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 condition code to integer in range (-1, 0, 1)
2281 (define_insn "*cmpint_si"
2282 [(set (match_operand:SI 0 "register_operand" "=d")
2283 (unspec:SI [(reg:CCU 33)] UNSPEC_CMPINT))]
2286 output_asm_insn ("lhi\t%0,1", operands);
2287 output_asm_insn ("jh\t.+12", operands);
2288 output_asm_insn ("jl\t.+6", operands);
2289 output_asm_insn ("sr\t%0,%0", operands);
2290 return "lcr\t%0,%0";
2292 [(set_attr "length" "16")])
2294 (define_insn "*cmpint_di"
2295 [(set (match_operand:DI 0 "register_operand" "=d")
2296 (sign_extend:DI (unspec:SI [(reg:CCU 33)] UNSPEC_CMPINT)))]
2299 output_asm_insn ("lghi\t%0,1", operands);
2300 output_asm_insn ("jh\t.+16", operands);
2301 output_asm_insn ("jl\t.+8", operands);
2302 output_asm_insn ("sgr\t%0,%0", operands);
2303 return "lcgr\t%0,%0";
2305 [(set_attr "length" "20")])
2309 ;;- Conversion instructions.
2312 (define_insn "*sethighqisi"
2313 [(set (match_operand:SI 0 "register_operand" "=d,d")
2314 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2315 (clobber (reg:CC 33))]
2320 [(set_attr "op_type" "RS,RSY")])
2322 (define_insn "*sethighhisi"
2323 [(set (match_operand:SI 0 "register_operand" "=d,d")
2324 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2325 (clobber (reg:CC 33))]
2330 [(set_attr "op_type" "RS,RSY")])
2332 (define_insn "*sethighqidi_64"
2333 [(set (match_operand:DI 0 "register_operand" "=d")
2334 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2335 (clobber (reg:CC 33))]
2338 [(set_attr "op_type" "RSY")])
2340 (define_insn "*sethighqidi_31"
2341 [(set (match_operand:DI 0 "register_operand" "=d,d")
2342 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2343 (clobber (reg:CC 33))]
2348 [(set_attr "op_type" "RS,RSY")])
2350 (define_insn_and_split "*extractqi"
2351 [(set (match_operand:SI 0 "register_operand" "=d")
2352 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2353 (match_operand 2 "const_int_operand" "n")
2355 (clobber (reg:CC 33))]
2357 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2359 "&& reload_completed"
2361 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2362 (clobber (reg:CC 33))])
2363 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2365 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2366 operands[1] = change_address (operands[1], QImode, 0);
2369 (define_insn_and_split "*extracthi"
2370 [(set (match_operand:SI 0 "register_operand" "=d")
2371 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2372 (match_operand 2 "const_int_operand" "n")
2374 (clobber (reg:CC 33))]
2376 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2378 "&& reload_completed"
2380 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2381 (clobber (reg:CC 33))])
2382 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2384 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2385 operands[1] = change_address (operands[1], HImode, 0);
2389 ; extendsidi2 instruction pattern(s).
2392 (define_expand "extendsidi2"
2393 [(set (match_operand:DI 0 "register_operand" "")
2394 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2400 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2401 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2402 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2403 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2409 (define_insn "*extendsidi2"
2410 [(set (match_operand:DI 0 "register_operand" "=d,d")
2411 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2416 [(set_attr "op_type" "RRE,RXY")])
2419 ; extendhidi2 instruction pattern(s).
2422 (define_expand "extendhidi2"
2423 [(set (match_operand:DI 0 "register_operand" "")
2424 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2430 rtx tmp = gen_reg_rtx (SImode);
2431 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2432 emit_insn (gen_extendsidi2 (operands[0], tmp));
2437 operands[1] = gen_lowpart (DImode, operands[1]);
2438 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2439 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2445 (define_insn "*extendhidi2"
2446 [(set (match_operand:DI 0 "register_operand" "=d")
2447 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2450 [(set_attr "op_type" "RXY")])
2453 ; extendqidi2 instruction pattern(s).
2456 (define_expand "extendqidi2"
2457 [(set (match_operand:DI 0 "register_operand" "")
2458 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2464 rtx tmp = gen_reg_rtx (SImode);
2465 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2466 emit_insn (gen_extendsidi2 (operands[0], tmp));
2471 operands[1] = gen_lowpart (DImode, operands[1]);
2472 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2473 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2479 (define_insn "*extendqidi2"
2480 [(set (match_operand:DI 0 "register_operand" "=d")
2481 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2482 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2484 [(set_attr "op_type" "RXY")])
2486 (define_insn_and_split "*extendqidi2_short_displ"
2487 [(set (match_operand:DI 0 "register_operand" "=d")
2488 (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))
2489 (clobber (reg:CC 33))]
2490 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2492 "&& reload_completed"
2494 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2495 (clobber (reg:CC 33))])
2497 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2498 (clobber (reg:CC 33))])]
2502 ; extendhisi2 instruction pattern(s).
2505 (define_expand "extendhisi2"
2506 [(set (match_operand:SI 0 "register_operand" "")
2507 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2511 operands[1] = gen_lowpart (SImode, operands[1]);
2512 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2513 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2518 (define_insn "*extendhisi2"
2519 [(set (match_operand:SI 0 "register_operand" "=d,d")
2520 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2525 [(set_attr "op_type" "RX,RXY")])
2528 ; extendqisi2 instruction pattern(s).
2531 (define_expand "extendqisi2"
2532 [(set (match_operand:SI 0 "register_operand" "")
2533 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2537 operands[1] = gen_lowpart (SImode, operands[1]);
2538 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2539 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2544 (define_insn "*extendqisi2"
2545 [(set (match_operand:SI 0 "register_operand" "=d")
2546 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2547 "TARGET_LONG_DISPLACEMENT"
2549 [(set_attr "op_type" "RXY")])
2551 (define_insn_and_split "*extendqisi2_short_displ"
2552 [(set (match_operand:SI 0 "register_operand" "=d")
2553 (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))
2554 (clobber (reg:CC 33))]
2555 "!TARGET_LONG_DISPLACEMENT"
2557 "&& reload_completed"
2559 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2560 (clobber (reg:CC 33))])
2562 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2563 (clobber (reg:CC 33))])]
2567 ; extendqihi2 instruction pattern(s).
2572 ; zero_extendsidi2 instruction pattern(s).
2575 (define_expand "zero_extendsidi2"
2576 [(set (match_operand:DI 0 "register_operand" "")
2577 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2583 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2584 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2585 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2591 (define_insn "*zero_extendsidi2"
2592 [(set (match_operand:DI 0 "register_operand" "=d,d")
2593 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2598 [(set_attr "op_type" "RRE,RXY")])
2601 ; zero_extendhidi2 instruction pattern(s).
2604 (define_expand "zero_extendhidi2"
2605 [(set (match_operand:DI 0 "register_operand" "")
2606 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2612 rtx tmp = gen_reg_rtx (SImode);
2613 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2614 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2619 operands[1] = gen_lowpart (DImode, operands[1]);
2620 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2621 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2627 (define_insn "*zero_extendhidi2"
2628 [(set (match_operand:DI 0 "register_operand" "=d")
2629 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2632 [(set_attr "op_type" "RXY")])
2635 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2638 (define_insn "*llgt_sisi"
2639 [(set (match_operand:SI 0 "register_operand" "=d,d")
2640 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2641 (const_int 2147483647)))]
2646 [(set_attr "op_type" "RRE,RXE")])
2649 [(set (match_operand:SI 0 "register_operand" "")
2650 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2651 (const_int 2147483647)))
2652 (clobber (reg:CC 33))]
2653 "TARGET_64BIT && reload_completed"
2655 (and:SI (match_dup 1)
2656 (const_int 2147483647)))]
2659 (define_insn "*llgt_didi"
2660 [(set (match_operand:DI 0 "register_operand" "=d,d")
2661 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2662 (const_int 2147483647)))]
2667 [(set_attr "op_type" "RRE,RXE")])
2670 [(set (match_operand:DI 0 "register_operand" "")
2671 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
2672 (const_int 2147483647)))
2673 (clobber (reg:CC 33))]
2674 "TARGET_64BIT && reload_completed"
2676 (and:DI (match_dup 1)
2677 (const_int 2147483647)))]
2680 (define_insn "*llgt_sidi"
2681 [(set (match_operand:DI 0 "register_operand" "=d")
2682 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2683 (const_int 2147483647)))]
2686 [(set_attr "op_type" "RXE")])
2688 (define_insn_and_split "*llgt_sidi_split"
2689 [(set (match_operand:DI 0 "register_operand" "=d")
2690 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2691 (const_int 2147483647)))
2692 (clobber (reg:CC 33))]
2695 "&& reload_completed"
2697 (and:DI (subreg:DI (match_dup 1) 0)
2698 (const_int 2147483647)))]
2702 ; zero_extendqidi2 instruction pattern(s)
2705 (define_expand "zero_extendqidi2"
2706 [(set (match_operand:DI 0 "register_operand" "")
2707 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2713 rtx tmp = gen_reg_rtx (SImode);
2714 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2715 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2720 operands[1] = gen_lowpart (DImode, operands[1]);
2721 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2722 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2728 (define_insn "*zero_extendqidi2"
2729 [(set (match_operand:DI 0 "register_operand" "=d")
2730 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2733 [(set_attr "op_type" "RXY")])
2736 ; zero_extendhisi2 instruction pattern(s).
2739 (define_expand "zero_extendhisi2"
2740 [(set (match_operand:SI 0 "register_operand" "")
2741 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2745 operands[1] = gen_lowpart (SImode, operands[1]);
2746 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2751 (define_insn "*zero_extendhisi2_64"
2752 [(set (match_operand:SI 0 "register_operand" "=d")
2753 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2756 [(set_attr "op_type" "RXY")])
2758 (define_insn_and_split "*zero_extendhisi2_31"
2759 [(set (match_operand:SI 0 "register_operand" "=&d")
2760 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2761 (clobber (reg:CC 33))]
2764 "&& reload_completed"
2765 [(set (match_dup 0) (const_int 0))
2767 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2768 (clobber (reg:CC 33))])]
2769 "operands[2] = gen_lowpart (HImode, operands[0]);")
2772 ; zero_extendqisi2 instruction pattern(s).
2775 (define_expand "zero_extendqisi2"
2776 [(set (match_operand:SI 0 "register_operand" "")
2777 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2781 operands[1] = gen_lowpart (SImode, operands[1]);
2782 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2787 (define_insn "*zero_extendqisi2_64"
2788 [(set (match_operand:SI 0 "register_operand" "=d")
2789 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2792 [(set_attr "op_type" "RXY")])
2794 (define_insn_and_split "*zero_extendqisi2_31"
2795 [(set (match_operand:SI 0 "register_operand" "=&d")
2796 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2799 "&& reload_completed"
2800 [(set (match_dup 0) (const_int 0))
2801 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2802 "operands[2] = gen_lowpart (QImode, operands[0]);")
2805 ; zero_extendqihi2 instruction pattern(s).
2808 (define_expand "zero_extendqihi2"
2809 [(set (match_operand:HI 0 "register_operand" "")
2810 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2814 operands[1] = gen_lowpart (HImode, operands[1]);
2815 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2820 (define_insn "*zero_extendqihi2_64"
2821 [(set (match_operand:HI 0 "register_operand" "=d")
2822 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2825 [(set_attr "op_type" "RXY")])
2827 (define_insn_and_split "*zero_extendqihi2_31"
2828 [(set (match_operand:HI 0 "register_operand" "=&d")
2829 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2832 "&& reload_completed"
2833 [(set (match_dup 0) (const_int 0))
2834 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2835 "operands[2] = gen_lowpart (QImode, operands[0]);")
2839 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2842 (define_expand "fixuns_truncdfdi2"
2843 [(set (match_operand:DI 0 "register_operand" "")
2844 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2845 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2847 rtx label1 = gen_label_rtx ();
2848 rtx label2 = gen_label_rtx ();
2849 rtx temp = gen_reg_rtx (DFmode);
2850 operands[1] = force_reg (DFmode, operands[1]);
2852 emit_insn (gen_cmpdf (operands[1],
2853 CONST_DOUBLE_FROM_REAL_VALUE (
2854 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2855 emit_jump_insn (gen_blt (label1));
2856 emit_insn (gen_subdf3 (temp, operands[1],
2857 CONST_DOUBLE_FROM_REAL_VALUE (
2858 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2859 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2862 emit_label (label1);
2863 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2864 emit_label (label2);
2868 (define_expand "fix_truncdfdi2"
2869 [(set (match_operand:DI 0 "register_operand" "")
2870 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2871 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2873 operands[1] = force_reg (DFmode, operands[1]);
2874 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2878 (define_insn "fix_truncdfdi2_ieee"
2879 [(set (match_operand:DI 0 "register_operand" "=d")
2880 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2881 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2882 (clobber (reg:CC 33))]
2883 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2885 [(set_attr "op_type" "RRE")
2886 (set_attr "type" "ftoi")])
2889 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2892 (define_expand "fixuns_truncdfsi2"
2893 [(set (match_operand:SI 0 "register_operand" "")
2894 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2895 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2897 rtx label1 = gen_label_rtx ();
2898 rtx label2 = gen_label_rtx ();
2899 rtx temp = gen_reg_rtx (DFmode);
2901 operands[1] = force_reg (DFmode,operands[1]);
2902 emit_insn (gen_cmpdf (operands[1],
2903 CONST_DOUBLE_FROM_REAL_VALUE (
2904 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2905 emit_jump_insn (gen_blt (label1));
2906 emit_insn (gen_subdf3 (temp, operands[1],
2907 CONST_DOUBLE_FROM_REAL_VALUE (
2908 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2909 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2912 emit_label (label1);
2913 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2914 emit_label (label2);
2918 (define_expand "fix_truncdfsi2"
2919 [(set (match_operand:SI 0 "register_operand" "")
2920 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2923 if (TARGET_IBM_FLOAT)
2925 /* This is the algorithm from POP chapter A.5.7.2. */
2927 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2928 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2929 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2931 operands[1] = force_reg (DFmode, operands[1]);
2932 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2933 two31r, two32, temp));
2937 operands[1] = force_reg (DFmode, operands[1]);
2938 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2944 (define_insn "fix_truncdfsi2_ieee"
2945 [(set (match_operand:SI 0 "register_operand" "=d")
2946 (fix:SI (match_operand:DF 1 "register_operand" "f")))
2947 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2948 (clobber (reg:CC 33))]
2949 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2951 [(set_attr "op_type" "RRE")
2952 (set_attr "type" "ftoi")])
2954 (define_insn "fix_truncdfsi2_ibm"
2955 [(set (match_operand:SI 0 "register_operand" "=d")
2956 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2957 (use (match_operand:DI 2 "immediate_operand" "m"))
2958 (use (match_operand:DI 3 "immediate_operand" "m"))
2959 (use (match_operand:BLK 4 "memory_operand" "m"))
2960 (clobber (reg:CC 33))]
2961 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2963 output_asm_insn ("sd\t%1,%2", operands);
2964 output_asm_insn ("aw\t%1,%3", operands);
2965 output_asm_insn ("std\t%1,%4", operands);
2966 output_asm_insn ("xi\t%N4,128", operands);
2969 [(set_attr "length" "20")])
2972 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
2975 (define_expand "fixuns_truncsfdi2"
2976 [(set (match_operand:DI 0 "register_operand" "")
2977 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2978 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2980 rtx label1 = gen_label_rtx ();
2981 rtx label2 = gen_label_rtx ();
2982 rtx temp = gen_reg_rtx (SFmode);
2984 operands[1] = force_reg (SFmode, operands[1]);
2985 emit_insn (gen_cmpsf (operands[1],
2986 CONST_DOUBLE_FROM_REAL_VALUE (
2987 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
2988 emit_jump_insn (gen_blt (label1));
2990 emit_insn (gen_subsf3 (temp, operands[1],
2991 CONST_DOUBLE_FROM_REAL_VALUE (
2992 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
2993 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
2996 emit_label (label1);
2997 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2998 emit_label (label2);
3002 (define_expand "fix_truncsfdi2"
3003 [(set (match_operand:DI 0 "register_operand" "")
3004 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
3005 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3007 operands[1] = force_reg (SFmode, operands[1]);
3008 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
3012 (define_insn "fix_truncsfdi2_ieee"
3013 [(set (match_operand:DI 0 "register_operand" "=d")
3014 (fix:DI (match_operand:SF 1 "register_operand" "f")))
3015 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3016 (clobber (reg:CC 33))]
3017 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3019 [(set_attr "op_type" "RRE")
3020 (set_attr "type" "ftoi")])
3023 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
3026 (define_expand "fixuns_truncsfsi2"
3027 [(set (match_operand:SI 0 "register_operand" "")
3028 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
3029 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3031 rtx label1 = gen_label_rtx ();
3032 rtx label2 = gen_label_rtx ();
3033 rtx temp = gen_reg_rtx (SFmode);
3035 operands[1] = force_reg (SFmode, operands[1]);
3036 emit_insn (gen_cmpsf (operands[1],
3037 CONST_DOUBLE_FROM_REAL_VALUE (
3038 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
3039 emit_jump_insn (gen_blt (label1));
3040 emit_insn (gen_subsf3 (temp, operands[1],
3041 CONST_DOUBLE_FROM_REAL_VALUE (
3042 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
3043 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
3046 emit_label (label1);
3047 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3048 emit_label (label2);
3052 (define_expand "fix_truncsfsi2"
3053 [(set (match_operand:SI 0 "register_operand" "")
3054 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
3057 if (TARGET_IBM_FLOAT)
3059 /* Convert to DFmode and then use the POP algorithm. */
3060 rtx temp = gen_reg_rtx (DFmode);
3061 emit_insn (gen_extendsfdf2 (temp, operands[1]));
3062 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
3066 operands[1] = force_reg (SFmode, operands[1]);
3067 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3073 (define_insn "fix_truncsfsi2_ieee"
3074 [(set (match_operand:SI 0 "register_operand" "=d")
3075 (fix:SI (match_operand:SF 1 "register_operand" "f")))
3076 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3077 (clobber (reg:CC 33))]
3078 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3080 [(set_attr "op_type" "RRE")
3081 (set_attr "type" "ftoi")])
3084 ; floatdidf2 instruction pattern(s).
3087 (define_insn "floatdidf2"
3088 [(set (match_operand:DF 0 "register_operand" "=f")
3089 (float:DF (match_operand:DI 1 "register_operand" "d")))]
3090 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3092 [(set_attr "op_type" "RRE")
3093 (set_attr "type" "itof" )])
3096 ; floatdisf2 instruction pattern(s).
3099 (define_insn "floatdisf2"
3100 [(set (match_operand:SF 0 "register_operand" "=f")
3101 (float:SF (match_operand:DI 1 "register_operand" "d")))]
3102 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3104 [(set_attr "op_type" "RRE")
3105 (set_attr "type" "itof" )])
3108 ; floatsidf2 instruction pattern(s).
3111 (define_expand "floatsidf2"
3112 [(set (match_operand:DF 0 "register_operand" "")
3113 (float:DF (match_operand:SI 1 "register_operand" "")))]
3116 if (TARGET_IBM_FLOAT)
3118 /* This is the algorithm from POP chapter A.5.7.1. */
3120 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3121 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
3123 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
3128 (define_insn "floatsidf2_ieee"
3129 [(set (match_operand:DF 0 "register_operand" "=f")
3130 (float:DF (match_operand:SI 1 "register_operand" "d")))]
3131 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3133 [(set_attr "op_type" "RRE")
3134 (set_attr "type" "itof" )])
3136 (define_insn "floatsidf2_ibm"
3137 [(set (match_operand:DF 0 "register_operand" "=f")
3138 (float:DF (match_operand:SI 1 "register_operand" "d")))
3139 (use (match_operand:DI 2 "immediate_operand" "m"))
3140 (use (match_operand:BLK 3 "memory_operand" "m"))
3141 (clobber (reg:CC 33))]
3142 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3144 output_asm_insn ("st\t%1,%N3", operands);
3145 output_asm_insn ("xi\t%N3,128", operands);
3146 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3147 output_asm_insn ("ld\t%0,%3", operands);
3150 [(set_attr "length" "20")])
3153 ; floatsisf2 instruction pattern(s).
3156 (define_expand "floatsisf2"
3157 [(set (match_operand:SF 0 "register_operand" "")
3158 (float:SF (match_operand:SI 1 "register_operand" "")))]
3161 if (TARGET_IBM_FLOAT)
3163 /* Use the POP algorithm to convert to DFmode and then truncate. */
3164 rtx temp = gen_reg_rtx (DFmode);
3165 emit_insn (gen_floatsidf2 (temp, operands[1]));
3166 emit_insn (gen_truncdfsf2 (operands[0], temp));
3171 (define_insn "floatsisf2_ieee"
3172 [(set (match_operand:SF 0 "register_operand" "=f")
3173 (float:SF (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" )])
3180 ; truncdfsf2 instruction pattern(s).
3183 (define_expand "truncdfsf2"
3184 [(set (match_operand:SF 0 "register_operand" "")
3185 (float_truncate:SF (match_operand:DF 1 "register_operand" "")))]
3189 (define_insn "truncdfsf2_ieee"
3190 [(set (match_operand:SF 0 "register_operand" "=f")
3191 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
3192 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3194 [(set_attr "op_type" "RRE")])
3196 (define_insn "truncdfsf2_ibm"
3197 [(set (match_operand:SF 0 "register_operand" "=f,f")
3198 (float_truncate:SF (match_operand:DF 1 "nonimmediate_operand" "f,R")))]
3199 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3203 [(set_attr "op_type" "RR,RX")
3204 (set_attr "type" "floads,floads")])
3207 ; extendsfdf2 instruction pattern(s).
3210 (define_expand "extendsfdf2"
3211 [(set (match_operand:DF 0 "register_operand" "")
3212 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3215 if (TARGET_IBM_FLOAT)
3217 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3222 (define_insn "extendsfdf2_ieee"
3223 [(set (match_operand:DF 0 "register_operand" "=f,f")
3224 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3225 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3229 [(set_attr "op_type" "RRE,RXE")
3230 (set_attr "type" "floads,floads")])
3232 (define_insn "extendsfdf2_ibm"
3233 [(set (match_operand:DF 0 "register_operand" "=f,f")
3234 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3235 (clobber (reg:CC 33))]
3236 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3238 sdr\t%0,%0\;ler\t%0,%1
3239 sdr\t%0,%0\;le\t%0,%1"
3240 [(set_attr "length" "4,6")
3241 (set_attr "type" "floads,floads")])
3245 ;; ARITHMETIC OPERATIONS
3247 ; arithmetic operations set the ConditionCode,
3248 ; because of unpredictable Bits in Register for Halfword and Byte
3249 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3252 ;;- Add instructions.
3256 ; addti3 instruction pattern(s).
3259 (define_insn_and_split "addti3"
3260 [(set (match_operand:TI 0 "register_operand" "=&d")
3261 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
3262 (match_operand:TI 2 "general_operand" "do") ) )
3263 (clobber (reg:CC 33))]
3266 "&& reload_completed"
3269 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
3271 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
3273 [(set (match_dup 3) (plus:DI (plus:DI (match_dup 4) (match_dup 5))
3274 (ltu:DI (reg:CCL1 33) (const_int 0))))
3275 (clobber (reg:CC 33))])]
3276 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3277 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3278 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3279 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3280 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3281 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
3284 ; adddi3 instruction pattern(s).
3287 (define_insn "*adddi3_sign"
3288 [(set (match_operand:DI 0 "register_operand" "=d,d")
3289 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3290 (match_operand:DI 1 "register_operand" "0,0")))
3291 (clobber (reg:CC 33))]
3296 [(set_attr "op_type" "RRE,RXY")])
3298 (define_insn "*adddi3_zero_cc"
3300 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3301 (match_operand:DI 1 "register_operand" "0,0"))
3303 (set (match_operand:DI 0 "register_operand" "=d,d")
3304 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3305 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3309 [(set_attr "op_type" "RRE,RXY")])
3311 (define_insn "*adddi3_zero_cconly"
3313 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3314 (match_operand:DI 1 "register_operand" "0,0"))
3316 (clobber (match_scratch:DI 0 "=d,d"))]
3317 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3321 [(set_attr "op_type" "RRE,RXY")])
3323 (define_insn "*adddi3_zero"
3324 [(set (match_operand:DI 0 "register_operand" "=d,d")
3325 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3326 (match_operand:DI 1 "register_operand" "0,0")))
3327 (clobber (reg:CC 33))]
3332 [(set_attr "op_type" "RRE,RXY")])
3334 (define_insn "*adddi3_imm_cc"
3336 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3337 (match_operand:DI 2 "const_int_operand" "K"))
3339 (set (match_operand:DI 0 "register_operand" "=d")
3340 (plus:DI (match_dup 1) (match_dup 2)))]
3342 && s390_match_ccmode (insn, CCAmode)
3343 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3345 [(set_attr "op_type" "RI")])
3347 (define_insn "*adddi3_carry1_cc"
3349 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3350 (match_operand:DI 2 "general_operand" "d,m"))
3352 (set (match_operand:DI 0 "register_operand" "=d,d")
3353 (plus:DI (match_dup 1) (match_dup 2)))]
3354 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3358 [(set_attr "op_type" "RRE,RXY")])
3360 (define_insn "*adddi3_carry1_cconly"
3362 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3363 (match_operand:DI 2 "general_operand" "d,m"))
3365 (clobber (match_scratch:DI 0 "=d,d"))]
3366 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3370 [(set_attr "op_type" "RRE,RXY")])
3372 (define_insn "*adddi3_carry2_cc"
3374 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3375 (match_operand:DI 2 "general_operand" "d,m"))
3377 (set (match_operand:DI 0 "register_operand" "=d,d")
3378 (plus:DI (match_dup 1) (match_dup 2)))]
3379 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3383 [(set_attr "op_type" "RRE,RXY")])
3385 (define_insn "*adddi3_carry2_cconly"
3387 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3388 (match_operand:DI 2 "general_operand" "d,m"))
3390 (clobber (match_scratch:DI 0 "=d,d"))]
3391 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3395 [(set_attr "op_type" "RRE,RXY")])
3397 (define_insn "*adddi3_cc"
3399 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3400 (match_operand:DI 2 "general_operand" "d,m"))
3402 (set (match_operand:DI 0 "register_operand" "=d,d")
3403 (plus:DI (match_dup 1) (match_dup 2)))]
3404 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3408 [(set_attr "op_type" "RRE,RXY")])
3410 (define_insn "*adddi3_cconly"
3412 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3413 (match_operand:DI 2 "general_operand" "d,m"))
3415 (clobber (match_scratch:DI 0 "=d,d"))]
3416 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3420 [(set_attr "op_type" "RRE,RXY")])
3422 (define_insn "*adddi3_cconly2"
3424 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3425 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3426 (clobber (match_scratch:DI 0 "=d,d"))]
3427 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3431 [(set_attr "op_type" "RRE,RXY")])
3433 (define_insn "*adddi3_64"
3434 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3435 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3436 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3437 (clobber (reg:CC 33))]
3443 [(set_attr "op_type" "RRE,RI,RXY")])
3445 (define_insn_and_split "*adddi3_31z"
3446 [(set (match_operand:DI 0 "register_operand" "=&d")
3447 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3448 (match_operand:DI 2 "general_operand" "do") ) )
3449 (clobber (reg:CC 33))]
3450 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3452 "&& reload_completed"
3455 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3457 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3459 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3460 (ltu:SI (reg:CCL1 33) (const_int 0))))
3461 (clobber (reg:CC 33))])]
3462 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3463 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3464 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3465 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3466 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3467 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
3469 (define_insn_and_split "*adddi3_31"
3470 [(set (match_operand:DI 0 "register_operand" "=&d")
3471 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3472 (match_operand:DI 2 "general_operand" "do") ) )
3473 (clobber (reg:CC 33))]
3476 "&& reload_completed"
3478 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3479 (clobber (reg:CC 33))])
3482 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3484 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3486 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3488 (label_ref (match_dup 9))))
3490 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3491 (clobber (reg:CC 33))])
3493 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3494 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3495 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3496 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3497 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3498 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3499 operands[9] = gen_label_rtx ();")
3501 (define_expand "adddi3"
3503 [(set (match_operand:DI 0 "register_operand" "")
3504 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3505 (match_operand:DI 2 "general_operand" "")))
3506 (clobber (reg:CC 33))])]
3511 ; addsi3 instruction pattern(s).
3514 (define_insn "*addsi3_imm_cc"
3516 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3517 (match_operand:SI 2 "const_int_operand" "K"))
3519 (set (match_operand:SI 0 "register_operand" "=d")
3520 (plus:SI (match_dup 1) (match_dup 2)))]
3521 "s390_match_ccmode (insn, CCAmode)
3522 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3524 [(set_attr "op_type" "RI")])
3526 (define_insn "*addsi3_carry1_cc"
3528 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3529 (match_operand:SI 2 "general_operand" "d,R,T"))
3531 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3532 (plus:SI (match_dup 1) (match_dup 2)))]
3533 "s390_match_ccmode (insn, CCL1mode)"
3538 [(set_attr "op_type" "RR,RX,RXY")])
3540 (define_insn "*addsi3_carry1_cconly"
3542 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3543 (match_operand:SI 2 "general_operand" "d,R,T"))
3545 (clobber (match_scratch:SI 0 "=d,d,d"))]
3546 "s390_match_ccmode (insn, CCL1mode)"
3551 [(set_attr "op_type" "RR,RX,RXY")])
3553 (define_insn "*addsi3_carry2_cc"
3555 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3556 (match_operand:SI 2 "general_operand" "d,R,T"))
3558 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3559 (plus:SI (match_dup 1) (match_dup 2)))]
3560 "s390_match_ccmode (insn, CCL1mode)"
3565 [(set_attr "op_type" "RR,RX,RXY")])
3567 (define_insn "*addsi3_carry2_cconly"
3569 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3570 (match_operand:SI 2 "general_operand" "d,R,T"))
3572 (clobber (match_scratch:SI 0 "=d,d,d"))]
3573 "s390_match_ccmode (insn, CCL1mode)"
3578 [(set_attr "op_type" "RR,RX,RXY")])
3580 (define_insn "*addsi3_cc"
3582 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3583 (match_operand:SI 2 "general_operand" "d,R,T"))
3585 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3586 (plus:SI (match_dup 1) (match_dup 2)))]
3587 "s390_match_ccmode (insn, CCLmode)"
3592 [(set_attr "op_type" "RR,RX,RXY")])
3594 (define_insn "*addsi3_cconly"
3596 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3597 (match_operand:SI 2 "general_operand" "d,R,T"))
3599 (clobber (match_scratch:SI 0 "=d,d,d"))]
3600 "s390_match_ccmode (insn, CCLmode)"
3605 [(set_attr "op_type" "RR,RX,RXY")])
3607 (define_insn "*addsi3_cconly2"
3609 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3610 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3611 (clobber (match_scratch:SI 0 "=d,d,d"))]
3612 "s390_match_ccmode (insn, CCLmode)"
3617 [(set_attr "op_type" "RR,RX,RXY")])
3619 (define_insn "*addsi3_sign"
3620 [(set (match_operand:SI 0 "register_operand" "=d,d")
3621 (plus:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
3622 (match_operand:SI 1 "register_operand" "0,0")))
3623 (clobber (reg:CC 33))]
3628 [(set_attr "op_type" "RX,RXY")])
3630 (define_insn "addsi3"
3631 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3632 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3633 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3634 (clobber (reg:CC 33))]
3641 [(set_attr "op_type" "RR,RI,RX,RXY")])
3644 ; adddf3 instruction pattern(s).
3647 (define_expand "adddf3"
3649 [(set (match_operand:DF 0 "register_operand" "=f,f")
3650 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3651 (match_operand:DF 2 "general_operand" "f,R")))
3652 (clobber (reg:CC 33))])]
3656 (define_insn "*adddf3"
3657 [(set (match_operand:DF 0 "register_operand" "=f,f")
3658 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3659 (match_operand:DF 2 "general_operand" "f,R")))
3660 (clobber (reg:CC 33))]
3661 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3665 [(set_attr "op_type" "RRE,RXE")
3666 (set_attr "type" "fsimpd,fsimpd")])
3668 (define_insn "*adddf3_cc"
3670 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3671 (match_operand:DF 2 "general_operand" "f,R"))
3672 (match_operand:DF 3 "const0_operand" "")))
3673 (set (match_operand:DF 0 "register_operand" "=f,f")
3674 (plus:DF (match_dup 1) (match_dup 2)))]
3675 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3679 [(set_attr "op_type" "RRE,RXE")
3680 (set_attr "type" "fsimpd,fsimpd")])
3682 (define_insn "*adddf3_cconly"
3684 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3685 (match_operand:DF 2 "general_operand" "f,R"))
3686 (match_operand:DF 3 "const0_operand" "")))
3687 (clobber (match_scratch:DF 0 "=f,f"))]
3688 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3692 [(set_attr "op_type" "RRE,RXE")
3693 (set_attr "type" "fsimpd,fsimpd")])
3695 (define_insn "*adddf3_ibm"
3696 [(set (match_operand:DF 0 "register_operand" "=f,f")
3697 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3698 (match_operand:DF 2 "general_operand" "f,R")))
3699 (clobber (reg:CC 33))]
3700 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3704 [(set_attr "op_type" "RR,RX")
3705 (set_attr "type" "fsimpd,fsimpd")])
3708 ; addsf3 instruction pattern(s).
3711 (define_expand "addsf3"
3713 [(set (match_operand:SF 0 "register_operand" "=f,f")
3714 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3715 (match_operand:SF 2 "general_operand" "f,R")))
3716 (clobber (reg:CC 33))])]
3720 (define_insn "*addsf3"
3721 [(set (match_operand:SF 0 "register_operand" "=f,f")
3722 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3723 (match_operand:SF 2 "general_operand" "f,R")))
3724 (clobber (reg:CC 33))]
3725 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3729 [(set_attr "op_type" "RRE,RXE")
3730 (set_attr "type" "fsimps,fsimps")])
3732 (define_insn "*addsf3_cc"
3734 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3735 (match_operand:SF 2 "general_operand" "f,R"))
3736 (match_operand:SF 3 "const0_operand" "")))
3737 (set (match_operand:SF 0 "register_operand" "=f,f")
3738 (plus:SF (match_dup 1) (match_dup 2)))]
3739 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3743 [(set_attr "op_type" "RRE,RXE")
3744 (set_attr "type" "fsimps,fsimps")])
3746 (define_insn "*addsf3_cconly"
3748 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3749 (match_operand:SF 2 "general_operand" "f,R"))
3750 (match_operand:SF 3 "const0_operand" "")))
3751 (clobber (match_scratch:SF 0 "=f,f"))]
3752 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3756 [(set_attr "op_type" "RRE,RXE")
3757 (set_attr "type" "fsimps,fsimps")])
3759 (define_insn "*addsf3"
3760 [(set (match_operand:SF 0 "register_operand" "=f,f")
3761 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3762 (match_operand:SF 2 "general_operand" "f,R")))
3763 (clobber (reg:CC 33))]
3764 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3768 [(set_attr "op_type" "RR,RX")
3769 (set_attr "type" "fsimps,fsimps")])
3773 ;;- Subtract instructions.
3777 ; subti3 instruction pattern(s).
3780 (define_insn_and_split "subti3"
3781 [(set (match_operand:TI 0 "register_operand" "=&d")
3782 (minus:TI (match_operand:TI 1 "register_operand" "0")
3783 (match_operand:TI 2 "general_operand" "do") ) )
3784 (clobber (reg:CC 33))]
3787 "&& reload_completed"
3790 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
3792 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
3794 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
3795 (gtu:DI (reg:CCL2 33) (const_int 0))))
3796 (clobber (reg:CC 33))])]
3797 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3798 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3799 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3800 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3801 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3802 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
3805 ; subdi3 instruction pattern(s).
3808 (define_insn "*subdi3_sign"
3809 [(set (match_operand:DI 0 "register_operand" "=d,d")
3810 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3811 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3812 (clobber (reg:CC 33))]
3817 [(set_attr "op_type" "RRE,RXY")])
3819 (define_insn "*subdi3_zero_cc"
3821 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3822 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3824 (set (match_operand:DI 0 "register_operand" "=d,d")
3825 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3826 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3830 [(set_attr "op_type" "RRE,RXY")])
3832 (define_insn "*subdi3_zero_cconly"
3834 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3835 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3837 (clobber (match_scratch:DI 0 "=d,d"))]
3838 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3842 [(set_attr "op_type" "RRE,RXY")])
3844 (define_insn "*subdi3_zero"
3845 [(set (match_operand:DI 0 "register_operand" "=d,d")
3846 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3847 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3848 (clobber (reg:CC 33))]
3853 [(set_attr "op_type" "RRE,RXY")])
3855 (define_insn "*subdi3_borrow_cc"
3857 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3858 (match_operand:DI 2 "general_operand" "d,m"))
3860 (set (match_operand:DI 0 "register_operand" "=d,d")
3861 (minus:DI (match_dup 1) (match_dup 2)))]
3862 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3866 [(set_attr "op_type" "RRE,RXY")])
3868 (define_insn "*subdi3_borrow_cconly"
3870 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3871 (match_operand:DI 2 "general_operand" "d,m"))
3873 (clobber (match_scratch:DI 0 "=d,d"))]
3874 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3878 [(set_attr "op_type" "RRE,RXY")])
3880 (define_insn "*subdi3_cc"
3882 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3883 (match_operand:DI 2 "general_operand" "d,m"))
3885 (set (match_operand:DI 0 "register_operand" "=d,d")
3886 (minus:DI (match_dup 1) (match_dup 2)))]
3887 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3891 [(set_attr "op_type" "RRE,RXY")])
3893 (define_insn "*subdi3_cc2"
3895 (compare (match_operand:DI 1 "register_operand" "0,0")
3896 (match_operand:DI 2 "general_operand" "d,m")))
3897 (set (match_operand:DI 0 "register_operand" "=d,d")
3898 (minus:DI (match_dup 1) (match_dup 2)))]
3899 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3903 [(set_attr "op_type" "RRE,RXY")])
3905 (define_insn "*subdi3_cconly"
3907 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3908 (match_operand:DI 2 "general_operand" "d,m"))
3910 (clobber (match_scratch:DI 0 "=d,d"))]
3911 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3915 [(set_attr "op_type" "RRE,RXY")])
3917 (define_insn "*subdi3_cconly2"
3919 (compare (match_operand:DI 1 "register_operand" "0,0")
3920 (match_operand:DI 2 "general_operand" "d,m")))
3921 (clobber (match_scratch:DI 0 "=d,d"))]
3922 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3926 [(set_attr "op_type" "RRE,RXY")])
3928 (define_insn "*subdi3_64"
3929 [(set (match_operand:DI 0 "register_operand" "=d,d")
3930 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3931 (match_operand:DI 2 "general_operand" "d,m") ) )
3932 (clobber (reg:CC 33))]
3937 [(set_attr "op_type" "RRE,RRE")])
3939 (define_insn_and_split "*subdi3_31z"
3940 [(set (match_operand:DI 0 "register_operand" "=&d")
3941 (minus:DI (match_operand:DI 1 "register_operand" "0")
3942 (match_operand:DI 2 "general_operand" "do") ) )
3943 (clobber (reg:CC 33))]
3944 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3946 "&& reload_completed"
3949 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3951 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3953 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3954 (gtu:SI (reg:CCL2 33) (const_int 0))))
3955 (clobber (reg:CC 33))])]
3956 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3957 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3958 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3959 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3960 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3961 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
3963 (define_insn_and_split "*subdi3_31"
3964 [(set (match_operand:DI 0 "register_operand" "=&d")
3965 (minus:DI (match_operand:DI 1 "register_operand" "0")
3966 (match_operand:DI 2 "general_operand" "do") ) )
3967 (clobber (reg:CC 33))]
3970 "&& reload_completed"
3972 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3973 (clobber (reg:CC 33))])
3976 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3978 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3980 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3982 (label_ref (match_dup 9))))
3984 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3985 (clobber (reg:CC 33))])
3987 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3988 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3989 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3990 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3991 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3992 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3993 operands[9] = gen_label_rtx ();")
3995 (define_expand "subdi3"
3997 [(set (match_operand:DI 0 "register_operand" "")
3998 (minus:DI (match_operand:DI 1 "register_operand" "")
3999 (match_operand:DI 2 "general_operand" "")))
4000 (clobber (reg:CC 33))])]
4005 ; subsi3 instruction pattern(s).
4008 (define_insn "*subsi3_borrow_cc"
4010 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4011 (match_operand:SI 2 "general_operand" "d,R,T"))
4013 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4014 (minus:SI (match_dup 1) (match_dup 2)))]
4015 "s390_match_ccmode (insn, CCL2mode)"
4020 [(set_attr "op_type" "RR,RX,RXY")])
4022 (define_insn "*subsi3_borrow_cconly"
4024 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4025 (match_operand:SI 2 "general_operand" "d,R,T"))
4027 (clobber (match_scratch:SI 0 "=d,d,d"))]
4028 "s390_match_ccmode (insn, CCL2mode)"
4033 [(set_attr "op_type" "RR,RX,RXY")])
4035 (define_insn "*subsi3_cc"
4037 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4038 (match_operand:SI 2 "general_operand" "d,R,T"))
4040 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4041 (minus:SI (match_dup 1) (match_dup 2)))]
4042 "s390_match_ccmode (insn, CCLmode)"
4047 [(set_attr "op_type" "RR,RX,RXY")])
4049 (define_insn "*subsi3_cc2"
4051 (compare (match_operand:SI 1 "register_operand" "0,0,0")
4052 (match_operand:SI 2 "general_operand" "d,R,T")))
4053 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4054 (minus:SI (match_dup 1) (match_dup 2)))]
4055 "s390_match_ccmode (insn, CCL3mode)"
4060 [(set_attr "op_type" "RR,RX,RXY")])
4062 (define_insn "*subsi3_cconly"
4064 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4065 (match_operand:SI 2 "general_operand" "d,R,T"))
4067 (clobber (match_scratch:SI 0 "=d,d,d"))]
4068 "s390_match_ccmode (insn, CCLmode)"
4073 [(set_attr "op_type" "RR,RX,RXY")])
4075 (define_insn "*subsi3_cconly2"
4077 (compare (match_operand:SI 1 "register_operand" "0,0,0")
4078 (match_operand:SI 2 "general_operand" "d,R,T")))
4079 (clobber (match_scratch:SI 0 "=d,d,d"))]
4080 "s390_match_ccmode (insn, CCL3mode)"
4085 [(set_attr "op_type" "RR,RX,RXY")])
4087 (define_insn "*subsi3_sign"
4088 [(set (match_operand:SI 0 "register_operand" "=d,d")
4089 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
4090 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4091 (clobber (reg:CC 33))]
4096 [(set_attr "op_type" "RX,RXY")])
4098 (define_insn "subsi3"
4099 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4100 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4101 (match_operand:SI 2 "general_operand" "d,R,T")))
4102 (clobber (reg:CC 33))]
4108 [(set_attr "op_type" "RR,RX,RXY")])
4112 ; subdf3 instruction pattern(s).
4115 (define_expand "subdf3"
4117 [(set (match_operand:DF 0 "register_operand" "=f,f")
4118 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4119 (match_operand:DF 2 "general_operand" "f,R")))
4120 (clobber (reg:CC 33))])]
4124 (define_insn "*subdf3"
4125 [(set (match_operand:DF 0 "register_operand" "=f,f")
4126 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4127 (match_operand:DF 2 "general_operand" "f,R")))
4128 (clobber (reg:CC 33))]
4129 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4133 [(set_attr "op_type" "RRE,RXE")
4134 (set_attr "type" "fsimpd,fsimpd")])
4136 (define_insn "*subdf3_cc"
4138 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4139 (match_operand:DF 2 "general_operand" "f,R"))
4140 (match_operand:DF 3 "const0_operand" "")))
4141 (set (match_operand:DF 0 "register_operand" "=f,f")
4142 (minus:DF (match_dup 1) (match_dup 2)))]
4143 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4147 [(set_attr "op_type" "RRE,RXE")
4148 (set_attr "type" "fsimpd,fsimpd")])
4150 (define_insn "*subdf3_cconly"
4152 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4153 (match_operand:DF 2 "general_operand" "f,R"))
4154 (match_operand:DF 3 "const0_operand" "")))
4155 (clobber (match_scratch:DF 0 "=f,f"))]
4156 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4160 [(set_attr "op_type" "RRE,RXE")
4161 (set_attr "type" "fsimpd,fsimpd")])
4163 (define_insn "*subdf3_ibm"
4164 [(set (match_operand:DF 0 "register_operand" "=f,f")
4165 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4166 (match_operand:DF 2 "general_operand" "f,R")))
4167 (clobber (reg:CC 33))]
4168 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4172 [(set_attr "op_type" "RR,RX")
4173 (set_attr "type" "fsimpd,fsimpd")])
4176 ; subsf3 instruction pattern(s).
4179 (define_expand "subsf3"
4181 [(set (match_operand:SF 0 "register_operand" "=f,f")
4182 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4183 (match_operand:SF 2 "general_operand" "f,R")))
4184 (clobber (reg:CC 33))])]
4188 (define_insn "*subsf3"
4189 [(set (match_operand:SF 0 "register_operand" "=f,f")
4190 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4191 (match_operand:SF 2 "general_operand" "f,R")))
4192 (clobber (reg:CC 33))]
4193 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4197 [(set_attr "op_type" "RRE,RXE")
4198 (set_attr "type" "fsimps,fsimps")])
4200 (define_insn "*subsf3_cc"
4202 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4203 (match_operand:SF 2 "general_operand" "f,R"))
4204 (match_operand:SF 3 "const0_operand" "")))
4205 (set (match_operand:SF 0 "register_operand" "=f,f")
4206 (minus:SF (match_dup 1) (match_dup 2)))]
4207 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4211 [(set_attr "op_type" "RRE,RXE")
4212 (set_attr "type" "fsimps,fsimps")])
4214 (define_insn "*subsf3_cconly"
4216 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4217 (match_operand:SF 2 "general_operand" "f,R"))
4218 (match_operand:SF 3 "const0_operand" "")))
4219 (clobber (match_scratch:SF 0 "=f,f"))]
4220 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4224 [(set_attr "op_type" "RRE,RXE")
4225 (set_attr "type" "fsimps,fsimps")])
4227 (define_insn "*subsf3_ibm"
4228 [(set (match_operand:SF 0 "register_operand" "=f,f")
4229 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4230 (match_operand:SF 2 "general_operand" "f,R")))
4231 (clobber (reg:CC 33))]
4232 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4236 [(set_attr "op_type" "RR,RX")
4237 (set_attr "type" "fsimps,fsimps")])
4241 ;;- Conditional add/subtract instructions.
4245 ; adddicc instruction pattern(s).
4248 (define_insn "*adddi3_alc_cc"
4251 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4252 (match_operand:DI 2 "general_operand" "d,m"))
4253 (match_operand:DI 3 "s390_alc_comparison" ""))
4255 (set (match_operand:DI 0 "register_operand" "=d,d")
4256 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4257 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4261 [(set_attr "op_type" "RRE,RXY")])
4263 (define_insn "*adddi3_alc"
4264 [(set (match_operand:DI 0 "register_operand" "=d,d")
4265 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4266 (match_operand:DI 2 "general_operand" "d,m"))
4267 (match_operand:DI 3 "s390_alc_comparison" "")))
4268 (clobber (reg:CC 33))]
4273 [(set_attr "op_type" "RRE,RXY")])
4275 (define_insn "*subdi3_slb_cc"
4278 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4279 (match_operand:DI 2 "general_operand" "d,m"))
4280 (match_operand:DI 3 "s390_slb_comparison" ""))
4282 (set (match_operand:DI 0 "register_operand" "=d,d")
4283 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4284 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4288 [(set_attr "op_type" "RRE,RXY")])
4290 (define_insn "*subdi3_slb"
4291 [(set (match_operand:DI 0 "register_operand" "=d,d")
4292 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4293 (match_operand:DI 2 "general_operand" "d,m"))
4294 (match_operand:DI 3 "s390_slb_comparison" "")))
4295 (clobber (reg:CC 33))]
4300 [(set_attr "op_type" "RRE,RXY")])
4302 (define_expand "adddicc"
4303 [(match_operand:DI 0 "register_operand" "")
4304 (match_operand 1 "comparison_operator" "")
4305 (match_operand:DI 2 "register_operand" "")
4306 (match_operand:DI 3 "const_int_operand" "")]
4308 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4309 s390_compare_op0, s390_compare_op1,
4310 operands[0], operands[2],
4311 operands[3])) FAIL; DONE;")
4314 ; addsicc instruction pattern(s).
4317 (define_insn "*addsi3_alc_cc"
4320 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4321 (match_operand:SI 2 "general_operand" "d,m"))
4322 (match_operand:SI 3 "s390_alc_comparison" ""))
4324 (set (match_operand:SI 0 "register_operand" "=d,d")
4325 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4326 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4330 [(set_attr "op_type" "RRE,RXY")])
4332 (define_insn "*addsi3_alc"
4333 [(set (match_operand:SI 0 "register_operand" "=d,d")
4334 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4335 (match_operand:SI 2 "general_operand" "d,m"))
4336 (match_operand:SI 3 "s390_alc_comparison" "")))
4337 (clobber (reg:CC 33))]
4342 [(set_attr "op_type" "RRE,RXY")])
4344 (define_insn "*subsi3_slb_cc"
4347 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4348 (match_operand:SI 2 "general_operand" "d,m"))
4349 (match_operand:SI 3 "s390_slb_comparison" ""))
4351 (set (match_operand:SI 0 "register_operand" "=d,d")
4352 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4353 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4357 [(set_attr "op_type" "RRE,RXY")])
4359 (define_insn "*subsi3_slb"
4360 [(set (match_operand:SI 0 "register_operand" "=d,d")
4361 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4362 (match_operand:SI 2 "general_operand" "d,m"))
4363 (match_operand:SI 3 "s390_slb_comparison" "")))
4364 (clobber (reg:CC 33))]
4369 [(set_attr "op_type" "RRE,RXY")])
4371 (define_expand "addsicc"
4372 [(match_operand:SI 0 "register_operand" "")
4373 (match_operand 1 "comparison_operator" "")
4374 (match_operand:SI 2 "register_operand" "")
4375 (match_operand:SI 3 "const_int_operand" "")]
4377 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4378 s390_compare_op0, s390_compare_op1,
4379 operands[0], operands[2],
4380 operands[3])) FAIL; DONE;")
4383 ; scond instruction pattern(s).
4386 (define_insn_and_split "*sconddi"
4387 [(set (match_operand:DI 0 "register_operand" "=&d")
4388 (match_operand:DI 1 "s390_alc_comparison" ""))
4389 (clobber (reg:CC 33))]
4392 "&& reload_completed"
4393 [(set (match_dup 0) (const_int 0))
4395 [(set (match_dup 0) (plus:DI (plus:DI (match_dup 0) (match_dup 0))
4397 (clobber (reg:CC 33))])]
4400 (define_insn_and_split "*scondsi"
4401 [(set (match_operand:SI 0 "register_operand" "=&d")
4402 (match_operand:SI 1 "s390_alc_comparison" ""))
4403 (clobber (reg:CC 33))]
4406 "&& reload_completed"
4407 [(set (match_dup 0) (const_int 0))
4409 [(set (match_dup 0) (plus:SI (plus:SI (match_dup 0) (match_dup 0))
4411 (clobber (reg:CC 33))])]
4414 (define_insn_and_split "*sconddi_neg"
4415 [(set (match_operand:DI 0 "register_operand" "=&d")
4416 (match_operand:DI 1 "s390_slb_comparison" ""))
4417 (clobber (reg:CC 33))]
4420 "&& reload_completed"
4421 [(set (match_dup 0) (const_int 0))
4423 [(set (match_dup 0) (minus:DI (minus:DI (match_dup 0) (match_dup 0))
4425 (clobber (reg:CC 33))])
4427 [(set (match_dup 0) (neg:DI (match_dup 0)))
4428 (clobber (reg:CC 33))])]
4431 (define_insn_and_split "*scondsi_neg"
4432 [(set (match_operand:SI 0 "register_operand" "=&d")
4433 (match_operand:SI 1 "s390_slb_comparison" ""))
4434 (clobber (reg:CC 33))]
4437 "&& reload_completed"
4438 [(set (match_dup 0) (const_int 0))
4440 [(set (match_dup 0) (minus:SI (minus:SI (match_dup 0) (match_dup 0))
4442 (clobber (reg:CC 33))])
4444 [(set (match_dup 0) (neg:SI (match_dup 0)))
4445 (clobber (reg:CC 33))])]
4448 (define_expand "sltu"
4449 [(match_operand:SI 0 "register_operand" "")]
4451 "if (!s390_expand_addcc (LTU, s390_compare_op0, s390_compare_op1,
4452 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4454 (define_expand "sgtu"
4455 [(match_operand:SI 0 "register_operand" "")]
4457 "if (!s390_expand_addcc (GTU, s390_compare_op0, s390_compare_op1,
4458 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4460 (define_expand "sleu"
4461 [(match_operand:SI 0 "register_operand" "")]
4463 "if (!s390_expand_addcc (LEU, s390_compare_op0, s390_compare_op1,
4464 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4466 (define_expand "sgeu"
4467 [(match_operand:SI 0 "register_operand" "")]
4469 "if (!s390_expand_addcc (GEU, s390_compare_op0, s390_compare_op1,
4470 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4474 ;;- Multiply instructions.
4478 ; muldi3 instruction pattern(s).
4481 (define_insn "*muldi3_sign"
4482 [(set (match_operand:DI 0 "register_operand" "=d,d")
4483 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4484 (match_operand:DI 1 "register_operand" "0,0")))]
4489 [(set_attr "op_type" "RRE,RXY")
4490 (set_attr "type" "imul")])
4492 (define_insn "muldi3"
4493 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4494 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4495 (match_operand:DI 2 "general_operand" "d,K,m")))]
4501 [(set_attr "op_type" "RRE,RI,RXY")
4502 (set_attr "type" "imul")])
4505 ; mulsi3 instruction pattern(s).
4508 (define_insn "*mulsi3_sign"
4509 [(set (match_operand:SI 0 "register_operand" "=d")
4510 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4511 (match_operand:SI 1 "register_operand" "0")))]
4514 [(set_attr "op_type" "RX")
4515 (set_attr "type" "imul")])
4517 (define_insn "mulsi3"
4518 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4519 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4520 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4527 [(set_attr "op_type" "RRE,RI,RX,RXY")
4528 (set_attr "type" "imul")])
4531 ; mulsidi3 instruction pattern(s).
4534 (define_insn "mulsidi3"
4535 [(set (match_operand:DI 0 "register_operand" "=d,d")
4536 (mult:DI (sign_extend:DI
4537 (match_operand:SI 1 "register_operand" "%0,0"))
4539 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4544 [(set_attr "op_type" "RR,RX")
4545 (set_attr "type" "imul")])
4548 ; umulsidi3 instruction pattern(s).
4551 (define_insn "umulsidi3"
4552 [(set (match_operand:DI 0 "register_operand" "=d,d")
4553 (mult:DI (zero_extend:DI
4554 (match_operand:SI 1 "register_operand" "%0,0"))
4556 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4557 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4561 [(set_attr "op_type" "RRE,RXY")
4562 (set_attr "type" "imul")])
4565 ; muldf3 instruction pattern(s).
4568 (define_expand "muldf3"
4569 [(set (match_operand:DF 0 "register_operand" "=f,f")
4570 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4571 (match_operand:DF 2 "general_operand" "f,R")))]
4575 (define_insn "*muldf3"
4576 [(set (match_operand:DF 0 "register_operand" "=f,f")
4577 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4578 (match_operand:DF 2 "general_operand" "f,R")))]
4579 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4583 [(set_attr "op_type" "RRE,RXE")
4584 (set_attr "type" "fmuld")])
4586 (define_insn "*muldf3_ibm"
4587 [(set (match_operand:DF 0 "register_operand" "=f,f")
4588 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4589 (match_operand:DF 2 "general_operand" "f,R")))]
4590 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4594 [(set_attr "op_type" "RR,RX")
4595 (set_attr "type" "fmuld")])
4597 (define_insn "*fmadddf"
4598 [(set (match_operand:DF 0 "register_operand" "=f,f")
4599 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4600 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4601 (match_operand:DF 3 "register_operand" "0,0")))]
4602 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4606 [(set_attr "op_type" "RRE,RXE")
4607 (set_attr "type" "fmuld")])
4609 (define_insn "*fmsubdf"
4610 [(set (match_operand:DF 0 "register_operand" "=f,f")
4611 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4612 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4613 (match_operand:DF 3 "register_operand" "0,0")))]
4614 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4618 [(set_attr "op_type" "RRE,RXE")
4619 (set_attr "type" "fmuld")])
4622 ; mulsf3 instruction pattern(s).
4625 (define_expand "mulsf3"
4626 [(set (match_operand:SF 0 "register_operand" "=f,f")
4627 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4628 (match_operand:SF 2 "general_operand" "f,R")))]
4632 (define_insn "*mulsf3"
4633 [(set (match_operand:SF 0 "register_operand" "=f,f")
4634 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4635 (match_operand:SF 2 "general_operand" "f,R")))]
4636 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4640 [(set_attr "op_type" "RRE,RXE")
4641 (set_attr "type" "fmuls")])
4643 (define_insn "*mulsf3_ibm"
4644 [(set (match_operand:SF 0 "register_operand" "=f,f")
4645 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4646 (match_operand:SF 2 "general_operand" "f,R")))]
4647 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4651 [(set_attr "op_type" "RR,RX")
4652 (set_attr "type" "fmuls")])
4654 (define_insn "*fmaddsf"
4655 [(set (match_operand:SF 0 "register_operand" "=f,f")
4656 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4657 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4658 (match_operand:SF 3 "register_operand" "0,0")))]
4659 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4663 [(set_attr "op_type" "RRE,RXE")
4664 (set_attr "type" "fmuls")])
4666 (define_insn "*fmsubsf"
4667 [(set (match_operand:SF 0 "register_operand" "=f,f")
4668 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4669 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4670 (match_operand:SF 3 "register_operand" "0,0")))]
4671 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4675 [(set_attr "op_type" "RRE,RXE")
4676 (set_attr "type" "fmuls")])
4679 ;;- Divide and modulo instructions.
4683 ; divmoddi4 instruction pattern(s).
4686 (define_expand "divmoddi4"
4687 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4688 (div:DI (match_operand:DI 1 "register_operand" "")
4689 (match_operand:DI 2 "general_operand" "")))
4690 (set (match_operand:DI 3 "general_operand" "")
4691 (mod:DI (match_dup 1) (match_dup 2)))])
4692 (clobber (match_dup 4))]
4695 rtx insn, div_equal, mod_equal;
4697 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4698 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4700 operands[4] = gen_reg_rtx(TImode);
4701 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4703 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4705 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4707 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4709 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4714 (define_insn "divmodtidi3"
4715 [(set (match_operand:TI 0 "register_operand" "=d,d")
4719 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4720 (match_operand:DI 2 "general_operand" "d,m")))
4722 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
4727 [(set_attr "op_type" "RRE,RXY")
4728 (set_attr "type" "idiv")])
4730 (define_insn "divmodtisi3"
4731 [(set (match_operand:TI 0 "register_operand" "=d,d")
4735 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4737 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4740 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
4745 [(set_attr "op_type" "RRE,RXY")
4746 (set_attr "type" "idiv")])
4749 ; udivmoddi4 instruction pattern(s).
4752 (define_expand "udivmoddi4"
4753 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4754 (udiv:DI (match_operand:DI 1 "general_operand" "")
4755 (match_operand:DI 2 "nonimmediate_operand" "")))
4756 (set (match_operand:DI 3 "general_operand" "")
4757 (umod:DI (match_dup 1) (match_dup 2)))])
4758 (clobber (match_dup 4))]
4761 rtx insn, div_equal, mod_equal, equal;
4763 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4764 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4765 equal = gen_rtx_IOR (TImode,
4766 gen_rtx_ASHIFT (TImode,
4767 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4769 gen_rtx_ZERO_EXTEND (TImode, div_equal));
4771 operands[4] = gen_reg_rtx(TImode);
4772 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4773 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4774 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4775 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4777 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4779 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4781 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4783 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4785 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4790 (define_insn "udivmodtidi3"
4791 [(set (match_operand:TI 0 "register_operand" "=d,d")
4796 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
4798 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4802 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
4807 [(set_attr "op_type" "RRE,RXY")
4808 (set_attr "type" "idiv")])
4811 ; divmodsi4 instruction pattern(s).
4814 (define_expand "divmodsi4"
4815 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4816 (div:SI (match_operand:SI 1 "general_operand" "")
4817 (match_operand:SI 2 "nonimmediate_operand" "")))
4818 (set (match_operand:SI 3 "general_operand" "")
4819 (mod:SI (match_dup 1) (match_dup 2)))])
4820 (clobber (match_dup 4))]
4823 rtx insn, div_equal, mod_equal, equal;
4825 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4826 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4827 equal = gen_rtx_IOR (DImode,
4828 gen_rtx_ASHIFT (DImode,
4829 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4831 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4833 operands[4] = gen_reg_rtx(DImode);
4834 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4835 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4837 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4839 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4841 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4843 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4845 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4850 (define_insn "divmoddisi3"
4851 [(set (match_operand:DI 0 "register_operand" "=d,d")
4856 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4858 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4862 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
4867 [(set_attr "op_type" "RR,RX")
4868 (set_attr "type" "idiv")])
4871 ; udivsi3 and umodsi3 instruction pattern(s).
4874 (define_expand "udivmodsi4"
4875 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4876 (udiv:SI (match_operand:SI 1 "general_operand" "")
4877 (match_operand:SI 2 "nonimmediate_operand" "")))
4878 (set (match_operand:SI 3 "general_operand" "")
4879 (umod:SI (match_dup 1) (match_dup 2)))])
4880 (clobber (match_dup 4))]
4881 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4883 rtx insn, div_equal, mod_equal, equal;
4885 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4886 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4887 equal = gen_rtx_IOR (DImode,
4888 gen_rtx_ASHIFT (DImode,
4889 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4891 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4893 operands[4] = gen_reg_rtx(DImode);
4894 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4895 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4896 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4897 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4899 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4901 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4903 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4905 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4907 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4912 (define_insn "udivmoddisi3"
4913 [(set (match_operand:DI 0 "register_operand" "=d,d")
4918 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
4920 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4924 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
4925 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4929 [(set_attr "op_type" "RRE,RXY")
4930 (set_attr "type" "idiv")])
4932 (define_expand "udivsi3"
4933 [(set (match_operand:SI 0 "register_operand" "=d")
4934 (udiv:SI (match_operand:SI 1 "general_operand" "")
4935 (match_operand:SI 2 "general_operand" "")))
4936 (clobber (match_dup 3))]
4937 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4939 rtx insn, udiv_equal, umod_equal, equal;
4941 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4942 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4943 equal = gen_rtx_IOR (DImode,
4944 gen_rtx_ASHIFT (DImode,
4945 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4947 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4949 operands[3] = gen_reg_rtx (DImode);
4951 if (CONSTANT_P (operands[2]))
4953 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4955 rtx label1 = gen_label_rtx ();
4957 operands[1] = make_safe_from (operands[1], operands[0]);
4958 emit_move_insn (operands[0], const0_rtx);
4959 emit_insn (gen_cmpsi (operands[1], operands[2]));
4960 emit_jump_insn (gen_bltu (label1));
4961 emit_move_insn (operands[0], const1_rtx);
4962 emit_label (label1);
4966 operands[2] = force_reg (SImode, operands[2]);
4967 operands[2] = make_safe_from (operands[2], operands[0]);
4969 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4970 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4973 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4975 insn = emit_move_insn (operands[0],
4976 gen_lowpart (SImode, operands[3]));
4978 gen_rtx_EXPR_LIST (REG_EQUAL,
4979 udiv_equal, REG_NOTES (insn));
4984 rtx label1 = gen_label_rtx ();
4985 rtx label2 = gen_label_rtx ();
4986 rtx label3 = gen_label_rtx ();
4988 operands[1] = force_reg (SImode, operands[1]);
4989 operands[1] = make_safe_from (operands[1], operands[0]);
4990 operands[2] = force_reg (SImode, operands[2]);
4991 operands[2] = make_safe_from (operands[2], operands[0]);
4993 emit_move_insn (operands[0], const0_rtx);
4994 emit_insn (gen_cmpsi (operands[2], operands[1]));
4995 emit_jump_insn (gen_bgtu (label3));
4996 emit_insn (gen_cmpsi (operands[2], const0_rtx));
4997 emit_jump_insn (gen_blt (label2));
4998 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4999 emit_jump_insn (gen_beq (label1));
5000 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5001 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5004 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5006 insn = emit_move_insn (operands[0],
5007 gen_lowpart (SImode, operands[3]));
5009 gen_rtx_EXPR_LIST (REG_EQUAL,
5010 udiv_equal, REG_NOTES (insn));
5012 emit_label (label1);
5013 emit_move_insn (operands[0], operands[1]);
5015 emit_label (label2);
5016 emit_move_insn (operands[0], const1_rtx);
5017 emit_label (label3);
5019 emit_move_insn (operands[0], operands[0]);
5023 (define_expand "umodsi3"
5024 [(set (match_operand:SI 0 "register_operand" "=d")
5025 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
5026 (match_operand:SI 2 "nonimmediate_operand" "")))
5027 (clobber (match_dup 3))]
5028 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
5030 rtx insn, udiv_equal, umod_equal, equal;
5032 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
5033 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
5034 equal = gen_rtx_IOR (DImode,
5035 gen_rtx_ASHIFT (DImode,
5036 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
5038 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
5040 operands[3] = gen_reg_rtx (DImode);
5042 if (CONSTANT_P (operands[2]))
5044 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
5046 rtx label1 = gen_label_rtx ();
5048 operands[1] = make_safe_from (operands[1], operands[0]);
5049 emit_move_insn (operands[0], operands[1]);
5050 emit_insn (gen_cmpsi (operands[0], operands[2]));
5051 emit_jump_insn (gen_bltu (label1));
5052 emit_insn (gen_abssi2 (operands[0], operands[2]));
5053 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
5054 emit_label (label1);
5058 operands[2] = force_reg (SImode, operands[2]);
5059 operands[2] = make_safe_from (operands[2], operands[0]);
5061 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5062 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5065 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5067 insn = emit_move_insn (operands[0],
5068 gen_highpart (SImode, operands[3]));
5070 gen_rtx_EXPR_LIST (REG_EQUAL,
5071 umod_equal, REG_NOTES (insn));
5076 rtx label1 = gen_label_rtx ();
5077 rtx label2 = gen_label_rtx ();
5078 rtx label3 = gen_label_rtx ();
5080 operands[1] = force_reg (SImode, operands[1]);
5081 operands[1] = make_safe_from (operands[1], operands[0]);
5082 operands[2] = force_reg (SImode, operands[2]);
5083 operands[2] = make_safe_from (operands[2], operands[0]);
5085 emit_move_insn(operands[0], operands[1]);
5086 emit_insn (gen_cmpsi (operands[2], operands[1]));
5087 emit_jump_insn (gen_bgtu (label3));
5088 emit_insn (gen_cmpsi (operands[2], const0_rtx));
5089 emit_jump_insn (gen_blt (label2));
5090 emit_insn (gen_cmpsi (operands[2], const1_rtx));
5091 emit_jump_insn (gen_beq (label1));
5092 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5093 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5096 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5098 insn = emit_move_insn (operands[0],
5099 gen_highpart (SImode, operands[3]));
5101 gen_rtx_EXPR_LIST (REG_EQUAL,
5102 umod_equal, REG_NOTES (insn));
5104 emit_label (label1);
5105 emit_move_insn (operands[0], const0_rtx);
5107 emit_label (label2);
5108 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
5109 emit_label (label3);
5115 ; divdf3 instruction pattern(s).
5118 (define_expand "divdf3"
5119 [(set (match_operand:DF 0 "register_operand" "=f,f")
5120 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5121 (match_operand:DF 2 "general_operand" "f,R")))]
5125 (define_insn "*divdf3"
5126 [(set (match_operand:DF 0 "register_operand" "=f,f")
5127 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5128 (match_operand:DF 2 "general_operand" "f,R")))]
5129 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5133 [(set_attr "op_type" "RRE,RXE")
5134 (set_attr "type" "fdivd")])
5136 (define_insn "*divdf3_ibm"
5137 [(set (match_operand:DF 0 "register_operand" "=f,f")
5138 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5139 (match_operand:DF 2 "general_operand" "f,R")))]
5140 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5144 [(set_attr "op_type" "RR,RX")
5145 (set_attr "type" "fdivd")])
5148 ; divsf3 instruction pattern(s).
5151 (define_expand "divsf3"
5152 [(set (match_operand:SF 0 "register_operand" "=f,f")
5153 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5154 (match_operand:SF 2 "general_operand" "f,R")))]
5158 (define_insn "*divsf3"
5159 [(set (match_operand:SF 0 "register_operand" "=f,f")
5160 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5161 (match_operand:SF 2 "general_operand" "f,R")))]
5162 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5166 [(set_attr "op_type" "RRE,RXE")
5167 (set_attr "type" "fdivs")])
5169 (define_insn "*divsf3"
5170 [(set (match_operand:SF 0 "register_operand" "=f,f")
5171 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5172 (match_operand:SF 2 "general_operand" "f,R")))]
5173 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5177 [(set_attr "op_type" "RR,RX")
5178 (set_attr "type" "fdivs")])
5182 ;;- And instructions.
5186 ; anddi3 instruction pattern(s).
5189 (define_insn "*anddi3_cc"
5191 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5192 (match_operand:DI 2 "general_operand" "d,m"))
5194 (set (match_operand:DI 0 "register_operand" "=d,d")
5195 (and:DI (match_dup 1) (match_dup 2)))]
5196 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5200 [(set_attr "op_type" "RRE,RXY")])
5202 (define_insn "*anddi3_cconly"
5204 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5205 (match_operand:DI 2 "general_operand" "d,m"))
5207 (clobber (match_scratch:DI 0 "=d,d"))]
5208 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
5209 /* Do not steal TM patterns. */
5210 && s390_single_part (operands[2], DImode, HImode, 0) < 0"
5214 [(set_attr "op_type" "RRE,RXY")])
5216 (define_insn "*anddi3"
5217 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q")
5218 (and:DI (match_operand:DI 1 "nonimmediate_operand"
5219 "%d,o,0,0,0,0,0,0,0,0")
5220 (match_operand:DI 2 "general_operand"
5221 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m,NxQDF,Q")))
5222 (clobber (reg:CC 33))]
5223 "TARGET_64BIT && s390_logical_operator_ok_p (operands)"
5235 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY,SI,SS")])
5238 [(set (match_operand:DI 0 "s_operand" "")
5239 (and:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5240 (clobber (reg:CC 33))]
5243 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5244 (clobber (reg:CC 33))])]
5245 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5247 (define_expand "anddi3"
5248 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5249 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
5250 (match_operand:DI 2 "general_operand" "")))
5251 (clobber (reg:CC 33))]
5253 "s390_expand_logical_operator (AND, DImode, operands); DONE;")
5256 ; andsi3 instruction pattern(s).
5259 (define_insn "*andsi3_cc"
5261 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5262 (match_operand:SI 2 "general_operand" "d,R,T"))
5264 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5265 (and:SI (match_dup 1) (match_dup 2)))]
5266 "s390_match_ccmode(insn, CCTmode)"
5271 [(set_attr "op_type" "RR,RX,RXY")])
5273 (define_insn "*andsi3_cconly"
5275 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5276 (match_operand:SI 2 "general_operand" "d,R,T"))
5278 (clobber (match_scratch:SI 0 "=d,d,d"))]
5279 "s390_match_ccmode(insn, CCTmode)
5280 /* Do not steal TM patterns. */
5281 && s390_single_part (operands[2], SImode, HImode, 0) < 0"
5286 [(set_attr "op_type" "RR,RX,RXY")])
5288 (define_insn "*andsi3_zarch"
5289 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,AQ,Q")
5290 (and:SI (match_operand:SI 1 "nonimmediate_operand"
5291 "%d,o,0,0,0,0,0,0,0")
5292 (match_operand:SI 2 "general_operand"
5293 "M,M,N0HSF,N1HSF,d,R,T,NxQSF,Q")))
5294 (clobber (reg:CC 33))]
5295 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5306 [(set_attr "op_type" "RRE,RXE,RI,RI,RR,RX,RXY,SI,SS")])
5308 (define_insn "*andsi3_esa"
5309 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5310 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5311 (match_operand:SI 2 "general_operand" "d,R,NxQSF,Q")))
5312 (clobber (reg:CC 33))]
5313 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5319 [(set_attr "op_type" "RR,RX,SI,SS")])
5322 [(set (match_operand:SI 0 "s_operand" "")
5323 (and:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5324 (clobber (reg:CC 33))]
5327 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5328 (clobber (reg:CC 33))])]
5329 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5331 (define_expand "andsi3"
5332 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5333 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
5334 (match_operand:SI 2 "general_operand" "")))
5335 (clobber (reg:CC 33))]
5337 "s390_expand_logical_operator (AND, SImode, operands); DONE;")
5340 ; andhi3 instruction pattern(s).
5343 (define_insn "*andhi3_zarch"
5344 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5345 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0,0")
5346 (match_operand:HI 2 "general_operand" "d,n,NxQHF,Q")))
5347 (clobber (reg:CC 33))]
5348 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5354 [(set_attr "op_type" "RR,RI,SI,SS")])
5356 (define_insn "*andhi3_esa"
5357 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
5358 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
5359 (match_operand:HI 2 "general_operand" "d,NxQHF,Q")))
5360 (clobber (reg:CC 33))]
5361 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5366 [(set_attr "op_type" "RR,SI,SS")])
5369 [(set (match_operand:HI 0 "s_operand" "")
5370 (and:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
5371 (clobber (reg:CC 33))]
5374 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5375 (clobber (reg:CC 33))])]
5376 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5378 (define_expand "andhi3"
5379 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5380 (and:HI (match_operand:HI 1 "nonimmediate_operand" "")
5381 (match_operand:HI 2 "general_operand" "")))
5382 (clobber (reg:CC 33))]
5384 "s390_expand_logical_operator (AND, HImode, operands); DONE;")
5387 ; andqi3 instruction pattern(s).
5390 (define_insn "*andqi3_zarch"
5391 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,Q,S,Q")
5392 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0,0")
5393 (match_operand:QI 2 "general_operand" "d,n,n,n,Q")))
5394 (clobber (reg:CC 33))]
5395 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5402 [(set_attr "op_type" "RR,RI,SI,SIY,SS")])
5404 (define_insn "*andqi3_esa"
5405 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
5406 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
5407 (match_operand:QI 2 "general_operand" "d,n,Q")))
5408 (clobber (reg:CC 33))]
5409 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5414 [(set_attr "op_type" "RR,SI,SS")])
5416 (define_expand "andqi3"
5417 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5418 (and:QI (match_operand:QI 1 "nonimmediate_operand" "")
5419 (match_operand:QI 2 "general_operand" "")))
5420 (clobber (reg:CC 33))]
5422 "s390_expand_logical_operator (AND, QImode, operands); DONE;")
5425 ; Block and (NC) patterns.
5429 [(set (match_operand:BLK 0 "memory_operand" "=Q")
5430 (and:BLK (match_dup 0)
5431 (match_operand:BLK 1 "memory_operand" "Q")))
5432 (use (match_operand 2 "const_int_operand" "n"))
5433 (clobber (reg:CC 33))]
5434 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
5435 "nc\t%O0(%2,%R0),%S1"
5436 [(set_attr "op_type" "SS")])
5439 [(set (match_operand 0 "memory_operand" "")
5441 (match_operand 1 "memory_operand" "")))
5442 (clobber (reg:CC 33))]
5444 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5445 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
5447 [(set (match_dup 0) (and:BLK (match_dup 0) (match_dup 1)))
5449 (clobber (reg:CC 33))])]
5451 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
5452 operands[0] = adjust_address (operands[0], BLKmode, 0);
5453 operands[1] = adjust_address (operands[1], BLKmode, 0);
5458 [(set (match_operand:BLK 0 "memory_operand" "")
5459 (and:BLK (match_dup 0)
5460 (match_operand:BLK 1 "memory_operand" "")))
5461 (use (match_operand 2 "const_int_operand" ""))
5462 (clobber (reg:CC 33))])
5464 [(set (match_operand:BLK 3 "memory_operand" "")
5465 (and:BLK (match_dup 3)
5466 (match_operand:BLK 4 "memory_operand" "")))
5467 (use (match_operand 5 "const_int_operand" ""))
5468 (clobber (reg:CC 33))])]
5469 "s390_offset_p (operands[0], operands[3], operands[2])
5470 && s390_offset_p (operands[1], operands[4], operands[2])
5471 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
5473 [(set (match_dup 6) (and:BLK (match_dup 6) (match_dup 7)))
5475 (clobber (reg:CC 33))])]
5476 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
5477 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
5478 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
5482 ;;- Bit set (inclusive or) instructions.
5486 ; iordi3 instruction pattern(s).
5489 (define_insn "*iordi3_cc"
5491 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5492 (match_operand:DI 2 "general_operand" "d,m"))
5494 (set (match_operand:DI 0 "register_operand" "=d,d")
5495 (ior:DI (match_dup 1) (match_dup 2)))]
5496 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5500 [(set_attr "op_type" "RRE,RXY")])
5502 (define_insn "*iordi3_cconly"
5504 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5505 (match_operand:DI 2 "general_operand" "d,m"))
5507 (clobber (match_scratch:DI 0 "=d,d"))]
5508 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5512 [(set_attr "op_type" "RRE,RXY")])
5514 (define_insn "*iordi3"
5515 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,AQ,Q")
5516 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,0,0,0,0,0,0")
5517 (match_operand:DI 2 "general_operand"
5518 "N0HD0,N1HD0,N2HD0,N3HD0,d,m,NxQD0,Q")))
5519 (clobber (reg:CC 33))]
5520 "TARGET_64BIT && s390_logical_operator_ok_p (operands)"
5530 [(set_attr "op_type" "RI,RI,RI,RI,RRE,RXY,SI,SS")])
5533 [(set (match_operand:DI 0 "s_operand" "")
5534 (ior:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5535 (clobber (reg:CC 33))]
5538 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5539 (clobber (reg:CC 33))])]
5540 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5542 (define_expand "iordi3"
5543 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5544 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "")
5545 (match_operand:DI 2 "general_operand" "")))
5546 (clobber (reg:CC 33))]
5548 "s390_expand_logical_operator (IOR, DImode, operands); DONE;")
5551 ; iorsi3 instruction pattern(s).
5554 (define_insn "*iorsi3_cc"
5556 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5557 (match_operand:SI 2 "general_operand" "d,R,T"))
5559 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5560 (ior:SI (match_dup 1) (match_dup 2)))]
5561 "s390_match_ccmode(insn, CCTmode)"
5566 [(set_attr "op_type" "RR,RX,RXY")])
5568 (define_insn "*iorsi3_cconly"
5570 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5571 (match_operand:SI 2 "general_operand" "d,R,T"))
5573 (clobber (match_scratch:SI 0 "=d,d,d"))]
5574 "s390_match_ccmode(insn, CCTmode)"
5579 [(set_attr "op_type" "RR,RX,RXY")])
5581 (define_insn "*iorsi3_zarch"
5582 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,AQ,Q")
5583 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0,0,0,0")
5584 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,d,R,T,NxQS0,Q")))
5585 (clobber (reg:CC 33))]
5586 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5595 [(set_attr "op_type" "RI,RI,RR,RX,RXY,SI,SS")])
5597 (define_insn "*iorsi3_esa"
5598 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5599 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0")
5600 (match_operand:SI 2 "general_operand" "d,R,NxQS0,Q")))
5601 (clobber (reg:CC 33))]
5602 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5608 [(set_attr "op_type" "RR,RX,SI,SS")])
5611 [(set (match_operand:SI 0 "s_operand" "")
5612 (ior:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5613 (clobber (reg:CC 33))]
5616 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5617 (clobber (reg:CC 33))])]
5618 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5620 (define_expand "iorsi3"
5621 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5622 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
5623 (match_operand:SI 2 "general_operand" "")))
5624 (clobber (reg:CC 33))]
5626 "s390_expand_logical_operator (IOR, SImode, operands); DONE;")
5629 ; iorhi3 instruction pattern(s).
5632 (define_insn "*iorhi3_zarch"
5633 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5634 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0,0")
5635 (match_operand:HI 2 "general_operand" "d,n,NxQH0,Q")))
5636 (clobber (reg:CC 33))]
5637 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5643 [(set_attr "op_type" "RR,RI,SI,SS")])
5645 (define_insn "*iorhi3_esa"
5646 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
5647 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
5648 (match_operand:HI 2 "general_operand" "d,NxQH0,Q")))
5649 (clobber (reg:CC 33))]
5650 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5655 [(set_attr "op_type" "RR,SI,SS")])
5658 [(set (match_operand:HI 0 "s_operand" "")
5659 (ior:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
5660 (clobber (reg:CC 33))]
5663 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5664 (clobber (reg:CC 33))])]
5665 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5667 (define_expand "iorhi3"
5668 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5669 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "")
5670 (match_operand:HI 2 "general_operand" "")))
5671 (clobber (reg:CC 33))]
5673 "s390_expand_logical_operator (IOR, HImode, operands); DONE;")
5676 ; iorqi3 instruction pattern(s).
5679 (define_insn "*iorqi3_zarch"
5680 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,Q,S,Q")
5681 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0,0")
5682 (match_operand:QI 2 "general_operand" "d,n,n,n,Q")))
5683 (clobber (reg:CC 33))]
5684 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5691 [(set_attr "op_type" "RR,RI,SI,SIY,SS")])
5693 (define_insn "*iorqi3_esa"
5694 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
5695 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
5696 (match_operand:QI 2 "general_operand" "d,n,Q")))
5697 (clobber (reg:CC 33))]
5698 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5703 [(set_attr "op_type" "RR,SI,SS")])
5705 (define_expand "iorqi3"
5706 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5707 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "")
5708 (match_operand:QI 2 "general_operand" "")))
5709 (clobber (reg:CC 33))]
5711 "s390_expand_logical_operator (IOR, QImode, operands); DONE;")
5714 ; Block inclusive or (OC) patterns.
5718 [(set (match_operand:BLK 0 "memory_operand" "=Q")
5719 (ior:BLK (match_dup 0)
5720 (match_operand:BLK 1 "memory_operand" "Q")))
5721 (use (match_operand 2 "const_int_operand" "n"))
5722 (clobber (reg:CC 33))]
5723 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
5724 "oc\t%O0(%2,%R0),%S1"
5725 [(set_attr "op_type" "SS")])
5728 [(set (match_operand 0 "memory_operand" "")
5730 (match_operand 1 "memory_operand" "")))
5731 (clobber (reg:CC 33))]
5733 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5734 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
5736 [(set (match_dup 0) (ior:BLK (match_dup 0) (match_dup 1)))
5738 (clobber (reg:CC 33))])]
5740 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
5741 operands[0] = adjust_address (operands[0], BLKmode, 0);
5742 operands[1] = adjust_address (operands[1], BLKmode, 0);
5747 [(set (match_operand:BLK 0 "memory_operand" "")
5748 (ior:BLK (match_dup 0)
5749 (match_operand:BLK 1 "memory_operand" "")))
5750 (use (match_operand 2 "const_int_operand" ""))
5751 (clobber (reg:CC 33))])
5753 [(set (match_operand:BLK 3 "memory_operand" "")
5754 (ior:BLK (match_dup 3)
5755 (match_operand:BLK 4 "memory_operand" "")))
5756 (use (match_operand 5 "const_int_operand" ""))
5757 (clobber (reg:CC 33))])]
5758 "s390_offset_p (operands[0], operands[3], operands[2])
5759 && s390_offset_p (operands[1], operands[4], operands[2])
5760 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
5762 [(set (match_dup 6) (ior:BLK (match_dup 6) (match_dup 7)))
5764 (clobber (reg:CC 33))])]
5765 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
5766 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
5767 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
5771 ;;- Xor instructions.
5775 ; xordi3 instruction pattern(s).
5778 (define_insn "*xordi3_cc"
5780 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5781 (match_operand:DI 2 "general_operand" "d,m"))
5783 (set (match_operand:DI 0 "register_operand" "=d,d")
5784 (xor:DI (match_dup 1) (match_dup 2)))]
5785 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5789 [(set_attr "op_type" "RRE,RXY")])
5791 (define_insn "*xordi3_cconly"
5793 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5794 (match_operand:DI 2 "general_operand" "d,m"))
5796 (clobber (match_scratch:DI 0 "=d,d"))]
5797 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5801 [(set_attr "op_type" "RRE,RXY")])
5803 (define_insn "*xordi3"
5804 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5805 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
5806 (match_operand:DI 2 "general_operand" "d,m,NxQD0,Q")))
5807 (clobber (reg:CC 33))]
5808 "TARGET_64BIT && s390_logical_operator_ok_p (operands)"
5814 [(set_attr "op_type" "RRE,RXY,SI,SS")])
5817 [(set (match_operand:DI 0 "s_operand" "")
5818 (xor:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5819 (clobber (reg:CC 33))]
5822 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
5823 (clobber (reg:CC 33))])]
5824 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
5826 (define_expand "xordi3"
5827 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5828 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "")
5829 (match_operand:DI 2 "general_operand" "")))
5830 (clobber (reg:CC 33))]
5832 "s390_expand_logical_operator (XOR, DImode, operands); DONE;")
5835 ; xorsi3 instruction pattern(s).
5838 (define_insn "*xorsi3_cc"
5840 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5841 (match_operand:SI 2 "general_operand" "d,R,T"))
5843 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5844 (xor:SI (match_dup 1) (match_dup 2)))]
5845 "s390_match_ccmode(insn, CCTmode)"
5850 [(set_attr "op_type" "RR,RX,RXY")])
5852 (define_insn "*xorsi3_cconly"
5854 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5855 (match_operand:SI 2 "general_operand" "d,R,T"))
5857 (clobber (match_scratch:SI 0 "=d,d,d"))]
5858 "s390_match_ccmode(insn, CCTmode)"
5863 [(set_attr "op_type" "RR,RX,RXY")])
5865 (define_insn "*xorsi3"
5866 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,AQ,Q")
5867 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0")
5868 (match_operand:SI 2 "general_operand" "d,R,T,NxQS0,Q")))
5869 (clobber (reg:CC 33))]
5870 "s390_logical_operator_ok_p (operands)"
5877 [(set_attr "op_type" "RR,RX,RXY,SI,SS")])
5880 [(set (match_operand:SI 0 "s_operand" "")
5881 (xor:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5882 (clobber (reg:CC 33))]
5885 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
5886 (clobber (reg:CC 33))])]
5887 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
5889 (define_expand "xorsi3"
5890 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5891 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "")
5892 (match_operand:SI 2 "general_operand" "")))
5893 (clobber (reg:CC 33))]
5895 "s390_expand_logical_operator (XOR, SImode, operands); DONE;")
5898 ; xorhi3 instruction pattern(s).
5901 (define_insn "*xorhi3"
5902 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
5903 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
5904 (match_operand:HI 2 "general_operand" "d,NxQH0,Q")))
5905 (clobber (reg:CC 33))]
5906 "s390_logical_operator_ok_p (operands)"
5911 [(set_attr "op_type" "RR,SI,SS")])
5914 [(set (match_operand:HI 0 "s_operand" "")
5915 (xor:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
5916 (clobber (reg:CC 33))]
5919 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
5920 (clobber (reg:CC 33))])]
5921 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
5923 (define_expand "xorhi3"
5924 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5925 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "")
5926 (match_operand:HI 2 "general_operand" "")))
5927 (clobber (reg:CC 33))]
5929 "s390_expand_logical_operator (XOR, HImode, operands); DONE;")
5932 ; xorqi3 instruction pattern(s).
5935 (define_insn "*xorqi3"
5936 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,S,Q")
5937 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0")
5938 (match_operand:QI 2 "general_operand" "d,n,n,Q")))
5939 (clobber (reg:CC 33))]
5940 "s390_logical_operator_ok_p (operands)"
5946 [(set_attr "op_type" "RR,SI,SIY,SS")])
5948 (define_expand "xorqi3"
5949 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5950 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "")
5951 (match_operand:QI 2 "general_operand" "")))
5952 (clobber (reg:CC 33))]
5954 "s390_expand_logical_operator (XOR, QImode, operands); DONE;")
5957 ; Block exclusive or (XC) patterns.
5961 [(set (match_operand:BLK 0 "memory_operand" "=Q")
5962 (xor:BLK (match_dup 0)
5963 (match_operand:BLK 1 "memory_operand" "Q")))
5964 (use (match_operand 2 "const_int_operand" "n"))
5965 (clobber (reg:CC 33))]
5966 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
5967 "xc\t%O0(%2,%R0),%S1"
5968 [(set_attr "op_type" "SS")])
5971 [(set (match_operand 0 "memory_operand" "")
5973 (match_operand 1 "memory_operand" "")))
5974 (clobber (reg:CC 33))]
5976 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5977 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
5979 [(set (match_dup 0) (xor:BLK (match_dup 0) (match_dup 1)))
5981 (clobber (reg:CC 33))])]
5983 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
5984 operands[0] = adjust_address (operands[0], BLKmode, 0);
5985 operands[1] = adjust_address (operands[1], BLKmode, 0);
5990 [(set (match_operand:BLK 0 "memory_operand" "")
5991 (xor:BLK (match_dup 0)
5992 (match_operand:BLK 1 "memory_operand" "")))
5993 (use (match_operand 2 "const_int_operand" ""))
5994 (clobber (reg:CC 33))])
5996 [(set (match_operand:BLK 3 "memory_operand" "")
5997 (xor:BLK (match_dup 3)
5998 (match_operand:BLK 4 "memory_operand" "")))
5999 (use (match_operand 5 "const_int_operand" ""))
6000 (clobber (reg:CC 33))])]
6001 "s390_offset_p (operands[0], operands[3], operands[2])
6002 && s390_offset_p (operands[1], operands[4], operands[2])
6003 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
6005 [(set (match_dup 6) (xor:BLK (match_dup 6) (match_dup 7)))
6007 (clobber (reg:CC 33))])]
6008 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
6009 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
6010 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
6013 ; Block xor (XC) patterns with src == dest.
6016 (define_insn "*xc_zero"
6017 [(set (match_operand:BLK 0 "memory_operand" "=Q")
6019 (use (match_operand 1 "const_int_operand" "n"))
6020 (clobber (reg:CC 33))]
6021 "INTVAL (operands[1]) >= 1 && INTVAL (operands[1]) <= 256"
6022 "xc\t%O0(%1,%R0),%S0"
6023 [(set_attr "op_type" "SS")])
6027 [(set (match_operand:BLK 0 "memory_operand" "")
6029 (use (match_operand 1 "const_int_operand" ""))
6030 (clobber (reg:CC 33))])
6032 [(set (match_operand:BLK 2 "memory_operand" "")
6034 (use (match_operand 3 "const_int_operand" ""))
6035 (clobber (reg:CC 33))])]
6036 "s390_offset_p (operands[0], operands[2], operands[1])
6037 && INTVAL (operands[1]) + INTVAL (operands[3]) <= 256"
6039 [(set (match_dup 4) (const_int 0))
6041 (clobber (reg:CC 33))])]
6042 "operands[4] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
6043 operands[5] = GEN_INT (INTVAL (operands[1]) + INTVAL (operands[3]));")
6047 ;;- Negate instructions.
6051 ; negdi2 instruction pattern(s).
6054 (define_expand "negdi2"
6056 [(set (match_operand:DI 0 "register_operand" "=d")
6057 (neg:DI (match_operand:DI 1 "register_operand" "d")))
6058 (clobber (reg:CC 33))])]
6062 (define_insn "*negdi2_64"
6063 [(set (match_operand:DI 0 "register_operand" "=d")
6064 (neg:DI (match_operand:DI 1 "register_operand" "d")))
6065 (clobber (reg:CC 33))]
6068 [(set_attr "op_type" "RR")])
6070 (define_insn "*negdi2_31"
6071 [(set (match_operand:DI 0 "register_operand" "=d")
6072 (neg:DI (match_operand:DI 1 "register_operand" "d")))
6073 (clobber (reg:CC 33))]
6077 xop[0] = gen_label_rtx ();
6078 output_asm_insn ("lcr\t%0,%1", operands);
6079 output_asm_insn ("lcr\t%N0,%N1", operands);
6080 output_asm_insn ("je\t%l0", xop);
6081 output_asm_insn ("bctr\t%0,0", operands);
6082 targetm.asm_out.internal_label (asm_out_file, "L",
6083 CODE_LABEL_NUMBER (xop[0]));
6086 [(set_attr "length" "10")])
6089 ; negsi2 instruction pattern(s).
6092 (define_insn "negsi2"
6093 [(set (match_operand:SI 0 "register_operand" "=d")
6094 (neg:SI (match_operand:SI 1 "register_operand" "d")))
6095 (clobber (reg:CC 33))]
6098 [(set_attr "op_type" "RR")])
6101 ; negdf2 instruction pattern(s).
6104 (define_expand "negdf2"
6106 [(set (match_operand:DF 0 "register_operand" "=f")
6107 (neg:DF (match_operand:DF 1 "register_operand" "f")))
6108 (clobber (reg:CC 33))])]
6112 (define_insn "*negdf2"
6113 [(set (match_operand:DF 0 "register_operand" "=f")
6114 (neg:DF (match_operand:DF 1 "register_operand" "f")))
6115 (clobber (reg:CC 33))]
6116 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6118 [(set_attr "op_type" "RRE")
6119 (set_attr "type" "fsimpd")])
6121 (define_insn "*negdf2_ibm"
6122 [(set (match_operand:DF 0 "register_operand" "=f")
6123 (neg:DF (match_operand:DF 1 "register_operand" "f")))
6124 (clobber (reg:CC 33))]
6125 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6127 [(set_attr "op_type" "RR")
6128 (set_attr "type" "fsimpd")])
6131 ; negsf2 instruction pattern(s).
6134 (define_expand "negsf2"
6136 [(set (match_operand:SF 0 "register_operand" "=f")
6137 (neg:SF (match_operand:SF 1 "register_operand" "f")))
6138 (clobber (reg:CC 33))])]
6142 (define_insn "*negsf2"
6143 [(set (match_operand:SF 0 "register_operand" "=f")
6144 (neg:SF (match_operand:SF 1 "register_operand" "f")))
6145 (clobber (reg:CC 33))]
6146 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6148 [(set_attr "op_type" "RRE")
6149 (set_attr "type" "fsimps")])
6151 (define_insn "*negsf2"
6152 [(set (match_operand:SF 0 "register_operand" "=f")
6153 (neg:SF (match_operand:SF 1 "register_operand" "f")))
6154 (clobber (reg:CC 33))]
6155 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6157 [(set_attr "op_type" "RR")
6158 (set_attr "type" "fsimps")])
6162 ;;- Absolute value instructions.
6166 ; absdi2 instruction pattern(s).
6169 (define_insn "absdi2"
6170 [(set (match_operand:DI 0 "register_operand" "=d")
6171 (abs:DI (match_operand:DI 1 "register_operand" "d")))
6172 (clobber (reg:CC 33))]
6175 [(set_attr "op_type" "RRE")])
6178 ; abssi2 instruction pattern(s).
6181 (define_insn "abssi2"
6182 [(set (match_operand:SI 0 "register_operand" "=d")
6183 (abs:SI (match_operand:SI 1 "register_operand" "d")))
6184 (clobber (reg:CC 33))]
6187 [(set_attr "op_type" "RR")])
6190 ; absdf2 instruction pattern(s).
6193 (define_expand "absdf2"
6195 [(set (match_operand:DF 0 "register_operand" "=f")
6196 (abs:DF (match_operand:DF 1 "register_operand" "f")))
6197 (clobber (reg:CC 33))])]
6201 (define_insn "*absdf2"
6202 [(set (match_operand:DF 0 "register_operand" "=f")
6203 (abs:DF (match_operand:DF 1 "register_operand" "f")))
6204 (clobber (reg:CC 33))]
6205 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6207 [(set_attr "op_type" "RRE")
6208 (set_attr "type" "fsimpd")])
6210 (define_insn "*absdf2_ibm"
6211 [(set (match_operand:DF 0 "register_operand" "=f")
6212 (abs:DF (match_operand:DF 1 "register_operand" "f")))
6213 (clobber (reg:CC 33))]
6214 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6216 [(set_attr "op_type" "RR")
6217 (set_attr "type" "fsimpd")])
6220 ; abssf2 instruction pattern(s).
6223 (define_expand "abssf2"
6225 [(set (match_operand:SF 0 "register_operand" "=f")
6226 (abs:SF (match_operand:SF 1 "register_operand" "f")))
6227 (clobber (reg:CC 33))])]
6231 (define_insn "*abssf2"
6232 [(set (match_operand:SF 0 "register_operand" "=f")
6233 (abs:SF (match_operand:SF 1 "register_operand" "f")))
6234 (clobber (reg:CC 33))]
6235 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6237 [(set_attr "op_type" "RRE")
6238 (set_attr "type" "fsimps")])
6240 (define_insn "*abssf2_ibm"
6241 [(set (match_operand:SF 0 "register_operand" "=f")
6242 (abs:SF (match_operand:SF 1 "register_operand" "f")))
6243 (clobber (reg:CC 33))]
6244 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6246 [(set_attr "op_type" "RR")
6247 (set_attr "type" "fsimps")])
6250 ;;- Negated absolute value instructions
6257 (define_insn "*negabssi2"
6258 [(set (match_operand:SI 0 "register_operand" "=d")
6259 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
6260 (clobber (reg:CC 33))]
6263 [(set_attr "op_type" "RR")])
6265 (define_insn "*negabsdi2"
6266 [(set (match_operand:DI 0 "register_operand" "=d")
6267 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
6268 (clobber (reg:CC 33))]
6271 [(set_attr "op_type" "RRE")])
6277 (define_insn "*negabssf2"
6278 [(set (match_operand:SF 0 "register_operand" "=f")
6279 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
6280 (clobber (reg:CC 33))]
6281 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6283 [(set_attr "op_type" "RRE")
6284 (set_attr "type" "fsimps")])
6286 (define_insn "*negabsdf2"
6287 [(set (match_operand:DF 0 "register_operand" "=f")
6288 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
6289 (clobber (reg:CC 33))]
6290 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6292 [(set_attr "op_type" "RRE")
6293 (set_attr "type" "fsimpd")])
6296 ;;- Square root instructions.
6300 ; sqrtdf2 instruction pattern(s).
6303 (define_insn "sqrtdf2"
6304 [(set (match_operand:DF 0 "register_operand" "=f,f")
6305 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
6306 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6310 [(set_attr "op_type" "RRE,RXE")
6311 (set_attr "type" "fsqrtd")])
6314 ; sqrtsf2 instruction pattern(s).
6317 (define_insn "sqrtsf2"
6318 [(set (match_operand:SF 0 "register_operand" "=f,f")
6319 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
6320 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6324 [(set_attr "op_type" "RRE,RXE")
6325 (set_attr "type" "fsqrts")])
6328 ;;- One complement instructions.
6332 ; one_cmpldi2 instruction pattern(s).
6335 (define_expand "one_cmpldi2"
6337 [(set (match_operand:DI 0 "register_operand" "")
6338 (xor:DI (match_operand:DI 1 "register_operand" "")
6340 (clobber (reg:CC 33))])]
6345 ; one_cmplsi2 instruction pattern(s).
6348 (define_expand "one_cmplsi2"
6350 [(set (match_operand:SI 0 "register_operand" "")
6351 (xor:SI (match_operand:SI 1 "register_operand" "")
6353 (clobber (reg:CC 33))])]
6358 ; one_cmplhi2 instruction pattern(s).
6361 (define_expand "one_cmplhi2"
6363 [(set (match_operand:HI 0 "register_operand" "")
6364 (xor:HI (match_operand:HI 1 "register_operand" "")
6366 (clobber (reg:CC 33))])]
6371 ; one_cmplqi2 instruction pattern(s).
6374 (define_expand "one_cmplqi2"
6376 [(set (match_operand:QI 0 "register_operand" "")
6377 (xor:QI (match_operand:QI 1 "register_operand" "")
6379 (clobber (reg:CC 33))])]
6385 ;;- Rotate instructions.
6389 ; rotldi3 instruction pattern(s).
6392 (define_insn "rotldi3"
6393 [(set (match_operand:DI 0 "register_operand" "=d")
6394 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6395 (match_operand:SI 2 "shift_count_operand" "Y")))]
6398 [(set_attr "op_type" "RSE")
6399 (set_attr "atype" "reg")])
6402 ; rotlsi3 instruction pattern(s).
6405 (define_insn "rotlsi3"
6406 [(set (match_operand:SI 0 "register_operand" "=d")
6407 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6408 (match_operand:SI 2 "shift_count_operand" "Y")))]
6411 [(set_attr "op_type" "RSE")
6412 (set_attr "atype" "reg")])
6416 ;;- Arithmetic shift instructions.
6420 ; ashldi3 instruction pattern(s).
6423 (define_expand "ashldi3"
6424 [(set (match_operand:DI 0 "register_operand" "")
6425 (ashift:DI (match_operand:DI 1 "register_operand" "")
6426 (match_operand:SI 2 "shift_count_operand" "")))]
6430 (define_insn "*ashldi3_31"
6431 [(set (match_operand:DI 0 "register_operand" "=d")
6432 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6433 (match_operand:SI 2 "shift_count_operand" "Y")))]
6436 [(set_attr "op_type" "RS")
6437 (set_attr "atype" "reg")])
6439 (define_insn "*ashldi3_64"
6440 [(set (match_operand:DI 0 "register_operand" "=d")
6441 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6442 (match_operand:SI 2 "shift_count_operand" "Y")))]
6445 [(set_attr "op_type" "RSE")
6446 (set_attr "atype" "reg")])
6449 ; ashrdi3 instruction pattern(s).
6452 (define_expand "ashrdi3"
6454 [(set (match_operand:DI 0 "register_operand" "")
6455 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6456 (match_operand:SI 2 "shift_count_operand" "")))
6457 (clobber (reg:CC 33))])]
6461 (define_insn "*ashrdi3_cc_31"
6463 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6464 (match_operand:SI 2 "shift_count_operand" "Y"))
6466 (set (match_operand:DI 0 "register_operand" "=d")
6467 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6468 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6470 [(set_attr "op_type" "RS")
6471 (set_attr "atype" "reg")])
6473 (define_insn "*ashrdi3_cconly_31"
6475 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6476 (match_operand:SI 2 "shift_count_operand" "Y"))
6478 (clobber (match_scratch:DI 0 "=d"))]
6479 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6481 [(set_attr "op_type" "RS")
6482 (set_attr "atype" "reg")])
6484 (define_insn "*ashrdi3_31"
6485 [(set (match_operand:DI 0 "register_operand" "=d")
6486 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6487 (match_operand:SI 2 "shift_count_operand" "Y")))
6488 (clobber (reg:CC 33))]
6491 [(set_attr "op_type" "RS")
6492 (set_attr "atype" "reg")])
6494 (define_insn "*ashrdi3_cc_64"
6496 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6497 (match_operand:SI 2 "shift_count_operand" "Y"))
6499 (set (match_operand:DI 0 "register_operand" "=d")
6500 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6501 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6503 [(set_attr "op_type" "RSE")
6504 (set_attr "atype" "reg")])
6506 (define_insn "*ashrdi3_cconly_64"
6508 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6509 (match_operand:SI 2 "shift_count_operand" "Y"))
6511 (clobber (match_scratch:DI 0 "=d"))]
6512 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6514 [(set_attr "op_type" "RSE")
6515 (set_attr "atype" "reg")])
6517 (define_insn "*ashrdi3_64"
6518 [(set (match_operand:DI 0 "register_operand" "=d")
6519 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6520 (match_operand:SI 2 "shift_count_operand" "Y")))
6521 (clobber (reg:CC 33))]
6524 [(set_attr "op_type" "RSE")
6525 (set_attr "atype" "reg")])
6529 ; ashlsi3 instruction pattern(s).
6532 (define_insn "ashlsi3"
6533 [(set (match_operand:SI 0 "register_operand" "=d")
6534 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6535 (match_operand:SI 2 "shift_count_operand" "Y")))]
6538 [(set_attr "op_type" "RS")
6539 (set_attr "atype" "reg")])
6542 ; ashrsi3 instruction pattern(s).
6545 (define_insn "*ashrsi3_cc"
6547 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6548 (match_operand:SI 2 "shift_count_operand" "Y"))
6550 (set (match_operand:SI 0 "register_operand" "=d")
6551 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6552 "s390_match_ccmode(insn, CCSmode)"
6554 [(set_attr "op_type" "RS")
6555 (set_attr "atype" "reg")])
6558 (define_insn "*ashrsi3_cconly"
6560 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6561 (match_operand:SI 2 "shift_count_operand" "Y"))
6563 (clobber (match_scratch:SI 0 "=d"))]
6564 "s390_match_ccmode(insn, CCSmode)"
6566 [(set_attr "op_type" "RS")
6567 (set_attr "atype" "reg")])
6569 (define_insn "ashrsi3"
6570 [(set (match_operand:SI 0 "register_operand" "=d")
6571 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6572 (match_operand:SI 2 "shift_count_operand" "Y")))
6573 (clobber (reg:CC 33))]
6576 [(set_attr "op_type" "RS")
6577 (set_attr "atype" "reg")])
6581 ;;- logical shift instructions.
6585 ; lshrdi3 instruction pattern(s).
6588 (define_expand "lshrdi3"
6589 [(set (match_operand:DI 0 "register_operand" "")
6590 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6591 (match_operand:SI 2 "shift_count_operand" "")))]
6595 (define_insn "*lshrdi3_31"
6596 [(set (match_operand:DI 0 "register_operand" "=d")
6597 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6598 (match_operand:SI 2 "shift_count_operand" "Y")))]
6601 [(set_attr "op_type" "RS")
6602 (set_attr "atype" "reg")])
6604 (define_insn "*lshrdi3_64"
6605 [(set (match_operand:DI 0 "register_operand" "=d")
6606 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6607 (match_operand:SI 2 "shift_count_operand" "Y")))]
6610 [(set_attr "op_type" "RSE")
6611 (set_attr "atype" "reg")])
6614 ; lshrsi3 instruction pattern(s).
6617 (define_insn "lshrsi3"
6618 [(set (match_operand:SI 0 "register_operand" "=d")
6619 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6620 (match_operand:SI 2 "shift_count_operand" "Y")))]
6623 [(set_attr "op_type" "RS")
6624 (set_attr "atype" "reg")])
6628 ;; Branch instruction patterns.
6631 (define_expand "beq"
6632 [(match_operand 0 "" "")]
6634 "s390_emit_jump (operands[0],
6635 s390_emit_compare (EQ, s390_compare_op0, s390_compare_op1)); DONE;")
6637 (define_expand "bne"
6638 [(match_operand 0 "" "")]
6640 "s390_emit_jump (operands[0],
6641 s390_emit_compare (NE, s390_compare_op0, s390_compare_op1)); DONE;")
6643 (define_expand "bgt"
6644 [(match_operand 0 "" "")]
6646 "s390_emit_jump (operands[0],
6647 s390_emit_compare (GT, s390_compare_op0, s390_compare_op1)); DONE;")
6649 (define_expand "bgtu"
6650 [(match_operand 0 "" "")]
6652 "s390_emit_jump (operands[0],
6653 s390_emit_compare (GTU, s390_compare_op0, s390_compare_op1)); DONE;")
6655 (define_expand "blt"
6656 [(match_operand 0 "" "")]
6658 "s390_emit_jump (operands[0],
6659 s390_emit_compare (LT, s390_compare_op0, s390_compare_op1)); DONE;")
6661 (define_expand "bltu"
6662 [(match_operand 0 "" "")]
6664 "s390_emit_jump (operands[0],
6665 s390_emit_compare (LTU, s390_compare_op0, s390_compare_op1)); DONE;")
6667 (define_expand "bge"
6668 [(match_operand 0 "" "")]
6670 "s390_emit_jump (operands[0],
6671 s390_emit_compare (GE, s390_compare_op0, s390_compare_op1)); DONE;")
6673 (define_expand "bgeu"
6674 [(match_operand 0 "" "")]
6676 "s390_emit_jump (operands[0],
6677 s390_emit_compare (GEU, s390_compare_op0, s390_compare_op1)); DONE;")
6679 (define_expand "ble"
6680 [(match_operand 0 "" "")]
6682 "s390_emit_jump (operands[0],
6683 s390_emit_compare (LE, s390_compare_op0, s390_compare_op1)); DONE;")
6685 (define_expand "bleu"
6686 [(match_operand 0 "" "")]
6688 "s390_emit_jump (operands[0],
6689 s390_emit_compare (LEU, s390_compare_op0, s390_compare_op1)); DONE;")
6691 (define_expand "bunordered"
6692 [(match_operand 0 "" "")]
6694 "s390_emit_jump (operands[0],
6695 s390_emit_compare (UNORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6697 (define_expand "bordered"
6698 [(match_operand 0 "" "")]
6700 "s390_emit_jump (operands[0],
6701 s390_emit_compare (ORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6703 (define_expand "buneq"
6704 [(match_operand 0 "" "")]
6706 "s390_emit_jump (operands[0],
6707 s390_emit_compare (UNEQ, s390_compare_op0, s390_compare_op1)); DONE;")
6709 (define_expand "bunlt"
6710 [(match_operand 0 "" "")]
6712 "s390_emit_jump (operands[0],
6713 s390_emit_compare (UNLT, s390_compare_op0, s390_compare_op1)); DONE;")
6715 (define_expand "bungt"
6716 [(match_operand 0 "" "")]
6718 "s390_emit_jump (operands[0],
6719 s390_emit_compare (UNGT, s390_compare_op0, s390_compare_op1)); DONE;")
6721 (define_expand "bunle"
6722 [(match_operand 0 "" "")]
6724 "s390_emit_jump (operands[0],
6725 s390_emit_compare (UNLE, s390_compare_op0, s390_compare_op1)); DONE;")
6727 (define_expand "bunge"
6728 [(match_operand 0 "" "")]
6730 "s390_emit_jump (operands[0],
6731 s390_emit_compare (UNGE, s390_compare_op0, s390_compare_op1)); DONE;")
6733 (define_expand "bltgt"
6734 [(match_operand 0 "" "")]
6736 "s390_emit_jump (operands[0],
6737 s390_emit_compare (LTGT, s390_compare_op0, s390_compare_op1)); DONE;")
6741 ;;- Conditional jump instructions.
6744 (define_insn "*cjump_64"
6747 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6748 (label_ref (match_operand 0 "" ""))
6752 if (get_attr_length (insn) == 4)
6755 return "jg%C1\t%l0";
6757 [(set_attr "op_type" "RI")
6758 (set_attr "type" "branch")
6759 (set (attr "length")
6760 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6761 (const_int 4) (const_int 6)))])
6763 (define_insn "*cjump_31"
6766 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6767 (label_ref (match_operand 0 "" ""))
6771 if (get_attr_length (insn) == 4)
6776 [(set_attr "op_type" "RI")
6777 (set_attr "type" "branch")
6778 (set (attr "length")
6779 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6780 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6781 (const_int 4) (const_int 6))
6782 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6783 (const_int 4) (const_int 8))))])
6785 (define_insn "*cjump_long"
6788 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6789 (match_operand 0 "address_operand" "U")
6793 if (get_attr_op_type (insn) == OP_TYPE_RR)
6798 [(set (attr "op_type")
6799 (if_then_else (match_operand 0 "register_operand" "")
6800 (const_string "RR") (const_string "RX")))
6801 (set_attr "type" "branch")
6802 (set_attr "atype" "agen")])
6806 ;;- Negated conditional jump instructions.
6809 (define_insn "*icjump_64"
6812 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6814 (label_ref (match_operand 0 "" ""))))]
6817 if (get_attr_length (insn) == 4)
6820 return "jg%D1\t%l0";
6822 [(set_attr "op_type" "RI")
6823 (set_attr "type" "branch")
6824 (set (attr "length")
6825 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6826 (const_int 4) (const_int 6)))])
6828 (define_insn "*icjump_31"
6831 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6833 (label_ref (match_operand 0 "" ""))))]
6836 if (get_attr_length (insn) == 4)
6841 [(set_attr "op_type" "RI")
6842 (set_attr "type" "branch")
6843 (set (attr "length")
6844 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6845 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6846 (const_int 4) (const_int 6))
6847 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6848 (const_int 4) (const_int 8))))])
6850 (define_insn "*icjump_long"
6853 (match_operator 1 "s390_comparison" [(reg 33) (const_int 0)])
6855 (match_operand 0 "address_operand" "U")))]
6858 if (get_attr_op_type (insn) == OP_TYPE_RR)
6863 [(set (attr "op_type")
6864 (if_then_else (match_operand 0 "register_operand" "")
6865 (const_string "RR") (const_string "RX")))
6866 (set_attr "type" "branch")
6867 (set_attr "atype" "agen")])
6870 ;;- Trap instructions.
6874 [(trap_if (const_int 1) (const_int 0))]
6877 [(set_attr "op_type" "RI")
6878 (set_attr "type" "branch")])
6880 (define_expand "conditional_trap"
6881 [(trap_if (match_operand 0 "comparison_operator" "")
6882 (match_operand 1 "general_operand" ""))]
6885 if (operands[1] != const0_rtx) FAIL;
6886 operands[0] = s390_emit_compare (GET_CODE (operands[0]),
6887 s390_compare_op0, s390_compare_op1);
6890 (define_insn "*trap"
6891 [(trap_if (match_operator 0 "s390_comparison" [(reg 33) (const_int 0)])
6895 [(set_attr "op_type" "RI")
6896 (set_attr "type" "branch")])
6899 ;;- Loop instructions.
6901 ;; This is all complicated by the fact that since this is a jump insn
6902 ;; we must handle our own output reloads.
6904 (define_expand "doloop_end"
6905 [(use (match_operand 0 "" "")) ; loop pseudo
6906 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6907 (use (match_operand 2 "" "")) ; max iterations
6908 (use (match_operand 3 "" "")) ; loop level
6909 (use (match_operand 4 "" ""))] ; label
6912 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
6913 emit_jump_insn (gen_doloop_si31 (operands[4], operands[0], operands[0]));
6914 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
6915 emit_jump_insn (gen_doloop_si64 (operands[4], operands[0], operands[0]));
6916 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6917 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6924 (define_insn_and_split "doloop_si64"
6927 (ne (match_operand:SI 1 "register_operand" "d,d")
6929 (label_ref (match_operand 0 "" ""))
6931 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6932 (plus:SI (match_dup 1) (const_int -1)))
6933 (clobber (match_scratch:SI 3 "=X,&d"))
6934 (clobber (reg:CC 33))]
6937 if (which_alternative != 0)
6939 else if (get_attr_length (insn) == 4)
6940 return "brct\t%1,%l0";
6942 return "ahi\t%1,-1\;jgne\t%l0";
6944 "&& reload_completed
6945 && (! REG_P (operands[2])
6946 || ! rtx_equal_p (operands[1], operands[2]))"
6947 [(set (match_dup 3) (match_dup 1))
6948 (parallel [(set (reg:CCAN 33)
6949 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6951 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6952 (set (match_dup 2) (match_dup 3))
6953 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6954 (label_ref (match_dup 0))
6957 [(set_attr "op_type" "RI")
6958 (set_attr "type" "branch")
6959 (set (attr "length")
6960 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6961 (const_int 4) (const_int 10)))])
6963 (define_insn_and_split "doloop_si31"
6966 (ne (match_operand:SI 1 "register_operand" "d,d")
6968 (label_ref (match_operand 0 "" ""))
6970 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6971 (plus:SI (match_dup 1) (const_int -1)))
6972 (clobber (match_scratch:SI 3 "=X,&d"))
6973 (clobber (reg:CC 33))]
6976 if (which_alternative != 0)
6978 else if (get_attr_length (insn) == 4)
6979 return "brct\t%1,%l0";
6983 "&& reload_completed
6984 && (! REG_P (operands[2])
6985 || ! rtx_equal_p (operands[1], operands[2]))"
6986 [(set (match_dup 3) (match_dup 1))
6987 (parallel [(set (reg:CCAN 33)
6988 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6990 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6991 (set (match_dup 2) (match_dup 3))
6992 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6993 (label_ref (match_dup 0))
6996 [(set_attr "op_type" "RI")
6997 (set_attr "type" "branch")
6998 (set (attr "length")
6999 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
7000 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7001 (const_int 4) (const_int 6))
7002 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7003 (const_int 4) (const_int 8))))])
7005 (define_insn "*doloop_si_long"
7008 (ne (match_operand:SI 1 "register_operand" "d,d")
7010 (match_operand 0 "address_operand" "U,U")
7012 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
7013 (plus:SI (match_dup 1) (const_int -1)))
7014 (clobber (match_scratch:SI 3 "=X,&d"))
7015 (clobber (reg:CC 33))]
7018 if (get_attr_op_type (insn) == OP_TYPE_RR)
7019 return "bctr\t%1,%0";
7021 return "bct\t%1,%a0";
7023 [(set (attr "op_type")
7024 (if_then_else (match_operand 0 "register_operand" "")
7025 (const_string "RR") (const_string "RX")))
7026 (set_attr "type" "branch")
7027 (set_attr "atype" "agen")])
7029 (define_insn_and_split "doloop_di"
7032 (ne (match_operand:DI 1 "register_operand" "d,d")
7034 (label_ref (match_operand 0 "" ""))
7036 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?*m*r")
7037 (plus:DI (match_dup 1) (const_int -1)))
7038 (clobber (match_scratch:DI 3 "=X,&d"))
7039 (clobber (reg:CC 33))]
7042 if (which_alternative != 0)
7044 else if (get_attr_length (insn) == 4)
7045 return "brctg\t%1,%l0";
7047 return "aghi\t%1,-1\;jgne\t%l0";
7049 "&& reload_completed
7050 && (! REG_P (operands[2])
7051 || ! rtx_equal_p (operands[1], operands[2]))"
7052 [(set (match_dup 3) (match_dup 1))
7053 (parallel [(set (reg:CCAN 33)
7054 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
7056 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
7057 (set (match_dup 2) (match_dup 3))
7058 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
7059 (label_ref (match_dup 0))
7062 [(set_attr "op_type" "RI")
7063 (set_attr "type" "branch")
7064 (set (attr "length")
7065 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7066 (const_int 4) (const_int 10)))])
7069 ;;- Unconditional jump instructions.
7073 ; jump instruction pattern(s).
7076 (define_expand "jump"
7077 [(match_operand 0 "" "")]
7079 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
7081 (define_insn "*jump64"
7082 [(set (pc) (label_ref (match_operand 0 "" "")))]
7085 if (get_attr_length (insn) == 4)
7090 [(set_attr "op_type" "RI")
7091 (set_attr "type" "branch")
7092 (set (attr "length")
7093 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7094 (const_int 4) (const_int 6)))])
7096 (define_insn "*jump31"
7097 [(set (pc) (label_ref (match_operand 0 "" "")))]
7100 if (get_attr_length (insn) == 4)
7105 [(set_attr "op_type" "RI")
7106 (set_attr "type" "branch")
7107 (set (attr "length")
7108 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
7109 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7110 (const_int 4) (const_int 6))
7111 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7112 (const_int 4) (const_int 8))))])
7115 ; indirect-jump instruction pattern(s).
7118 (define_insn "indirect_jump"
7119 [(set (pc) (match_operand 0 "address_operand" "U"))]
7122 if (get_attr_op_type (insn) == OP_TYPE_RR)
7127 [(set (attr "op_type")
7128 (if_then_else (match_operand 0 "register_operand" "")
7129 (const_string "RR") (const_string "RX")))
7130 (set_attr "type" "branch")
7131 (set_attr "atype" "agen")])
7134 ; casesi instruction pattern(s).
7137 (define_insn "casesi_jump"
7138 [(set (pc) (match_operand 0 "address_operand" "U"))
7139 (use (label_ref (match_operand 1 "" "")))]
7142 if (get_attr_op_type (insn) == OP_TYPE_RR)
7147 [(set (attr "op_type")
7148 (if_then_else (match_operand 0 "register_operand" "")
7149 (const_string "RR") (const_string "RX")))
7150 (set_attr "type" "branch")
7151 (set_attr "atype" "agen")])
7153 (define_expand "casesi"
7154 [(match_operand:SI 0 "general_operand" "")
7155 (match_operand:SI 1 "general_operand" "")
7156 (match_operand:SI 2 "general_operand" "")
7157 (label_ref (match_operand 3 "" ""))
7158 (label_ref (match_operand 4 "" ""))]
7161 rtx index = gen_reg_rtx (SImode);
7162 rtx base = gen_reg_rtx (Pmode);
7163 rtx target = gen_reg_rtx (Pmode);
7165 emit_move_insn (index, operands[0]);
7166 emit_insn (gen_subsi3 (index, index, operands[1]));
7167 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
7170 if (Pmode != SImode)
7171 index = convert_to_mode (Pmode, index, 1);
7172 if (GET_CODE (index) != REG)
7173 index = copy_to_mode_reg (Pmode, index);
7176 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
7178 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
7180 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
7182 index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
7183 emit_move_insn (target, index);
7186 target = gen_rtx_PLUS (Pmode, base, target);
7187 emit_jump_insn (gen_casesi_jump (target, operands[3]));
7194 ;;- Jump to subroutine.
7199 ; untyped call instruction pattern(s).
7202 ;; Call subroutine returning any type.
7203 (define_expand "untyped_call"
7204 [(parallel [(call (match_operand 0 "" "")
7206 (match_operand 1 "" "")
7207 (match_operand 2 "" "")])]
7212 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
7214 for (i = 0; i < XVECLEN (operands[2], 0); i++)
7216 rtx set = XVECEXP (operands[2], 0, i);
7217 emit_move_insn (SET_DEST (set), SET_SRC (set));
7220 /* The optimizer does not know that the call sets the function value
7221 registers we stored in the result block. We avoid problems by
7222 claiming that all hard registers are used and clobbered at this
7224 emit_insn (gen_blockage ());
7229 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
7230 ;; all of memory. This blocks insns from being moved across this point.
7232 (define_insn "blockage"
7233 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
7236 [(set_attr "type" "none")
7237 (set_attr "length" "0")])
7243 (define_expand "sibcall"
7244 [(call (match_operand 0 "" "")
7245 (match_operand 1 "" ""))]
7248 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
7252 (define_insn "*sibcall_br"
7253 [(call (mem:QI (reg 1))
7254 (match_operand 0 "const_int_operand" "n"))]
7255 "SIBLING_CALL_P (insn)
7256 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
7258 [(set_attr "op_type" "RR")
7259 (set_attr "type" "branch")
7260 (set_attr "atype" "agen")])
7262 (define_insn "*sibcall_brc"
7263 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7264 (match_operand 1 "const_int_operand" "n"))]
7265 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7267 [(set_attr "op_type" "RI")
7268 (set_attr "type" "branch")])
7270 (define_insn "*sibcall_brcl"
7271 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7272 (match_operand 1 "const_int_operand" "n"))]
7273 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7275 [(set_attr "op_type" "RIL")
7276 (set_attr "type" "branch")])
7279 ; sibcall_value patterns
7282 (define_expand "sibcall_value"
7283 [(set (match_operand 0 "" "")
7284 (call (match_operand 1 "" "")
7285 (match_operand 2 "" "")))]
7288 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
7292 (define_insn "*sibcall_value_br"
7293 [(set (match_operand 0 "" "")
7294 (call (mem:QI (reg 1))
7295 (match_operand 1 "const_int_operand" "n")))]
7296 "SIBLING_CALL_P (insn)
7297 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
7299 [(set_attr "op_type" "RR")
7300 (set_attr "type" "branch")
7301 (set_attr "atype" "agen")])
7303 (define_insn "*sibcall_value_brc"
7304 [(set (match_operand 0 "" "")
7305 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7306 (match_operand 2 "const_int_operand" "n")))]
7307 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7309 [(set_attr "op_type" "RI")
7310 (set_attr "type" "branch")])
7312 (define_insn "*sibcall_value_brcl"
7313 [(set (match_operand 0 "" "")
7314 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7315 (match_operand 2 "const_int_operand" "n")))]
7316 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7318 [(set_attr "op_type" "RIL")
7319 (set_attr "type" "branch")])
7323 ; call instruction pattern(s).
7326 (define_expand "call"
7327 [(call (match_operand 0 "" "")
7328 (match_operand 1 "" ""))
7329 (use (match_operand 2 "" ""))]
7332 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
7333 gen_rtx_REG (Pmode, RETURN_REGNUM));
7337 (define_insn "*bras"
7338 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7339 (match_operand 1 "const_int_operand" "n"))
7340 (clobber (match_operand 2 "register_operand" "=r"))]
7341 "!SIBLING_CALL_P (insn)
7342 && TARGET_SMALL_EXEC
7343 && GET_MODE (operands[2]) == Pmode"
7345 [(set_attr "op_type" "RI")
7346 (set_attr "type" "jsr")])
7348 (define_insn "*brasl"
7349 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7350 (match_operand 1 "const_int_operand" "n"))
7351 (clobber (match_operand 2 "register_operand" "=r"))]
7352 "!SIBLING_CALL_P (insn)
7354 && GET_MODE (operands[2]) == Pmode"
7356 [(set_attr "op_type" "RIL")
7357 (set_attr "type" "jsr")])
7359 (define_insn "*basr"
7360 [(call (mem:QI (match_operand 0 "address_operand" "U"))
7361 (match_operand 1 "const_int_operand" "n"))
7362 (clobber (match_operand 2 "register_operand" "=r"))]
7363 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
7365 if (get_attr_op_type (insn) == OP_TYPE_RR)
7366 return "basr\t%2,%0";
7368 return "bas\t%2,%a0";
7370 [(set (attr "op_type")
7371 (if_then_else (match_operand 0 "register_operand" "")
7372 (const_string "RR") (const_string "RX")))
7373 (set_attr "type" "jsr")
7374 (set_attr "atype" "agen")])
7377 ; call_value instruction pattern(s).
7380 (define_expand "call_value"
7381 [(set (match_operand 0 "" "")
7382 (call (match_operand 1 "" "")
7383 (match_operand 2 "" "")))
7384 (use (match_operand 3 "" ""))]
7387 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
7388 gen_rtx_REG (Pmode, RETURN_REGNUM));
7392 (define_insn "*bras_r"
7393 [(set (match_operand 0 "" "")
7394 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7395 (match_operand:SI 2 "const_int_operand" "n")))
7396 (clobber (match_operand 3 "register_operand" "=r"))]
7397 "!SIBLING_CALL_P (insn)
7398 && TARGET_SMALL_EXEC
7399 && GET_MODE (operands[3]) == Pmode"
7401 [(set_attr "op_type" "RI")
7402 (set_attr "type" "jsr")])
7404 (define_insn "*brasl_r"
7405 [(set (match_operand 0 "" "")
7406 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7407 (match_operand 2 "const_int_operand" "n")))
7408 (clobber (match_operand 3 "register_operand" "=r"))]
7409 "!SIBLING_CALL_P (insn)
7411 && GET_MODE (operands[3]) == Pmode"
7413 [(set_attr "op_type" "RIL")
7414 (set_attr "type" "jsr")])
7416 (define_insn "*basr_r"
7417 [(set (match_operand 0 "" "")
7418 (call (mem:QI (match_operand 1 "address_operand" "U"))
7419 (match_operand 2 "const_int_operand" "n")))
7420 (clobber (match_operand 3 "register_operand" "=r"))]
7421 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7423 if (get_attr_op_type (insn) == OP_TYPE_RR)
7424 return "basr\t%3,%1";
7426 return "bas\t%3,%a1";
7428 [(set (attr "op_type")
7429 (if_then_else (match_operand 1 "register_operand" "")
7430 (const_string "RR") (const_string "RX")))
7431 (set_attr "type" "jsr")
7432 (set_attr "atype" "agen")])
7435 ;;- Thread-local storage support.
7438 (define_expand "get_tp_64"
7439 [(set (match_operand:DI 0 "nonimmediate_operand" "") (reg:DI 36))]
7443 (define_expand "get_tp_31"
7444 [(set (match_operand:SI 0 "nonimmediate_operand" "") (reg:SI 36))]
7448 (define_expand "set_tp_64"
7449 [(set (reg:DI 36) (match_operand:DI 0 "nonimmediate_operand" ""))
7450 (unspec_volatile [(reg:DI 36)] UNSPECV_SET_TP)]
7454 (define_expand "set_tp_31"
7455 [(set (reg:SI 36) (match_operand:SI 0 "nonimmediate_operand" ""))
7456 (unspec_volatile [(reg:SI 36)] UNSPECV_SET_TP)]
7460 (define_insn "*set_tp"
7461 [(unspec_volatile [(reg 36)] UNSPECV_SET_TP)]
7464 [(set_attr "type" "none")
7465 (set_attr "length" "0")])
7467 (define_insn "*tls_load_64"
7468 [(set (match_operand:DI 0 "register_operand" "=d")
7469 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7470 (match_operand:DI 2 "" "")]
7474 [(set_attr "op_type" "RXE")])
7476 (define_insn "*tls_load_31"
7477 [(set (match_operand:SI 0 "register_operand" "=d,d")
7478 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7479 (match_operand:SI 2 "" "")]
7485 [(set_attr "op_type" "RX,RXY")])
7487 (define_insn "*bras_tls"
7488 [(set (match_operand 0 "" "")
7489 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7490 (match_operand 2 "const_int_operand" "n")))
7491 (clobber (match_operand 3 "register_operand" "=r"))
7492 (use (match_operand 4 "" ""))]
7493 "!SIBLING_CALL_P (insn)
7494 && TARGET_SMALL_EXEC
7495 && GET_MODE (operands[3]) == Pmode"
7497 [(set_attr "op_type" "RI")
7498 (set_attr "type" "jsr")])
7500 (define_insn "*brasl_tls"
7501 [(set (match_operand 0 "" "")
7502 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7503 (match_operand 2 "const_int_operand" "n")))
7504 (clobber (match_operand 3 "register_operand" "=r"))
7505 (use (match_operand 4 "" ""))]
7506 "!SIBLING_CALL_P (insn)
7508 && GET_MODE (operands[3]) == Pmode"
7510 [(set_attr "op_type" "RIL")
7511 (set_attr "type" "jsr")])
7513 (define_insn "*basr_tls"
7514 [(set (match_operand 0 "" "")
7515 (call (mem:QI (match_operand 1 "address_operand" "U"))
7516 (match_operand 2 "const_int_operand" "n")))
7517 (clobber (match_operand 3 "register_operand" "=r"))
7518 (use (match_operand 4 "" ""))]
7519 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7521 if (get_attr_op_type (insn) == OP_TYPE_RR)
7522 return "basr\t%3,%1%J4";
7524 return "bas\t%3,%a1%J4";
7526 [(set (attr "op_type")
7527 (if_then_else (match_operand 1 "register_operand" "")
7528 (const_string "RR") (const_string "RX")))
7529 (set_attr "type" "jsr")
7530 (set_attr "atype" "agen")])
7533 ;;- Miscellaneous instructions.
7537 ; allocate stack instruction pattern(s).
7540 (define_expand "allocate_stack"
7541 [(match_operand 0 "general_operand" "")
7542 (match_operand 1 "general_operand" "")]
7543 "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN"
7545 rtx temp = gen_reg_rtx (Pmode);
7547 emit_move_insn (temp, s390_back_chain_rtx ());
7548 anti_adjust_stack (operands[1]);
7549 emit_move_insn (s390_back_chain_rtx (), temp);
7551 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7557 ; setjmp instruction pattern.
7560 (define_expand "builtin_setjmp_receiver"
7561 [(match_operand 0 "" "")]
7564 emit_insn (s390_load_got ());
7565 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7569 ;; These patterns say how to save and restore the stack pointer. We need not
7570 ;; save the stack pointer at function level since we are careful to
7571 ;; preserve the backchain. At block level, we have to restore the backchain
7572 ;; when we restore the stack pointer.
7574 ;; For nonlocal gotos, we must save both the stack pointer and its
7575 ;; backchain and restore both. Note that in the nonlocal case, the
7576 ;; save area is a memory location.
7578 (define_expand "save_stack_function"
7579 [(match_operand 0 "general_operand" "")
7580 (match_operand 1 "general_operand" "")]
7584 (define_expand "restore_stack_function"
7585 [(match_operand 0 "general_operand" "")
7586 (match_operand 1 "general_operand" "")]
7590 (define_expand "restore_stack_block"
7591 [(match_operand 0 "register_operand" "")
7592 (match_operand 1 "register_operand" "")]
7593 "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN"
7595 rtx temp = gen_reg_rtx (Pmode);
7597 emit_move_insn (temp, s390_back_chain_rtx ());
7598 emit_move_insn (operands[0], operands[1]);
7599 emit_move_insn (s390_back_chain_rtx (), temp);
7604 (define_expand "save_stack_nonlocal"
7605 [(match_operand 0 "memory_operand" "")
7606 (match_operand 1 "register_operand" "")]
7609 enum machine_mode mode = TARGET_64BIT ? OImode : TImode;
7610 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
7612 /* Copy the backchain to the first word, sp to the second and the
7613 literal pool base to the third. */
7615 if (TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN)
7617 rtx temp = force_reg (Pmode, s390_back_chain_rtx ());
7618 emit_move_insn (operand_subword (operands[0], 0, 0, mode), temp);
7621 emit_move_insn (operand_subword (operands[0], 1, 0, mode), operands[1]);
7622 emit_move_insn (operand_subword (operands[0], 2, 0, mode), base);
7627 (define_expand "restore_stack_nonlocal"
7628 [(match_operand 0 "register_operand" "")
7629 (match_operand 1 "memory_operand" "")]
7632 enum machine_mode mode = TARGET_64BIT ? OImode : TImode;
7633 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
7634 rtx temp = NULL_RTX;
7636 /* Restore the backchain from the first word, sp from the second and the
7637 literal pool base from the third. */
7639 if (TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN)
7640 temp = force_reg (Pmode, operand_subword (operands[1], 0, 0, mode));
7642 emit_move_insn (base, operand_subword (operands[1], 2, 0, mode));
7643 emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, mode));
7646 emit_move_insn (s390_back_chain_rtx (), temp);
7648 emit_insn (gen_rtx_USE (VOIDmode, base));
7654 ; nop instruction pattern(s).
7661 [(set_attr "op_type" "RR")])
7665 ; Special literal pool access instruction pattern(s).
7668 (define_insn "*pool_entry"
7669 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7670 UNSPECV_POOL_ENTRY)]
7673 enum machine_mode mode = GET_MODE (PATTERN (insn));
7674 unsigned int align = GET_MODE_BITSIZE (mode);
7675 s390_output_pool_entry (operands[0], mode, align);
7678 [(set (attr "length")
7679 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7681 (define_insn "pool_align"
7682 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")]
7683 UNSPECV_POOL_ALIGN)]
7686 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7688 (define_insn "pool_section_start"
7689 [(unspec_volatile [(const_int 1)] UNSPECV_POOL_SECTION)]
7692 [(set_attr "length" "0")])
7694 (define_insn "pool_section_end"
7695 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_SECTION)]
7698 [(set_attr "length" "0")])
7700 (define_insn "main_base_31_small"
7701 [(set (match_operand 0 "register_operand" "=a")
7702 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7703 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7705 [(set_attr "op_type" "RR")
7706 (set_attr "type" "la")])
7708 (define_insn "main_base_31_large"
7709 [(set (match_operand 0 "register_operand" "=a")
7710 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7711 (set (pc) (label_ref (match_operand 2 "" "")))]
7712 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7714 [(set_attr "op_type" "RI")])
7716 (define_insn "main_base_64"
7717 [(set (match_operand 0 "register_operand" "=a")
7718 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7719 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7721 [(set_attr "op_type" "RIL")
7722 (set_attr "type" "larl")])
7724 (define_insn "main_pool"
7725 [(set (match_operand 0 "register_operand" "=a")
7726 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
7727 "GET_MODE (operands[0]) == Pmode"
7730 (if_then_else (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
7731 (const_string "larl") (const_string "la")))])
7733 (define_insn "reload_base_31"
7734 [(set (match_operand 0 "register_operand" "=a")
7735 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7736 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7737 "basr\t%0,0\;la\t%0,%1-.(%0)"
7738 [(set_attr "length" "6")
7739 (set_attr "type" "la")])
7741 (define_insn "reload_base_64"
7742 [(set (match_operand 0 "register_operand" "=a")
7743 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7744 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7746 [(set_attr "op_type" "RIL")
7747 (set_attr "type" "larl")])
7750 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7753 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7756 ;; Insns related to generating the function prologue and epilogue.
7760 (define_expand "prologue"
7761 [(use (const_int 0))]
7763 "s390_emit_prologue (); DONE;")
7765 (define_insn "prologue_tpf"
7766 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_PROLOGUE)
7767 (clobber (reg:DI 1))]
7768 "TARGET_TPF_PROFILING"
7770 [(set_attr "type" "jsr")
7771 (set_attr "op_type" "RX")])
7773 (define_expand "epilogue"
7774 [(use (const_int 1))]
7776 "s390_emit_epilogue (false); DONE;")
7778 (define_insn "epilogue_tpf"
7779 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_EPILOGUE)
7780 (clobber (reg:DI 1))]
7781 "TARGET_TPF_PROFILING"
7783 [(set_attr "type" "jsr")
7784 (set_attr "op_type" "RX")])
7787 (define_expand "sibcall_epilogue"
7788 [(use (const_int 0))]
7790 "s390_emit_epilogue (true); DONE;")
7792 (define_insn "*return"
7794 (use (match_operand 0 "register_operand" "a"))]
7795 "GET_MODE (operands[0]) == Pmode"
7797 [(set_attr "op_type" "RR")
7798 (set_attr "type" "jsr")
7799 (set_attr "atype" "agen")])
7802 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7803 ;; pointer. This is used for compatibility.
7805 (define_expand "ptr_extend"
7806 [(set (match_operand:DI 0 "register_operand" "=r")
7807 (match_operand:SI 1 "register_operand" "r"))]
7810 emit_insn (gen_anddi3 (operands[0],
7811 gen_lowpart (DImode, operands[1]),
7812 GEN_INT (0x7fffffff)));
7816 ;; Instruction definition to expand eh_return macro to support
7817 ;; swapping in special linkage return addresses.
7819 (define_expand "eh_return"
7820 [(use (match_operand 0 "register_operand" ""))]
7823 s390_emit_tpf_eh_return (operands[0]);