1 ;;- Machine description for HP PA-RISC architecture for GCC compiler
2 ;; Copyright (C) 1992-2013 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"
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")
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")
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. Allow unconditional branches in the
186 (define_attr "in_call_delay" "false,true"
187 (cond [(and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,parallel_branch")
188 (eq_attr "length" "4")
189 (not (match_test "RTX_FRAME_RELATED_P (insn)")))
190 (const_string "true")
191 (eq_attr "type" "uncond_branch")
192 (if_then_else (match_test "TARGET_JUMP_IN_DELAY")
193 (const_string "true")
194 (const_string "false"))]
195 (const_string "false")))
198 ;; Call delay slot description.
199 (define_delay (eq_attr "type" "call")
200 [(eq_attr "in_call_delay" "true") (nil) (nil)])
202 ;; Sibcall delay slot description.
203 (define_delay (eq_attr "type" "sibcall")
204 [(eq_attr "in_call_delay" "true") (nil) (nil)])
206 ;; Millicode call delay slot description.
207 (define_delay (eq_attr "type" "milli")
208 [(eq_attr "in_call_delay" "true") (nil) (nil)])
210 ;; Return and other similar instructions.
211 (define_delay (eq_attr "type" "branch,parallel_branch")
212 [(eq_attr "in_branch_delay" "true") (nil) (nil)])
214 ;; Floating point conditional branch delay slot description.
215 (define_delay (eq_attr "type" "fbranch")
216 [(eq_attr "in_branch_delay" "true")
217 (eq_attr "in_nullified_branch_delay" "true")
220 ;; Integer conditional branch delay slot description.
221 ;; Nullification of conditional branches on the PA is dependent on the
222 ;; direction of the branch. Forward branches nullify true and
223 ;; backward branches nullify false. If the direction is unknown
224 ;; then nullification is not allowed.
225 (define_delay (eq_attr "type" "cbranch")
226 [(eq_attr "in_branch_delay" "true")
227 (and (eq_attr "in_nullified_branch_delay" "true")
228 (attr_flag "forward"))
229 (and (eq_attr "in_nullified_branch_delay" "true")
230 (attr_flag "backward"))])
232 (define_delay (and (eq_attr "type" "uncond_branch")
233 (not (match_test "pa_following_call (insn)")))
234 [(eq_attr "in_branch_delay" "true") (nil) (nil)])
236 ;; Memory. Disregarding Cache misses, the Mustang memory times are:
237 ;; load: 2, fpload: 3
238 ;; store, fpstore: 3, no D-cache operations should be scheduled.
240 ;; The Timex (aka 700) has two floating-point units: ALU, and MUL/DIV/SQRT.
242 ;; Instruction Time Unit Minimum Distance (unit contention)
249 ;; fmpyadd 3 ALU,MPY 2
250 ;; fmpysub 3 ALU,MPY 2
251 ;; fmpycfxt 3 ALU,MPY 2
254 ;; fdiv,sgl 10 MPY 10
255 ;; fdiv,dbl 12 MPY 12
256 ;; fsqrt,sgl 14 MPY 14
257 ;; fsqrt,dbl 18 MPY 18
259 ;; We don't model fmpyadd/fmpysub properly as those instructions
260 ;; keep both the FP ALU and MPY units busy. Given that these
261 ;; processors are obsolete, I'm not going to spend the time to
262 ;; model those instructions correctly.
264 (define_automaton "pa700")
265 (define_cpu_unit "dummy_700,mem_700,fpalu_700,fpmpy_700" "pa700")
267 (define_insn_reservation "W0" 4
268 (and (eq_attr "type" "fpcc")
269 (eq_attr "cpu" "700"))
272 (define_insn_reservation "W1" 3
273 (and (eq_attr "type" "fpalu")
274 (eq_attr "cpu" "700"))
277 (define_insn_reservation "W2" 3
278 (and (eq_attr "type" "fpmulsgl,fpmuldbl")
279 (eq_attr "cpu" "700"))
282 (define_insn_reservation "W3" 10
283 (and (eq_attr "type" "fpdivsgl")
284 (eq_attr "cpu" "700"))
287 (define_insn_reservation "W4" 12
288 (and (eq_attr "type" "fpdivdbl")
289 (eq_attr "cpu" "700"))
292 (define_insn_reservation "W5" 14
293 (and (eq_attr "type" "fpsqrtsgl")
294 (eq_attr "cpu" "700"))
297 (define_insn_reservation "W6" 18
298 (and (eq_attr "type" "fpsqrtdbl")
299 (eq_attr "cpu" "700"))
302 (define_insn_reservation "W7" 2
303 (and (eq_attr "type" "load")
304 (eq_attr "cpu" "700"))
307 (define_insn_reservation "W8" 2
308 (and (eq_attr "type" "fpload")
309 (eq_attr "cpu" "700"))
312 (define_insn_reservation "W9" 3
313 (and (eq_attr "type" "store")
314 (eq_attr "cpu" "700"))
317 (define_insn_reservation "W10" 3
318 (and (eq_attr "type" "fpstore")
319 (eq_attr "cpu" "700"))
322 (define_insn_reservation "W11" 5
323 (and (eq_attr "type" "fpstore_load")
324 (eq_attr "cpu" "700"))
327 (define_insn_reservation "W12" 6
328 (and (eq_attr "type" "store_fpload")
329 (eq_attr "cpu" "700"))
332 (define_insn_reservation "W13" 1
333 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,load,fpload,store,fpstore,fpstore_load,store_fpload")
334 (eq_attr "cpu" "700"))
337 ;; We have a bypass for all computations in the FP unit which feed an
338 ;; FP store as long as the sizes are the same.
339 (define_bypass 2 "W1,W2" "W10,W11" "pa_fpstore_bypass_p")
340 (define_bypass 9 "W3" "W10,W11" "pa_fpstore_bypass_p")
341 (define_bypass 11 "W4" "W10,W11" "pa_fpstore_bypass_p")
342 (define_bypass 13 "W5" "W10,W11" "pa_fpstore_bypass_p")
343 (define_bypass 17 "W6" "W10,W11" "pa_fpstore_bypass_p")
345 ;; We have an "anti-bypass" for FP loads which feed an FP store.
346 (define_bypass 4 "W8,W12" "W10,W11" "pa_fpstore_bypass_p")
348 ;; Function units for the 7100 and 7150. The 7100/7150 can dual-issue
349 ;; floating point computations with non-floating point computations (fp loads
350 ;; and stores are not fp computations).
352 ;; Memory. Disregarding Cache misses, memory loads take two cycles; stores also
353 ;; take two cycles, during which no Dcache operations should be scheduled.
354 ;; Any special cases are handled in pa_adjust_cost. The 7100, 7150 and 7100LC
355 ;; all have the same memory characteristics if one disregards cache misses.
357 ;; The 7100/7150 has three floating-point units: ALU, MUL, and DIV.
358 ;; There's no value in modeling the ALU and MUL separately though
359 ;; since there can never be a functional unit conflict given the
360 ;; latency and issue rates for those units.
363 ;; Instruction Time Unit Minimum Distance (unit contention)
370 ;; fmpyadd 2 ALU,MPY 1
371 ;; fmpysub 2 ALU,MPY 1
372 ;; fmpycfxt 2 ALU,MPY 1
376 ;; fdiv,dbl 15 DIV 15
378 ;; fsqrt,dbl 15 DIV 15
380 (define_automaton "pa7100")
381 (define_cpu_unit "i_7100, f_7100,fpmac_7100,fpdivsqrt_7100,mem_7100" "pa7100")
383 (define_insn_reservation "X0" 2
384 (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
385 (eq_attr "cpu" "7100"))
388 (define_insn_reservation "X1" 8
389 (and (eq_attr "type" "fpdivsgl,fpsqrtsgl")
390 (eq_attr "cpu" "7100"))
391 "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*7")
393 (define_insn_reservation "X2" 15
394 (and (eq_attr "type" "fpdivdbl,fpsqrtdbl")
395 (eq_attr "cpu" "7100"))
396 "f_7100+fpdivsqrt_7100,fpdivsqrt_7100*14")
398 (define_insn_reservation "X3" 2
399 (and (eq_attr "type" "load")
400 (eq_attr "cpu" "7100"))
403 (define_insn_reservation "X4" 2
404 (and (eq_attr "type" "fpload")
405 (eq_attr "cpu" "7100"))
408 (define_insn_reservation "X5" 2
409 (and (eq_attr "type" "store")
410 (eq_attr "cpu" "7100"))
411 "i_7100+mem_7100,mem_7100")
413 (define_insn_reservation "X6" 2
414 (and (eq_attr "type" "fpstore")
415 (eq_attr "cpu" "7100"))
416 "i_7100+mem_7100,mem_7100")
418 (define_insn_reservation "X7" 4
419 (and (eq_attr "type" "fpstore_load")
420 (eq_attr "cpu" "7100"))
421 "i_7100+mem_7100,mem_7100*3")
423 (define_insn_reservation "X8" 4
424 (and (eq_attr "type" "store_fpload")
425 (eq_attr "cpu" "7100"))
426 "i_7100+mem_7100,mem_7100*3")
428 (define_insn_reservation "X9" 1
429 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore,fpstore_load,store_fpload")
430 (eq_attr "cpu" "7100"))
433 ;; We have a bypass for all computations in the FP unit which feed an
434 ;; FP store as long as the sizes are the same.
435 (define_bypass 1 "X0" "X6,X7" "pa_fpstore_bypass_p")
436 (define_bypass 7 "X1" "X6,X7" "pa_fpstore_bypass_p")
437 (define_bypass 14 "X2" "X6,X7" "pa_fpstore_bypass_p")
439 ;; We have an "anti-bypass" for FP loads which feed an FP store.
440 (define_bypass 3 "X4,X8" "X6,X7" "pa_fpstore_bypass_p")
442 ;; The 7100LC has three floating-point units: ALU, MUL, and DIV.
443 ;; There's no value in modeling the ALU and MUL separately though
444 ;; since there can never be a functional unit conflict that
445 ;; can be avoided given the latency, issue rates and mandatory
446 ;; one cycle cpu-wide lock for a double precision fp multiply.
449 ;; Instruction Time Unit Minimum Distance (unit contention)
456 ;; fmpyadd,sgl 2 ALU,MPY 1
457 ;; fmpyadd,dbl 3 ALU,MPY 2
458 ;; fmpysub,sgl 2 ALU,MPY 1
459 ;; fmpysub,dbl 3 ALU,MPY 2
460 ;; fmpycfxt,sgl 2 ALU,MPY 1
461 ;; fmpycfxt,dbl 3 ALU,MPY 2
466 ;; fdiv,dbl 15 DIV 15
468 ;; fsqrt,dbl 15 DIV 15
470 ;; The PA7200 is just like the PA7100LC except that there is
471 ;; no store-store penalty.
473 ;; The PA7300 is just like the PA7200 except that there is
474 ;; no store-load penalty.
476 ;; Note there are some aspects of the 7100LC we are not modeling
477 ;; at the moment. I'll be reviewing the 7100LC scheduling info
478 ;; shortly and updating this description.
482 ;; other issue modeling
484 (define_automaton "pa7100lc")
485 (define_cpu_unit "i0_7100lc, i1_7100lc, f_7100lc" "pa7100lc")
486 (define_cpu_unit "fpmac_7100lc" "pa7100lc")
487 (define_cpu_unit "mem_7100lc" "pa7100lc")
489 ;; Double precision multiplies lock the entire CPU for one
490 ;; cycle. There is no way to avoid this lock and trying to
491 ;; schedule around the lock is pointless and thus there is no
492 ;; value in trying to model this lock.
494 ;; Not modeling the lock allows us to treat fp multiplies just
495 ;; like any other FP alu instruction. It allows for a smaller
496 ;; DFA and may reduce register pressure.
497 (define_insn_reservation "Y0" 2
498 (and (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
499 (eq_attr "cpu" "7100LC,7200,7300"))
500 "f_7100lc,fpmac_7100lc")
502 ;; fp division and sqrt instructions lock the entire CPU for
503 ;; 7 cycles (single precision) or 14 cycles (double precision).
504 ;; There is no way to avoid this lock and trying to schedule
505 ;; around the lock is pointless and thus there is no value in
506 ;; trying to model this lock. Not modeling the lock allows
507 ;; for a smaller DFA and may reduce register pressure.
508 (define_insn_reservation "Y1" 1
509 (and (eq_attr "type" "fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl")
510 (eq_attr "cpu" "7100LC,7200,7300"))
513 (define_insn_reservation "Y2" 2
514 (and (eq_attr "type" "load")
515 (eq_attr "cpu" "7100LC,7200,7300"))
516 "i1_7100lc+mem_7100lc")
518 (define_insn_reservation "Y3" 2
519 (and (eq_attr "type" "fpload")
520 (eq_attr "cpu" "7100LC,7200,7300"))
521 "i1_7100lc+mem_7100lc")
523 (define_insn_reservation "Y4" 2
524 (and (eq_attr "type" "store")
525 (eq_attr "cpu" "7100LC"))
526 "i1_7100lc+mem_7100lc,mem_7100lc")
528 (define_insn_reservation "Y5" 2
529 (and (eq_attr "type" "fpstore")
530 (eq_attr "cpu" "7100LC"))
531 "i1_7100lc+mem_7100lc,mem_7100lc")
533 (define_insn_reservation "Y6" 4
534 (and (eq_attr "type" "fpstore_load")
535 (eq_attr "cpu" "7100LC"))
536 "i1_7100lc+mem_7100lc,mem_7100lc*3")
538 (define_insn_reservation "Y7" 4
539 (and (eq_attr "type" "store_fpload")
540 (eq_attr "cpu" "7100LC"))
541 "i1_7100lc+mem_7100lc,mem_7100lc*3")
543 (define_insn_reservation "Y8" 1
544 (and (eq_attr "type" "shift,nullshift")
545 (eq_attr "cpu" "7100LC,7200,7300"))
548 (define_insn_reservation "Y9" 1
549 (and (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore,shift,nullshift")
550 (eq_attr "cpu" "7100LC,7200,7300"))
551 "(i0_7100lc|i1_7100lc)")
553 ;; The 7200 has a store-load penalty
554 (define_insn_reservation "Y10" 2
555 (and (eq_attr "type" "store")
556 (eq_attr "cpu" "7200"))
557 "i1_7100lc,mem_7100lc")
559 (define_insn_reservation "Y11" 2
560 (and (eq_attr "type" "fpstore")
561 (eq_attr "cpu" "7200"))
562 "i1_7100lc,mem_7100lc")
564 (define_insn_reservation "Y12" 4
565 (and (eq_attr "type" "fpstore_load")
566 (eq_attr "cpu" "7200"))
567 "i1_7100lc,mem_7100lc,i1_7100lc+mem_7100lc")
569 (define_insn_reservation "Y13" 4
570 (and (eq_attr "type" "store_fpload")
571 (eq_attr "cpu" "7200"))
572 "i1_7100lc,mem_7100lc,i1_7100lc+mem_7100lc")
574 ;; The 7300 has no penalty for store-store or store-load
575 (define_insn_reservation "Y14" 2
576 (and (eq_attr "type" "store")
577 (eq_attr "cpu" "7300"))
580 (define_insn_reservation "Y15" 2
581 (and (eq_attr "type" "fpstore")
582 (eq_attr "cpu" "7300"))
585 (define_insn_reservation "Y16" 4
586 (and (eq_attr "type" "fpstore_load")
587 (eq_attr "cpu" "7300"))
588 "i1_7100lc,i1_7100lc+mem_7100lc")
590 (define_insn_reservation "Y17" 4
591 (and (eq_attr "type" "store_fpload")
592 (eq_attr "cpu" "7300"))
593 "i1_7100lc,i1_7100lc+mem_7100lc")
595 ;; We have an "anti-bypass" for FP loads which feed an FP store.
596 (define_bypass 3 "Y3,Y7,Y13,Y17" "Y5,Y6,Y11,Y12,Y15,Y16" "pa_fpstore_bypass_p")
598 ;; Scheduling for the PA8000 is somewhat different than scheduling for a
599 ;; traditional architecture.
601 ;; The PA8000 has a large (56) entry reorder buffer that is split between
602 ;; memory and non-memory operations.
604 ;; The PA8000 can issue two memory and two non-memory operations per cycle to
605 ;; the function units, with the exception of branches and multi-output
606 ;; instructions. The PA8000 can retire two non-memory operations per cycle
607 ;; and two memory operations per cycle, only one of which may be a store.
609 ;; Given the large reorder buffer, the processor can hide most latencies.
610 ;; According to HP, they've got the best results by scheduling for retirement
611 ;; bandwidth with limited latency scheduling for floating point operations.
612 ;; Latency for integer operations and memory references is ignored.
615 ;; We claim floating point operations have a 2 cycle latency and are
616 ;; fully pipelined, except for div and sqrt which are not pipelined and
617 ;; take from 17 to 31 cycles to complete.
619 ;; It's worth noting that there is no way to saturate all the functional
620 ;; units on the PA8000 as there is not enough issue bandwidth.
622 (define_automaton "pa8000")
623 (define_cpu_unit "inm0_8000, inm1_8000, im0_8000, im1_8000" "pa8000")
624 (define_cpu_unit "rnm0_8000, rnm1_8000, rm0_8000, rm1_8000" "pa8000")
625 (define_cpu_unit "store_8000" "pa8000")
626 (define_cpu_unit "f0_8000, f1_8000" "pa8000")
627 (define_cpu_unit "fdivsqrt0_8000, fdivsqrt1_8000" "pa8000")
628 (define_reservation "inm_8000" "inm0_8000 | inm1_8000")
629 (define_reservation "im_8000" "im0_8000 | im1_8000")
630 (define_reservation "rnm_8000" "rnm0_8000 | rnm1_8000")
631 (define_reservation "rm_8000" "rm0_8000 | rm1_8000")
632 (define_reservation "f_8000" "f0_8000 | f1_8000")
633 (define_reservation "fdivsqrt_8000" "fdivsqrt0_8000 | fdivsqrt1_8000")
635 ;; We can issue any two memops per cycle, but we can only retire
636 ;; one memory store per cycle. We assume that the reorder buffer
637 ;; will hide any memory latencies per HP's recommendation.
638 (define_insn_reservation "Z0" 0
640 (eq_attr "type" "load,fpload")
641 (eq_attr "cpu" "8000"))
644 (define_insn_reservation "Z1" 0
646 (eq_attr "type" "store,fpstore")
647 (eq_attr "cpu" "8000"))
648 "im_8000,rm_8000+store_8000")
650 (define_insn_reservation "Z2" 0
651 (and (eq_attr "type" "fpstore_load,store_fpload")
652 (eq_attr "cpu" "8000"))
653 "im_8000,rm_8000+store_8000,im_8000,rm_8000")
655 ;; We can issue and retire two non-memory operations per cycle with
656 ;; a few exceptions (branches). This group catches those we want
657 ;; to assume have zero latency.
658 (define_insn_reservation "Z3" 0
660 (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")
661 (eq_attr "cpu" "8000"))
664 ;; Branches use both slots in the non-memory issue and
666 (define_insn_reservation "Z4" 0
668 (eq_attr "type" "uncond_branch,branch,cbranch,fbranch,call,sibcall,dyncall,multi,milli,sh_func_adrs,parallel_branch")
669 (eq_attr "cpu" "8000"))
670 "inm0_8000+inm1_8000,rnm0_8000+rnm1_8000")
672 ;; We partial latency schedule the floating point units.
673 ;; They can issue/retire two at a time in the non-memory
674 ;; units. We fix their latency at 2 cycles and they
675 ;; are fully pipelined.
676 (define_insn_reservation "Z5" 1
678 (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl")
679 (eq_attr "cpu" "8000"))
680 "inm_8000,f_8000,rnm_8000")
682 ;; The fdivsqrt units are not pipelined and have a very long latency.
683 ;; To keep the DFA from exploding, we do not show all the
684 ;; reservations for the divsqrt unit.
685 (define_insn_reservation "Z6" 17
687 (eq_attr "type" "fpdivsgl,fpsqrtsgl")
688 (eq_attr "cpu" "8000"))
689 "inm_8000,fdivsqrt_8000*6,rnm_8000")
691 (define_insn_reservation "Z7" 31
693 (eq_attr "type" "fpdivdbl,fpsqrtdbl")
694 (eq_attr "cpu" "8000"))
695 "inm_8000,fdivsqrt_8000*6,rnm_8000")
697 ;; Operand and operator predicates and constraints
699 (include "predicates.md")
700 (include "constraints.md")
702 ;; Atomic instructions
704 ;; All memory loads and stores access storage atomically except
705 ;; for one exception. The STORE BYTES, STORE DOUBLE BYTES, and
706 ;; doubleword loads and stores are not guaranteed to be atomic
707 ;; when referencing the I/O address space.
709 ;; Implement atomic DImode load using 64-bit floating point load and copy.
711 (define_expand "atomic_loaddi"
712 [(match_operand:DI 0 "register_operand") ;; val out
713 (match_operand:DI 1 "memory_operand") ;; memory
714 (match_operand:SI 2 "const_int_operand")] ;; model
715 "!TARGET_64BIT && !TARGET_SOFT_FLOAT"
717 enum memmodel model = (enum memmodel) INTVAL (operands[2]);
718 operands[1] = force_reg (SImode, XEXP (operands[1], 0));
719 operands[2] = gen_reg_rtx (DImode);
720 expand_mem_thread_fence (model);
721 emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1], operands[2]));
722 if ((model & MEMMODEL_MASK) == MEMMODEL_SEQ_CST)
723 expand_mem_thread_fence (model);
727 (define_insn "atomic_loaddi_1"
728 [(set (match_operand:DI 0 "register_operand" "=r")
729 (mem:DI (match_operand:SI 1 "register_operand" "r")))
730 (clobber (match_operand:DI 2 "register_operand" "=&f"))]
731 "!TARGET_64BIT && !TARGET_SOFT_FLOAT"
732 "{fldds|fldd} 0(%1),%2\;{fstds|fstd} %2,-16(%%sp)\;{ldws|ldw} -16(%%sp),%0\;{ldws|ldw} -12(%%sp),%R0"
733 [(set_attr "type" "move")
734 (set_attr "length" "16")])
736 ;; Implement atomic DImode store using copy and 64-bit floating point store.
738 (define_expand "atomic_storedi"
739 [(match_operand:DI 0 "memory_operand") ;; memory
740 (match_operand:DI 1 "register_operand") ;; val out
741 (match_operand:SI 2 "const_int_operand")] ;; model
742 "!TARGET_64BIT && !TARGET_SOFT_FLOAT"
744 enum memmodel model = (enum memmodel) INTVAL (operands[2]);
745 operands[0] = force_reg (SImode, XEXP (operands[0], 0));
746 operands[2] = gen_reg_rtx (DImode);
747 expand_mem_thread_fence (model);
748 emit_insn (gen_atomic_storedi_1 (operands[0], operands[1], operands[2]));
749 if ((model & MEMMODEL_MASK) == MEMMODEL_SEQ_CST)
750 expand_mem_thread_fence (model);
754 (define_insn "atomic_storedi_1"
755 [(set (mem:DI (match_operand:SI 0 "register_operand" "r"))
756 (match_operand:DI 1 "register_operand" "r"))
757 (clobber (match_operand:DI 2 "register_operand" "=&f"))]
758 "!TARGET_64BIT && !TARGET_SOFT_FLOAT"
759 "{stws|stw} %1,-16(%%sp)\;{stws|stw} %R1,-12(%%sp)\;{fldds|fldd} -16(%%sp),%2\;{fstds|fstd} %2,0(%0)"
760 [(set_attr "type" "move")
761 (set_attr "length" "16")])
763 ;; Compare instructions.
764 ;; This controls RTL generation and register allocation.
768 (match_operator:CCFP 2 "comparison_operator"
769 [(match_operand:SF 0 "reg_or_0_operand" "fG")
770 (match_operand:SF 1 "reg_or_0_operand" "fG")]))]
771 "! TARGET_SOFT_FLOAT"
772 "fcmp,sgl,%Y2 %f0,%f1"
773 [(set_attr "length" "4")
774 (set_attr "type" "fpcc")])
778 (match_operator:CCFP 2 "comparison_operator"
779 [(match_operand:DF 0 "reg_or_0_operand" "fG")
780 (match_operand:DF 1 "reg_or_0_operand" "fG")]))]
781 "! TARGET_SOFT_FLOAT"
782 "fcmp,dbl,%Y2 %f0,%f1"
783 [(set_attr "length" "4")
784 (set_attr "type" "fpcc")])
786 ;; Provide a means to emit the movccfp0 and movccfp1 optimization
787 ;; placeholders. This is necessary in rare situations when a
788 ;; placeholder is re-emitted (see PR 8705).
790 (define_expand "movccfp"
792 (match_operand 0 "const_int_operand" ""))]
793 "! TARGET_SOFT_FLOAT"
796 if ((unsigned HOST_WIDE_INT) INTVAL (operands[0]) > 1)
800 ;; The following patterns are optimization placeholders. In almost
801 ;; all cases, the user of the condition code will be simplified and the
802 ;; original condition code setting insn should be eliminated.
804 (define_insn "*movccfp0"
807 "! TARGET_SOFT_FLOAT"
808 "fcmp,dbl,= %%fr0,%%fr0"
809 [(set_attr "length" "4")
810 (set_attr "type" "fpcc")])
812 (define_insn "*movccfp1"
815 "! TARGET_SOFT_FLOAT"
816 "fcmp,dbl,!= %%fr0,%%fr0"
817 [(set_attr "length" "4")
818 (set_attr "type" "fpcc")])
822 (define_expand "cstoresi4"
823 [(set (match_operand:SI 0 "register_operand")
824 (match_operator:SI 1 "ordered_comparison_operator"
825 [(match_operand:SI 2 "reg_or_0_operand" "")
826 (match_operand:SI 3 "arith5_operand" "")]))]
830 ;; Instruction canonicalization puts immediate operands second, which
831 ;; is the reverse of what we want.
834 [(set (match_operand:SI 0 "register_operand" "=r")
835 (match_operator:SI 3 "comparison_operator"
836 [(match_operand:SI 1 "register_operand" "r")
837 (match_operand:SI 2 "arith11_operand" "rI")]))]
839 "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi 1,%0"
840 [(set_attr "type" "binary")
841 (set_attr "length" "8")])
844 [(set (match_operand:DI 0 "register_operand" "=r")
845 (match_operator:DI 3 "comparison_operator"
846 [(match_operand:DI 1 "register_operand" "r")
847 (match_operand:DI 2 "arith11_operand" "rI")]))]
849 "cmp%I2clr,*%B3 %2,%1,%0\;ldi 1,%0"
850 [(set_attr "type" "binary")
851 (set_attr "length" "8")])
853 (define_insn "iorscc"
854 [(set (match_operand:SI 0 "register_operand" "=r")
855 (ior:SI (match_operator:SI 3 "comparison_operator"
856 [(match_operand:SI 1 "register_operand" "r")
857 (match_operand:SI 2 "arith11_operand" "rI")])
858 (match_operator:SI 6 "comparison_operator"
859 [(match_operand:SI 4 "register_operand" "r")
860 (match_operand:SI 5 "arith11_operand" "rI")])))]
862 "{com%I2clr|cmp%I2clr},%S3 %2,%1,%%r0\;{com%I5clr|cmp%I5clr},%B6 %5,%4,%0\;ldi 1,%0"
863 [(set_attr "type" "binary")
864 (set_attr "length" "12")])
867 [(set (match_operand:DI 0 "register_operand" "=r")
868 (ior:DI (match_operator:DI 3 "comparison_operator"
869 [(match_operand:DI 1 "register_operand" "r")
870 (match_operand:DI 2 "arith11_operand" "rI")])
871 (match_operator:DI 6 "comparison_operator"
872 [(match_operand:DI 4 "register_operand" "r")
873 (match_operand:DI 5 "arith11_operand" "rI")])))]
875 "cmp%I2clr,*%S3 %2,%1,%%r0\;cmp%I5clr,*%B6 %5,%4,%0\;ldi 1,%0"
876 [(set_attr "type" "binary")
877 (set_attr "length" "12")])
879 ;; Combiner patterns for common operations performed with the output
880 ;; from an scc insn (negscc and incscc).
881 (define_insn "negscc"
882 [(set (match_operand:SI 0 "register_operand" "=r")
883 (neg:SI (match_operator:SI 3 "comparison_operator"
884 [(match_operand:SI 1 "register_operand" "r")
885 (match_operand:SI 2 "arith11_operand" "rI")])))]
887 "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi -1,%0"
888 [(set_attr "type" "binary")
889 (set_attr "length" "8")])
892 [(set (match_operand:DI 0 "register_operand" "=r")
893 (neg:DI (match_operator:DI 3 "comparison_operator"
894 [(match_operand:DI 1 "register_operand" "r")
895 (match_operand:DI 2 "arith11_operand" "rI")])))]
897 "cmp%I2clr,*%B3 %2,%1,%0\;ldi -1,%0"
898 [(set_attr "type" "binary")
899 (set_attr "length" "8")])
901 ;; Patterns for adding/subtracting the result of a boolean expression from
902 ;; a register. First we have special patterns that make use of the carry
903 ;; bit, and output only two instructions. For the cases we can't in
904 ;; general do in two instructions, the incscc pattern at the end outputs
905 ;; two or three instructions.
908 [(set (match_operand:SI 0 "register_operand" "=r")
909 (plus:SI (leu:SI (match_operand:SI 2 "register_operand" "r")
910 (match_operand:SI 3 "arith11_operand" "rI"))
911 (match_operand:SI 1 "register_operand" "r")))]
913 "sub%I3 %3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
914 [(set_attr "type" "binary")
915 (set_attr "length" "8")])
918 [(set (match_operand:DI 0 "register_operand" "=r")
919 (plus:DI (leu:DI (match_operand:DI 2 "register_operand" "r")
920 (match_operand:DI 3 "arith11_operand" "rI"))
921 (match_operand:DI 1 "register_operand" "r")))]
923 "sub%I3 %3,%2,%%r0\;add,dc %%r0,%1,%0"
924 [(set_attr "type" "binary")
925 (set_attr "length" "8")])
927 ; This need only accept registers for op3, since canonicalization
928 ; replaces geu with gtu when op3 is an integer.
930 [(set (match_operand:SI 0 "register_operand" "=r")
931 (plus:SI (geu:SI (match_operand:SI 2 "register_operand" "r")
932 (match_operand:SI 3 "register_operand" "r"))
933 (match_operand:SI 1 "register_operand" "r")))]
935 "sub %2,%3,%%r0\;{addc|add,c} %%r0,%1,%0"
936 [(set_attr "type" "binary")
937 (set_attr "length" "8")])
940 [(set (match_operand:DI 0 "register_operand" "=r")
941 (plus:DI (geu:DI (match_operand:DI 2 "register_operand" "r")
942 (match_operand:DI 3 "register_operand" "r"))
943 (match_operand:DI 1 "register_operand" "r")))]
945 "sub %2,%3,%%r0\;add,dc %%r0,%1,%0"
946 [(set_attr "type" "binary")
947 (set_attr "length" "8")])
949 ; Match only integers for op3 here. This is used as canonical form of the
950 ; geu pattern when op3 is an integer. Don't match registers since we can't
951 ; make better code than the general incscc pattern.
953 [(set (match_operand:SI 0 "register_operand" "=r")
954 (plus:SI (gtu:SI (match_operand:SI 2 "register_operand" "r")
955 (match_operand:SI 3 "int11_operand" "I"))
956 (match_operand:SI 1 "register_operand" "r")))]
958 "addi %k3,%2,%%r0\;{addc|add,c} %%r0,%1,%0"
959 [(set_attr "type" "binary")
960 (set_attr "length" "8")])
963 [(set (match_operand:DI 0 "register_operand" "=r")
964 (plus:DI (gtu:DI (match_operand:DI 2 "register_operand" "r")
965 (match_operand:DI 3 "int11_operand" "I"))
966 (match_operand:DI 1 "register_operand" "r")))]
968 "addi %k3,%2,%%r0\;add,dc %%r0,%1,%0"
969 [(set_attr "type" "binary")
970 (set_attr "length" "8")])
972 (define_insn "incscc"
973 [(set (match_operand:SI 0 "register_operand" "=r,r")
974 (plus:SI (match_operator:SI 4 "comparison_operator"
975 [(match_operand:SI 2 "register_operand" "r,r")
976 (match_operand:SI 3 "arith11_operand" "rI,rI")])
977 (match_operand:SI 1 "register_operand" "0,?r")))]
980 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi 1,%0,%0
981 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
982 [(set_attr "type" "binary,binary")
983 (set_attr "length" "8,12")])
986 [(set (match_operand:DI 0 "register_operand" "=r,r")
987 (plus:DI (match_operator:DI 4 "comparison_operator"
988 [(match_operand:DI 2 "register_operand" "r,r")
989 (match_operand:DI 3 "arith11_operand" "rI,rI")])
990 (match_operand:DI 1 "register_operand" "0,?r")))]
993 cmp%I3clr,*%B4 %3,%2,%%r0\;addi 1,%0,%0
994 cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr 1,%1,%0\;copy %1,%0"
995 [(set_attr "type" "binary,binary")
996 (set_attr "length" "8,12")])
999 [(set (match_operand:SI 0 "register_operand" "=r")
1000 (minus:SI (match_operand:SI 1 "register_operand" "r")
1001 (gtu:SI (match_operand:SI 2 "register_operand" "r")
1002 (match_operand:SI 3 "arith11_operand" "rI"))))]
1004 "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
1005 [(set_attr "type" "binary")
1006 (set_attr "length" "8")])
1009 [(set (match_operand:DI 0 "register_operand" "=r")
1010 (minus:DI (match_operand:DI 1 "register_operand" "r")
1011 (gtu:DI (match_operand:DI 2 "register_operand" "r")
1012 (match_operand:DI 3 "arith11_operand" "rI"))))]
1014 "sub%I3 %3,%2,%%r0\;sub,db %1,%%r0,%0"
1015 [(set_attr "type" "binary")
1016 (set_attr "length" "8")])
1019 [(set (match_operand:SI 0 "register_operand" "=r")
1020 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1021 (gtu:SI (match_operand:SI 2 "register_operand" "r")
1022 (match_operand:SI 3 "arith11_operand" "rI")))
1023 (match_operand:SI 4 "register_operand" "r")))]
1025 "sub%I3 %3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
1026 [(set_attr "type" "binary")
1027 (set_attr "length" "8")])
1030 [(set (match_operand:DI 0 "register_operand" "=r")
1031 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1032 (gtu:DI (match_operand:DI 2 "register_operand" "r")
1033 (match_operand:DI 3 "arith11_operand" "rI")))
1034 (match_operand:DI 4 "register_operand" "r")))]
1036 "sub%I3 %3,%2,%%r0\;sub,db %1,%4,%0"
1037 [(set_attr "type" "binary")
1038 (set_attr "length" "8")])
1040 ; This need only accept registers for op3, since canonicalization
1041 ; replaces ltu with leu when op3 is an integer.
1043 [(set (match_operand:SI 0 "register_operand" "=r")
1044 (minus:SI (match_operand:SI 1 "register_operand" "r")
1045 (ltu:SI (match_operand:SI 2 "register_operand" "r")
1046 (match_operand:SI 3 "register_operand" "r"))))]
1048 "sub %2,%3,%%r0\;{subb|sub,b} %1,%%r0,%0"
1049 [(set_attr "type" "binary")
1050 (set_attr "length" "8")])
1053 [(set (match_operand:DI 0 "register_operand" "=r")
1054 (minus:DI (match_operand:DI 1 "register_operand" "r")
1055 (ltu:DI (match_operand:DI 2 "register_operand" "r")
1056 (match_operand:DI 3 "register_operand" "r"))))]
1058 "sub %2,%3,%%r0\;sub,db %1,%%r0,%0"
1059 [(set_attr "type" "binary")
1060 (set_attr "length" "8")])
1063 [(set (match_operand:SI 0 "register_operand" "=r")
1064 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1065 (ltu:SI (match_operand:SI 2 "register_operand" "r")
1066 (match_operand:SI 3 "register_operand" "r")))
1067 (match_operand:SI 4 "register_operand" "r")))]
1069 "sub %2,%3,%%r0\;{subb|sub,b} %1,%4,%0"
1070 [(set_attr "type" "binary")
1071 (set_attr "length" "8")])
1074 [(set (match_operand:DI 0 "register_operand" "=r")
1075 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1076 (ltu:DI (match_operand:DI 2 "register_operand" "r")
1077 (match_operand:DI 3 "register_operand" "r")))
1078 (match_operand:DI 4 "register_operand" "r")))]
1080 "sub %2,%3,%%r0\;sub,db %1,%4,%0"
1081 [(set_attr "type" "binary")
1082 (set_attr "length" "8")])
1084 ; Match only integers for op3 here. This is used as canonical form of the
1085 ; ltu pattern when op3 is an integer. Don't match registers since we can't
1086 ; make better code than the general incscc pattern.
1088 [(set (match_operand:SI 0 "register_operand" "=r")
1089 (minus:SI (match_operand:SI 1 "register_operand" "r")
1090 (leu:SI (match_operand:SI 2 "register_operand" "r")
1091 (match_operand:SI 3 "int11_operand" "I"))))]
1093 "addi %k3,%2,%%r0\;{subb|sub,b} %1,%%r0,%0"
1094 [(set_attr "type" "binary")
1095 (set_attr "length" "8")])
1098 [(set (match_operand:DI 0 "register_operand" "=r")
1099 (minus:DI (match_operand:DI 1 "register_operand" "r")
1100 (leu:DI (match_operand:DI 2 "register_operand" "r")
1101 (match_operand:DI 3 "int11_operand" "I"))))]
1103 "addi %k3,%2,%%r0\;sub,db %1,%%r0,%0"
1104 [(set_attr "type" "binary")
1105 (set_attr "length" "8")])
1108 [(set (match_operand:SI 0 "register_operand" "=r")
1109 (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
1110 (leu:SI (match_operand:SI 2 "register_operand" "r")
1111 (match_operand:SI 3 "int11_operand" "I")))
1112 (match_operand:SI 4 "register_operand" "r")))]
1114 "addi %k3,%2,%%r0\;{subb|sub,b} %1,%4,%0"
1115 [(set_attr "type" "binary")
1116 (set_attr "length" "8")])
1119 [(set (match_operand:DI 0 "register_operand" "=r")
1120 (minus:DI (minus:DI (match_operand:DI 1 "register_operand" "r")
1121 (leu:DI (match_operand:DI 2 "register_operand" "r")
1122 (match_operand:DI 3 "int11_operand" "I")))
1123 (match_operand:DI 4 "register_operand" "r")))]
1125 "addi %k3,%2,%%r0\;sub,db %1,%4,%0"
1126 [(set_attr "type" "binary")
1127 (set_attr "length" "8")])
1129 (define_insn "decscc"
1130 [(set (match_operand:SI 0 "register_operand" "=r,r")
1131 (minus:SI (match_operand:SI 1 "register_operand" "0,?r")
1132 (match_operator:SI 4 "comparison_operator"
1133 [(match_operand:SI 2 "register_operand" "r,r")
1134 (match_operand:SI 3 "arith11_operand" "rI,rI")])))]
1137 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi -1,%0,%0
1138 {com%I3clr|cmp%I3clr},%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1139 [(set_attr "type" "binary,binary")
1140 (set_attr "length" "8,12")])
1143 [(set (match_operand:DI 0 "register_operand" "=r,r")
1144 (minus:DI (match_operand:DI 1 "register_operand" "0,?r")
1145 (match_operator:DI 4 "comparison_operator"
1146 [(match_operand:DI 2 "register_operand" "r,r")
1147 (match_operand:DI 3 "arith11_operand" "rI,rI")])))]
1150 cmp%I3clr,*%B4 %3,%2,%%r0\;addi -1,%0,%0
1151 cmp%I3clr,*%B4 %3,%2,%%r0\;addi,tr -1,%1,%0\;copy %1,%0"
1152 [(set_attr "type" "binary,binary")
1153 (set_attr "length" "8,12")])
1155 ; Patterns for max and min. (There is no need for an earlyclobber in the
1156 ; last alternative since the middle alternative will match if op0 == op1.)
1158 (define_insn "sminsi3"
1159 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1160 (smin:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1161 (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1164 {comclr|cmpclr},> %2,%0,%%r0\;copy %2,%0
1165 {comiclr|cmpiclr},> %2,%0,%%r0\;ldi %2,%0
1166 {comclr|cmpclr},> %1,%r2,%0\;copy %1,%0"
1167 [(set_attr "type" "multi,multi,multi")
1168 (set_attr "length" "8,8,8")])
1170 (define_insn "smindi3"
1171 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1172 (smin:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1173 (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1176 cmpclr,*> %2,%0,%%r0\;copy %2,%0
1177 cmpiclr,*> %2,%0,%%r0\;ldi %2,%0
1178 cmpclr,*> %1,%r2,%0\;copy %1,%0"
1179 [(set_attr "type" "multi,multi,multi")
1180 (set_attr "length" "8,8,8")])
1182 (define_insn "uminsi3"
1183 [(set (match_operand:SI 0 "register_operand" "=r,r")
1184 (umin:SI (match_operand:SI 1 "register_operand" "%0,0")
1185 (match_operand:SI 2 "arith11_operand" "r,I")))]
1188 {comclr|cmpclr},>> %2,%0,%%r0\;copy %2,%0
1189 {comiclr|cmpiclr},>> %2,%0,%%r0\;ldi %2,%0"
1190 [(set_attr "type" "multi,multi")
1191 (set_attr "length" "8,8")])
1193 (define_insn "umindi3"
1194 [(set (match_operand:DI 0 "register_operand" "=r,r")
1195 (umin:DI (match_operand:DI 1 "register_operand" "%0,0")
1196 (match_operand:DI 2 "arith11_operand" "r,I")))]
1199 cmpclr,*>> %2,%0,%%r0\;copy %2,%0
1200 cmpiclr,*>> %2,%0,%%r0\;ldi %2,%0"
1201 [(set_attr "type" "multi,multi")
1202 (set_attr "length" "8,8")])
1204 (define_insn "smaxsi3"
1205 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1206 (smax:SI (match_operand:SI 1 "register_operand" "%0,0,r")
1207 (match_operand:SI 2 "arith11_operand" "r,I,M")))]
1210 {comclr|cmpclr},< %2,%0,%%r0\;copy %2,%0
1211 {comiclr|cmpiclr},< %2,%0,%%r0\;ldi %2,%0
1212 {comclr|cmpclr},< %1,%r2,%0\;copy %1,%0"
1213 [(set_attr "type" "multi,multi,multi")
1214 (set_attr "length" "8,8,8")])
1216 (define_insn "smaxdi3"
1217 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1218 (smax:DI (match_operand:DI 1 "register_operand" "%0,0,r")
1219 (match_operand:DI 2 "arith11_operand" "r,I,M")))]
1222 cmpclr,*< %2,%0,%%r0\;copy %2,%0
1223 cmpiclr,*< %2,%0,%%r0\;ldi %2,%0
1224 cmpclr,*< %1,%r2,%0\;copy %1,%0"
1225 [(set_attr "type" "multi,multi,multi")
1226 (set_attr "length" "8,8,8")])
1228 (define_insn "umaxsi3"
1229 [(set (match_operand:SI 0 "register_operand" "=r,r")
1230 (umax:SI (match_operand:SI 1 "register_operand" "%0,0")
1231 (match_operand:SI 2 "arith11_operand" "r,I")))]
1234 {comclr|cmpclr},<< %2,%0,%%r0\;copy %2,%0
1235 {comiclr|cmpiclr},<< %2,%0,%%r0\;ldi %2,%0"
1236 [(set_attr "type" "multi,multi")
1237 (set_attr "length" "8,8")])
1239 (define_insn "umaxdi3"
1240 [(set (match_operand:DI 0 "register_operand" "=r,r")
1241 (umax:DI (match_operand:DI 1 "register_operand" "%0,0")
1242 (match_operand:DI 2 "arith11_operand" "r,I")))]
1245 cmpclr,*<< %2,%0,%%r0\;copy %2,%0
1246 cmpiclr,*<< %2,%0,%%r0\;ldi %2,%0"
1247 [(set_attr "type" "multi,multi")
1248 (set_attr "length" "8,8")])
1250 (define_insn "abssi2"
1251 [(set (match_operand:SI 0 "register_operand" "=r")
1252 (abs:SI (match_operand:SI 1 "register_operand" "r")))]
1254 "or,>= %%r0,%1,%0\;subi 0,%0,%0"
1255 [(set_attr "type" "multi")
1256 (set_attr "length" "8")])
1258 (define_insn "absdi2"
1259 [(set (match_operand:DI 0 "register_operand" "=r")
1260 (abs:DI (match_operand:DI 1 "register_operand" "r")))]
1262 "or,*>= %%r0,%1,%0\;subi 0,%0,%0"
1263 [(set_attr "type" "multi")
1264 (set_attr "length" "8")])
1266 ;;; Experimental conditional move patterns
1268 (define_expand "movsicc"
1269 [(set (match_operand:SI 0 "register_operand" "")
1271 (match_operand 1 "comparison_operator" "")
1272 (match_operand:SI 2 "reg_or_cint_move_operand" "")
1273 (match_operand:SI 3 "reg_or_cint_move_operand" "")))]
1277 if (GET_MODE (XEXP (operands[1], 0)) != SImode
1278 || GET_MODE (XEXP (operands[1], 0)) != GET_MODE (XEXP (operands[1], 1)))
1282 ;; We used to accept any register for op1.
1284 ;; However, it loses sometimes because the compiler will end up using
1285 ;; different registers for op0 and op1 in some critical cases. local-alloc
1286 ;; will not tie op0 and op1 because op0 is used in multiple basic blocks.
1288 ;; If/when global register allocation supports tying we should allow any
1289 ;; register for op1 again.
1291 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
1293 (match_operator 2 "comparison_operator"
1294 [(match_operand:SI 3 "register_operand" "r,r,r,r")
1295 (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI")])
1296 (match_operand:SI 1 "reg_or_cint_move_operand" "0,J,N,K")
1300 {com%I4clr|cmp%I4clr},%S2 %4,%3,%%r0\;ldi 0,%0
1301 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldi %1,%0
1302 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;ldil L'%1,%0
1303 {com%I4clr|cmp%I4clr},%B2 %4,%3,%0\;{zdepi|depwi,z} %Z1,%0"
1304 [(set_attr "type" "multi,multi,multi,nullshift")
1305 (set_attr "length" "8,8,8,8")])
1308 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1310 (match_operator 5 "comparison_operator"
1311 [(match_operand:SI 3 "register_operand" "r,r,r,r,r,r,r,r")
1312 (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1313 (match_operand:SI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1314 (match_operand:SI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1317 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;copy %2,%0
1318 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldi %2,%0
1319 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;ldil L'%2,%0
1320 {com%I4clr|cmp%I4clr},%S5 %4,%3,%%r0\;{zdepi|depwi,z} %Z2,%0
1321 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;copy %1,%0
1322 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldi %1,%0
1323 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;ldil L'%1,%0
1324 {com%I4clr|cmp%I4clr},%B5 %4,%3,%%r0\;{zdepi|depwi,z} %Z1,%0"
1325 [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1326 (set_attr "length" "8,8,8,8,8,8,8,8")])
1328 (define_expand "movdicc"
1329 [(set (match_operand:DI 0 "register_operand" "")
1331 (match_operand 1 "comparison_operator" "")
1332 (match_operand:DI 2 "reg_or_cint_move_operand" "")
1333 (match_operand:DI 3 "reg_or_cint_move_operand" "")))]
1337 if (GET_MODE (XEXP (operands[1], 0)) != DImode
1338 || GET_MODE (XEXP (operands[1], 0)) != GET_MODE (XEXP (operands[1], 1)))
1342 ; We need the first constraint alternative in order to avoid
1343 ; earlyclobbers on all other alternatives.
1345 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r")
1347 (match_operator 2 "comparison_operator"
1348 [(match_operand:DI 3 "register_operand" "r,r,r,r,r")
1349 (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI")])
1350 (match_operand:DI 1 "reg_or_cint_move_operand" "0,r,J,N,K")
1354 cmp%I4clr,*%S2 %4,%3,%%r0\;ldi 0,%0
1355 cmp%I4clr,*%B2 %4,%3,%0\;copy %1,%0
1356 cmp%I4clr,*%B2 %4,%3,%0\;ldi %1,%0
1357 cmp%I4clr,*%B2 %4,%3,%0\;ldil L'%1,%0
1358 cmp%I4clr,*%B2 %4,%3,%0\;depdi,z %z1,%0"
1359 [(set_attr "type" "multi,multi,multi,multi,nullshift")
1360 (set_attr "length" "8,8,8,8,8")])
1363 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r,r,r,r")
1365 (match_operator 5 "comparison_operator"
1366 [(match_operand:DI 3 "register_operand" "r,r,r,r,r,r,r,r")
1367 (match_operand:DI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
1368 (match_operand:DI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
1369 (match_operand:DI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
1372 cmp%I4clr,*%S5 %4,%3,%%r0\;copy %2,%0
1373 cmp%I4clr,*%S5 %4,%3,%%r0\;ldi %2,%0
1374 cmp%I4clr,*%S5 %4,%3,%%r0\;ldil L'%2,%0
1375 cmp%I4clr,*%S5 %4,%3,%%r0\;depdi,z %z2,%0
1376 cmp%I4clr,*%B5 %4,%3,%%r0\;copy %1,%0
1377 cmp%I4clr,*%B5 %4,%3,%%r0\;ldi %1,%0
1378 cmp%I4clr,*%B5 %4,%3,%%r0\;ldil L'%1,%0
1379 cmp%I4clr,*%B5 %4,%3,%%r0\;depdi,z %z1,%0"
1380 [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
1381 (set_attr "length" "8,8,8,8,8,8,8,8")])
1383 ;; Conditional Branches
1385 (define_expand "cbranchdi4"
1387 (if_then_else (match_operator 0 "ordered_comparison_operator"
1388 [(match_operand:DI 1 "reg_or_0_operand" "")
1389 (match_operand:DI 2 "register_operand" "")])
1390 (label_ref (match_operand 3 "" ""))
1395 (define_expand "cbranchsi4"
1397 (if_then_else (match_operator 0 "ordered_comparison_operator"
1398 [(match_operand:SI 1 "reg_or_0_operand" "")
1399 (match_operand:SI 2 "arith5_operand" "")])
1400 (label_ref (match_operand 3 "" ""))
1405 (define_expand "cbranchsf4"
1407 (if_then_else (match_operator 0 "comparison_operator"
1408 [(match_operand:SF 1 "reg_or_0_operand" "")
1409 (match_operand:SF 2 "reg_or_0_operand" "")])
1410 (label_ref (match_operand 3 "" ""))
1415 pa_emit_bcond_fp (operands);
1420 (define_expand "cbranchdf4"
1422 (if_then_else (match_operator 0 "comparison_operator"
1423 [(match_operand:DF 1 "reg_or_0_operand" "")
1424 (match_operand:DF 2 "reg_or_0_operand" "")])
1425 (label_ref (match_operand 3 "" ""))
1430 pa_emit_bcond_fp (operands);
1434 ;; Match the branch patterns.
1437 ;; Note a long backward conditional branch with an annulled delay slot
1438 ;; has a length of 12.
1442 (match_operator 3 "comparison_operator"
1443 [(match_operand:SI 1 "reg_or_0_operand" "rM")
1444 (match_operand:SI 2 "arith5_operand" "rL")])
1445 (label_ref (match_operand 0 "" ""))
1450 return pa_output_cbranch (operands, 0, insn);
1452 [(set_attr "type" "cbranch")
1453 (set (attr "length")
1454 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1455 (const_int MAX_12BIT_OFFSET))
1457 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1458 (const_int MAX_17BIT_OFFSET))
1460 (match_test "TARGET_PORTABLE_RUNTIME")
1462 (not (match_test "flag_pic"))
1466 ;; Match the negated branch.
1471 (match_operator 3 "comparison_operator"
1472 [(match_operand:SI 1 "reg_or_0_operand" "rM")
1473 (match_operand:SI 2 "arith5_operand" "rL")])
1475 (label_ref (match_operand 0 "" ""))))]
1479 return pa_output_cbranch (operands, 1, 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"))
1498 (match_operator 3 "comparison_operator"
1499 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1500 (match_operand:DI 2 "reg_or_0_operand" "rM")])
1501 (label_ref (match_operand 0 "" ""))
1506 return pa_output_cbranch (operands, 0, insn);
1508 [(set_attr "type" "cbranch")
1509 (set (attr "length")
1510 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1511 (const_int MAX_12BIT_OFFSET))
1513 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1514 (const_int MAX_17BIT_OFFSET))
1516 (match_test "TARGET_PORTABLE_RUNTIME")
1518 (not (match_test "flag_pic"))
1522 ;; Match the negated branch.
1527 (match_operator 3 "comparison_operator"
1528 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1529 (match_operand:DI 2 "reg_or_0_operand" "rM")])
1531 (label_ref (match_operand 0 "" ""))))]
1535 return pa_output_cbranch (operands, 1, insn);
1537 [(set_attr "type" "cbranch")
1538 (set (attr "length")
1539 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1540 (const_int MAX_12BIT_OFFSET))
1542 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1543 (const_int MAX_17BIT_OFFSET))
1545 (match_test "TARGET_PORTABLE_RUNTIME")
1547 (not (match_test "flag_pic"))
1553 (match_operator 3 "cmpib_comparison_operator"
1554 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1555 (match_operand:DI 2 "arith5_operand" "rL")])
1556 (label_ref (match_operand 0 "" ""))
1561 return pa_output_cbranch (operands, 0, insn);
1563 [(set_attr "type" "cbranch")
1564 (set (attr "length")
1565 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1566 (const_int MAX_12BIT_OFFSET))
1568 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1569 (const_int MAX_17BIT_OFFSET))
1571 (match_test "TARGET_PORTABLE_RUNTIME")
1573 (not (match_test "flag_pic"))
1577 ;; Match the negated branch.
1582 (match_operator 3 "cmpib_comparison_operator"
1583 [(match_operand:DI 1 "reg_or_0_operand" "rM")
1584 (match_operand:DI 2 "arith5_operand" "rL")])
1586 (label_ref (match_operand 0 "" ""))))]
1590 return pa_output_cbranch (operands, 1, insn);
1592 [(set_attr "type" "cbranch")
1593 (set (attr "length")
1594 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1595 (const_int MAX_12BIT_OFFSET))
1597 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
1598 (const_int MAX_17BIT_OFFSET))
1600 (match_test "TARGET_PORTABLE_RUNTIME")
1602 (not (match_test "flag_pic"))
1606 ;; Branch on Bit patterns.
1610 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1612 (match_operand:SI 1 "uint5_operand" ""))
1614 (label_ref (match_operand 2 "" ""))
1619 return pa_output_bb (operands, 0, insn, 0);
1621 [(set_attr "type" "cbranch")
1622 (set (attr "length")
1623 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1624 (const_int MAX_12BIT_OFFSET))
1626 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1627 (const_int MAX_17BIT_OFFSET))
1629 (match_test "TARGET_PORTABLE_RUNTIME")
1631 (not (match_test "flag_pic"))
1638 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1640 (match_operand:DI 1 "uint32_operand" ""))
1642 (label_ref (match_operand 2 "" ""))
1647 return pa_output_bb (operands, 0, insn, 0);
1649 [(set_attr "type" "cbranch")
1650 (set (attr "length")
1651 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1652 (const_int MAX_12BIT_OFFSET))
1654 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1655 (const_int MAX_17BIT_OFFSET))
1657 (match_test "TARGET_PORTABLE_RUNTIME")
1659 (not (match_test "flag_pic"))
1666 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1668 (match_operand:SI 1 "uint5_operand" ""))
1671 (label_ref (match_operand 2 "" ""))))]
1675 return pa_output_bb (operands, 1, insn, 0);
1677 [(set_attr "type" "cbranch")
1678 (set (attr "length")
1679 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1680 (const_int MAX_12BIT_OFFSET))
1682 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1683 (const_int MAX_17BIT_OFFSET))
1685 (match_test "TARGET_PORTABLE_RUNTIME")
1687 (not (match_test "flag_pic"))
1694 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1696 (match_operand:DI 1 "uint32_operand" ""))
1699 (label_ref (match_operand 2 "" ""))))]
1703 return pa_output_bb (operands, 1, insn, 0);
1705 [(set_attr "type" "cbranch")
1706 (set (attr "length")
1707 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1708 (const_int MAX_12BIT_OFFSET))
1710 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1711 (const_int MAX_17BIT_OFFSET))
1713 (match_test "TARGET_PORTABLE_RUNTIME")
1715 (not (match_test "flag_pic"))
1722 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1724 (match_operand:SI 1 "uint5_operand" ""))
1726 (label_ref (match_operand 2 "" ""))
1731 return pa_output_bb (operands, 0, insn, 1);
1733 [(set_attr "type" "cbranch")
1734 (set (attr "length")
1735 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1736 (const_int MAX_12BIT_OFFSET))
1738 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1739 (const_int MAX_17BIT_OFFSET))
1741 (match_test "TARGET_PORTABLE_RUNTIME")
1743 (not (match_test "flag_pic"))
1750 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1752 (match_operand:DI 1 "uint32_operand" ""))
1754 (label_ref (match_operand 2 "" ""))
1759 return pa_output_bb (operands, 0, insn, 1);
1761 [(set_attr "type" "cbranch")
1762 (set (attr "length")
1763 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1764 (const_int MAX_12BIT_OFFSET))
1766 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1767 (const_int MAX_17BIT_OFFSET))
1769 (match_test "TARGET_PORTABLE_RUNTIME")
1771 (not (match_test "flag_pic"))
1778 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1780 (match_operand:SI 1 "uint5_operand" ""))
1783 (label_ref (match_operand 2 "" ""))))]
1787 return pa_output_bb (operands, 1, insn, 1);
1789 [(set_attr "type" "cbranch")
1790 (set (attr "length")
1791 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1792 (const_int MAX_12BIT_OFFSET))
1794 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1795 (const_int MAX_17BIT_OFFSET))
1797 (match_test "TARGET_PORTABLE_RUNTIME")
1799 (not (match_test "flag_pic"))
1806 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1808 (match_operand:DI 1 "uint32_operand" ""))
1811 (label_ref (match_operand 2 "" ""))))]
1815 return pa_output_bb (operands, 1, insn, 1);
1817 [(set_attr "type" "cbranch")
1818 (set (attr "length")
1819 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1820 (const_int MAX_12BIT_OFFSET))
1822 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1823 (const_int MAX_17BIT_OFFSET))
1825 (match_test "TARGET_PORTABLE_RUNTIME")
1827 (not (match_test "flag_pic"))
1831 ;; Branch on Variable Bit patterns.
1835 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1837 (match_operand:SI 1 "register_operand" "q"))
1839 (label_ref (match_operand 2 "" ""))
1844 return pa_output_bvb (operands, 0, insn, 0);
1846 [(set_attr "type" "cbranch")
1847 (set (attr "length")
1848 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1849 (const_int MAX_12BIT_OFFSET))
1851 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1852 (const_int MAX_17BIT_OFFSET))
1854 (match_test "TARGET_PORTABLE_RUNTIME")
1856 (not (match_test "flag_pic"))
1863 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1865 (match_operand:DI 1 "register_operand" "q"))
1867 (label_ref (match_operand 2 "" ""))
1872 return pa_output_bvb (operands, 0, insn, 0);
1874 [(set_attr "type" "cbranch")
1875 (set (attr "length")
1876 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1877 (const_int MAX_12BIT_OFFSET))
1879 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1880 (const_int MAX_17BIT_OFFSET))
1882 (match_test "TARGET_PORTABLE_RUNTIME")
1884 (not (match_test "flag_pic"))
1891 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1893 (match_operand:SI 1 "register_operand" "q"))
1896 (label_ref (match_operand 2 "" ""))))]
1900 return pa_output_bvb (operands, 1, insn, 0);
1902 [(set_attr "type" "cbranch")
1903 (set (attr "length")
1904 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1905 (const_int MAX_12BIT_OFFSET))
1907 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1908 (const_int MAX_17BIT_OFFSET))
1910 (match_test "TARGET_PORTABLE_RUNTIME")
1912 (not (match_test "flag_pic"))
1919 (ne (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1921 (match_operand:DI 1 "register_operand" "q"))
1924 (label_ref (match_operand 2 "" ""))))]
1928 return pa_output_bvb (operands, 1, insn, 0);
1930 [(set_attr "type" "cbranch")
1931 (set (attr "length")
1932 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1933 (const_int MAX_12BIT_OFFSET))
1935 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1936 (const_int MAX_17BIT_OFFSET))
1938 (match_test "TARGET_PORTABLE_RUNTIME")
1940 (not (match_test "flag_pic"))
1947 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1949 (match_operand:SI 1 "register_operand" "q"))
1951 (label_ref (match_operand 2 "" ""))
1956 return pa_output_bvb (operands, 0, insn, 1);
1958 [(set_attr "type" "cbranch")
1959 (set (attr "length")
1960 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1961 (const_int MAX_12BIT_OFFSET))
1963 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1964 (const_int MAX_17BIT_OFFSET))
1966 (match_test "TARGET_PORTABLE_RUNTIME")
1968 (not (match_test "flag_pic"))
1975 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
1977 (match_operand:DI 1 "register_operand" "q"))
1979 (label_ref (match_operand 2 "" ""))
1984 return pa_output_bvb (operands, 0, insn, 1);
1986 [(set_attr "type" "cbranch")
1987 (set (attr "length")
1988 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1989 (const_int MAX_12BIT_OFFSET))
1991 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
1992 (const_int MAX_17BIT_OFFSET))
1994 (match_test "TARGET_PORTABLE_RUNTIME")
1996 (not (match_test "flag_pic"))
2003 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
2005 (match_operand:SI 1 "register_operand" "q"))
2008 (label_ref (match_operand 2 "" ""))))]
2012 return pa_output_bvb (operands, 1, insn, 1);
2014 [(set_attr "type" "cbranch")
2015 (set (attr "length")
2016 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2017 (const_int MAX_12BIT_OFFSET))
2019 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2020 (const_int MAX_17BIT_OFFSET))
2022 (match_test "TARGET_PORTABLE_RUNTIME")
2024 (not (match_test "flag_pic"))
2031 (eq (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
2033 (match_operand:DI 1 "register_operand" "q"))
2036 (label_ref (match_operand 2 "" ""))))]
2040 return pa_output_bvb (operands, 1, insn, 1);
2042 [(set_attr "type" "cbranch")
2043 (set (attr "length")
2044 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2045 (const_int MAX_12BIT_OFFSET))
2047 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
2048 (const_int MAX_17BIT_OFFSET))
2050 (match_test "TARGET_PORTABLE_RUNTIME")
2052 (not (match_test "flag_pic"))
2056 ;; Floating point branches
2058 ;; ??? Nullification is handled differently from other branches.
2059 ;; If nullification is specified, the delay slot is nullified on any
2060 ;; taken branch regardless of branch direction.
2062 [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2063 (label_ref (match_operand 0 "" ""))
2065 "!TARGET_SOFT_FLOAT"
2068 int length = get_attr_length (insn);
2070 int nullify, xdelay;
2073 return \"ftest\;b%* %l0\";
2075 if (dbr_sequence_length () == 0 || INSN_ANNULLED_BRANCH_P (insn))
2079 xoperands[0] = GEN_INT (length - 8);
2085 xoperands[0] = GEN_INT (length - 4);
2089 output_asm_insn (\"ftest\;add,tr %%r0,%%r0,%%r0\;b,n .+%0\", xoperands);
2091 output_asm_insn (\"ftest\;add,tr %%r0,%%r0,%%r0\;b .+%0\", xoperands);
2092 return pa_output_lbranch (operands[0], insn, xdelay);
2094 [(set_attr "type" "fbranch")
2095 (set (attr "length")
2096 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
2097 (const_int MAX_17BIT_OFFSET))
2099 (match_test "TARGET_PORTABLE_RUNTIME")
2101 (not (match_test "flag_pic"))
2106 [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
2108 (label_ref (match_operand 0 "" ""))))]
2109 "!TARGET_SOFT_FLOAT"
2112 int length = get_attr_length (insn);
2114 int nullify, xdelay;
2117 return \"ftest\;add,tr %%r0,%%r0,%%r0\;b%* %0\";
2119 if (dbr_sequence_length () == 0 || INSN_ANNULLED_BRANCH_P (insn))
2123 xoperands[0] = GEN_INT (length - 4);
2129 xoperands[0] = GEN_INT (length);
2133 output_asm_insn (\"ftest\;b,n .+%0\", xoperands);
2135 output_asm_insn (\"ftest\;b .+%0\", xoperands);
2136 return pa_output_lbranch (operands[0], insn, xdelay);
2138 [(set_attr "type" "fbranch")
2139 (set (attr "length")
2140 (cond [(lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
2141 (const_int MAX_17BIT_OFFSET))
2143 (match_test "TARGET_PORTABLE_RUNTIME")
2145 (not (match_test "flag_pic"))
2149 ;; Move instructions
2151 (define_expand "movsi"
2152 [(set (match_operand:SI 0 "general_operand" "")
2153 (match_operand:SI 1 "general_operand" ""))]
2157 if (pa_emit_move_sequence (operands, SImode, 0))
2161 ;; Handle SImode input reloads requiring %r1 as a scratch register.
2162 (define_expand "reload_insi_r1"
2163 [(set (match_operand:SI 0 "register_operand" "=Z")
2164 (match_operand:SI 1 "non_hard_reg_operand" ""))
2165 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
2169 if (pa_emit_move_sequence (operands, SImode, operands[2]))
2172 /* We don't want the clobber emitted, so handle this ourselves. */
2173 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
2177 ;; Handle SImode input reloads requiring a general register as a
2178 ;; scratch register.
2179 (define_expand "reload_insi"
2180 [(set (match_operand:SI 0 "register_operand" "=Z")
2181 (match_operand:SI 1 "non_hard_reg_operand" ""))
2182 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2186 if (pa_emit_move_sequence (operands, SImode, operands[2]))
2189 /* We don't want the clobber emitted, so handle this ourselves. */
2190 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
2194 ;; Handle SImode output reloads requiring a general register as a
2195 ;; scratch register.
2196 (define_expand "reload_outsi"
2197 [(set (match_operand:SI 0 "non_hard_reg_operand" "")
2198 (match_operand:SI 1 "register_operand" "Z"))
2199 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
2203 if (pa_emit_move_sequence (operands, SImode, operands[2]))
2206 /* We don't want the clobber emitted, so handle this ourselves. */
2207 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
2212 [(set (match_operand:SI 0 "move_dest_operand"
2213 "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T,?r,?*f")
2214 (match_operand:SI 1 "move_src_operand"
2215 "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f,*f,r"))]
2216 "(register_operand (operands[0], SImode)
2217 || reg_or_0_operand (operands[1], SImode))
2218 && !TARGET_SOFT_FLOAT
2225 {zdepi|depwi,z} %Z1,%0
2229 {mfctl|mfctl,w} %%sar,%0
2233 {fstws|fstw} %1,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0
2234 {stws|stw} %1,-16(%%sp)\n\t{fldws|fldw} -16(%%sp),%0"
2235 [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore,fpstore_load,store_fpload")
2236 (set_attr "pa_combine_type" "addmove")
2237 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,8,8")])
2240 [(set (match_operand:SI 0 "move_dest_operand"
2241 "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T")
2242 (match_operand:SI 1 "move_src_operand"
2243 "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f"))]
2244 "(register_operand (operands[0], SImode)
2245 || reg_or_0_operand (operands[1], SImode))
2246 && !TARGET_SOFT_FLOAT
2253 {zdepi|depwi,z} %Z1,%0
2257 {mfctl|mfctl,w} %%sar,%0
2261 [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore")
2262 (set_attr "pa_combine_type" "addmove")
2263 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4")])
2266 [(set (match_operand:SI 0 "indexed_memory_operand" "=R")
2267 (match_operand:SI 1 "register_operand" "f"))]
2269 && !TARGET_DISABLE_INDEXING
2270 && reload_completed"
2272 [(set_attr "type" "fpstore")
2273 (set_attr "pa_combine_type" "addmove")
2274 (set_attr "length" "4")])
2276 ; Rewrite RTL using an indexed store. This will allow the insn that
2277 ; computes the address to be deleted if the register it sets is dead.
2279 [(set (match_operand:SI 0 "register_operand" "")
2280 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
2282 (match_operand:SI 2 "register_operand" "")))
2283 (set (mem:SI (match_dup 0))
2284 (match_operand:SI 3 "register_operand" ""))]
2286 && !TARGET_DISABLE_INDEXING
2287 && REG_OK_FOR_BASE_P (operands[2])
2288 && FP_REGNO_P (REGNO (operands[3]))"
2289 [(set (mem:SI (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
2291 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
2296 [(set (match_operand:SI 0 "register_operand" "")
2297 (plus:SI (match_operand:SI 2 "register_operand" "")
2298 (mult:SI (match_operand:SI 1 "register_operand" "")
2300 (set (mem:SI (match_dup 0))
2301 (match_operand:SI 3 "register_operand" ""))]
2303 && !TARGET_DISABLE_INDEXING
2304 && REG_OK_FOR_BASE_P (operands[2])
2305 && FP_REGNO_P (REGNO (operands[3]))"
2306 [(set (mem:SI (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
2308 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
2313 [(set (match_operand:DI 0 "register_operand" "")
2314 (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2316 (match_operand:DI 2 "register_operand" "")))
2317 (set (mem:SI (match_dup 0))
2318 (match_operand:SI 3 "register_operand" ""))]
2320 && !TARGET_DISABLE_INDEXING
2322 && REG_OK_FOR_BASE_P (operands[2])
2323 && FP_REGNO_P (REGNO (operands[3]))"
2324 [(set (mem:SI (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
2326 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
2331 [(set (match_operand:DI 0 "register_operand" "")
2332 (plus:DI (match_operand:DI 2 "register_operand" "")
2333 (mult:DI (match_operand:DI 1 "register_operand" "")
2335 (set (mem:SI (match_dup 0))
2336 (match_operand:SI 3 "register_operand" ""))]
2338 && !TARGET_DISABLE_INDEXING
2340 && REG_OK_FOR_BASE_P (operands[2])
2341 && FP_REGNO_P (REGNO (operands[3]))"
2342 [(set (mem:SI (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
2344 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
2349 [(set (match_operand:SI 0 "register_operand" "")
2350 (plus:SI (match_operand:SI 1 "register_operand" "")
2351 (match_operand:SI 2 "register_operand" "")))
2352 (set (mem:SI (match_dup 0))
2353 (match_operand:SI 3 "register_operand" ""))]
2355 && !TARGET_DISABLE_INDEXING
2356 && TARGET_NO_SPACE_REGS
2357 && REG_OK_FOR_INDEX_P (operands[1])
2358 && REG_OK_FOR_BASE_P (operands[2])
2359 && FP_REGNO_P (REGNO (operands[3]))"
2360 [(set (mem:SI (plus:SI (match_dup 1) (match_dup 2)))
2362 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
2366 [(set (match_operand:SI 0 "register_operand" "")
2367 (plus:SI (match_operand:SI 1 "register_operand" "")
2368 (match_operand:SI 2 "register_operand" "")))
2369 (set (mem:SI (match_dup 0))
2370 (match_operand:SI 3 "register_operand" ""))]
2372 && !TARGET_DISABLE_INDEXING
2373 && TARGET_NO_SPACE_REGS
2374 && REG_OK_FOR_BASE_P (operands[1])
2375 && REG_OK_FOR_INDEX_P (operands[2])
2376 && FP_REGNO_P (REGNO (operands[3]))"
2377 [(set (mem:SI (plus:SI (match_dup 2) (match_dup 1)))
2379 (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
2383 [(set (match_operand:DI 0 "register_operand" "")
2384 (plus:DI (match_operand:DI 1 "register_operand" "")
2385 (match_operand:DI 2 "register_operand" "")))
2386 (set (mem:SI (match_dup 0))
2387 (match_operand:SI 3 "register_operand" ""))]
2389 && !TARGET_DISABLE_INDEXING
2391 && TARGET_NO_SPACE_REGS
2392 && REG_OK_FOR_INDEX_P (operands[1])
2393 && REG_OK_FOR_BASE_P (operands[2])
2394 && FP_REGNO_P (REGNO (operands[3]))"
2395 [(set (mem:SI (plus:DI (match_dup 1) (match_dup 2)))
2397 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
2401 [(set (match_operand:DI 0 "register_operand" "")
2402 (plus:DI (match_operand:DI 1 "register_operand" "")
2403 (match_operand:DI 2 "register_operand" "")))
2404 (set (mem:SI (match_dup 0))
2405 (match_operand:SI 3 "register_operand" ""))]
2407 && !TARGET_DISABLE_INDEXING
2409 && TARGET_NO_SPACE_REGS
2410 && REG_OK_FOR_BASE_P (operands[1])
2411 && REG_OK_FOR_INDEX_P (operands[2])
2412 && FP_REGNO_P (REGNO (operands[3]))"
2413 [(set (mem:SI (plus:DI (match_dup 2) (match_dup 1)))
2415 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
2419 [(set (match_operand:SI 0 "move_dest_operand"
2420 "=r,r,r,r,r,r,Q,!*q,!r")
2421 (match_operand:SI 1 "move_src_operand"
2422 "A,r,J,N,K,RQ,rM,!rM,!*q"))]
2423 "(register_operand (operands[0], SImode)
2424 || reg_or_0_operand (operands[1], SImode))
2425 && TARGET_SOFT_FLOAT"
2431 {zdepi|depwi,z} %Z1,%0
2435 {mfctl|mfctl,w} %%sar,%0"
2436 [(set_attr "type" "load,move,move,move,move,load,store,move,move")
2437 (set_attr "pa_combine_type" "addmove")
2438 (set_attr "length" "4,4,4,4,4,4,4,4,4")])
2440 ;; Load or store with base-register modification.
2442 [(set (match_operand:SI 0 "register_operand" "=r")
2443 (mem:SI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2444 (match_operand:DI 2 "int5_operand" "L"))))
2446 (plus:DI (match_dup 1) (match_dup 2)))]
2449 [(set_attr "type" "load")
2450 (set_attr "length" "4")])
2452 ; And a zero extended variant.
2454 [(set (match_operand:DI 0 "register_operand" "=r")
2455 (zero_extend:DI (mem:SI
2457 (match_operand:DI 1 "register_operand" "+r")
2458 (match_operand:DI 2 "int5_operand" "L")))))
2460 (plus:DI (match_dup 1) (match_dup 2)))]
2463 [(set_attr "type" "load")
2464 (set_attr "length" "4")])
2466 (define_expand "pre_load"
2467 [(parallel [(set (match_operand:SI 0 "register_operand" "")
2468 (mem (plus (match_operand 1 "register_operand" "")
2469 (match_operand 2 "pre_cint_operand" ""))))
2471 (plus (match_dup 1) (match_dup 2)))])]
2477 emit_insn (gen_pre_ldd (operands[0], operands[1], operands[2]));
2480 emit_insn (gen_pre_ldw (operands[0], operands[1], operands[2]));
2484 (define_insn "pre_ldw"
2485 [(set (match_operand:SI 0 "register_operand" "=r")
2486 (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2487 (match_operand:SI 2 "pre_cint_operand" ""))))
2489 (plus:SI (match_dup 1) (match_dup 2)))]
2493 if (INTVAL (operands[2]) < 0)
2494 return \"{ldwm|ldw,mb} %2(%1),%0\";
2495 return \"{ldws|ldw},mb %2(%1),%0\";
2497 [(set_attr "type" "load")
2498 (set_attr "length" "4")])
2500 (define_insn "pre_ldd"
2501 [(set (match_operand:DI 0 "register_operand" "=r")
2502 (mem:DI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2503 (match_operand:DI 2 "pre_cint_operand" ""))))
2505 (plus:DI (match_dup 1) (match_dup 2)))]
2508 [(set_attr "type" "load")
2509 (set_attr "length" "4")])
2512 [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2513 (match_operand:SI 1 "pre_cint_operand" "")))
2514 (match_operand:SI 2 "reg_or_0_operand" "rM"))
2516 (plus:SI (match_dup 0) (match_dup 1)))]
2520 if (INTVAL (operands[1]) < 0)
2521 return \"{stwm|stw,mb} %r2,%1(%0)\";
2522 return \"{stws|stw},mb %r2,%1(%0)\";
2524 [(set_attr "type" "store")
2525 (set_attr "length" "4")])
2528 [(set (match_operand:SI 0 "register_operand" "=r")
2529 (mem:SI (match_operand:SI 1 "register_operand" "+r")))
2531 (plus:SI (match_dup 1)
2532 (match_operand:SI 2 "post_cint_operand" "")))]
2536 if (INTVAL (operands[2]) > 0)
2537 return \"{ldwm|ldw,ma} %2(%1),%0\";
2538 return \"{ldws|ldw},ma %2(%1),%0\";
2540 [(set_attr "type" "load")
2541 (set_attr "length" "4")])
2543 (define_expand "post_store"
2544 [(parallel [(set (mem (match_operand 0 "register_operand" ""))
2545 (match_operand 1 "reg_or_0_operand" ""))
2548 (match_operand 2 "post_cint_operand" "")))])]
2554 emit_insn (gen_post_std (operands[0], operands[1], operands[2]));
2557 emit_insn (gen_post_stw (operands[0], operands[1], operands[2]));
2561 (define_insn "post_stw"
2562 [(set (mem:SI (match_operand:SI 0 "register_operand" "+r"))
2563 (match_operand:SI 1 "reg_or_0_operand" "rM"))
2565 (plus:SI (match_dup 0)
2566 (match_operand:SI 2 "post_cint_operand" "")))]
2570 if (INTVAL (operands[2]) > 0)
2571 return \"{stwm|stw,ma} %r1,%2(%0)\";
2572 return \"{stws|stw},ma %r1,%2(%0)\";
2574 [(set_attr "type" "store")
2575 (set_attr "length" "4")])
2577 (define_insn "post_std"
2578 [(set (mem:DI (match_operand:DI 0 "register_operand" "+r"))
2579 (match_operand:DI 1 "reg_or_0_operand" "rM"))
2581 (plus:DI (match_dup 0)
2582 (match_operand:DI 2 "post_cint_operand" "")))]
2585 [(set_attr "type" "store")
2586 (set_attr "length" "4")])
2588 ;; For loading the address of a label while generating PIC code.
2589 ;; Note since this pattern can be created at reload time (via movsi), all
2590 ;; the same rules for movsi apply here. (no new pseudos, no temporaries).
2592 [(set (match_operand 0 "pmode_register_operand" "=a")
2593 (match_operand 1 "pic_label_operand" ""))]
2599 xoperands[0] = operands[0];
2600 xoperands[1] = operands[1];
2601 xoperands[2] = gen_label_rtx ();
2603 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
2604 CODE_LABEL_NUMBER (xoperands[2]));
2605 output_asm_insn (\"mfia %0\", xoperands);
2607 /* If we're trying to load the address of a label that happens to be
2608 close, then we can use a shorter sequence. */
2609 if (GET_CODE (operands[1]) == LABEL_REF
2610 && !LABEL_REF_NONLOCAL_P (operands[1])
2611 && INSN_ADDRESSES_SET_P ()
2612 && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
2613 - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
2614 output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
2617 output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
2618 output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
2622 [(set_attr "type" "multi")
2623 (set_attr "length" "12")]) ; 8 or 12
2626 [(set (match_operand 0 "pmode_register_operand" "=a")
2627 (match_operand 1 "pic_label_operand" ""))]
2633 xoperands[0] = operands[0];
2634 xoperands[1] = operands[1];
2635 xoperands[2] = gen_label_rtx ();
2637 output_asm_insn (\"bl .+8,%0\", xoperands);
2638 output_asm_insn (\"depi 0,31,2,%0\", xoperands);
2639 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
2640 CODE_LABEL_NUMBER (xoperands[2]));
2642 /* If we're trying to load the address of a label that happens to be
2643 close, then we can use a shorter sequence. */
2644 if (GET_CODE (operands[1]) == LABEL_REF
2645 && !LABEL_REF_NONLOCAL_P (operands[1])
2646 && INSN_ADDRESSES_SET_P ()
2647 && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
2648 - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
2649 output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
2652 output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
2653 output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
2657 [(set_attr "type" "multi")
2658 (set_attr "length" "16")]) ; 12 or 16
2661 [(set (match_operand:SI 0 "register_operand" "=a")
2662 (plus:SI (match_operand:SI 1 "register_operand" "r")
2663 (high:SI (match_operand 2 "" ""))))]
2664 "symbolic_operand (operands[2], Pmode)
2665 && ! function_label_operand (operands[2], Pmode)
2668 [(set_attr "type" "binary")
2669 (set_attr "length" "4")])
2672 [(set (match_operand:DI 0 "register_operand" "=a")
2673 (plus:DI (match_operand:DI 1 "register_operand" "r")
2674 (high:DI (match_operand 2 "" ""))))]
2675 "symbolic_operand (operands[2], Pmode)
2676 && ! function_label_operand (operands[2], Pmode)
2680 [(set_attr "type" "binary")
2681 (set_attr "length" "4")])
2683 ;; Always use addil rather than ldil;add sequences. This allows the
2684 ;; HP linker to eliminate the dp relocation if the symbolic operand
2685 ;; lives in the TEXT space.
2687 [(set (match_operand:SI 0 "register_operand" "=a")
2688 (high:SI (match_operand 1 "" "")))]
2689 "symbolic_operand (operands[1], Pmode)
2690 && ! function_label_operand (operands[1], Pmode)
2691 && ! read_only_operand (operands[1], Pmode)
2695 if (TARGET_LONG_LOAD_STORE)
2696 return \"addil NLR'%H1,%%r27\;ldo N'%H1(%%r1),%%r1\";
2698 return \"addil LR'%H1,%%r27\";
2700 [(set_attr "type" "binary")
2701 (set (attr "length")
2702 (if_then_else (not (match_test "TARGET_LONG_LOAD_STORE"))
2707 ;; This is for use in the prologue/epilogue code. We need it
2708 ;; to add large constants to a stack pointer or frame pointer.
2709 ;; Because of the additional %r1 pressure, we probably do not
2710 ;; want to use this in general code, so make it available
2711 ;; only after reload.
2713 [(set (match_operand:SI 0 "register_operand" "=!a,*r")
2714 (plus:SI (match_operand:SI 1 "register_operand" "r,r")
2715 (high:SI (match_operand 2 "const_int_operand" ""))))]
2719 ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2720 [(set_attr "type" "binary,binary")
2721 (set_attr "length" "4,8")])
2724 [(set (match_operand:DI 0 "register_operand" "=!a,*r")
2725 (plus:DI (match_operand:DI 1 "register_operand" "r,r")
2726 (high:DI (match_operand 2 "const_int_operand" ""))))]
2727 "reload_completed && TARGET_64BIT"
2730 ldil L'%G2,%0\;{addl|add,l} %0,%1,%0"
2731 [(set_attr "type" "binary,binary")
2732 (set_attr "length" "4,8")])
2735 [(set (match_operand:SI 0 "register_operand" "=r")
2736 (high:SI (match_operand 1 "" "")))]
2737 "(!flag_pic || !symbolic_operand (operands[1], Pmode))
2738 && !pa_is_function_label_plus_const (operands[1])"
2741 if (symbolic_operand (operands[1], Pmode))
2742 return \"ldil LR'%H1,%0\";
2744 return \"ldil L'%G1,%0\";
2746 [(set_attr "type" "move")
2747 (set_attr "length" "4")])
2750 [(set (match_operand:DI 0 "register_operand" "=r")
2751 (high:DI (match_operand 1 "const_int_operand" "")))]
2754 [(set_attr "type" "move")
2755 (set_attr "length" "4")])
2758 [(set (match_operand:DI 0 "register_operand" "=r")
2759 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
2760 (match_operand:DI 2 "const_int_operand" "i")))]
2763 [(set_attr "type" "move")
2764 (set_attr "length" "4")])
2767 [(set (match_operand:SI 0 "register_operand" "=r")
2768 (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
2769 (match_operand:SI 2 "immediate_operand" "i")))]
2770 "!pa_is_function_label_plus_const (operands[2])"
2773 gcc_assert (!flag_pic || !symbolic_operand (operands[2], Pmode));
2775 if (symbolic_operand (operands[2], Pmode))
2776 return \"ldo RR'%G2(%1),%0\";
2778 return \"ldo R'%G2(%1),%0\";
2780 [(set_attr "type" "move")
2781 (set_attr "length" "4")])
2783 ;; Now that a symbolic_address plus a constant is broken up early
2784 ;; in the compilation phase (for better CSE) we need a special
2785 ;; combiner pattern to load the symbolic address plus the constant
2786 ;; in only 2 instructions. (For cases where the symbolic address
2787 ;; was not a common subexpression.)
2789 [(set (match_operand:SI 0 "register_operand" "")
2790 (match_operand:SI 1 "symbolic_operand" ""))
2791 (clobber (match_operand:SI 2 "register_operand" ""))]
2792 "! (flag_pic && pic_label_operand (operands[1], SImode))"
2793 [(set (match_dup 2) (high:SI (match_dup 1)))
2794 (set (match_dup 0) (lo_sum:SI (match_dup 2) (match_dup 1)))]
2797 ;; hppa_legitimize_address goes to a great deal of trouble to
2798 ;; create addresses which use indexing. In some cases, this
2799 ;; is a lose because there isn't any store instructions which
2800 ;; allow indexed addresses (with integer register source).
2802 ;; These define_splits try to turn a 3 insn store into
2803 ;; a 2 insn store with some creative RTL rewriting.
2805 [(set (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2806 (match_operand:SI 1 "shadd_operand" ""))
2807 (plus:SI (match_operand:SI 2 "register_operand" "")
2808 (match_operand:SI 3 "const_int_operand" ""))))
2809 (match_operand:SI 4 "register_operand" ""))
2810 (clobber (match_operand:SI 5 "register_operand" ""))]
2812 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2814 (set (mem:SI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2818 [(set (mem:HI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2819 (match_operand:SI 1 "shadd_operand" ""))
2820 (plus:SI (match_operand:SI 2 "register_operand" "")
2821 (match_operand:SI 3 "const_int_operand" ""))))
2822 (match_operand:HI 4 "register_operand" ""))
2823 (clobber (match_operand:SI 5 "register_operand" ""))]
2825 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2827 (set (mem:HI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2831 [(set (mem:QI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
2832 (match_operand:SI 1 "shadd_operand" ""))
2833 (plus:SI (match_operand:SI 2 "register_operand" "")
2834 (match_operand:SI 3 "const_int_operand" ""))))
2835 (match_operand:QI 4 "register_operand" ""))
2836 (clobber (match_operand:SI 5 "register_operand" ""))]
2838 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
2840 (set (mem:QI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
2843 (define_expand "movhi"
2844 [(set (match_operand:HI 0 "general_operand" "")
2845 (match_operand:HI 1 "general_operand" ""))]
2849 if (pa_emit_move_sequence (operands, HImode, 0))
2853 ;; Handle HImode input reloads requiring a general register as a
2854 ;; scratch register.
2855 (define_expand "reload_inhi"
2856 [(set (match_operand:HI 0 "register_operand" "=Z")
2857 (match_operand:HI 1 "non_hard_reg_operand" ""))
2858 (clobber (match_operand:HI 2 "register_operand" "=&r"))]
2862 if (pa_emit_move_sequence (operands, HImode, operands[2]))
2865 /* We don't want the clobber emitted, so handle this ourselves. */
2866 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
2870 ;; Handle HImode output reloads requiring a general register as a
2871 ;; scratch register.
2872 (define_expand "reload_outhi"
2873 [(set (match_operand:HI 0 "non_hard_reg_operand" "")
2874 (match_operand:HI 1 "register_operand" "Z"))
2875 (clobber (match_operand:HI 2 "register_operand" "=&r"))]
2879 if (pa_emit_move_sequence (operands, HImode, operands[2]))
2882 /* We don't want the clobber emitted, so handle this ourselves. */
2883 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
2888 [(set (match_operand:HI 0 "move_dest_operand"
2889 "=r,r,r,r,r,Q,!*q,!r")
2890 (match_operand:HI 1 "move_src_operand"
2891 "r,J,N,K,RQ,rM,!rM,!*q"))]
2892 "(register_operand (operands[0], HImode)
2893 || reg_or_0_operand (operands[1], HImode))"
2898 {zdepi|depwi,z} %Z1,%0
2902 {mfctl|mfctl,w} %sar,%0"
2903 [(set_attr "type" "move,move,move,shift,load,store,move,move")
2904 (set_attr "pa_combine_type" "addmove")
2905 (set_attr "length" "4,4,4,4,4,4,4,4")])
2908 [(set (match_operand:HI 0 "register_operand" "=r")
2909 (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "+r")
2910 (match_operand:SI 2 "int5_operand" "L"))))
2912 (plus:SI (match_dup 1) (match_dup 2)))]
2914 "{ldhs|ldh},mb %2(%1),%0"
2915 [(set_attr "type" "load")
2916 (set_attr "length" "4")])
2919 [(set (match_operand:HI 0 "register_operand" "=r")
2920 (mem:HI (plus:DI (match_operand:DI 1 "register_operand" "+r")
2921 (match_operand:DI 2 "int5_operand" "L"))))
2923 (plus:DI (match_dup 1) (match_dup 2)))]
2926 [(set_attr "type" "load")
2927 (set_attr "length" "4")])
2929 ; And a zero extended variant.
2931 [(set (match_operand:DI 0 "register_operand" "=r")
2932 (zero_extend:DI (mem:HI
2934 (match_operand:DI 1 "register_operand" "+r")
2935 (match_operand:DI 2 "int5_operand" "L")))))
2937 (plus:DI (match_dup 1) (match_dup 2)))]
2940 [(set_attr "type" "load")
2941 (set_attr "length" "4")])
2944 [(set (match_operand:SI 0 "register_operand" "=r")
2945 (zero_extend:SI (mem:HI
2947 (match_operand:SI 1 "register_operand" "+r")
2948 (match_operand:SI 2 "int5_operand" "L")))))
2950 (plus:SI (match_dup 1) (match_dup 2)))]
2952 "{ldhs|ldh},mb %2(%1),%0"
2953 [(set_attr "type" "load")
2954 (set_attr "length" "4")])
2957 [(set (match_operand:SI 0 "register_operand" "=r")
2958 (zero_extend:SI (mem:HI
2960 (match_operand:DI 1 "register_operand" "+r")
2961 (match_operand:DI 2 "int5_operand" "L")))))
2963 (plus:DI (match_dup 1) (match_dup 2)))]
2966 [(set_attr "type" "load")
2967 (set_attr "length" "4")])
2970 [(set (mem:HI (plus:SI (match_operand:SI 0 "register_operand" "+r")
2971 (match_operand:SI 1 "int5_operand" "L")))
2972 (match_operand:HI 2 "reg_or_0_operand" "rM"))
2974 (plus:SI (match_dup 0) (match_dup 1)))]
2976 "{sths|sth},mb %r2,%1(%0)"
2977 [(set_attr "type" "store")
2978 (set_attr "length" "4")])
2981 [(set (mem:HI (plus:DI (match_operand:DI 0 "register_operand" "+r")
2982 (match_operand:DI 1 "int5_operand" "L")))
2983 (match_operand:HI 2 "reg_or_0_operand" "rM"))
2985 (plus:DI (match_dup 0) (match_dup 1)))]
2988 [(set_attr "type" "store")
2989 (set_attr "length" "4")])
2991 (define_insn "addhi3"
2992 [(set (match_operand:HI 0 "register_operand" "=r,r")
2993 (plus:HI (match_operand:HI 1 "register_operand" "%r,r")
2994 (match_operand:HI 2 "arith14_operand" "r,J")))]
2997 {addl|add,l} %1,%2,%0
2999 [(set_attr "type" "binary,binary")
3000 (set_attr "pa_combine_type" "addmove")
3001 (set_attr "length" "4,4")])
3003 (define_expand "movqi"
3004 [(set (match_operand:QI 0 "general_operand" "")
3005 (match_operand:QI 1 "general_operand" ""))]
3009 if (pa_emit_move_sequence (operands, QImode, 0))
3013 ;; Handle QImode input reloads requiring a general register as a
3014 ;; scratch register.
3015 (define_expand "reload_inqi"
3016 [(set (match_operand:QI 0 "register_operand" "=Z")
3017 (match_operand:QI 1 "non_hard_reg_operand" ""))
3018 (clobber (match_operand:QI 2 "register_operand" "=&r"))]
3022 if (pa_emit_move_sequence (operands, QImode, operands[2]))
3025 /* We don't want the clobber emitted, so handle this ourselves. */
3026 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3030 ;; Handle QImode output reloads requiring a general register as a
3031 ;; scratch register.
3032 (define_expand "reload_outqi"
3033 [(set (match_operand:QI 0 "non_hard_reg_operand" "")
3034 (match_operand:QI 1 "register_operand" "Z"))
3035 (clobber (match_operand:QI 2 "register_operand" "=&r"))]
3039 if (pa_emit_move_sequence (operands, QImode, operands[2]))
3042 /* We don't want the clobber emitted, so handle this ourselves. */
3043 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3048 [(set (match_operand:QI 0 "move_dest_operand"
3049 "=r,r,r,r,r,Q,!*q,!r")
3050 (match_operand:QI 1 "move_src_operand"
3051 "r,J,N,K,RQ,rM,!rM,!*q"))]
3052 "(register_operand (operands[0], QImode)
3053 || reg_or_0_operand (operands[1], QImode))"
3058 {zdepi|depwi,z} %Z1,%0
3062 {mfctl|mfctl,w} %%sar,%0"
3063 [(set_attr "type" "move,move,move,shift,load,store,move,move")
3064 (set_attr "pa_combine_type" "addmove")
3065 (set_attr "length" "4,4,4,4,4,4,4,4")])
3068 [(set (match_operand:QI 0 "register_operand" "=r")
3069 (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "+r")
3070 (match_operand:SI 2 "int5_operand" "L"))))
3071 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3073 "{ldbs|ldb},mb %2(%1),%0"
3074 [(set_attr "type" "load")
3075 (set_attr "length" "4")])
3078 [(set (match_operand:QI 0 "register_operand" "=r")
3079 (mem:QI (plus:DI (match_operand:DI 1 "register_operand" "+r")
3080 (match_operand:DI 2 "int5_operand" "L"))))
3081 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3084 [(set_attr "type" "load")
3085 (set_attr "length" "4")])
3087 ; Now the same thing with zero extensions.
3089 [(set (match_operand:DI 0 "register_operand" "=r")
3090 (zero_extend:DI (mem:QI (plus:DI
3091 (match_operand:DI 1 "register_operand" "+r")
3092 (match_operand:DI 2 "int5_operand" "L")))))
3093 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3096 [(set_attr "type" "load")
3097 (set_attr "length" "4")])
3100 [(set (match_operand:SI 0 "register_operand" "=r")
3101 (zero_extend:SI (mem:QI (plus:SI
3102 (match_operand:SI 1 "register_operand" "+r")
3103 (match_operand:SI 2 "int5_operand" "L")))))
3104 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3106 "{ldbs|ldb},mb %2(%1),%0"
3107 [(set_attr "type" "load")
3108 (set_attr "length" "4")])
3111 [(set (match_operand:SI 0 "register_operand" "=r")
3112 (zero_extend:SI (mem:QI (plus:DI
3113 (match_operand:DI 1 "register_operand" "+r")
3114 (match_operand:DI 2 "int5_operand" "L")))))
3115 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3118 [(set_attr "type" "load")
3119 (set_attr "length" "4")])
3122 [(set (match_operand:HI 0 "register_operand" "=r")
3123 (zero_extend:HI (mem:QI (plus:SI
3124 (match_operand:SI 1 "register_operand" "+r")
3125 (match_operand:SI 2 "int5_operand" "L")))))
3126 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
3128 "{ldbs|ldb},mb %2(%1),%0"
3129 [(set_attr "type" "load")
3130 (set_attr "length" "4")])
3133 [(set (match_operand:HI 0 "register_operand" "=r")
3134 (zero_extend:HI (mem:QI (plus:DI
3135 (match_operand:DI 1 "register_operand" "+r")
3136 (match_operand:DI 2 "int5_operand" "L")))))
3137 (set (match_dup 1) (plus:DI (match_dup 1) (match_dup 2)))]
3140 [(set_attr "type" "load")
3141 (set_attr "length" "4")])
3144 [(set (mem:QI (plus:SI (match_operand:SI 0 "register_operand" "+r")
3145 (match_operand:SI 1 "int5_operand" "L")))
3146 (match_operand:QI 2 "reg_or_0_operand" "rM"))
3148 (plus:SI (match_dup 0) (match_dup 1)))]
3150 "{stbs|stb},mb %r2,%1(%0)"
3151 [(set_attr "type" "store")
3152 (set_attr "length" "4")])
3155 [(set (mem:QI (plus:DI (match_operand:DI 0 "register_operand" "+r")
3156 (match_operand:DI 1 "int5_operand" "L")))
3157 (match_operand:QI 2 "reg_or_0_operand" "rM"))
3159 (plus:DI (match_dup 0) (match_dup 1)))]
3162 [(set_attr "type" "store")
3163 (set_attr "length" "4")])
3165 ;; The definition of this insn does not really explain what it does,
3166 ;; but it should suffice that anything generated as this insn will be
3167 ;; recognized as a movmemsi operation, and that it will not successfully
3168 ;; combine with anything.
3169 (define_expand "movmemsi"
3170 [(parallel [(set (match_operand:BLK 0 "" "")
3171 (match_operand:BLK 1 "" ""))
3172 (clobber (match_dup 4))
3173 (clobber (match_dup 5))
3174 (clobber (match_dup 6))
3175 (clobber (match_dup 7))
3176 (clobber (match_dup 8))
3177 (use (match_operand:SI 2 "arith14_operand" ""))
3178 (use (match_operand:SI 3 "const_int_operand" ""))])]
3179 "!TARGET_64BIT && optimize > 0"
3184 /* HP provides very fast block move library routine for the PA;
3185 this routine includes:
3187 4x4 byte at a time block moves,
3188 1x4 byte at a time with alignment checked at runtime with
3189 attempts to align the source and destination as needed
3192 With that in mind, here's the heuristics to try and guess when
3193 the inlined block move will be better than the library block
3196 If the size isn't constant, then always use the library routines.
3198 If the size is large in respect to the known alignment, then use
3199 the library routines.
3201 If the size is small in respect to the known alignment, then open
3202 code the copy (since that will lead to better scheduling).
3204 Else use the block move pattern. */
3206 /* Undetermined size, use the library routine. */
3207 if (GET_CODE (operands[2]) != CONST_INT)
3210 size = INTVAL (operands[2]);
3211 align = INTVAL (operands[3]);
3212 align = align > 4 ? 4 : (align ? align : 1);
3214 /* If size/alignment is large, then use the library routines. */
3215 if (size / align > 16)
3218 /* This does happen, but not often enough to worry much about. */
3219 if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3222 /* Fall through means we're going to use our block move pattern. */
3224 = replace_equiv_address (operands[0],
3225 copy_to_mode_reg (SImode, XEXP (operands[0], 0)));
3227 = replace_equiv_address (operands[1],
3228 copy_to_mode_reg (SImode, XEXP (operands[1], 0)));
3229 operands[4] = gen_reg_rtx (SImode);
3230 operands[5] = gen_reg_rtx (SImode);
3231 operands[6] = gen_reg_rtx (SImode);
3232 operands[7] = gen_reg_rtx (SImode);
3233 operands[8] = gen_reg_rtx (SImode);
3236 ;; The operand constraints are written like this to support both compile-time
3237 ;; and run-time determined byte counts. The expander and pa_output_block_move
3238 ;; only support compile-time determined counts at this time.
3240 ;; If the count is run-time determined, the register with the byte count
3241 ;; is clobbered by the copying code, and therefore it is forced to operand 2.
3243 ;; We used to clobber operands 0 and 1. However, a change to regrename.c
3244 ;; broke this semantic for pseudo registers. We can't use match_scratch
3245 ;; as this requires two registers in the class R1_REGS when the MEMs for
3246 ;; operands 0 and 1 are both equivalent to symbolic MEMs. Thus, we are
3247 ;; forced to internally copy operands 0 and 1 to operands 7 and 8,
3248 ;; respectively. We then split or peephole optimize after reload.
3249 (define_insn "movmemsi_prereload"
3250 [(set (mem:BLK (match_operand:SI 0 "register_operand" "r,r"))
3251 (mem:BLK (match_operand:SI 1 "register_operand" "r,r")))
3252 (clobber (match_operand:SI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3253 (clobber (match_operand:SI 3 "register_operand" "=&r,&r")) ;item tmp1
3254 (clobber (match_operand:SI 6 "register_operand" "=&r,&r")) ;item tmp2
3255 (clobber (match_operand:SI 7 "register_operand" "=&r,&r")) ;item tmp3
3256 (clobber (match_operand:SI 8 "register_operand" "=&r,&r")) ;item tmp4
3257 (use (match_operand:SI 4 "arith14_operand" "J,2")) ;byte count
3258 (use (match_operand:SI 5 "const_int_operand" "n,n"))] ;alignment
3261 [(set_attr "type" "multi,multi")])
3264 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3265 (match_operand:BLK 1 "memory_operand" ""))
3266 (clobber (match_operand:SI 2 "register_operand" ""))
3267 (clobber (match_operand:SI 3 "register_operand" ""))
3268 (clobber (match_operand:SI 6 "register_operand" ""))
3269 (clobber (match_operand:SI 7 "register_operand" ""))
3270 (clobber (match_operand:SI 8 "register_operand" ""))
3271 (use (match_operand:SI 4 "arith14_operand" ""))
3272 (use (match_operand:SI 5 "const_int_operand" ""))])]
3273 "!TARGET_64BIT && reload_completed && !flag_peephole2
3274 && GET_CODE (operands[0]) == MEM
3275 && register_operand (XEXP (operands[0], 0), SImode)
3276 && GET_CODE (operands[1]) == MEM
3277 && register_operand (XEXP (operands[1], 0), SImode)"
3278 [(set (match_dup 7) (match_dup 9))
3279 (set (match_dup 8) (match_dup 10))
3280 (parallel [(set (match_dup 0) (match_dup 1))
3281 (clobber (match_dup 2))
3282 (clobber (match_dup 3))
3283 (clobber (match_dup 6))
3284 (clobber (match_dup 7))
3285 (clobber (match_dup 8))
3291 operands[9] = XEXP (operands[0], 0);
3292 operands[10] = XEXP (operands[1], 0);
3293 operands[0] = replace_equiv_address (operands[0], operands[7]);
3294 operands[1] = replace_equiv_address (operands[1], operands[8]);
3298 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3299 (match_operand:BLK 1 "memory_operand" ""))
3300 (clobber (match_operand:SI 2 "register_operand" ""))
3301 (clobber (match_operand:SI 3 "register_operand" ""))
3302 (clobber (match_operand:SI 6 "register_operand" ""))
3303 (clobber (match_operand:SI 7 "register_operand" ""))
3304 (clobber (match_operand:SI 8 "register_operand" ""))
3305 (use (match_operand:SI 4 "arith14_operand" ""))
3306 (use (match_operand:SI 5 "const_int_operand" ""))])]
3308 && GET_CODE (operands[0]) == MEM
3309 && register_operand (XEXP (operands[0], 0), SImode)
3310 && GET_CODE (operands[1]) == MEM
3311 && register_operand (XEXP (operands[1], 0), SImode)"
3312 [(parallel [(set (match_dup 0) (match_dup 1))
3313 (clobber (match_dup 2))
3314 (clobber (match_dup 3))
3315 (clobber (match_dup 6))
3316 (clobber (match_dup 7))
3317 (clobber (match_dup 8))
3323 rtx addr = XEXP (operands[0], 0);
3324 if (dead_or_set_p (curr_insn, addr))
3328 emit_insn (gen_rtx_SET (VOIDmode, operands[7], addr));
3329 operands[0] = replace_equiv_address (operands[0], operands[7]);
3332 addr = XEXP (operands[1], 0);
3333 if (dead_or_set_p (curr_insn, addr))
3337 emit_insn (gen_rtx_SET (VOIDmode, operands[8], addr));
3338 operands[1] = replace_equiv_address (operands[1], operands[8]);
3342 (define_insn "movmemsi_postreload"
3343 [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r,r"))
3344 (mem:BLK (match_operand:SI 1 "register_operand" "+r,r")))
3345 (clobber (match_operand:SI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3346 (clobber (match_operand:SI 3 "register_operand" "=&r,&r")) ;item tmp1
3347 (clobber (match_operand:SI 6 "register_operand" "=&r,&r")) ;item tmp2
3348 (clobber (match_dup 0))
3349 (clobber (match_dup 1))
3350 (use (match_operand:SI 4 "arith14_operand" "J,2")) ;byte count
3351 (use (match_operand:SI 5 "const_int_operand" "n,n")) ;alignment
3353 "!TARGET_64BIT && reload_completed"
3354 "* return pa_output_block_move (operands, !which_alternative);"
3355 [(set_attr "type" "multi,multi")])
3357 (define_expand "movmemdi"
3358 [(parallel [(set (match_operand:BLK 0 "" "")
3359 (match_operand:BLK 1 "" ""))
3360 (clobber (match_dup 4))
3361 (clobber (match_dup 5))
3362 (clobber (match_dup 6))
3363 (clobber (match_dup 7))
3364 (clobber (match_dup 8))
3365 (use (match_operand:DI 2 "arith14_operand" ""))
3366 (use (match_operand:DI 3 "const_int_operand" ""))])]
3367 "TARGET_64BIT && optimize > 0"
3372 /* HP provides very fast block move library routine for the PA;
3373 this routine includes:
3375 4x4 byte at a time block moves,
3376 1x4 byte at a time with alignment checked at runtime with
3377 attempts to align the source and destination as needed
3380 With that in mind, here's the heuristics to try and guess when
3381 the inlined block move will be better than the library block
3384 If the size isn't constant, then always use the library routines.
3386 If the size is large in respect to the known alignment, then use
3387 the library routines.
3389 If the size is small in respect to the known alignment, then open
3390 code the copy (since that will lead to better scheduling).
3392 Else use the block move pattern. */
3394 /* Undetermined size, use the library routine. */
3395 if (GET_CODE (operands[2]) != CONST_INT)
3398 size = INTVAL (operands[2]);
3399 align = INTVAL (operands[3]);
3400 align = align > 8 ? 8 : (align ? align : 1);
3402 /* If size/alignment is large, then use the library routines. */
3403 if (size / align > 16)
3406 /* This does happen, but not often enough to worry much about. */
3407 if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3410 /* Fall through means we're going to use our block move pattern. */
3412 = replace_equiv_address (operands[0],
3413 copy_to_mode_reg (DImode, XEXP (operands[0], 0)));
3415 = replace_equiv_address (operands[1],
3416 copy_to_mode_reg (DImode, XEXP (operands[1], 0)));
3417 operands[4] = gen_reg_rtx (DImode);
3418 operands[5] = gen_reg_rtx (DImode);
3419 operands[6] = gen_reg_rtx (DImode);
3420 operands[7] = gen_reg_rtx (DImode);
3421 operands[8] = gen_reg_rtx (DImode);
3424 ;; The operand constraints are written like this to support both compile-time
3425 ;; and run-time determined byte counts. The expander and pa_output_block_move
3426 ;; only support compile-time determined counts at this time.
3428 ;; If the count is run-time determined, the register with the byte count
3429 ;; is clobbered by the copying code, and therefore it is forced to operand 2.
3431 ;; We used to clobber operands 0 and 1. However, a change to regrename.c
3432 ;; broke this semantic for pseudo registers. We can't use match_scratch
3433 ;; as this requires two registers in the class R1_REGS when the MEMs for
3434 ;; operands 0 and 1 are both equivalent to symbolic MEMs. Thus, we are
3435 ;; forced to internally copy operands 0 and 1 to operands 7 and 8,
3436 ;; respectively. We then split or peephole optimize after reload.
3437 (define_insn "movmemdi_prereload"
3438 [(set (mem:BLK (match_operand:DI 0 "register_operand" "r,r"))
3439 (mem:BLK (match_operand:DI 1 "register_operand" "r,r")))
3440 (clobber (match_operand:DI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3441 (clobber (match_operand:DI 3 "register_operand" "=&r,&r")) ;item tmp1
3442 (clobber (match_operand:DI 6 "register_operand" "=&r,&r")) ;item tmp2
3443 (clobber (match_operand:DI 7 "register_operand" "=&r,&r")) ;item tmp3
3444 (clobber (match_operand:DI 8 "register_operand" "=&r,&r")) ;item tmp4
3445 (use (match_operand:DI 4 "arith14_operand" "J,2")) ;byte count
3446 (use (match_operand:DI 5 "const_int_operand" "n,n"))] ;alignment
3449 [(set_attr "type" "multi,multi")])
3452 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3453 (match_operand:BLK 1 "memory_operand" ""))
3454 (clobber (match_operand:DI 2 "register_operand" ""))
3455 (clobber (match_operand:DI 3 "register_operand" ""))
3456 (clobber (match_operand:DI 6 "register_operand" ""))
3457 (clobber (match_operand:DI 7 "register_operand" ""))
3458 (clobber (match_operand:DI 8 "register_operand" ""))
3459 (use (match_operand:DI 4 "arith14_operand" ""))
3460 (use (match_operand:DI 5 "const_int_operand" ""))])]
3461 "TARGET_64BIT && reload_completed && !flag_peephole2
3462 && GET_CODE (operands[0]) == MEM
3463 && register_operand (XEXP (operands[0], 0), DImode)
3464 && GET_CODE (operands[1]) == MEM
3465 && register_operand (XEXP (operands[1], 0), DImode)"
3466 [(set (match_dup 7) (match_dup 9))
3467 (set (match_dup 8) (match_dup 10))
3468 (parallel [(set (match_dup 0) (match_dup 1))
3469 (clobber (match_dup 2))
3470 (clobber (match_dup 3))
3471 (clobber (match_dup 6))
3472 (clobber (match_dup 7))
3473 (clobber (match_dup 8))
3479 operands[9] = XEXP (operands[0], 0);
3480 operands[10] = XEXP (operands[1], 0);
3481 operands[0] = replace_equiv_address (operands[0], operands[7]);
3482 operands[1] = replace_equiv_address (operands[1], operands[8]);
3486 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3487 (match_operand:BLK 1 "memory_operand" ""))
3488 (clobber (match_operand:DI 2 "register_operand" ""))
3489 (clobber (match_operand:DI 3 "register_operand" ""))
3490 (clobber (match_operand:DI 6 "register_operand" ""))
3491 (clobber (match_operand:DI 7 "register_operand" ""))
3492 (clobber (match_operand:DI 8 "register_operand" ""))
3493 (use (match_operand:DI 4 "arith14_operand" ""))
3494 (use (match_operand:DI 5 "const_int_operand" ""))])]
3496 && GET_CODE (operands[0]) == MEM
3497 && register_operand (XEXP (operands[0], 0), DImode)
3498 && GET_CODE (operands[1]) == MEM
3499 && register_operand (XEXP (operands[1], 0), DImode)"
3500 [(parallel [(set (match_dup 0) (match_dup 1))
3501 (clobber (match_dup 2))
3502 (clobber (match_dup 3))
3503 (clobber (match_dup 6))
3504 (clobber (match_dup 7))
3505 (clobber (match_dup 8))
3511 rtx addr = XEXP (operands[0], 0);
3512 if (dead_or_set_p (curr_insn, addr))
3516 emit_insn (gen_rtx_SET (VOIDmode, operands[7], addr));
3517 operands[0] = replace_equiv_address (operands[0], operands[7]);
3520 addr = XEXP (operands[1], 0);
3521 if (dead_or_set_p (curr_insn, addr))
3525 emit_insn (gen_rtx_SET (VOIDmode, operands[8], addr));
3526 operands[1] = replace_equiv_address (operands[1], operands[8]);
3530 (define_insn "movmemdi_postreload"
3531 [(set (mem:BLK (match_operand:DI 0 "register_operand" "+r,r"))
3532 (mem:BLK (match_operand:DI 1 "register_operand" "+r,r")))
3533 (clobber (match_operand:DI 2 "register_operand" "=&r,&r")) ;loop cnt/tmp
3534 (clobber (match_operand:DI 3 "register_operand" "=&r,&r")) ;item tmp1
3535 (clobber (match_operand:DI 6 "register_operand" "=&r,&r")) ;item tmp2
3536 (clobber (match_dup 0))
3537 (clobber (match_dup 1))
3538 (use (match_operand:DI 4 "arith14_operand" "J,2")) ;byte count
3539 (use (match_operand:DI 5 "const_int_operand" "n,n")) ;alignment
3541 "TARGET_64BIT && reload_completed"
3542 "* return pa_output_block_move (operands, !which_alternative);"
3543 [(set_attr "type" "multi,multi")])
3545 (define_expand "setmemsi"
3546 [(parallel [(set (match_operand:BLK 0 "" "")
3547 (match_operand 2 "const_int_operand" ""))
3548 (clobber (match_dup 4))
3549 (clobber (match_dup 5))
3550 (use (match_operand:SI 1 "arith14_operand" ""))
3551 (use (match_operand:SI 3 "const_int_operand" ""))])]
3552 "!TARGET_64BIT && optimize > 0"
3557 /* If value to set is not zero, use the library routine. */
3558 if (operands[2] != const0_rtx)
3561 /* Undetermined size, use the library routine. */
3562 if (GET_CODE (operands[1]) != CONST_INT)
3565 size = INTVAL (operands[1]);
3566 align = INTVAL (operands[3]);
3567 align = align > 4 ? 4 : align;
3569 /* If size/alignment is large, then use the library routines. */
3570 if (size / align > 16)
3573 /* This does happen, but not often enough to worry much about. */
3574 if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3577 /* Fall through means we're going to use our block clear pattern. */
3579 = replace_equiv_address (operands[0],
3580 copy_to_mode_reg (SImode, XEXP (operands[0], 0)));
3581 operands[4] = gen_reg_rtx (SImode);
3582 operands[5] = gen_reg_rtx (SImode);
3585 (define_insn "clrmemsi_prereload"
3586 [(set (mem:BLK (match_operand:SI 0 "register_operand" "r,r"))
3588 (clobber (match_operand:SI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3589 (clobber (match_operand:SI 4 "register_operand" "=&r,&r")) ;tmp1
3590 (use (match_operand:SI 2 "arith14_operand" "J,1")) ;byte count
3591 (use (match_operand:SI 3 "const_int_operand" "n,n"))] ;alignment
3594 [(set_attr "type" "multi,multi")])
3597 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3599 (clobber (match_operand:SI 1 "register_operand" ""))
3600 (clobber (match_operand:SI 4 "register_operand" ""))
3601 (use (match_operand:SI 2 "arith14_operand" ""))
3602 (use (match_operand:SI 3 "const_int_operand" ""))])]
3603 "!TARGET_64BIT && reload_completed && !flag_peephole2
3604 && GET_CODE (operands[0]) == MEM
3605 && register_operand (XEXP (operands[0], 0), SImode)"
3606 [(set (match_dup 4) (match_dup 5))
3607 (parallel [(set (match_dup 0) (const_int 0))
3608 (clobber (match_dup 1))
3609 (clobber (match_dup 4))
3615 operands[5] = XEXP (operands[0], 0);
3616 operands[0] = replace_equiv_address (operands[0], operands[4]);
3620 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3622 (clobber (match_operand:SI 1 "register_operand" ""))
3623 (clobber (match_operand:SI 4 "register_operand" ""))
3624 (use (match_operand:SI 2 "arith14_operand" ""))
3625 (use (match_operand:SI 3 "const_int_operand" ""))])]
3627 && GET_CODE (operands[0]) == MEM
3628 && register_operand (XEXP (operands[0], 0), SImode)"
3629 [(parallel [(set (match_dup 0) (const_int 0))
3630 (clobber (match_dup 1))
3631 (clobber (match_dup 4))
3637 rtx addr = XEXP (operands[0], 0);
3638 if (dead_or_set_p (curr_insn, addr))
3642 emit_insn (gen_rtx_SET (VOIDmode, operands[4], addr));
3643 operands[0] = replace_equiv_address (operands[0], operands[4]);
3647 (define_insn "clrmemsi_postreload"
3648 [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r,r"))
3650 (clobber (match_operand:SI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3651 (clobber (match_dup 0))
3652 (use (match_operand:SI 2 "arith14_operand" "J,1")) ;byte count
3653 (use (match_operand:SI 3 "const_int_operand" "n,n")) ;alignment
3655 "!TARGET_64BIT && reload_completed"
3656 "* return pa_output_block_clear (operands, !which_alternative);"
3657 [(set_attr "type" "multi,multi")])
3659 (define_expand "setmemdi"
3660 [(parallel [(set (match_operand:BLK 0 "" "")
3661 (match_operand 2 "const_int_operand" ""))
3662 (clobber (match_dup 4))
3663 (clobber (match_dup 5))
3664 (use (match_operand:DI 1 "arith14_operand" ""))
3665 (use (match_operand:DI 3 "const_int_operand" ""))])]
3666 "TARGET_64BIT && optimize > 0"
3671 /* If value to set is not zero, use the library routine. */
3672 if (operands[2] != const0_rtx)
3675 /* Undetermined size, use the library routine. */
3676 if (GET_CODE (operands[1]) != CONST_INT)
3679 size = INTVAL (operands[1]);
3680 align = INTVAL (operands[3]);
3681 align = align > 8 ? 8 : align;
3683 /* If size/alignment is large, then use the library routines. */
3684 if (size / align > 16)
3687 /* This does happen, but not often enough to worry much about. */
3688 if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
3691 /* Fall through means we're going to use our block clear pattern. */
3693 = replace_equiv_address (operands[0],
3694 copy_to_mode_reg (DImode, XEXP (operands[0], 0)));
3695 operands[4] = gen_reg_rtx (DImode);
3696 operands[5] = gen_reg_rtx (DImode);
3699 (define_insn "clrmemdi_prereload"
3700 [(set (mem:BLK (match_operand:DI 0 "register_operand" "r,r"))
3702 (clobber (match_operand:DI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3703 (clobber (match_operand:DI 4 "register_operand" "=&r,&r")) ;item tmp1
3704 (use (match_operand:DI 2 "arith14_operand" "J,1")) ;byte count
3705 (use (match_operand:DI 3 "const_int_operand" "n,n"))] ;alignment
3708 [(set_attr "type" "multi,multi")])
3711 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3713 (clobber (match_operand:DI 1 "register_operand" ""))
3714 (clobber (match_operand:DI 4 "register_operand" ""))
3715 (use (match_operand:DI 2 "arith14_operand" ""))
3716 (use (match_operand:DI 3 "const_int_operand" ""))])]
3717 "TARGET_64BIT && reload_completed && !flag_peephole2
3718 && GET_CODE (operands[0]) == MEM
3719 && register_operand (XEXP (operands[0], 0), DImode)"
3720 [(set (match_dup 4) (match_dup 5))
3721 (parallel [(set (match_dup 0) (const_int 0))
3722 (clobber (match_dup 1))
3723 (clobber (match_dup 4))
3729 operands[5] = XEXP (operands[0], 0);
3730 operands[0] = replace_equiv_address (operands[0], operands[4]);
3734 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
3736 (clobber (match_operand:DI 1 "register_operand" ""))
3737 (clobber (match_operand:DI 4 "register_operand" ""))
3738 (use (match_operand:DI 2 "arith14_operand" ""))
3739 (use (match_operand:DI 3 "const_int_operand" ""))])]
3741 && GET_CODE (operands[0]) == MEM
3742 && register_operand (XEXP (operands[0], 0), DImode)"
3743 [(parallel [(set (match_dup 0) (const_int 0))
3744 (clobber (match_dup 1))
3745 (clobber (match_dup 4))
3751 rtx addr = XEXP (operands[0], 0);
3752 if (dead_or_set_p (curr_insn, addr))
3756 emit_insn (gen_rtx_SET (VOIDmode, operands[4], addr));
3757 operands[0] = replace_equiv_address (operands[0], operands[4]);
3761 (define_insn "clrmemdi_postreload"
3762 [(set (mem:BLK (match_operand:DI 0 "register_operand" "+r,r"))
3764 (clobber (match_operand:DI 1 "register_operand" "=&r,&r")) ;loop cnt/tmp
3765 (clobber (match_dup 0))
3766 (use (match_operand:DI 2 "arith14_operand" "J,1")) ;byte count
3767 (use (match_operand:DI 3 "const_int_operand" "n,n")) ;alignment
3769 "TARGET_64BIT && reload_completed"
3770 "* return pa_output_block_clear (operands, !which_alternative);"
3771 [(set_attr "type" "multi,multi")])
3773 ;; Floating point move insns
3775 (define_expand "movdf"
3776 [(set (match_operand:DF 0 "general_operand" "")
3777 (match_operand:DF 1 "general_operand" ""))]
3781 if (pa_emit_move_sequence (operands, DFmode, 0))
3785 ;; Handle DFmode input reloads requiring %r1 as a scratch register.
3786 (define_expand "reload_indf_r1"
3787 [(set (match_operand:DF 0 "register_operand" "=Z")
3788 (match_operand:DF 1 "non_hard_reg_operand" ""))
3789 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
3793 if (pa_emit_move_sequence (operands, DFmode, operands[2]))
3796 /* We don't want the clobber emitted, so handle this ourselves. */
3797 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3801 ;; Handle DFmode input reloads requiring a general register as a
3802 ;; scratch register.
3803 (define_expand "reload_indf"
3804 [(set (match_operand:DF 0 "register_operand" "=Z")
3805 (match_operand:DF 1 "non_hard_reg_operand" ""))
3806 (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3810 if (pa_emit_move_sequence (operands, DFmode, operands[2]))
3813 /* We don't want the clobber emitted, so handle this ourselves. */
3814 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3818 ;; Handle DFmode output reloads requiring a general register as a
3819 ;; scratch register.
3820 (define_expand "reload_outdf"
3821 [(set (match_operand:DF 0 "non_hard_reg_operand" "")
3822 (match_operand:DF 1 "register_operand" "Z"))
3823 (clobber (match_operand:DF 2 "register_operand" "=&r"))]
3827 if (pa_emit_move_sequence (operands, DFmode, operands[2]))
3830 /* We don't want the clobber emitted, so handle this ourselves. */
3831 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
3836 [(set (match_operand:DF 0 "move_dest_operand"
3837 "=f,*r,T,?o,?Q,f,*r,*r,?*r,?f")
3838 (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
3839 "fG,*rG,f,*r,*r,RT,o,RQ,f,*r"))]
3840 "(register_operand (operands[0], DFmode)
3841 || reg_or_0_operand (operands[1], DFmode))
3842 && !(GET_CODE (operands[1]) == CONST_DOUBLE
3843 && GET_CODE (operands[0]) == MEM)
3845 && !TARGET_SOFT_FLOAT"
3848 if ((FP_REG_P (operands[0]) || FP_REG_P (operands[1])
3849 || operands[1] == CONST0_RTX (DFmode))
3850 && !(REG_P (operands[0]) && REG_P (operands[1])
3851 && FP_REG_P (operands[0]) ^ FP_REG_P (operands[1])))
3852 return pa_output_fp_move_double (operands);
3853 return pa_output_move_double (operands);
3855 [(set_attr "type" "fpalu,move,fpstore,store,store,fpload,load,load,fpstore_load,store_fpload")
3856 (set_attr "length" "4,8,4,8,16,4,8,16,12,12")])
3859 [(set (match_operand:DF 0 "indexed_memory_operand" "=R")
3860 (match_operand:DF 1 "reg_or_0_operand" "f"))]
3862 && !TARGET_DISABLE_INDEXING
3863 && reload_completed"
3865 [(set_attr "type" "fpstore")
3866 (set_attr "pa_combine_type" "addmove")
3867 (set_attr "length" "4")])
3870 [(set (match_operand:SI 0 "register_operand" "")
3871 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
3873 (match_operand:SI 2 "register_operand" "")))
3874 (set (mem:DF (match_dup 0))
3875 (match_operand:DF 3 "register_operand" ""))]
3877 && !TARGET_DISABLE_INDEXING
3878 && REG_OK_FOR_BASE_P (operands[2])
3879 && FP_REGNO_P (REGNO (operands[3]))"
3880 [(set (mem:DF (plus:SI (mult:SI (match_dup 1) (const_int 8)) (match_dup 2)))
3882 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 8))
3887 [(set (match_operand:SI 0 "register_operand" "")
3888 (plus:SI (match_operand:SI 2 "register_operand" "")
3889 (mult:SI (match_operand:SI 1 "register_operand" "")
3891 (set (mem:DF (match_dup 0))
3892 (match_operand:DF 3 "register_operand" ""))]
3894 && !TARGET_DISABLE_INDEXING
3895 && REG_OK_FOR_BASE_P (operands[2])
3896 && FP_REGNO_P (REGNO (operands[3]))"
3897 [(set (mem:DF (plus:SI (mult:SI (match_dup 1) (const_int 8)) (match_dup 2)))
3899 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 8))
3904 [(set (match_operand:DI 0 "register_operand" "")
3905 (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
3907 (match_operand:DI 2 "register_operand" "")))
3908 (set (mem:DF (match_dup 0))
3909 (match_operand:DF 3 "register_operand" ""))]
3911 && !TARGET_DISABLE_INDEXING
3913 && REG_OK_FOR_BASE_P (operands[2])
3914 && FP_REGNO_P (REGNO (operands[3]))"
3915 [(set (mem:DF (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
3917 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
3922 [(set (match_operand:DI 0 "register_operand" "")
3923 (plus:DI (match_operand:DI 2 "register_operand" "")
3924 (mult:DI (match_operand:DI 1 "register_operand" "")
3926 (set (mem:DF (match_dup 0))
3927 (match_operand:DF 3 "register_operand" ""))]
3929 && !TARGET_DISABLE_INDEXING
3931 && REG_OK_FOR_BASE_P (operands[2])
3932 && FP_REGNO_P (REGNO (operands[3]))"
3933 [(set (mem:DF (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
3935 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
3940 [(set (match_operand:SI 0 "register_operand" "")
3941 (plus:SI (match_operand:SI 1 "register_operand" "")
3942 (match_operand:SI 2 "register_operand" "")))
3943 (set (mem:DF (match_dup 0))
3944 (match_operand:DF 3 "register_operand" ""))]
3946 && !TARGET_DISABLE_INDEXING
3947 && TARGET_NO_SPACE_REGS
3948 && REG_OK_FOR_INDEX_P (operands[1])
3949 && REG_OK_FOR_BASE_P (operands[2])
3950 && FP_REGNO_P (REGNO (operands[3]))"
3951 [(set (mem:DF (plus:SI (match_dup 1) (match_dup 2)))
3953 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
3957 [(set (match_operand:SI 0 "register_operand" "")
3958 (plus:SI (match_operand:SI 1 "register_operand" "")
3959 (match_operand:SI 2 "register_operand" "")))
3960 (set (mem:DF (match_dup 0))
3961 (match_operand:DF 3 "register_operand" ""))]
3963 && !TARGET_DISABLE_INDEXING
3964 && TARGET_NO_SPACE_REGS
3965 && REG_OK_FOR_BASE_P (operands[1])
3966 && REG_OK_FOR_INDEX_P (operands[2])
3967 && FP_REGNO_P (REGNO (operands[3]))"
3968 [(set (mem:DF (plus:SI (match_dup 2) (match_dup 1)))
3970 (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
3974 [(set (match_operand:DI 0 "register_operand" "")
3975 (plus:DI (match_operand:DI 1 "register_operand" "")
3976 (match_operand:DI 2 "register_operand" "")))
3977 (set (mem:DF (match_dup 0))
3978 (match_operand:DF 3 "register_operand" ""))]
3980 && !TARGET_DISABLE_INDEXING
3982 && TARGET_NO_SPACE_REGS
3983 && REG_OK_FOR_INDEX_P (operands[1])
3984 && REG_OK_FOR_BASE_P (operands[2])
3985 && FP_REGNO_P (REGNO (operands[3]))"
3986 [(set (mem:DF (plus:DI (match_dup 1) (match_dup 2)))
3988 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3992 [(set (match_operand:DI 0 "register_operand" "")
3993 (plus:DI (match_operand:DI 1 "register_operand" "")
3994 (match_operand:DI 2 "register_operand" "")))
3995 (set (mem:DF (match_dup 0))
3996 (match_operand:DF 3 "register_operand" ""))]
3998 && !TARGET_DISABLE_INDEXING
4000 && TARGET_NO_SPACE_REGS
4001 && REG_OK_FOR_BASE_P (operands[1])
4002 && REG_OK_FOR_INDEX_P (operands[2])
4003 && FP_REGNO_P (REGNO (operands[3]))"
4004 [(set (mem:DF (plus:DI (match_dup 2) (match_dup 1)))
4006 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
4010 [(set (match_operand:DF 0 "move_dest_operand"
4012 (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
4014 "(register_operand (operands[0], DFmode)
4015 || reg_or_0_operand (operands[1], DFmode))
4017 && TARGET_SOFT_FLOAT"
4020 return pa_output_move_double (operands);
4022 [(set_attr "type" "move,store,store,load,load")
4023 (set_attr "length" "8,8,16,8,16")])
4026 [(set (match_operand:DF 0 "move_dest_operand"
4027 "=!*r,*r,*r,*r,*r,Q,f,f,T")
4028 (match_operand:DF 1 "move_src_operand"
4029 "!*r,J,N,K,RQ,*rG,fG,RT,f"))]
4030 "(register_operand (operands[0], DFmode)
4031 || reg_or_0_operand (operands[1], DFmode))
4032 && !TARGET_SOFT_FLOAT && TARGET_64BIT"
4043 [(set_attr "type" "move,move,move,shift,load,store,fpalu,fpload,fpstore")
4044 (set_attr "pa_combine_type" "addmove")
4045 (set_attr "length" "4,4,4,4,4,4,4,4,4")])
4048 (define_expand "movdi"
4049 [(set (match_operand:DI 0 "general_operand" "")
4050 (match_operand:DI 1 "general_operand" ""))]
4054 if (pa_emit_move_sequence (operands, DImode, 0))
4058 ;; Handle DImode input reloads requiring %r1 as a scratch register.
4059 (define_expand "reload_indi_r1"
4060 [(set (match_operand:DI 0 "register_operand" "=Z")
4061 (match_operand:DI 1 "non_hard_reg_operand" ""))
4062 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
4066 if (pa_emit_move_sequence (operands, DImode, operands[2]))
4069 /* We don't want the clobber emitted, so handle this ourselves. */
4070 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
4074 ;; Handle DImode input reloads requiring a general register as a
4075 ;; scratch register.
4076 (define_expand "reload_indi"
4077 [(set (match_operand:DI 0 "register_operand" "=Z")
4078 (match_operand:DI 1 "non_hard_reg_operand" ""))
4079 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
4083 if (pa_emit_move_sequence (operands, DImode, operands[2]))
4086 /* We don't want the clobber emitted, so handle this ourselves. */
4087 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
4091 ;; Handle DImode output reloads requiring a general register as a
4092 ;; scratch register.
4093 (define_expand "reload_outdi"
4094 [(set (match_operand:DI 0 "non_hard_reg_operand" "")
4095 (match_operand:DI 1 "register_operand" "Z"))
4096 (clobber (match_operand:SI 2 "register_operand" "=&r"))]
4100 if (pa_emit_move_sequence (operands, DImode, operands[2]))
4103 /* We don't want the clobber emitted, so handle this ourselves. */
4104 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
4109 [(set (match_operand:DI 0 "register_operand" "=r")
4110 (high:DI (match_operand 1 "" "")))]
4114 rtx op0 = operands[0];
4115 rtx op1 = operands[1];
4117 switch (GET_CODE (op1))
4120 #if HOST_BITS_PER_WIDE_INT <= 32
4121 operands[0] = operand_subword (op0, 1, 0, DImode);
4122 output_asm_insn (\"ldil L'%1,%0\", operands);
4124 operands[0] = operand_subword (op0, 0, 0, DImode);
4125 if (INTVAL (op1) < 0)
4126 output_asm_insn (\"ldi -1,%0\", operands);
4128 output_asm_insn (\"ldi 0,%0\", operands);
4130 operands[0] = operand_subword (op0, 1, 0, DImode);
4131 operands[1] = GEN_INT (INTVAL (op1) & 0xffffffff);
4132 output_asm_insn (\"ldil L'%1,%0\", operands);
4134 operands[0] = operand_subword (op0, 0, 0, DImode);
4135 operands[1] = GEN_INT (INTVAL (op1) >> 32);
4136 output_asm_insn (pa_singlemove_string (operands), operands);
4141 operands[0] = operand_subword (op0, 1, 0, DImode);
4142 operands[1] = GEN_INT (CONST_DOUBLE_LOW (op1));
4143 output_asm_insn (\"ldil L'%1,%0\", operands);
4145 operands[0] = operand_subword (op0, 0, 0, DImode);
4146 operands[1] = GEN_INT (CONST_DOUBLE_HIGH (op1));
4147 output_asm_insn (pa_singlemove_string (operands), operands);
4155 [(set_attr "type" "move")
4156 (set_attr "length" "12")])
4159 [(set (match_operand:DI 0 "move_dest_operand"
4160 "=r,o,Q,r,r,r,*f,*f,T,?r,?*f")
4161 (match_operand:DI 1 "move_src_operand"
4162 "rM,r,r,o*R,Q,i,*fM,RT,*f,*f,r"))]
4163 "(register_operand (operands[0], DImode)
4164 || reg_or_0_operand (operands[1], DImode))
4166 && !TARGET_SOFT_FLOAT"
4169 if ((FP_REG_P (operands[0]) || FP_REG_P (operands[1])
4170 || operands[1] == CONST0_RTX (DFmode))
4171 && !(REG_P (operands[0]) && REG_P (operands[1])
4172 && FP_REG_P (operands[0]) ^ FP_REG_P (operands[1])))
4173 return pa_output_fp_move_double (operands);
4174 return pa_output_move_double (operands);
4177 "move,store,store,load,load,multi,fpalu,fpload,fpstore,fpstore_load,store_fpload")
4178 (set_attr "length" "8,8,16,8,16,16,4,4,4,12,12")])
4181 [(set (match_operand:DI 0 "move_dest_operand"
4182 "=r,r,r,r,r,r,Q,!*q,!r,!*f,*f,T")
4183 (match_operand:DI 1 "move_src_operand"
4184 "A,r,J,N,K,RQ,rM,!rM,!*q,!*fM,RT,*f"))]
4185 "(register_operand (operands[0], DImode)
4186 || reg_or_0_operand (operands[1], DImode))
4187 && !TARGET_SOFT_FLOAT && TARGET_64BIT"
4197 {mfctl|mfctl,w} %%sar,%0
4201 [(set_attr "type" "load,move,move,move,shift,load,store,move,move,fpalu,fpload,fpstore")
4202 (set_attr "pa_combine_type" "addmove")
4203 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4")])
4206 [(set (match_operand:DI 0 "indexed_memory_operand" "=R")
4207 (match_operand:DI 1 "register_operand" "f"))]
4210 && !TARGET_DISABLE_INDEXING
4211 && reload_completed"
4213 [(set_attr "type" "fpstore")
4214 (set_attr "pa_combine_type" "addmove")
4215 (set_attr "length" "4")])
4218 [(set (match_operand:DI 0 "register_operand" "")
4219 (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
4221 (match_operand:DI 2 "register_operand" "")))
4222 (set (mem:DI (match_dup 0))
4223 (match_operand:DI 3 "register_operand" ""))]
4225 && !TARGET_DISABLE_INDEXING
4227 && REG_OK_FOR_BASE_P (operands[2])
4228 && FP_REGNO_P (REGNO (operands[3]))"
4229 [(set (mem:DI (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
4231 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
4236 [(set (match_operand:DI 0 "register_operand" "")
4237 (plus:DI (match_operand:DI 2 "register_operand" "")
4238 (mult:DI (match_operand:DI 1 "register_operand" "")
4240 (set (mem:DI (match_dup 0))
4241 (match_operand:DI 3 "register_operand" ""))]
4243 && !TARGET_DISABLE_INDEXING
4245 && REG_OK_FOR_BASE_P (operands[2])
4246 && FP_REGNO_P (REGNO (operands[3]))"
4247 [(set (mem:DI (plus:DI (mult:DI (match_dup 1) (const_int 8)) (match_dup 2)))
4249 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 8))
4254 [(set (match_operand:DI 0 "register_operand" "")
4255 (plus:DI (match_operand:DI 1 "register_operand" "")
4256 (match_operand:DI 2 "register_operand" "")))
4257 (set (mem:DI (match_dup 0))
4258 (match_operand:DI 3 "register_operand" ""))]
4260 && !TARGET_DISABLE_INDEXING
4262 && TARGET_NO_SPACE_REGS
4263 && REG_OK_FOR_INDEX_P (operands[1])
4264 && REG_OK_FOR_BASE_P (operands[2])
4265 && FP_REGNO_P (REGNO (operands[3]))"
4266 [(set (mem:DI (plus:DI (match_dup 1) (match_dup 2)))
4268 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
4272 [(set (match_operand:DI 0 "register_operand" "")
4273 (plus:DI (match_operand:DI 1 "register_operand" "")
4274 (match_operand:DI 2 "register_operand" "")))
4275 (set (mem:DI (match_dup 0))
4276 (match_operand:DI 3 "register_operand" ""))]
4278 && !TARGET_DISABLE_INDEXING
4280 && TARGET_NO_SPACE_REGS
4281 && REG_OK_FOR_BASE_P (operands[1])
4282 && REG_OK_FOR_INDEX_P (operands[2])
4283 && FP_REGNO_P (REGNO (operands[3]))"
4284 [(set (mem:DI (plus:DI (match_dup 2) (match_dup 1)))
4286 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
4290 [(set (match_operand:DI 0 "move_dest_operand"
4292 (match_operand:DI 1 "general_operand"
4294 "(register_operand (operands[0], DImode)
4295 || reg_or_0_operand (operands[1], DImode))
4297 && TARGET_SOFT_FLOAT"
4300 return pa_output_move_double (operands);
4302 [(set_attr "type" "move,store,store,load,load,multi")
4303 (set_attr "length" "8,8,16,8,16,16")])
4306 [(set (match_operand:DI 0 "register_operand" "=r,&r")
4307 (lo_sum:DI (match_operand:DI 1 "register_operand" "0,r")
4308 (match_operand:DI 2 "immediate_operand" "i,i")))]
4312 /* Don't output a 64-bit constant, since we can't trust the assembler to
4313 handle it correctly. */
4314 if (GET_CODE (operands[2]) == CONST_DOUBLE)
4315 operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[2]));
4316 else if (HOST_BITS_PER_WIDE_INT > 32
4317 && GET_CODE (operands[2]) == CONST_INT)
4318 operands[2] = GEN_INT (INTVAL (operands[2]) & 0xffffffff);
4319 if (which_alternative == 1)
4320 output_asm_insn (\"copy %1,%0\", operands);
4321 return \"ldo R'%G2(%R1),%R0\";
4323 [(set_attr "type" "move,move")
4324 (set_attr "length" "4,8")])
4326 (define_expand "movsf"
4327 [(set (match_operand:SF 0 "general_operand" "")
4328 (match_operand:SF 1 "general_operand" ""))]
4332 if (pa_emit_move_sequence (operands, SFmode, 0))
4336 ;; Handle SFmode input reloads requiring %r1 as a scratch register.
4337 (define_expand "reload_insf_r1"
4338 [(set (match_operand:SF 0 "register_operand" "=Z")
4339 (match_operand:SF 1 "non_hard_reg_operand" ""))
4340 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
4344 if (pa_emit_move_sequence (operands, SFmode, operands[2]))
4347 /* We don't want the clobber emitted, so handle this ourselves. */
4348 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
4352 ;; Handle SFmode input reloads requiring a general register as a
4353 ;; scratch register.
4354 (define_expand "reload_insf"
4355 [(set (match_operand:SF 0 "register_operand" "=Z")
4356 (match_operand:SF 1 "non_hard_reg_operand" ""))
4357 (clobber (match_operand:SF 2 "register_operand" "=&r"))]
4361 if (pa_emit_move_sequence (operands, SFmode, operands[2]))
4364 /* We don't want the clobber emitted, so handle this ourselves. */
4365 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
4369 ;; Handle SFmode output reloads requiring a general register as a
4370 ;; scratch register.
4371 (define_expand "reload_outsf"
4372 [(set (match_operand:SF 0 "non_hard_reg_operand" "")
4373 (match_operand:SF 1 "register_operand" "Z"))
4374 (clobber (match_operand:SF 2 "register_operand" "=&r"))]
4378 if (pa_emit_move_sequence (operands, SFmode, operands[2]))
4381 /* We don't want the clobber emitted, so handle this ourselves. */
4382 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
4387 [(set (match_operand:SF 0 "move_dest_operand"
4388 "=f,!*r,f,*r,T,Q,?*r,?f")
4389 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4390 "fG,!*rG,RT,RQ,f,*rG,f,*r"))]
4391 "(register_operand (operands[0], SFmode)
4392 || reg_or_0_operand (operands[1], SFmode))
4393 && !TARGET_SOFT_FLOAT
4402 {fstws|fstw} %1,-16(%%sp)\n\t{ldws|ldw} -16(%%sp),%0
4403 {stws|stw} %1,-16(%%sp)\n\t{fldws|fldw} -16(%%sp),%0"
4404 [(set_attr "type" "fpalu,move,fpload,load,fpstore,store,fpstore_load,store_fpload")
4405 (set_attr "pa_combine_type" "addmove")
4406 (set_attr "length" "4,4,4,4,4,4,8,8")])
4409 [(set (match_operand:SF 0 "move_dest_operand"
4411 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4412 "fG,!*rG,RT,RQ,f,*rG"))]
4413 "(register_operand (operands[0], SFmode)
4414 || reg_or_0_operand (operands[1], SFmode))
4415 && !TARGET_SOFT_FLOAT
4424 [(set_attr "type" "fpalu,move,fpload,load,fpstore,store")
4425 (set_attr "pa_combine_type" "addmove")
4426 (set_attr "length" "4,4,4,4,4,4")])
4429 [(set (match_operand:SF 0 "indexed_memory_operand" "=R")
4430 (match_operand:SF 1 "register_operand" "f"))]
4432 && !TARGET_DISABLE_INDEXING
4433 && reload_completed"
4435 [(set_attr "type" "fpstore")
4436 (set_attr "pa_combine_type" "addmove")
4437 (set_attr "length" "4")])
4440 [(set (match_operand:SI 0 "register_operand" "")
4441 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
4443 (match_operand:SI 2 "register_operand" "")))
4444 (set (mem:SF (match_dup 0))
4445 (match_operand:SF 3 "register_operand" ""))]
4447 && !TARGET_DISABLE_INDEXING
4448 && REG_OK_FOR_BASE_P (operands[2])
4449 && FP_REGNO_P (REGNO (operands[3]))"
4450 [(set (mem:SF (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
4452 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
4457 [(set (match_operand:SI 0 "register_operand" "")
4458 (plus:SI (match_operand:SI 2 "register_operand" "")
4459 (mult:SI (match_operand:SI 1 "register_operand" "")
4461 (set (mem:SF (match_dup 0))
4462 (match_operand:SF 3 "register_operand" ""))]
4464 && !TARGET_DISABLE_INDEXING
4465 && REG_OK_FOR_BASE_P (operands[2])
4466 && FP_REGNO_P (REGNO (operands[3]))"
4467 [(set (mem:SF (plus:SI (mult:SI (match_dup 1) (const_int 4)) (match_dup 2)))
4469 (set (match_dup 0) (plus:SI (mult:SI (match_dup 1) (const_int 4))
4474 [(set (match_operand:DI 0 "register_operand" "")
4475 (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
4477 (match_operand:DI 2 "register_operand" "")))
4478 (set (mem:SF (match_dup 0))
4479 (match_operand:SF 3 "register_operand" ""))]
4481 && !TARGET_DISABLE_INDEXING
4483 && REG_OK_FOR_BASE_P (operands[2])
4484 && FP_REGNO_P (REGNO (operands[3]))"
4485 [(set (mem:SF (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
4487 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
4492 [(set (match_operand:DI 0 "register_operand" "")
4493 (plus:DI (match_operand:DI 2 "register_operand" "")
4494 (mult:DI (match_operand:DI 1 "register_operand" "")
4496 (set (mem:SF (match_dup 0))
4497 (match_operand:SF 3 "register_operand" ""))]
4499 && !TARGET_DISABLE_INDEXING
4501 && REG_OK_FOR_BASE_P (operands[2])
4502 && FP_REGNO_P (REGNO (operands[3]))"
4503 [(set (mem:SF (plus:DI (mult:DI (match_dup 1) (const_int 4)) (match_dup 2)))
4505 (set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (const_int 4))
4510 [(set (match_operand:SI 0 "register_operand" "")
4511 (plus:SI (match_operand:SI 1 "register_operand" "")
4512 (match_operand:SI 2 "register_operand" "")))
4513 (set (mem:SF (match_dup 0))
4514 (match_operand:SF 3 "register_operand" ""))]
4516 && !TARGET_DISABLE_INDEXING
4517 && TARGET_NO_SPACE_REGS
4518 && REG_OK_FOR_INDEX_P (operands[1])
4519 && REG_OK_FOR_BASE_P (operands[2])
4520 && FP_REGNO_P (REGNO (operands[3]))"
4521 [(set (mem:SF (plus:SI (match_dup 1) (match_dup 2)))
4523 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
4527 [(set (match_operand:SI 0 "register_operand" "")
4528 (plus:SI (match_operand:SI 1 "register_operand" "")
4529 (match_operand:SI 2 "register_operand" "")))
4530 (set (mem:SF (match_dup 0))
4531 (match_operand:SF 3 "register_operand" ""))]
4533 && !TARGET_DISABLE_INDEXING
4534 && TARGET_NO_SPACE_REGS
4535 && REG_OK_FOR_BASE_P (operands[1])
4536 && REG_OK_FOR_INDEX_P (operands[2])
4537 && FP_REGNO_P (REGNO (operands[3]))"
4538 [(set (mem:SF (plus:SI (match_dup 2) (match_dup 1)))
4540 (set (match_dup 0) (plus:SI (match_dup 2) (match_dup 1)))]
4544 [(set (match_operand:DI 0 "register_operand" "")
4545 (plus:DI (match_operand:DI 1 "register_operand" "")
4546 (match_operand:DI 2 "register_operand" "")))
4547 (set (mem:SF (match_dup 0))
4548 (match_operand:SF 3 "register_operand" ""))]
4550 && !TARGET_DISABLE_INDEXING
4552 && TARGET_NO_SPACE_REGS
4553 && REG_OK_FOR_INDEX_P (operands[1])
4554 && REG_OK_FOR_BASE_P (operands[2])
4555 && FP_REGNO_P (REGNO (operands[3]))"
4556 [(set (mem:SF (plus:DI (match_dup 1) (match_dup 2)))
4558 (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
4562 [(set (match_operand:DI 0 "register_operand" "")
4563 (plus:DI (match_operand:DI 1 "register_operand" "")
4564 (match_operand:DI 2 "register_operand" "")))
4565 (set (mem:SF (match_dup 0))
4566 (match_operand:SF 3 "register_operand" ""))]
4568 && !TARGET_DISABLE_INDEXING
4570 && TARGET_NO_SPACE_REGS
4571 && REG_OK_FOR_BASE_P (operands[1])
4572 && REG_OK_FOR_INDEX_P (operands[2])
4573 && FP_REGNO_P (REGNO (operands[3]))"
4574 [(set (mem:SF (plus:DI (match_dup 2) (match_dup 1)))
4576 (set (match_dup 0) (plus:DI (match_dup 2) (match_dup 1)))]
4580 [(set (match_operand:SF 0 "move_dest_operand"
4582 (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
4584 "(register_operand (operands[0], SFmode)
4585 || reg_or_0_operand (operands[1], SFmode))
4586 && TARGET_SOFT_FLOAT"
4591 [(set_attr "type" "move,load,store")
4592 (set_attr "pa_combine_type" "addmove")
4593 (set_attr "length" "4,4,4")])
4597 ;;- zero extension instructions
4598 ;; We have define_expand for zero extension patterns to make sure the
4599 ;; operands get loaded into registers. The define_insns accept
4600 ;; memory operands. This gives us better overall code than just
4601 ;; having a pattern that does or does not accept memory operands.
4603 (define_expand "zero_extendqihi2"
4604 [(set (match_operand:HI 0 "register_operand" "")
4606 (match_operand:QI 1 "register_operand" "")))]
4611 [(set (match_operand:HI 0 "register_operand" "=r,r")
4613 (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4614 "GET_CODE (operands[1]) != CONST_INT"
4616 {extru|extrw,u} %1,31,8,%0
4618 [(set_attr "type" "shift,load")
4619 (set_attr "length" "4,4")])
4621 (define_expand "zero_extendqisi2"
4622 [(set (match_operand:SI 0 "register_operand" "")
4624 (match_operand:QI 1 "register_operand" "")))]
4629 [(set (match_operand:SI 0 "register_operand" "=r,r")
4631 (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4632 "GET_CODE (operands[1]) != CONST_INT"
4634 {extru|extrw,u} %1,31,8,%0
4636 [(set_attr "type" "shift,load")
4637 (set_attr "length" "4,4")])
4639 (define_expand "zero_extendhisi2"
4640 [(set (match_operand:SI 0 "register_operand" "")
4642 (match_operand:HI 1 "register_operand" "")))]
4647 [(set (match_operand:SI 0 "register_operand" "=r,r")
4649 (match_operand:HI 1 "move_src_operand" "r,RQ")))]
4650 "GET_CODE (operands[1]) != CONST_INT"
4652 {extru|extrw,u} %1,31,16,%0
4654 [(set_attr "type" "shift,load")
4655 (set_attr "length" "4,4")])
4657 (define_expand "zero_extendqidi2"
4658 [(set (match_operand:DI 0 "register_operand" "")
4660 (match_operand:QI 1 "register_operand" "")))]
4665 [(set (match_operand:DI 0 "register_operand" "=r,r")
4667 (match_operand:QI 1 "move_src_operand" "r,RQ")))]
4668 "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4672 [(set_attr "type" "shift,load")
4673 (set_attr "length" "4,4")])
4675 (define_expand "zero_extendhidi2"
4676 [(set (match_operand:DI 0 "register_operand" "")
4678 (match_operand:HI 1 "register_operand" "")))]
4683 [(set (match_operand:DI 0 "register_operand" "=r,r")
4685 (match_operand:HI 1 "move_src_operand" "r,RQ")))]
4686 "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4690 [(set_attr "type" "shift,load")
4691 (set_attr "length" "4,4")])
4693 (define_expand "zero_extendsidi2"
4694 [(set (match_operand:DI 0 "register_operand" "")
4696 (match_operand:SI 1 "register_operand" "")))]
4701 [(set (match_operand:DI 0 "register_operand" "=r,r")
4703 (match_operand:SI 1 "move_src_operand" "r,RQ")))]
4704 "TARGET_64BIT && GET_CODE (operands[1]) != CONST_INT"
4708 [(set_attr "type" "shift,load")
4709 (set_attr "length" "4,4")])
4711 ;;- sign extension instructions
4713 (define_insn "extendhisi2"
4714 [(set (match_operand:SI 0 "register_operand" "=r")
4715 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
4717 "{extrs|extrw,s} %1,31,16,%0"
4718 [(set_attr "type" "shift")
4719 (set_attr "length" "4")])
4721 (define_insn "extendqihi2"
4722 [(set (match_operand:HI 0 "register_operand" "=r")
4723 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
4725 "{extrs|extrw,s} %1,31,8,%0"
4726 [(set_attr "type" "shift")
4727 (set_attr "length" "4")])
4729 (define_insn "extendqisi2"
4730 [(set (match_operand:SI 0 "register_operand" "=r")
4731 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
4733 "{extrs|extrw,s} %1,31,8,%0"
4734 [(set_attr "type" "shift")
4735 (set_attr "length" "4")])
4737 (define_insn "extendqidi2"
4738 [(set (match_operand:DI 0 "register_operand" "=r")
4739 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
4741 "extrd,s %1,63,8,%0"
4742 [(set_attr "type" "shift")
4743 (set_attr "length" "4")])
4745 (define_insn "extendhidi2"
4746 [(set (match_operand:DI 0 "register_operand" "=r")
4747 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
4749 "extrd,s %1,63,16,%0"
4750 [(set_attr "type" "shift")
4751 (set_attr "length" "4")])
4753 (define_insn "extendsidi2"
4754 [(set (match_operand:DI 0 "register_operand" "=r")
4755 (sign_extend:DI (match_operand:SI 1 "register_operand" "r")))]
4757 "extrd,s %1,63,32,%0"
4758 [(set_attr "type" "shift")
4759 (set_attr "length" "4")])
4762 ;; Conversions between float and double.
4764 (define_insn "extendsfdf2"
4765 [(set (match_operand:DF 0 "register_operand" "=f")
4767 (match_operand:SF 1 "register_operand" "f")))]
4768 "! TARGET_SOFT_FLOAT"
4769 "{fcnvff|fcnv},sgl,dbl %1,%0"
4770 [(set_attr "type" "fpalu")
4771 (set_attr "length" "4")])
4773 (define_insn "truncdfsf2"
4774 [(set (match_operand:SF 0 "register_operand" "=f")
4776 (match_operand:DF 1 "register_operand" "f")))]
4777 "! TARGET_SOFT_FLOAT"
4778 "{fcnvff|fcnv},dbl,sgl %1,%0"
4779 [(set_attr "type" "fpalu")
4780 (set_attr "length" "4")])
4782 ;; Conversion between fixed point and floating point.
4783 ;; Note that among the fix-to-float insns
4784 ;; the ones that start with SImode come first.
4785 ;; That is so that an operand that is a CONST_INT
4786 ;; (and therefore lacks a specific machine mode).
4787 ;; will be recognized as SImode (which is always valid)
4788 ;; rather than as QImode or HImode.
4790 ;; This pattern forces (set (reg:SF ...) (float:SF (const_int ...)))
4791 ;; to be reloaded by putting the constant into memory.
4792 ;; It must come before the more general floatsisf2 pattern.
4794 [(set (match_operand:SF 0 "register_operand" "=f")
4795 (float:SF (match_operand:SI 1 "const_int_operand" "m")))]
4796 "! TARGET_SOFT_FLOAT"
4797 "fldw%F1 %1,%0\;{fcnvxf,sgl,sgl|fcnv,w,sgl} %0,%0"
4798 [(set_attr "type" "fpalu")
4799 (set_attr "length" "8")])
4801 (define_insn "floatsisf2"
4802 [(set (match_operand:SF 0 "register_operand" "=f")
4803 (float:SF (match_operand:SI 1 "register_operand" "f")))]
4804 "! TARGET_SOFT_FLOAT"
4805 "{fcnvxf,sgl,sgl|fcnv,w,sgl} %1,%0"
4806 [(set_attr "type" "fpalu")
4807 (set_attr "length" "4")])
4809 ;; This pattern forces (set (reg:DF ...) (float:DF (const_int ...)))
4810 ;; to be reloaded by putting the constant into memory.
4811 ;; It must come before the more general floatsidf2 pattern.
4813 [(set (match_operand:DF 0 "register_operand" "=f")
4814 (float:DF (match_operand:SI 1 "const_int_operand" "m")))]
4815 "! TARGET_SOFT_FLOAT"
4816 "fldw%F1 %1,%0\;{fcnvxf,sgl,dbl|fcnv,w,dbl} %0,%0"
4817 [(set_attr "type" "fpalu")
4818 (set_attr "length" "8")])
4820 (define_insn "floatsidf2"
4821 [(set (match_operand:DF 0 "register_operand" "=f")
4822 (float:DF (match_operand:SI 1 "register_operand" "f")))]
4823 "! TARGET_SOFT_FLOAT"
4824 "{fcnvxf,sgl,dbl|fcnv,w,dbl} %1,%0"
4825 [(set_attr "type" "fpalu")
4826 (set_attr "length" "4")])
4828 (define_expand "floatunssisf2"
4829 [(set (subreg:SI (match_dup 2) 4)
4830 (match_operand:SI 1 "register_operand" ""))
4831 (set (subreg:SI (match_dup 2) 0)
4833 (set (match_operand:SF 0 "register_operand" "")
4834 (float:SF (match_dup 2)))]
4835 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4840 emit_insn (gen_floatunssisf2_pa20 (operands[0], operands[1]));
4843 operands[2] = gen_reg_rtx (DImode);
4846 (define_expand "floatunssidf2"
4847 [(set (subreg:SI (match_dup 2) 4)
4848 (match_operand:SI 1 "register_operand" ""))
4849 (set (subreg:SI (match_dup 2) 0)
4851 (set (match_operand:DF 0 "register_operand" "")
4852 (float:DF (match_dup 2)))]
4853 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4858 emit_insn (gen_floatunssidf2_pa20 (operands[0], operands[1]));
4861 operands[2] = gen_reg_rtx (DImode);
4864 (define_insn "floatdisf2"
4865 [(set (match_operand:SF 0 "register_operand" "=f")
4866 (float:SF (match_operand:DI 1 "register_operand" "f")))]
4867 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4868 "{fcnvxf,dbl,sgl|fcnv,dw,sgl} %1,%0"
4869 [(set_attr "type" "fpalu")
4870 (set_attr "length" "4")])
4872 (define_insn "floatdidf2"
4873 [(set (match_operand:DF 0 "register_operand" "=f")
4874 (float:DF (match_operand:DI 1 "register_operand" "f")))]
4875 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4876 "{fcnvxf,dbl,dbl|fcnv,dw,dbl} %1,%0"
4877 [(set_attr "type" "fpalu")
4878 (set_attr "length" "4")])
4880 ;; Convert a float to an actual integer.
4881 ;; Truncation is performed as part of the conversion.
4883 (define_insn "fix_truncsfsi2"
4884 [(set (match_operand:SI 0 "register_operand" "=f")
4885 (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4886 "! TARGET_SOFT_FLOAT"
4887 "{fcnvfxt,sgl,sgl|fcnv,t,sgl,w} %1,%0"
4888 [(set_attr "type" "fpalu")
4889 (set_attr "length" "4")])
4891 (define_insn "fix_truncdfsi2"
4892 [(set (match_operand:SI 0 "register_operand" "=f")
4893 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4894 "! TARGET_SOFT_FLOAT"
4895 "{fcnvfxt,dbl,sgl|fcnv,t,dbl,w} %1,%0"
4896 [(set_attr "type" "fpalu")
4897 (set_attr "length" "4")])
4899 (define_insn "fix_truncsfdi2"
4900 [(set (match_operand:DI 0 "register_operand" "=f")
4901 (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4902 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4903 "{fcnvfxt,sgl,dbl|fcnv,t,sgl,dw} %1,%0"
4904 [(set_attr "type" "fpalu")
4905 (set_attr "length" "4")])
4907 (define_insn "fix_truncdfdi2"
4908 [(set (match_operand:DI 0 "register_operand" "=f")
4909 (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4910 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT"
4911 "{fcnvfxt,dbl,dbl|fcnv,t,dbl,dw} %1,%0"
4912 [(set_attr "type" "fpalu")
4913 (set_attr "length" "4")])
4915 (define_insn "floatunssidf2_pa20"
4916 [(set (match_operand:DF 0 "register_operand" "=f")
4917 (unsigned_float:DF (match_operand:SI 1 "register_operand" "f")))]
4918 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4920 [(set_attr "type" "fpalu")
4921 (set_attr "length" "4")])
4923 (define_insn "floatunssisf2_pa20"
4924 [(set (match_operand:SF 0 "register_operand" "=f")
4925 (unsigned_float:SF (match_operand:SI 1 "register_operand" "f")))]
4926 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4928 [(set_attr "type" "fpalu")
4929 (set_attr "length" "4")])
4931 (define_insn "floatunsdisf2"
4932 [(set (match_operand:SF 0 "register_operand" "=f")
4933 (unsigned_float:SF (match_operand:DI 1 "register_operand" "f")))]
4934 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4935 "fcnv,udw,sgl %1,%0"
4936 [(set_attr "type" "fpalu")
4937 (set_attr "length" "4")])
4939 (define_insn "floatunsdidf2"
4940 [(set (match_operand:DF 0 "register_operand" "=f")
4941 (unsigned_float:DF (match_operand:DI 1 "register_operand" "f")))]
4942 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4943 "fcnv,udw,dbl %1,%0"
4944 [(set_attr "type" "fpalu")
4945 (set_attr "length" "4")])
4947 (define_insn "fixuns_truncsfsi2"
4948 [(set (match_operand:SI 0 "register_operand" "=f")
4949 (unsigned_fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4950 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4951 "fcnv,t,sgl,uw %1,%0"
4952 [(set_attr "type" "fpalu")
4953 (set_attr "length" "4")])
4955 (define_insn "fixuns_truncdfsi2"
4956 [(set (match_operand:SI 0 "register_operand" "=f")
4957 (unsigned_fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4958 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4959 "fcnv,t,dbl,uw %1,%0"
4960 [(set_attr "type" "fpalu")
4961 (set_attr "length" "4")])
4963 (define_insn "fixuns_truncsfdi2"
4964 [(set (match_operand:DI 0 "register_operand" "=f")
4965 (unsigned_fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
4966 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4967 "fcnv,t,sgl,udw %1,%0"
4968 [(set_attr "type" "fpalu")
4969 (set_attr "length" "4")])
4971 (define_insn "fixuns_truncdfdi2"
4972 [(set (match_operand:DI 0 "register_operand" "=f")
4973 (unsigned_fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
4974 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
4975 "fcnv,t,dbl,udw %1,%0"
4976 [(set_attr "type" "fpalu")
4977 (set_attr "length" "4")])
4979 ;;- arithmetic instructions
4981 (define_expand "adddi3"
4982 [(set (match_operand:DI 0 "register_operand" "")
4983 (plus:DI (match_operand:DI 1 "register_operand" "")
4984 (match_operand:DI 2 "adddi3_operand" "")))]
4989 [(set (match_operand:DI 0 "register_operand" "=r")
4990 (plus:DI (match_operand:DI 1 "register_operand" "%r")
4991 (match_operand:DI 2 "arith11_operand" "rI")))]
4995 if (GET_CODE (operands[2]) == CONST_INT)
4997 if (INTVAL (operands[2]) >= 0)
4998 return \"addi %2,%R1,%R0\;{addc|add,c} %1,%%r0,%0\";
5000 return \"addi %2,%R1,%R0\;{subb|sub,b} %1,%%r0,%0\";
5003 return \"add %R2,%R1,%R0\;{addc|add,c} %2,%1,%0\";
5005 [(set_attr "type" "binary")
5006 (set_attr "length" "8")])
5009 [(set (match_operand:DI 0 "register_operand" "=r,r")
5010 (plus:DI (match_operand:DI 1 "register_operand" "%r,r")
5011 (match_operand:DI 2 "arith14_operand" "r,J")))]
5016 [(set_attr "type" "binary,binary")
5017 (set_attr "pa_combine_type" "addmove")
5018 (set_attr "length" "4,4")])
5021 [(set (match_operand:DI 0 "register_operand" "=r")
5022 (plus:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
5023 (match_operand:DI 2 "register_operand" "r")))]
5026 [(set_attr "type" "binary")
5027 (set_attr "length" "4")])
5030 [(set (match_operand:SI 0 "register_operand" "=r")
5031 (plus:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
5032 (match_operand:SI 2 "register_operand" "r")))]
5035 [(set_attr "type" "binary")
5036 (set_attr "length" "4")])
5038 (define_expand "addvdi3"
5039 [(parallel [(set (match_operand:DI 0 "register_operand" "")
5040 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "")
5041 (match_operand:DI 2 "arith11_operand" "")))
5042 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
5043 (sign_extend:TI (match_dup 2)))
5044 (sign_extend:TI (plus:DI (match_dup 1)
5051 [(set (match_operand:DI 0 "register_operand" "=r,r")
5052 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rM,rM")
5053 (match_operand:DI 2 "arith11_operand" "r,I")))
5054 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
5055 (sign_extend:TI (match_dup 2)))
5056 (sign_extend:TI (plus:DI (match_dup 1)
5062 addi,tsv,* %2,%1,%0"
5063 [(set_attr "type" "binary,binary")
5064 (set_attr "length" "4,4")])
5067 [(set (match_operand:DI 0 "register_operand" "=r")
5068 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rM")
5069 (match_operand:DI 2 "arith11_operand" "rI")))
5070 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
5071 (sign_extend:TI (match_dup 2)))
5072 (sign_extend:TI (plus:DI (match_dup 1)
5078 if (GET_CODE (operands[2]) == CONST_INT)
5080 if (INTVAL (operands[2]) >= 0)
5081 return \"addi %2,%R1,%R0\;{addco|add,c,tsv} %1,%%r0,%0\";
5083 return \"addi %2,%R1,%R0\;{subbo|sub,b,tsv} %1,%%r0,%0\";
5086 return \"add %R2,%R1,%R0\;{addco|add,c,tsv} %2,%1,%0\";
5088 [(set_attr "type" "binary")
5089 (set_attr "length" "8")])
5091 ;; define_splits to optimize cases of adding a constant integer
5092 ;; to a register when the constant does not fit in 14 bits. */
5094 [(set (match_operand:SI 0 "register_operand" "")
5095 (plus:SI (match_operand:SI 1 "register_operand" "")
5096 (match_operand:SI 2 "const_int_operand" "")))
5097 (clobber (match_operand:SI 4 "register_operand" ""))]
5098 "! pa_cint_ok_for_move (INTVAL (operands[2]))
5099 && VAL_14_BITS_P (INTVAL (operands[2]) >> 1)"
5100 [(set (match_dup 4) (plus:SI (match_dup 1) (match_dup 2)))
5101 (set (match_dup 0) (plus:SI (match_dup 4) (match_dup 3)))]
5104 int val = INTVAL (operands[2]);
5105 int low = (val < 0) ? -0x2000 : 0x1fff;
5106 int rest = val - low;
5108 operands[2] = GEN_INT (rest);
5109 operands[3] = GEN_INT (low);
5113 [(set (match_operand:SI 0 "register_operand" "")
5114 (plus:SI (match_operand:SI 1 "register_operand" "")
5115 (match_operand:SI 2 "const_int_operand" "")))
5116 (clobber (match_operand:SI 4 "register_operand" ""))]
5117 "! pa_cint_ok_for_move (INTVAL (operands[2]))"
5118 [(set (match_dup 4) (match_dup 2))
5119 (set (match_dup 0) (plus:SI (mult:SI (match_dup 4) (match_dup 3))
5123 HOST_WIDE_INT intval = INTVAL (operands[2]);
5125 /* Try dividing the constant by 2, then 4, and finally 8 to see
5126 if we can get a constant which can be loaded into a register
5127 in a single instruction (pa_cint_ok_for_move).
5129 If that fails, try to negate the constant and subtract it
5130 from our input operand. */
5131 if (intval % 2 == 0 && pa_cint_ok_for_move (intval / 2))
5133 operands[2] = GEN_INT (intval / 2);
5134 operands[3] = const2_rtx;
5136 else if (intval % 4 == 0 && pa_cint_ok_for_move (intval / 4))
5138 operands[2] = GEN_INT (intval / 4);
5139 operands[3] = GEN_INT (4);
5141 else if (intval % 8 == 0 && pa_cint_ok_for_move (intval / 8))
5143 operands[2] = GEN_INT (intval / 8);
5144 operands[3] = GEN_INT (8);
5146 else if (pa_cint_ok_for_move (-intval))
5148 emit_insn (gen_rtx_SET (VOIDmode, operands[4], GEN_INT (-intval)));
5149 emit_insn (gen_subsi3 (operands[0], operands[1], operands[4]));
5156 (define_insn "addsi3"
5157 [(set (match_operand:SI 0 "register_operand" "=r,r")
5158 (plus:SI (match_operand:SI 1 "register_operand" "%r,r")
5159 (match_operand:SI 2 "arith14_operand" "r,J")))]
5162 {addl|add,l} %1,%2,%0
5164 [(set_attr "type" "binary,binary")
5165 (set_attr "pa_combine_type" "addmove")
5166 (set_attr "length" "4,4")])
5168 (define_insn "addvsi3"
5169 [(set (match_operand:SI 0 "register_operand" "=r,r")
5170 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rM,rM")
5171 (match_operand:SI 2 "arith11_operand" "r,I")))
5172 (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
5173 (sign_extend:DI (match_dup 2)))
5174 (sign_extend:DI (plus:SI (match_dup 1)
5179 {addo|add,tsv} %2,%1,%0
5180 {addio|addi,tsv} %2,%1,%0"
5181 [(set_attr "type" "binary,binary")
5182 (set_attr "length" "4,4")])
5184 (define_expand "subdi3"
5185 [(set (match_operand:DI 0 "register_operand" "")
5186 (minus:DI (match_operand:DI 1 "arith11_operand" "")
5187 (match_operand:DI 2 "reg_or_0_operand" "")))]
5192 [(set (match_operand:DI 0 "register_operand" "=r,r,!q")
5193 (minus:DI (match_operand:DI 1 "arith11_operand" "r,I,!U")
5194 (match_operand:DI 2 "reg_or_0_operand" "rM,rM,!rM")))]
5200 [(set_attr "type" "binary,binary,move")
5201 (set_attr "length" "4,4,4")])
5204 [(set (match_operand:DI 0 "register_operand" "=r,&r")
5205 (minus:DI (match_operand:DI 1 "arith11_operand" "r,I")
5206 (match_operand:DI 2 "reg_or_0_operand" "rM,rM")))]
5210 if (GET_CODE (operands[1]) == CONST_INT)
5212 if (INTVAL (operands[1]) >= 0)
5213 return \"subi %1,%R2,%R0\;{subb|sub,b} %%r0,%2,%0\";
5215 return \"ldi -1,%0\;subi %1,%R2,%R0\;{subb|sub,b} %0,%2,%0\";
5218 return \"sub %R1,%R2,%R0\;{subb|sub,b} %1,%2,%0\";
5220 [(set_attr "type" "binary")
5221 (set (attr "length")
5222 (if_then_else (eq_attr "alternative" "0")
5224 (if_then_else (ge (symbol_ref "INTVAL (operands[1])")
5229 (define_expand "subvdi3"
5230 [(parallel [(set (match_operand:DI 0 "register_operand" "")
5231 (minus:DI (match_operand:DI 1 "arith11_operand" "")
5232 (match_operand:DI 2 "reg_or_0_operand" "")))
5233 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
5234 (sign_extend:TI (match_dup 2)))
5235 (sign_extend:TI (minus:DI (match_dup 1)
5242 [(set (match_operand:DI 0 "register_operand" "=r,r")
5243 (minus:DI (match_operand:DI 1 "arith11_operand" "r,I")
5244 (match_operand:DI 2 "reg_or_0_operand" "rM,rM")))
5245 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
5246 (sign_extend:TI (match_dup 2)))
5247 (sign_extend:TI (minus:DI (match_dup 1)
5252 {subo|sub,tsv} %1,%2,%0
5253 {subio|subi,tsv} %1,%2,%0"
5254 [(set_attr "type" "binary,binary")
5255 (set_attr "length" "4,4")])
5258 [(set (match_operand:DI 0 "register_operand" "=r,&r")
5259 (minus:DI (match_operand:DI 1 "arith11_operand" "r,I")
5260 (match_operand:DI 2 "reg_or_0_operand" "rM,rM")))
5261 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
5262 (sign_extend:TI (match_dup 2)))
5263 (sign_extend:TI (minus:DI (match_dup 1)
5269 if (GET_CODE (operands[1]) == CONST_INT)
5271 if (INTVAL (operands[1]) >= 0)
5272 return \"subi %1,%R2,%R0\;{subbo|sub,b,tsv} %%r0,%2,%0\";
5274 return \"ldi -1,%0\;subi %1,%R2,%R0\;{subbo|sub,b,tsv} %0,%2,%0\";
5277 return \"sub %R1,%R2,%R0\;{subbo|sub,b,tsv} %1,%2,%0\";
5279 [(set_attr "type" "binary,binary")
5280 (set (attr "length")
5281 (if_then_else (eq_attr "alternative" "0")
5283 (if_then_else (ge (symbol_ref "INTVAL (operands[1])")
5288 (define_expand "subsi3"
5289 [(set (match_operand:SI 0 "register_operand" "")
5290 (minus:SI (match_operand:SI 1 "arith11_operand" "")
5291 (match_operand:SI 2 "register_operand" "")))]
5296 [(set (match_operand:SI 0 "register_operand" "=r,r")
5297 (minus:SI (match_operand:SI 1 "arith11_operand" "r,I")
5298 (match_operand:SI 2 "register_operand" "r,r")))]
5303 [(set_attr "type" "binary,binary")
5304 (set_attr "length" "4,4")])
5307 [(set (match_operand:SI 0 "register_operand" "=r,r,!q")
5308 (minus:SI (match_operand:SI 1 "arith11_operand" "r,I,!S")
5309 (match_operand:SI 2 "register_operand" "r,r,!r")))]
5315 [(set_attr "type" "binary,binary,move")
5316 (set_attr "length" "4,4,4")])
5318 (define_insn "subvsi3"
5319 [(set (match_operand:SI 0 "register_operand" "=r,r")
5320 (minus:SI (match_operand:SI 1 "arith11_operand" "rM,I")
5321 (match_operand:SI 2 "reg_or_0_operand" "rM,rM")))
5322 (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
5323 (sign_extend:DI (match_dup 2)))
5324 (sign_extend:DI (minus:SI (match_dup 1)
5329 {subo|sub,tsv} %1,%2,%0
5330 {subio|subi,tsv} %1,%2,%0"
5331 [(set_attr "type" "binary,binary")
5332 (set_attr "length" "4,4")])
5334 ;; Clobbering a "register_operand" instead of a match_scratch
5335 ;; in operand3 of millicode calls avoids spilling %r1 and
5336 ;; produces better code.
5338 ;; The mulsi3 insns set up registers for the millicode call.
5339 (define_expand "mulsi3"
5340 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5341 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5342 (parallel [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5343 (clobber (match_dup 3))
5344 (clobber (reg:SI 26))
5345 (clobber (reg:SI 25))
5346 (clobber (match_dup 4))])
5347 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5351 operands[4] = gen_rtx_REG (SImode, TARGET_64BIT ? 2 : 31);
5352 if (TARGET_PA_11 && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT)
5354 rtx scratch = gen_reg_rtx (DImode);
5355 operands[1] = force_reg (SImode, operands[1]);
5356 operands[2] = force_reg (SImode, operands[2]);
5357 emit_insn (gen_umulsidi3 (scratch, operands[1], operands[2]));
5358 emit_insn (gen_movsi (operands[0],
5359 gen_rtx_SUBREG (SImode, scratch,
5360 GET_MODE_SIZE (SImode))));
5363 operands[3] = gen_reg_rtx (SImode);
5366 (define_insn "umulsidi3"
5367 [(set (match_operand:DI 0 "register_operand" "=f")
5368 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5369 (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "f"))))]
5370 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
5372 [(set_attr "type" "fpmuldbl")
5373 (set_attr "length" "4")])
5376 [(set (match_operand:DI 0 "register_operand" "=f")
5377 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5378 (match_operand:DI 2 "uint32_operand" "f")))]
5379 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && !TARGET_64BIT"
5381 [(set_attr "type" "fpmuldbl")
5382 (set_attr "length" "4")])
5385 [(set (match_operand:DI 0 "register_operand" "=f")
5386 (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
5387 (match_operand:DI 2 "uint32_operand" "f")))]
5388 "TARGET_PA_11 && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT && TARGET_64BIT"
5390 [(set_attr "type" "fpmuldbl")
5391 (set_attr "length" "4")])
5394 [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5395 (clobber (match_operand:SI 0 "register_operand" "=a"))
5396 (clobber (reg:SI 26))
5397 (clobber (reg:SI 25))
5398 (clobber (reg:SI 31))]
5400 "* return pa_output_mul_insn (0, insn);"
5401 [(set_attr "type" "milli")
5402 (set (attr "length")
5403 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5404 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5407 [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
5408 (clobber (match_operand:SI 0 "register_operand" "=a"))
5409 (clobber (reg:SI 26))
5410 (clobber (reg:SI 25))
5411 (clobber (reg:SI 2))]
5413 "* return pa_output_mul_insn (0, insn);"
5414 [(set_attr "type" "milli")
5415 (set (attr "length")
5416 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5417 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5419 (define_expand "muldi3"
5420 [(set (match_operand:DI 0 "register_operand" "")
5421 (mult:DI (match_operand:DI 1 "register_operand" "")
5422 (match_operand:DI 2 "register_operand" "")))]
5423 "TARGET_64BIT && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
5426 rtx low_product = gen_reg_rtx (DImode);
5427 rtx cross_product1 = gen_reg_rtx (DImode);
5428 rtx cross_product2 = gen_reg_rtx (DImode);
5429 rtx cross_scratch = gen_reg_rtx (DImode);
5430 rtx cross_product = gen_reg_rtx (DImode);
5431 rtx op1l, op1r, op2l, op2r;
5432 rtx op1shifted, op2shifted;
5434 op1shifted = gen_reg_rtx (DImode);
5435 op2shifted = gen_reg_rtx (DImode);
5436 op1l = gen_reg_rtx (SImode);
5437 op1r = gen_reg_rtx (SImode);
5438 op2l = gen_reg_rtx (SImode);
5439 op2r = gen_reg_rtx (SImode);
5441 emit_move_insn (op1shifted, gen_rtx_LSHIFTRT (DImode, operands[1],
5443 emit_move_insn (op2shifted, gen_rtx_LSHIFTRT (DImode, operands[2],
5445 op1r = force_reg (SImode, gen_rtx_SUBREG (SImode, operands[1], 4));
5446 op2r = force_reg (SImode, gen_rtx_SUBREG (SImode, operands[2], 4));
5447 op1l = force_reg (SImode, gen_rtx_SUBREG (SImode, op1shifted, 4));
5448 op2l = force_reg (SImode, gen_rtx_SUBREG (SImode, op2shifted, 4));
5450 /* Emit multiplies for the cross products. */
5451 emit_insn (gen_umulsidi3 (cross_product1, op2r, op1l));
5452 emit_insn (gen_umulsidi3 (cross_product2, op2l, op1r));
5454 /* Emit a multiply for the low sub-word. */
5455 emit_insn (gen_umulsidi3 (low_product, copy_rtx (op2r), copy_rtx (op1r)));
5457 /* Sum the cross products and shift them into proper position. */
5458 emit_insn (gen_adddi3 (cross_scratch, cross_product1, cross_product2));
5459 emit_insn (gen_ashldi3 (cross_product, cross_scratch, GEN_INT (32)));
5461 /* Add the cross product to the low product and store the result
5462 into the output operand . */
5463 emit_insn (gen_adddi3 (operands[0], cross_product, low_product));
5467 ;;; Division and mod.
5468 (define_expand "divsi3"
5469 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5470 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5471 (parallel [(set (reg:SI 29) (div:SI (reg:SI 26) (reg:SI 25)))
5472 (clobber (match_dup 3))
5473 (clobber (match_dup 4))
5474 (clobber (reg:SI 26))
5475 (clobber (reg:SI 25))
5476 (clobber (match_dup 5))])
5477 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5481 operands[3] = gen_reg_rtx (SImode);
5484 operands[5] = gen_rtx_REG (SImode, 2);
5485 operands[4] = operands[5];
5489 operands[5] = gen_rtx_REG (SImode, 31);
5490 operands[4] = gen_reg_rtx (SImode);
5492 if (GET_CODE (operands[2]) == CONST_INT && pa_emit_hpdiv_const (operands, 0))
5498 (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5499 (clobber (match_operand:SI 1 "register_operand" "=a"))
5500 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5501 (clobber (reg:SI 26))
5502 (clobber (reg:SI 25))
5503 (clobber (reg:SI 31))]
5506 return pa_output_div_insn (operands, 0, insn);"
5507 [(set_attr "type" "milli")
5508 (set (attr "length")
5509 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5510 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5514 (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5515 (clobber (match_operand:SI 1 "register_operand" "=a"))
5516 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5517 (clobber (reg:SI 26))
5518 (clobber (reg:SI 25))
5519 (clobber (reg:SI 2))]
5522 return pa_output_div_insn (operands, 0, insn);"
5523 [(set_attr "type" "milli")
5524 (set (attr "length")
5525 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5526 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5528 (define_expand "udivsi3"
5529 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5530 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5531 (parallel [(set (reg:SI 29) (udiv:SI (reg:SI 26) (reg:SI 25)))
5532 (clobber (match_dup 3))
5533 (clobber (match_dup 4))
5534 (clobber (reg:SI 26))
5535 (clobber (reg:SI 25))
5536 (clobber (match_dup 5))])
5537 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5541 operands[3] = gen_reg_rtx (SImode);
5545 operands[5] = gen_rtx_REG (SImode, 2);
5546 operands[4] = operands[5];
5550 operands[5] = gen_rtx_REG (SImode, 31);
5551 operands[4] = gen_reg_rtx (SImode);
5553 if (GET_CODE (operands[2]) == CONST_INT && pa_emit_hpdiv_const (operands, 1))
5559 (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5560 (clobber (match_operand:SI 1 "register_operand" "=a"))
5561 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5562 (clobber (reg:SI 26))
5563 (clobber (reg:SI 25))
5564 (clobber (reg:SI 31))]
5567 return pa_output_div_insn (operands, 1, insn);"
5568 [(set_attr "type" "milli")
5569 (set (attr "length")
5570 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5571 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5575 (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
5576 (clobber (match_operand:SI 1 "register_operand" "=a"))
5577 (clobber (match_operand:SI 2 "register_operand" "=&r"))
5578 (clobber (reg:SI 26))
5579 (clobber (reg:SI 25))
5580 (clobber (reg:SI 2))]
5583 return pa_output_div_insn (operands, 1, insn);"
5584 [(set_attr "type" "milli")
5585 (set (attr "length")
5586 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5587 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5589 (define_expand "modsi3"
5590 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5591 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5592 (parallel [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
5593 (clobber (match_dup 3))
5594 (clobber (match_dup 4))
5595 (clobber (reg:SI 26))
5596 (clobber (reg:SI 25))
5597 (clobber (match_dup 5))])
5598 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5604 operands[5] = gen_rtx_REG (SImode, 2);
5605 operands[4] = operands[5];
5609 operands[5] = gen_rtx_REG (SImode, 31);
5610 operands[4] = gen_reg_rtx (SImode);
5612 operands[3] = gen_reg_rtx (SImode);
5616 [(set (reg:SI 29) (mod: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 31))]
5624 return pa_output_mod_insn (0, 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)")))])
5631 [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
5632 (clobber (match_operand:SI 0 "register_operand" "=a"))
5633 (clobber (match_operand:SI 1 "register_operand" "=&r"))
5634 (clobber (reg:SI 26))
5635 (clobber (reg:SI 25))
5636 (clobber (reg:SI 2))]
5639 return pa_output_mod_insn (0, insn);"
5640 [(set_attr "type" "milli")
5641 (set (attr "length")
5642 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5643 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5645 (define_expand "umodsi3"
5646 [(set (reg:SI 26) (match_operand:SI 1 "move_src_operand" ""))
5647 (set (reg:SI 25) (match_operand:SI 2 "move_src_operand" ""))
5648 (parallel [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5649 (clobber (match_dup 3))
5650 (clobber (match_dup 4))
5651 (clobber (reg:SI 26))
5652 (clobber (reg:SI 25))
5653 (clobber (match_dup 5))])
5654 (set (match_operand:SI 0 "move_dest_operand" "") (reg:SI 29))]
5660 operands[5] = gen_rtx_REG (SImode, 2);
5661 operands[4] = operands[5];
5665 operands[5] = gen_rtx_REG (SImode, 31);
5666 operands[4] = gen_reg_rtx (SImode);
5668 operands[3] = gen_reg_rtx (SImode);
5672 [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5673 (clobber (match_operand:SI 0 "register_operand" "=a"))
5674 (clobber (match_operand:SI 1 "register_operand" "=&r"))
5675 (clobber (reg:SI 26))
5676 (clobber (reg:SI 25))
5677 (clobber (reg:SI 31))]
5680 return pa_output_mod_insn (1, insn);"
5681 [(set_attr "type" "milli")
5682 (set (attr "length")
5683 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5684 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5687 [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
5688 (clobber (match_operand:SI 0 "register_operand" "=a"))
5689 (clobber (match_operand:SI 1 "register_operand" "=&r"))
5690 (clobber (reg:SI 26))
5691 (clobber (reg:SI 25))
5692 (clobber (reg:SI 2))]
5695 return pa_output_mod_insn (1, insn);"
5696 [(set_attr "type" "milli")
5697 (set (attr "length")
5698 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
5699 (symbol_ref "pa_attr_length_millicode_call (insn)")))])
5701 ;;- and instructions
5702 ;; We define DImode `and` so with DImode `not` we can get
5703 ;; DImode `andn`. Other combinations are possible.
5705 (define_expand "anddi3"
5706 [(set (match_operand:DI 0 "register_operand" "")
5707 (and:DI (match_operand:DI 1 "register_operand" "")
5708 (match_operand:DI 2 "and_operand" "")))]
5713 [(set (match_operand:DI 0 "register_operand" "=r,r")
5714 (and:DI (match_operand:DI 1 "register_operand" "%?r,0")
5715 (match_operand:DI 2 "and_operand" "rO,P")))]
5717 "* return pa_output_64bit_and (operands); "
5718 [(set_attr "type" "binary")
5719 (set_attr "length" "4")])
5721 ; The ? for op1 makes reload prefer zdepi instead of loading a huge
5722 ; constant with ldil;ldo.
5723 (define_insn "andsi3"
5724 [(set (match_operand:SI 0 "register_operand" "=r,r")
5725 (and:SI (match_operand:SI 1 "register_operand" "%?r,0")
5726 (match_operand:SI 2 "and_operand" "rO,P")))]
5728 "* return pa_output_and (operands); "
5729 [(set_attr "type" "binary,shift")
5730 (set_attr "length" "4,4")])
5733 [(set (match_operand:DI 0 "register_operand" "=r")
5734 (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
5735 (match_operand:DI 2 "register_operand" "r")))]
5738 [(set_attr "type" "binary")
5739 (set_attr "length" "4")])
5742 [(set (match_operand:SI 0 "register_operand" "=r")
5743 (and:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
5744 (match_operand:SI 2 "register_operand" "r")))]
5747 [(set_attr "type" "binary")
5748 (set_attr "length" "4")])
5750 (define_expand "iordi3"
5751 [(set (match_operand:DI 0 "register_operand" "")
5752 (ior:DI (match_operand:DI 1 "register_operand" "")
5753 (match_operand:DI 2 "reg_or_cint_ior_operand" "")))]
5758 [(set (match_operand:DI 0 "register_operand" "=r,r")
5759 (ior:DI (match_operand:DI 1 "register_operand" "0,0")
5760 (match_operand:DI 2 "cint_ior_operand" "M,i")))]
5762 "* return pa_output_64bit_ior (operands); "
5763 [(set_attr "type" "binary,shift")
5764 (set_attr "length" "4,4")])
5767 [(set (match_operand:DI 0 "register_operand" "=r")
5768 (ior:DI (match_operand:DI 1 "register_operand" "%r")
5769 (match_operand:DI 2 "register_operand" "r")))]
5772 [(set_attr "type" "binary")
5773 (set_attr "length" "4")])
5775 ;; Need a define_expand because we've run out of CONST_OK... characters.
5776 (define_expand "iorsi3"
5777 [(set (match_operand:SI 0 "register_operand" "")
5778 (ior:SI (match_operand:SI 1 "register_operand" "")
5779 (match_operand:SI 2 "reg_or_cint_ior_operand" "")))]
5784 [(set (match_operand:SI 0 "register_operand" "=r,r")
5785 (ior:SI (match_operand:SI 1 "register_operand" "0,0")
5786 (match_operand:SI 2 "cint_ior_operand" "M,i")))]
5788 "* return pa_output_ior (operands); "
5789 [(set_attr "type" "binary,shift")
5790 (set_attr "length" "4,4")])
5793 [(set (match_operand:SI 0 "register_operand" "=r")
5794 (ior:SI (match_operand:SI 1 "register_operand" "%r")
5795 (match_operand:SI 2 "register_operand" "r")))]
5798 [(set_attr "type" "binary")
5799 (set_attr "length" "4")])
5801 (define_expand "xordi3"
5802 [(set (match_operand:DI 0 "register_operand" "")
5803 (xor:DI (match_operand:DI 1 "register_operand" "")
5804 (match_operand:DI 2 "register_operand" "")))]
5809 [(set (match_operand:DI 0 "register_operand" "=r")
5810 (xor:DI (match_operand:DI 1 "register_operand" "%r")
5811 (match_operand:DI 2 "register_operand" "r")))]
5814 [(set_attr "type" "binary")
5815 (set_attr "length" "4")])
5817 (define_insn "xorsi3"
5818 [(set (match_operand:SI 0 "register_operand" "=r")
5819 (xor:SI (match_operand:SI 1 "register_operand" "%r")
5820 (match_operand:SI 2 "register_operand" "r")))]
5823 [(set_attr "type" "binary")
5824 (set_attr "length" "4")])
5826 (define_expand "negdi2"
5827 [(set (match_operand:DI 0 "register_operand" "")
5828 (neg:DI (match_operand:DI 1 "register_operand" "")))]
5833 [(set (match_operand:DI 0 "register_operand" "=r")
5834 (neg:DI (match_operand:DI 1 "register_operand" "r")))]
5836 "sub %%r0,%R1,%R0\;{subb|sub,b} %%r0,%1,%0"
5837 [(set_attr "type" "unary")
5838 (set_attr "length" "8")])
5841 [(set (match_operand:DI 0 "register_operand" "=r")
5842 (neg:DI (match_operand:DI 1 "register_operand" "r")))]
5845 [(set_attr "type" "unary")
5846 (set_attr "length" "4")])
5848 (define_expand "negvdi2"
5849 [(parallel [(set (match_operand:DI 0 "register_operand" "")
5850 (neg:DI (match_operand:DI 1 "register_operand" "")))
5851 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
5852 (sign_extend:TI (neg:DI (match_dup 1))))
5858 [(set (match_operand:DI 0 "register_operand" "=r")
5859 (neg:DI (match_operand:DI 1 "register_operand" "r")))
5860 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
5861 (sign_extend:TI (neg:DI (match_dup 1))))
5864 "sub %%r0,%R1,%R0\;{subbo|sub,b,tsv} %%r0,%1,%0"
5865 [(set_attr "type" "unary")
5866 (set_attr "length" "8")])
5869 [(set (match_operand:DI 0 "register_operand" "=r")
5870 (neg:DI (match_operand:DI 1 "register_operand" "r")))
5871 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
5872 (sign_extend:TI (neg:DI (match_dup 1))))
5875 "sub,tsv %%r0,%1,%0"
5876 [(set_attr "type" "unary")
5877 (set_attr "length" "4")])
5879 (define_insn "negsi2"
5880 [(set (match_operand:SI 0 "register_operand" "=r")
5881 (neg:SI (match_operand:SI 1 "register_operand" "r")))]
5884 [(set_attr "type" "unary")
5885 (set_attr "length" "4")])
5887 (define_insn "negvsi2"
5888 [(set (match_operand:SI 0 "register_operand" "=r")
5889 (neg:SI (match_operand:SI 1 "register_operand" "r")))
5890 (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
5891 (sign_extend:DI (neg:SI (match_dup 1))))
5894 "{subo|sub,tsv} %%r0,%1,%0"
5895 [(set_attr "type" "unary")
5896 (set_attr "length" "4")])
5898 (define_expand "one_cmpldi2"
5899 [(set (match_operand:DI 0 "register_operand" "")
5900 (not:DI (match_operand:DI 1 "register_operand" "")))]
5907 [(set (match_operand:DI 0 "register_operand" "=r")
5908 (not:DI (match_operand:DI 1 "register_operand" "r")))]
5910 "uaddcm %%r0,%1,%0\;uaddcm %%r0,%R1,%R0"
5911 [(set_attr "type" "unary")
5912 (set_attr "length" "8")])
5915 [(set (match_operand:DI 0 "register_operand" "=r")
5916 (not:DI (match_operand:DI 1 "register_operand" "r")))]
5919 [(set_attr "type" "unary")
5920 (set_attr "length" "4")])
5922 (define_insn "one_cmplsi2"
5923 [(set (match_operand:SI 0 "register_operand" "=r")
5924 (not:SI (match_operand:SI 1 "register_operand" "r")))]
5927 [(set_attr "type" "unary")
5928 (set_attr "length" "4")])
5930 ;; Floating point arithmetic instructions.
5932 (define_insn "adddf3"
5933 [(set (match_operand:DF 0 "register_operand" "=f")
5934 (plus:DF (match_operand:DF 1 "register_operand" "f")
5935 (match_operand:DF 2 "register_operand" "f")))]
5936 "! TARGET_SOFT_FLOAT"
5938 [(set_attr "type" "fpalu")
5939 (set_attr "pa_combine_type" "faddsub")
5940 (set_attr "length" "4")])
5942 (define_insn "addsf3"
5943 [(set (match_operand:SF 0 "register_operand" "=f")
5944 (plus:SF (match_operand:SF 1 "register_operand" "f")
5945 (match_operand:SF 2 "register_operand" "f")))]
5946 "! TARGET_SOFT_FLOAT"
5948 [(set_attr "type" "fpalu")
5949 (set_attr "pa_combine_type" "faddsub")
5950 (set_attr "length" "4")])
5952 (define_insn "subdf3"
5953 [(set (match_operand:DF 0 "register_operand" "=f")
5954 (minus:DF (match_operand:DF 1 "register_operand" "f")
5955 (match_operand:DF 2 "register_operand" "f")))]
5956 "! TARGET_SOFT_FLOAT"
5958 [(set_attr "type" "fpalu")
5959 (set_attr "pa_combine_type" "faddsub")
5960 (set_attr "length" "4")])
5962 (define_insn "subsf3"
5963 [(set (match_operand:SF 0 "register_operand" "=f")
5964 (minus:SF (match_operand:SF 1 "register_operand" "f")
5965 (match_operand:SF 2 "register_operand" "f")))]
5966 "! TARGET_SOFT_FLOAT"
5968 [(set_attr "type" "fpalu")
5969 (set_attr "pa_combine_type" "faddsub")
5970 (set_attr "length" "4")])
5972 (define_insn "muldf3"
5973 [(set (match_operand:DF 0 "register_operand" "=f")
5974 (mult:DF (match_operand:DF 1 "register_operand" "f")
5975 (match_operand:DF 2 "register_operand" "f")))]
5976 "! TARGET_SOFT_FLOAT"
5978 [(set_attr "type" "fpmuldbl")
5979 (set_attr "pa_combine_type" "fmpy")
5980 (set_attr "length" "4")])
5982 (define_insn "mulsf3"
5983 [(set (match_operand:SF 0 "register_operand" "=f")
5984 (mult:SF (match_operand:SF 1 "register_operand" "f")
5985 (match_operand:SF 2 "register_operand" "f")))]
5986 "! TARGET_SOFT_FLOAT"
5988 [(set_attr "type" "fpmulsgl")
5989 (set_attr "pa_combine_type" "fmpy")
5990 (set_attr "length" "4")])
5992 (define_insn "divdf3"
5993 [(set (match_operand:DF 0 "register_operand" "=f")
5994 (div:DF (match_operand:DF 1 "register_operand" "f")
5995 (match_operand:DF 2 "register_operand" "f")))]
5996 "! TARGET_SOFT_FLOAT"
5998 [(set_attr "type" "fpdivdbl")
5999 (set_attr "length" "4")])
6001 (define_insn "divsf3"
6002 [(set (match_operand:SF 0 "register_operand" "=f")
6003 (div:SF (match_operand:SF 1 "register_operand" "f")
6004 (match_operand:SF 2 "register_operand" "f")))]
6005 "! TARGET_SOFT_FLOAT"
6007 [(set_attr "type" "fpdivsgl")
6008 (set_attr "length" "4")])
6010 ;; Processors prior to PA 2.0 don't have a fneg instruction. Fast
6011 ;; negation can be done by subtracting from plus zero. However, this
6012 ;; violates the IEEE standard when negating plus and minus zero.
6013 ;; The slow path toggles the sign bit in the general registers.
6014 (define_expand "negdf2"
6015 [(set (match_operand:DF 0 "register_operand" "")
6016 (neg:DF (match_operand:DF 1 "register_operand" "")))]
6017 "!TARGET_SOFT_FLOAT"
6019 if (TARGET_PA_20 || !flag_signed_zeros)
6020 emit_insn (gen_negdf2_fast (operands[0], operands[1]));
6022 emit_insn (gen_negdf2_slow (operands[0], operands[1]));
6026 (define_insn "negdf2_slow"
6027 [(set (match_operand:DF 0 "register_operand" "=r")
6028 (neg:DF (match_operand:DF 1 "register_operand" "r")))]
6029 "!TARGET_SOFT_FLOAT && !TARGET_PA_20"
6032 if (rtx_equal_p (operands[0], operands[1]))
6033 return \"and,< %1,%1,%0\;depi,tr 1,0,1,%0\;depi 0,0,1,%0\";
6035 return \"and,< %1,%1,%0\;depi,tr 1,0,1,%0\;depi 0,0,1,%0\;copy %R1,%R0\";
6037 [(set_attr "type" "multi")
6038 (set (attr "length")
6039 (if_then_else (match_test "rtx_equal_p (operands[0], operands[1])")
6043 (define_insn "negdf2_fast"
6044 [(set (match_operand:DF 0 "register_operand" "=f")
6045 (neg:DF (match_operand:DF 1 "register_operand" "f")))]
6046 "!TARGET_SOFT_FLOAT"
6050 return \"fneg,dbl %1,%0\";
6052 return \"fsub,dbl %%fr0,%1,%0\";
6054 [(set_attr "type" "fpalu")
6055 (set_attr "length" "4")])
6057 (define_expand "negsf2"
6058 [(set (match_operand:SF 0 "register_operand" "")
6059 (neg:SF (match_operand:SF 1 "register_operand" "")))]
6060 "!TARGET_SOFT_FLOAT"
6062 if (TARGET_PA_20 || !flag_signed_zeros)
6063 emit_insn (gen_negsf2_fast (operands[0], operands[1]));
6065 emit_insn (gen_negsf2_slow (operands[0], operands[1]));
6069 (define_insn "negsf2_slow"
6070 [(set (match_operand:SF 0 "register_operand" "=r")
6071 (neg:SF (match_operand:SF 1 "register_operand" "r")))]
6072 "!TARGET_SOFT_FLOAT && !TARGET_PA_20"
6073 "and,< %1,%1,%0\;depi,tr 1,0,1,%0\;depi 0,0,1,%0"
6074 [(set_attr "type" "multi")
6075 (set_attr "length" "12")])
6077 (define_insn "negsf2_fast"
6078 [(set (match_operand:SF 0 "register_operand" "=f")
6079 (neg:SF (match_operand:SF 1 "register_operand" "f")))]
6080 "!TARGET_SOFT_FLOAT"
6084 return \"fneg,sgl %1,%0\";
6086 return \"fsub,sgl %%fr0,%1,%0\";
6088 [(set_attr "type" "fpalu")
6089 (set_attr "length" "4")])
6091 (define_insn "absdf2"
6092 [(set (match_operand:DF 0 "register_operand" "=f")
6093 (abs:DF (match_operand:DF 1 "register_operand" "f")))]
6094 "! TARGET_SOFT_FLOAT"
6096 [(set_attr "type" "fpalu")
6097 (set_attr "length" "4")])
6099 (define_insn "abssf2"
6100 [(set (match_operand:SF 0 "register_operand" "=f")
6101 (abs:SF (match_operand:SF 1 "register_operand" "f")))]
6102 "! TARGET_SOFT_FLOAT"
6104 [(set_attr "type" "fpalu")
6105 (set_attr "length" "4")])
6107 (define_insn "sqrtdf2"
6108 [(set (match_operand:DF 0 "register_operand" "=f")
6109 (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
6110 "! TARGET_SOFT_FLOAT"
6112 [(set_attr "type" "fpsqrtdbl")
6113 (set_attr "length" "4")])
6115 (define_insn "sqrtsf2"
6116 [(set (match_operand:SF 0 "register_operand" "=f")
6117 (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
6118 "! TARGET_SOFT_FLOAT"
6120 [(set_attr "type" "fpsqrtsgl")
6121 (set_attr "length" "4")])
6123 ;; PA 2.0 floating point instructions
6126 (define_insn "fmadf4"
6127 [(set (match_operand:DF 0 "register_operand" "=f")
6128 (fma:DF (match_operand:DF 1 "register_operand" "f")
6129 (match_operand:DF 2 "register_operand" "f")
6130 (match_operand:DF 3 "register_operand" "f")))]
6131 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6132 "fmpyfadd,dbl %1,%2,%3,%0"
6133 [(set_attr "type" "fpmuldbl")
6134 (set_attr "length" "4")])
6136 (define_insn "fmasf4"
6137 [(set (match_operand:SF 0 "register_operand" "=f")
6138 (fma:SF (match_operand:SF 1 "register_operand" "f")
6139 (match_operand:SF 2 "register_operand" "f")
6140 (match_operand:SF 3 "register_operand" "f")))]
6141 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6142 "fmpyfadd,sgl %1,%2,%3,%0"
6143 [(set_attr "type" "fpmulsgl")
6144 (set_attr "length" "4")])
6146 ; fmpynfadd patterns
6147 (define_insn "fnmadf4"
6148 [(set (match_operand:DF 0 "register_operand" "=f")
6149 (fma:DF (neg:DF (match_operand:DF 1 "register_operand" "f"))
6150 (match_operand:DF 2 "register_operand" "f")
6151 (match_operand:DF 3 "register_operand" "f")))]
6152 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6153 "fmpynfadd,dbl %1,%2,%3,%0"
6154 [(set_attr "type" "fpmuldbl")
6155 (set_attr "length" "4")])
6157 (define_insn "fnmasf4"
6158 [(set (match_operand:SF 0 "register_operand" "=f")
6159 (fma:SF (neg:SF (match_operand:SF 1 "register_operand" "f"))
6160 (match_operand:SF 2 "register_operand" "f")
6161 (match_operand:SF 3 "register_operand" "f")))]
6162 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6163 "fmpynfadd,sgl %1,%2,%3,%0"
6164 [(set_attr "type" "fpmulsgl")
6165 (set_attr "length" "4")])
6169 [(set (match_operand:DF 0 "register_operand" "=f")
6170 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))]
6171 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6173 [(set_attr "type" "fpalu")
6174 (set_attr "length" "4")])
6177 [(set (match_operand:SF 0 "register_operand" "=f")
6178 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))]
6179 "TARGET_PA_20 && ! TARGET_SOFT_FLOAT"
6181 [(set_attr "type" "fpalu")
6182 (set_attr "length" "4")])
6185 [(set (match_operand:DF 0 "register_operand" "=f")
6186 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
6187 (set (match_operand:DF 2 "register_operand" "=&f") (abs:DF (match_dup 1)))]
6188 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6189 && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
6191 [(set_attr "type" "fpalu")
6192 (set_attr "length" "8")])
6195 [(set (match_operand:DF 0 "register_operand" "")
6196 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" ""))))
6197 (set (match_operand:DF 2 "register_operand" "") (abs:DF (match_dup 1)))]
6198 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6199 [(set (match_dup 2) (abs:DF (match_dup 1)))
6200 (set (match_dup 0) (neg:DF (abs:DF (match_dup 1))))]
6204 [(set (match_operand:SF 0 "register_operand" "=f")
6205 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
6206 (set (match_operand:SF 2 "register_operand" "=&f") (abs:SF (match_dup 1)))]
6207 "(! TARGET_SOFT_FLOAT && TARGET_PA_20
6208 && ! reg_overlap_mentioned_p (operands[2], operands[1]))"
6210 [(set_attr "type" "fpalu")
6211 (set_attr "length" "8")])
6214 [(set (match_operand:SF 0 "register_operand" "")
6215 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" ""))))
6216 (set (match_operand:SF 2 "register_operand" "") (abs:SF (match_dup 1)))]
6217 "! TARGET_SOFT_FLOAT && TARGET_PA_20"
6218 [(set (match_dup 2) (abs:SF (match_dup 1)))
6219 (set (match_dup 0) (neg:SF (abs:SF (match_dup 1))))]
6222 ;; Negating a multiply can be faked by adding zero in a fused multiply-add
6223 ;; instruction if we can ignore the sign of zero.
6225 [(set (match_operand:DF 0 "register_operand" "=f")
6226 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6227 (match_operand:DF 2 "register_operand" "f"))))]
6228 "!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros"
6229 "fmpynfadd,dbl %1,%2,%%fr0,%0"
6230 [(set_attr "type" "fpmuldbl")
6231 (set_attr "length" "4")])
6234 [(set (match_operand:SF 0 "register_operand" "=f")
6235 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6236 (match_operand:SF 2 "register_operand" "f"))))]
6237 "!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros"
6238 "fmpynfadd,sgl %1,%2,%%fr0,%0"
6239 [(set_attr "type" "fpmuldbl")
6240 (set_attr "length" "4")])
6243 [(set (match_operand:DF 0 "register_operand" "=f")
6244 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
6245 (match_operand:DF 2 "register_operand" "f"))))
6246 (set (match_operand:DF 3 "register_operand" "=&f")
6247 (mult:DF (match_dup 1) (match_dup 2)))]
6248 "(!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros
6249 && ! (reg_overlap_mentioned_p (operands[3], operands[1])
6250 || reg_overlap_mentioned_p (operands[3], operands[2])))"
6252 [(set_attr "type" "fpmuldbl")
6253 (set_attr "length" "8")])
6256 [(set (match_operand:DF 0 "register_operand" "")
6257 (neg:DF (mult:DF (match_operand:DF 1 "register_operand" "")
6258 (match_operand:DF 2 "register_operand" ""))))
6259 (set (match_operand:DF 3 "register_operand" "")
6260 (mult:DF (match_dup 1) (match_dup 2)))]
6261 "!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros"
6262 [(set (match_dup 3) (mult:DF (match_dup 1) (match_dup 2)))
6263 (set (match_dup 0) (neg:DF (mult:DF (match_dup 1) (match_dup 2))))]
6267 [(set (match_operand:SF 0 "register_operand" "=f")
6268 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
6269 (match_operand:SF 2 "register_operand" "f"))))
6270 (set (match_operand:SF 3 "register_operand" "=&f")
6271 (mult:SF (match_dup 1) (match_dup 2)))]
6272 "(!TARGET_SOFT_FLOAT && TARGET_PA_20 && !flag_signed_zeros
6273 && ! (reg_overlap_mentioned_p (operands[3], operands[1])
6274 || reg_overlap_mentioned_p (operands[3], operands[2])))"
6276 [(set_attr "type" "fpmuldbl")
6277 (set_attr "length" "8")])
6280 [(set (match_operand:SF 0 "register_operand" "")
6281 (neg:SF (mult:SF (match_operand:SF 1 "register_operand" "")
6282 (match_operand:SF 2 "register_operand" ""))))
6283 (set (match_operand:SF 3 "register_operand" "")
6284 (mult:SF (match_dup 1) (match_dup 2)))]
6285 "!TARGET_SOFT_FLOAT && TARGET_PA_20&& !flag_signed_zeros"
6286 [(set (match_dup 3) (mult:SF (match_dup 1) (match_dup 2)))
6287 (set (match_dup 0) (neg:SF (mult:SF (match_dup 1) (match_dup 2))))]
6290 ;;- Shift instructions
6292 ;; Optimized special case of shifting.
6295 [(set (match_operand:SI 0 "register_operand" "=r")
6296 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
6300 [(set_attr "type" "load")
6301 (set_attr "length" "4")])
6304 [(set (match_operand:SI 0 "register_operand" "=r")
6305 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
6309 [(set_attr "type" "load")
6310 (set_attr "length" "4")])
6313 [(set (match_operand:SI 0 "register_operand" "=r")
6314 (plus:SI (mult:SI (match_operand:SI 2 "register_operand" "r")
6315 (match_operand:SI 3 "shadd_operand" ""))
6316 (match_operand:SI 1 "register_operand" "r")))]
6318 "{sh%O3addl %2,%1,%0|shladd,l %2,%O3,%1,%0} "
6319 [(set_attr "type" "binary")
6320 (set_attr "length" "4")])
6323 [(set (match_operand:DI 0 "register_operand" "=r")
6324 (plus:DI (mult:DI (match_operand:DI 2 "register_operand" "r")
6325 (match_operand:DI 3 "shadd_operand" ""))
6326 (match_operand:DI 1 "register_operand" "r")))]
6328 "shladd,l %2,%O3,%1,%0"
6329 [(set_attr "type" "binary")
6330 (set_attr "length" "4")])
6332 (define_expand "ashlsi3"
6333 [(set (match_operand:SI 0 "register_operand" "")
6334 (ashift:SI (match_operand:SI 1 "lhs_lshift_operand" "")
6335 (match_operand:SI 2 "arith32_operand" "")))]
6339 if (GET_CODE (operands[2]) != CONST_INT)
6341 rtx temp = gen_reg_rtx (SImode);
6342 emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
6343 if (GET_CODE (operands[1]) == CONST_INT)
6344 emit_insn (gen_zvdep_imm32 (operands[0], operands[1], temp));
6346 emit_insn (gen_zvdep32 (operands[0], operands[1], temp));
6349 /* Make sure both inputs are not constants,
6350 there are no patterns for that. */
6351 operands[1] = force_reg (SImode, operands[1]);
6355 [(set (match_operand:SI 0 "register_operand" "=r")
6356 (ashift:SI (match_operand:SI 1 "register_operand" "r")
6357 (match_operand:SI 2 "const_int_operand" "n")))]
6359 "{zdep|depw,z} %1,%P2,%L2,%0"
6360 [(set_attr "type" "shift")
6361 (set_attr "length" "4")])
6363 ; Match cases of op1 a CONST_INT here that zvdep_imm32 doesn't handle.
6364 ; Doing it like this makes slightly better code since reload can
6365 ; replace a register with a known value in range -16..15 with a
6366 ; constant. Ideally, we would like to merge zvdep32 and zvdep_imm32,
6367 ; but since we have no more CONST_OK... characters, that is not
6369 (define_insn "zvdep32"
6370 [(set (match_operand:SI 0 "register_operand" "=r,r")
6371 (ashift:SI (match_operand:SI 1 "arith5_operand" "r,L")
6372 (minus:SI (const_int 31)
6373 (match_operand:SI 2 "register_operand" "q,q"))))]
6376 {zvdep %1,32,%0|depw,z %1,%%sar,32,%0}
6377 {zvdepi %1,32,%0|depwi,z %1,%%sar,32,%0}"
6378 [(set_attr "type" "shift,shift")
6379 (set_attr "length" "4,4")])
6381 (define_insn "zvdep_imm32"
6382 [(set (match_operand:SI 0 "register_operand" "=r")
6383 (ashift:SI (match_operand:SI 1 "lhs_lshift_cint_operand" "")
6384 (minus:SI (const_int 31)
6385 (match_operand:SI 2 "register_operand" "q"))))]
6389 unsigned HOST_WIDE_INT x = UINTVAL (operands[1]);
6390 operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
6391 operands[1] = GEN_INT ((x & 0xf) - 0x10);
6392 return \"{zvdepi %1,%2,%0|depwi,z %1,%%sar,%2,%0}\";
6394 [(set_attr "type" "shift")
6395 (set_attr "length" "4")])
6397 (define_insn "vdepi_ior"
6398 [(set (match_operand:SI 0 "register_operand" "=r")
6399 (ior:SI (ashift:SI (match_operand:SI 1 "const_int_operand" "")
6400 (minus:SI (const_int 31)
6401 (match_operand:SI 2 "register_operand" "q")))
6402 (match_operand:SI 3 "register_operand" "0")))]
6403 ; accept ...0001...1, can this be generalized?
6404 "exact_log2 (INTVAL (operands[1]) + 1) > 0"
6407 HOST_WIDE_INT x = INTVAL (operands[1]);
6408 operands[2] = GEN_INT (exact_log2 (x + 1));
6409 return \"{vdepi -1,%2,%0|depwi -1,%%sar,%2,%0}\";
6411 [(set_attr "type" "shift")
6412 (set_attr "length" "4")])
6414 (define_insn "vdepi_and"
6415 [(set (match_operand:SI 0 "register_operand" "=r")
6416 (and:SI (rotate:SI (match_operand:SI 1 "const_int_operand" "")
6417 (minus:SI (const_int 31)
6418 (match_operand:SI 2 "register_operand" "q")))
6419 (match_operand:SI 3 "register_operand" "0")))]
6420 ; this can be generalized...!
6421 "INTVAL (operands[1]) == -2"
6424 HOST_WIDE_INT x = INTVAL (operands[1]);
6425 operands[2] = GEN_INT (exact_log2 ((~x) + 1));
6426 return \"{vdepi 0,%2,%0|depwi 0,%%sar,%2,%0}\";
6428 [(set_attr "type" "shift")
6429 (set_attr "length" "4")])
6431 (define_expand "ashldi3"
6432 [(set (match_operand:DI 0 "register_operand" "")
6433 (ashift:DI (match_operand:DI 1 "lhs_lshift_operand" "")
6434 (match_operand:DI 2 "arith32_operand" "")))]
6438 if (GET_CODE (operands[2]) != CONST_INT)
6440 rtx temp = gen_reg_rtx (DImode);
6441 emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
6442 if (GET_CODE (operands[1]) == CONST_INT)
6443 emit_insn (gen_zvdep_imm64 (operands[0], operands[1], temp));
6445 emit_insn (gen_zvdep64 (operands[0], operands[1], temp));
6448 /* Make sure both inputs are not constants,
6449 there are no patterns for that. */
6450 operands[1] = force_reg (DImode, operands[1]);
6454 [(set (match_operand:DI 0 "register_operand" "=r")
6455 (ashift:DI (match_operand:DI 1 "register_operand" "r")
6456 (match_operand:DI 2 "const_int_operand" "n")))]
6458 "depd,z %1,%p2,%Q2,%0"
6459 [(set_attr "type" "shift")
6460 (set_attr "length" "4")])
6462 ; Match cases of op1 a CONST_INT here that zvdep_imm64 doesn't handle.
6463 ; Doing it like this makes slightly better code since reload can
6464 ; replace a register with a known value in range -16..15 with a
6465 ; constant. Ideally, we would like to merge zvdep64 and zvdep_imm64,
6466 ; but since we have no more CONST_OK... characters, that is not
6468 (define_insn "zvdep64"
6469 [(set (match_operand:DI 0 "register_operand" "=r,r")
6470 (ashift:DI (match_operand:DI 1 "arith5_operand" "r,L")
6471 (minus:DI (const_int 63)
6472 (match_operand:DI 2 "register_operand" "q,q"))))]
6475 depd,z %1,%%sar,64,%0
6476 depdi,z %1,%%sar,64,%0"
6477 [(set_attr "type" "shift,shift")
6478 (set_attr "length" "4,4")])
6480 (define_insn "zvdep_imm64"
6481 [(set (match_operand:DI 0 "register_operand" "=r")
6482 (ashift:DI (match_operand:DI 1 "lhs_lshift_cint_operand" "")
6483 (minus:DI (const_int 63)
6484 (match_operand:DI 2 "register_operand" "q"))))]
6488 unsigned HOST_WIDE_INT x = UINTVAL (operands[1]);
6489 operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
6490 operands[1] = GEN_INT ((x & 0x1f) - 0x20);
6491 return \"depdi,z %1,%%sar,%2,%0\";
6493 [(set_attr "type" "shift")
6494 (set_attr "length" "4")])
6497 [(set (match_operand:DI 0 "register_operand" "=r")
6498 (ior:DI (ashift:DI (match_operand:DI 1 "const_int_operand" "")
6499 (minus:DI (const_int 63)
6500 (match_operand:DI 2 "register_operand" "q")))
6501 (match_operand:DI 3 "register_operand" "0")))]
6502 ; accept ...0001...1, can this be generalized?
6503 "TARGET_64BIT && exact_log2 (INTVAL (operands[1]) + 1) > 0"
6506 HOST_WIDE_INT x = INTVAL (operands[1]);
6507 operands[2] = GEN_INT (exact_log2 (x + 1));
6508 return \"depdi -1,%%sar,%2,%0\";
6510 [(set_attr "type" "shift")
6511 (set_attr "length" "4")])
6514 [(set (match_operand:DI 0 "register_operand" "=r")
6515 (and:DI (rotate:DI (match_operand:DI 1 "const_int_operand" "")
6516 (minus:DI (const_int 63)
6517 (match_operand:DI 2 "register_operand" "q")))
6518 (match_operand:DI 3 "register_operand" "0")))]
6519 ; this can be generalized...!
6520 "TARGET_64BIT && INTVAL (operands[1]) == -2"
6523 HOST_WIDE_INT x = INTVAL (operands[1]);
6524 operands[2] = GEN_INT (exact_log2 ((~x) + 1));
6525 return \"depdi 0,%%sar,%2,%0\";
6527 [(set_attr "type" "shift")
6528 (set_attr "length" "4")])
6530 (define_expand "ashrsi3"
6531 [(set (match_operand:SI 0 "register_operand" "")
6532 (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
6533 (match_operand:SI 2 "arith32_operand" "")))]
6537 if (GET_CODE (operands[2]) != CONST_INT)
6539 rtx temp = gen_reg_rtx (SImode);
6540 emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
6541 emit_insn (gen_vextrs32 (operands[0], operands[1], temp));
6547 [(set (match_operand:SI 0 "register_operand" "=r")
6548 (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
6549 (match_operand:SI 2 "const_int_operand" "n")))]
6551 "{extrs|extrw,s} %1,%P2,%L2,%0"
6552 [(set_attr "type" "shift")
6553 (set_attr "length" "4")])
6555 (define_insn "vextrs32"
6556 [(set (match_operand:SI 0 "register_operand" "=r")
6557 (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
6558 (minus:SI (const_int 31)
6559 (match_operand:SI 2 "register_operand" "q"))))]
6561 "{vextrs %1,32,%0|extrw,s %1,%%sar,32,%0}"
6562 [(set_attr "type" "shift")
6563 (set_attr "length" "4")])
6565 (define_expand "ashrdi3"
6566 [(set (match_operand:DI 0 "register_operand" "")
6567 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6568 (match_operand:DI 2 "arith32_operand" "")))]
6572 if (GET_CODE (operands[2]) != CONST_INT)
6574 rtx temp = gen_reg_rtx (DImode);
6575 emit_insn (gen_subdi3 (temp, GEN_INT (63), operands[2]));
6576 emit_insn (gen_vextrs64 (operands[0], operands[1], temp));
6582 [(set (match_operand:DI 0 "register_operand" "=r")
6583 (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
6584 (match_operand:DI 2 "const_int_operand" "n")))]
6586 "extrd,s %1,%p2,%Q2,%0"
6587 [(set_attr "type" "shift")
6588 (set_attr "length" "4")])
6590 (define_insn "vextrs64"
6591 [(set (match_operand:DI 0 "register_operand" "=r")
6592 (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
6593 (minus:DI (const_int 63)
6594 (match_operand:DI 2 "register_operand" "q"))))]
6596 "extrd,s %1,%%sar,64,%0"
6597 [(set_attr "type" "shift")
6598 (set_attr "length" "4")])
6600 (define_insn "lshrsi3"
6601 [(set (match_operand:SI 0 "register_operand" "=r,r")
6602 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
6603 (match_operand:SI 2 "shift5_operand" "q,n")))]
6606 {vshd %%r0,%1,%0|shrpw %%r0,%1,%%sar,%0}
6607 {extru|extrw,u} %1,%P2,%L2,%0"
6608 [(set_attr "type" "shift")
6609 (set_attr "length" "4")])
6611 (define_insn "lshrdi3"
6612 [(set (match_operand:DI 0 "register_operand" "=r,r")
6613 (lshiftrt:DI (match_operand:DI 1 "register_operand" "r,r")
6614 (match_operand:DI 2 "shift6_operand" "q,n")))]
6617 shrpd %%r0,%1,%%sar,%0
6618 extrd,u %1,%p2,%Q2,%0"
6619 [(set_attr "type" "shift")
6620 (set_attr "length" "4")])
6622 ; Shift right pair word 0 to 31 bits.
6623 (define_insn "shrpsi4"
6624 [(set (match_operand:SI 0 "register_operand" "=r,r")
6625 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "r,r")
6626 (minus:SI (const_int 32)
6627 (match_operand:SI 3 "shift5_operand" "q,n")))
6628 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r,r")
6632 {vshd %1,%2,%0|shrpw %1,%2,%%sar,%0}
6633 {shd|shrpw} %1,%2,%3,%0"
6634 [(set_attr "type" "shift")
6635 (set_attr "length" "4")])
6637 ; Shift right pair doubleword 0 to 63 bits.
6638 (define_insn "shrpdi4"
6639 [(set (match_operand:DI 0 "register_operand" "=r,r")
6640 (ior:DI (ashift:DI (match_operand:SI 1 "register_operand" "r,r")
6641 (minus:DI (const_int 64)
6642 (match_operand:DI 3 "shift6_operand" "q,n")))
6643 (lshiftrt:DI (match_operand:DI 2 "register_operand" "r,r")
6647 shrpd %1,%2,%%sar,%0
6649 [(set_attr "type" "shift")
6650 (set_attr "length" "4")])
6652 (define_insn "rotrsi3"
6653 [(set (match_operand:SI 0 "register_operand" "=r,r")
6654 (rotatert:SI (match_operand:SI 1 "register_operand" "r,r")
6655 (match_operand:SI 2 "shift5_operand" "q,n")))]
6659 if (GET_CODE (operands[2]) == CONST_INT)
6661 operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
6662 return \"{shd|shrpw} %1,%1,%2,%0\";
6665 return \"{vshd %1,%1,%0|shrpw %1,%1,%%sar,%0}\";
6667 [(set_attr "type" "shift")
6668 (set_attr "length" "4")])
6670 (define_expand "rotlsi3"
6671 [(set (match_operand:SI 0 "register_operand" "")
6672 (rotate:SI (match_operand:SI 1 "register_operand" "")
6673 (match_operand:SI 2 "arith32_operand" "")))]
6677 if (GET_CODE (operands[2]) != CONST_INT)
6679 rtx temp = gen_reg_rtx (SImode);
6680 emit_insn (gen_subsi3 (temp, GEN_INT (32), operands[2]));
6681 emit_insn (gen_rotrsi3 (operands[0], operands[1], temp));
6684 /* Else expand normally. */
6688 [(set (match_operand:SI 0 "register_operand" "=r")
6689 (rotate:SI (match_operand:SI 1 "register_operand" "r")
6690 (match_operand:SI 2 "const_int_operand" "n")))]
6694 operands[2] = GEN_INT ((32 - INTVAL (operands[2])) & 31);
6695 return \"{shd|shrpw} %1,%1,%2,%0\";
6697 [(set_attr "type" "shift")
6698 (set_attr "length" "4")])
6701 [(set (match_operand:SI 0 "register_operand" "=r")
6702 (match_operator:SI 5 "plus_xor_ior_operator"
6703 [(ashift:SI (match_operand:SI 1 "register_operand" "r")
6704 (match_operand:SI 3 "const_int_operand" "n"))
6705 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
6706 (match_operand:SI 4 "const_int_operand" "n"))]))]
6707 "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
6708 "{shd|shrpw} %1,%2,%4,%0"
6709 [(set_attr "type" "shift")
6710 (set_attr "length" "4")])
6713 [(set (match_operand:SI 0 "register_operand" "=r")
6714 (match_operator:SI 5 "plus_xor_ior_operator"
6715 [(lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
6716 (match_operand:SI 4 "const_int_operand" "n"))
6717 (ashift:SI (match_operand:SI 1 "register_operand" "r")
6718 (match_operand:SI 3 "const_int_operand" "n"))]))]
6719 "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
6720 "{shd|shrpw} %1,%2,%4,%0"
6721 [(set_attr "type" "shift")
6722 (set_attr "length" "4")])
6725 [(set (match_operand:SI 0 "register_operand" "=r")
6726 (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
6727 (match_operand:SI 2 "const_int_operand" ""))
6728 (match_operand:SI 3 "const_int_operand" "")))]
6729 "exact_log2 (1 + (INTVAL (operands[3]) >> (INTVAL (operands[2]) & 31))) > 0"
6732 int cnt = INTVAL (operands[2]) & 31;
6733 operands[3] = GEN_INT (exact_log2 (1 + (INTVAL (operands[3]) >> cnt)));
6734 operands[2] = GEN_INT (31 - cnt);
6735 return \"{zdep|depw,z} %1,%2,%3,%0\";
6737 [(set_attr "type" "shift")
6738 (set_attr "length" "4")])
6740 ;; Unconditional and other jump instructions.
6742 ;; Trivial return used when no epilogue is needed.
6743 (define_insn "return"
6746 "pa_can_use_return_insn ()"
6750 return \"bve%* (%%r2)\";
6751 return \"bv%* %%r0(%%r2)\";
6753 [(set_attr "type" "branch")
6754 (set_attr "length" "4")])
6756 ;; This is used for most returns.
6757 (define_insn "return_internal"
6764 return \"bve%* (%%r2)\";
6765 return \"bv%* %%r0(%%r2)\";
6767 [(set_attr "type" "branch")
6768 (set_attr "length" "4")])
6770 ;; This is used for eh returns which bypass the return stub.
6771 (define_insn "return_external_pic"
6773 (clobber (reg:SI 1))
6775 "!TARGET_NO_SPACE_REGS
6777 && flag_pic && crtl->calls_eh_return"
6778 "ldsid (%%sr0,%%r2),%%r1\;mtsp %%r1,%%sr0\;be%* 0(%%sr0,%%r2)"
6779 [(set_attr "type" "branch")
6780 (set_attr "length" "12")])
6782 (define_expand "prologue"
6785 "pa_expand_prologue ();DONE;")
6787 (define_expand "sibcall_epilogue"
6792 pa_expand_epilogue ();
6796 (define_expand "epilogue"
6803 /* Try to use the trivial return first. Else use the full epilogue. */
6804 if (pa_can_use_return_insn ())
6808 pa_expand_epilogue ();
6810 /* EH returns bypass the normal return stub. Thus, we must do an
6811 interspace branch to return from functions that call eh_return.
6812 This is only a problem for returns from shared code on ports
6813 using space registers. */
6814 if (!TARGET_NO_SPACE_REGS
6816 && flag_pic && crtl->calls_eh_return)
6817 x = gen_return_external_pic ();
6819 x = gen_return_internal ();
6825 ; Used by hppa_profile_hook to load the starting address of the current
6826 ; function; operand 1 contains the address of the label in operand 3
6827 (define_insn "load_offset_label_address"
6828 [(set (match_operand:SI 0 "register_operand" "=r")
6829 (plus:SI (match_operand:SI 1 "register_operand" "r")
6830 (minus:SI (match_operand:SI 2 "" "")
6831 (label_ref:SI (match_operand 3 "" "")))))]
6834 [(set_attr "type" "multi")
6835 (set_attr "length" "4")])
6837 ; Output a code label and load its address.
6838 (define_insn "lcla1"
6839 [(set (match_operand:SI 0 "register_operand" "=r")
6840 (label_ref:SI (match_operand 1 "" "")))
6845 output_asm_insn (\"bl .+8,%0\;depi 0,31,2,%0\", operands);
6846 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
6847 CODE_LABEL_NUMBER (operands[1]));
6850 [(set_attr "type" "multi")
6851 (set_attr "length" "8")])
6853 (define_insn "lcla2"
6854 [(set (match_operand:SI 0 "register_operand" "=r")
6855 (label_ref:SI (match_operand 1 "" "")))
6860 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
6861 CODE_LABEL_NUMBER (operands[1]));
6864 [(set_attr "type" "move")
6865 (set_attr "length" "4")])
6867 (define_insn "blockage"
6868 [(unspec_volatile [(const_int 2)] UNSPECV_BLOCKAGE)]
6871 [(set_attr "length" "0")])
6874 [(set (pc) (label_ref (match_operand 0 "" "")))]
6878 /* An unconditional branch which can reach its target. */
6879 if (get_attr_length (insn) < 16)
6882 return pa_output_lbranch (operands[0], insn, 1);
6884 [(set_attr "type" "uncond_branch")
6885 (set_attr "pa_combine_type" "uncond_branch")
6886 (set (attr "length")
6887 (cond [(match_test "pa_jump_in_call_delay (insn)")
6888 (if_then_else (lt (abs (minus (match_dup 0)
6889 (plus (pc) (const_int 8))))
6890 (const_int MAX_12BIT_OFFSET))
6893 (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
6894 (const_int MAX_17BIT_OFFSET))
6896 (match_test "TARGET_PORTABLE_RUNTIME")
6898 (not (match_test "flag_pic"))
6902 ;;; Hope this is only within a function...
6903 (define_insn "indirect_jump"
6904 [(set (pc) (match_operand 0 "register_operand" "r"))]
6905 "GET_MODE (operands[0]) == word_mode"
6907 [(set_attr "type" "branch")
6908 (set_attr "length" "4")])
6910 ;;; An indirect jump can be optimized to a direct jump. GAS for the
6911 ;;; SOM target doesn't allow branching to a label inside a function.
6912 ;;; We also don't correctly compute branch distances for labels
6913 ;;; outside the current function. Thus, we use an indirect jump can't
6914 ;;; be optimized to a direct jump for all targets. We assume that
6915 ;;; the branch target is in the same space (i.e., nested function
6916 ;;; jumping to a label in an outer function in the same translation
6918 (define_expand "nonlocal_goto"
6919 [(use (match_operand 0 "general_operand" ""))
6920 (use (match_operand 1 "general_operand" ""))
6921 (use (match_operand 2 "general_operand" ""))
6922 (use (match_operand 3 "general_operand" ""))]
6925 rtx lab = operands[1];
6926 rtx stack = operands[2];
6927 rtx fp = operands[3];
6929 lab = copy_to_reg (lab);
6931 emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode)));
6932 emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
6934 /* Restore the frame pointer. The virtual_stack_vars_rtx is saved
6935 instead of the hard_frame_pointer_rtx in the save area. As a
6936 result, an extra instruction is needed to adjust for the offset
6937 of the virtual stack variables and the hard frame pointer. */
6938 if (GET_CODE (fp) != REG)
6939 fp = force_reg (Pmode, fp);
6940 emit_move_insn (hard_frame_pointer_rtx, plus_constant (Pmode, fp, -8));
6942 emit_stack_restore (SAVE_NONLOCAL, stack);
6944 emit_use (hard_frame_pointer_rtx);
6945 emit_use (stack_pointer_rtx);
6947 /* Nonlocal goto jumps are only used between functions in the same
6948 translation unit. Thus, we can avoid the extra overhead of an
6950 emit_jump_insn (gen_indirect_goto (lab));
6955 (define_insn "indirect_goto"
6956 [(unspec [(match_operand 0 "register_operand" "=r")] UNSPEC_GOTO)]
6957 "GET_MODE (operands[0]) == word_mode"
6959 [(set_attr "type" "branch")
6960 (set_attr "length" "4")])
6962 ;; Subroutines of "casesi".
6963 ;; operand 0 is index
6964 ;; operand 1 is the minimum bound
6965 ;; operand 2 is the maximum bound - minimum bound + 1
6966 ;; operand 3 is CODE_LABEL for the table;
6967 ;; operand 4 is the CODE_LABEL to go to if index out of range.
6969 (define_expand "casesi"
6970 [(match_operand:SI 0 "general_operand" "")
6971 (match_operand:SI 1 "const_int_operand" "")
6972 (match_operand:SI 2 "const_int_operand" "")
6973 (match_operand 3 "" "")
6974 (match_operand 4 "" "")]
6978 if (GET_CODE (operands[0]) != REG)
6979 operands[0] = force_reg (SImode, operands[0]);
6981 if (operands[1] != const0_rtx)
6983 rtx index = gen_reg_rtx (SImode);
6985 operands[1] = gen_int_mode (-INTVAL (operands[1]), SImode);
6986 if (!INT_14_BITS (operands[1]))
6987 operands[1] = force_reg (SImode, operands[1]);
6988 emit_insn (gen_addsi3 (index, operands[0], operands[1]));
6989 operands[0] = index;
6992 if (!INT_5_BITS (operands[2]))
6993 operands[2] = force_reg (SImode, operands[2]);
6995 /* This branch prevents us finding an insn for the delay slot of the
6996 following vectored branch. It might be possible to use the delay
6997 slot if an index value of -1 was used to transfer to the out-of-range
6998 label. In order to do this, we would have to output the -1 vector
6999 element after the delay insn. The casesi output code would have to
7000 check if the casesi insn is in a delay branch sequence and output
7001 the delay insn if one is found. If this was done, then it might
7002 then be worthwhile to split the casesi patterns to improve scheduling.
7003 However, it's not clear that all this extra complexity is worth
7006 rtx test = gen_rtx_GTU (VOIDmode, operands[0], operands[2]);
7007 emit_jump_insn (gen_cbranchsi4 (test, operands[0], operands[2], operands[4]));
7010 /* In 64bit mode we must make sure to wipe the upper bits of the register
7011 just in case the addition overflowed or we had random bits in the
7012 high part of the register. */
7015 rtx index = gen_reg_rtx (DImode);
7017 emit_insn (gen_extendsidi2 (index, operands[0]));
7018 operands[0] = index;
7022 emit_jump_insn (gen_casesi64p (operands[0], operands[3]));
7024 emit_jump_insn (gen_casesi32p (operands[0], operands[3]));
7026 emit_jump_insn (gen_casesi32 (operands[0], operands[3]));
7030 ;;; 32-bit code, absolute branch table.
7031 (define_insn "casesi32"
7032 [(set (pc) (mem:SI (plus:SI
7033 (mult:SI (match_operand:SI 0 "register_operand" "r")
7035 (label_ref (match_operand 1 "" "")))))
7036 (clobber (match_scratch:SI 2 "=&r"))]
7038 "ldil L'%l1,%2\;ldo R'%l1(%2),%2\;{ldwx|ldw},s %0(%2),%2\;bv,n %%r0(%2)"
7039 [(set_attr "type" "multi")
7040 (set_attr "length" "16")])
7042 ;;; 32-bit code, relative branch table.
7043 (define_insn "casesi32p"
7044 [(set (pc) (mem:SI (plus:SI
7045 (mult:SI (match_operand:SI 0 "register_operand" "r")
7047 (label_ref (match_operand 1 "" "")))))
7048 (clobber (match_scratch:SI 2 "=&r"))
7049 (clobber (match_scratch:SI 3 "=&r"))]
7051 "{bl .+8,%2\;depi 0,31,2,%2|mfia %2}\;ldo {%l1-.|%l1+4-.}(%2),%2\;\
7052 {ldwx|ldw},s %0(%2),%3\;{addl|add,l} %2,%3,%3\;bv,n %%r0(%3)"
7053 [(set_attr "type" "multi")
7054 (set (attr "length")
7055 (if_then_else (match_test "TARGET_PA_20")
7059 ;;; 64-bit code, 32-bit relative branch table.
7060 (define_insn "casesi64p"
7061 [(set (pc) (mem:DI (plus:DI
7062 (mult:DI (match_operand:DI 0 "register_operand" "r")
7064 (label_ref (match_operand 1 "" "")))))
7065 (clobber (match_scratch:DI 2 "=&r"))
7066 (clobber (match_scratch:DI 3 "=&r"))]
7068 "mfia %2\;ldo %l1+4-.(%2),%2\;ldw,s %0(%2),%3\;extrd,s %3,63,32,%3\;\
7069 add,l %2,%3,%3\;bv,n %%r0(%3)"
7070 [(set_attr "type" "multi")
7071 (set_attr "length" "24")])
7075 ;;- jump to subroutine
7077 (define_expand "call"
7078 [(parallel [(call (match_operand:SI 0 "" "")
7079 (match_operand 1 "" ""))
7080 (clobber (reg:SI 2))])]
7085 rtx nb = operands[1];
7087 if (TARGET_PORTABLE_RUNTIME)
7088 op = force_reg (SImode, XEXP (operands[0], 0));
7090 op = XEXP (operands[0], 0);
7094 if (!virtuals_instantiated)
7095 emit_move_insn (arg_pointer_rtx,
7096 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
7100 /* The loop pass can generate new libcalls after the virtual
7101 registers are instantiated when fpregs are disabled because
7102 the only method that we have for doing DImode multiplication
7103 is with a libcall. This could be trouble if we haven't
7104 allocated enough space for the outgoing arguments. */
7105 gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
7107 emit_move_insn (arg_pointer_rtx,
7108 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
7109 GEN_INT (STACK_POINTER_OFFSET + 64)));
7113 /* Use two different patterns for calls to explicitly named functions
7114 and calls through function pointers. This is necessary as these two
7115 types of calls use different calling conventions, and CSE might try
7116 to change the named call into an indirect call in some cases (using
7117 two patterns keeps CSE from performing this optimization).
7119 We now use even more call patterns as there was a subtle bug in
7120 attempting to restore the pic register after a call using a simple
7121 move insn. During reload, a instruction involving a pseudo register
7122 with no explicit dependence on the PIC register can be converted
7123 to an equivalent load from memory using the PIC register. If we
7124 emit a simple move to restore the PIC register in the initial rtl
7125 generation, then it can potentially be repositioned during scheduling.
7126 and an instruction that eventually uses the PIC register may end up
7127 between the call and the PIC register restore.
7129 This only worked because there is a post call group of instructions
7130 that are scheduled with the call. These instructions are included
7131 in the same basic block as the call. However, calls can throw in
7132 C++ code and a basic block has to terminate at the call if the call
7133 can throw. This results in the PIC register restore being scheduled
7134 independently from the call. So, we now hide the save and restore
7135 of the PIC register in the call pattern until after reload. Then,
7136 we split the moves out. A small side benefit is that we now don't
7137 need to have a use of the PIC register in the return pattern and
7138 the final save/restore operation is not needed.
7140 I elected to just use register %r4 in the PIC patterns instead
7141 of trying to force hppa_pic_save_rtx () to a callee saved register.
7142 This might have required a new register class and constraint. It
7143 was also simpler to just handle the restore from a register than a
7147 rtx r4 = gen_rtx_REG (word_mode, 4);
7148 if (GET_CODE (op) == SYMBOL_REF)
7149 emit_call_insn (gen_call_symref_64bit (op, nb, r4));
7152 op = force_reg (word_mode, op);
7153 emit_call_insn (gen_call_reg_64bit (op, nb, r4));
7158 if (GET_CODE (op) == SYMBOL_REF)
7162 rtx r4 = gen_rtx_REG (word_mode, 4);
7163 emit_call_insn (gen_call_symref_pic (op, nb, r4));
7166 emit_call_insn (gen_call_symref (op, nb));
7170 rtx tmpreg = gen_rtx_REG (word_mode, 22);
7171 emit_move_insn (tmpreg, force_reg (word_mode, op));
7174 rtx r4 = gen_rtx_REG (word_mode, 4);
7175 emit_call_insn (gen_call_reg_pic (nb, r4));
7178 emit_call_insn (gen_call_reg (nb));
7185 ;; We use function calls to set the attribute length of calls and millicode
7186 ;; calls. This is necessary because of the large variety of call sequences.
7187 ;; Implementing the calculation in rtl is difficult as well as ugly. As
7188 ;; we need the same calculation in several places, maintenance becomes a
7191 ;; However, this has a subtle impact on branch shortening. When the
7192 ;; expression used to set the length attribute of an instruction depends
7193 ;; on a relative address (e.g., pc or a branch address), genattrtab
7194 ;; notes that the insn's length is variable, and attempts to determine a
7195 ;; worst-case default length and code to compute an insn's current length.
7197 ;; The use of a function call hides the variable dependence of our calls
7198 ;; and millicode calls. The result is genattrtab doesn't treat the operation
7199 ;; as variable and it only generates code for the default case using our
7200 ;; function call. Because of this, calls and millicode calls have a fixed
7201 ;; length in the branch shortening pass, and some branches will use a longer
7202 ;; code sequence than necessary. However, the length of any given call
7203 ;; will still reflect its final code location and it may be shorter than
7204 ;; the initial length estimate.
7206 ;; It's possible to trick genattrtab by adding an expression involving `pc'
7207 ;; in the set. However, when genattrtab hits a function call in its attempt
7208 ;; to compute the default length, it marks the result as unknown and sets
7209 ;; the default result to MAX_INT ;-( One possible fix that would allow
7210 ;; calls to participate in branch shortening would be to make the call to
7211 ;; insn_default_length a target option. Then, we could massage unknown
7212 ;; results. Another fix might be to change genattrtab so that it just does
7213 ;; the call in the variable case as it already does for the fixed case.
7215 (define_insn "call_symref"
7216 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7217 (match_operand 1 "" "i"))
7218 (clobber (reg:SI 1))
7219 (clobber (reg:SI 2))
7220 (use (const_int 0))]
7221 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7224 pa_output_arg_descriptor (insn);
7225 return pa_output_call (insn, operands[0], 0);
7227 [(set_attr "type" "call")
7228 (set (attr "length")
7229 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7230 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7232 (define_insn "call_symref_pic"
7233 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7234 (match_operand 1 "" "i"))
7235 (clobber (reg:SI 1))
7236 (clobber (reg:SI 2))
7237 (clobber (match_operand 2))
7239 (use (const_int 0))]
7240 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7243 ;; Split out the PIC register save and restore after reload. As the
7244 ;; split is done after reload, there are some situations in which we
7245 ;; unnecessarily save and restore %r4. This happens when there is a
7246 ;; single call and the PIC register is not used after the call.
7248 ;; The split has to be done since call_from_call_insn () can't handle
7249 ;; the pattern as is. Noreturn calls are special because they have to
7250 ;; terminate the basic block. The split has to contain more than one
7253 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7254 (match_operand 1 "" ""))
7255 (clobber (reg:SI 1))
7256 (clobber (reg:SI 2))
7257 (clobber (match_operand 2))
7259 (use (const_int 0))])]
7260 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed
7261 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7262 [(set (match_dup 2) (reg:SI 19))
7263 (parallel [(call (mem:SI (match_dup 0))
7265 (clobber (reg:SI 1))
7266 (clobber (reg:SI 2))
7268 (use (const_int 0))])]
7272 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7273 (match_operand 1 "" ""))
7274 (clobber (reg:SI 1))
7275 (clobber (reg:SI 2))
7276 (clobber (match_operand 2))
7278 (use (const_int 0))])]
7279 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
7280 [(set (match_dup 2) (reg:SI 19))
7281 (parallel [(call (mem:SI (match_dup 0))
7283 (clobber (reg:SI 1))
7284 (clobber (reg:SI 2))
7286 (use (const_int 0))])
7287 (set (reg:SI 19) (match_dup 2))]
7290 (define_insn "*call_symref_pic_post_reload"
7291 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7292 (match_operand 1 "" "i"))
7293 (clobber (reg:SI 1))
7294 (clobber (reg:SI 2))
7296 (use (const_int 0))]
7297 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7300 pa_output_arg_descriptor (insn);
7301 return pa_output_call (insn, operands[0], 0);
7303 [(set_attr "type" "call")
7304 (set (attr "length")
7305 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7306 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7308 ;; This pattern is split if it is necessary to save and restore the
7310 (define_insn "call_symref_64bit"
7311 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7312 (match_operand 1 "" "i"))
7313 (clobber (reg:DI 1))
7314 (clobber (reg:DI 2))
7315 (clobber (match_operand 2))
7318 (use (const_int 0))]
7322 ;; Split out the PIC register save and restore after reload. As the
7323 ;; split is done after reload, there are some situations in which we
7324 ;; unnecessarily save and restore %r4. This happens when there is a
7325 ;; single call and the PIC register is not used after the call.
7327 ;; The split has to be done since call_from_call_insn () can't handle
7328 ;; the pattern as is. Noreturn calls are special because they have to
7329 ;; terminate the basic block. The split has to contain more than one
7332 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7333 (match_operand 1 "" ""))
7334 (clobber (reg:DI 1))
7335 (clobber (reg:DI 2))
7336 (clobber (match_operand 2))
7339 (use (const_int 0))])]
7340 "TARGET_64BIT && reload_completed
7341 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7342 [(set (match_dup 2) (reg:DI 27))
7343 (parallel [(call (mem:SI (match_dup 0))
7345 (clobber (reg:DI 1))
7346 (clobber (reg:DI 2))
7349 (use (const_int 0))])]
7353 [(parallel [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7354 (match_operand 1 "" ""))
7355 (clobber (reg:DI 1))
7356 (clobber (reg:DI 2))
7357 (clobber (match_operand 2))
7360 (use (const_int 0))])]
7361 "TARGET_64BIT && reload_completed"
7362 [(set (match_dup 2) (reg:DI 27))
7363 (parallel [(call (mem:SI (match_dup 0))
7365 (clobber (reg:DI 1))
7366 (clobber (reg:DI 2))
7369 (use (const_int 0))])
7370 (set (reg:DI 27) (match_dup 2))]
7373 (define_insn "*call_symref_64bit_post_reload"
7374 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
7375 (match_operand 1 "" "i"))
7376 (clobber (reg:DI 1))
7377 (clobber (reg:DI 2))
7380 (use (const_int 0))]
7384 pa_output_arg_descriptor (insn);
7385 return pa_output_call (insn, operands[0], 0);
7387 [(set_attr "type" "call")
7388 (set (attr "length")
7389 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7390 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7392 (define_insn "call_reg"
7393 [(call (mem:SI (reg:SI 22))
7394 (match_operand 0 "" "i"))
7395 (clobber (reg:SI 1))
7396 (clobber (reg:SI 2))
7397 (use (const_int 1))]
7401 return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
7403 [(set_attr "type" "dyncall")
7404 (set (attr "length")
7405 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7406 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
7408 ;; This pattern is split if it is necessary to save and restore the
7410 (define_insn "call_reg_pic"
7411 [(call (mem:SI (reg:SI 22))
7412 (match_operand 0 "" "i"))
7413 (clobber (reg:SI 1))
7414 (clobber (reg:SI 2))
7415 (clobber (match_operand 1))
7417 (use (const_int 1))]
7421 ;; Split out the PIC register save and restore after reload. As the
7422 ;; split is done after reload, there are some situations in which we
7423 ;; unnecessarily save and restore %r4. This happens when there is a
7424 ;; single call and the PIC register is not used after the call.
7426 ;; The split has to be done since call_from_call_insn () can't handle
7427 ;; the pattern as is. Noreturn calls are special because they have to
7428 ;; terminate the basic block. The split has to contain more than one
7431 [(parallel [(call (mem:SI (reg:SI 22))
7432 (match_operand 0 "" ""))
7433 (clobber (reg:SI 1))
7434 (clobber (reg:SI 2))
7435 (clobber (match_operand 1))
7437 (use (const_int 1))])]
7438 "!TARGET_64BIT && reload_completed
7439 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7440 [(set (match_dup 1) (reg:SI 19))
7441 (parallel [(call (mem:SI (reg:SI 22))
7443 (clobber (reg:SI 1))
7444 (clobber (reg:SI 2))
7446 (use (const_int 1))])]
7450 [(parallel [(call (mem:SI (reg:SI 22))
7451 (match_operand 0 "" ""))
7452 (clobber (reg:SI 1))
7453 (clobber (reg:SI 2))
7454 (clobber (match_operand 1))
7456 (use (const_int 1))])]
7457 "!TARGET_64BIT && reload_completed"
7458 [(set (match_dup 1) (reg:SI 19))
7459 (parallel [(call (mem:SI (reg:SI 22))
7461 (clobber (reg:SI 1))
7462 (clobber (reg:SI 2))
7464 (use (const_int 1))])
7465 (set (reg:SI 19) (match_dup 1))]
7468 (define_insn "*call_reg_pic_post_reload"
7469 [(call (mem:SI (reg:SI 22))
7470 (match_operand 0 "" "i"))
7471 (clobber (reg:SI 1))
7472 (clobber (reg:SI 2))
7474 (use (const_int 1))]
7478 return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
7480 [(set_attr "type" "dyncall")
7481 (set (attr "length")
7482 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7483 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
7485 ;; This pattern is split if it is necessary to save and restore the
7487 (define_insn "call_reg_64bit"
7488 [(call (mem:SI (match_operand:DI 0 "register_operand" "r"))
7489 (match_operand 1 "" "i"))
7490 (clobber (reg:DI 1))
7491 (clobber (reg:DI 2))
7492 (clobber (match_operand 2))
7495 (use (const_int 1))]
7499 ;; Split out the PIC register save and restore after reload. As the
7500 ;; split is done after reload, there are some situations in which we
7501 ;; unnecessarily save and restore %r4. This happens when there is a
7502 ;; single call and the PIC register is not used after the call.
7504 ;; The split has to be done since call_from_call_insn () can't handle
7505 ;; the pattern as is. Noreturn calls are special because they have to
7506 ;; terminate the basic block. The split has to contain more than one
7509 [(parallel [(call (mem:SI (match_operand 0 "register_operand" ""))
7510 (match_operand 1 "" ""))
7511 (clobber (reg:DI 1))
7512 (clobber (reg:DI 2))
7513 (clobber (match_operand 2))
7516 (use (const_int 1))])]
7517 "TARGET_64BIT && reload_completed
7518 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7519 [(set (match_dup 2) (reg:DI 27))
7520 (parallel [(call (mem:SI (match_dup 0))
7522 (clobber (reg:DI 1))
7523 (clobber (reg:DI 2))
7526 (use (const_int 1))])]
7530 [(parallel [(call (mem:SI (match_operand 0 "register_operand" ""))
7531 (match_operand 1 "" ""))
7532 (clobber (reg:DI 1))
7533 (clobber (reg:DI 2))
7534 (clobber (match_operand 2))
7537 (use (const_int 1))])]
7538 "TARGET_64BIT && reload_completed"
7539 [(set (match_dup 2) (reg:DI 27))
7540 (parallel [(call (mem:SI (match_dup 0))
7542 (clobber (reg:DI 1))
7543 (clobber (reg:DI 2))
7546 (use (const_int 1))])
7547 (set (reg:DI 27) (match_dup 2))]
7550 (define_insn "*call_reg_64bit_post_reload"
7551 [(call (mem:SI (match_operand:DI 0 "register_operand" "r"))
7552 (match_operand 1 "" "i"))
7553 (clobber (reg:DI 1))
7554 (clobber (reg:DI 2))
7557 (use (const_int 1))]
7561 return pa_output_indirect_call (insn, operands[0]);
7563 [(set_attr "type" "dyncall")
7564 (set (attr "length")
7565 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 12)]
7566 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
7568 (define_expand "call_value"
7569 [(parallel [(set (match_operand 0 "" "")
7570 (call (match_operand:SI 1 "" "")
7571 (match_operand 2 "" "")))
7572 (clobber (reg:SI 2))])]
7576 rtx dst = operands[0];
7577 rtx nb = operands[2];
7579 if (TARGET_PORTABLE_RUNTIME)
7580 op = force_reg (SImode, XEXP (operands[1], 0));
7582 op = XEXP (operands[1], 0);
7586 if (!virtuals_instantiated)
7587 emit_move_insn (arg_pointer_rtx,
7588 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
7592 /* The loop pass can generate new libcalls after the virtual
7593 registers are instantiated when fpregs are disabled because
7594 the only method that we have for doing DImode multiplication
7595 is with a libcall. This could be trouble if we haven't
7596 allocated enough space for the outgoing arguments. */
7597 gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
7599 emit_move_insn (arg_pointer_rtx,
7600 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
7601 GEN_INT (STACK_POINTER_OFFSET + 64)));
7605 /* Use two different patterns for calls to explicitly named functions
7606 and calls through function pointers. This is necessary as these two
7607 types of calls use different calling conventions, and CSE might try
7608 to change the named call into an indirect call in some cases (using
7609 two patterns keeps CSE from performing this optimization).
7611 We now use even more call patterns as there was a subtle bug in
7612 attempting to restore the pic register after a call using a simple
7613 move insn. During reload, a instruction involving a pseudo register
7614 with no explicit dependence on the PIC register can be converted
7615 to an equivalent load from memory using the PIC register. If we
7616 emit a simple move to restore the PIC register in the initial rtl
7617 generation, then it can potentially be repositioned during scheduling.
7618 and an instruction that eventually uses the PIC register may end up
7619 between the call and the PIC register restore.
7621 This only worked because there is a post call group of instructions
7622 that are scheduled with the call. These instructions are included
7623 in the same basic block as the call. However, calls can throw in
7624 C++ code and a basic block has to terminate at the call if the call
7625 can throw. This results in the PIC register restore being scheduled
7626 independently from the call. So, we now hide the save and restore
7627 of the PIC register in the call pattern until after reload. Then,
7628 we split the moves out. A small side benefit is that we now don't
7629 need to have a use of the PIC register in the return pattern and
7630 the final save/restore operation is not needed.
7632 I elected to just use register %r4 in the PIC patterns instead
7633 of trying to force hppa_pic_save_rtx () to a callee saved register.
7634 This might have required a new register class and constraint. It
7635 was also simpler to just handle the restore from a register than a
7639 rtx r4 = gen_rtx_REG (word_mode, 4);
7640 if (GET_CODE (op) == SYMBOL_REF)
7642 if (TARGET_HPUX && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT
7643 && !strcmp (targetm.strip_name_encoding (XSTR (op, 0)), "powf"))
7644 emit_call_insn (gen_call_val_powf_64bit (dst, op, nb, r4));
7646 emit_call_insn (gen_call_val_symref_64bit (dst, op, nb, r4));
7650 op = force_reg (word_mode, op);
7651 emit_call_insn (gen_call_val_reg_64bit (dst, op, nb, r4));
7656 if (GET_CODE (op) == SYMBOL_REF)
7660 rtx r4 = gen_rtx_REG (word_mode, 4);
7662 if (TARGET_HPUX && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT
7663 && !strcmp (targetm.strip_name_encoding (XSTR (op, 0)),
7665 emit_call_insn (gen_call_val_powf_pic (dst, op, nb, r4));
7667 emit_call_insn (gen_call_val_symref_pic (dst, op, nb, r4));
7671 if (TARGET_HPUX && !TARGET_DISABLE_FPREGS && !TARGET_SOFT_FLOAT
7672 && !strcmp (targetm.strip_name_encoding (XSTR (op, 0)),
7674 emit_call_insn (gen_call_val_powf (dst, op, nb));
7676 emit_call_insn (gen_call_val_symref (dst, op, nb));
7681 rtx tmpreg = gen_rtx_REG (word_mode, 22);
7682 emit_move_insn (tmpreg, force_reg (word_mode, op));
7685 rtx r4 = gen_rtx_REG (word_mode, 4);
7686 emit_call_insn (gen_call_val_reg_pic (dst, nb, r4));
7689 emit_call_insn (gen_call_val_reg (dst, nb));
7696 (define_insn "call_val_symref"
7697 [(set (match_operand 0 "" "")
7698 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7699 (match_operand 2 "" "i")))
7700 (clobber (reg:SI 1))
7701 (clobber (reg:SI 2))
7702 (use (const_int 0))]
7703 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7706 pa_output_arg_descriptor (insn);
7707 return pa_output_call (insn, operands[1], 0);
7709 [(set_attr "type" "call")
7710 (set (attr "length")
7711 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7712 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7714 ;; powf function clobbers %fr12
7715 (define_insn "call_val_powf"
7716 [(set (match_operand 0 "" "")
7717 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7718 (match_operand 2 "" "i")))
7719 (clobber (reg:SI 1))
7720 (clobber (reg:SI 2))
7721 (clobber (reg:DF 48))
7722 (use (const_int 1))]
7723 "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7726 pa_output_arg_descriptor (insn);
7727 return pa_output_call (insn, operands[1], 0);
7729 [(set_attr "type" "call")
7730 (set (attr "length")
7731 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7732 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7734 (define_insn "call_val_symref_pic"
7735 [(set (match_operand 0 "" "")
7736 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7737 (match_operand 2 "" "i")))
7738 (clobber (reg:SI 1))
7739 (clobber (reg:SI 2))
7740 (clobber (match_operand 3))
7742 (use (const_int 0))]
7743 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7746 ;; Split out the PIC register save and restore after reload. As the
7747 ;; split is done after reload, there are some situations in which we
7748 ;; unnecessarily save and restore %r4. This happens when there is a
7749 ;; single call and the PIC register is not used after the call.
7751 ;; The split has to be done since call_from_call_insn () can't handle
7752 ;; the pattern as is. Noreturn calls are special because they have to
7753 ;; terminate the basic block. The split has to contain more than one
7756 [(parallel [(set (match_operand 0 "" "")
7757 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7758 (match_operand 2 "" "")))
7759 (clobber (reg:SI 1))
7760 (clobber (reg:SI 2))
7761 (clobber (match_operand 3))
7763 (use (const_int 0))])]
7764 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed
7765 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7766 [(set (match_dup 3) (reg:SI 19))
7767 (parallel [(set (match_dup 0)
7768 (call (mem:SI (match_dup 1))
7770 (clobber (reg:SI 1))
7771 (clobber (reg:SI 2))
7773 (use (const_int 0))])]
7777 [(parallel [(set (match_operand 0 "" "")
7778 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7779 (match_operand 2 "" "")))
7780 (clobber (reg:SI 1))
7781 (clobber (reg:SI 2))
7782 (clobber (match_operand 3))
7784 (use (const_int 0))])]
7785 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
7786 [(set (match_dup 3) (reg:SI 19))
7787 (parallel [(set (match_dup 0)
7788 (call (mem:SI (match_dup 1))
7790 (clobber (reg:SI 1))
7791 (clobber (reg:SI 2))
7793 (use (const_int 0))])
7794 (set (reg:SI 19) (match_dup 3))]
7797 (define_insn "*call_val_symref_pic_post_reload"
7798 [(set (match_operand 0 "" "")
7799 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7800 (match_operand 2 "" "i")))
7801 (clobber (reg:SI 1))
7802 (clobber (reg:SI 2))
7804 (use (const_int 0))]
7805 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7808 pa_output_arg_descriptor (insn);
7809 return pa_output_call (insn, operands[1], 0);
7811 [(set_attr "type" "call")
7812 (set (attr "length")
7813 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7814 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7816 ;; powf function clobbers %fr12
7817 (define_insn "call_val_powf_pic"
7818 [(set (match_operand 0 "" "")
7819 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7820 (match_operand 2 "" "i")))
7821 (clobber (reg:SI 1))
7822 (clobber (reg:SI 2))
7823 (clobber (reg:DF 48))
7824 (clobber (match_operand 3))
7826 (use (const_int 1))]
7827 "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7830 ;; Split out the PIC register save and restore after reload. As the
7831 ;; split is done after reload, there are some situations in which we
7832 ;; unnecessarily save and restore %r4. This happens when there is a
7833 ;; single call and the PIC register is not used after the call.
7835 ;; The split has to be done since call_from_call_insn () can't handle
7836 ;; the pattern as is. Noreturn calls are special because they have to
7837 ;; terminate the basic block. The split has to contain more than one
7840 [(parallel [(set (match_operand 0 "" "")
7841 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7842 (match_operand 2 "" "")))
7843 (clobber (reg:SI 1))
7844 (clobber (reg:SI 2))
7845 (clobber (reg:DF 48))
7846 (clobber (match_operand 3))
7848 (use (const_int 1))])]
7849 "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed
7850 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7851 [(set (match_dup 3) (reg:SI 19))
7852 (parallel [(set (match_dup 0)
7853 (call (mem:SI (match_dup 1))
7855 (clobber (reg:SI 1))
7856 (clobber (reg:SI 2))
7857 (clobber (reg:DF 48))
7859 (use (const_int 1))])]
7863 [(parallel [(set (match_operand 0 "" "")
7864 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7865 (match_operand 2 "" "")))
7866 (clobber (reg:SI 1))
7867 (clobber (reg:SI 2))
7868 (clobber (reg:DF 48))
7869 (clobber (match_operand 3))
7871 (use (const_int 1))])]
7872 "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT && reload_completed"
7873 [(set (match_dup 3) (reg:SI 19))
7874 (parallel [(set (match_dup 0)
7875 (call (mem:SI (match_dup 1))
7877 (clobber (reg:SI 1))
7878 (clobber (reg:SI 2))
7879 (clobber (reg:DF 48))
7881 (use (const_int 1))])
7882 (set (reg:SI 19) (match_dup 3))]
7885 (define_insn "*call_val_powf_pic_post_reload"
7886 [(set (match_operand 0 "" "")
7887 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7888 (match_operand 2 "" "i")))
7889 (clobber (reg:SI 1))
7890 (clobber (reg:SI 2))
7891 (clobber (reg:DF 48))
7893 (use (const_int 1))]
7894 "TARGET_HPUX && !TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
7897 pa_output_arg_descriptor (insn);
7898 return pa_output_call (insn, operands[1], 0);
7900 [(set_attr "type" "call")
7901 (set (attr "length")
7902 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7903 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7905 ;; This pattern is split if it is necessary to save and restore the
7907 (define_insn "call_val_symref_64bit"
7908 [(set (match_operand 0 "" "")
7909 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7910 (match_operand 2 "" "i")))
7911 (clobber (reg:DI 1))
7912 (clobber (reg:DI 2))
7913 (clobber (match_operand 3))
7916 (use (const_int 0))]
7920 ;; Split out the PIC register save and restore after reload. As the
7921 ;; split is done after reload, there are some situations in which we
7922 ;; unnecessarily save and restore %r4. This happens when there is a
7923 ;; single call and the PIC register is not used after the call.
7925 ;; The split has to be done since call_from_call_insn () can't handle
7926 ;; the pattern as is. Noreturn calls are special because they have to
7927 ;; terminate the basic block. The split has to contain more than one
7930 [(parallel [(set (match_operand 0 "" "")
7931 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7932 (match_operand 2 "" "")))
7933 (clobber (reg:DI 1))
7934 (clobber (reg:DI 2))
7935 (clobber (match_operand 3))
7938 (use (const_int 0))])]
7939 "TARGET_64BIT && reload_completed
7940 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7941 [(set (match_dup 3) (reg:DI 27))
7942 (parallel [(set (match_dup 0)
7943 (call (mem:SI (match_dup 1))
7945 (clobber (reg:DI 1))
7946 (clobber (reg:DI 2))
7949 (use (const_int 0))])]
7953 [(parallel [(set (match_operand 0 "" "")
7954 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7955 (match_operand 2 "" "")))
7956 (clobber (reg:DI 1))
7957 (clobber (reg:DI 2))
7958 (clobber (match_operand 3))
7961 (use (const_int 0))])]
7962 "TARGET_64BIT && reload_completed"
7963 [(set (match_dup 3) (reg:DI 27))
7964 (parallel [(set (match_dup 0)
7965 (call (mem:SI (match_dup 1))
7967 (clobber (reg:DI 1))
7968 (clobber (reg:DI 2))
7971 (use (const_int 0))])
7972 (set (reg:DI 27) (match_dup 3))]
7975 (define_insn "*call_val_symref_64bit_post_reload"
7976 [(set (match_operand 0 "" "")
7977 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7978 (match_operand 2 "" "i")))
7979 (clobber (reg:DI 1))
7980 (clobber (reg:DI 2))
7983 (use (const_int 0))]
7987 pa_output_arg_descriptor (insn);
7988 return pa_output_call (insn, operands[1], 0);
7990 [(set_attr "type" "call")
7991 (set (attr "length")
7992 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
7993 (symbol_ref "pa_attr_length_call (insn, 0)")))])
7995 ;; powf function clobbers %fr12
7996 (define_insn "call_val_powf_64bit"
7997 [(set (match_operand 0 "" "")
7998 (call (mem:SI (match_operand 1 "call_operand_address" ""))
7999 (match_operand 2 "" "i")))
8000 (clobber (reg:DI 1))
8001 (clobber (reg:DI 2))
8002 (clobber (reg:DF 40))
8003 (clobber (match_operand 3))
8006 (use (const_int 1))]
8007 "TARGET_64BIT && TARGET_HPUX"
8010 ;; Split out the PIC register save and restore after reload. As the
8011 ;; split is done after reload, there are some situations in which we
8012 ;; unnecessarily save and restore %r4. This happens when there is a
8013 ;; single call and the PIC register is not used after the call.
8015 ;; The split has to be done since call_from_call_insn () can't handle
8016 ;; the pattern as is. Noreturn calls are special because they have to
8017 ;; terminate the basic block. The split has to contain more than one
8020 [(parallel [(set (match_operand 0 "" "")
8021 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8022 (match_operand 2 "" "")))
8023 (clobber (reg:DI 1))
8024 (clobber (reg:DI 2))
8025 (clobber (reg:DF 40))
8026 (clobber (match_operand 3))
8029 (use (const_int 1))])]
8030 "TARGET_64BIT && TARGET_HPUX && reload_completed
8031 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8032 [(set (match_dup 3) (reg:DI 27))
8033 (parallel [(set (match_dup 0)
8034 (call (mem:SI (match_dup 1))
8036 (clobber (reg:DI 1))
8037 (clobber (reg:DI 2))
8038 (clobber (reg:DF 40))
8041 (use (const_int 1))])]
8045 [(parallel [(set (match_operand 0 "" "")
8046 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8047 (match_operand 2 "" "")))
8048 (clobber (reg:DI 1))
8049 (clobber (reg:DI 2))
8050 (clobber (reg:DF 40))
8051 (clobber (match_operand 3))
8054 (use (const_int 1))])]
8055 "TARGET_64BIT && TARGET_HPUX && reload_completed"
8056 [(set (match_dup 3) (reg:DI 27))
8057 (parallel [(set (match_dup 0)
8058 (call (mem:SI (match_dup 1))
8060 (clobber (reg:DI 1))
8061 (clobber (reg:DI 2))
8062 (clobber (reg:DF 40))
8065 (use (const_int 1))])
8066 (set (reg:DI 27) (match_dup 3))]
8069 (define_insn "*call_val_powf_64bit_post_reload"
8070 [(set (match_operand 0 "" "")
8071 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8072 (match_operand 2 "" "i")))
8073 (clobber (reg:DI 1))
8074 (clobber (reg:DI 2))
8075 (clobber (reg:DF 40))
8078 (use (const_int 1))]
8079 "TARGET_64BIT && TARGET_HPUX"
8082 pa_output_arg_descriptor (insn);
8083 return pa_output_call (insn, operands[1], 0);
8085 [(set_attr "type" "call")
8086 (set (attr "length")
8087 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8088 (symbol_ref "pa_attr_length_call (insn, 0)")))])
8090 (define_insn "call_val_reg"
8091 [(set (match_operand 0 "" "")
8092 (call (mem:SI (reg:SI 22))
8093 (match_operand 1 "" "i")))
8094 (clobber (reg:SI 1))
8095 (clobber (reg:SI 2))
8096 (use (const_int 1))]
8100 return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
8102 [(set_attr "type" "dyncall")
8103 (set (attr "length")
8104 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8105 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
8107 ;; This pattern is split if it is necessary to save and restore the
8109 (define_insn "call_val_reg_pic"
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))
8115 (clobber (match_operand 2))
8117 (use (const_int 1))]
8121 ;; Split out the PIC register save and restore after reload. As the
8122 ;; split is done after reload, there are some situations in which we
8123 ;; unnecessarily save and restore %r4. This happens when there is a
8124 ;; single call and the PIC register is not used after the call.
8126 ;; The split has to be done since call_from_call_insn () can't handle
8127 ;; the pattern as is. Noreturn calls are special because they have to
8128 ;; terminate the basic block. The split has to contain more than one
8131 [(parallel [(set (match_operand 0 "" "")
8132 (call (mem:SI (reg:SI 22))
8133 (match_operand 1 "" "")))
8134 (clobber (reg:SI 1))
8135 (clobber (reg:SI 2))
8136 (clobber (match_operand 2))
8138 (use (const_int 1))])]
8139 "!TARGET_64BIT && reload_completed
8140 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8141 [(set (match_dup 2) (reg:SI 19))
8142 (parallel [(set (match_dup 0)
8143 (call (mem:SI (reg:SI 22))
8145 (clobber (reg:SI 1))
8146 (clobber (reg:SI 2))
8148 (use (const_int 1))])]
8152 [(parallel [(set (match_operand 0 "" "")
8153 (call (mem:SI (reg:SI 22))
8154 (match_operand 1 "" "")))
8155 (clobber (reg:SI 1))
8156 (clobber (reg:SI 2))
8157 (clobber (match_operand 2))
8159 (use (const_int 1))])]
8160 "!TARGET_64BIT && reload_completed"
8161 [(set (match_dup 2) (reg:SI 19))
8162 (parallel [(set (match_dup 0)
8163 (call (mem:SI (reg:SI 22))
8165 (clobber (reg:SI 1))
8166 (clobber (reg:SI 2))
8168 (use (const_int 1))])
8169 (set (reg:SI 19) (match_dup 2))]
8172 (define_insn "*call_val_reg_pic_post_reload"
8173 [(set (match_operand 0 "" "")
8174 (call (mem:SI (reg:SI 22))
8175 (match_operand 1 "" "i")))
8176 (clobber (reg:SI 1))
8177 (clobber (reg:SI 2))
8179 (use (const_int 1))]
8183 return pa_output_indirect_call (insn, gen_rtx_REG (word_mode, 22));
8185 [(set_attr "type" "dyncall")
8186 (set (attr "length")
8187 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8188 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
8190 ;; This pattern is split if it is necessary to save and restore the
8192 (define_insn "call_val_reg_64bit"
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 1))
8197 (clobber (reg:DI 2))
8198 (clobber (match_operand 3))
8201 (use (const_int 1))]
8205 ;; Split out the PIC register save and restore after reload. As the
8206 ;; split is done after reload, there are some situations in which we
8207 ;; unnecessarily save and restore %r4. This happens when there is a
8208 ;; single call and the PIC register is not used after the call.
8210 ;; The split has to be done since call_from_call_insn () can't handle
8211 ;; the pattern as is. Noreturn calls are special because they have to
8212 ;; terminate the basic block. The split has to contain more than one
8215 [(parallel [(set (match_operand 0 "" "")
8216 (call (mem:SI (match_operand:DI 1 "register_operand" ""))
8217 (match_operand 2 "" "")))
8218 (clobber (reg:DI 1))
8219 (clobber (reg:DI 2))
8220 (clobber (match_operand 3))
8223 (use (const_int 1))])]
8224 "TARGET_64BIT && reload_completed
8225 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8226 [(set (match_dup 3) (reg:DI 27))
8227 (parallel [(set (match_dup 0)
8228 (call (mem:SI (match_dup 1))
8230 (clobber (reg:DI 1))
8231 (clobber (reg:DI 2))
8234 (use (const_int 1))])]
8238 [(parallel [(set (match_operand 0 "" "")
8239 (call (mem:SI (match_operand:DI 1 "register_operand" ""))
8240 (match_operand 2 "" "")))
8241 (clobber (reg:DI 1))
8242 (clobber (reg:DI 2))
8243 (clobber (match_operand 3))
8246 (use (const_int 1))])]
8247 "TARGET_64BIT && reload_completed"
8248 [(set (match_dup 3) (reg:DI 27))
8249 (parallel [(set (match_dup 0)
8250 (call (mem:SI (match_dup 1))
8252 (clobber (reg:DI 1))
8253 (clobber (reg:DI 2))
8256 (use (const_int 1))])
8257 (set (reg:DI 27) (match_dup 3))]
8260 (define_insn "*call_val_reg_64bit_post_reload"
8261 [(set (match_operand 0 "" "")
8262 (call (mem:SI (match_operand:DI 1 "register_operand" "r"))
8263 (match_operand 2 "" "i")))
8264 (clobber (reg:DI 1))
8265 (clobber (reg:DI 2))
8268 (use (const_int 1))]
8272 return pa_output_indirect_call (insn, operands[1]);
8274 [(set_attr "type" "dyncall")
8275 (set (attr "length")
8276 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 12)]
8277 (symbol_ref "pa_attr_length_indirect_call (insn)")))])
8279 ;; Call subroutine returning any type.
8281 (define_expand "untyped_call"
8282 [(parallel [(call (match_operand 0 "" "")
8284 (match_operand 1 "" "")
8285 (match_operand 2 "" "")])]
8291 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
8293 for (i = 0; i < XVECLEN (operands[2], 0); i++)
8295 rtx set = XVECEXP (operands[2], 0, i);
8296 emit_move_insn (SET_DEST (set), SET_SRC (set));
8299 /* The optimizer does not know that the call sets the function value
8300 registers we stored in the result block. We avoid problems by
8301 claiming that all hard registers are used and clobbered at this
8303 emit_insn (gen_blockage ());
8308 (define_expand "sibcall"
8309 [(call (match_operand:SI 0 "" "")
8310 (match_operand 1 "" ""))]
8311 "!TARGET_PORTABLE_RUNTIME"
8315 rtx nb = operands[1];
8317 op = XEXP (operands[0], 0);
8321 if (!virtuals_instantiated)
8322 emit_move_insn (arg_pointer_rtx,
8323 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
8327 /* The loop pass can generate new libcalls after the virtual
8328 registers are instantiated when fpregs are disabled because
8329 the only method that we have for doing DImode multiplication
8330 is with a libcall. This could be trouble if we haven't
8331 allocated enough space for the outgoing arguments. */
8332 gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
8334 emit_move_insn (arg_pointer_rtx,
8335 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
8336 GEN_INT (STACK_POINTER_OFFSET + 64)));
8340 /* Indirect sibling calls are not allowed. */
8342 call_insn = gen_sibcall_internal_symref_64bit (op, operands[1]);
8344 call_insn = gen_sibcall_internal_symref (op, operands[1]);
8346 call_insn = emit_call_insn (call_insn);
8349 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
8351 /* We don't have to restore the PIC register. */
8353 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
8358 (define_insn "sibcall_internal_symref"
8359 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8360 (match_operand 1 "" "i"))
8361 (clobber (reg:SI 1))
8363 (use (const_int 0))]
8364 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
8367 pa_output_arg_descriptor (insn);
8368 return pa_output_call (insn, operands[0], 1);
8370 [(set_attr "type" "sibcall")
8371 (set (attr "length")
8372 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8373 (symbol_ref "pa_attr_length_call (insn, 1)")))])
8375 (define_insn "sibcall_internal_symref_64bit"
8376 [(call (mem:SI (match_operand 0 "call_operand_address" ""))
8377 (match_operand 1 "" "i"))
8378 (clobber (reg:DI 1))
8380 (use (const_int 0))]
8384 pa_output_arg_descriptor (insn);
8385 return pa_output_call (insn, operands[0], 1);
8387 [(set_attr "type" "sibcall")
8388 (set (attr "length")
8389 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8390 (symbol_ref "pa_attr_length_call (insn, 1)")))])
8392 (define_expand "sibcall_value"
8393 [(set (match_operand 0 "" "")
8394 (call (match_operand:SI 1 "" "")
8395 (match_operand 2 "" "")))]
8396 "!TARGET_PORTABLE_RUNTIME"
8400 rtx nb = operands[1];
8402 op = XEXP (operands[1], 0);
8406 if (!virtuals_instantiated)
8407 emit_move_insn (arg_pointer_rtx,
8408 gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
8412 /* The loop pass can generate new libcalls after the virtual
8413 registers are instantiated when fpregs are disabled because
8414 the only method that we have for doing DImode multiplication
8415 is with a libcall. This could be trouble if we haven't
8416 allocated enough space for the outgoing arguments. */
8417 gcc_assert (INTVAL (nb) <= crtl->outgoing_args_size);
8419 emit_move_insn (arg_pointer_rtx,
8420 gen_rtx_PLUS (word_mode, stack_pointer_rtx,
8421 GEN_INT (STACK_POINTER_OFFSET + 64)));
8425 /* Indirect sibling calls are not allowed. */
8428 = gen_sibcall_value_internal_symref_64bit (operands[0], op, operands[2]);
8431 = gen_sibcall_value_internal_symref (operands[0], op, operands[2]);
8433 call_insn = emit_call_insn (call_insn);
8436 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
8438 /* We don't have to restore the PIC register. */
8440 use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
8445 (define_insn "sibcall_value_internal_symref"
8446 [(set (match_operand 0 "" "")
8447 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8448 (match_operand 2 "" "i")))
8449 (clobber (reg:SI 1))
8451 (use (const_int 0))]
8452 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
8455 pa_output_arg_descriptor (insn);
8456 return pa_output_call (insn, operands[1], 1);
8458 [(set_attr "type" "sibcall")
8459 (set (attr "length")
8460 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8461 (symbol_ref "pa_attr_length_call (insn, 1)")))])
8463 (define_insn "sibcall_value_internal_symref_64bit"
8464 [(set (match_operand 0 "" "")
8465 (call (mem:SI (match_operand 1 "call_operand_address" ""))
8466 (match_operand 2 "" "i")))
8467 (clobber (reg:DI 1))
8469 (use (const_int 0))]
8473 pa_output_arg_descriptor (insn);
8474 return pa_output_call (insn, operands[1], 1);
8476 [(set_attr "type" "sibcall")
8477 (set (attr "length")
8478 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 8)]
8479 (symbol_ref "pa_attr_length_call (insn, 1)")))])
8485 [(set_attr "type" "move")
8486 (set_attr "length" "4")])
8488 ;; These are just placeholders so we know where branch tables
8490 (define_insn "begin_brtab"
8495 /* Only GAS actually supports this pseudo-op. */
8497 return \".begin_brtab\";
8501 [(set_attr "type" "move")
8502 (set_attr "length" "0")])
8504 (define_insn "end_brtab"
8509 /* Only GAS actually supports this pseudo-op. */
8511 return \".end_brtab\";
8515 [(set_attr "type" "move")
8516 (set_attr "length" "0")])
8518 ;;; EH does longjmp's from and within the data section. Thus,
8519 ;;; an interspace branch is required for the longjmp implementation.
8520 ;;; Registers r1 and r2 are used as scratch registers for the jump
8522 (define_expand "interspace_jump"
8524 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8525 (clobber (match_dup 1))])]
8529 operands[1] = gen_rtx_REG (word_mode, 2);
8533 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8534 (clobber (reg:SI 2))]
8535 "TARGET_PA_20 && !TARGET_64BIT"
8537 [(set_attr "type" "branch")
8538 (set_attr "length" "4")])
8541 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8542 (clobber (reg:SI 2))]
8543 "TARGET_NO_SPACE_REGS && !TARGET_64BIT"
8545 [(set_attr "type" "branch")
8546 (set_attr "length" "4")])
8549 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8550 (clobber (reg:SI 2))]
8552 "ldsid (%%sr0,%0),%%r2\;mtsp %%r2,%%sr0\;be%* 0(%%sr0,%0)"
8553 [(set_attr "type" "branch")
8554 (set_attr "length" "12")])
8557 [(set (pc) (match_operand 0 "pmode_register_operand" "a"))
8558 (clobber (reg:DI 2))]
8561 [(set_attr "type" "branch")
8562 (set_attr "length" "4")])
8564 (define_expand "builtin_longjmp"
8565 [(unspec_volatile [(match_operand 0 "register_operand" "r")] UNSPECV_LONGJMP)]
8569 /* The elements of the buffer are, in order: */
8570 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
8571 rtx lab = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0],
8572 POINTER_SIZE / BITS_PER_UNIT));
8573 rtx stack = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0],
8574 (POINTER_SIZE * 2) / BITS_PER_UNIT));
8575 rtx pv = gen_rtx_REG (Pmode, 1);
8577 emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode)));
8578 emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
8580 /* Restore the frame pointer. The virtual_stack_vars_rtx is saved
8581 instead of the hard_frame_pointer_rtx in the save area. We need
8582 to adjust for the offset between these two values. */
8583 if (GET_CODE (fp) != REG)
8584 fp = force_reg (Pmode, fp);
8585 emit_move_insn (hard_frame_pointer_rtx, plus_constant (Pmode, fp, -8));
8587 /* This bit is the same as expand_builtin_longjmp. */
8588 emit_stack_restore (SAVE_NONLOCAL, stack);
8589 emit_use (hard_frame_pointer_rtx);
8590 emit_use (stack_pointer_rtx);
8592 /* Load the label we are jumping through into r1 so that we know
8593 where to look for it when we get back to setjmp's function for
8594 restoring the gp. */
8595 emit_move_insn (pv, lab);
8597 /* Prevent the insns above from being scheduled into the delay slot
8598 of the interspace jump because the space register could change. */
8599 emit_insn (gen_blockage ());
8601 emit_jump_insn (gen_interspace_jump (pv));
8606 ;;; Operands 2 and 3 are assumed to be CONST_INTs.
8607 (define_expand "extzvsi"
8608 [(set (match_operand:SI 0 "register_operand" "")
8609 (zero_extract:SI (match_operand:SI 1 "register_operand" "")
8610 (match_operand:SI 2 "uint5_operand" "")
8611 (match_operand:SI 3 "uint5_operand" "")))]
8615 unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8616 unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8618 /* PA extraction insns don't support zero length bitfields or fields
8619 extending beyond the left or right-most bits. Also, the predicate
8620 rejects lengths equal to a word as they are better handled by
8621 the move patterns. */
8622 if (len == 0 || pos + len > 32)
8625 /* From mips.md: extract_bit_field doesn't verify that our source
8626 matches the predicate, so check it again here. */
8627 if (!register_operand (operands[1], VOIDmode))
8630 emit_insn (gen_extzv_32 (operands[0], operands[1],
8631 operands[2], operands[3]));
8635 (define_insn "extzv_32"
8636 [(set (match_operand:SI 0 "register_operand" "=r")
8637 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
8638 (match_operand:SI 2 "uint5_operand" "")
8639 (match_operand:SI 3 "uint5_operand" "")))]
8640 "UINTVAL (operands[2]) > 0
8641 && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 32"
8642 "{extru|extrw,u} %1,%3+%2-1,%2,%0"
8643 [(set_attr "type" "shift")
8644 (set_attr "length" "4")])
8647 [(set (match_operand:SI 0 "register_operand" "=r")
8648 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
8650 (match_operand:SI 2 "register_operand" "q")))]
8652 "{vextru %1,1,%0|extrw,u %1,%%sar,1,%0}"
8653 [(set_attr "type" "shift")
8654 (set_attr "length" "4")])
8656 (define_expand "extzvdi"
8657 [(set (match_operand:DI 0 "register_operand" "")
8658 (zero_extract:DI (match_operand:DI 1 "register_operand" "")
8659 (match_operand:DI 2 "uint6_operand" "")
8660 (match_operand:DI 3 "uint6_operand" "")))]
8664 unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8665 unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8667 /* PA extraction insns don't support zero length bitfields or fields
8668 extending beyond the left or right-most bits. Also, the predicate
8669 rejects lengths equal to a doubleword as they are better handled by
8670 the move patterns. */
8671 if (len == 0 || pos + len > 64)
8674 /* From mips.md: extract_bit_field doesn't verify that our source
8675 matches the predicate, so check it again here. */
8676 if (!register_operand (operands[1], VOIDmode))
8679 emit_insn (gen_extzv_64 (operands[0], operands[1],
8680 operands[2], operands[3]));
8684 (define_insn "extzv_64"
8685 [(set (match_operand:DI 0 "register_operand" "=r")
8686 (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
8687 (match_operand:DI 2 "uint6_operand" "")
8688 (match_operand:DI 3 "uint6_operand" "")))]
8690 && UINTVAL (operands[2]) > 0
8691 && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 64"
8692 "extrd,u %1,%3+%2-1,%2,%0"
8693 [(set_attr "type" "shift")
8694 (set_attr "length" "4")])
8697 [(set (match_operand:DI 0 "register_operand" "=r")
8698 (zero_extract:DI (match_operand:DI 1 "register_operand" "r")
8700 (match_operand:DI 2 "register_operand" "q")))]
8702 "extrd,u %1,%%sar,1,%0"
8703 [(set_attr "type" "shift")
8704 (set_attr "length" "4")])
8706 ;;; Operands 2 and 3 are assumed to be CONST_INTs.
8707 (define_expand "extvsi"
8708 [(set (match_operand:SI 0 "register_operand" "")
8709 (sign_extract:SI (match_operand:SI 1 "register_operand" "")
8710 (match_operand:SI 2 "uint5_operand" "")
8711 (match_operand:SI 3 "uint5_operand" "")))]
8715 unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8716 unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8718 /* PA extraction insns don't support zero length bitfields or fields
8719 extending beyond the left or right-most bits. Also, the predicate
8720 rejects lengths equal to a word as they are better handled by
8721 the move patterns. */
8722 if (len == 0 || pos + len > 32)
8725 /* From mips.md: extract_bit_field doesn't verify that our source
8726 matches the predicate, so check it again here. */
8727 if (!register_operand (operands[1], VOIDmode))
8730 emit_insn (gen_extv_32 (operands[0], operands[1],
8731 operands[2], operands[3]));
8735 (define_insn "extv_32"
8736 [(set (match_operand:SI 0 "register_operand" "=r")
8737 (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
8738 (match_operand:SI 2 "uint5_operand" "")
8739 (match_operand:SI 3 "uint5_operand" "")))]
8740 "UINTVAL (operands[2]) > 0
8741 && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 32"
8742 "{extrs|extrw,s} %1,%3+%2-1,%2,%0"
8743 [(set_attr "type" "shift")
8744 (set_attr "length" "4")])
8747 [(set (match_operand:SI 0 "register_operand" "=r")
8748 (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
8750 (match_operand:SI 2 "register_operand" "q")))]
8752 "{vextrs %1,1,%0|extrw,s %1,%%sar,1,%0}"
8753 [(set_attr "type" "shift")
8754 (set_attr "length" "4")])
8756 (define_expand "extvdi"
8757 [(set (match_operand:DI 0 "register_operand" "")
8758 (sign_extract:DI (match_operand:DI 1 "register_operand" "")
8759 (match_operand:DI 2 "uint6_operand" "")
8760 (match_operand:DI 3 "uint6_operand" "")))]
8764 unsigned HOST_WIDE_INT len = UINTVAL (operands[2]);
8765 unsigned HOST_WIDE_INT pos = UINTVAL (operands[3]);
8767 /* PA extraction insns don't support zero length bitfields or fields
8768 extending beyond the left or right-most bits. Also, the predicate
8769 rejects lengths equal to a doubleword as they are better handled by
8770 the move patterns. */
8771 if (len == 0 || pos + len > 64)
8774 /* From mips.md: extract_bit_field doesn't verify that our source
8775 matches the predicate, so check it again here. */
8776 if (!register_operand (operands[1], VOIDmode))
8779 emit_insn (gen_extv_64 (operands[0], operands[1],
8780 operands[2], operands[3]));
8784 (define_insn "extv_64"
8785 [(set (match_operand:DI 0 "register_operand" "=r")
8786 (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
8787 (match_operand:DI 2 "uint6_operand" "")
8788 (match_operand:DI 3 "uint6_operand" "")))]
8790 && UINTVAL (operands[2]) > 0
8791 && UINTVAL (operands[2]) + UINTVAL (operands[3]) <= 64"
8792 "extrd,s %1,%3+%2-1,%2,%0"
8793 [(set_attr "type" "shift")
8794 (set_attr "length" "4")])
8797 [(set (match_operand:DI 0 "register_operand" "=r")
8798 (sign_extract:DI (match_operand:DI 1 "register_operand" "r")
8800 (match_operand:DI 2 "register_operand" "q")))]
8802 "extrd,s %1,%%sar,1,%0"
8803 [(set_attr "type" "shift")
8804 (set_attr "length" "4")])
8806 ;;; Operands 1 and 2 are assumed to be CONST_INTs.
8807 (define_expand "insvsi"
8808 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "")
8809 (match_operand:SI 1 "uint5_operand" "")
8810 (match_operand:SI 2 "uint5_operand" ""))
8811 (match_operand:SI 3 "arith5_operand" ""))]
8815 unsigned HOST_WIDE_INT len = UINTVAL (operands[1]);
8816 unsigned HOST_WIDE_INT pos = UINTVAL (operands[2]);
8818 /* PA insertion insns don't support zero length bitfields or fields
8819 extending beyond the left or right-most bits. Also, the predicate
8820 rejects lengths equal to a word as they are better handled by
8821 the move patterns. */
8822 if (len <= 0 || pos + len > 32)
8825 /* From mips.md: insert_bit_field doesn't verify that our destination
8826 matches the predicate, so check it again here. */
8827 if (!register_operand (operands[0], VOIDmode))
8830 emit_insn (gen_insv_32 (operands[0], operands[1],
8831 operands[2], operands[3]));
8835 (define_insn "insv_32"
8836 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r,r")
8837 (match_operand:SI 1 "uint5_operand" "")
8838 (match_operand:SI 2 "uint5_operand" ""))
8839 (match_operand:SI 3 "arith5_operand" "r,L"))]
8840 "UINTVAL (operands[1]) > 0
8841 && UINTVAL (operands[1]) + UINTVAL (operands[2]) <= 32"
8843 {dep|depw} %3,%2+%1-1,%1,%0
8844 {depi|depwi} %3,%2+%1-1,%1,%0"
8845 [(set_attr "type" "shift,shift")
8846 (set_attr "length" "4,4")])
8848 ;; Optimize insertion of const_int values of type 1...1xxxx.
8850 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
8851 (match_operand:SI 1 "uint5_operand" "")
8852 (match_operand:SI 2 "uint5_operand" ""))
8853 (match_operand:SI 3 "const_int_operand" ""))]
8854 "(INTVAL (operands[3]) & 0x10) != 0 &&
8855 (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
8858 operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
8859 return \"{depi|depwi} %3,%2+%1-1,%1,%0\";
8861 [(set_attr "type" "shift")
8862 (set_attr "length" "4")])
8864 (define_expand "insvdi"
8865 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
8866 (match_operand:DI 1 "uint6_operand" "")
8867 (match_operand:DI 2 "uint6_operand" ""))
8868 (match_operand:DI 3 "arith5_operand" ""))]
8872 unsigned HOST_WIDE_INT len = UINTVAL (operands[1]);
8873 unsigned HOST_WIDE_INT pos = UINTVAL (operands[2]);
8875 /* PA insertion insns don't support zero length bitfields or fields
8876 extending beyond the left or right-most bits. Also, the predicate
8877 rejects lengths equal to a doubleword as they are better handled by
8878 the move patterns. */
8879 if (len <= 0 || pos + len > 64)
8882 /* From mips.md: insert_bit_field doesn't verify that our destination
8883 matches the predicate, so check it again here. */
8884 if (!register_operand (operands[0], VOIDmode))
8887 emit_insn (gen_insv_64 (operands[0], operands[1],
8888 operands[2], operands[3]));
8892 (define_insn "insv_64"
8893 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r,r")
8894 (match_operand:DI 1 "uint6_operand" "")
8895 (match_operand:DI 2 "uint6_operand" ""))
8896 (match_operand:DI 3 "arith5_operand" "r,L"))]
8898 && UINTVAL (operands[1]) > 0
8899 && UINTVAL (operands[1]) + UINTVAL (operands[2]) <= 64"
8901 depd %3,%2+%1-1,%1,%0
8902 depdi %3,%2+%1-1,%1,%0"
8903 [(set_attr "type" "shift,shift")
8904 (set_attr "length" "4,4")])
8906 ;; Optimize insertion of const_int values of type 1...1xxxx.
8908 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+r")
8909 (match_operand:DI 1 "uint6_operand" "")
8910 (match_operand:DI 2 "uint6_operand" ""))
8911 (match_operand:DI 3 "const_int_operand" ""))]
8912 "(INTVAL (operands[3]) & 0x10) != 0
8914 && (~INTVAL (operands[3]) & ((1L << INTVAL (operands[1])) - 1) & ~0xf) == 0"
8917 operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
8918 return \"depdi %3,%2+%1-1,%1,%0\";
8920 [(set_attr "type" "shift")
8921 (set_attr "length" "4")])
8924 [(set (match_operand:DI 0 "register_operand" "=r")
8925 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
8928 "depd,z %1,31,32,%0"
8929 [(set_attr "type" "shift")
8930 (set_attr "length" "4")])
8932 ;; This insn is used for some loop tests, typically loops reversed when
8933 ;; strength reduction is used. It is actually created when the instruction
8934 ;; combination phase combines the special loop test. Since this insn
8935 ;; is both a jump insn and has an output, it must deal with its own
8936 ;; reloads, hence the `m' constraints. The `!' constraints direct reload
8937 ;; to not choose the register alternatives in the event a reload is needed.
8938 (define_insn "decrement_and_branch_until_zero"
8941 (match_operator 2 "comparison_operator"
8943 (match_operand:SI 0 "reg_before_reload_operand" "+!r,!*f,*m")
8944 (match_operand:SI 1 "int5_operand" "L,L,L"))
8946 (label_ref (match_operand 3 "" ""))
8949 (plus:SI (match_dup 0) (match_dup 1)))
8950 (clobber (match_scratch:SI 4 "=X,r,r"))]
8952 "* return pa_output_dbra (operands, insn, which_alternative); "
8953 ;; Do not expect to understand this the first time through.
8954 [(set_attr "type" "cbranch,multi,multi")
8955 (set (attr "length")
8956 (if_then_else (eq_attr "alternative" "0")
8957 ;; Loop counter in register case
8958 ;; Short branch has length of 4
8959 ;; Long branch has length of 8, 20, 24 or 28
8960 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8961 (const_int MAX_12BIT_OFFSET))
8963 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8964 (const_int MAX_17BIT_OFFSET))
8966 (match_test "TARGET_PORTABLE_RUNTIME")
8968 (not (match_test "flag_pic"))
8972 ;; Loop counter in FP reg case.
8973 ;; Extra goo to deal with additional reload insns.
8974 (if_then_else (eq_attr "alternative" "1")
8975 (if_then_else (lt (match_dup 3) (pc))
8976 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 24))))
8977 (const_int MAX_12BIT_OFFSET))
8979 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 24))))
8980 (const_int MAX_17BIT_OFFSET))
8982 (match_test "TARGET_PORTABLE_RUNTIME")
8984 (not (match_test "flag_pic"))
8987 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8988 (const_int MAX_12BIT_OFFSET))
8990 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
8991 (const_int MAX_17BIT_OFFSET))
8993 (match_test "TARGET_PORTABLE_RUNTIME")
8995 (not (match_test "flag_pic"))
8999 ;; Loop counter in memory case.
9000 ;; Extra goo to deal with additional reload insns.
9001 (if_then_else (lt (match_dup 3) (pc))
9002 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9003 (const_int MAX_12BIT_OFFSET))
9005 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9006 (const_int MAX_17BIT_OFFSET))
9008 (match_test "TARGET_PORTABLE_RUNTIME")
9010 (not (match_test "flag_pic"))
9013 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9014 (const_int MAX_12BIT_OFFSET))
9016 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9017 (const_int MAX_17BIT_OFFSET))
9019 (match_test "TARGET_PORTABLE_RUNTIME")
9021 (not (match_test "flag_pic"))
9023 (const_int 36))))))])
9028 (match_operator 2 "movb_comparison_operator"
9029 [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
9030 (label_ref (match_operand 3 "" ""))
9032 (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q")
9035 "* return pa_output_movb (operands, insn, which_alternative, 0); "
9036 ;; Do not expect to understand this the first time through.
9037 [(set_attr "type" "cbranch,multi,multi,multi")
9038 (set (attr "length")
9039 (if_then_else (eq_attr "alternative" "0")
9040 ;; Loop counter in register case
9041 ;; Short branch has length of 4
9042 ;; Long branch has length of 8, 20, 24 or 28
9043 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9044 (const_int MAX_12BIT_OFFSET))
9046 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9047 (const_int MAX_17BIT_OFFSET))
9049 (match_test "TARGET_PORTABLE_RUNTIME")
9051 (not (match_test "flag_pic"))
9055 ;; Loop counter in FP reg case.
9056 ;; Extra goo to deal with additional reload insns.
9057 (if_then_else (eq_attr "alternative" "1")
9058 (if_then_else (lt (match_dup 3) (pc))
9059 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9060 (const_int MAX_12BIT_OFFSET))
9062 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9063 (const_int MAX_17BIT_OFFSET))
9065 (match_test "TARGET_PORTABLE_RUNTIME")
9067 (not (match_test "flag_pic"))
9070 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9071 (const_int MAX_12BIT_OFFSET))
9073 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9074 (const_int MAX_17BIT_OFFSET))
9076 (match_test "TARGET_PORTABLE_RUNTIME")
9078 (not (match_test "flag_pic"))
9082 ;; Loop counter in memory or sar case.
9083 ;; Extra goo to deal with additional reload insns.
9084 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9085 (const_int MAX_12BIT_OFFSET))
9087 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9088 (const_int MAX_17BIT_OFFSET))
9090 (match_test "TARGET_PORTABLE_RUNTIME")
9092 (not (match_test "flag_pic"))
9094 (const_int 32)))))])
9096 ;; Handle negated branch.
9100 (match_operator 2 "movb_comparison_operator"
9101 [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
9103 (label_ref (match_operand 3 "" ""))))
9104 (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q")
9107 "* return pa_output_movb (operands, insn, which_alternative, 1); "
9108 ;; Do not expect to understand this the first time through.
9109 [(set_attr "type" "cbranch,multi,multi,multi")
9110 (set (attr "length")
9111 (if_then_else (eq_attr "alternative" "0")
9112 ;; Loop counter in register case
9113 ;; Short branch has length of 4
9114 ;; Long branch has length of 8
9115 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9116 (const_int MAX_12BIT_OFFSET))
9118 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9119 (const_int MAX_17BIT_OFFSET))
9121 (match_test "TARGET_PORTABLE_RUNTIME")
9123 (not (match_test "flag_pic"))
9127 ;; Loop counter in FP reg case.
9128 ;; Extra goo to deal with additional reload insns.
9129 (if_then_else (eq_attr "alternative" "1")
9130 (if_then_else (lt (match_dup 3) (pc))
9131 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9132 (const_int MAX_12BIT_OFFSET))
9134 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
9135 (const_int MAX_17BIT_OFFSET))
9137 (match_test "TARGET_PORTABLE_RUNTIME")
9139 (not (match_test "flag_pic"))
9142 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9143 (const_int MAX_12BIT_OFFSET))
9145 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9146 (const_int MAX_17BIT_OFFSET))
9148 (match_test "TARGET_PORTABLE_RUNTIME")
9150 (not (match_test "flag_pic"))
9154 ;; Loop counter in memory or SAR case.
9155 ;; Extra goo to deal with additional reload insns.
9156 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9157 (const_int MAX_12BIT_OFFSET))
9159 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9160 (const_int MAX_17BIT_OFFSET))
9162 (match_test "TARGET_PORTABLE_RUNTIME")
9164 (not (match_test "flag_pic"))
9166 (const_int 32)))))])
9169 [(set (pc) (label_ref (match_operand 3 "" "" )))
9170 (set (match_operand:SI 0 "ireg_operand" "=r")
9171 (plus:SI (match_operand:SI 1 "ireg_operand" "r")
9172 (match_operand:SI 2 "ireg_or_int5_operand" "rL")))]
9173 "(reload_completed && operands[0] == operands[1]) || operands[0] == operands[2]"
9176 return pa_output_parallel_addb (operands, insn);
9178 [(set_attr "type" "parallel_branch")
9179 (set (attr "length")
9180 (cond [(lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9181 (const_int MAX_12BIT_OFFSET))
9183 (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
9184 (const_int MAX_17BIT_OFFSET))
9186 (match_test "TARGET_PORTABLE_RUNTIME")
9188 (not (match_test "flag_pic"))
9193 [(set (pc) (label_ref (match_operand 2 "" "" )))
9194 (set (match_operand:SF 0 "ireg_operand" "=r")
9195 (match_operand:SF 1 "ireg_or_int5_operand" "rL"))]
9199 return pa_output_parallel_movb (operands, insn);
9201 [(set_attr "type" "parallel_branch")
9202 (set (attr "length")
9203 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9204 (const_int MAX_12BIT_OFFSET))
9206 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9207 (const_int MAX_17BIT_OFFSET))
9209 (match_test "TARGET_PORTABLE_RUNTIME")
9211 (not (match_test "flag_pic"))
9216 [(set (pc) (label_ref (match_operand 2 "" "" )))
9217 (set (match_operand:SI 0 "ireg_operand" "=r")
9218 (match_operand:SI 1 "ireg_or_int5_operand" "rL"))]
9222 return pa_output_parallel_movb (operands, insn);
9224 [(set_attr "type" "parallel_branch")
9225 (set (attr "length")
9226 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9227 (const_int MAX_12BIT_OFFSET))
9229 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9230 (const_int MAX_17BIT_OFFSET))
9232 (match_test "TARGET_PORTABLE_RUNTIME")
9234 (not (match_test "flag_pic"))
9239 [(set (pc) (label_ref (match_operand 2 "" "" )))
9240 (set (match_operand:HI 0 "ireg_operand" "=r")
9241 (match_operand:HI 1 "ireg_or_int5_operand" "rL"))]
9245 return pa_output_parallel_movb (operands, insn);
9247 [(set_attr "type" "parallel_branch")
9248 (set (attr "length")
9249 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9250 (const_int MAX_12BIT_OFFSET))
9252 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9253 (const_int MAX_17BIT_OFFSET))
9255 (match_test "TARGET_PORTABLE_RUNTIME")
9257 (not (match_test "flag_pic"))
9262 [(set (pc) (label_ref (match_operand 2 "" "" )))
9263 (set (match_operand:QI 0 "ireg_operand" "=r")
9264 (match_operand:QI 1 "ireg_or_int5_operand" "rL"))]
9268 return pa_output_parallel_movb (operands, insn);
9270 [(set_attr "type" "parallel_branch")
9271 (set (attr "length")
9272 (cond [(lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9273 (const_int MAX_12BIT_OFFSET))
9275 (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
9276 (const_int MAX_17BIT_OFFSET))
9278 (match_test "TARGET_PORTABLE_RUNTIME")
9280 (not (match_test "flag_pic"))
9285 [(set (match_operand 0 "register_operand" "=f")
9286 (mult (match_operand 1 "register_operand" "f")
9287 (match_operand 2 "register_operand" "f")))
9288 (set (match_operand 3 "register_operand" "+f")
9289 (plus (match_operand 4 "register_operand" "f")
9290 (match_operand 5 "register_operand" "f")))]
9291 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9292 && reload_completed && pa_fmpyaddoperands (operands)"
9295 if (GET_MODE (operands[0]) == DFmode)
9297 if (rtx_equal_p (operands[3], operands[5]))
9298 return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
9300 return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
9304 if (rtx_equal_p (operands[3], operands[5]))
9305 return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
9307 return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
9310 [(set_attr "type" "fpalu")
9311 (set_attr "length" "4")])
9314 [(set (match_operand 3 "register_operand" "+f")
9315 (plus (match_operand 4 "register_operand" "f")
9316 (match_operand 5 "register_operand" "f")))
9317 (set (match_operand 0 "register_operand" "=f")
9318 (mult (match_operand 1 "register_operand" "f")
9319 (match_operand 2 "register_operand" "f")))]
9320 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9321 && reload_completed && pa_fmpyaddoperands (operands)"
9324 if (GET_MODE (operands[0]) == DFmode)
9326 if (rtx_equal_p (operands[3], operands[5]))
9327 return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
9329 return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
9333 if (rtx_equal_p (operands[3], operands[5]))
9334 return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
9336 return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
9339 [(set_attr "type" "fpalu")
9340 (set_attr "length" "4")])
9343 [(set (match_operand 0 "register_operand" "=f")
9344 (mult (match_operand 1 "register_operand" "f")
9345 (match_operand 2 "register_operand" "f")))
9346 (set (match_operand 3 "register_operand" "+f")
9347 (minus (match_operand 4 "register_operand" "f")
9348 (match_operand 5 "register_operand" "f")))]
9349 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9350 && reload_completed && pa_fmpysuboperands (operands)"
9353 if (GET_MODE (operands[0]) == DFmode)
9354 return \"fmpysub,dbl %1,%2,%0,%5,%3\";
9356 return \"fmpysub,sgl %1,%2,%0,%5,%3\";
9358 [(set_attr "type" "fpalu")
9359 (set_attr "length" "4")])
9362 [(set (match_operand 3 "register_operand" "+f")
9363 (minus (match_operand 4 "register_operand" "f")
9364 (match_operand 5 "register_operand" "f")))
9365 (set (match_operand 0 "register_operand" "=f")
9366 (mult (match_operand 1 "register_operand" "f")
9367 (match_operand 2 "register_operand" "f")))]
9368 "TARGET_PA_11 && ! TARGET_SOFT_FLOAT
9369 && reload_completed && pa_fmpysuboperands (operands)"
9372 if (GET_MODE (operands[0]) == DFmode)
9373 return \"fmpysub,dbl %1,%2,%0,%5,%3\";
9375 return \"fmpysub,sgl %1,%2,%0,%5,%3\";
9377 [(set_attr "type" "fpalu")
9378 (set_attr "length" "4")])
9380 ;; The following two patterns are used by the trampoline code for nested
9381 ;; functions. They flush the I and D cache lines from the start address
9382 ;; (operand0) to the end address (operand1). No lines are flushed if the
9383 ;; end address is less than the start address (unsigned).
9385 ;; Because the range of memory flushed is variable and the size of a MEM
9386 ;; can only be a CONST_INT, the patterns specify that they perform an
9387 ;; unspecified volatile operation on all memory.
9389 ;; The address range for an icache flush must lie within a single
9390 ;; space on targets with non-equivalent space registers.
9392 ;; Operand 0 contains the start address.
9393 ;; Operand 1 contains the end address.
9394 ;; Operand 2 contains the line length to use.
9395 (define_insn "dcacheflush<P:mode>"
9397 (unspec_volatile [(mem:BLK (scratch))] UNSPECV_DCACHE)
9398 (use (match_operand 0 "pmode_register_operand" "r"))
9399 (use (match_operand 1 "pmode_register_operand" "r"))
9400 (use (match_operand 2 "pmode_register_operand" "r"))
9401 (clobber (match_scratch:P 3 "=&0"))]
9403 "cmpb,<dwc><<=,n %3,%1,.\;fdc,m %2(%3)\;sync"
9404 [(set_attr "type" "multi")
9405 (set_attr "length" "12")])
9407 (define_insn "icacheflush<P:mode>"
9409 (unspec_volatile [(mem:BLK (scratch))] UNSPECV_ICACHE)
9410 (use (match_operand 0 "pmode_register_operand" "r"))
9411 (use (match_operand 1 "pmode_register_operand" "r"))
9412 (use (match_operand 2 "pmode_register_operand" "r"))
9413 (clobber (match_operand 3 "pmode_register_operand" "=&r"))
9414 (clobber (match_operand 4 "pmode_register_operand" "=&r"))
9415 (clobber (match_scratch:P 5 "=&0"))]
9417 "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"
9418 [(set_attr "type" "multi")
9419 (set_attr "length" "52")])
9421 ;; An out-of-line prologue.
9422 (define_insn "outline_prologue_call"
9423 [(unspec_volatile [(const_int 0)] UNSPECV_OPC)
9424 (clobber (reg:SI 31))
9425 (clobber (reg:SI 22))
9426 (clobber (reg:SI 21))
9427 (clobber (reg:SI 20))
9428 (clobber (reg:SI 19))
9429 (clobber (reg:SI 1))]
9434 /* We need two different versions depending on whether or not we
9435 need a frame pointer. Also note that we return to the instruction
9436 immediately after the branch rather than two instructions after the
9437 break as normally is the case. */
9438 if (frame_pointer_needed)
9440 /* Must import the magic millicode routine(s). */
9441 output_asm_insn (\".IMPORT __outline_prologue_fp,MILLICODE\", NULL);
9443 if (TARGET_PORTABLE_RUNTIME)
9445 output_asm_insn (\"ldil L'__outline_prologue_fp,%%r31\", NULL);
9446 output_asm_insn (\"ble,n R'__outline_prologue_fp(%%sr0,%%r31)\",
9450 output_asm_insn (\"{bl|b,l},n __outline_prologue_fp,%%r31\", NULL);
9454 /* Must import the magic millicode routine(s). */
9455 output_asm_insn (\".IMPORT __outline_prologue,MILLICODE\", NULL);
9457 if (TARGET_PORTABLE_RUNTIME)
9459 output_asm_insn (\"ldil L'__outline_prologue,%%r31\", NULL);
9460 output_asm_insn (\"ble,n R'__outline_prologue(%%sr0,%%r31)\", NULL);
9463 output_asm_insn (\"{bl|b,l},n __outline_prologue,%%r31\", NULL);
9467 [(set_attr "type" "multi")
9468 (set_attr "length" "8")])
9470 ;; An out-of-line epilogue.
9471 (define_insn "outline_epilogue_call"
9472 [(unspec_volatile [(const_int 1)] UNSPECV_OEC)
9475 (clobber (reg:SI 31))
9476 (clobber (reg:SI 22))
9477 (clobber (reg:SI 21))
9478 (clobber (reg:SI 20))
9479 (clobber (reg:SI 19))
9480 (clobber (reg:SI 2))
9481 (clobber (reg:SI 1))]
9486 /* We need two different versions depending on whether or not we
9487 need a frame pointer. Also note that we return to the instruction
9488 immediately after the branch rather than two instructions after the
9489 break as normally is the case. */
9490 if (frame_pointer_needed)
9492 /* Must import the magic millicode routine. */
9493 output_asm_insn (\".IMPORT __outline_epilogue_fp,MILLICODE\", NULL);
9495 /* The out-of-line prologue will make sure we return to the right
9497 if (TARGET_PORTABLE_RUNTIME)
9499 output_asm_insn (\"ldil L'__outline_epilogue_fp,%%r31\", NULL);
9500 output_asm_insn (\"ble,n R'__outline_epilogue_fp(%%sr0,%%r31)\",
9504 output_asm_insn (\"{bl|b,l},n __outline_epilogue_fp,%%r31\", NULL);
9508 /* Must import the magic millicode routine. */
9509 output_asm_insn (\".IMPORT __outline_epilogue,MILLICODE\", NULL);
9511 /* The out-of-line prologue will make sure we return to the right
9513 if (TARGET_PORTABLE_RUNTIME)
9515 output_asm_insn (\"ldil L'__outline_epilogue,%%r31\", NULL);
9516 output_asm_insn (\"ble,n R'__outline_epilogue(%%sr0,%%r31)\", NULL);
9519 output_asm_insn (\"{bl|b,l},n __outline_epilogue,%%r31\", NULL);
9523 [(set_attr "type" "multi")
9524 (set_attr "length" "8")])
9526 ;; Given a function pointer, canonicalize it so it can be
9527 ;; reliably compared to another function pointer. */
9528 (define_expand "canonicalize_funcptr_for_compare"
9529 [(set (reg:SI 26) (match_operand:SI 1 "register_operand" ""))
9530 (parallel [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] UNSPEC_CFFC))
9531 (clobber (match_dup 2))
9532 (clobber (reg:SI 26))
9533 (clobber (reg:SI 22))
9534 (clobber (reg:SI 31))])
9535 (set (match_operand:SI 0 "register_operand" "")
9537 "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
9542 rtx canonicalize_funcptr_for_compare_libfunc
9543 = init_one_libfunc (CANONICALIZE_FUNCPTR_FOR_COMPARE_LIBCALL);
9545 emit_library_call_value (canonicalize_funcptr_for_compare_libfunc,
9546 operands[0], LCT_NORMAL, Pmode,
9547 1, operands[1], Pmode);
9551 operands[2] = gen_reg_rtx (SImode);
9552 if (GET_CODE (operands[1]) != REG)
9554 rtx tmp = gen_reg_rtx (Pmode);
9555 emit_move_insn (tmp, operands[1]);
9560 (define_insn "*$$sh_func_adrs"
9561 [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] UNSPEC_CFFC))
9562 (clobber (match_operand:SI 0 "register_operand" "=a"))
9563 (clobber (reg:SI 26))
9564 (clobber (reg:SI 22))
9565 (clobber (reg:SI 31))]
9569 int length = get_attr_length (insn);
9572 xoperands[0] = GEN_INT (length - 8);
9573 xoperands[1] = GEN_INT (length - 16);
9575 /* Must import the magic millicode routine. */
9576 output_asm_insn (\".IMPORT $$sh_func_adrs,MILLICODE\", NULL);
9578 /* This is absolutely amazing.
9580 First, copy our input parameter into %r29 just in case we don't
9581 need to call $$sh_func_adrs. */
9582 output_asm_insn (\"copy %%r26,%%r29\", NULL);
9583 output_asm_insn (\"{extru|extrw,u} %%r26,31,2,%%r31\", NULL);
9585 /* Next, examine the low two bits in %r26, if they aren't 0x2, then
9586 we use %r26 unchanged. */
9587 output_asm_insn (\"{comib|cmpib},<>,n 2,%%r31,.+%0\", xoperands);
9588 output_asm_insn (\"ldi 4096,%%r31\", NULL);
9590 /* Next, compare %r26 with 4096, if %r26 is less than or equal to
9591 4096, then again we use %r26 unchanged. */
9592 output_asm_insn (\"{comb|cmpb},<<,n %%r26,%%r31,.+%1\", xoperands);
9594 /* Finally, call $$sh_func_adrs to extract the function's real add24. */
9595 return pa_output_millicode_call (insn,
9596 gen_rtx_SYMBOL_REF (SImode,
9597 \"$$sh_func_adrs\"));
9599 [(set_attr "type" "sh_func_adrs")
9600 (set (attr "length")
9601 (cond [(and (const_int 0) (eq (const_int 0) (pc))) (const_int 28)]
9602 (plus (symbol_ref "pa_attr_length_millicode_call (insn)")
9605 ;; On the PA, the PIC register is call clobbered, so it must
9606 ;; be saved & restored around calls by the caller. If the call
9607 ;; doesn't return normally (nonlocal goto, or an exception is
9608 ;; thrown), then the code at the exception handler label must
9609 ;; restore the PIC register.
9610 (define_expand "exception_receiver"
9615 /* On the 64-bit port, we need a blockage because there is
9616 confusion regarding the dependence of the restore on the
9617 frame pointer. As a result, the frame pointer and pic
9618 register restores sometimes are interchanged erroneously. */
9620 emit_insn (gen_blockage ());
9621 /* Restore the PIC register using hppa_pic_save_rtx (). The
9622 PIC register is not saved in the frame in 64-bit ABI. */
9623 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
9624 emit_insn (gen_blockage ());
9628 (define_expand "builtin_setjmp_receiver"
9629 [(label_ref (match_operand 0 "" ""))]
9634 emit_insn (gen_blockage ());
9635 /* Restore the PIC register. Hopefully, this will always be from
9636 a stack slot. The only registers that are valid after a
9637 builtin_longjmp are the stack and frame pointers. */
9638 emit_move_insn (pic_offset_table_rtx, hppa_pic_save_rtx ());
9639 emit_insn (gen_blockage ());
9643 ;; Allocate new stack space and update the saved stack pointer in the
9644 ;; frame marker. The HP C compilers also copy additional words in the
9645 ;; frame marker. The 64-bit compiler copies words at -48, -32 and -24.
9646 ;; The 32-bit compiler copies the word at -16 (Static Link). We
9647 ;; currently don't copy these values.
9649 ;; Since the copy of the frame marker can't be done atomically, I
9650 ;; suspect that using it for unwind purposes may be somewhat unreliable.
9651 ;; The HP compilers appear to raise the stack and copy the frame
9652 ;; marker in a strict instruction sequence. This suggests that the
9653 ;; unwind library may check for an alloca sequence when ALLOCA_FRAME
9654 ;; is set in the callinfo data. We currently don't set ALLOCA_FRAME
9655 ;; as GAS doesn't support it, or try to keep the instructions emitted
9656 ;; here in strict sequence.
9657 (define_expand "allocate_stack"
9658 [(match_operand 0 "" "")
9659 (match_operand 1 "" "")]
9665 /* Since the stack grows upward, we need to store virtual_stack_dynamic_rtx
9666 in operand 0 before adjusting the stack. */
9667 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9668 anti_adjust_stack (operands[1]);
9669 if (TARGET_HPUX_UNWIND_LIBRARY)
9671 addr = gen_rtx_PLUS (word_mode, stack_pointer_rtx,
9672 GEN_INT (TARGET_64BIT ? -8 : -4));
9673 emit_move_insn (gen_rtx_MEM (word_mode, addr), hard_frame_pointer_rtx);
9675 if (!TARGET_64BIT && flag_pic)
9677 rtx addr = gen_rtx_PLUS (word_mode, stack_pointer_rtx, GEN_INT (-32));
9678 emit_move_insn (gen_rtx_MEM (word_mode, addr), pic_offset_table_rtx);
9683 (define_expand "prefetch"
9684 [(match_operand 0 "address_operand" "")
9685 (match_operand 1 "const_int_operand" "")
9686 (match_operand 2 "const_int_operand" "")]
9689 operands[0] = copy_addr_to_reg (operands[0]);
9690 emit_insn (gen_prefetch_20 (operands[0], operands[1], operands[2]));
9694 (define_insn "prefetch_20"
9695 [(prefetch (match_operand 0 "pmode_register_operand" "r")
9696 (match_operand:SI 1 "const_int_operand" "n")
9697 (match_operand:SI 2 "const_int_operand" "n"))]
9700 /* The SL cache-control completer indicates good spatial locality but
9701 poor temporal locality. The ldw instruction with a target of general
9702 register 0 prefetches a cache line for a read. The ldd instruction
9703 prefetches a cache line for a write. */
9704 static const char * const instr[2][2] = {
9706 "ldw,sl 0(%0),%%r0",
9714 int read_or_write = INTVAL (operands[1]) == 0 ? 0 : 1;
9715 int locality = INTVAL (operands[2]) == 0 ? 0 : 1;
9717 return instr [locality][read_or_write];
9719 [(set_attr "type" "load")
9720 (set_attr "length" "4")])
9723 (define_insn "tgd_load"
9724 [(set (match_operand:SI 0 "register_operand" "=r")
9725 (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD))
9726 (clobber (reg:SI 1))
9731 return \"addil LR'%1-$tls_gdidx$,%%r27\;ldo RR'%1-$tls_gdidx$(%%r1),%0\";
9733 [(set_attr "type" "multi")
9734 (set_attr "length" "8")])
9736 (define_insn "tgd_load_pic"
9737 [(set (match_operand:SI 0 "register_operand" "=r")
9738 (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD_PIC))
9739 (clobber (reg:SI 1))
9744 return \"addil LT'%1-$tls_gdidx$,%%r19\;ldo RT'%1-$tls_gdidx$(%%r1),%0\";
9746 [(set_attr "type" "multi")
9747 (set_attr "length" "8")])
9749 (define_insn "tld_load"
9750 [(set (match_operand:SI 0 "register_operand" "=r")
9751 (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM))
9752 (clobber (reg:SI 1))
9757 return \"addil LR'%1-$tls_ldidx$,%%r27\;ldo RR'%1-$tls_ldidx$(%%r1),%0\";
9759 [(set_attr "type" "multi")
9760 (set_attr "length" "8")])
9762 (define_insn "tld_load_pic"
9763 [(set (match_operand:SI 0 "register_operand" "=r")
9764 (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM_PIC))
9765 (clobber (reg:SI 1))
9770 return \"addil LT'%1-$tls_ldidx$,%%r19\;ldo RT'%1-$tls_ldidx$(%%r1),%0\";
9772 [(set_attr "type" "multi")
9773 (set_attr "length" "8")])
9775 (define_insn "tld_offset_load"
9776 [(set (match_operand:SI 0 "register_operand" "=r")
9777 (plus:SI (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")]
9779 (match_operand:SI 2 "register_operand" "r")))
9780 (clobber (reg:SI 1))]
9784 return \"addil LR'%1-$tls_dtpoff$,%2\;ldo RR'%1-$tls_dtpoff$(%%r1),%0\";
9786 [(set_attr "type" "multi")
9787 (set_attr "length" "8")])
9789 (define_insn "tp_load"
9790 [(set (match_operand:SI 0 "register_operand" "=r")
9791 (unspec:SI [(const_int 0)] UNSPEC_TP))]
9794 [(set_attr "type" "multi")
9795 (set_attr "length" "4")])
9797 (define_insn "tie_load"
9798 [(set (match_operand:SI 0 "register_operand" "=r")
9799 (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE))
9800 (clobber (reg:SI 1))
9805 return \"addil LR'%1-$tls_ieoff$,%%r27\;ldw RR'%1-$tls_ieoff$(%%r1),%0\";
9807 [(set_attr "type" "multi")
9808 (set_attr "length" "8")])
9810 (define_insn "tie_load_pic"
9811 [(set (match_operand:SI 0 "register_operand" "=r")
9812 (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE_PIC))
9813 (clobber (reg:SI 1))
9818 return \"addil LT'%1-$tls_ieoff$,%%r19\;ldw RT'%1-$tls_ieoff$(%%r1),%0\";
9820 [(set_attr "type" "multi")
9821 (set_attr "length" "8")])
9823 (define_insn "tle_load"
9824 [(set (match_operand:SI 0 "register_operand" "=r")
9825 (plus:SI (unspec:SI [(match_operand 1 "tle_symbolic_operand" "")]
9827 (match_operand:SI 2 "register_operand" "r")))
9828 (clobber (reg:SI 1))]
9830 "addil LR'%1-$tls_leoff$,%2\;ldo RR'%1-$tls_leoff$(%%r1),%0"
9831 [(set_attr "type" "multi")
9832 (set_attr "length" "8")])