1 ;;- Machine description for GNU compiler -- S/390 / zSeries version.
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and
5 ;; Ulrich Weigand (uweigand@de.ibm.com).
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it under
10 ;; the terms of the GNU General Public License as published by the Free
11 ;; Software Foundation; either version 2, or (at your option) any later
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING. If not, write to the Free
21 ;; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 ;; Special constraints for s/390 machine description:
27 ;; a -- Any address register from 1 to 15.
28 ;; c -- Condition code register 33.
29 ;; d -- Any register from 0 to 15.
30 ;; I -- An 8-bit constant (0..255).
31 ;; J -- A 12-bit constant (0..4095).
32 ;; K -- A 16-bit constant (-32768..32767).
33 ;; L -- Value appropriate as displacement.
34 ;; (0..4095) for short displacement
35 ;; (-524288..524287) for long displacement
36 ;; M -- Constant integer with a value of 0x7fffffff.
37 ;; N -- Multiple letter constraint followed by 4 parameter letters.
38 ;; 0..9,x: number of the part counting from most to least significant
39 ;; H,Q: mode of the part
40 ;; D,S,H: mode of the containing operand
41 ;; 0,F: value of the other parts (F - all bits set)
43 ;; The constraint matches if the specified part of a constant
44 ;; has a value different from its other parts. If the letter x
45 ;; is specified instead of a part number, the constraint matches
46 ;; if there is any single part with non-default value.
47 ;; Q -- Memory reference without index register and with short displacement.
48 ;; R -- Memory reference with index register and short displacement.
49 ;; S -- Memory reference without index register but with long displacement.
50 ;; T -- Memory reference with index register and long displacement.
51 ;; A -- Multiple letter constraint followed by Q, R, S, or T:
52 ;; Offsettable memory reference of type specified by second letter.
53 ;; U -- Pointer with short displacement.
54 ;; W -- Pointer with long displacement.
55 ;; Y -- Shift count operand.
57 ;; Special formats used for outputting 390 instructions.
59 ;; %C: print opcode suffix for branch condition.
60 ;; %D: print opcode suffix for inverse branch condition.
61 ;; %J: print tls_load/tls_gdcall/tls_ldcall suffix
62 ;; %O: print only the displacement of a memory reference.
63 ;; %R: print only the base register of a memory reference.
64 ;; %S: print S-type memory reference (base+displacement).
65 ;; %N: print the second word of a DImode operand.
66 ;; %M: print the second word of a TImode operand.
68 ;; %b: print integer X as if it's an unsigned byte.
69 ;; %x: print integer X as if it's an unsigned word.
70 ;; %h: print integer X as if it's a signed word.
71 ;; %i: print the first nonzero HImode part of X
72 ;; %j: print the first HImode part unequal to 0xffff of X
75 ;; We have a special constraint for pattern matching.
77 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
90 ; GOT/PLT and lt-relative accesses
91 (UNSPEC_LTREL_OFFSET 100)
92 (UNSPEC_LTREL_BASE 101)
100 (UNSPEC_RELOAD_BASE 210)
101 (UNSPEC_MAIN_BASE 211)
106 ; TLS relocation specifiers
111 (UNSPEC_GOTNTPOFF 504)
112 (UNSPEC_INDNTPOFF 505)
115 (UNSPEC_TLSLDM_NTPOFF 511)
116 (UNSPEC_TLS_LOAD 512)
123 ;; UNSPEC_VOLATILE usage
131 (UNSPECV_TPF_PROLOGUE 20)
132 (UNSPECV_TPF_EPILOGUE 21)
136 (UNSPECV_POOL_SECTION 201)
137 (UNSPECV_POOL_ALIGN 202)
138 (UNSPECV_POOL_ENTRY 203)
139 (UNSPECV_MAIN_POOL 300)
146 ;; Instruction operand type as used in the Principles of Operation.
147 ;; Used to determine defaults for length and other attribute values.
149 (define_attr "op_type"
150 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
153 ;; Instruction type attribute used for scheduling.
155 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
156 cs,vs,store,imul,idiv,
157 branch,jsr,fsimpd,fsimps,
158 floadd,floads,fstored, fstores,
159 fmuld,fmuls,fdivd,fdivs,
160 ftoi,itof,fsqrtd,fsqrts,
162 (cond [(eq_attr "op_type" "NN") (const_string "other")
163 (eq_attr "op_type" "SS") (const_string "cs")]
164 (const_string "integer")))
166 ;; Another attribute used for scheduling purposes:
167 ;; agen: Instruction uses the address generation unit
168 ;; reg: Instruction does not use the agen unit
170 (define_attr "atype" "agen,reg"
171 (cond [(eq_attr "op_type" "E") (const_string "reg")
172 (eq_attr "op_type" "RR") (const_string "reg")
173 (eq_attr "op_type" "RX") (const_string "agen")
174 (eq_attr "op_type" "RI") (const_string "reg")
175 (eq_attr "op_type" "RRE") (const_string "reg")
176 (eq_attr "op_type" "RS") (const_string "agen")
177 (eq_attr "op_type" "RSI") (const_string "agen")
178 (eq_attr "op_type" "S") (const_string "agen")
179 (eq_attr "op_type" "SI") (const_string "agen")
180 (eq_attr "op_type" "SS") (const_string "agen")
181 (eq_attr "op_type" "SSE") (const_string "agen")
182 (eq_attr "op_type" "RXE") (const_string "agen")
183 (eq_attr "op_type" "RSE") (const_string "agen")
184 (eq_attr "op_type" "RIL") (const_string "agen")
185 (eq_attr "op_type" "RXY") (const_string "agen")
186 (eq_attr "op_type" "RSY") (const_string "agen")
187 (eq_attr "op_type" "SIY") (const_string "agen")]
188 (const_string "agen")))
192 (define_attr "length" ""
193 (cond [(eq_attr "op_type" "E") (const_int 2)
194 (eq_attr "op_type" "RR") (const_int 2)
195 (eq_attr "op_type" "RX") (const_int 4)
196 (eq_attr "op_type" "RI") (const_int 4)
197 (eq_attr "op_type" "RRE") (const_int 4)
198 (eq_attr "op_type" "RS") (const_int 4)
199 (eq_attr "op_type" "RSI") (const_int 4)
200 (eq_attr "op_type" "S") (const_int 4)
201 (eq_attr "op_type" "SI") (const_int 4)
202 (eq_attr "op_type" "SS") (const_int 6)
203 (eq_attr "op_type" "SSE") (const_int 6)
204 (eq_attr "op_type" "RXE") (const_int 6)
205 (eq_attr "op_type" "RSE") (const_int 6)
206 (eq_attr "op_type" "RIL") (const_int 6)
207 (eq_attr "op_type" "RXY") (const_int 6)
208 (eq_attr "op_type" "RSY") (const_int 6)
209 (eq_attr "op_type" "SIY") (const_int 6)]
213 ;; Processor type. This attribute must exactly match the processor_type
214 ;; enumeration in s390.h. The current machine description does not
215 ;; distinguish between g5 and g6, but there are differences between the two
216 ;; CPUs could in theory be modeled.
218 (define_attr "cpu" "g5,g6,z900,z990"
219 (const (symbol_ref "s390_tune")))
221 ;; Pipeline description for z900. For lack of anything better,
222 ;; this description is also used for the g5 and g6.
225 ;; Pipeline description for z990.
233 ; CCL: Zero Nonzero Zero Nonzero (AL, ALR, SL, SLR, N, NC, NI, NR, O, OC, OI, OR, X, XC, XI, XR)
234 ; CCA: Zero <Zero >Zero Overflow (A, AR, AH, AHI, S, SR, SH, SHI, LTR, LCR, LNR, LPR, SLA, SLDA, SLA, SRDA)
235 ; CCU: Equal ULess UGreater -- (CL, CLR, CLI, CLM)
236 ; CCS: Equal SLess SGreater -- (C, CR, CH, CHI, ICM)
237 ; CCT: Zero Mixed Mixed Ones (TM, TMH, TML)
240 ; CCZ1 -> CCA/CCU/CCS/CCT
243 ; String: CLC, CLCL, CLCLE, CLST, CUSE, MVCL, MVCLE, MVPG, MVST, SRST
244 ; Clobber: CKSM, CFC, CS, CDS, CUUTF, CUTFU, PLO, SPM, STCK, STCKE, TS, TRT, TRE, UPT
248 ;;- Compare instructions.
251 (define_expand "cmpdi"
253 (compare:CC (match_operand:DI 0 "register_operand" "")
254 (match_operand:DI 1 "general_operand" "")))]
257 s390_compare_op0 = operands[0];
258 s390_compare_op1 = operands[1];
262 (define_expand "cmpsi"
264 (compare:CC (match_operand:SI 0 "register_operand" "")
265 (match_operand:SI 1 "general_operand" "")))]
268 s390_compare_op0 = operands[0];
269 s390_compare_op1 = operands[1];
273 (define_expand "cmpdf"
275 (compare:CC (match_operand:DF 0 "register_operand" "")
276 (match_operand:DF 1 "general_operand" "")))]
279 s390_compare_op0 = operands[0];
280 s390_compare_op1 = operands[1];
284 (define_expand "cmpsf"
286 (compare:CC (match_operand:SF 0 "register_operand" "")
287 (match_operand:SF 1 "general_operand" "")))]
290 s390_compare_op0 = operands[0];
291 s390_compare_op1 = operands[1];
296 ; Test-under-Mask instructions
298 (define_insn "*tmqi_mem"
300 (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S")
301 (match_operand:QI 1 "immediate_operand" "n,n"))
302 (match_operand:QI 2 "immediate_operand" "n,n")))]
303 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))"
307 [(set_attr "op_type" "SI,SIY")])
309 (define_insn "*tmdi_reg"
311 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
312 (match_operand:DI 1 "immediate_operand"
313 "N0HD0,N1HD0,N2HD0,N3HD0"))
314 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
316 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
317 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
323 [(set_attr "op_type" "RI")])
325 (define_insn "*tmsi_reg"
327 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
328 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
329 (match_operand:SI 2 "immediate_operand" "n,n")))]
330 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
331 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
335 [(set_attr "op_type" "RI")])
337 (define_insn "*tmhi_full"
339 (compare (match_operand:HI 0 "register_operand" "d")
340 (match_operand:HI 1 "immediate_operand" "n")))]
341 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
343 [(set_attr "op_type" "RI")])
345 (define_insn "*tmqi_full"
347 (compare (match_operand:QI 0 "register_operand" "d")
348 (match_operand:QI 1 "immediate_operand" "n")))]
349 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
351 [(set_attr "op_type" "RI")])
354 ; Load-and-Test instructions
356 (define_insn "*tstdi_sign"
358 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
359 (const_int 32)) (const_int 32))
360 (match_operand:DI 1 "const0_operand" "")))
361 (set (match_operand:DI 2 "register_operand" "=d")
362 (sign_extend:DI (match_dup 0)))]
363 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
365 [(set_attr "op_type" "RRE")])
367 (define_insn "*tstdi"
369 (compare (match_operand:DI 0 "register_operand" "d")
370 (match_operand:DI 1 "const0_operand" "")))
371 (set (match_operand:DI 2 "register_operand" "=d")
373 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
375 [(set_attr "op_type" "RRE")])
377 (define_insn "*tstdi_cconly"
379 (compare (match_operand:DI 0 "register_operand" "d")
380 (match_operand:DI 1 "const0_operand" "")))]
381 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
383 [(set_attr "op_type" "RRE")])
385 (define_insn "*tstdi_cconly_31"
387 (compare (match_operand:DI 0 "register_operand" "d")
388 (match_operand:DI 1 "const0_operand" "")))]
389 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
391 [(set_attr "op_type" "RS")
392 (set_attr "atype" "reg")])
395 (define_insn "*tstsi"
397 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
398 (match_operand:SI 1 "const0_operand" "")))
399 (set (match_operand:SI 2 "register_operand" "=d,d,d")
401 "s390_match_ccmode(insn, CCSmode)"
406 [(set_attr "op_type" "RR,RS,RSY")])
408 (define_insn "*tstsi_cconly"
410 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
411 (match_operand:SI 1 "const0_operand" "")))
412 (clobber (match_scratch:SI 2 "=X,d,d"))]
413 "s390_match_ccmode(insn, CCSmode)"
418 [(set_attr "op_type" "RR,RS,RSY")])
420 (define_insn "*tstsi_cconly2"
422 (compare (match_operand:SI 0 "register_operand" "d")
423 (match_operand:SI 1 "const0_operand" "")))]
424 "s390_match_ccmode(insn, CCSmode)"
426 [(set_attr "op_type" "RR")])
428 (define_insn "*tsthiCCT"
430 (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d")
431 (match_operand:HI 1 "const0_operand" "")))
432 (set (match_operand:HI 2 "register_operand" "=d,d,0")
434 "s390_match_ccmode(insn, CCTmode)"
439 [(set_attr "op_type" "RS,RSY,RI")])
441 (define_insn "*tsthiCCT_cconly"
443 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
444 (match_operand:HI 1 "const0_operand" "")))
445 (clobber (match_scratch:HI 2 "=d,d,X"))]
446 "s390_match_ccmode(insn, CCTmode)"
451 [(set_attr "op_type" "RS,RSY,RI")])
453 (define_insn "*tsthi"
455 (compare (match_operand:HI 0 "s_operand" "Q,S")
456 (match_operand:HI 1 "const0_operand" "")))
457 (set (match_operand:HI 2 "register_operand" "=d,d")
459 "s390_match_ccmode(insn, CCSmode)"
463 [(set_attr "op_type" "RS,RSY")])
465 (define_insn "*tsthi_cconly"
467 (compare (match_operand:HI 0 "s_operand" "Q,S")
468 (match_operand:HI 1 "const0_operand" "")))
469 (clobber (match_scratch:HI 2 "=d,d"))]
470 "s390_match_ccmode(insn, CCSmode)"
474 [(set_attr "op_type" "RS,RSY")])
476 (define_insn "*tstqiCCT"
478 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
479 (match_operand:QI 1 "const0_operand" "")))
480 (set (match_operand:QI 2 "register_operand" "=d,d,0")
482 "s390_match_ccmode(insn, CCTmode)"
487 [(set_attr "op_type" "RS,RSY,RI")])
489 (define_insn "*tstqiCCT_cconly"
491 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
492 (match_operand:QI 1 "const0_operand" "")))]
493 "s390_match_ccmode(insn, CCTmode)"
498 [(set_attr "op_type" "SI,SIY,RI")])
500 (define_insn "*tstqi"
502 (compare (match_operand:QI 0 "s_operand" "Q,S")
503 (match_operand:QI 1 "const0_operand" "")))
504 (set (match_operand:QI 2 "register_operand" "=d,d")
506 "s390_match_ccmode(insn, CCSmode)"
510 [(set_attr "op_type" "RS,RSY")])
512 (define_insn "*tstqi_cconly"
514 (compare (match_operand:QI 0 "s_operand" "Q,S")
515 (match_operand:QI 1 "const0_operand" "")))
516 (clobber (match_scratch:QI 2 "=d,d"))]
517 "s390_match_ccmode(insn, CCSmode)"
521 [(set_attr "op_type" "RS,RSY")])
524 ; Compare (equality) instructions
526 (define_insn "*cmpdi_cct"
528 (compare (match_operand:DI 0 "nonimmediate_operand" "d,d,d,m,Q")
529 (match_operand:DI 1 "general_operand" "d,K,m,d,Q")))]
530 "s390_match_ccmode (insn, CCTmode) && TARGET_64BIT
531 && (!s390_pool_operand (operands[0]) || !s390_pool_operand (operands[1]))"
538 [(set_attr "op_type" "RRE,RI,RXY,RXY,SS")])
540 (define_insn "*cmpsi_cct"
542 (compare (match_operand:SI 0 "nonimmediate_operand" "d,d,d,d,R,T,Q")
543 (match_operand:SI 1 "general_operand" "d,K,R,T,d,d,Q")))]
544 "s390_match_ccmode (insn, CCTmode)
545 && (!s390_pool_operand (operands[0]) || !s390_pool_operand (operands[1]))"
554 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")])
557 ; Compare (signed) instructions
559 (define_insn "*cmpdi_ccs_sign"
561 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
562 (match_operand:DI 0 "register_operand" "d,d")))]
563 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
567 [(set_attr "op_type" "RRE,RXY")])
569 (define_insn "*cmpdi_ccs"
571 (compare (match_operand:DI 0 "register_operand" "d,d,d")
572 (match_operand:DI 1 "general_operand" "d,K,m")))]
573 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
578 [(set_attr "op_type" "RRE,RI,RXY")])
580 (define_insn "*cmpsi_ccs_sign"
582 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
583 (match_operand:SI 0 "register_operand" "d,d")))]
584 "s390_match_ccmode(insn, CCSRmode)"
588 [(set_attr "op_type" "RX,RXY")])
590 (define_insn "*cmpsi_ccs"
592 (compare (match_operand:SI 0 "register_operand" "d,d,d,d")
593 (match_operand:SI 1 "general_operand" "d,K,R,T")))]
594 "s390_match_ccmode(insn, CCSmode)"
600 [(set_attr "op_type" "RR,RI,RX,RXY")])
603 ; Compare (unsigned) instructions
605 (define_insn "*cmpdi_ccu_zero"
607 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
608 (match_operand:DI 0 "register_operand" "d,d")))]
609 "s390_match_ccmode (insn, CCURmode) && TARGET_64BIT"
613 [(set_attr "op_type" "RRE,RXY")])
615 (define_insn "*cmpdi_ccu"
617 (compare (match_operand:DI 0 "nonimmediate_operand" "d,d,Q")
618 (match_operand:DI 1 "general_operand" "d,m,Q")))]
619 "s390_match_ccmode (insn, CCUmode) && TARGET_64BIT
620 && (!s390_pool_operand (operands[0]) || !s390_pool_operand (operands[1]))"
625 [(set_attr "op_type" "RRE,RXY,SS")])
627 (define_insn "*cmpsi_ccu"
629 (compare (match_operand:SI 0 "nonimmediate_operand" "d,d,d,Q")
630 (match_operand:SI 1 "general_operand" "d,R,T,Q")))]
631 "s390_match_ccmode (insn, CCUmode)
632 && (!s390_pool_operand (operands[0]) || !s390_pool_operand (operands[1]))"
638 [(set_attr "op_type" "RR,RX,RXY,SS")])
640 (define_insn "*cmphi_ccu"
642 (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q")
643 (match_operand:HI 1 "general_operand" "Q,S,Q")))]
644 "s390_match_ccmode (insn, CCUmode)
645 && (!s390_pool_operand (operands[0]) || !s390_pool_operand (operands[1]))
646 && !register_operand (operands[1], HImode)"
651 [(set_attr "op_type" "RS,RSY,SS")])
653 (define_insn "*cmpqi_ccu"
655 (compare (match_operand:QI 0 "nonimmediate_operand" "d,d,Q,S,Q")
656 (match_operand:QI 1 "general_operand" "Q,S,n,n,Q")))]
657 "s390_match_ccmode (insn, CCUmode)
658 && (!s390_pool_operand (operands[0]) || !s390_pool_operand (operands[1]))
659 && !register_operand (operands[1], QImode)"
666 [(set_attr "op_type" "RS,RSY,SI,SIY,SS")])
669 ; Block compare (CLC) instruction patterns.
673 (compare (match_operand:BLK 0 "memory_operand" "=Q")
674 (match_operand:BLK 1 "memory_operand" "Q")))
675 (use (match_operand 2 "const_int_operand" "n"))]
676 "s390_match_ccmode (insn, CCUmode)
677 && INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
678 "clc\t%O0(%2,%R0),%S1"
679 [(set_attr "op_type" "SS")])
683 (compare (match_operand 0 "memory_operand" "")
684 (match_operand 1 "memory_operand" "")))]
686 && s390_match_ccmode (insn, CCUmode)
687 && GET_MODE (operands[0]) == GET_MODE (operands[1])
688 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
690 [(set (match_dup 0) (match_dup 1))
691 (use (match_dup 2))])]
693 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
694 operands[0] = adjust_address (operands[0], BLKmode, 0);
695 operands[1] = adjust_address (operands[1], BLKmode, 0);
697 operands[1] = gen_rtx_COMPARE (GET_MODE (SET_DEST (PATTERN (curr_insn))),
698 operands[0], operands[1]);
699 operands[0] = SET_DEST (PATTERN (curr_insn));
705 (define_insn "*cmpdf_ccs_0"
707 (compare (match_operand:DF 0 "register_operand" "f")
708 (match_operand:DF 1 "const0_operand" "")))]
709 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
711 [(set_attr "op_type" "RRE")
712 (set_attr "type" "fsimpd")])
714 (define_insn "*cmpdf_ccs_0_ibm"
716 (compare (match_operand:DF 0 "register_operand" "f")
717 (match_operand:DF 1 "const0_operand" "")))]
718 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
720 [(set_attr "op_type" "RR")
721 (set_attr "type" "fsimpd")])
723 (define_insn "*cmpdf_ccs"
725 (compare (match_operand:DF 0 "register_operand" "f,f")
726 (match_operand:DF 1 "general_operand" "f,R")))]
727 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
731 [(set_attr "op_type" "RRE,RXE")
732 (set_attr "type" "fsimpd")])
734 (define_insn "*cmpdf_ccs_ibm"
736 (compare (match_operand:DF 0 "register_operand" "f,f")
737 (match_operand:DF 1 "general_operand" "f,R")))]
738 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
742 [(set_attr "op_type" "RR,RX")
743 (set_attr "type" "fsimpd")])
748 (define_insn "*cmpsf_ccs_0"
750 (compare (match_operand:SF 0 "register_operand" "f")
751 (match_operand:SF 1 "const0_operand" "")))]
752 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
754 [(set_attr "op_type" "RRE")
755 (set_attr "type" "fsimps")])
757 (define_insn "*cmpsf_ccs_0_ibm"
759 (compare (match_operand:SF 0 "register_operand" "f")
760 (match_operand:SF 1 "const0_operand" "")))]
761 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
763 [(set_attr "op_type" "RR")
764 (set_attr "type" "fsimps")])
766 (define_insn "*cmpsf_ccs"
768 (compare (match_operand:SF 0 "register_operand" "f,f")
769 (match_operand:SF 1 "general_operand" "f,R")))]
770 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
774 [(set_attr "op_type" "RRE,RXE")
775 (set_attr "type" "fsimps")])
777 (define_insn "*cmpsf_ccs"
779 (compare (match_operand:SF 0 "register_operand" "f,f")
780 (match_operand:SF 1 "general_operand" "f,R")))]
781 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
785 [(set_attr "op_type" "RR,RX")
786 (set_attr "type" "fsimps")])
790 ;;- Move instructions.
794 ; movti instruction pattern(s).
798 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
799 (match_operand:TI 1 "general_operand" "QS,d,dKm,d,Q"))]
807 [(set_attr "op_type" "RSY,RSY,*,*,SS")
808 (set_attr "type" "lm,stm,*,*,*")])
811 [(set (match_operand:TI 0 "nonimmediate_operand" "")
812 (match_operand:TI 1 "general_operand" ""))]
813 "TARGET_64BIT && reload_completed
814 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
815 [(set (match_dup 2) (match_dup 4))
816 (set (match_dup 3) (match_dup 5))]
818 operands[2] = operand_subword (operands[0], 0, 0, TImode);
819 operands[3] = operand_subword (operands[0], 1, 0, TImode);
820 operands[4] = operand_subword (operands[1], 0, 0, TImode);
821 operands[5] = operand_subword (operands[1], 1, 0, TImode);
825 [(set (match_operand:TI 0 "nonimmediate_operand" "")
826 (match_operand:TI 1 "general_operand" ""))]
827 "TARGET_64BIT && reload_completed
828 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
829 [(set (match_dup 2) (match_dup 4))
830 (set (match_dup 3) (match_dup 5))]
832 operands[2] = operand_subword (operands[0], 1, 0, TImode);
833 operands[3] = operand_subword (operands[0], 0, 0, TImode);
834 operands[4] = operand_subword (operands[1], 1, 0, TImode);
835 operands[5] = operand_subword (operands[1], 0, 0, TImode);
839 [(set (match_operand:TI 0 "register_operand" "")
840 (match_operand:TI 1 "memory_operand" ""))]
841 "TARGET_64BIT && reload_completed
842 && !s_operand (operands[1], VOIDmode)"
843 [(set (match_dup 0) (match_dup 1))]
845 rtx addr = operand_subword (operands[0], 1, 0, TImode);
846 s390_load_address (addr, XEXP (operands[1], 0));
847 operands[1] = replace_equiv_address (operands[1], addr);
850 (define_expand "reload_outti"
851 [(parallel [(match_operand:TI 0 "memory_operand" "")
852 (match_operand:TI 1 "register_operand" "d")
853 (match_operand:DI 2 "register_operand" "=&a")])]
856 s390_load_address (operands[2], XEXP (operands[0], 0));
857 operands[0] = replace_equiv_address (operands[0], operands[2]);
858 emit_move_insn (operands[0], operands[1]);
863 ; movdi instruction pattern(s).
866 (define_expand "movdi"
867 [(set (match_operand:DI 0 "general_operand" "")
868 (match_operand:DI 1 "general_operand" ""))]
871 /* Handle symbolic constants. */
872 if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
873 emit_symbolic_move (operands);
876 (define_insn "*movdi_larl"
877 [(set (match_operand:DI 0 "register_operand" "=d")
878 (match_operand:DI 1 "larl_operand" "X"))]
880 && !FP_REG_P (operands[0])"
882 [(set_attr "op_type" "RIL")
883 (set_attr "type" "larl")])
885 (define_insn "*movdi_64"
886 [(set (match_operand:DI 0 "nonimmediate_operand"
887 "=d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,d,t,Q,t,?Q")
888 (match_operand:DI 1 "general_operand"
889 "K,N0HD0,N1HD0,N2HD0,N3HD0,L,d,m,d,*f,R,T,*f,*f,t,d,t,Q,?Q"))]
911 [(set_attr "op_type" "RI,RI,RI,RI,RI,RXY,RRE,RXY,RXY,
912 RR,RX,RXY,RX,RXY,*,*,RS,RS,SS")
913 (set_attr "type" "*,*,*,*,*,la,lr,load,store,
914 floadd,floadd,floadd,fstored,fstored,*,*,*,*,*")])
917 [(set (match_operand:DI 0 "register_operand" "")
918 (match_operand:DI 1 "register_operand" ""))]
919 "TARGET_64BIT && ACCESS_REG_P (operands[1])"
920 [(set (match_dup 2) (match_dup 3))
921 (set (match_dup 0) (ashift:DI (match_dup 0) (const_int 32)))
922 (set (strict_low_part (match_dup 2)) (match_dup 4))]
923 "operands[2] = gen_lowpart (SImode, operands[0]);
924 s390_split_access_reg (operands[1], &operands[4], &operands[3]);")
927 [(set (match_operand:DI 0 "register_operand" "")
928 (match_operand:DI 1 "register_operand" ""))]
929 "TARGET_64BIT && ACCESS_REG_P (operands[0])
930 && dead_or_set_p (insn, operands[1])"
931 [(set (match_dup 3) (match_dup 2))
932 (set (match_dup 1) (lshiftrt:DI (match_dup 1) (const_int 32)))
933 (set (match_dup 4) (match_dup 2))]
934 "operands[2] = gen_lowpart (SImode, operands[1]);
935 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
938 [(set (match_operand:DI 0 "register_operand" "")
939 (match_operand:DI 1 "register_operand" ""))]
940 "TARGET_64BIT && ACCESS_REG_P (operands[0])
941 && !dead_or_set_p (insn, operands[1])"
942 [(set (match_dup 3) (match_dup 2))
943 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))
944 (set (match_dup 4) (match_dup 2))
945 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))]
946 "operands[2] = gen_lowpart (SImode, operands[1]);
947 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
949 (define_insn "*movdi_31"
950 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,o,!*f,!*f,!*f,!R,!T,Q")
951 (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,R,T,*f,*f,Q"))]
964 [(set_attr "op_type" "RS,RS,*,*,RR,RX,RXY,RX,RXY,SS")
965 (set_attr "type" "lm,stm,*,*,floadd,floadd,floadd,fstored,fstored,*")])
968 [(set (match_operand:DI 0 "nonimmediate_operand" "")
969 (match_operand:DI 1 "general_operand" ""))]
970 "!TARGET_64BIT && reload_completed
971 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
972 [(set (match_dup 2) (match_dup 4))
973 (set (match_dup 3) (match_dup 5))]
975 operands[2] = operand_subword (operands[0], 0, 0, DImode);
976 operands[3] = operand_subword (operands[0], 1, 0, DImode);
977 operands[4] = operand_subword (operands[1], 0, 0, DImode);
978 operands[5] = operand_subword (operands[1], 1, 0, DImode);
982 [(set (match_operand:DI 0 "nonimmediate_operand" "")
983 (match_operand:DI 1 "general_operand" ""))]
984 "!TARGET_64BIT && reload_completed
985 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
986 [(set (match_dup 2) (match_dup 4))
987 (set (match_dup 3) (match_dup 5))]
989 operands[2] = operand_subword (operands[0], 1, 0, DImode);
990 operands[3] = operand_subword (operands[0], 0, 0, DImode);
991 operands[4] = operand_subword (operands[1], 1, 0, DImode);
992 operands[5] = operand_subword (operands[1], 0, 0, DImode);
996 [(set (match_operand:DI 0 "register_operand" "")
997 (match_operand:DI 1 "memory_operand" ""))]
998 "!TARGET_64BIT && reload_completed
999 && !FP_REG_P (operands[0])
1000 && !s_operand (operands[1], VOIDmode)"
1001 [(set (match_dup 0) (match_dup 1))]
1003 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1004 s390_load_address (addr, XEXP (operands[1], 0));
1005 operands[1] = replace_equiv_address (operands[1], addr);
1008 (define_expand "reload_outdi"
1009 [(parallel [(match_operand:DI 0 "memory_operand" "")
1010 (match_operand:DI 1 "register_operand" "d")
1011 (match_operand:SI 2 "register_operand" "=&a")])]
1014 s390_load_address (operands[2], XEXP (operands[0], 0));
1015 operands[0] = replace_equiv_address (operands[0], operands[2]);
1016 emit_move_insn (operands[0], operands[1]);
1021 [(set (match_operand:DI 0 "register_operand" "")
1022 (mem:DI (match_operand 1 "address_operand" "")))]
1024 && !FP_REG_P (operands[0])
1025 && GET_CODE (operands[1]) == SYMBOL_REF
1026 && CONSTANT_POOL_ADDRESS_P (operands[1])
1027 && get_pool_mode (operands[1]) == DImode
1028 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1029 [(set (match_dup 0) (match_dup 2))]
1030 "operands[2] = get_pool_constant (operands[1]);")
1032 (define_insn "*la_64"
1033 [(set (match_operand:DI 0 "register_operand" "=d,d")
1034 (match_operand:QI 1 "address_operand" "U,W"))]
1039 [(set_attr "op_type" "RX,RXY")
1040 (set_attr "type" "la")])
1044 [(set (match_operand:DI 0 "register_operand" "")
1045 (match_operand:QI 1 "address_operand" ""))
1046 (clobber (reg:CC 33))])]
1048 && preferred_la_operand_p (operands[1], const0_rtx)"
1049 [(set (match_dup 0) (match_dup 1))]
1053 [(set (match_operand:DI 0 "register_operand" "")
1054 (match_operand:DI 1 "register_operand" ""))
1057 (plus:DI (match_dup 0)
1058 (match_operand:DI 2 "nonmemory_operand" "")))
1059 (clobber (reg:CC 33))])]
1061 && !reg_overlap_mentioned_p (operands[0], operands[2])
1062 && preferred_la_operand_p (operands[1], operands[2])"
1063 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1066 (define_expand "reload_indi"
1067 [(parallel [(match_operand:DI 0 "register_operand" "=a")
1068 (match_operand:DI 1 "s390_plus_operand" "")
1069 (match_operand:DI 2 "register_operand" "=&a")])]
1072 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1077 ; movsi instruction pattern(s).
1080 (define_expand "movsi"
1081 [(set (match_operand:SI 0 "general_operand" "")
1082 (match_operand:SI 1 "general_operand" ""))]
1085 /* Handle symbolic constants. */
1086 if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1087 emit_symbolic_move (operands);
1090 (define_insn "*movsi_larl"
1091 [(set (match_operand:SI 0 "register_operand" "=d")
1092 (match_operand:SI 1 "larl_operand" "X"))]
1093 "!TARGET_64BIT && TARGET_CPU_ZARCH
1094 && !FP_REG_P (operands[0])"
1096 [(set_attr "op_type" "RIL")
1097 (set_attr "type" "larl")])
1099 (define_insn "*movsi_zarch"
1100 [(set (match_operand:SI 0 "nonimmediate_operand"
1101 "=d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,d,t,Q,t,?Q")
1102 (match_operand:SI 1 "general_operand"
1103 "K,N0HS0,N1HS0,L,d,R,T,d,d,*f,R,T,*f,*f,t,d,t,Q,?Q"))]
1125 [(set_attr "op_type" "RI,RI,RI,RXY,RR,RX,RXY,RX,RXY,
1126 RR,RX,RXY,RX,RXY,RRE,RRE,RS,RS,SS")
1127 (set_attr "type" "*,*,*,la,lr,load,load,store,store,
1128 floads,floads,floads,fstores,fstores,*,*,*,*,*")])
1130 (define_insn "*movsi_esa"
1131 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,d,t,Q,t,?Q")
1132 (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,t,d,t,Q,?Q"))]
1147 [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,RRE,RRE,RS,RS,SS")
1148 (set_attr "type" "*,lr,load,store,floads,floads,fstores,*,*,*,*,*")])
1151 [(set (match_operand:SI 0 "register_operand" "")
1152 (mem:SI (match_operand 1 "address_operand" "")))]
1153 "!FP_REG_P (operands[0])
1154 && GET_CODE (operands[1]) == SYMBOL_REF
1155 && CONSTANT_POOL_ADDRESS_P (operands[1])
1156 && get_pool_mode (operands[1]) == SImode
1157 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1158 [(set (match_dup 0) (match_dup 2))]
1159 "operands[2] = get_pool_constant (operands[1]);")
1161 (define_insn "*la_31"
1162 [(set (match_operand:SI 0 "register_operand" "=d,d")
1163 (match_operand:QI 1 "address_operand" "U,W"))]
1164 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1168 [(set_attr "op_type" "RX,RXY")
1169 (set_attr "type" "la")])
1173 [(set (match_operand:SI 0 "register_operand" "")
1174 (match_operand:QI 1 "address_operand" ""))
1175 (clobber (reg:CC 33))])]
1177 && preferred_la_operand_p (operands[1], const0_rtx)"
1178 [(set (match_dup 0) (match_dup 1))]
1182 [(set (match_operand:SI 0 "register_operand" "")
1183 (match_operand:SI 1 "register_operand" ""))
1186 (plus:SI (match_dup 0)
1187 (match_operand:SI 2 "nonmemory_operand" "")))
1188 (clobber (reg:CC 33))])]
1190 && !reg_overlap_mentioned_p (operands[0], operands[2])
1191 && preferred_la_operand_p (operands[1], operands[2])"
1192 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1195 (define_insn "*la_31_and"
1196 [(set (match_operand:SI 0 "register_operand" "=d,d")
1197 (and:SI (match_operand:QI 1 "address_operand" "U,W")
1198 (const_int 2147483647)))]
1203 [(set_attr "op_type" "RX,RXY")
1204 (set_attr "type" "la")])
1206 (define_insn_and_split "*la_31_and_cc"
1207 [(set (match_operand:SI 0 "register_operand" "=d")
1208 (and:SI (match_operand:QI 1 "address_operand" "p")
1209 (const_int 2147483647)))
1210 (clobber (reg:CC 33))]
1213 "&& reload_completed"
1215 (and:SI (match_dup 1) (const_int 2147483647)))]
1217 [(set_attr "op_type" "RX")
1218 (set_attr "type" "la")])
1220 (define_insn "force_la_31"
1221 [(set (match_operand:SI 0 "register_operand" "=d,d")
1222 (match_operand:QI 1 "address_operand" "U,W"))
1223 (use (const_int 0))]
1228 [(set_attr "op_type" "RX")
1229 (set_attr "type" "la")])
1231 (define_expand "reload_insi"
1232 [(parallel [(match_operand:SI 0 "register_operand" "=a")
1233 (match_operand:SI 1 "s390_plus_operand" "")
1234 (match_operand:SI 2 "register_operand" "=&a")])]
1237 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1242 ; movhi instruction pattern(s).
1245 (define_expand "movhi"
1246 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1247 (match_operand:HI 1 "general_operand" ""))]
1250 /* Make it explicit that loading a register from memory
1251 always sign-extends (at least) to SImode. */
1252 if (optimize && !no_new_pseudos
1253 && register_operand (operands[0], VOIDmode)
1254 && GET_CODE (operands[1]) == MEM)
1256 rtx tmp = gen_reg_rtx (SImode);
1257 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1258 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1259 operands[1] = gen_lowpart (HImode, tmp);
1263 (define_insn "*movhi"
1264 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1265 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1275 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1276 (set_attr "type" "lr,*,*,*,store,store,*")])
1279 [(set (match_operand:HI 0 "register_operand" "")
1280 (mem:HI (match_operand 1 "address_operand" "")))]
1281 "GET_CODE (operands[1]) == SYMBOL_REF
1282 && CONSTANT_POOL_ADDRESS_P (operands[1])
1283 && get_pool_mode (operands[1]) == HImode
1284 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1285 [(set (match_dup 0) (match_dup 2))]
1286 "operands[2] = get_pool_constant (operands[1]);")
1289 ; movqi instruction pattern(s).
1292 (define_expand "movqi"
1293 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1294 (match_operand:QI 1 "general_operand" ""))]
1297 /* On z/Architecture, zero-extending from memory to register
1298 is just as fast as a QImode load. */
1299 if (TARGET_ZARCH && optimize && !no_new_pseudos
1300 && register_operand (operands[0], VOIDmode)
1301 && GET_CODE (operands[1]) == MEM)
1303 rtx tmp = gen_reg_rtx (word_mode);
1304 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1305 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1306 operands[1] = gen_lowpart (QImode, tmp);
1310 (define_insn "*movqi"
1311 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1312 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1324 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1325 (set_attr "type" "lr,*,*,*,store,store,store,store,*")])
1328 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1329 (mem:QI (match_operand 1 "address_operand" "")))]
1330 "GET_CODE (operands[1]) == SYMBOL_REF
1331 && CONSTANT_POOL_ADDRESS_P (operands[1])
1332 && get_pool_mode (operands[1]) == QImode
1333 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1334 [(set (match_dup 0) (match_dup 2))]
1335 "operands[2] = get_pool_constant (operands[1]);")
1338 ; movstrictqi instruction pattern(s).
1341 (define_insn "*movstrictqi"
1342 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1343 (match_operand:QI 1 "memory_operand" "R,T"))]
1348 [(set_attr "op_type" "RX,RXY")])
1351 ; movstricthi instruction pattern(s).
1354 (define_insn "*movstricthi"
1355 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1356 (match_operand:HI 1 "memory_operand" "Q,S"))
1357 (clobber (reg:CC 33))]
1362 [(set_attr "op_type" "RS,RSY")])
1365 ; movstrictsi instruction pattern(s).
1368 (define_insn "movstrictsi"
1369 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d,d"))
1370 (match_operand:SI 1 "general_operand" "d,R,T,t"))]
1377 [(set_attr "op_type" "RR,RX,RXY,RRE")
1378 (set_attr "type" "lr,load,load,*")])
1381 ; movdf instruction pattern(s).
1384 (define_expand "movdf"
1385 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1386 (match_operand:DF 1 "general_operand" ""))]
1390 (define_insn "*movdf_64"
1391 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1392 (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1404 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1405 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,*")])
1407 (define_insn "*movdf_31"
1408 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1409 (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1422 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,*,*,SS")
1423 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,*")])
1426 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1427 (match_operand:DF 1 "general_operand" ""))]
1428 "!TARGET_64BIT && reload_completed
1429 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1430 [(set (match_dup 2) (match_dup 4))
1431 (set (match_dup 3) (match_dup 5))]
1433 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1434 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1435 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1436 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1440 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1441 (match_operand:DF 1 "general_operand" ""))]
1442 "!TARGET_64BIT && reload_completed
1443 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1444 [(set (match_dup 2) (match_dup 4))
1445 (set (match_dup 3) (match_dup 5))]
1447 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1448 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1449 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1450 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1454 [(set (match_operand:DF 0 "register_operand" "")
1455 (match_operand:DF 1 "memory_operand" ""))]
1456 "!TARGET_64BIT && reload_completed
1457 && !FP_REG_P (operands[0])
1458 && !s_operand (operands[1], VOIDmode)"
1459 [(set (match_dup 0) (match_dup 1))]
1461 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1462 s390_load_address (addr, XEXP (operands[1], 0));
1463 operands[1] = replace_equiv_address (operands[1], addr);
1466 (define_expand "reload_outdf"
1467 [(parallel [(match_operand:DF 0 "memory_operand" "")
1468 (match_operand:DF 1 "register_operand" "d")
1469 (match_operand:SI 2 "register_operand" "=&a")])]
1472 s390_load_address (operands[2], XEXP (operands[0], 0));
1473 operands[0] = replace_equiv_address (operands[0], operands[2]);
1474 emit_move_insn (operands[0], operands[1]);
1479 ; movsf instruction pattern(s).
1482 (define_insn "movsf"
1483 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1484 (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1498 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1499 (set_attr "type" "floads,floads,floads,fstores,fstores,
1500 lr,load,load,store,store,*")])
1503 ; movcc instruction pattern
1506 (define_insn "movcc"
1507 [(set (match_operand:CC 0 "nonimmediate_operand" "=d,c,d,d,d,R,T")
1508 (match_operand:CC 1 "nonimmediate_operand" "d,d,c,R,T,d,d"))]
1518 [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY")
1519 (set_attr "type" "lr,*,*,store,store,load,load")])
1522 ; Block move (MVC) patterns.
1526 [(set (match_operand:BLK 0 "memory_operand" "=Q")
1527 (match_operand:BLK 1 "memory_operand" "Q"))
1528 (use (match_operand 2 "const_int_operand" "n"))]
1529 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
1530 "mvc\t%O0(%2,%R0),%S1"
1531 [(set_attr "op_type" "SS")])
1534 [(set (match_operand 0 "memory_operand" "")
1535 (match_operand 1 "memory_operand" ""))]
1537 && GET_MODE (operands[0]) == GET_MODE (operands[1])
1538 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
1540 [(set (match_dup 0) (match_dup 1))
1541 (use (match_dup 2))])]
1543 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
1544 operands[0] = adjust_address (operands[0], BLKmode, 0);
1545 operands[1] = adjust_address (operands[1], BLKmode, 0);
1550 [(set (match_operand:BLK 0 "memory_operand" "")
1551 (match_operand:BLK 1 "memory_operand" ""))
1552 (use (match_operand 2 "const_int_operand" ""))])
1554 [(set (match_operand:BLK 3 "memory_operand" "")
1555 (match_operand:BLK 4 "memory_operand" ""))
1556 (use (match_operand 5 "const_int_operand" ""))])]
1557 "s390_offset_p (operands[0], operands[3], operands[2])
1558 && s390_offset_p (operands[1], operands[4], operands[2])
1559 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
1561 [(set (match_dup 6) (match_dup 7))
1562 (use (match_dup 8))])]
1563 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
1564 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
1565 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
1569 ; load_multiple pattern(s).
1571 ; ??? Due to reload problems with replacing registers inside match_parallel
1572 ; we currently support load_multiple/store_multiple only after reload.
1575 (define_expand "load_multiple"
1576 [(match_par_dup 3 [(set (match_operand 0 "" "")
1577 (match_operand 1 "" ""))
1578 (use (match_operand 2 "" ""))])]
1581 enum machine_mode mode;
1587 /* Support only loading a constant number of fixed-point registers from
1588 memory and only bother with this if more than two */
1589 if (GET_CODE (operands[2]) != CONST_INT
1590 || INTVAL (operands[2]) < 2
1591 || INTVAL (operands[2]) > 16
1592 || GET_CODE (operands[1]) != MEM
1593 || GET_CODE (operands[0]) != REG
1594 || REGNO (operands[0]) >= 16)
1597 count = INTVAL (operands[2]);
1598 regno = REGNO (operands[0]);
1599 mode = GET_MODE (operands[0]);
1600 if (mode != SImode && mode != word_mode)
1603 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1606 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1608 from = XEXP (operands[1], 0);
1611 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1612 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1613 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1615 from = XEXP (XEXP (operands[1], 0), 0);
1616 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1623 from = force_reg (Pmode, XEXP (operands[1], 0));
1627 for (i = 0; i < count; i++)
1628 XVECEXP (operands[3], 0, i)
1629 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1630 change_address (operands[1], mode,
1631 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1634 (define_insn "*load_multiple_di"
1635 [(match_parallel 0 "load_multiple_operation"
1636 [(set (match_operand:DI 1 "register_operand" "=r")
1637 (match_operand:DI 2 "s_operand" "QS"))])]
1638 "reload_completed && word_mode == DImode"
1640 int words = XVECLEN (operands[0], 0);
1641 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1642 return "lmg\t%1,%0,%S2";
1644 [(set_attr "op_type" "RSY")
1645 (set_attr "type" "lm")])
1647 (define_insn "*load_multiple_si"
1648 [(match_parallel 0 "load_multiple_operation"
1649 [(set (match_operand:SI 1 "register_operand" "=r,r")
1650 (match_operand:SI 2 "s_operand" "Q,S"))])]
1653 int words = XVECLEN (operands[0], 0);
1654 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1655 return which_alternative == 0 ? "lm\t%1,%0,%S2" : "lmy\t%1,%0,%S2";
1657 [(set_attr "op_type" "RS,RSY")
1658 (set_attr "type" "lm")])
1661 ; store multiple pattern(s).
1664 (define_expand "store_multiple"
1665 [(match_par_dup 3 [(set (match_operand 0 "" "")
1666 (match_operand 1 "" ""))
1667 (use (match_operand 2 "" ""))])]
1670 enum machine_mode mode;
1676 /* Support only storing a constant number of fixed-point registers to
1677 memory and only bother with this if more than two. */
1678 if (GET_CODE (operands[2]) != CONST_INT
1679 || INTVAL (operands[2]) < 2
1680 || INTVAL (operands[2]) > 16
1681 || GET_CODE (operands[0]) != MEM
1682 || GET_CODE (operands[1]) != REG
1683 || REGNO (operands[1]) >= 16)
1686 count = INTVAL (operands[2]);
1687 regno = REGNO (operands[1]);
1688 mode = GET_MODE (operands[1]);
1689 if (mode != SImode && mode != word_mode)
1692 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1696 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1698 to = XEXP (operands[0], 0);
1701 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1702 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1703 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1705 to = XEXP (XEXP (operands[0], 0), 0);
1706 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1713 to = force_reg (Pmode, XEXP (operands[0], 0));
1717 for (i = 0; i < count; i++)
1718 XVECEXP (operands[3], 0, i)
1719 = gen_rtx_SET (VOIDmode,
1720 change_address (operands[0], mode,
1721 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1722 gen_rtx_REG (mode, regno + i));
1725 (define_insn "*store_multiple_di"
1726 [(match_parallel 0 "store_multiple_operation"
1727 [(set (match_operand:DI 1 "s_operand" "=QS")
1728 (match_operand:DI 2 "register_operand" "r"))])]
1729 "reload_completed && word_mode == DImode"
1731 int words = XVECLEN (operands[0], 0);
1732 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1733 return "stmg\t%2,%0,%S1";
1735 [(set_attr "op_type" "RSY")
1736 (set_attr "type" "stm")])
1739 (define_insn "*store_multiple_si"
1740 [(match_parallel 0 "store_multiple_operation"
1741 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1742 (match_operand:SI 2 "register_operand" "r,r"))])]
1745 int words = XVECLEN (operands[0], 0);
1746 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1747 return which_alternative == 0 ? "stm\t%2,%0,%S1" : "stmy\t%2,%0,%S1";
1749 [(set_attr "op_type" "RS,RSY")
1750 (set_attr "type" "stm")])
1753 ;; String instructions.
1756 (define_insn "*execute"
1757 [(match_parallel 0 ""
1758 [(unspec [(match_operand 1 "register_operand" "a")
1759 (match_operand:BLK 2 "memory_operand" "R")
1760 (match_operand 3 "" "")] UNSPEC_EXECUTE)])]
1761 "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
1762 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
1764 [(set_attr "op_type" "RX")
1765 (set_attr "type" "cs")])
1769 ; strlenM instruction pattern(s).
1772 (define_expand "strlendi"
1773 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1776 (unspec:DI [(const_int 0)
1777 (match_operand:BLK 1 "memory_operand" "")
1779 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1780 (clobber (scratch:DI))
1781 (clobber (reg:CC 33))])
1783 [(set (match_operand:DI 0 "register_operand" "")
1784 (minus:DI (match_dup 4) (match_dup 5)))
1785 (clobber (reg:CC 33))])]
1788 operands[4] = gen_reg_rtx (DImode);
1789 operands[5] = gen_reg_rtx (DImode);
1790 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1791 operands[1] = replace_equiv_address (operands[1], operands[5]);
1794 (define_insn "*strlendi"
1795 [(set (match_operand:DI 0 "register_operand" "=a")
1796 (unspec:DI [(match_operand:DI 2 "general_operand" "0")
1797 (mem:BLK (match_operand:DI 3 "register_operand" "1"))
1799 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1800 (clobber (match_scratch:DI 1 "=a"))
1801 (clobber (reg:CC 33))]
1803 "srst\t%0,%1\;jo\t.-4"
1804 [(set_attr "length" "8")
1805 (set_attr "type" "vs")])
1807 (define_expand "strlensi"
1808 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1811 (unspec:SI [(const_int 0)
1812 (match_operand:BLK 1 "memory_operand" "")
1814 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1815 (clobber (scratch:SI))
1816 (clobber (reg:CC 33))])
1818 [(set (match_operand:SI 0 "register_operand" "")
1819 (minus:SI (match_dup 4) (match_dup 5)))
1820 (clobber (reg:CC 33))])]
1823 operands[4] = gen_reg_rtx (SImode);
1824 operands[5] = gen_reg_rtx (SImode);
1825 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1826 operands[1] = replace_equiv_address (operands[1], operands[5]);
1829 (define_insn "*strlensi"
1830 [(set (match_operand:SI 0 "register_operand" "=a")
1831 (unspec:SI [(match_operand:SI 2 "general_operand" "0")
1832 (mem:BLK (match_operand:SI 3 "register_operand" "1"))
1834 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1835 (clobber (match_scratch:SI 1 "=a"))
1836 (clobber (reg:CC 33))]
1838 "srst\t%0,%1\;jo\t.-4"
1839 [(set_attr "length" "8")
1840 (set_attr "type" "vs")])
1843 ; movmemM instruction pattern(s).
1846 (define_expand "movmemdi"
1847 [(set (match_operand:BLK 0 "memory_operand" "")
1848 (match_operand:BLK 1 "memory_operand" ""))
1849 (use (match_operand:DI 2 "general_operand" ""))
1850 (match_operand 3 "" "")]
1852 "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
1854 (define_expand "movmemsi"
1855 [(set (match_operand:BLK 0 "memory_operand" "")
1856 (match_operand:BLK 1 "memory_operand" ""))
1857 (use (match_operand:SI 2 "general_operand" ""))
1858 (match_operand 3 "" "")]
1860 "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
1862 ; Move a block that is up to 256 bytes in length.
1863 ; The block length is taken as (operands[2] % 256) + 1.
1865 (define_expand "movmem_short"
1867 [(set (match_operand:BLK 0 "memory_operand" "")
1868 (match_operand:BLK 1 "memory_operand" ""))
1869 (use (match_operand 2 "nonmemory_operand" ""))
1870 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
1871 (clobber (match_dup 3))])]
1873 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1875 (define_insn "*movmem_short"
1876 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q")
1877 (match_operand:BLK 1 "memory_operand" "Q,Q,Q"))
1878 (use (match_operand 2 "nonmemory_operand" "n,a,a"))
1879 (use (match_operand 3 "immediate_operand" "X,R,X"))
1880 (clobber (match_scratch 4 "=X,X,&a"))]
1881 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
1882 && GET_MODE (operands[4]) == Pmode"
1884 [(set_attr "type" "cs")])
1887 [(set (match_operand:BLK 0 "memory_operand" "")
1888 (match_operand:BLK 1 "memory_operand" ""))
1889 (use (match_operand 2 "const_int_operand" ""))
1890 (use (match_operand 3 "immediate_operand" ""))
1891 (clobber (scratch))]
1894 [(set (match_dup 0) (match_dup 1))
1895 (use (match_dup 2))])]
1896 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
1899 [(set (match_operand:BLK 0 "memory_operand" "")
1900 (match_operand:BLK 1 "memory_operand" ""))
1901 (use (match_operand 2 "register_operand" ""))
1902 (use (match_operand 3 "memory_operand" ""))
1903 (clobber (scratch))]
1906 [(unspec [(match_dup 2) (match_dup 3)
1907 (const_int 0)] UNSPEC_EXECUTE)
1908 (set (match_dup 0) (match_dup 1))
1909 (use (const_int 1))])]
1913 [(set (match_operand:BLK 0 "memory_operand" "")
1914 (match_operand:BLK 1 "memory_operand" ""))
1915 (use (match_operand 2 "register_operand" ""))
1916 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
1917 (clobber (match_operand 3 "register_operand" ""))]
1918 "reload_completed && TARGET_CPU_ZARCH"
1919 [(set (match_dup 3) (label_ref (match_dup 4)))
1921 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
1922 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
1923 (set (match_dup 0) (match_dup 1))
1924 (use (const_int 1))])]
1925 "operands[4] = gen_label_rtx ();")
1927 ; Move a block of arbitrary length.
1929 (define_expand "movmem_long"
1931 [(clobber (match_dup 2))
1932 (clobber (match_dup 3))
1933 (set (match_operand:BLK 0 "memory_operand" "")
1934 (match_operand:BLK 1 "memory_operand" ""))
1935 (use (match_operand 2 "general_operand" ""))
1937 (clobber (reg:CC 33))])]
1940 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1941 rtx reg0 = gen_reg_rtx (dword_mode);
1942 rtx reg1 = gen_reg_rtx (dword_mode);
1943 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1944 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
1945 rtx len0 = gen_lowpart (Pmode, reg0);
1946 rtx len1 = gen_lowpart (Pmode, reg1);
1948 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1949 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1950 emit_move_insn (len0, operands[2]);
1952 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
1953 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1954 emit_move_insn (len1, operands[2]);
1956 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1957 operands[1] = replace_equiv_address_nv (operands[1], addr1);
1962 (define_insn "*movmem_long_64"
1963 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1964 (clobber (match_operand:TI 1 "register_operand" "=d"))
1965 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1966 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
1969 (clobber (reg:CC 33))]
1971 "mvcle\t%0,%1,0\;jo\t.-4"
1972 [(set_attr "length" "8")
1973 (set_attr "type" "vs")])
1975 (define_insn "*movmem_long_31"
1976 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1977 (clobber (match_operand:DI 1 "register_operand" "=d"))
1978 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1979 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
1982 (clobber (reg:CC 33))]
1984 "mvcle\t%0,%1,0\;jo\t.-4"
1985 [(set_attr "length" "8")
1986 (set_attr "type" "vs")])
1989 ; clrmemM instruction pattern(s).
1992 (define_expand "clrmemdi"
1993 [(set (match_operand:BLK 0 "memory_operand" "")
1995 (use (match_operand:DI 1 "general_operand" ""))
1996 (match_operand 2 "" "")]
1998 "s390_expand_clrmem (operands[0], operands[1]); DONE;")
2000 (define_expand "clrmemsi"
2001 [(set (match_operand:BLK 0 "memory_operand" "")
2003 (use (match_operand:SI 1 "general_operand" ""))
2004 (match_operand 2 "" "")]
2006 "s390_expand_clrmem (operands[0], operands[1]); DONE;")
2008 ; Clear a block that is up to 256 bytes in length.
2009 ; The block length is taken as (operands[1] % 256) + 1.
2011 (define_expand "clrmem_short"
2013 [(set (match_operand:BLK 0 "memory_operand" "")
2015 (use (match_operand 1 "nonmemory_operand" ""))
2016 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2017 (clobber (match_dup 2))
2018 (clobber (reg:CC 33))])]
2020 "operands[2] = gen_rtx_SCRATCH (Pmode);")
2022 (define_insn "*clrmem_short"
2023 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q")
2025 (use (match_operand 1 "nonmemory_operand" "n,a,a"))
2026 (use (match_operand 2 "immediate_operand" "X,R,X"))
2027 (clobber (match_scratch 3 "=X,X,&a"))
2028 (clobber (reg:CC 33))]
2029 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
2030 && GET_MODE (operands[3]) == Pmode"
2032 [(set_attr "type" "cs")])
2035 [(set (match_operand:BLK 0 "memory_operand" "")
2037 (use (match_operand 1 "const_int_operand" ""))
2038 (use (match_operand 2 "immediate_operand" ""))
2040 (clobber (reg:CC 33))]
2043 [(set (match_dup 0) (const_int 0))
2045 (clobber (reg:CC 33))])]
2046 "operands[1] = GEN_INT ((INTVAL (operands[1]) & 0xff) + 1);")
2049 [(set (match_operand:BLK 0 "memory_operand" "")
2051 (use (match_operand 1 "register_operand" ""))
2052 (use (match_operand 2 "memory_operand" ""))
2054 (clobber (reg:CC 33))]
2057 [(unspec [(match_dup 1) (match_dup 2)
2058 (const_int 0)] UNSPEC_EXECUTE)
2059 (set (match_dup 0) (const_int 0))
2061 (clobber (reg:CC 33))])]
2065 [(set (match_operand:BLK 0 "memory_operand" "")
2067 (use (match_operand 1 "register_operand" ""))
2068 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2069 (clobber (match_operand 2 "register_operand" ""))
2070 (clobber (reg:CC 33))]
2071 "reload_completed && TARGET_CPU_ZARCH"
2072 [(set (match_dup 2) (label_ref (match_dup 3)))
2074 [(unspec [(match_dup 1) (mem:BLK (match_dup 2))
2075 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
2076 (set (match_dup 0) (const_int 0))
2078 (clobber (reg:CC 33))])]
2079 "operands[3] = gen_label_rtx ();")
2081 ; Clear a block of arbitrary length.
2083 (define_expand "clrmem_long"
2085 [(clobber (match_dup 1))
2086 (set (match_operand:BLK 0 "memory_operand" "")
2088 (use (match_operand 1 "general_operand" ""))
2090 (clobber (reg:CC 33))])]
2093 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2094 rtx reg0 = gen_reg_rtx (dword_mode);
2095 rtx reg1 = gen_reg_rtx (dword_mode);
2096 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2097 rtx len0 = gen_lowpart (Pmode, reg0);
2099 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2100 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2101 emit_move_insn (len0, operands[1]);
2103 emit_move_insn (reg1, const0_rtx);
2105 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2110 (define_insn "*clrmem_long_64"
2111 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2112 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2115 (use (match_operand:TI 1 "register_operand" "d"))
2116 (clobber (reg:CC 33))]
2118 "mvcle\t%0,%1,0\;jo\t.-4"
2119 [(set_attr "length" "8")
2120 (set_attr "type" "vs")])
2122 (define_insn "*clrmem_long_31"
2123 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2124 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2127 (use (match_operand:DI 1 "register_operand" "d"))
2128 (clobber (reg:CC 33))]
2130 "mvcle\t%0,%1,0\;jo\t.-4"
2131 [(set_attr "length" "8")
2132 (set_attr "type" "vs")])
2135 ; cmpmemM instruction pattern(s).
2138 (define_expand "cmpmemsi"
2139 [(set (match_operand:SI 0 "register_operand" "")
2140 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2141 (match_operand:BLK 2 "memory_operand" "") ) )
2142 (use (match_operand:SI 3 "general_operand" ""))
2143 (use (match_operand:SI 4 "" ""))]
2145 "s390_expand_cmpmem (operands[0], operands[1],
2146 operands[2], operands[3]); DONE;")
2148 ; Compare a block that is up to 256 bytes in length.
2149 ; The block length is taken as (operands[2] % 256) + 1.
2151 (define_expand "cmpmem_short"
2154 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2155 (match_operand:BLK 1 "memory_operand" "")))
2156 (use (match_operand 2 "nonmemory_operand" ""))
2157 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2158 (clobber (match_dup 3))])]
2160 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2162 (define_insn "*cmpmem_short"
2164 (compare:CCU (match_operand:BLK 0 "memory_operand" "=Q,Q,Q")
2165 (match_operand:BLK 1 "memory_operand" "Q,Q,Q")))
2166 (use (match_operand 2 "nonmemory_operand" "n,a,a"))
2167 (use (match_operand 3 "immediate_operand" "X,R,X"))
2168 (clobber (match_scratch 4 "=X,X,&a"))]
2169 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2170 && GET_MODE (operands[4]) == Pmode"
2172 [(set_attr "type" "cs")])
2176 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2177 (match_operand:BLK 1 "memory_operand" "")))
2178 (use (match_operand 2 "const_int_operand" ""))
2179 (use (match_operand 3 "immediate_operand" ""))
2180 (clobber (scratch))]
2183 [(set (reg:CCU 33) (compare:CCU (match_dup 0) (match_dup 1)))
2184 (use (match_dup 2))])]
2185 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
2189 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2190 (match_operand:BLK 1 "memory_operand" "")))
2191 (use (match_operand 2 "register_operand" ""))
2192 (use (match_operand 3 "memory_operand" ""))
2193 (clobber (scratch))]
2196 [(unspec [(match_dup 2) (match_dup 3)
2197 (const_int 0)] UNSPEC_EXECUTE)
2198 (set (reg:CCU 33) (compare:CCU (match_dup 0) (match_dup 1)))
2199 (use (const_int 1))])]
2204 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2205 (match_operand:BLK 1 "memory_operand" "")))
2206 (use (match_operand 2 "register_operand" ""))
2207 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2208 (clobber (match_operand 3 "register_operand" ""))]
2209 "reload_completed && TARGET_CPU_ZARCH"
2210 [(set (match_dup 3) (label_ref (match_dup 4)))
2212 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
2213 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
2214 (set (reg:CCU 33) (compare:CCU (match_dup 0) (match_dup 1)))
2215 (use (const_int 1))])]
2216 "operands[4] = gen_label_rtx ();")
2218 ; Compare a block of arbitrary length.
2220 (define_expand "cmpmem_long"
2222 [(clobber (match_dup 2))
2223 (clobber (match_dup 3))
2225 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2226 (match_operand:BLK 1 "memory_operand" "")))
2227 (use (match_operand 2 "general_operand" ""))
2228 (use (match_dup 3))])]
2231 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2232 rtx reg0 = gen_reg_rtx (dword_mode);
2233 rtx reg1 = gen_reg_rtx (dword_mode);
2234 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2235 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2236 rtx len0 = gen_lowpart (Pmode, reg0);
2237 rtx len1 = gen_lowpart (Pmode, reg1);
2239 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2240 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2241 emit_move_insn (len0, operands[2]);
2243 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2244 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2245 emit_move_insn (len1, operands[2]);
2247 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2248 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2253 (define_insn "*cmpmem_long_64"
2254 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2255 (clobber (match_operand:TI 1 "register_operand" "=d"))
2257 (compare:CCU (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2258 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2260 (use (match_dup 3))]
2262 "clcle\t%0,%1,0\;jo\t.-4"
2263 [(set_attr "length" "8")
2264 (set_attr "type" "vs")])
2266 (define_insn "*cmpmem_long_31"
2267 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2268 (clobber (match_operand:DI 1 "register_operand" "=d"))
2270 (compare:CCU (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2271 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2273 (use (match_dup 3))]
2275 "clcle\t%0,%1,0\;jo\t.-4"
2276 [(set_attr "length" "8")
2277 (set_attr "type" "vs")])
2279 ; Convert CCUmode condition code to integer.
2280 ; Result is zero if EQ, positive if LTU, negative if GTU.
2282 (define_insn_and_split "cmpint"
2283 [(set (match_operand:SI 0 "register_operand" "=d")
2284 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2286 (clobber (reg:CC 33))]
2290 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
2292 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))
2293 (clobber (reg:CC 33))])])
2295 (define_insn_and_split "*cmpint_cc"
2297 (compare (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2300 (set (match_operand:SI 0 "register_operand" "=d")
2301 (unspec:SI [(match_dup 1)] UNSPEC_CMPINT))]
2302 "s390_match_ccmode (insn, CCSmode)"
2304 "&& reload_completed"
2305 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
2307 [(set (match_dup 2) (match_dup 3))
2308 (set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))])]
2310 rtx result = gen_rtx_ASHIFTRT (SImode, operands[0], GEN_INT (30));
2311 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
2312 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
2315 (define_insn_and_split "*cmpint_sign"
2316 [(set (match_operand:DI 0 "register_operand" "=d")
2317 (sign_extend:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2319 (clobber (reg:CC 33))]
2322 "&& reload_completed"
2323 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
2325 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))
2326 (clobber (reg:CC 33))])])
2328 (define_insn_and_split "*cmpint_sign_cc"
2330 (compare (ashiftrt:DI (ashift:DI (subreg:DI
2331 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2333 (const_int 32)) (const_int 32))
2335 (set (match_operand:DI 0 "register_operand" "=d")
2336 (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_CMPINT)))]
2337 "s390_match_ccmode (insn, CCSmode) && TARGET_64BIT"
2339 "&& reload_completed"
2340 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
2342 [(set (match_dup 2) (match_dup 3))
2343 (set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))])]
2345 rtx result = gen_rtx_ASHIFTRT (DImode, operands[0], GEN_INT (62));
2346 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
2347 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
2352 ;;- Conversion instructions.
2355 (define_insn "*sethighqisi"
2356 [(set (match_operand:SI 0 "register_operand" "=d,d")
2357 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2358 (clobber (reg:CC 33))]
2363 [(set_attr "op_type" "RS,RSY")])
2365 (define_insn "*sethighhisi"
2366 [(set (match_operand:SI 0 "register_operand" "=d,d")
2367 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2368 (clobber (reg:CC 33))]
2373 [(set_attr "op_type" "RS,RSY")])
2375 (define_insn "*sethighqidi_64"
2376 [(set (match_operand:DI 0 "register_operand" "=d")
2377 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2378 (clobber (reg:CC 33))]
2381 [(set_attr "op_type" "RSY")])
2383 (define_insn "*sethighqidi_31"
2384 [(set (match_operand:DI 0 "register_operand" "=d,d")
2385 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2386 (clobber (reg:CC 33))]
2391 [(set_attr "op_type" "RS,RSY")])
2393 (define_insn_and_split "*extractqi"
2394 [(set (match_operand:SI 0 "register_operand" "=d")
2395 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2396 (match_operand 2 "const_int_operand" "n")
2398 (clobber (reg:CC 33))]
2400 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2402 "&& reload_completed"
2404 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2405 (clobber (reg:CC 33))])
2406 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2408 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2409 operands[1] = change_address (operands[1], QImode, 0);
2412 (define_insn_and_split "*extracthi"
2413 [(set (match_operand:SI 0 "register_operand" "=d")
2414 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2415 (match_operand 2 "const_int_operand" "n")
2417 (clobber (reg:CC 33))]
2419 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2421 "&& reload_completed"
2423 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2424 (clobber (reg:CC 33))])
2425 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2427 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2428 operands[1] = change_address (operands[1], HImode, 0);
2432 ; extendsidi2 instruction pattern(s).
2435 (define_expand "extendsidi2"
2436 [(set (match_operand:DI 0 "register_operand" "")
2437 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2443 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2444 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2445 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2446 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2452 (define_insn "*extendsidi2"
2453 [(set (match_operand:DI 0 "register_operand" "=d,d")
2454 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2459 [(set_attr "op_type" "RRE,RXY")])
2462 ; extendhidi2 instruction pattern(s).
2465 (define_expand "extendhidi2"
2466 [(set (match_operand:DI 0 "register_operand" "")
2467 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2473 rtx tmp = gen_reg_rtx (SImode);
2474 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2475 emit_insn (gen_extendsidi2 (operands[0], tmp));
2480 operands[1] = gen_lowpart (DImode, operands[1]);
2481 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2482 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2488 (define_insn "*extendhidi2"
2489 [(set (match_operand:DI 0 "register_operand" "=d")
2490 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2493 [(set_attr "op_type" "RXY")])
2496 ; extendqidi2 instruction pattern(s).
2499 (define_expand "extendqidi2"
2500 [(set (match_operand:DI 0 "register_operand" "")
2501 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2507 rtx tmp = gen_reg_rtx (SImode);
2508 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2509 emit_insn (gen_extendsidi2 (operands[0], tmp));
2514 operands[1] = gen_lowpart (DImode, operands[1]);
2515 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2516 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2522 (define_insn "*extendqidi2"
2523 [(set (match_operand:DI 0 "register_operand" "=d")
2524 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2525 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2527 [(set_attr "op_type" "RXY")])
2529 (define_insn_and_split "*extendqidi2_short_displ"
2530 [(set (match_operand:DI 0 "register_operand" "=d")
2531 (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))
2532 (clobber (reg:CC 33))]
2533 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2535 "&& reload_completed"
2537 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2538 (clobber (reg:CC 33))])
2540 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2541 (clobber (reg:CC 33))])]
2545 ; extendhisi2 instruction pattern(s).
2548 (define_expand "extendhisi2"
2549 [(set (match_operand:SI 0 "register_operand" "")
2550 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2554 operands[1] = gen_lowpart (SImode, operands[1]);
2555 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2556 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2561 (define_insn "*extendhisi2"
2562 [(set (match_operand:SI 0 "register_operand" "=d,d")
2563 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2568 [(set_attr "op_type" "RX,RXY")])
2571 ; extendqisi2 instruction pattern(s).
2574 (define_expand "extendqisi2"
2575 [(set (match_operand:SI 0 "register_operand" "")
2576 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2580 operands[1] = gen_lowpart (SImode, operands[1]);
2581 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2582 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2587 (define_insn "*extendqisi2"
2588 [(set (match_operand:SI 0 "register_operand" "=d")
2589 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2590 "TARGET_LONG_DISPLACEMENT"
2592 [(set_attr "op_type" "RXY")])
2594 (define_insn_and_split "*extendqisi2_short_displ"
2595 [(set (match_operand:SI 0 "register_operand" "=d")
2596 (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))
2597 (clobber (reg:CC 33))]
2598 "!TARGET_LONG_DISPLACEMENT"
2600 "&& reload_completed"
2602 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2603 (clobber (reg:CC 33))])
2605 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2606 (clobber (reg:CC 33))])]
2610 ; extendqihi2 instruction pattern(s).
2615 ; zero_extendsidi2 instruction pattern(s).
2618 (define_expand "zero_extendsidi2"
2619 [(set (match_operand:DI 0 "register_operand" "")
2620 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2626 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2627 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2628 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2634 (define_insn "*zero_extendsidi2"
2635 [(set (match_operand:DI 0 "register_operand" "=d,d")
2636 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2641 [(set_attr "op_type" "RRE,RXY")])
2644 ; zero_extendhidi2 instruction pattern(s).
2647 (define_expand "zero_extendhidi2"
2648 [(set (match_operand:DI 0 "register_operand" "")
2649 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2655 rtx tmp = gen_reg_rtx (SImode);
2656 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2657 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2662 operands[1] = gen_lowpart (DImode, operands[1]);
2663 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2664 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2670 (define_insn "*zero_extendhidi2"
2671 [(set (match_operand:DI 0 "register_operand" "=d")
2672 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2675 [(set_attr "op_type" "RXY")])
2678 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2681 (define_insn "*llgt_sisi"
2682 [(set (match_operand:SI 0 "register_operand" "=d,d")
2683 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2684 (const_int 2147483647)))]
2689 [(set_attr "op_type" "RRE,RXE")])
2692 [(set (match_operand:SI 0 "register_operand" "")
2693 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2694 (const_int 2147483647)))
2695 (clobber (reg:CC 33))]
2696 "TARGET_64BIT && reload_completed"
2698 (and:SI (match_dup 1)
2699 (const_int 2147483647)))]
2702 (define_insn "*llgt_didi"
2703 [(set (match_operand:DI 0 "register_operand" "=d,d")
2704 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2705 (const_int 2147483647)))]
2710 [(set_attr "op_type" "RRE,RXE")])
2713 [(set (match_operand:DI 0 "register_operand" "")
2714 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
2715 (const_int 2147483647)))
2716 (clobber (reg:CC 33))]
2717 "TARGET_64BIT && reload_completed"
2719 (and:DI (match_dup 1)
2720 (const_int 2147483647)))]
2723 (define_insn "*llgt_sidi"
2724 [(set (match_operand:DI 0 "register_operand" "=d")
2725 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2726 (const_int 2147483647)))]
2729 [(set_attr "op_type" "RXE")])
2731 (define_insn_and_split "*llgt_sidi_split"
2732 [(set (match_operand:DI 0 "register_operand" "=d")
2733 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2734 (const_int 2147483647)))
2735 (clobber (reg:CC 33))]
2738 "&& reload_completed"
2740 (and:DI (subreg:DI (match_dup 1) 0)
2741 (const_int 2147483647)))]
2745 ; zero_extendqidi2 instruction pattern(s)
2748 (define_expand "zero_extendqidi2"
2749 [(set (match_operand:DI 0 "register_operand" "")
2750 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2756 rtx tmp = gen_reg_rtx (SImode);
2757 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2758 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2763 operands[1] = gen_lowpart (DImode, operands[1]);
2764 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2765 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2771 (define_insn "*zero_extendqidi2"
2772 [(set (match_operand:DI 0 "register_operand" "=d")
2773 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2776 [(set_attr "op_type" "RXY")])
2779 ; zero_extendhisi2 instruction pattern(s).
2782 (define_expand "zero_extendhisi2"
2783 [(set (match_operand:SI 0 "register_operand" "")
2784 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2788 operands[1] = gen_lowpart (SImode, operands[1]);
2789 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2794 (define_insn "*zero_extendhisi2_64"
2795 [(set (match_operand:SI 0 "register_operand" "=d")
2796 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2799 [(set_attr "op_type" "RXY")])
2801 (define_insn_and_split "*zero_extendhisi2_31"
2802 [(set (match_operand:SI 0 "register_operand" "=&d")
2803 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2804 (clobber (reg:CC 33))]
2807 "&& reload_completed"
2808 [(set (match_dup 0) (const_int 0))
2810 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2811 (clobber (reg:CC 33))])]
2812 "operands[2] = gen_lowpart (HImode, operands[0]);")
2815 ; zero_extendqisi2 instruction pattern(s).
2818 (define_expand "zero_extendqisi2"
2819 [(set (match_operand:SI 0 "register_operand" "")
2820 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2824 operands[1] = gen_lowpart (SImode, operands[1]);
2825 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2830 (define_insn "*zero_extendqisi2_64"
2831 [(set (match_operand:SI 0 "register_operand" "=d")
2832 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2835 [(set_attr "op_type" "RXY")])
2837 (define_insn_and_split "*zero_extendqisi2_31"
2838 [(set (match_operand:SI 0 "register_operand" "=&d")
2839 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2842 "&& reload_completed"
2843 [(set (match_dup 0) (const_int 0))
2844 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2845 "operands[2] = gen_lowpart (QImode, operands[0]);")
2848 ; zero_extendqihi2 instruction pattern(s).
2851 (define_expand "zero_extendqihi2"
2852 [(set (match_operand:HI 0 "register_operand" "")
2853 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2857 operands[1] = gen_lowpart (HImode, operands[1]);
2858 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2863 (define_insn "*zero_extendqihi2_64"
2864 [(set (match_operand:HI 0 "register_operand" "=d")
2865 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2868 [(set_attr "op_type" "RXY")])
2870 (define_insn_and_split "*zero_extendqihi2_31"
2871 [(set (match_operand:HI 0 "register_operand" "=&d")
2872 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2875 "&& reload_completed"
2876 [(set (match_dup 0) (const_int 0))
2877 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2878 "operands[2] = gen_lowpart (QImode, operands[0]);")
2882 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2885 (define_expand "fixuns_truncdfdi2"
2886 [(set (match_operand:DI 0 "register_operand" "")
2887 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2888 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2890 rtx label1 = gen_label_rtx ();
2891 rtx label2 = gen_label_rtx ();
2892 rtx temp = gen_reg_rtx (DFmode);
2893 operands[1] = force_reg (DFmode, operands[1]);
2895 emit_insn (gen_cmpdf (operands[1],
2896 CONST_DOUBLE_FROM_REAL_VALUE (
2897 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2898 emit_jump_insn (gen_blt (label1));
2899 emit_insn (gen_subdf3 (temp, operands[1],
2900 CONST_DOUBLE_FROM_REAL_VALUE (
2901 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2902 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2905 emit_label (label1);
2906 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2907 emit_label (label2);
2911 (define_expand "fix_truncdfdi2"
2912 [(set (match_operand:DI 0 "register_operand" "")
2913 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2914 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2916 operands[1] = force_reg (DFmode, operands[1]);
2917 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2921 (define_insn "fix_truncdfdi2_ieee"
2922 [(set (match_operand:DI 0 "register_operand" "=d")
2923 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2924 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2925 (clobber (reg:CC 33))]
2926 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2928 [(set_attr "op_type" "RRE")
2929 (set_attr "type" "ftoi")])
2932 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2935 (define_expand "fixuns_truncdfsi2"
2936 [(set (match_operand:SI 0 "register_operand" "")
2937 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2938 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2940 rtx label1 = gen_label_rtx ();
2941 rtx label2 = gen_label_rtx ();
2942 rtx temp = gen_reg_rtx (DFmode);
2944 operands[1] = force_reg (DFmode,operands[1]);
2945 emit_insn (gen_cmpdf (operands[1],
2946 CONST_DOUBLE_FROM_REAL_VALUE (
2947 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2948 emit_jump_insn (gen_blt (label1));
2949 emit_insn (gen_subdf3 (temp, operands[1],
2950 CONST_DOUBLE_FROM_REAL_VALUE (
2951 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2952 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2955 emit_label (label1);
2956 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2957 emit_label (label2);
2961 (define_expand "fix_truncdfsi2"
2962 [(set (match_operand:SI 0 "register_operand" "")
2963 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2966 if (TARGET_IBM_FLOAT)
2968 /* This is the algorithm from POP chapter A.5.7.2. */
2970 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2971 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2972 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2974 operands[1] = force_reg (DFmode, operands[1]);
2975 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2976 two31r, two32, temp));
2980 operands[1] = force_reg (DFmode, operands[1]);
2981 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2987 (define_insn "fix_truncdfsi2_ieee"
2988 [(set (match_operand:SI 0 "register_operand" "=d")
2989 (fix:SI (match_operand:DF 1 "register_operand" "f")))
2990 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2991 (clobber (reg:CC 33))]
2992 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2994 [(set_attr "op_type" "RRE")
2995 (set_attr "type" "ftoi")])
2997 (define_insn "fix_truncdfsi2_ibm"
2998 [(set (match_operand:SI 0 "register_operand" "=d")
2999 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
3000 (use (match_operand:DI 2 "immediate_operand" "m"))
3001 (use (match_operand:DI 3 "immediate_operand" "m"))
3002 (use (match_operand:BLK 4 "memory_operand" "m"))
3003 (clobber (reg:CC 33))]
3004 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3006 output_asm_insn ("sd\t%1,%2", operands);
3007 output_asm_insn ("aw\t%1,%3", operands);
3008 output_asm_insn ("std\t%1,%4", operands);
3009 output_asm_insn ("xi\t%N4,128", operands);
3012 [(set_attr "length" "20")])
3015 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
3018 (define_expand "fixuns_truncsfdi2"
3019 [(set (match_operand:DI 0 "register_operand" "")
3020 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
3021 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3023 rtx label1 = gen_label_rtx ();
3024 rtx label2 = gen_label_rtx ();
3025 rtx temp = gen_reg_rtx (SFmode);
3027 operands[1] = force_reg (SFmode, operands[1]);
3028 emit_insn (gen_cmpsf (operands[1],
3029 CONST_DOUBLE_FROM_REAL_VALUE (
3030 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
3031 emit_jump_insn (gen_blt (label1));
3033 emit_insn (gen_subsf3 (temp, operands[1],
3034 CONST_DOUBLE_FROM_REAL_VALUE (
3035 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
3036 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
3039 emit_label (label1);
3040 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
3041 emit_label (label2);
3045 (define_expand "fix_truncsfdi2"
3046 [(set (match_operand:DI 0 "register_operand" "")
3047 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
3048 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3050 operands[1] = force_reg (SFmode, operands[1]);
3051 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
3055 (define_insn "fix_truncsfdi2_ieee"
3056 [(set (match_operand:DI 0 "register_operand" "=d")
3057 (fix:DI (match_operand:SF 1 "register_operand" "f")))
3058 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3059 (clobber (reg:CC 33))]
3060 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3062 [(set_attr "op_type" "RRE")
3063 (set_attr "type" "ftoi")])
3066 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
3069 (define_expand "fixuns_truncsfsi2"
3070 [(set (match_operand:SI 0 "register_operand" "")
3071 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
3072 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3074 rtx label1 = gen_label_rtx ();
3075 rtx label2 = gen_label_rtx ();
3076 rtx temp = gen_reg_rtx (SFmode);
3078 operands[1] = force_reg (SFmode, operands[1]);
3079 emit_insn (gen_cmpsf (operands[1],
3080 CONST_DOUBLE_FROM_REAL_VALUE (
3081 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
3082 emit_jump_insn (gen_blt (label1));
3083 emit_insn (gen_subsf3 (temp, operands[1],
3084 CONST_DOUBLE_FROM_REAL_VALUE (
3085 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
3086 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
3089 emit_label (label1);
3090 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3091 emit_label (label2);
3095 (define_expand "fix_truncsfsi2"
3096 [(set (match_operand:SI 0 "register_operand" "")
3097 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
3100 if (TARGET_IBM_FLOAT)
3102 /* Convert to DFmode and then use the POP algorithm. */
3103 rtx temp = gen_reg_rtx (DFmode);
3104 emit_insn (gen_extendsfdf2 (temp, operands[1]));
3105 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
3109 operands[1] = force_reg (SFmode, operands[1]);
3110 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3116 (define_insn "fix_truncsfsi2_ieee"
3117 [(set (match_operand:SI 0 "register_operand" "=d")
3118 (fix:SI (match_operand:SF 1 "register_operand" "f")))
3119 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3120 (clobber (reg:CC 33))]
3121 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3123 [(set_attr "op_type" "RRE")
3124 (set_attr "type" "ftoi")])
3127 ; floatdidf2 instruction pattern(s).
3130 (define_insn "floatdidf2"
3131 [(set (match_operand:DF 0 "register_operand" "=f")
3132 (float:DF (match_operand:DI 1 "register_operand" "d")))]
3133 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3135 [(set_attr "op_type" "RRE")
3136 (set_attr "type" "itof" )])
3139 ; floatdisf2 instruction pattern(s).
3142 (define_insn "floatdisf2"
3143 [(set (match_operand:SF 0 "register_operand" "=f")
3144 (float:SF (match_operand:DI 1 "register_operand" "d")))]
3145 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3147 [(set_attr "op_type" "RRE")
3148 (set_attr "type" "itof" )])
3151 ; floatsidf2 instruction pattern(s).
3154 (define_expand "floatsidf2"
3155 [(set (match_operand:DF 0 "register_operand" "")
3156 (float:DF (match_operand:SI 1 "register_operand" "")))]
3159 if (TARGET_IBM_FLOAT)
3161 /* This is the algorithm from POP chapter A.5.7.1. */
3163 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3164 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
3166 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
3171 (define_insn "floatsidf2_ieee"
3172 [(set (match_operand:DF 0 "register_operand" "=f")
3173 (float:DF (match_operand:SI 1 "register_operand" "d")))]
3174 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3176 [(set_attr "op_type" "RRE")
3177 (set_attr "type" "itof" )])
3179 (define_insn "floatsidf2_ibm"
3180 [(set (match_operand:DF 0 "register_operand" "=f")
3181 (float:DF (match_operand:SI 1 "register_operand" "d")))
3182 (use (match_operand:DI 2 "immediate_operand" "m"))
3183 (use (match_operand:BLK 3 "memory_operand" "m"))
3184 (clobber (reg:CC 33))]
3185 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3187 output_asm_insn ("st\t%1,%N3", operands);
3188 output_asm_insn ("xi\t%N3,128", operands);
3189 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3190 output_asm_insn ("ld\t%0,%3", operands);
3193 [(set_attr "length" "20")])
3196 ; floatsisf2 instruction pattern(s).
3199 (define_expand "floatsisf2"
3200 [(set (match_operand:SF 0 "register_operand" "")
3201 (float:SF (match_operand:SI 1 "register_operand" "")))]
3204 if (TARGET_IBM_FLOAT)
3206 /* Use the POP algorithm to convert to DFmode and then truncate. */
3207 rtx temp = gen_reg_rtx (DFmode);
3208 emit_insn (gen_floatsidf2 (temp, operands[1]));
3209 emit_insn (gen_truncdfsf2 (operands[0], temp));
3214 (define_insn "floatsisf2_ieee"
3215 [(set (match_operand:SF 0 "register_operand" "=f")
3216 (float:SF (match_operand:SI 1 "register_operand" "d")))]
3217 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3219 [(set_attr "op_type" "RRE")
3220 (set_attr "type" "itof" )])
3223 ; truncdfsf2 instruction pattern(s).
3226 (define_expand "truncdfsf2"
3227 [(set (match_operand:SF 0 "register_operand" "")
3228 (float_truncate:SF (match_operand:DF 1 "register_operand" "")))]
3232 (define_insn "truncdfsf2_ieee"
3233 [(set (match_operand:SF 0 "register_operand" "=f")
3234 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
3235 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3237 [(set_attr "op_type" "RRE")])
3239 (define_insn "truncdfsf2_ibm"
3240 [(set (match_operand:SF 0 "register_operand" "=f,f")
3241 (float_truncate:SF (match_operand:DF 1 "nonimmediate_operand" "f,R")))]
3242 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3246 [(set_attr "op_type" "RR,RX")
3247 (set_attr "type" "floads,floads")])
3250 ; extendsfdf2 instruction pattern(s).
3253 (define_expand "extendsfdf2"
3254 [(set (match_operand:DF 0 "register_operand" "")
3255 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3258 if (TARGET_IBM_FLOAT)
3260 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3265 (define_insn "extendsfdf2_ieee"
3266 [(set (match_operand:DF 0 "register_operand" "=f,f")
3267 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3268 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3272 [(set_attr "op_type" "RRE,RXE")
3273 (set_attr "type" "floads,floads")])
3275 (define_insn "extendsfdf2_ibm"
3276 [(set (match_operand:DF 0 "register_operand" "=f,f")
3277 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3278 (clobber (reg:CC 33))]
3279 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3281 sdr\t%0,%0\;ler\t%0,%1
3282 sdr\t%0,%0\;le\t%0,%1"
3283 [(set_attr "length" "4,6")
3284 (set_attr "type" "floads,floads")])
3288 ;; ARITHMETIC OPERATIONS
3290 ; arithmetic operations set the ConditionCode,
3291 ; because of unpredictable Bits in Register for Halfword and Byte
3292 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3295 ;;- Add instructions.
3299 ; addti3 instruction pattern(s).
3302 (define_insn_and_split "addti3"
3303 [(set (match_operand:TI 0 "register_operand" "=&d")
3304 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
3305 (match_operand:TI 2 "general_operand" "do") ) )
3306 (clobber (reg:CC 33))]
3309 "&& reload_completed"
3312 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
3314 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
3316 [(set (match_dup 3) (plus:DI (plus:DI (match_dup 4) (match_dup 5))
3317 (ltu:DI (reg:CCL1 33) (const_int 0))))
3318 (clobber (reg:CC 33))])]
3319 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3320 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3321 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3322 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3323 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3324 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
3327 ; adddi3 instruction pattern(s).
3330 (define_insn "*adddi3_sign"
3331 [(set (match_operand:DI 0 "register_operand" "=d,d")
3332 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3333 (match_operand:DI 1 "register_operand" "0,0")))
3334 (clobber (reg:CC 33))]
3339 [(set_attr "op_type" "RRE,RXY")])
3341 (define_insn "*adddi3_zero_cc"
3343 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3344 (match_operand:DI 1 "register_operand" "0,0"))
3346 (set (match_operand:DI 0 "register_operand" "=d,d")
3347 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3348 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3352 [(set_attr "op_type" "RRE,RXY")])
3354 (define_insn "*adddi3_zero_cconly"
3356 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3357 (match_operand:DI 1 "register_operand" "0,0"))
3359 (clobber (match_scratch:DI 0 "=d,d"))]
3360 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3364 [(set_attr "op_type" "RRE,RXY")])
3366 (define_insn "*adddi3_zero"
3367 [(set (match_operand:DI 0 "register_operand" "=d,d")
3368 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3369 (match_operand:DI 1 "register_operand" "0,0")))
3370 (clobber (reg:CC 33))]
3375 [(set_attr "op_type" "RRE,RXY")])
3377 (define_insn "*adddi3_imm_cc"
3379 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3380 (match_operand:DI 2 "const_int_operand" "K"))
3382 (set (match_operand:DI 0 "register_operand" "=d")
3383 (plus:DI (match_dup 1) (match_dup 2)))]
3385 && s390_match_ccmode (insn, CCAmode)
3386 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3388 [(set_attr "op_type" "RI")])
3390 (define_insn "*adddi3_carry1_cc"
3392 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3393 (match_operand:DI 2 "general_operand" "d,m"))
3395 (set (match_operand:DI 0 "register_operand" "=d,d")
3396 (plus:DI (match_dup 1) (match_dup 2)))]
3397 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3401 [(set_attr "op_type" "RRE,RXY")])
3403 (define_insn "*adddi3_carry1_cconly"
3405 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3406 (match_operand:DI 2 "general_operand" "d,m"))
3408 (clobber (match_scratch:DI 0 "=d,d"))]
3409 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3413 [(set_attr "op_type" "RRE,RXY")])
3415 (define_insn "*adddi3_carry2_cc"
3417 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3418 (match_operand:DI 2 "general_operand" "d,m"))
3420 (set (match_operand:DI 0 "register_operand" "=d,d")
3421 (plus:DI (match_dup 1) (match_dup 2)))]
3422 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3426 [(set_attr "op_type" "RRE,RXY")])
3428 (define_insn "*adddi3_carry2_cconly"
3430 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3431 (match_operand:DI 2 "general_operand" "d,m"))
3433 (clobber (match_scratch:DI 0 "=d,d"))]
3434 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3438 [(set_attr "op_type" "RRE,RXY")])
3440 (define_insn "*adddi3_cc"
3442 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3443 (match_operand:DI 2 "general_operand" "d,m"))
3445 (set (match_operand:DI 0 "register_operand" "=d,d")
3446 (plus:DI (match_dup 1) (match_dup 2)))]
3447 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3451 [(set_attr "op_type" "RRE,RXY")])
3453 (define_insn "*adddi3_cconly"
3455 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3456 (match_operand:DI 2 "general_operand" "d,m"))
3458 (clobber (match_scratch:DI 0 "=d,d"))]
3459 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3463 [(set_attr "op_type" "RRE,RXY")])
3465 (define_insn "*adddi3_cconly2"
3467 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3468 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3469 (clobber (match_scratch:DI 0 "=d,d"))]
3470 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3474 [(set_attr "op_type" "RRE,RXY")])
3476 (define_insn "*adddi3_64"
3477 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3478 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3479 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3480 (clobber (reg:CC 33))]
3486 [(set_attr "op_type" "RRE,RI,RXY")])
3488 (define_insn_and_split "*adddi3_31z"
3489 [(set (match_operand:DI 0 "register_operand" "=&d")
3490 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3491 (match_operand:DI 2 "general_operand" "do") ) )
3492 (clobber (reg:CC 33))]
3493 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3495 "&& reload_completed"
3498 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3500 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3502 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3503 (ltu:SI (reg:CCL1 33) (const_int 0))))
3504 (clobber (reg:CC 33))])]
3505 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3506 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3507 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3508 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3509 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3510 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
3512 (define_insn_and_split "*adddi3_31"
3513 [(set (match_operand:DI 0 "register_operand" "=&d")
3514 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3515 (match_operand:DI 2 "general_operand" "do") ) )
3516 (clobber (reg:CC 33))]
3519 "&& reload_completed"
3521 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3522 (clobber (reg:CC 33))])
3525 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3527 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3529 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3531 (label_ref (match_dup 9))))
3533 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3534 (clobber (reg:CC 33))])
3536 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3537 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3538 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3539 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3540 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3541 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3542 operands[9] = gen_label_rtx ();")
3544 (define_expand "adddi3"
3546 [(set (match_operand:DI 0 "register_operand" "")
3547 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3548 (match_operand:DI 2 "general_operand" "")))
3549 (clobber (reg:CC 33))])]
3554 ; addsi3 instruction pattern(s).
3557 (define_insn "*addsi3_imm_cc"
3559 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3560 (match_operand:SI 2 "const_int_operand" "K"))
3562 (set (match_operand:SI 0 "register_operand" "=d")
3563 (plus:SI (match_dup 1) (match_dup 2)))]
3564 "s390_match_ccmode (insn, CCAmode)
3565 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3567 [(set_attr "op_type" "RI")])
3569 (define_insn "*addsi3_carry1_cc"
3571 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3572 (match_operand:SI 2 "general_operand" "d,R,T"))
3574 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3575 (plus:SI (match_dup 1) (match_dup 2)))]
3576 "s390_match_ccmode (insn, CCL1mode)"
3581 [(set_attr "op_type" "RR,RX,RXY")])
3583 (define_insn "*addsi3_carry1_cconly"
3585 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3586 (match_operand:SI 2 "general_operand" "d,R,T"))
3588 (clobber (match_scratch:SI 0 "=d,d,d"))]
3589 "s390_match_ccmode (insn, CCL1mode)"
3594 [(set_attr "op_type" "RR,RX,RXY")])
3596 (define_insn "*addsi3_carry2_cc"
3598 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3599 (match_operand:SI 2 "general_operand" "d,R,T"))
3601 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3602 (plus:SI (match_dup 1) (match_dup 2)))]
3603 "s390_match_ccmode (insn, CCL1mode)"
3608 [(set_attr "op_type" "RR,RX,RXY")])
3610 (define_insn "*addsi3_carry2_cconly"
3612 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3613 (match_operand:SI 2 "general_operand" "d,R,T"))
3615 (clobber (match_scratch:SI 0 "=d,d,d"))]
3616 "s390_match_ccmode (insn, CCL1mode)"
3621 [(set_attr "op_type" "RR,RX,RXY")])
3623 (define_insn "*addsi3_cc"
3625 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3626 (match_operand:SI 2 "general_operand" "d,R,T"))
3628 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3629 (plus:SI (match_dup 1) (match_dup 2)))]
3630 "s390_match_ccmode (insn, CCLmode)"
3635 [(set_attr "op_type" "RR,RX,RXY")])
3637 (define_insn "*addsi3_cconly"
3639 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3640 (match_operand:SI 2 "general_operand" "d,R,T"))
3642 (clobber (match_scratch:SI 0 "=d,d,d"))]
3643 "s390_match_ccmode (insn, CCLmode)"
3648 [(set_attr "op_type" "RR,RX,RXY")])
3650 (define_insn "*addsi3_cconly2"
3652 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3653 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3654 (clobber (match_scratch:SI 0 "=d,d,d"))]
3655 "s390_match_ccmode (insn, CCLmode)"
3660 [(set_attr "op_type" "RR,RX,RXY")])
3662 (define_insn "*addsi3_sign"
3663 [(set (match_operand:SI 0 "register_operand" "=d,d")
3664 (plus:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
3665 (match_operand:SI 1 "register_operand" "0,0")))
3666 (clobber (reg:CC 33))]
3671 [(set_attr "op_type" "RX,RXY")])
3673 (define_insn "addsi3"
3674 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3675 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3676 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3677 (clobber (reg:CC 33))]
3684 [(set_attr "op_type" "RR,RI,RX,RXY")])
3687 ; adddf3 instruction pattern(s).
3690 (define_expand "adddf3"
3692 [(set (match_operand:DF 0 "register_operand" "=f,f")
3693 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3694 (match_operand:DF 2 "general_operand" "f,R")))
3695 (clobber (reg:CC 33))])]
3699 (define_insn "*adddf3"
3700 [(set (match_operand:DF 0 "register_operand" "=f,f")
3701 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3702 (match_operand:DF 2 "general_operand" "f,R")))
3703 (clobber (reg:CC 33))]
3704 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3708 [(set_attr "op_type" "RRE,RXE")
3709 (set_attr "type" "fsimpd,fsimpd")])
3711 (define_insn "*adddf3_cc"
3713 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3714 (match_operand:DF 2 "general_operand" "f,R"))
3715 (match_operand:DF 3 "const0_operand" "")))
3716 (set (match_operand:DF 0 "register_operand" "=f,f")
3717 (plus:DF (match_dup 1) (match_dup 2)))]
3718 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3722 [(set_attr "op_type" "RRE,RXE")
3723 (set_attr "type" "fsimpd,fsimpd")])
3725 (define_insn "*adddf3_cconly"
3727 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3728 (match_operand:DF 2 "general_operand" "f,R"))
3729 (match_operand:DF 3 "const0_operand" "")))
3730 (clobber (match_scratch:DF 0 "=f,f"))]
3731 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3735 [(set_attr "op_type" "RRE,RXE")
3736 (set_attr "type" "fsimpd,fsimpd")])
3738 (define_insn "*adddf3_ibm"
3739 [(set (match_operand:DF 0 "register_operand" "=f,f")
3740 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3741 (match_operand:DF 2 "general_operand" "f,R")))
3742 (clobber (reg:CC 33))]
3743 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3747 [(set_attr "op_type" "RR,RX")
3748 (set_attr "type" "fsimpd,fsimpd")])
3751 ; addsf3 instruction pattern(s).
3754 (define_expand "addsf3"
3756 [(set (match_operand:SF 0 "register_operand" "=f,f")
3757 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3758 (match_operand:SF 2 "general_operand" "f,R")))
3759 (clobber (reg:CC 33))])]
3763 (define_insn "*addsf3"
3764 [(set (match_operand:SF 0 "register_operand" "=f,f")
3765 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3766 (match_operand:SF 2 "general_operand" "f,R")))
3767 (clobber (reg:CC 33))]
3768 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3772 [(set_attr "op_type" "RRE,RXE")
3773 (set_attr "type" "fsimps,fsimps")])
3775 (define_insn "*addsf3_cc"
3777 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3778 (match_operand:SF 2 "general_operand" "f,R"))
3779 (match_operand:SF 3 "const0_operand" "")))
3780 (set (match_operand:SF 0 "register_operand" "=f,f")
3781 (plus:SF (match_dup 1) (match_dup 2)))]
3782 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3786 [(set_attr "op_type" "RRE,RXE")
3787 (set_attr "type" "fsimps,fsimps")])
3789 (define_insn "*addsf3_cconly"
3791 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3792 (match_operand:SF 2 "general_operand" "f,R"))
3793 (match_operand:SF 3 "const0_operand" "")))
3794 (clobber (match_scratch:SF 0 "=f,f"))]
3795 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3799 [(set_attr "op_type" "RRE,RXE")
3800 (set_attr "type" "fsimps,fsimps")])
3802 (define_insn "*addsf3"
3803 [(set (match_operand:SF 0 "register_operand" "=f,f")
3804 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3805 (match_operand:SF 2 "general_operand" "f,R")))
3806 (clobber (reg:CC 33))]
3807 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3811 [(set_attr "op_type" "RR,RX")
3812 (set_attr "type" "fsimps,fsimps")])
3816 ;;- Subtract instructions.
3820 ; subti3 instruction pattern(s).
3823 (define_insn_and_split "subti3"
3824 [(set (match_operand:TI 0 "register_operand" "=&d")
3825 (minus:TI (match_operand:TI 1 "register_operand" "0")
3826 (match_operand:TI 2 "general_operand" "do") ) )
3827 (clobber (reg:CC 33))]
3830 "&& reload_completed"
3833 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
3835 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
3837 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
3838 (gtu:DI (reg:CCL2 33) (const_int 0))))
3839 (clobber (reg:CC 33))])]
3840 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3841 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3842 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3843 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3844 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3845 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
3848 ; subdi3 instruction pattern(s).
3851 (define_insn "*subdi3_sign"
3852 [(set (match_operand:DI 0 "register_operand" "=d,d")
3853 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3854 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3855 (clobber (reg:CC 33))]
3860 [(set_attr "op_type" "RRE,RXY")])
3862 (define_insn "*subdi3_zero_cc"
3864 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3865 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3867 (set (match_operand:DI 0 "register_operand" "=d,d")
3868 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3869 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3873 [(set_attr "op_type" "RRE,RXY")])
3875 (define_insn "*subdi3_zero_cconly"
3877 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3878 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3880 (clobber (match_scratch:DI 0 "=d,d"))]
3881 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3885 [(set_attr "op_type" "RRE,RXY")])
3887 (define_insn "*subdi3_zero"
3888 [(set (match_operand:DI 0 "register_operand" "=d,d")
3889 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3890 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3891 (clobber (reg:CC 33))]
3896 [(set_attr "op_type" "RRE,RXY")])
3898 (define_insn "*subdi3_borrow_cc"
3900 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3901 (match_operand:DI 2 "general_operand" "d,m"))
3903 (set (match_operand:DI 0 "register_operand" "=d,d")
3904 (minus:DI (match_dup 1) (match_dup 2)))]
3905 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3909 [(set_attr "op_type" "RRE,RXY")])
3911 (define_insn "*subdi3_borrow_cconly"
3913 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3914 (match_operand:DI 2 "general_operand" "d,m"))
3916 (clobber (match_scratch:DI 0 "=d,d"))]
3917 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3921 [(set_attr "op_type" "RRE,RXY")])
3923 (define_insn "*subdi3_cc"
3925 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3926 (match_operand:DI 2 "general_operand" "d,m"))
3928 (set (match_operand:DI 0 "register_operand" "=d,d")
3929 (minus:DI (match_dup 1) (match_dup 2)))]
3930 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3934 [(set_attr "op_type" "RRE,RXY")])
3936 (define_insn "*subdi3_cc2"
3938 (compare (match_operand:DI 1 "register_operand" "0,0")
3939 (match_operand:DI 2 "general_operand" "d,m")))
3940 (set (match_operand:DI 0 "register_operand" "=d,d")
3941 (minus:DI (match_dup 1) (match_dup 2)))]
3942 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3946 [(set_attr "op_type" "RRE,RXY")])
3948 (define_insn "*subdi3_cconly"
3950 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3951 (match_operand:DI 2 "general_operand" "d,m"))
3953 (clobber (match_scratch:DI 0 "=d,d"))]
3954 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3958 [(set_attr "op_type" "RRE,RXY")])
3960 (define_insn "*subdi3_cconly2"
3962 (compare (match_operand:DI 1 "register_operand" "0,0")
3963 (match_operand:DI 2 "general_operand" "d,m")))
3964 (clobber (match_scratch:DI 0 "=d,d"))]
3965 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3969 [(set_attr "op_type" "RRE,RXY")])
3971 (define_insn "*subdi3_64"
3972 [(set (match_operand:DI 0 "register_operand" "=d,d")
3973 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3974 (match_operand:DI 2 "general_operand" "d,m") ) )
3975 (clobber (reg:CC 33))]
3980 [(set_attr "op_type" "RRE,RRE")])
3982 (define_insn_and_split "*subdi3_31z"
3983 [(set (match_operand:DI 0 "register_operand" "=&d")
3984 (minus:DI (match_operand:DI 1 "register_operand" "0")
3985 (match_operand:DI 2 "general_operand" "do") ) )
3986 (clobber (reg:CC 33))]
3987 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3989 "&& reload_completed"
3992 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3994 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3996 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3997 (gtu:SI (reg:CCL2 33) (const_int 0))))
3998 (clobber (reg:CC 33))])]
3999 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
4000 operands[4] = operand_subword (operands[1], 0, 0, DImode);
4001 operands[5] = operand_subword (operands[2], 0, 0, DImode);
4002 operands[6] = operand_subword (operands[0], 1, 0, DImode);
4003 operands[7] = operand_subword (operands[1], 1, 0, DImode);
4004 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
4006 (define_insn_and_split "*subdi3_31"
4007 [(set (match_operand:DI 0 "register_operand" "=&d")
4008 (minus:DI (match_operand:DI 1 "register_operand" "0")
4009 (match_operand:DI 2 "general_operand" "do") ) )
4010 (clobber (reg:CC 33))]
4013 "&& reload_completed"
4015 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
4016 (clobber (reg:CC 33))])
4019 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
4021 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
4023 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
4025 (label_ref (match_dup 9))))
4027 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
4028 (clobber (reg:CC 33))])
4030 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
4031 operands[4] = operand_subword (operands[1], 0, 0, DImode);
4032 operands[5] = operand_subword (operands[2], 0, 0, DImode);
4033 operands[6] = operand_subword (operands[0], 1, 0, DImode);
4034 operands[7] = operand_subword (operands[1], 1, 0, DImode);
4035 operands[8] = operand_subword (operands[2], 1, 0, DImode);
4036 operands[9] = gen_label_rtx ();")
4038 (define_expand "subdi3"
4040 [(set (match_operand:DI 0 "register_operand" "")
4041 (minus:DI (match_operand:DI 1 "register_operand" "")
4042 (match_operand:DI 2 "general_operand" "")))
4043 (clobber (reg:CC 33))])]
4048 ; subsi3 instruction pattern(s).
4051 (define_insn "*subsi3_borrow_cc"
4053 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4054 (match_operand:SI 2 "general_operand" "d,R,T"))
4056 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4057 (minus:SI (match_dup 1) (match_dup 2)))]
4058 "s390_match_ccmode (insn, CCL2mode)"
4063 [(set_attr "op_type" "RR,RX,RXY")])
4065 (define_insn "*subsi3_borrow_cconly"
4067 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4068 (match_operand:SI 2 "general_operand" "d,R,T"))
4070 (clobber (match_scratch:SI 0 "=d,d,d"))]
4071 "s390_match_ccmode (insn, CCL2mode)"
4076 [(set_attr "op_type" "RR,RX,RXY")])
4078 (define_insn "*subsi3_cc"
4080 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4081 (match_operand:SI 2 "general_operand" "d,R,T"))
4083 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4084 (minus:SI (match_dup 1) (match_dup 2)))]
4085 "s390_match_ccmode (insn, CCLmode)"
4090 [(set_attr "op_type" "RR,RX,RXY")])
4092 (define_insn "*subsi3_cc2"
4094 (compare (match_operand:SI 1 "register_operand" "0,0,0")
4095 (match_operand:SI 2 "general_operand" "d,R,T")))
4096 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4097 (minus:SI (match_dup 1) (match_dup 2)))]
4098 "s390_match_ccmode (insn, CCL3mode)"
4103 [(set_attr "op_type" "RR,RX,RXY")])
4105 (define_insn "*subsi3_cconly"
4107 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4108 (match_operand:SI 2 "general_operand" "d,R,T"))
4110 (clobber (match_scratch:SI 0 "=d,d,d"))]
4111 "s390_match_ccmode (insn, CCLmode)"
4116 [(set_attr "op_type" "RR,RX,RXY")])
4118 (define_insn "*subsi3_cconly2"
4120 (compare (match_operand:SI 1 "register_operand" "0,0,0")
4121 (match_operand:SI 2 "general_operand" "d,R,T")))
4122 (clobber (match_scratch:SI 0 "=d,d,d"))]
4123 "s390_match_ccmode (insn, CCL3mode)"
4128 [(set_attr "op_type" "RR,RX,RXY")])
4130 (define_insn "*subsi3_sign"
4131 [(set (match_operand:SI 0 "register_operand" "=d,d")
4132 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
4133 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4134 (clobber (reg:CC 33))]
4139 [(set_attr "op_type" "RX,RXY")])
4141 (define_insn "subsi3"
4142 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4143 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4144 (match_operand:SI 2 "general_operand" "d,R,T")))
4145 (clobber (reg:CC 33))]
4151 [(set_attr "op_type" "RR,RX,RXY")])
4155 ; subdf3 instruction pattern(s).
4158 (define_expand "subdf3"
4160 [(set (match_operand:DF 0 "register_operand" "=f,f")
4161 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4162 (match_operand:DF 2 "general_operand" "f,R")))
4163 (clobber (reg:CC 33))])]
4167 (define_insn "*subdf3"
4168 [(set (match_operand:DF 0 "register_operand" "=f,f")
4169 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4170 (match_operand:DF 2 "general_operand" "f,R")))
4171 (clobber (reg:CC 33))]
4172 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4176 [(set_attr "op_type" "RRE,RXE")
4177 (set_attr "type" "fsimpd,fsimpd")])
4179 (define_insn "*subdf3_cc"
4181 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4182 (match_operand:DF 2 "general_operand" "f,R"))
4183 (match_operand:DF 3 "const0_operand" "")))
4184 (set (match_operand:DF 0 "register_operand" "=f,f")
4185 (minus:DF (match_dup 1) (match_dup 2)))]
4186 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4190 [(set_attr "op_type" "RRE,RXE")
4191 (set_attr "type" "fsimpd,fsimpd")])
4193 (define_insn "*subdf3_cconly"
4195 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4196 (match_operand:DF 2 "general_operand" "f,R"))
4197 (match_operand:DF 3 "const0_operand" "")))
4198 (clobber (match_scratch:DF 0 "=f,f"))]
4199 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4203 [(set_attr "op_type" "RRE,RXE")
4204 (set_attr "type" "fsimpd,fsimpd")])
4206 (define_insn "*subdf3_ibm"
4207 [(set (match_operand:DF 0 "register_operand" "=f,f")
4208 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4209 (match_operand:DF 2 "general_operand" "f,R")))
4210 (clobber (reg:CC 33))]
4211 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4215 [(set_attr "op_type" "RR,RX")
4216 (set_attr "type" "fsimpd,fsimpd")])
4219 ; subsf3 instruction pattern(s).
4222 (define_expand "subsf3"
4224 [(set (match_operand:SF 0 "register_operand" "=f,f")
4225 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4226 (match_operand:SF 2 "general_operand" "f,R")))
4227 (clobber (reg:CC 33))])]
4231 (define_insn "*subsf3"
4232 [(set (match_operand:SF 0 "register_operand" "=f,f")
4233 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4234 (match_operand:SF 2 "general_operand" "f,R")))
4235 (clobber (reg:CC 33))]
4236 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4240 [(set_attr "op_type" "RRE,RXE")
4241 (set_attr "type" "fsimps,fsimps")])
4243 (define_insn "*subsf3_cc"
4245 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4246 (match_operand:SF 2 "general_operand" "f,R"))
4247 (match_operand:SF 3 "const0_operand" "")))
4248 (set (match_operand:SF 0 "register_operand" "=f,f")
4249 (minus:SF (match_dup 1) (match_dup 2)))]
4250 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4254 [(set_attr "op_type" "RRE,RXE")
4255 (set_attr "type" "fsimps,fsimps")])
4257 (define_insn "*subsf3_cconly"
4259 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4260 (match_operand:SF 2 "general_operand" "f,R"))
4261 (match_operand:SF 3 "const0_operand" "")))
4262 (clobber (match_scratch:SF 0 "=f,f"))]
4263 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4267 [(set_attr "op_type" "RRE,RXE")
4268 (set_attr "type" "fsimps,fsimps")])
4270 (define_insn "*subsf3_ibm"
4271 [(set (match_operand:SF 0 "register_operand" "=f,f")
4272 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4273 (match_operand:SF 2 "general_operand" "f,R")))
4274 (clobber (reg:CC 33))]
4275 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4279 [(set_attr "op_type" "RR,RX")
4280 (set_attr "type" "fsimps,fsimps")])
4284 ;;- Conditional add/subtract instructions.
4288 ; adddicc instruction pattern(s).
4291 (define_insn "*adddi3_alc_cc"
4294 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4295 (match_operand:DI 2 "general_operand" "d,m"))
4296 (match_operand:DI 3 "s390_alc_comparison" ""))
4298 (set (match_operand:DI 0 "register_operand" "=d,d")
4299 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4300 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4304 [(set_attr "op_type" "RRE,RXY")])
4306 (define_insn "*adddi3_alc"
4307 [(set (match_operand:DI 0 "register_operand" "=d,d")
4308 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4309 (match_operand:DI 2 "general_operand" "d,m"))
4310 (match_operand:DI 3 "s390_alc_comparison" "")))
4311 (clobber (reg:CC 33))]
4316 [(set_attr "op_type" "RRE,RXY")])
4318 (define_insn "*subdi3_slb_cc"
4321 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4322 (match_operand:DI 2 "general_operand" "d,m"))
4323 (match_operand:DI 3 "s390_slb_comparison" ""))
4325 (set (match_operand:DI 0 "register_operand" "=d,d")
4326 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4327 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4331 [(set_attr "op_type" "RRE,RXY")])
4333 (define_insn "*subdi3_slb"
4334 [(set (match_operand:DI 0 "register_operand" "=d,d")
4335 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4336 (match_operand:DI 2 "general_operand" "d,m"))
4337 (match_operand:DI 3 "s390_slb_comparison" "")))
4338 (clobber (reg:CC 33))]
4343 [(set_attr "op_type" "RRE,RXY")])
4345 (define_expand "adddicc"
4346 [(match_operand:DI 0 "register_operand" "")
4347 (match_operand 1 "comparison_operator" "")
4348 (match_operand:DI 2 "register_operand" "")
4349 (match_operand:DI 3 "const_int_operand" "")]
4351 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4352 s390_compare_op0, s390_compare_op1,
4353 operands[0], operands[2],
4354 operands[3])) FAIL; DONE;")
4357 ; addsicc instruction pattern(s).
4360 (define_insn "*addsi3_alc_cc"
4363 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4364 (match_operand:SI 2 "general_operand" "d,m"))
4365 (match_operand:SI 3 "s390_alc_comparison" ""))
4367 (set (match_operand:SI 0 "register_operand" "=d,d")
4368 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4369 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4373 [(set_attr "op_type" "RRE,RXY")])
4375 (define_insn "*addsi3_alc"
4376 [(set (match_operand:SI 0 "register_operand" "=d,d")
4377 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4378 (match_operand:SI 2 "general_operand" "d,m"))
4379 (match_operand:SI 3 "s390_alc_comparison" "")))
4380 (clobber (reg:CC 33))]
4385 [(set_attr "op_type" "RRE,RXY")])
4387 (define_insn "*subsi3_slb_cc"
4390 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4391 (match_operand:SI 2 "general_operand" "d,m"))
4392 (match_operand:SI 3 "s390_slb_comparison" ""))
4394 (set (match_operand:SI 0 "register_operand" "=d,d")
4395 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4396 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4400 [(set_attr "op_type" "RRE,RXY")])
4402 (define_insn "*subsi3_slb"
4403 [(set (match_operand:SI 0 "register_operand" "=d,d")
4404 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4405 (match_operand:SI 2 "general_operand" "d,m"))
4406 (match_operand:SI 3 "s390_slb_comparison" "")))
4407 (clobber (reg:CC 33))]
4412 [(set_attr "op_type" "RRE,RXY")])
4414 (define_expand "addsicc"
4415 [(match_operand:SI 0 "register_operand" "")
4416 (match_operand 1 "comparison_operator" "")
4417 (match_operand:SI 2 "register_operand" "")
4418 (match_operand:SI 3 "const_int_operand" "")]
4420 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4421 s390_compare_op0, s390_compare_op1,
4422 operands[0], operands[2],
4423 operands[3])) FAIL; DONE;")
4426 ; scond instruction pattern(s).
4429 (define_insn_and_split "*sconddi"
4430 [(set (match_operand:DI 0 "register_operand" "=&d")
4431 (match_operand:DI 1 "s390_alc_comparison" ""))
4432 (clobber (reg:CC 33))]
4435 "&& reload_completed"
4436 [(set (match_dup 0) (const_int 0))
4438 [(set (match_dup 0) (plus:DI (plus:DI (match_dup 0) (match_dup 0))
4440 (clobber (reg:CC 33))])]
4443 (define_insn_and_split "*scondsi"
4444 [(set (match_operand:SI 0 "register_operand" "=&d")
4445 (match_operand:SI 1 "s390_alc_comparison" ""))
4446 (clobber (reg:CC 33))]
4449 "&& reload_completed"
4450 [(set (match_dup 0) (const_int 0))
4452 [(set (match_dup 0) (plus:SI (plus:SI (match_dup 0) (match_dup 0))
4454 (clobber (reg:CC 33))])]
4457 (define_insn_and_split "*sconddi_neg"
4458 [(set (match_operand:DI 0 "register_operand" "=&d")
4459 (match_operand:DI 1 "s390_slb_comparison" ""))
4460 (clobber (reg:CC 33))]
4463 "&& reload_completed"
4464 [(set (match_dup 0) (const_int 0))
4466 [(set (match_dup 0) (minus:DI (minus:DI (match_dup 0) (match_dup 0))
4468 (clobber (reg:CC 33))])
4470 [(set (match_dup 0) (neg:DI (match_dup 0)))
4471 (clobber (reg:CC 33))])]
4474 (define_insn_and_split "*scondsi_neg"
4475 [(set (match_operand:SI 0 "register_operand" "=&d")
4476 (match_operand:SI 1 "s390_slb_comparison" ""))
4477 (clobber (reg:CC 33))]
4480 "&& reload_completed"
4481 [(set (match_dup 0) (const_int 0))
4483 [(set (match_dup 0) (minus:SI (minus:SI (match_dup 0) (match_dup 0))
4485 (clobber (reg:CC 33))])
4487 [(set (match_dup 0) (neg:SI (match_dup 0)))
4488 (clobber (reg:CC 33))])]
4491 (define_expand "sltu"
4492 [(match_operand:SI 0 "register_operand" "")]
4494 "if (!s390_expand_addcc (LTU, s390_compare_op0, s390_compare_op1,
4495 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4497 (define_expand "sgtu"
4498 [(match_operand:SI 0 "register_operand" "")]
4500 "if (!s390_expand_addcc (GTU, s390_compare_op0, s390_compare_op1,
4501 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4503 (define_expand "sleu"
4504 [(match_operand:SI 0 "register_operand" "")]
4506 "if (!s390_expand_addcc (LEU, s390_compare_op0, s390_compare_op1,
4507 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4509 (define_expand "sgeu"
4510 [(match_operand:SI 0 "register_operand" "")]
4512 "if (!s390_expand_addcc (GEU, s390_compare_op0, s390_compare_op1,
4513 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4517 ;;- Multiply instructions.
4521 ; muldi3 instruction pattern(s).
4524 (define_insn "*muldi3_sign"
4525 [(set (match_operand:DI 0 "register_operand" "=d,d")
4526 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4527 (match_operand:DI 1 "register_operand" "0,0")))]
4532 [(set_attr "op_type" "RRE,RXY")
4533 (set_attr "type" "imul")])
4535 (define_insn "muldi3"
4536 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4537 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4538 (match_operand:DI 2 "general_operand" "d,K,m")))]
4544 [(set_attr "op_type" "RRE,RI,RXY")
4545 (set_attr "type" "imul")])
4548 ; mulsi3 instruction pattern(s).
4551 (define_insn "*mulsi3_sign"
4552 [(set (match_operand:SI 0 "register_operand" "=d")
4553 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4554 (match_operand:SI 1 "register_operand" "0")))]
4557 [(set_attr "op_type" "RX")
4558 (set_attr "type" "imul")])
4560 (define_insn "mulsi3"
4561 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4562 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4563 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4570 [(set_attr "op_type" "RRE,RI,RX,RXY")
4571 (set_attr "type" "imul")])
4574 ; mulsidi3 instruction pattern(s).
4577 (define_insn "mulsidi3"
4578 [(set (match_operand:DI 0 "register_operand" "=d,d")
4579 (mult:DI (sign_extend:DI
4580 (match_operand:SI 1 "register_operand" "%0,0"))
4582 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4587 [(set_attr "op_type" "RR,RX")
4588 (set_attr "type" "imul")])
4591 ; umulsidi3 instruction pattern(s).
4594 (define_insn "umulsidi3"
4595 [(set (match_operand:DI 0 "register_operand" "=d,d")
4596 (mult:DI (zero_extend:DI
4597 (match_operand:SI 1 "register_operand" "%0,0"))
4599 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4600 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4604 [(set_attr "op_type" "RRE,RXY")
4605 (set_attr "type" "imul")])
4608 ; muldf3 instruction pattern(s).
4611 (define_expand "muldf3"
4612 [(set (match_operand:DF 0 "register_operand" "=f,f")
4613 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4614 (match_operand:DF 2 "general_operand" "f,R")))]
4618 (define_insn "*muldf3"
4619 [(set (match_operand:DF 0 "register_operand" "=f,f")
4620 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4621 (match_operand:DF 2 "general_operand" "f,R")))]
4622 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4626 [(set_attr "op_type" "RRE,RXE")
4627 (set_attr "type" "fmuld")])
4629 (define_insn "*muldf3_ibm"
4630 [(set (match_operand:DF 0 "register_operand" "=f,f")
4631 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4632 (match_operand:DF 2 "general_operand" "f,R")))]
4633 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4637 [(set_attr "op_type" "RR,RX")
4638 (set_attr "type" "fmuld")])
4640 (define_insn "*fmadddf"
4641 [(set (match_operand:DF 0 "register_operand" "=f,f")
4642 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4643 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4644 (match_operand:DF 3 "register_operand" "0,0")))]
4645 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4649 [(set_attr "op_type" "RRE,RXE")
4650 (set_attr "type" "fmuld")])
4652 (define_insn "*fmsubdf"
4653 [(set (match_operand:DF 0 "register_operand" "=f,f")
4654 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4655 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4656 (match_operand:DF 3 "register_operand" "0,0")))]
4657 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4661 [(set_attr "op_type" "RRE,RXE")
4662 (set_attr "type" "fmuld")])
4665 ; mulsf3 instruction pattern(s).
4668 (define_expand "mulsf3"
4669 [(set (match_operand:SF 0 "register_operand" "=f,f")
4670 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4671 (match_operand:SF 2 "general_operand" "f,R")))]
4675 (define_insn "*mulsf3"
4676 [(set (match_operand:SF 0 "register_operand" "=f,f")
4677 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4678 (match_operand:SF 2 "general_operand" "f,R")))]
4679 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4683 [(set_attr "op_type" "RRE,RXE")
4684 (set_attr "type" "fmuls")])
4686 (define_insn "*mulsf3_ibm"
4687 [(set (match_operand:SF 0 "register_operand" "=f,f")
4688 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4689 (match_operand:SF 2 "general_operand" "f,R")))]
4690 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4694 [(set_attr "op_type" "RR,RX")
4695 (set_attr "type" "fmuls")])
4697 (define_insn "*fmaddsf"
4698 [(set (match_operand:SF 0 "register_operand" "=f,f")
4699 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4700 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4701 (match_operand:SF 3 "register_operand" "0,0")))]
4702 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4706 [(set_attr "op_type" "RRE,RXE")
4707 (set_attr "type" "fmuls")])
4709 (define_insn "*fmsubsf"
4710 [(set (match_operand:SF 0 "register_operand" "=f,f")
4711 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4712 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4713 (match_operand:SF 3 "register_operand" "0,0")))]
4714 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4718 [(set_attr "op_type" "RRE,RXE")
4719 (set_attr "type" "fmuls")])
4722 ;;- Divide and modulo instructions.
4726 ; divmoddi4 instruction pattern(s).
4729 (define_expand "divmoddi4"
4730 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4731 (div:DI (match_operand:DI 1 "register_operand" "")
4732 (match_operand:DI 2 "general_operand" "")))
4733 (set (match_operand:DI 3 "general_operand" "")
4734 (mod:DI (match_dup 1) (match_dup 2)))])
4735 (clobber (match_dup 4))]
4738 rtx insn, div_equal, mod_equal;
4740 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4741 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4743 operands[4] = gen_reg_rtx(TImode);
4744 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4746 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4748 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4750 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4752 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4757 (define_insn "divmodtidi3"
4758 [(set (match_operand:TI 0 "register_operand" "=d,d")
4762 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4763 (match_operand:DI 2 "general_operand" "d,m")))
4765 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
4770 [(set_attr "op_type" "RRE,RXY")
4771 (set_attr "type" "idiv")])
4773 (define_insn "divmodtisi3"
4774 [(set (match_operand:TI 0 "register_operand" "=d,d")
4778 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4780 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4783 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
4788 [(set_attr "op_type" "RRE,RXY")
4789 (set_attr "type" "idiv")])
4792 ; udivmoddi4 instruction pattern(s).
4795 (define_expand "udivmoddi4"
4796 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4797 (udiv:DI (match_operand:DI 1 "general_operand" "")
4798 (match_operand:DI 2 "nonimmediate_operand" "")))
4799 (set (match_operand:DI 3 "general_operand" "")
4800 (umod:DI (match_dup 1) (match_dup 2)))])
4801 (clobber (match_dup 4))]
4804 rtx insn, div_equal, mod_equal, equal;
4806 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4807 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4808 equal = gen_rtx_IOR (TImode,
4809 gen_rtx_ASHIFT (TImode,
4810 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4812 gen_rtx_ZERO_EXTEND (TImode, div_equal));
4814 operands[4] = gen_reg_rtx(TImode);
4815 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4816 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4817 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4818 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4820 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4822 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4824 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4826 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4828 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4833 (define_insn "udivmodtidi3"
4834 [(set (match_operand:TI 0 "register_operand" "=d,d")
4839 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
4841 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4845 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
4850 [(set_attr "op_type" "RRE,RXY")
4851 (set_attr "type" "idiv")])
4854 ; divmodsi4 instruction pattern(s).
4857 (define_expand "divmodsi4"
4858 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4859 (div:SI (match_operand:SI 1 "general_operand" "")
4860 (match_operand:SI 2 "nonimmediate_operand" "")))
4861 (set (match_operand:SI 3 "general_operand" "")
4862 (mod:SI (match_dup 1) (match_dup 2)))])
4863 (clobber (match_dup 4))]
4866 rtx insn, div_equal, mod_equal, equal;
4868 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4869 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4870 equal = gen_rtx_IOR (DImode,
4871 gen_rtx_ASHIFT (DImode,
4872 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4874 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4876 operands[4] = gen_reg_rtx(DImode);
4877 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4878 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4880 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4882 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4884 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4886 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4888 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4893 (define_insn "divmoddisi3"
4894 [(set (match_operand:DI 0 "register_operand" "=d,d")
4899 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4901 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4905 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
4910 [(set_attr "op_type" "RR,RX")
4911 (set_attr "type" "idiv")])
4914 ; udivsi3 and umodsi3 instruction pattern(s).
4917 (define_expand "udivmodsi4"
4918 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4919 (udiv:SI (match_operand:SI 1 "general_operand" "")
4920 (match_operand:SI 2 "nonimmediate_operand" "")))
4921 (set (match_operand:SI 3 "general_operand" "")
4922 (umod:SI (match_dup 1) (match_dup 2)))])
4923 (clobber (match_dup 4))]
4924 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4926 rtx insn, div_equal, mod_equal, equal;
4928 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4929 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4930 equal = gen_rtx_IOR (DImode,
4931 gen_rtx_ASHIFT (DImode,
4932 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4934 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4936 operands[4] = gen_reg_rtx(DImode);
4937 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4938 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4939 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4940 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4942 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4944 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4946 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4948 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4950 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4955 (define_insn "udivmoddisi3"
4956 [(set (match_operand:DI 0 "register_operand" "=d,d")
4961 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
4963 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4967 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
4968 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4972 [(set_attr "op_type" "RRE,RXY")
4973 (set_attr "type" "idiv")])
4975 (define_expand "udivsi3"
4976 [(set (match_operand:SI 0 "register_operand" "=d")
4977 (udiv:SI (match_operand:SI 1 "general_operand" "")
4978 (match_operand:SI 2 "general_operand" "")))
4979 (clobber (match_dup 3))]
4980 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4982 rtx insn, udiv_equal, umod_equal, equal;
4984 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4985 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4986 equal = gen_rtx_IOR (DImode,
4987 gen_rtx_ASHIFT (DImode,
4988 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4990 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4992 operands[3] = gen_reg_rtx (DImode);
4994 if (CONSTANT_P (operands[2]))
4996 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4998 rtx label1 = gen_label_rtx ();
5000 operands[1] = make_safe_from (operands[1], operands[0]);
5001 emit_move_insn (operands[0], const0_rtx);
5002 emit_insn (gen_cmpsi (operands[1], operands[2]));
5003 emit_jump_insn (gen_bltu (label1));
5004 emit_move_insn (operands[0], const1_rtx);
5005 emit_label (label1);
5009 operands[2] = force_reg (SImode, operands[2]);
5010 operands[2] = make_safe_from (operands[2], operands[0]);
5012 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5013 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5016 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5018 insn = emit_move_insn (operands[0],
5019 gen_lowpart (SImode, operands[3]));
5021 gen_rtx_EXPR_LIST (REG_EQUAL,
5022 udiv_equal, REG_NOTES (insn));
5027 rtx label1 = gen_label_rtx ();
5028 rtx label2 = gen_label_rtx ();
5029 rtx label3 = gen_label_rtx ();
5031 operands[1] = force_reg (SImode, operands[1]);
5032 operands[1] = make_safe_from (operands[1], operands[0]);
5033 operands[2] = force_reg (SImode, operands[2]);
5034 operands[2] = make_safe_from (operands[2], operands[0]);
5036 emit_move_insn (operands[0], const0_rtx);
5037 emit_insn (gen_cmpsi (operands[2], operands[1]));
5038 emit_jump_insn (gen_bgtu (label3));
5039 emit_insn (gen_cmpsi (operands[2], const0_rtx));
5040 emit_jump_insn (gen_blt (label2));
5041 emit_insn (gen_cmpsi (operands[2], const1_rtx));
5042 emit_jump_insn (gen_beq (label1));
5043 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5044 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5047 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5049 insn = emit_move_insn (operands[0],
5050 gen_lowpart (SImode, operands[3]));
5052 gen_rtx_EXPR_LIST (REG_EQUAL,
5053 udiv_equal, REG_NOTES (insn));
5055 emit_label (label1);
5056 emit_move_insn (operands[0], operands[1]);
5058 emit_label (label2);
5059 emit_move_insn (operands[0], const1_rtx);
5060 emit_label (label3);
5062 emit_move_insn (operands[0], operands[0]);
5066 (define_expand "umodsi3"
5067 [(set (match_operand:SI 0 "register_operand" "=d")
5068 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
5069 (match_operand:SI 2 "nonimmediate_operand" "")))
5070 (clobber (match_dup 3))]
5071 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
5073 rtx insn, udiv_equal, umod_equal, equal;
5075 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
5076 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
5077 equal = gen_rtx_IOR (DImode,
5078 gen_rtx_ASHIFT (DImode,
5079 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
5081 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
5083 operands[3] = gen_reg_rtx (DImode);
5085 if (CONSTANT_P (operands[2]))
5087 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
5089 rtx label1 = gen_label_rtx ();
5091 operands[1] = make_safe_from (operands[1], operands[0]);
5092 emit_move_insn (operands[0], operands[1]);
5093 emit_insn (gen_cmpsi (operands[0], operands[2]));
5094 emit_jump_insn (gen_bltu (label1));
5095 emit_insn (gen_abssi2 (operands[0], operands[2]));
5096 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
5097 emit_label (label1);
5101 operands[2] = force_reg (SImode, operands[2]);
5102 operands[2] = make_safe_from (operands[2], operands[0]);
5104 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5105 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5108 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5110 insn = emit_move_insn (operands[0],
5111 gen_highpart (SImode, operands[3]));
5113 gen_rtx_EXPR_LIST (REG_EQUAL,
5114 umod_equal, REG_NOTES (insn));
5119 rtx label1 = gen_label_rtx ();
5120 rtx label2 = gen_label_rtx ();
5121 rtx label3 = gen_label_rtx ();
5123 operands[1] = force_reg (SImode, operands[1]);
5124 operands[1] = make_safe_from (operands[1], operands[0]);
5125 operands[2] = force_reg (SImode, operands[2]);
5126 operands[2] = make_safe_from (operands[2], operands[0]);
5128 emit_move_insn(operands[0], operands[1]);
5129 emit_insn (gen_cmpsi (operands[2], operands[1]));
5130 emit_jump_insn (gen_bgtu (label3));
5131 emit_insn (gen_cmpsi (operands[2], const0_rtx));
5132 emit_jump_insn (gen_blt (label2));
5133 emit_insn (gen_cmpsi (operands[2], const1_rtx));
5134 emit_jump_insn (gen_beq (label1));
5135 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5136 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5139 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5141 insn = emit_move_insn (operands[0],
5142 gen_highpart (SImode, operands[3]));
5144 gen_rtx_EXPR_LIST (REG_EQUAL,
5145 umod_equal, REG_NOTES (insn));
5147 emit_label (label1);
5148 emit_move_insn (operands[0], const0_rtx);
5150 emit_label (label2);
5151 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
5152 emit_label (label3);
5158 ; divdf3 instruction pattern(s).
5161 (define_expand "divdf3"
5162 [(set (match_operand:DF 0 "register_operand" "=f,f")
5163 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5164 (match_operand:DF 2 "general_operand" "f,R")))]
5168 (define_insn "*divdf3"
5169 [(set (match_operand:DF 0 "register_operand" "=f,f")
5170 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5171 (match_operand:DF 2 "general_operand" "f,R")))]
5172 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5176 [(set_attr "op_type" "RRE,RXE")
5177 (set_attr "type" "fdivd")])
5179 (define_insn "*divdf3_ibm"
5180 [(set (match_operand:DF 0 "register_operand" "=f,f")
5181 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5182 (match_operand:DF 2 "general_operand" "f,R")))]
5183 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5187 [(set_attr "op_type" "RR,RX")
5188 (set_attr "type" "fdivd")])
5191 ; divsf3 instruction pattern(s).
5194 (define_expand "divsf3"
5195 [(set (match_operand:SF 0 "register_operand" "=f,f")
5196 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5197 (match_operand:SF 2 "general_operand" "f,R")))]
5201 (define_insn "*divsf3"
5202 [(set (match_operand:SF 0 "register_operand" "=f,f")
5203 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5204 (match_operand:SF 2 "general_operand" "f,R")))]
5205 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5209 [(set_attr "op_type" "RRE,RXE")
5210 (set_attr "type" "fdivs")])
5212 (define_insn "*divsf3"
5213 [(set (match_operand:SF 0 "register_operand" "=f,f")
5214 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5215 (match_operand:SF 2 "general_operand" "f,R")))]
5216 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5220 [(set_attr "op_type" "RR,RX")
5221 (set_attr "type" "fdivs")])
5225 ;;- And instructions.
5229 ; anddi3 instruction pattern(s).
5232 (define_insn "*anddi3_cc"
5234 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5235 (match_operand:DI 2 "general_operand" "d,m"))
5237 (set (match_operand:DI 0 "register_operand" "=d,d")
5238 (and:DI (match_dup 1) (match_dup 2)))]
5239 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5243 [(set_attr "op_type" "RRE,RXY")])
5245 (define_insn "*anddi3_cconly"
5247 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5248 (match_operand:DI 2 "general_operand" "d,m"))
5250 (clobber (match_scratch:DI 0 "=d,d"))]
5251 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
5252 /* Do not steal TM patterns. */
5253 && s390_single_part (operands[2], DImode, HImode, 0) < 0"
5257 [(set_attr "op_type" "RRE,RXY")])
5259 (define_insn "*anddi3"
5260 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q")
5261 (and:DI (match_operand:DI 1 "nonimmediate_operand"
5262 "%d,o,0,0,0,0,0,0,0,0")
5263 (match_operand:DI 2 "general_operand"
5264 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m,NxQDF,Q")))
5265 (clobber (reg:CC 33))]
5266 "TARGET_64BIT && s390_logical_operator_ok_p (operands)"
5278 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY,SI,SS")])
5281 [(set (match_operand:DI 0 "s_operand" "")
5282 (and:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5283 (clobber (reg:CC 33))]
5286 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5287 (clobber (reg:CC 33))])]
5288 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5290 (define_expand "anddi3"
5291 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5292 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
5293 (match_operand:DI 2 "general_operand" "")))
5294 (clobber (reg:CC 33))]
5296 "s390_expand_logical_operator (AND, DImode, operands); DONE;")
5299 ; andsi3 instruction pattern(s).
5302 (define_insn "*andsi3_cc"
5304 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5305 (match_operand:SI 2 "general_operand" "d,R,T"))
5307 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5308 (and:SI (match_dup 1) (match_dup 2)))]
5309 "s390_match_ccmode(insn, CCTmode)"
5314 [(set_attr "op_type" "RR,RX,RXY")])
5316 (define_insn "*andsi3_cconly"
5318 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5319 (match_operand:SI 2 "general_operand" "d,R,T"))
5321 (clobber (match_scratch:SI 0 "=d,d,d"))]
5322 "s390_match_ccmode(insn, CCTmode)
5323 /* Do not steal TM patterns. */
5324 && s390_single_part (operands[2], SImode, HImode, 0) < 0"
5329 [(set_attr "op_type" "RR,RX,RXY")])
5331 (define_insn "*andsi3_zarch"
5332 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,AQ,Q")
5333 (and:SI (match_operand:SI 1 "nonimmediate_operand"
5334 "%d,o,0,0,0,0,0,0,0")
5335 (match_operand:SI 2 "general_operand"
5336 "M,M,N0HSF,N1HSF,d,R,T,NxQSF,Q")))
5337 (clobber (reg:CC 33))]
5338 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5349 [(set_attr "op_type" "RRE,RXE,RI,RI,RR,RX,RXY,SI,SS")])
5351 (define_insn "*andsi3_esa"
5352 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5353 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5354 (match_operand:SI 2 "general_operand" "d,R,NxQSF,Q")))
5355 (clobber (reg:CC 33))]
5356 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5362 [(set_attr "op_type" "RR,RX,SI,SS")])
5365 [(set (match_operand:SI 0 "s_operand" "")
5366 (and:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5367 (clobber (reg:CC 33))]
5370 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5371 (clobber (reg:CC 33))])]
5372 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5374 (define_expand "andsi3"
5375 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5376 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
5377 (match_operand:SI 2 "general_operand" "")))
5378 (clobber (reg:CC 33))]
5380 "s390_expand_logical_operator (AND, SImode, operands); DONE;")
5383 ; andhi3 instruction pattern(s).
5386 (define_insn "*andhi3_zarch"
5387 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5388 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0,0")
5389 (match_operand:HI 2 "general_operand" "d,n,NxQHF,Q")))
5390 (clobber (reg:CC 33))]
5391 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5397 [(set_attr "op_type" "RR,RI,SI,SS")])
5399 (define_insn "*andhi3_esa"
5400 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
5401 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
5402 (match_operand:HI 2 "general_operand" "d,NxQHF,Q")))
5403 (clobber (reg:CC 33))]
5404 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5409 [(set_attr "op_type" "RR,SI,SS")])
5412 [(set (match_operand:HI 0 "s_operand" "")
5413 (and:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
5414 (clobber (reg:CC 33))]
5417 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5418 (clobber (reg:CC 33))])]
5419 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5421 (define_expand "andhi3"
5422 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5423 (and:HI (match_operand:HI 1 "nonimmediate_operand" "")
5424 (match_operand:HI 2 "general_operand" "")))
5425 (clobber (reg:CC 33))]
5427 "s390_expand_logical_operator (AND, HImode, operands); DONE;")
5430 ; andqi3 instruction pattern(s).
5433 (define_insn "*andqi3_zarch"
5434 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,Q,S,Q")
5435 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0,0")
5436 (match_operand:QI 2 "general_operand" "d,n,n,n,Q")))
5437 (clobber (reg:CC 33))]
5438 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5445 [(set_attr "op_type" "RR,RI,SI,SIY,SS")])
5447 (define_insn "*andqi3_esa"
5448 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
5449 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
5450 (match_operand:QI 2 "general_operand" "d,n,Q")))
5451 (clobber (reg:CC 33))]
5452 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5457 [(set_attr "op_type" "RR,SI,SS")])
5459 (define_expand "andqi3"
5460 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5461 (and:QI (match_operand:QI 1 "nonimmediate_operand" "")
5462 (match_operand:QI 2 "general_operand" "")))
5463 (clobber (reg:CC 33))]
5465 "s390_expand_logical_operator (AND, QImode, operands); DONE;")
5468 ; Block and (NC) patterns.
5472 [(set (match_operand:BLK 0 "memory_operand" "=Q")
5473 (and:BLK (match_dup 0)
5474 (match_operand:BLK 1 "memory_operand" "Q")))
5475 (use (match_operand 2 "const_int_operand" "n"))
5476 (clobber (reg:CC 33))]
5477 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
5478 "nc\t%O0(%2,%R0),%S1"
5479 [(set_attr "op_type" "SS")])
5482 [(set (match_operand 0 "memory_operand" "")
5484 (match_operand 1 "memory_operand" "")))
5485 (clobber (reg:CC 33))]
5487 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5488 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
5490 [(set (match_dup 0) (and:BLK (match_dup 0) (match_dup 1)))
5492 (clobber (reg:CC 33))])]
5494 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
5495 operands[0] = adjust_address (operands[0], BLKmode, 0);
5496 operands[1] = adjust_address (operands[1], BLKmode, 0);
5501 [(set (match_operand:BLK 0 "memory_operand" "")
5502 (and:BLK (match_dup 0)
5503 (match_operand:BLK 1 "memory_operand" "")))
5504 (use (match_operand 2 "const_int_operand" ""))
5505 (clobber (reg:CC 33))])
5507 [(set (match_operand:BLK 3 "memory_operand" "")
5508 (and:BLK (match_dup 3)
5509 (match_operand:BLK 4 "memory_operand" "")))
5510 (use (match_operand 5 "const_int_operand" ""))
5511 (clobber (reg:CC 33))])]
5512 "s390_offset_p (operands[0], operands[3], operands[2])
5513 && s390_offset_p (operands[1], operands[4], operands[2])
5514 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
5516 [(set (match_dup 6) (and:BLK (match_dup 6) (match_dup 7)))
5518 (clobber (reg:CC 33))])]
5519 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
5520 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
5521 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
5525 ;;- Bit set (inclusive or) instructions.
5529 ; iordi3 instruction pattern(s).
5532 (define_insn "*iordi3_cc"
5534 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5535 (match_operand:DI 2 "general_operand" "d,m"))
5537 (set (match_operand:DI 0 "register_operand" "=d,d")
5538 (ior:DI (match_dup 1) (match_dup 2)))]
5539 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5543 [(set_attr "op_type" "RRE,RXY")])
5545 (define_insn "*iordi3_cconly"
5547 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5548 (match_operand:DI 2 "general_operand" "d,m"))
5550 (clobber (match_scratch:DI 0 "=d,d"))]
5551 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5555 [(set_attr "op_type" "RRE,RXY")])
5557 (define_insn "*iordi3"
5558 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,AQ,Q")
5559 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,0,0,0,0,0,0")
5560 (match_operand:DI 2 "general_operand"
5561 "N0HD0,N1HD0,N2HD0,N3HD0,d,m,NxQD0,Q")))
5562 (clobber (reg:CC 33))]
5563 "TARGET_64BIT && s390_logical_operator_ok_p (operands)"
5573 [(set_attr "op_type" "RI,RI,RI,RI,RRE,RXY,SI,SS")])
5576 [(set (match_operand:DI 0 "s_operand" "")
5577 (ior:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5578 (clobber (reg:CC 33))]
5581 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5582 (clobber (reg:CC 33))])]
5583 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5585 (define_expand "iordi3"
5586 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5587 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "")
5588 (match_operand:DI 2 "general_operand" "")))
5589 (clobber (reg:CC 33))]
5591 "s390_expand_logical_operator (IOR, DImode, operands); DONE;")
5594 ; iorsi3 instruction pattern(s).
5597 (define_insn "*iorsi3_cc"
5599 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5600 (match_operand:SI 2 "general_operand" "d,R,T"))
5602 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5603 (ior:SI (match_dup 1) (match_dup 2)))]
5604 "s390_match_ccmode(insn, CCTmode)"
5609 [(set_attr "op_type" "RR,RX,RXY")])
5611 (define_insn "*iorsi3_cconly"
5613 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5614 (match_operand:SI 2 "general_operand" "d,R,T"))
5616 (clobber (match_scratch:SI 0 "=d,d,d"))]
5617 "s390_match_ccmode(insn, CCTmode)"
5622 [(set_attr "op_type" "RR,RX,RXY")])
5624 (define_insn "*iorsi3_zarch"
5625 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,AQ,Q")
5626 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0,0,0,0")
5627 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,d,R,T,NxQS0,Q")))
5628 (clobber (reg:CC 33))]
5629 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5638 [(set_attr "op_type" "RI,RI,RR,RX,RXY,SI,SS")])
5640 (define_insn "*iorsi3_esa"
5641 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5642 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0")
5643 (match_operand:SI 2 "general_operand" "d,R,NxQS0,Q")))
5644 (clobber (reg:CC 33))]
5645 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5651 [(set_attr "op_type" "RR,RX,SI,SS")])
5654 [(set (match_operand:SI 0 "s_operand" "")
5655 (ior:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5656 (clobber (reg:CC 33))]
5659 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5660 (clobber (reg:CC 33))])]
5661 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5663 (define_expand "iorsi3"
5664 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5665 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
5666 (match_operand:SI 2 "general_operand" "")))
5667 (clobber (reg:CC 33))]
5669 "s390_expand_logical_operator (IOR, SImode, operands); DONE;")
5672 ; iorhi3 instruction pattern(s).
5675 (define_insn "*iorhi3_zarch"
5676 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5677 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0,0")
5678 (match_operand:HI 2 "general_operand" "d,n,NxQH0,Q")))
5679 (clobber (reg:CC 33))]
5680 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5686 [(set_attr "op_type" "RR,RI,SI,SS")])
5688 (define_insn "*iorhi3_esa"
5689 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
5690 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
5691 (match_operand:HI 2 "general_operand" "d,NxQH0,Q")))
5692 (clobber (reg:CC 33))]
5693 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5698 [(set_attr "op_type" "RR,SI,SS")])
5701 [(set (match_operand:HI 0 "s_operand" "")
5702 (ior:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
5703 (clobber (reg:CC 33))]
5706 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5707 (clobber (reg:CC 33))])]
5708 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5710 (define_expand "iorhi3"
5711 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5712 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "")
5713 (match_operand:HI 2 "general_operand" "")))
5714 (clobber (reg:CC 33))]
5716 "s390_expand_logical_operator (IOR, HImode, operands); DONE;")
5719 ; iorqi3 instruction pattern(s).
5722 (define_insn "*iorqi3_zarch"
5723 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,Q,S,Q")
5724 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0,0")
5725 (match_operand:QI 2 "general_operand" "d,n,n,n,Q")))
5726 (clobber (reg:CC 33))]
5727 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5734 [(set_attr "op_type" "RR,RI,SI,SIY,SS")])
5736 (define_insn "*iorqi3_esa"
5737 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
5738 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
5739 (match_operand:QI 2 "general_operand" "d,n,Q")))
5740 (clobber (reg:CC 33))]
5741 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5746 [(set_attr "op_type" "RR,SI,SS")])
5748 (define_expand "iorqi3"
5749 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5750 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "")
5751 (match_operand:QI 2 "general_operand" "")))
5752 (clobber (reg:CC 33))]
5754 "s390_expand_logical_operator (IOR, QImode, operands); DONE;")
5757 ; Block inclusive or (OC) patterns.
5761 [(set (match_operand:BLK 0 "memory_operand" "=Q")
5762 (ior:BLK (match_dup 0)
5763 (match_operand:BLK 1 "memory_operand" "Q")))
5764 (use (match_operand 2 "const_int_operand" "n"))
5765 (clobber (reg:CC 33))]
5766 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
5767 "oc\t%O0(%2,%R0),%S1"
5768 [(set_attr "op_type" "SS")])
5771 [(set (match_operand 0 "memory_operand" "")
5773 (match_operand 1 "memory_operand" "")))
5774 (clobber (reg:CC 33))]
5776 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5777 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
5779 [(set (match_dup 0) (ior:BLK (match_dup 0) (match_dup 1)))
5781 (clobber (reg:CC 33))])]
5783 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
5784 operands[0] = adjust_address (operands[0], BLKmode, 0);
5785 operands[1] = adjust_address (operands[1], BLKmode, 0);
5790 [(set (match_operand:BLK 0 "memory_operand" "")
5791 (ior:BLK (match_dup 0)
5792 (match_operand:BLK 1 "memory_operand" "")))
5793 (use (match_operand 2 "const_int_operand" ""))
5794 (clobber (reg:CC 33))])
5796 [(set (match_operand:BLK 3 "memory_operand" "")
5797 (ior:BLK (match_dup 3)
5798 (match_operand:BLK 4 "memory_operand" "")))
5799 (use (match_operand 5 "const_int_operand" ""))
5800 (clobber (reg:CC 33))])]
5801 "s390_offset_p (operands[0], operands[3], operands[2])
5802 && s390_offset_p (operands[1], operands[4], operands[2])
5803 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
5805 [(set (match_dup 6) (ior:BLK (match_dup 6) (match_dup 7)))
5807 (clobber (reg:CC 33))])]
5808 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
5809 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
5810 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
5814 ;;- Xor instructions.
5818 ; xordi3 instruction pattern(s).
5821 (define_insn "*xordi3_cc"
5823 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5824 (match_operand:DI 2 "general_operand" "d,m"))
5826 (set (match_operand:DI 0 "register_operand" "=d,d")
5827 (xor:DI (match_dup 1) (match_dup 2)))]
5828 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5832 [(set_attr "op_type" "RRE,RXY")])
5834 (define_insn "*xordi3_cconly"
5836 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5837 (match_operand:DI 2 "general_operand" "d,m"))
5839 (clobber (match_scratch:DI 0 "=d,d"))]
5840 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5844 [(set_attr "op_type" "RRE,RXY")])
5846 (define_insn "*xordi3"
5847 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5848 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
5849 (match_operand:DI 2 "general_operand" "d,m,NxQD0,Q")))
5850 (clobber (reg:CC 33))]
5851 "TARGET_64BIT && s390_logical_operator_ok_p (operands)"
5857 [(set_attr "op_type" "RRE,RXY,SI,SS")])
5860 [(set (match_operand:DI 0 "s_operand" "")
5861 (xor:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5862 (clobber (reg:CC 33))]
5865 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
5866 (clobber (reg:CC 33))])]
5867 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
5869 (define_expand "xordi3"
5870 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5871 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "")
5872 (match_operand:DI 2 "general_operand" "")))
5873 (clobber (reg:CC 33))]
5875 "s390_expand_logical_operator (XOR, DImode, operands); DONE;")
5878 ; xorsi3 instruction pattern(s).
5881 (define_insn "*xorsi3_cc"
5883 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5884 (match_operand:SI 2 "general_operand" "d,R,T"))
5886 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5887 (xor:SI (match_dup 1) (match_dup 2)))]
5888 "s390_match_ccmode(insn, CCTmode)"
5893 [(set_attr "op_type" "RR,RX,RXY")])
5895 (define_insn "*xorsi3_cconly"
5897 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5898 (match_operand:SI 2 "general_operand" "d,R,T"))
5900 (clobber (match_scratch:SI 0 "=d,d,d"))]
5901 "s390_match_ccmode(insn, CCTmode)"
5906 [(set_attr "op_type" "RR,RX,RXY")])
5908 (define_insn "*xorsi3"
5909 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,AQ,Q")
5910 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0")
5911 (match_operand:SI 2 "general_operand" "d,R,T,NxQS0,Q")))
5912 (clobber (reg:CC 33))]
5913 "s390_logical_operator_ok_p (operands)"
5920 [(set_attr "op_type" "RR,RX,RXY,SI,SS")])
5923 [(set (match_operand:SI 0 "s_operand" "")
5924 (xor:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5925 (clobber (reg:CC 33))]
5928 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
5929 (clobber (reg:CC 33))])]
5930 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
5932 (define_expand "xorsi3"
5933 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5934 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "")
5935 (match_operand:SI 2 "general_operand" "")))
5936 (clobber (reg:CC 33))]
5938 "s390_expand_logical_operator (XOR, SImode, operands); DONE;")
5941 ; xorhi3 instruction pattern(s).
5944 (define_insn "*xorhi3"
5945 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
5946 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
5947 (match_operand:HI 2 "general_operand" "d,NxQH0,Q")))
5948 (clobber (reg:CC 33))]
5949 "s390_logical_operator_ok_p (operands)"
5954 [(set_attr "op_type" "RR,SI,SS")])
5957 [(set (match_operand:HI 0 "s_operand" "")
5958 (xor:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
5959 (clobber (reg:CC 33))]
5962 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
5963 (clobber (reg:CC 33))])]
5964 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
5966 (define_expand "xorhi3"
5967 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5968 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "")
5969 (match_operand:HI 2 "general_operand" "")))
5970 (clobber (reg:CC 33))]
5972 "s390_expand_logical_operator (XOR, HImode, operands); DONE;")
5975 ; xorqi3 instruction pattern(s).
5978 (define_insn "*xorqi3"
5979 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,S,Q")
5980 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0")
5981 (match_operand:QI 2 "general_operand" "d,n,n,Q")))
5982 (clobber (reg:CC 33))]
5983 "s390_logical_operator_ok_p (operands)"
5989 [(set_attr "op_type" "RR,SI,SIY,SS")])
5991 (define_expand "xorqi3"
5992 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5993 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "")
5994 (match_operand:QI 2 "general_operand" "")))
5995 (clobber (reg:CC 33))]
5997 "s390_expand_logical_operator (XOR, QImode, operands); DONE;")
6000 ; Block exclusive or (XC) patterns.
6004 [(set (match_operand:BLK 0 "memory_operand" "=Q")
6005 (xor:BLK (match_dup 0)
6006 (match_operand:BLK 1 "memory_operand" "Q")))
6007 (use (match_operand 2 "const_int_operand" "n"))
6008 (clobber (reg:CC 33))]
6009 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
6010 "xc\t%O0(%2,%R0),%S1"
6011 [(set_attr "op_type" "SS")])
6014 [(set (match_operand 0 "memory_operand" "")
6016 (match_operand 1 "memory_operand" "")))
6017 (clobber (reg:CC 33))]
6019 && GET_MODE (operands[0]) == GET_MODE (operands[1])
6020 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
6022 [(set (match_dup 0) (xor:BLK (match_dup 0) (match_dup 1)))
6024 (clobber (reg:CC 33))])]
6026 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
6027 operands[0] = adjust_address (operands[0], BLKmode, 0);
6028 operands[1] = adjust_address (operands[1], BLKmode, 0);
6033 [(set (match_operand:BLK 0 "memory_operand" "")
6034 (xor:BLK (match_dup 0)
6035 (match_operand:BLK 1 "memory_operand" "")))
6036 (use (match_operand 2 "const_int_operand" ""))
6037 (clobber (reg:CC 33))])
6039 [(set (match_operand:BLK 3 "memory_operand" "")
6040 (xor:BLK (match_dup 3)
6041 (match_operand:BLK 4 "memory_operand" "")))
6042 (use (match_operand 5 "const_int_operand" ""))
6043 (clobber (reg:CC 33))])]
6044 "s390_offset_p (operands[0], operands[3], operands[2])
6045 && s390_offset_p (operands[1], operands[4], operands[2])
6046 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
6048 [(set (match_dup 6) (xor:BLK (match_dup 6) (match_dup 7)))
6050 (clobber (reg:CC 33))])]
6051 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
6052 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
6053 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
6056 ; Block xor (XC) patterns with src == dest.
6059 (define_insn "*xc_zero"
6060 [(set (match_operand:BLK 0 "memory_operand" "=Q")
6062 (use (match_operand 1 "const_int_operand" "n"))
6063 (clobber (reg:CC 33))]
6064 "INTVAL (operands[1]) >= 1 && INTVAL (operands[1]) <= 256"
6065 "xc\t%O0(%1,%R0),%S0"
6066 [(set_attr "op_type" "SS")])
6070 [(set (match_operand:BLK 0 "memory_operand" "")
6072 (use (match_operand 1 "const_int_operand" ""))
6073 (clobber (reg:CC 33))])
6075 [(set (match_operand:BLK 2 "memory_operand" "")
6077 (use (match_operand 3 "const_int_operand" ""))
6078 (clobber (reg:CC 33))])]
6079 "s390_offset_p (operands[0], operands[2], operands[1])
6080 && INTVAL (operands[1]) + INTVAL (operands[3]) <= 256"
6082 [(set (match_dup 4) (const_int 0))
6084 (clobber (reg:CC 33))])]
6085 "operands[4] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
6086 operands[5] = GEN_INT (INTVAL (operands[1]) + INTVAL (operands[3]));")
6090 ;;- Negate instructions.
6094 ; negdi2 instruction pattern(s).
6097 (define_expand "negdi2"
6099 [(set (match_operand:DI 0 "register_operand" "=d")
6100 (neg:DI (match_operand:DI 1 "register_operand" "d")))
6101 (clobber (reg:CC 33))])]
6105 (define_insn "*negdi2_64"
6106 [(set (match_operand:DI 0 "register_operand" "=d")
6107 (neg:DI (match_operand:DI 1 "register_operand" "d")))
6108 (clobber (reg:CC 33))]
6111 [(set_attr "op_type" "RR")])
6113 (define_insn "*negdi2_31"
6114 [(set (match_operand:DI 0 "register_operand" "=d")
6115 (neg:DI (match_operand:DI 1 "register_operand" "d")))
6116 (clobber (reg:CC 33))]
6120 xop[0] = gen_label_rtx ();
6121 output_asm_insn ("lcr\t%0,%1", operands);
6122 output_asm_insn ("lcr\t%N0,%N1", operands);
6123 output_asm_insn ("je\t%l0", xop);
6124 output_asm_insn ("bctr\t%0,0", operands);
6125 targetm.asm_out.internal_label (asm_out_file, "L",
6126 CODE_LABEL_NUMBER (xop[0]));
6129 [(set_attr "length" "10")])
6132 ; negsi2 instruction pattern(s).
6135 (define_insn "negsi2"
6136 [(set (match_operand:SI 0 "register_operand" "=d")
6137 (neg:SI (match_operand:SI 1 "register_operand" "d")))
6138 (clobber (reg:CC 33))]
6141 [(set_attr "op_type" "RR")])
6144 ; negdf2 instruction pattern(s).
6147 (define_expand "negdf2"
6149 [(set (match_operand:DF 0 "register_operand" "=f")
6150 (neg:DF (match_operand:DF 1 "register_operand" "f")))
6151 (clobber (reg:CC 33))])]
6155 (define_insn "*negdf2"
6156 [(set (match_operand:DF 0 "register_operand" "=f")
6157 (neg:DF (match_operand:DF 1 "register_operand" "f")))
6158 (clobber (reg:CC 33))]
6159 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6161 [(set_attr "op_type" "RRE")
6162 (set_attr "type" "fsimpd")])
6164 (define_insn "*negdf2_ibm"
6165 [(set (match_operand:DF 0 "register_operand" "=f")
6166 (neg:DF (match_operand:DF 1 "register_operand" "f")))
6167 (clobber (reg:CC 33))]
6168 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6170 [(set_attr "op_type" "RR")
6171 (set_attr "type" "fsimpd")])
6174 ; negsf2 instruction pattern(s).
6177 (define_expand "negsf2"
6179 [(set (match_operand:SF 0 "register_operand" "=f")
6180 (neg:SF (match_operand:SF 1 "register_operand" "f")))
6181 (clobber (reg:CC 33))])]
6185 (define_insn "*negsf2"
6186 [(set (match_operand:SF 0 "register_operand" "=f")
6187 (neg:SF (match_operand:SF 1 "register_operand" "f")))
6188 (clobber (reg:CC 33))]
6189 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6191 [(set_attr "op_type" "RRE")
6192 (set_attr "type" "fsimps")])
6194 (define_insn "*negsf2"
6195 [(set (match_operand:SF 0 "register_operand" "=f")
6196 (neg:SF (match_operand:SF 1 "register_operand" "f")))
6197 (clobber (reg:CC 33))]
6198 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6200 [(set_attr "op_type" "RR")
6201 (set_attr "type" "fsimps")])
6205 ;;- Absolute value instructions.
6209 ; absdi2 instruction pattern(s).
6212 (define_insn "absdi2"
6213 [(set (match_operand:DI 0 "register_operand" "=d")
6214 (abs:DI (match_operand:DI 1 "register_operand" "d")))
6215 (clobber (reg:CC 33))]
6218 [(set_attr "op_type" "RRE")])
6221 ; abssi2 instruction pattern(s).
6224 (define_insn "abssi2"
6225 [(set (match_operand:SI 0 "register_operand" "=d")
6226 (abs:SI (match_operand:SI 1 "register_operand" "d")))
6227 (clobber (reg:CC 33))]
6230 [(set_attr "op_type" "RR")])
6233 ; absdf2 instruction pattern(s).
6236 (define_expand "absdf2"
6238 [(set (match_operand:DF 0 "register_operand" "=f")
6239 (abs:DF (match_operand:DF 1 "register_operand" "f")))
6240 (clobber (reg:CC 33))])]
6244 (define_insn "*absdf2"
6245 [(set (match_operand:DF 0 "register_operand" "=f")
6246 (abs:DF (match_operand:DF 1 "register_operand" "f")))
6247 (clobber (reg:CC 33))]
6248 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6250 [(set_attr "op_type" "RRE")
6251 (set_attr "type" "fsimpd")])
6253 (define_insn "*absdf2_ibm"
6254 [(set (match_operand:DF 0 "register_operand" "=f")
6255 (abs:DF (match_operand:DF 1 "register_operand" "f")))
6256 (clobber (reg:CC 33))]
6257 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6259 [(set_attr "op_type" "RR")
6260 (set_attr "type" "fsimpd")])
6263 ; abssf2 instruction pattern(s).
6266 (define_expand "abssf2"
6268 [(set (match_operand:SF 0 "register_operand" "=f")
6269 (abs:SF (match_operand:SF 1 "register_operand" "f")))
6270 (clobber (reg:CC 33))])]
6274 (define_insn "*abssf2"
6275 [(set (match_operand:SF 0 "register_operand" "=f")
6276 (abs:SF (match_operand:SF 1 "register_operand" "f")))
6277 (clobber (reg:CC 33))]
6278 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6280 [(set_attr "op_type" "RRE")
6281 (set_attr "type" "fsimps")])
6283 (define_insn "*abssf2_ibm"
6284 [(set (match_operand:SF 0 "register_operand" "=f")
6285 (abs:SF (match_operand:SF 1 "register_operand" "f")))
6286 (clobber (reg:CC 33))]
6287 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6289 [(set_attr "op_type" "RR")
6290 (set_attr "type" "fsimps")])
6293 ;;- Negated absolute value instructions
6300 (define_insn "*negabssi2"
6301 [(set (match_operand:SI 0 "register_operand" "=d")
6302 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
6303 (clobber (reg:CC 33))]
6306 [(set_attr "op_type" "RR")])
6308 (define_insn "*negabsdi2"
6309 [(set (match_operand:DI 0 "register_operand" "=d")
6310 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
6311 (clobber (reg:CC 33))]
6314 [(set_attr "op_type" "RRE")])
6320 (define_insn "*negabssf2"
6321 [(set (match_operand:SF 0 "register_operand" "=f")
6322 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
6323 (clobber (reg:CC 33))]
6324 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6326 [(set_attr "op_type" "RRE")
6327 (set_attr "type" "fsimps")])
6329 (define_insn "*negabsdf2"
6330 [(set (match_operand:DF 0 "register_operand" "=f")
6331 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
6332 (clobber (reg:CC 33))]
6333 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6335 [(set_attr "op_type" "RRE")
6336 (set_attr "type" "fsimpd")])
6339 ;;- Square root instructions.
6343 ; sqrtdf2 instruction pattern(s).
6346 (define_insn "sqrtdf2"
6347 [(set (match_operand:DF 0 "register_operand" "=f,f")
6348 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
6349 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6353 [(set_attr "op_type" "RRE,RXE")
6354 (set_attr "type" "fsqrtd")])
6357 ; sqrtsf2 instruction pattern(s).
6360 (define_insn "sqrtsf2"
6361 [(set (match_operand:SF 0 "register_operand" "=f,f")
6362 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
6363 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6367 [(set_attr "op_type" "RRE,RXE")
6368 (set_attr "type" "fsqrts")])
6371 ;;- One complement instructions.
6375 ; one_cmpldi2 instruction pattern(s).
6378 (define_expand "one_cmpldi2"
6380 [(set (match_operand:DI 0 "register_operand" "")
6381 (xor:DI (match_operand:DI 1 "register_operand" "")
6383 (clobber (reg:CC 33))])]
6388 ; one_cmplsi2 instruction pattern(s).
6391 (define_expand "one_cmplsi2"
6393 [(set (match_operand:SI 0 "register_operand" "")
6394 (xor:SI (match_operand:SI 1 "register_operand" "")
6396 (clobber (reg:CC 33))])]
6401 ; one_cmplhi2 instruction pattern(s).
6404 (define_expand "one_cmplhi2"
6406 [(set (match_operand:HI 0 "register_operand" "")
6407 (xor:HI (match_operand:HI 1 "register_operand" "")
6409 (clobber (reg:CC 33))])]
6414 ; one_cmplqi2 instruction pattern(s).
6417 (define_expand "one_cmplqi2"
6419 [(set (match_operand:QI 0 "register_operand" "")
6420 (xor:QI (match_operand:QI 1 "register_operand" "")
6422 (clobber (reg:CC 33))])]
6428 ;;- Rotate instructions.
6432 ; rotldi3 instruction pattern(s).
6435 (define_insn "rotldi3"
6436 [(set (match_operand:DI 0 "register_operand" "=d")
6437 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6438 (match_operand:SI 2 "shift_count_operand" "Y")))]
6441 [(set_attr "op_type" "RSE")
6442 (set_attr "atype" "reg")])
6445 ; rotlsi3 instruction pattern(s).
6448 (define_insn "rotlsi3"
6449 [(set (match_operand:SI 0 "register_operand" "=d")
6450 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6451 (match_operand:SI 2 "shift_count_operand" "Y")))]
6454 [(set_attr "op_type" "RSE")
6455 (set_attr "atype" "reg")])
6459 ;;- Arithmetic shift instructions.
6463 ; ashldi3 instruction pattern(s).
6466 (define_expand "ashldi3"
6467 [(set (match_operand:DI 0 "register_operand" "")
6468 (ashift:DI (match_operand:DI 1 "register_operand" "")
6469 (match_operand:SI 2 "shift_count_operand" "")))]
6473 (define_insn "*ashldi3_31"
6474 [(set (match_operand:DI 0 "register_operand" "=d")
6475 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6476 (match_operand:SI 2 "shift_count_operand" "Y")))]
6479 [(set_attr "op_type" "RS")
6480 (set_attr "atype" "reg")])
6482 (define_insn "*ashldi3_64"
6483 [(set (match_operand:DI 0 "register_operand" "=d")
6484 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6485 (match_operand:SI 2 "shift_count_operand" "Y")))]
6488 [(set_attr "op_type" "RSE")
6489 (set_attr "atype" "reg")])
6492 ; ashrdi3 instruction pattern(s).
6495 (define_expand "ashrdi3"
6497 [(set (match_operand:DI 0 "register_operand" "")
6498 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6499 (match_operand:SI 2 "shift_count_operand" "")))
6500 (clobber (reg:CC 33))])]
6504 (define_insn "*ashrdi3_cc_31"
6506 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6507 (match_operand:SI 2 "shift_count_operand" "Y"))
6509 (set (match_operand:DI 0 "register_operand" "=d")
6510 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6511 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6513 [(set_attr "op_type" "RS")
6514 (set_attr "atype" "reg")])
6516 (define_insn "*ashrdi3_cconly_31"
6518 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6519 (match_operand:SI 2 "shift_count_operand" "Y"))
6521 (clobber (match_scratch:DI 0 "=d"))]
6522 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6524 [(set_attr "op_type" "RS")
6525 (set_attr "atype" "reg")])
6527 (define_insn "*ashrdi3_31"
6528 [(set (match_operand:DI 0 "register_operand" "=d")
6529 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6530 (match_operand:SI 2 "shift_count_operand" "Y")))
6531 (clobber (reg:CC 33))]
6534 [(set_attr "op_type" "RS")
6535 (set_attr "atype" "reg")])
6537 (define_insn "*ashrdi3_cc_64"
6539 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6540 (match_operand:SI 2 "shift_count_operand" "Y"))
6542 (set (match_operand:DI 0 "register_operand" "=d")
6543 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6544 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6546 [(set_attr "op_type" "RSE")
6547 (set_attr "atype" "reg")])
6549 (define_insn "*ashrdi3_cconly_64"
6551 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6552 (match_operand:SI 2 "shift_count_operand" "Y"))
6554 (clobber (match_scratch:DI 0 "=d"))]
6555 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6557 [(set_attr "op_type" "RSE")
6558 (set_attr "atype" "reg")])
6560 (define_insn "*ashrdi3_64"
6561 [(set (match_operand:DI 0 "register_operand" "=d")
6562 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6563 (match_operand:SI 2 "shift_count_operand" "Y")))
6564 (clobber (reg:CC 33))]
6567 [(set_attr "op_type" "RSE")
6568 (set_attr "atype" "reg")])
6572 ; ashlsi3 instruction pattern(s).
6575 (define_insn "ashlsi3"
6576 [(set (match_operand:SI 0 "register_operand" "=d")
6577 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6578 (match_operand:SI 2 "shift_count_operand" "Y")))]
6581 [(set_attr "op_type" "RS")
6582 (set_attr "atype" "reg")])
6585 ; ashrsi3 instruction pattern(s).
6588 (define_insn "*ashrsi3_cc"
6590 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6591 (match_operand:SI 2 "shift_count_operand" "Y"))
6593 (set (match_operand:SI 0 "register_operand" "=d")
6594 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6595 "s390_match_ccmode(insn, CCSmode)"
6597 [(set_attr "op_type" "RS")
6598 (set_attr "atype" "reg")])
6601 (define_insn "*ashrsi3_cconly"
6603 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6604 (match_operand:SI 2 "shift_count_operand" "Y"))
6606 (clobber (match_scratch:SI 0 "=d"))]
6607 "s390_match_ccmode(insn, CCSmode)"
6609 [(set_attr "op_type" "RS")
6610 (set_attr "atype" "reg")])
6612 (define_insn "ashrsi3"
6613 [(set (match_operand:SI 0 "register_operand" "=d")
6614 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6615 (match_operand:SI 2 "shift_count_operand" "Y")))
6616 (clobber (reg:CC 33))]
6619 [(set_attr "op_type" "RS")
6620 (set_attr "atype" "reg")])
6624 ;;- logical shift instructions.
6628 ; lshrdi3 instruction pattern(s).
6631 (define_expand "lshrdi3"
6632 [(set (match_operand:DI 0 "register_operand" "")
6633 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6634 (match_operand:SI 2 "shift_count_operand" "")))]
6638 (define_insn "*lshrdi3_31"
6639 [(set (match_operand:DI 0 "register_operand" "=d")
6640 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6641 (match_operand:SI 2 "shift_count_operand" "Y")))]
6644 [(set_attr "op_type" "RS")
6645 (set_attr "atype" "reg")])
6647 (define_insn "*lshrdi3_64"
6648 [(set (match_operand:DI 0 "register_operand" "=d")
6649 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6650 (match_operand:SI 2 "shift_count_operand" "Y")))]
6653 [(set_attr "op_type" "RSE")
6654 (set_attr "atype" "reg")])
6657 ; lshrsi3 instruction pattern(s).
6660 (define_insn "lshrsi3"
6661 [(set (match_operand:SI 0 "register_operand" "=d")
6662 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6663 (match_operand:SI 2 "shift_count_operand" "Y")))]
6666 [(set_attr "op_type" "RS")
6667 (set_attr "atype" "reg")])
6671 ;; Branch instruction patterns.
6674 (define_expand "beq"
6675 [(match_operand 0 "" "")]
6677 "s390_emit_jump (operands[0],
6678 s390_emit_compare (EQ, s390_compare_op0, s390_compare_op1)); DONE;")
6680 (define_expand "bne"
6681 [(match_operand 0 "" "")]
6683 "s390_emit_jump (operands[0],
6684 s390_emit_compare (NE, s390_compare_op0, s390_compare_op1)); DONE;")
6686 (define_expand "bgt"
6687 [(match_operand 0 "" "")]
6689 "s390_emit_jump (operands[0],
6690 s390_emit_compare (GT, s390_compare_op0, s390_compare_op1)); DONE;")
6692 (define_expand "bgtu"
6693 [(match_operand 0 "" "")]
6695 "s390_emit_jump (operands[0],
6696 s390_emit_compare (GTU, s390_compare_op0, s390_compare_op1)); DONE;")
6698 (define_expand "blt"
6699 [(match_operand 0 "" "")]
6701 "s390_emit_jump (operands[0],
6702 s390_emit_compare (LT, s390_compare_op0, s390_compare_op1)); DONE;")
6704 (define_expand "bltu"
6705 [(match_operand 0 "" "")]
6707 "s390_emit_jump (operands[0],
6708 s390_emit_compare (LTU, s390_compare_op0, s390_compare_op1)); DONE;")
6710 (define_expand "bge"
6711 [(match_operand 0 "" "")]
6713 "s390_emit_jump (operands[0],
6714 s390_emit_compare (GE, s390_compare_op0, s390_compare_op1)); DONE;")
6716 (define_expand "bgeu"
6717 [(match_operand 0 "" "")]
6719 "s390_emit_jump (operands[0],
6720 s390_emit_compare (GEU, s390_compare_op0, s390_compare_op1)); DONE;")
6722 (define_expand "ble"
6723 [(match_operand 0 "" "")]
6725 "s390_emit_jump (operands[0],
6726 s390_emit_compare (LE, s390_compare_op0, s390_compare_op1)); DONE;")
6728 (define_expand "bleu"
6729 [(match_operand 0 "" "")]
6731 "s390_emit_jump (operands[0],
6732 s390_emit_compare (LEU, s390_compare_op0, s390_compare_op1)); DONE;")
6734 (define_expand "bunordered"
6735 [(match_operand 0 "" "")]
6737 "s390_emit_jump (operands[0],
6738 s390_emit_compare (UNORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6740 (define_expand "bordered"
6741 [(match_operand 0 "" "")]
6743 "s390_emit_jump (operands[0],
6744 s390_emit_compare (ORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6746 (define_expand "buneq"
6747 [(match_operand 0 "" "")]
6749 "s390_emit_jump (operands[0],
6750 s390_emit_compare (UNEQ, s390_compare_op0, s390_compare_op1)); DONE;")
6752 (define_expand "bunlt"
6753 [(match_operand 0 "" "")]
6755 "s390_emit_jump (operands[0],
6756 s390_emit_compare (UNLT, s390_compare_op0, s390_compare_op1)); DONE;")
6758 (define_expand "bungt"
6759 [(match_operand 0 "" "")]
6761 "s390_emit_jump (operands[0],
6762 s390_emit_compare (UNGT, s390_compare_op0, s390_compare_op1)); DONE;")
6764 (define_expand "bunle"
6765 [(match_operand 0 "" "")]
6767 "s390_emit_jump (operands[0],
6768 s390_emit_compare (UNLE, s390_compare_op0, s390_compare_op1)); DONE;")
6770 (define_expand "bunge"
6771 [(match_operand 0 "" "")]
6773 "s390_emit_jump (operands[0],
6774 s390_emit_compare (UNGE, s390_compare_op0, s390_compare_op1)); DONE;")
6776 (define_expand "bltgt"
6777 [(match_operand 0 "" "")]
6779 "s390_emit_jump (operands[0],
6780 s390_emit_compare (LTGT, s390_compare_op0, s390_compare_op1)); DONE;")
6784 ;;- Conditional jump instructions.
6787 (define_insn "*cjump_64"
6790 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6791 (label_ref (match_operand 0 "" ""))
6795 if (get_attr_length (insn) == 4)
6798 return "jg%C1\t%l0";
6800 [(set_attr "op_type" "RI")
6801 (set_attr "type" "branch")
6802 (set (attr "length")
6803 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6804 (const_int 4) (const_int 6)))])
6806 (define_insn "*cjump_31"
6809 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6810 (label_ref (match_operand 0 "" ""))
6814 if (get_attr_length (insn) == 4)
6819 [(set_attr "op_type" "RI")
6820 (set_attr "type" "branch")
6821 (set (attr "length")
6822 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6823 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6824 (const_int 4) (const_int 6))
6825 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6826 (const_int 4) (const_int 8))))])
6828 (define_insn "*cjump_long"
6831 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6832 (match_operand 0 "address_operand" "U")
6836 if (get_attr_op_type (insn) == OP_TYPE_RR)
6841 [(set (attr "op_type")
6842 (if_then_else (match_operand 0 "register_operand" "")
6843 (const_string "RR") (const_string "RX")))
6844 (set_attr "type" "branch")
6845 (set_attr "atype" "agen")])
6849 ;;- Negated conditional jump instructions.
6852 (define_insn "*icjump_64"
6855 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6857 (label_ref (match_operand 0 "" ""))))]
6860 if (get_attr_length (insn) == 4)
6863 return "jg%D1\t%l0";
6865 [(set_attr "op_type" "RI")
6866 (set_attr "type" "branch")
6867 (set (attr "length")
6868 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6869 (const_int 4) (const_int 6)))])
6871 (define_insn "*icjump_31"
6874 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6876 (label_ref (match_operand 0 "" ""))))]
6879 if (get_attr_length (insn) == 4)
6884 [(set_attr "op_type" "RI")
6885 (set_attr "type" "branch")
6886 (set (attr "length")
6887 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6888 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6889 (const_int 4) (const_int 6))
6890 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6891 (const_int 4) (const_int 8))))])
6893 (define_insn "*icjump_long"
6896 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6898 (match_operand 0 "address_operand" "U")))]
6901 if (get_attr_op_type (insn) == OP_TYPE_RR)
6906 [(set (attr "op_type")
6907 (if_then_else (match_operand 0 "register_operand" "")
6908 (const_string "RR") (const_string "RX")))
6909 (set_attr "type" "branch")
6910 (set_attr "atype" "agen")])
6913 ;;- Trap instructions.
6917 [(trap_if (const_int 1) (const_int 0))]
6920 [(set_attr "op_type" "RI")
6921 (set_attr "type" "branch")])
6923 (define_expand "conditional_trap"
6924 [(trap_if (match_operand 0 "comparison_operator" "")
6925 (match_operand 1 "general_operand" ""))]
6928 if (operands[1] != const0_rtx) FAIL;
6929 operands[0] = s390_emit_compare (GET_CODE (operands[0]),
6930 s390_compare_op0, s390_compare_op1);
6933 (define_insn "*trap"
6934 [(trap_if (match_operator 0 "s390_comparison" [(reg 33) (const_int 0)])
6938 [(set_attr "op_type" "RI")
6939 (set_attr "type" "branch")])
6942 ;;- Loop instructions.
6944 ;; This is all complicated by the fact that since this is a jump insn
6945 ;; we must handle our own output reloads.
6947 (define_expand "doloop_end"
6948 [(use (match_operand 0 "" "")) ; loop pseudo
6949 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6950 (use (match_operand 2 "" "")) ; max iterations
6951 (use (match_operand 3 "" "")) ; loop level
6952 (use (match_operand 4 "" ""))] ; label
6955 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
6956 emit_jump_insn (gen_doloop_si31 (operands[4], operands[0], operands[0]));
6957 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
6958 emit_jump_insn (gen_doloop_si64 (operands[4], operands[0], operands[0]));
6959 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6960 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6967 (define_insn_and_split "doloop_si64"
6970 (ne (match_operand:SI 1 "register_operand" "d,d")
6972 (label_ref (match_operand 0 "" ""))
6974 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6975 (plus:SI (match_dup 1) (const_int -1)))
6976 (clobber (match_scratch:SI 3 "=X,&d"))
6977 (clobber (reg:CC 33))]
6980 if (which_alternative != 0)
6982 else if (get_attr_length (insn) == 4)
6983 return "brct\t%1,%l0";
6985 return "ahi\t%1,-1\;jgne\t%l0";
6987 "&& reload_completed
6988 && (! REG_P (operands[2])
6989 || ! rtx_equal_p (operands[1], operands[2]))"
6990 [(set (match_dup 3) (match_dup 1))
6991 (parallel [(set (reg:CCAN 33)
6992 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6994 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6995 (set (match_dup 2) (match_dup 3))
6996 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6997 (label_ref (match_dup 0))
7000 [(set_attr "op_type" "RI")
7001 (set_attr "type" "branch")
7002 (set (attr "length")
7003 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7004 (const_int 4) (const_int 10)))])
7006 (define_insn_and_split "doloop_si31"
7009 (ne (match_operand:SI 1 "register_operand" "d,d")
7011 (label_ref (match_operand 0 "" ""))
7013 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
7014 (plus:SI (match_dup 1) (const_int -1)))
7015 (clobber (match_scratch:SI 3 "=X,&d"))
7016 (clobber (reg:CC 33))]
7019 if (which_alternative != 0)
7021 else if (get_attr_length (insn) == 4)
7022 return "brct\t%1,%l0";
7026 "&& reload_completed
7027 && (! REG_P (operands[2])
7028 || ! rtx_equal_p (operands[1], operands[2]))"
7029 [(set (match_dup 3) (match_dup 1))
7030 (parallel [(set (reg:CCAN 33)
7031 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
7033 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
7034 (set (match_dup 2) (match_dup 3))
7035 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
7036 (label_ref (match_dup 0))
7039 [(set_attr "op_type" "RI")
7040 (set_attr "type" "branch")
7041 (set (attr "length")
7042 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
7043 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7044 (const_int 4) (const_int 6))
7045 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7046 (const_int 4) (const_int 8))))])
7048 (define_insn "*doloop_si_long"
7051 (ne (match_operand:SI 1 "register_operand" "d,d")
7053 (match_operand 0 "address_operand" "U,U")
7055 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
7056 (plus:SI (match_dup 1) (const_int -1)))
7057 (clobber (match_scratch:SI 3 "=X,&d"))
7058 (clobber (reg:CC 33))]
7061 if (get_attr_op_type (insn) == OP_TYPE_RR)
7062 return "bctr\t%1,%0";
7064 return "bct\t%1,%a0";
7066 [(set (attr "op_type")
7067 (if_then_else (match_operand 0 "register_operand" "")
7068 (const_string "RR") (const_string "RX")))
7069 (set_attr "type" "branch")
7070 (set_attr "atype" "agen")])
7072 (define_insn_and_split "doloop_di"
7075 (ne (match_operand:DI 1 "register_operand" "d,d")
7077 (label_ref (match_operand 0 "" ""))
7079 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?*m*r")
7080 (plus:DI (match_dup 1) (const_int -1)))
7081 (clobber (match_scratch:DI 3 "=X,&d"))
7082 (clobber (reg:CC 33))]
7085 if (which_alternative != 0)
7087 else if (get_attr_length (insn) == 4)
7088 return "brctg\t%1,%l0";
7090 return "aghi\t%1,-1\;jgne\t%l0";
7092 "&& reload_completed
7093 && (! REG_P (operands[2])
7094 || ! rtx_equal_p (operands[1], operands[2]))"
7095 [(set (match_dup 3) (match_dup 1))
7096 (parallel [(set (reg:CCAN 33)
7097 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
7099 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
7100 (set (match_dup 2) (match_dup 3))
7101 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
7102 (label_ref (match_dup 0))
7105 [(set_attr "op_type" "RI")
7106 (set_attr "type" "branch")
7107 (set (attr "length")
7108 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7109 (const_int 4) (const_int 10)))])
7112 ;;- Unconditional jump instructions.
7116 ; jump instruction pattern(s).
7119 (define_expand "jump"
7120 [(match_operand 0 "" "")]
7122 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
7124 (define_insn "*jump64"
7125 [(set (pc) (label_ref (match_operand 0 "" "")))]
7128 if (get_attr_length (insn) == 4)
7133 [(set_attr "op_type" "RI")
7134 (set_attr "type" "branch")
7135 (set (attr "length")
7136 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7137 (const_int 4) (const_int 6)))])
7139 (define_insn "*jump31"
7140 [(set (pc) (label_ref (match_operand 0 "" "")))]
7143 if (get_attr_length (insn) == 4)
7148 [(set_attr "op_type" "RI")
7149 (set_attr "type" "branch")
7150 (set (attr "length")
7151 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
7152 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7153 (const_int 4) (const_int 6))
7154 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7155 (const_int 4) (const_int 8))))])
7158 ; indirect-jump instruction pattern(s).
7161 (define_insn "indirect_jump"
7162 [(set (pc) (match_operand 0 "address_operand" "U"))]
7165 if (get_attr_op_type (insn) == OP_TYPE_RR)
7170 [(set (attr "op_type")
7171 (if_then_else (match_operand 0 "register_operand" "")
7172 (const_string "RR") (const_string "RX")))
7173 (set_attr "type" "branch")
7174 (set_attr "atype" "agen")])
7177 ; casesi instruction pattern(s).
7180 (define_insn "casesi_jump"
7181 [(set (pc) (match_operand 0 "address_operand" "U"))
7182 (use (label_ref (match_operand 1 "" "")))]
7185 if (get_attr_op_type (insn) == OP_TYPE_RR)
7190 [(set (attr "op_type")
7191 (if_then_else (match_operand 0 "register_operand" "")
7192 (const_string "RR") (const_string "RX")))
7193 (set_attr "type" "branch")
7194 (set_attr "atype" "agen")])
7196 (define_expand "casesi"
7197 [(match_operand:SI 0 "general_operand" "")
7198 (match_operand:SI 1 "general_operand" "")
7199 (match_operand:SI 2 "general_operand" "")
7200 (label_ref (match_operand 3 "" ""))
7201 (label_ref (match_operand 4 "" ""))]
7204 rtx index = gen_reg_rtx (SImode);
7205 rtx base = gen_reg_rtx (Pmode);
7206 rtx target = gen_reg_rtx (Pmode);
7208 emit_move_insn (index, operands[0]);
7209 emit_insn (gen_subsi3 (index, index, operands[1]));
7210 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
7213 if (Pmode != SImode)
7214 index = convert_to_mode (Pmode, index, 1);
7215 if (GET_CODE (index) != REG)
7216 index = copy_to_mode_reg (Pmode, index);
7219 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
7221 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
7223 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
7225 index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
7226 emit_move_insn (target, index);
7229 target = gen_rtx_PLUS (Pmode, base, target);
7230 emit_jump_insn (gen_casesi_jump (target, operands[3]));
7237 ;;- Jump to subroutine.
7242 ; untyped call instruction pattern(s).
7245 ;; Call subroutine returning any type.
7246 (define_expand "untyped_call"
7247 [(parallel [(call (match_operand 0 "" "")
7249 (match_operand 1 "" "")
7250 (match_operand 2 "" "")])]
7255 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
7257 for (i = 0; i < XVECLEN (operands[2], 0); i++)
7259 rtx set = XVECEXP (operands[2], 0, i);
7260 emit_move_insn (SET_DEST (set), SET_SRC (set));
7263 /* The optimizer does not know that the call sets the function value
7264 registers we stored in the result block. We avoid problems by
7265 claiming that all hard registers are used and clobbered at this
7267 emit_insn (gen_blockage ());
7272 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
7273 ;; all of memory. This blocks insns from being moved across this point.
7275 (define_insn "blockage"
7276 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
7279 [(set_attr "type" "none")
7280 (set_attr "length" "0")])
7286 (define_expand "sibcall"
7287 [(call (match_operand 0 "" "")
7288 (match_operand 1 "" ""))]
7291 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
7295 (define_insn "*sibcall_br"
7296 [(call (mem:QI (reg 1))
7297 (match_operand 0 "const_int_operand" "n"))]
7298 "SIBLING_CALL_P (insn)
7299 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
7301 [(set_attr "op_type" "RR")
7302 (set_attr "type" "branch")
7303 (set_attr "atype" "agen")])
7305 (define_insn "*sibcall_brc"
7306 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7307 (match_operand 1 "const_int_operand" "n"))]
7308 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7310 [(set_attr "op_type" "RI")
7311 (set_attr "type" "branch")])
7313 (define_insn "*sibcall_brcl"
7314 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7315 (match_operand 1 "const_int_operand" "n"))]
7316 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7318 [(set_attr "op_type" "RIL")
7319 (set_attr "type" "branch")])
7322 ; sibcall_value patterns
7325 (define_expand "sibcall_value"
7326 [(set (match_operand 0 "" "")
7327 (call (match_operand 1 "" "")
7328 (match_operand 2 "" "")))]
7331 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
7335 (define_insn "*sibcall_value_br"
7336 [(set (match_operand 0 "" "")
7337 (call (mem:QI (reg 1))
7338 (match_operand 1 "const_int_operand" "n")))]
7339 "SIBLING_CALL_P (insn)
7340 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
7342 [(set_attr "op_type" "RR")
7343 (set_attr "type" "branch")
7344 (set_attr "atype" "agen")])
7346 (define_insn "*sibcall_value_brc"
7347 [(set (match_operand 0 "" "")
7348 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7349 (match_operand 2 "const_int_operand" "n")))]
7350 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7352 [(set_attr "op_type" "RI")
7353 (set_attr "type" "branch")])
7355 (define_insn "*sibcall_value_brcl"
7356 [(set (match_operand 0 "" "")
7357 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7358 (match_operand 2 "const_int_operand" "n")))]
7359 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7361 [(set_attr "op_type" "RIL")
7362 (set_attr "type" "branch")])
7366 ; call instruction pattern(s).
7369 (define_expand "call"
7370 [(call (match_operand 0 "" "")
7371 (match_operand 1 "" ""))
7372 (use (match_operand 2 "" ""))]
7375 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
7376 gen_rtx_REG (Pmode, RETURN_REGNUM));
7380 (define_insn "*bras"
7381 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7382 (match_operand 1 "const_int_operand" "n"))
7383 (clobber (match_operand 2 "register_operand" "=r"))]
7384 "!SIBLING_CALL_P (insn)
7385 && TARGET_SMALL_EXEC
7386 && GET_MODE (operands[2]) == Pmode"
7388 [(set_attr "op_type" "RI")
7389 (set_attr "type" "jsr")])
7391 (define_insn "*brasl"
7392 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7393 (match_operand 1 "const_int_operand" "n"))
7394 (clobber (match_operand 2 "register_operand" "=r"))]
7395 "!SIBLING_CALL_P (insn)
7397 && GET_MODE (operands[2]) == Pmode"
7399 [(set_attr "op_type" "RIL")
7400 (set_attr "type" "jsr")])
7402 (define_insn "*basr"
7403 [(call (mem:QI (match_operand 0 "address_operand" "U"))
7404 (match_operand 1 "const_int_operand" "n"))
7405 (clobber (match_operand 2 "register_operand" "=r"))]
7406 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
7408 if (get_attr_op_type (insn) == OP_TYPE_RR)
7409 return "basr\t%2,%0";
7411 return "bas\t%2,%a0";
7413 [(set (attr "op_type")
7414 (if_then_else (match_operand 0 "register_operand" "")
7415 (const_string "RR") (const_string "RX")))
7416 (set_attr "type" "jsr")
7417 (set_attr "atype" "agen")])
7420 ; call_value instruction pattern(s).
7423 (define_expand "call_value"
7424 [(set (match_operand 0 "" "")
7425 (call (match_operand 1 "" "")
7426 (match_operand 2 "" "")))
7427 (use (match_operand 3 "" ""))]
7430 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
7431 gen_rtx_REG (Pmode, RETURN_REGNUM));
7435 (define_insn "*bras_r"
7436 [(set (match_operand 0 "" "")
7437 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7438 (match_operand:SI 2 "const_int_operand" "n")))
7439 (clobber (match_operand 3 "register_operand" "=r"))]
7440 "!SIBLING_CALL_P (insn)
7441 && TARGET_SMALL_EXEC
7442 && GET_MODE (operands[3]) == Pmode"
7444 [(set_attr "op_type" "RI")
7445 (set_attr "type" "jsr")])
7447 (define_insn "*brasl_r"
7448 [(set (match_operand 0 "" "")
7449 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7450 (match_operand 2 "const_int_operand" "n")))
7451 (clobber (match_operand 3 "register_operand" "=r"))]
7452 "!SIBLING_CALL_P (insn)
7454 && GET_MODE (operands[3]) == Pmode"
7456 [(set_attr "op_type" "RIL")
7457 (set_attr "type" "jsr")])
7459 (define_insn "*basr_r"
7460 [(set (match_operand 0 "" "")
7461 (call (mem:QI (match_operand 1 "address_operand" "U"))
7462 (match_operand 2 "const_int_operand" "n")))
7463 (clobber (match_operand 3 "register_operand" "=r"))]
7464 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7466 if (get_attr_op_type (insn) == OP_TYPE_RR)
7467 return "basr\t%3,%1";
7469 return "bas\t%3,%a1";
7471 [(set (attr "op_type")
7472 (if_then_else (match_operand 1 "register_operand" "")
7473 (const_string "RR") (const_string "RX")))
7474 (set_attr "type" "jsr")
7475 (set_attr "atype" "agen")])
7478 ;;- Thread-local storage support.
7481 (define_expand "get_tp_64"
7482 [(set (match_operand:DI 0 "nonimmediate_operand" "") (reg:DI 36))]
7486 (define_expand "get_tp_31"
7487 [(set (match_operand:SI 0 "nonimmediate_operand" "") (reg:SI 36))]
7491 (define_expand "set_tp_64"
7492 [(set (reg:DI 36) (match_operand:DI 0 "nonimmediate_operand" ""))
7493 (unspec_volatile [(reg:DI 36)] UNSPECV_SET_TP)]
7497 (define_expand "set_tp_31"
7498 [(set (reg:SI 36) (match_operand:SI 0 "nonimmediate_operand" ""))
7499 (unspec_volatile [(reg:SI 36)] UNSPECV_SET_TP)]
7503 (define_insn "*set_tp"
7504 [(unspec_volatile [(reg 36)] UNSPECV_SET_TP)]
7507 [(set_attr "type" "none")
7508 (set_attr "length" "0")])
7510 (define_insn "*tls_load_64"
7511 [(set (match_operand:DI 0 "register_operand" "=d")
7512 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7513 (match_operand:DI 2 "" "")]
7517 [(set_attr "op_type" "RXE")])
7519 (define_insn "*tls_load_31"
7520 [(set (match_operand:SI 0 "register_operand" "=d,d")
7521 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7522 (match_operand:SI 2 "" "")]
7528 [(set_attr "op_type" "RX,RXY")])
7530 (define_insn "*bras_tls"
7531 [(set (match_operand 0 "" "")
7532 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7533 (match_operand 2 "const_int_operand" "n")))
7534 (clobber (match_operand 3 "register_operand" "=r"))
7535 (use (match_operand 4 "" ""))]
7536 "!SIBLING_CALL_P (insn)
7537 && TARGET_SMALL_EXEC
7538 && GET_MODE (operands[3]) == Pmode"
7540 [(set_attr "op_type" "RI")
7541 (set_attr "type" "jsr")])
7543 (define_insn "*brasl_tls"
7544 [(set (match_operand 0 "" "")
7545 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7546 (match_operand 2 "const_int_operand" "n")))
7547 (clobber (match_operand 3 "register_operand" "=r"))
7548 (use (match_operand 4 "" ""))]
7549 "!SIBLING_CALL_P (insn)
7551 && GET_MODE (operands[3]) == Pmode"
7553 [(set_attr "op_type" "RIL")
7554 (set_attr "type" "jsr")])
7556 (define_insn "*basr_tls"
7557 [(set (match_operand 0 "" "")
7558 (call (mem:QI (match_operand 1 "address_operand" "U"))
7559 (match_operand 2 "const_int_operand" "n")))
7560 (clobber (match_operand 3 "register_operand" "=r"))
7561 (use (match_operand 4 "" ""))]
7562 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7564 if (get_attr_op_type (insn) == OP_TYPE_RR)
7565 return "basr\t%3,%1%J4";
7567 return "bas\t%3,%a1%J4";
7569 [(set (attr "op_type")
7570 (if_then_else (match_operand 1 "register_operand" "")
7571 (const_string "RR") (const_string "RX")))
7572 (set_attr "type" "jsr")
7573 (set_attr "atype" "agen")])
7576 ;;- Miscellaneous instructions.
7580 ; allocate stack instruction pattern(s).
7583 (define_expand "allocate_stack"
7584 [(match_operand 0 "general_operand" "")
7585 (match_operand 1 "general_operand" "")]
7586 "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN"
7588 rtx temp = gen_reg_rtx (Pmode);
7590 emit_move_insn (temp, s390_back_chain_rtx ());
7591 anti_adjust_stack (operands[1]);
7592 emit_move_insn (s390_back_chain_rtx (), temp);
7594 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7600 ; setjmp instruction pattern.
7603 (define_expand "builtin_setjmp_receiver"
7604 [(match_operand 0 "" "")]
7607 emit_insn (s390_load_got ());
7608 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7612 ;; These patterns say how to save and restore the stack pointer. We need not
7613 ;; save the stack pointer at function level since we are careful to
7614 ;; preserve the backchain. At block level, we have to restore the backchain
7615 ;; when we restore the stack pointer.
7617 ;; For nonlocal gotos, we must save both the stack pointer and its
7618 ;; backchain and restore both. Note that in the nonlocal case, the
7619 ;; save area is a memory location.
7621 (define_expand "save_stack_function"
7622 [(match_operand 0 "general_operand" "")
7623 (match_operand 1 "general_operand" "")]
7627 (define_expand "restore_stack_function"
7628 [(match_operand 0 "general_operand" "")
7629 (match_operand 1 "general_operand" "")]
7633 (define_expand "restore_stack_block"
7634 [(match_operand 0 "register_operand" "")
7635 (match_operand 1 "register_operand" "")]
7636 "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN"
7638 rtx temp = gen_reg_rtx (Pmode);
7640 emit_move_insn (temp, s390_back_chain_rtx ());
7641 emit_move_insn (operands[0], operands[1]);
7642 emit_move_insn (s390_back_chain_rtx (), temp);
7647 (define_expand "save_stack_nonlocal"
7648 [(match_operand 0 "memory_operand" "")
7649 (match_operand 1 "register_operand" "")]
7652 enum machine_mode mode = TARGET_64BIT ? OImode : TImode;
7653 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
7655 /* Copy the backchain to the first word, sp to the second and the
7656 literal pool base to the third. */
7658 if (TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN)
7660 rtx temp = force_reg (Pmode, s390_back_chain_rtx ());
7661 emit_move_insn (operand_subword (operands[0], 0, 0, mode), temp);
7664 emit_move_insn (operand_subword (operands[0], 1, 0, mode), operands[1]);
7665 emit_move_insn (operand_subword (operands[0], 2, 0, mode), base);
7670 (define_expand "restore_stack_nonlocal"
7671 [(match_operand 0 "register_operand" "")
7672 (match_operand 1 "memory_operand" "")]
7675 enum machine_mode mode = TARGET_64BIT ? OImode : TImode;
7676 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
7677 rtx temp = NULL_RTX;
7679 /* Restore the backchain from the first word, sp from the second and the
7680 literal pool base from the third. */
7682 if (TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN)
7683 temp = force_reg (Pmode, operand_subword (operands[1], 0, 0, mode));
7685 emit_move_insn (base, operand_subword (operands[1], 2, 0, mode));
7686 emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, mode));
7689 emit_move_insn (s390_back_chain_rtx (), temp);
7691 emit_insn (gen_rtx_USE (VOIDmode, base));
7697 ; nop instruction pattern(s).
7704 [(set_attr "op_type" "RR")])
7708 ; Special literal pool access instruction pattern(s).
7711 (define_insn "*pool_entry"
7712 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7713 UNSPECV_POOL_ENTRY)]
7716 enum machine_mode mode = GET_MODE (PATTERN (insn));
7717 unsigned int align = GET_MODE_BITSIZE (mode);
7718 s390_output_pool_entry (operands[0], mode, align);
7721 [(set (attr "length")
7722 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7724 (define_insn "pool_align"
7725 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")]
7726 UNSPECV_POOL_ALIGN)]
7729 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7731 (define_insn "pool_section_start"
7732 [(unspec_volatile [(const_int 1)] UNSPECV_POOL_SECTION)]
7735 [(set_attr "length" "0")])
7737 (define_insn "pool_section_end"
7738 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_SECTION)]
7741 [(set_attr "length" "0")])
7743 (define_insn "main_base_31_small"
7744 [(set (match_operand 0 "register_operand" "=a")
7745 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7746 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7748 [(set_attr "op_type" "RR")
7749 (set_attr "type" "la")])
7751 (define_insn "main_base_31_large"
7752 [(set (match_operand 0 "register_operand" "=a")
7753 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7754 (set (pc) (label_ref (match_operand 2 "" "")))]
7755 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7757 [(set_attr "op_type" "RI")])
7759 (define_insn "main_base_64"
7760 [(set (match_operand 0 "register_operand" "=a")
7761 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7762 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7764 [(set_attr "op_type" "RIL")
7765 (set_attr "type" "larl")])
7767 (define_insn "main_pool"
7768 [(set (match_operand 0 "register_operand" "=a")
7769 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
7770 "GET_MODE (operands[0]) == Pmode"
7773 (if_then_else (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
7774 (const_string "larl") (const_string "la")))])
7776 (define_insn "reload_base_31"
7777 [(set (match_operand 0 "register_operand" "=a")
7778 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7779 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7780 "basr\t%0,0\;la\t%0,%1-.(%0)"
7781 [(set_attr "length" "6")
7782 (set_attr "type" "la")])
7784 (define_insn "reload_base_64"
7785 [(set (match_operand 0 "register_operand" "=a")
7786 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7787 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7789 [(set_attr "op_type" "RIL")
7790 (set_attr "type" "larl")])
7793 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7796 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7799 ;; Insns related to generating the function prologue and epilogue.
7803 (define_expand "prologue"
7804 [(use (const_int 0))]
7806 "s390_emit_prologue (); DONE;")
7808 (define_insn "prologue_tpf"
7809 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_PROLOGUE)
7810 (clobber (reg:DI 1))]
7811 "TARGET_TPF_PROFILING"
7813 [(set_attr "type" "jsr")
7814 (set_attr "op_type" "RX")])
7816 (define_expand "epilogue"
7817 [(use (const_int 1))]
7819 "s390_emit_epilogue (false); DONE;")
7821 (define_insn "epilogue_tpf"
7822 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_EPILOGUE)
7823 (clobber (reg:DI 1))]
7824 "TARGET_TPF_PROFILING"
7826 [(set_attr "type" "jsr")
7827 (set_attr "op_type" "RX")])
7830 (define_expand "sibcall_epilogue"
7831 [(use (const_int 0))]
7833 "s390_emit_epilogue (true); DONE;")
7835 (define_insn "*return"
7837 (use (match_operand 0 "register_operand" "a"))]
7838 "GET_MODE (operands[0]) == Pmode"
7840 [(set_attr "op_type" "RR")
7841 (set_attr "type" "jsr")
7842 (set_attr "atype" "agen")])
7845 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7846 ;; pointer. This is used for compatibility.
7848 (define_expand "ptr_extend"
7849 [(set (match_operand:DI 0 "register_operand" "=r")
7850 (match_operand:SI 1 "register_operand" "r"))]
7853 emit_insn (gen_anddi3 (operands[0],
7854 gen_lowpart (DImode, operands[1]),
7855 GEN_INT (0x7fffffff)));
7859 ;; Instruction definition to expand eh_return macro to support
7860 ;; swapping in special linkage return addresses.
7862 (define_expand "eh_return"
7863 [(use (match_operand 0 "register_operand" ""))]
7866 s390_emit_tpf_eh_return (operands[0]);