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 ;; d -- Any register from 0 to 15.
29 ;; I -- An 8-bit constant (0..255).
30 ;; J -- A 12-bit constant (0..4095).
31 ;; K -- A 16-bit constant (-32768..32767).
32 ;; L -- Value appropriate as displacement.
33 ;; (0..4095) for short displacement
34 ;; (-524288..524287) for long displacement
35 ;; M -- Constant integer with a value of 0x7fffffff.
36 ;; N -- Multiple letter constraint followed by 4 parameter letters.
37 ;; 0..9: number of the part counting from most to least significant
38 ;; H,Q: mode of the part
39 ;; D,S,H: mode of the containing operand
40 ;; 0,F: value of the other parts (F - all bits set)
42 ;; The constraint matches if the specified part of a constant
43 ;; has a value different from its other parts.
44 ;; Q -- Memory reference without index register and with short displacement.
45 ;; R -- Memory reference with index register and short displacement.
46 ;; S -- Memory reference without index register but with long displacement.
47 ;; T -- Memory reference with index register and long displacement.
48 ;; U -- Pointer with short displacement.
49 ;; W -- Pointer with long displacement.
50 ;; Y -- Shift count operand.
52 ;; Special formats used for outputting 390 instructions.
54 ;; %C: print opcode suffix for branch condition.
55 ;; %D: print opcode suffix for inverse branch condition.
56 ;; %J: print tls_load/tls_gdcall/tls_ldcall suffix
57 ;; %O: print only the displacement of a memory reference.
58 ;; %R: print only the base register of a memory reference.
59 ;; %N: print the second word of a DImode operand.
60 ;; %M: print the second word of a TImode operand.
62 ;; %b: print integer X as if it's an unsigned byte.
63 ;; %x: print integer X as if it's an unsigned word.
64 ;; %h: print integer X as if it's a signed word.
65 ;; %i: print the first nonzero HImode part of X
66 ;; %j: print the first HImode part unequal to 0xffff of X
69 ;; We have a special constraint for pattern matching.
71 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
83 ; GOT/PLT and lt-relative accesses
84 (UNSPEC_LTREL_OFFSET 100)
85 (UNSPEC_LTREL_BASE 101)
93 (UNSPEC_RELOAD_BASE 210)
94 (UNSPEC_MAIN_BASE 211)
97 ; TLS relocation specifiers
102 (UNSPEC_GOTNTPOFF 504)
103 (UNSPEC_INDNTPOFF 505)
107 (UNSPEC_TLSLDM_NTPOFF 511)
108 (UNSPEC_TLS_LOAD 512)
115 ;; UNSPEC_VOLATILE usage
123 (UNSPECV_TPF_PROLOGUE 20)
124 (UNSPECV_TPF_EPILOGUE 21)
128 (UNSPECV_POOL_START 201)
129 (UNSPECV_POOL_END 202)
130 (UNSPECV_POOL_ENTRY 203)
131 (UNSPECV_MAIN_POOL 300)
138 ;; Processor type. This attribute must exactly match the processor_type
139 ;; enumeration in s390.h. The current machine description does not
140 ;; distinguish between g5 and g6, but there are differences between the two
141 ;; CPUs could in theory be modeled.
143 (define_attr "cpu" "g5,g6,z900,z990"
144 (const (symbol_ref "s390_tune")))
146 ;; Define an insn type attribute. This is used in function unit delay
149 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
150 cs,vs,store,imul,idiv,
151 branch,jsr,fsimpd,fsimps,
152 floadd,floads,fstored, fstores,
153 fmuld,fmuls,fdivd,fdivs,
154 ftoi,itof,fsqrtd,fsqrts,
156 (const_string "integer"))
158 ;; Operand type. Used to default length attribute values
160 (define_attr "op_type"
161 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
164 ;; Insn are devide in two classes:
165 ;; agen: Insn using agen
166 ;; reg: Insn not using agen
168 (define_attr "atype" "agen,reg"
169 (cond [ (eq_attr "op_type" "E") (const_string "reg")
170 (eq_attr "op_type" "RR") (const_string "reg")
171 (eq_attr "op_type" "RX") (const_string "agen")
172 (eq_attr "op_type" "RI") (const_string "reg")
173 (eq_attr "op_type" "RRE") (const_string "reg")
174 (eq_attr "op_type" "RS") (const_string "agen")
175 (eq_attr "op_type" "RSI") (const_string "agen")
176 (eq_attr "op_type" "S") (const_string "agen")
177 (eq_attr "op_type" "SI") (const_string "agen")
178 (eq_attr "op_type" "SS") (const_string "agen")
179 (eq_attr "op_type" "SSE") (const_string "agen")
180 (eq_attr "op_type" "RXE") (const_string "agen")
181 (eq_attr "op_type" "RSE") (const_string "agen")
182 (eq_attr "op_type" "RIL") (const_string "agen")
183 (eq_attr "op_type" "RXY") (const_string "agen")
184 (eq_attr "op_type" "RSY") (const_string "agen")
185 (eq_attr "op_type" "SIY") (const_string "agen")]
186 (const_string "reg")))
188 ;; Pipeline description for z900. For lack of anything better,
189 ;; this description is also used for the g5 and g6.
192 ;; Pipeline description for z990.
197 (define_attr "length" ""
198 (cond [ (eq_attr "op_type" "E") (const_int 2)
199 (eq_attr "op_type" "RR") (const_int 2)
200 (eq_attr "op_type" "RX") (const_int 4)
201 (eq_attr "op_type" "RI") (const_int 4)
202 (eq_attr "op_type" "RRE") (const_int 4)
203 (eq_attr "op_type" "RS") (const_int 4)
204 (eq_attr "op_type" "RSI") (const_int 4)
205 (eq_attr "op_type" "S") (const_int 4)
206 (eq_attr "op_type" "SI") (const_int 4)
207 (eq_attr "op_type" "SS") (const_int 6)
208 (eq_attr "op_type" "SSE") (const_int 6)
209 (eq_attr "op_type" "RXE") (const_int 6)
210 (eq_attr "op_type" "RSE") (const_int 6)
211 (eq_attr "op_type" "RIL") (const_int 6)
212 (eq_attr "op_type" "RXY") (const_int 6)
213 (eq_attr "op_type" "RSY") (const_int 6)
214 (eq_attr "op_type" "SIY") (const_int 6)]
217 ;; Define attributes for `asm' insns.
219 (define_asm_attributes [(set_attr "type" "other")
220 (set_attr "op_type" "NN")])
226 ; CCL: Zero Nonzero Zero Nonzero (AL, ALR, SL, SLR, N, NC, NI, NR, O, OC, OI, OR, X, XC, XI, XR)
227 ; CCA: Zero <Zero >Zero Overflow (A, AR, AH, AHI, S, SR, SH, SHI, LTR, LCR, LNR, LPR, SLA, SLDA, SLA, SRDA)
228 ; CCU: Equal ULess UGreater -- (CL, CLR, CLI, CLM)
229 ; CCS: Equal SLess SGreater -- (C, CR, CH, CHI, ICM)
230 ; CCT: Zero Mixed Mixed Ones (TM, TMH, TML)
233 ; CCZ1 -> CCA/CCU/CCS/CCT
236 ; String: CLC, CLCL, CLCLE, CLST, CUSE, MVCL, MVCLE, MVPG, MVST, SRST
237 ; Clobber: CKSM, CFC, CS, CDS, CUUTF, CUTFU, PLO, SPM, STCK, STCKE, TS, TRT, TRE, UPT
241 ;;- Compare instructions.
244 (define_expand "cmpdi"
246 (compare:CC (match_operand:DI 0 "register_operand" "")
247 (match_operand:DI 1 "general_operand" "")))]
250 s390_compare_op0 = operands[0];
251 s390_compare_op1 = operands[1];
255 (define_expand "cmpsi"
257 (compare:CC (match_operand:SI 0 "register_operand" "")
258 (match_operand:SI 1 "general_operand" "")))]
261 s390_compare_op0 = operands[0];
262 s390_compare_op1 = operands[1];
266 (define_expand "cmpdf"
268 (compare:CC (match_operand:DF 0 "register_operand" "")
269 (match_operand:DF 1 "general_operand" "")))]
272 s390_compare_op0 = operands[0];
273 s390_compare_op1 = operands[1];
277 (define_expand "cmpsf"
279 (compare:CC (match_operand:SF 0 "register_operand" "")
280 (match_operand:SF 1 "general_operand" "")))]
283 s390_compare_op0 = operands[0];
284 s390_compare_op1 = operands[1];
289 ; Test-under-Mask instructions
291 (define_insn "*tmqi_mem"
293 (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S")
294 (match_operand:QI 1 "immediate_operand" "n,n"))
295 (match_operand:QI 2 "immediate_operand" "n,n")))]
296 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))"
300 [(set_attr "op_type" "SI,SIY")])
302 (define_insn "*tmdi_reg"
304 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
305 (match_operand:DI 1 "immediate_operand"
306 "N0HD0,N1HD0,N2HD0,N3HD0"))
307 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
309 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
310 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
316 [(set_attr "op_type" "RI")])
318 (define_insn "*tmsi_reg"
320 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
321 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
322 (match_operand:SI 2 "immediate_operand" "n,n")))]
323 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
324 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
328 [(set_attr "op_type" "RI")])
330 (define_insn "*tmhi_full"
332 (compare (match_operand:HI 0 "register_operand" "d")
333 (match_operand:HI 1 "immediate_operand" "n")))]
334 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
336 [(set_attr "op_type" "RX")])
338 (define_insn "*tmqi_full"
340 (compare (match_operand:QI 0 "register_operand" "d")
341 (match_operand:QI 1 "immediate_operand" "n")))]
342 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
344 [(set_attr "op_type" "RI")])
347 ; Load-and-Test instructions
349 (define_insn "*tstdi_sign"
351 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
352 (const_int 32)) (const_int 32))
353 (match_operand:DI 1 "const0_operand" "")))
354 (set (match_operand:DI 2 "register_operand" "=d")
355 (sign_extend:DI (match_dup 0)))]
356 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
358 [(set_attr "op_type" "RRE")])
360 (define_insn "*tstdi"
362 (compare (match_operand:DI 0 "register_operand" "d")
363 (match_operand:DI 1 "const0_operand" "")))
364 (set (match_operand:DI 2 "register_operand" "=d")
366 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
368 [(set_attr "op_type" "RRE")])
370 (define_insn "*tstdi_cconly"
372 (compare (match_operand:DI 0 "register_operand" "d")
373 (match_operand:DI 1 "const0_operand" "")))]
374 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
376 [(set_attr "op_type" "RRE")])
378 (define_insn "*tstdi_cconly_31"
380 (compare (match_operand:DI 0 "register_operand" "d")
381 (match_operand:DI 1 "const0_operand" "")))]
382 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
384 [(set_attr "op_type" "RS")
385 (set_attr "atype" "reg")])
388 (define_insn "*tstsi"
390 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
391 (match_operand:SI 1 "const0_operand" "")))
392 (set (match_operand:SI 2 "register_operand" "=d,d,d")
394 "s390_match_ccmode(insn, CCSmode)"
399 [(set_attr "op_type" "RR,RS,RSY")])
401 (define_insn "*tstsi_cconly"
403 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
404 (match_operand:SI 1 "const0_operand" "")))
405 (clobber (match_scratch:SI 2 "=X,d,d"))]
406 "s390_match_ccmode(insn, CCSmode)"
411 [(set_attr "op_type" "RR,RS,RSY")])
413 (define_insn "*tstsi_cconly2"
415 (compare (match_operand:SI 0 "register_operand" "d")
416 (match_operand:SI 1 "const0_operand" "")))]
417 "s390_match_ccmode(insn, CCSmode)"
419 [(set_attr "op_type" "RR")])
421 (define_insn "*tsthiCCT"
423 (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d")
424 (match_operand:HI 1 "const0_operand" "")))
425 (set (match_operand:HI 2 "register_operand" "=d,d,0")
427 "s390_match_ccmode(insn, CCTmode)"
432 [(set_attr "op_type" "RS,RSY,RI")])
434 (define_insn "*tsthiCCT_cconly"
436 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
437 (match_operand:HI 1 "const0_operand" "")))
438 (clobber (match_scratch:HI 2 "=d,d,X"))]
439 "s390_match_ccmode(insn, CCTmode)"
444 [(set_attr "op_type" "RS,RSY,RI")])
446 (define_insn "*tsthi"
448 (compare (match_operand:HI 0 "s_operand" "Q,S")
449 (match_operand:HI 1 "const0_operand" "")))
450 (set (match_operand:HI 2 "register_operand" "=d,d")
452 "s390_match_ccmode(insn, CCSmode)"
456 [(set_attr "op_type" "RS,RSY")])
458 (define_insn "*tsthi_cconly"
460 (compare (match_operand:HI 0 "s_operand" "Q,S")
461 (match_operand:HI 1 "const0_operand" "")))
462 (clobber (match_scratch:HI 2 "=d,d"))]
463 "s390_match_ccmode(insn, CCSmode)"
467 [(set_attr "op_type" "RS,RSY")])
469 (define_insn "*tstqiCCT"
471 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
472 (match_operand:QI 1 "const0_operand" "")))
473 (set (match_operand:QI 2 "register_operand" "=d,d,0")
475 "s390_match_ccmode(insn, CCTmode)"
480 [(set_attr "op_type" "RS,RSY,RI")])
482 (define_insn "*tstqiCCT_cconly"
484 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
485 (match_operand:QI 1 "const0_operand" "")))]
486 "s390_match_ccmode(insn, CCTmode)"
491 [(set_attr "op_type" "SI,SIY,RI")])
493 (define_insn "*tstqi"
495 (compare (match_operand:QI 0 "s_operand" "Q,S")
496 (match_operand:QI 1 "const0_operand" "")))
497 (set (match_operand:QI 2 "register_operand" "=d,d")
499 "s390_match_ccmode(insn, CCSmode)"
503 [(set_attr "op_type" "RS,RSY")])
505 (define_insn "*tstqi_cconly"
507 (compare (match_operand:QI 0 "s_operand" "Q,S")
508 (match_operand:QI 1 "const0_operand" "")))
509 (clobber (match_scratch:QI 2 "=d,d"))]
510 "s390_match_ccmode(insn, CCSmode)"
514 [(set_attr "op_type" "RS,RSY")])
517 ; Compare (signed) instructions
519 (define_insn "*cmpdi_ccs_sign"
521 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
522 (match_operand:DI 0 "register_operand" "d,d")))]
523 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
527 [(set_attr "op_type" "RRE,RXY")])
529 (define_insn "*cmpdi_ccs"
531 (compare (match_operand:DI 0 "register_operand" "d,d,d")
532 (match_operand:DI 1 "general_operand" "d,K,m")))]
533 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
538 [(set_attr "op_type" "RRE,RI,RXY")])
540 (define_insn "*cmpsi_ccs_sign"
542 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
543 (match_operand:SI 0 "register_operand" "d,d")))]
544 "s390_match_ccmode(insn, CCSRmode)"
548 [(set_attr "op_type" "RX,RXY")])
550 (define_insn "*cmpsi_ccs"
552 (compare (match_operand:SI 0 "register_operand" "d,d,d,d")
553 (match_operand:SI 1 "general_operand" "d,K,R,T")))]
554 "s390_match_ccmode(insn, CCSmode)"
560 [(set_attr "op_type" "RR,RI,RX,RXY")])
563 ; Compare (unsigned) instructions
565 (define_insn "*cmpdi_ccu_zero"
567 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
568 (match_operand:DI 0 "register_operand" "d,d")))]
569 "s390_match_ccmode(insn, CCURmode) && TARGET_64BIT"
573 [(set_attr "op_type" "RRE,RXY")])
575 (define_insn "*cmpdi_ccu"
577 (compare (match_operand:DI 0 "register_operand" "d,d")
578 (match_operand:DI 1 "general_operand" "d,m")))]
579 "s390_match_ccmode(insn, CCUmode) && TARGET_64BIT"
583 [(set_attr "op_type" "RRE,RXY")])
585 (define_insn "*cmpsi_ccu"
587 (compare (match_operand:SI 0 "register_operand" "d,d,d")
588 (match_operand:SI 1 "general_operand" "d,R,T")))]
589 "s390_match_ccmode(insn, CCUmode)"
594 [(set_attr "op_type" "RR,RX,RXY")])
596 (define_insn "*cmphi_ccu"
598 (compare (match_operand:HI 0 "register_operand" "d,d")
599 (match_operand:HI 1 "s_imm_operand" "Q,S")))]
600 "s390_match_ccmode(insn, CCUmode)"
604 [(set_attr "op_type" "RS,RSY")])
606 (define_insn "*cmpqi_ccu"
608 (compare (match_operand:QI 0 "register_operand" "d,d")
609 (match_operand:QI 1 "s_imm_operand" "Q,S")))]
610 "s390_match_ccmode(insn, CCUmode)"
614 [(set_attr "op_type" "RS,RSY")])
618 (compare (match_operand:QI 0 "memory_operand" "Q,S")
619 (match_operand:QI 1 "immediate_operand" "n,n")))]
620 "s390_match_ccmode (insn, CCUmode)"
624 [(set_attr "op_type" "SI,SIY")])
626 (define_insn "*cmpdi_ccu_mem"
628 (compare (match_operand:DI 0 "s_operand" "Q")
629 (match_operand:DI 1 "s_imm_operand" "Q")))]
630 "s390_match_ccmode(insn, CCUmode)"
632 [(set_attr "op_type" "SS")])
634 (define_insn "*cmpsi_ccu_mem"
636 (compare (match_operand:SI 0 "s_operand" "Q")
637 (match_operand:SI 1 "s_imm_operand" "Q")))]
638 "s390_match_ccmode(insn, CCUmode)"
640 [(set_attr "op_type" "SS")])
642 (define_insn "*cmphi_ccu_mem"
644 (compare (match_operand:HI 0 "s_operand" "Q")
645 (match_operand:HI 1 "s_imm_operand" "Q")))]
646 "s390_match_ccmode(insn, CCUmode)"
648 [(set_attr "op_type" "SS")])
650 (define_insn "*cmpqi_ccu_mem"
652 (compare (match_operand:QI 0 "s_operand" "Q")
653 (match_operand:QI 1 "s_imm_operand" "Q")))]
654 "s390_match_ccmode(insn, CCUmode)"
656 [(set_attr "op_type" "SS")])
661 (define_insn "*cmpdf_ccs_0"
663 (compare (match_operand:DF 0 "register_operand" "f")
664 (match_operand:DF 1 "const0_operand" "")))]
665 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
667 [(set_attr "op_type" "RRE")
668 (set_attr "type" "fsimpd")])
670 (define_insn "*cmpdf_ccs_0_ibm"
672 (compare (match_operand:DF 0 "register_operand" "f")
673 (match_operand:DF 1 "const0_operand" "")))]
674 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
676 [(set_attr "op_type" "RR")
677 (set_attr "type" "fsimpd")])
679 (define_insn "*cmpdf_ccs"
681 (compare (match_operand:DF 0 "register_operand" "f,f")
682 (match_operand:DF 1 "general_operand" "f,R")))]
683 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
687 [(set_attr "op_type" "RRE,RXE")
688 (set_attr "type" "fsimpd")])
690 (define_insn "*cmpdf_ccs_ibm"
692 (compare (match_operand:DF 0 "register_operand" "f,f")
693 (match_operand:DF 1 "general_operand" "f,R")))]
694 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
698 [(set_attr "op_type" "RR,RX")
699 (set_attr "type" "fsimpd")])
704 (define_insn "*cmpsf_ccs_0"
706 (compare (match_operand:SF 0 "register_operand" "f")
707 (match_operand:SF 1 "const0_operand" "")))]
708 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
710 [(set_attr "op_type" "RRE")
711 (set_attr "type" "fsimps")])
713 (define_insn "*cmpsf_ccs_0_ibm"
715 (compare (match_operand:SF 0 "register_operand" "f")
716 (match_operand:SF 1 "const0_operand" "")))]
717 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
719 [(set_attr "op_type" "RR")
720 (set_attr "type" "fsimps")])
722 (define_insn "*cmpsf_ccs"
724 (compare (match_operand:SF 0 "register_operand" "f,f")
725 (match_operand:SF 1 "general_operand" "f,R")))]
726 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
730 [(set_attr "op_type" "RRE,RXE")
731 (set_attr "type" "fsimps")])
733 (define_insn "*cmpsf_ccs"
735 (compare (match_operand:SF 0 "register_operand" "f,f")
736 (match_operand:SF 1 "general_operand" "f,R")))]
737 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
741 [(set_attr "op_type" "RR,RX")
742 (set_attr "type" "fsimps")])
746 ;;- Move instructions.
750 ; movti instruction pattern(s).
754 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
755 (match_operand:TI 1 "general_operand" "QS,d,dKm,d,Q"))]
763 [(set_attr "op_type" "RSY,RSY,NN,NN,SS")
764 (set_attr "type" "lm,stm,*,*,cs")])
767 [(set (match_operand:TI 0 "nonimmediate_operand" "")
768 (match_operand:TI 1 "general_operand" ""))]
769 "TARGET_64BIT && reload_completed
770 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
771 [(set (match_dup 2) (match_dup 4))
772 (set (match_dup 3) (match_dup 5))]
774 operands[2] = operand_subword (operands[0], 0, 0, TImode);
775 operands[3] = operand_subword (operands[0], 1, 0, TImode);
776 operands[4] = operand_subword (operands[1], 0, 0, TImode);
777 operands[5] = operand_subword (operands[1], 1, 0, TImode);
781 [(set (match_operand:TI 0 "nonimmediate_operand" "")
782 (match_operand:TI 1 "general_operand" ""))]
783 "TARGET_64BIT && reload_completed
784 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
785 [(set (match_dup 2) (match_dup 4))
786 (set (match_dup 3) (match_dup 5))]
788 operands[2] = operand_subword (operands[0], 1, 0, TImode);
789 operands[3] = operand_subword (operands[0], 0, 0, TImode);
790 operands[4] = operand_subword (operands[1], 1, 0, TImode);
791 operands[5] = operand_subword (operands[1], 0, 0, TImode);
795 [(set (match_operand:TI 0 "register_operand" "")
796 (match_operand:TI 1 "memory_operand" ""))]
797 "TARGET_64BIT && reload_completed
798 && !s_operand (operands[1], VOIDmode)"
799 [(set (match_dup 0) (match_dup 1))]
801 rtx addr = operand_subword (operands[0], 1, 0, TImode);
802 s390_load_address (addr, XEXP (operands[1], 0));
803 operands[1] = replace_equiv_address (operands[1], addr);
806 (define_expand "reload_outti"
807 [(parallel [(match_operand:TI 0 "memory_operand" "")
808 (match_operand:TI 1 "register_operand" "d")
809 (match_operand:DI 2 "register_operand" "=&a")])]
812 s390_load_address (operands[2], XEXP (operands[0], 0));
813 operands[0] = replace_equiv_address (operands[0], operands[2]);
814 emit_move_insn (operands[0], operands[1]);
819 ; movdi instruction pattern(s).
822 (define_expand "movdi"
823 [(set (match_operand:DI 0 "general_operand" "")
824 (match_operand:DI 1 "general_operand" ""))]
827 /* Handle symbolic constants. */
828 if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
829 emit_symbolic_move (operands);
831 /* During and after reload, we need to force constants
832 to the literal pool ourselves, if necessary. */
833 if ((reload_in_progress || reload_completed)
834 && CONSTANT_P (operands[1])
835 && (!legitimate_reload_constant_p (operands[1])
836 || FP_REG_P (operands[0])))
837 operands[1] = force_const_mem (DImode, operands[1]);
840 (define_insn "*movdi_larl"
841 [(set (match_operand:DI 0 "register_operand" "=d")
842 (match_operand:DI 1 "larl_operand" "X"))]
844 && !FP_REG_P (operands[0])"
846 [(set_attr "op_type" "RIL")
847 (set_attr "type" "larl")])
849 (define_insn "*movdi_64"
850 [(set (match_operand:DI 0 "nonimmediate_operand"
851 "=d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,?Q")
852 (match_operand:DI 1 "general_operand"
853 "K,N0HD0,N1HD0,N2HD0,N3HD0,L,d,m,d,*f,R,T,*f,*f,?Q"))]
871 [(set_attr "op_type" "RI,RI,RI,RI,RI,RXY,RRE,RXY,RXY,RR,RX,RXY,RX,RXY,SS")
872 (set_attr "type" "*,*,*,*,*,la,lr,load,store,floadd,floadd,floadd,
873 fstored,fstored,cs")])
875 (define_insn "*movdi_31"
876 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,o,!*f,!*f,!*f,!R,!T,Q")
877 (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,R,T,*f,*f,Q"))]
890 [(set_attr "op_type" "RS,RS,NN,NN,RR,RX,RXY,RX,RXY,SS")
891 (set_attr "type" "lm,stm,*,*,floadd,floadd,floadd,fstored,fstored,cs")])
894 [(set (match_operand:DI 0 "nonimmediate_operand" "")
895 (match_operand:DI 1 "general_operand" ""))]
896 "!TARGET_64BIT && reload_completed
897 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
898 [(set (match_dup 2) (match_dup 4))
899 (set (match_dup 3) (match_dup 5))]
901 operands[2] = operand_subword (operands[0], 0, 0, DImode);
902 operands[3] = operand_subword (operands[0], 1, 0, DImode);
903 operands[4] = operand_subword (operands[1], 0, 0, DImode);
904 operands[5] = operand_subword (operands[1], 1, 0, DImode);
908 [(set (match_operand:DI 0 "nonimmediate_operand" "")
909 (match_operand:DI 1 "general_operand" ""))]
910 "!TARGET_64BIT && reload_completed
911 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
912 [(set (match_dup 2) (match_dup 4))
913 (set (match_dup 3) (match_dup 5))]
915 operands[2] = operand_subword (operands[0], 1, 0, DImode);
916 operands[3] = operand_subword (operands[0], 0, 0, DImode);
917 operands[4] = operand_subword (operands[1], 1, 0, DImode);
918 operands[5] = operand_subword (operands[1], 0, 0, DImode);
922 [(set (match_operand:DI 0 "register_operand" "")
923 (match_operand:DI 1 "memory_operand" ""))]
924 "!TARGET_64BIT && reload_completed
925 && !FP_REG_P (operands[0])
926 && !s_operand (operands[1], VOIDmode)"
927 [(set (match_dup 0) (match_dup 1))]
929 rtx addr = operand_subword (operands[0], 1, 0, DImode);
930 s390_load_address (addr, XEXP (operands[1], 0));
931 operands[1] = replace_equiv_address (operands[1], addr);
934 (define_expand "reload_outdi"
935 [(parallel [(match_operand:DI 0 "memory_operand" "")
936 (match_operand:DI 1 "register_operand" "d")
937 (match_operand:SI 2 "register_operand" "=&a")])]
940 s390_load_address (operands[2], XEXP (operands[0], 0));
941 operands[0] = replace_equiv_address (operands[0], operands[2]);
942 emit_move_insn (operands[0], operands[1]);
947 [(set (match_operand:DI 0 "register_operand" "")
948 (mem:DI (match_operand 1 "address_operand" "")))]
950 && !FP_REG_P (operands[0])
951 && GET_CODE (operands[1]) == SYMBOL_REF
952 && CONSTANT_POOL_ADDRESS_P (operands[1])
953 && get_pool_mode (operands[1]) == DImode
954 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
955 [(set (match_dup 0) (match_dup 2))]
956 "operands[2] = get_pool_constant (operands[1]);")
958 (define_insn "*la_64"
959 [(set (match_operand:DI 0 "register_operand" "=d,d")
960 (match_operand:QI 1 "address_operand" "U,W"))]
965 [(set_attr "op_type" "RX,RXY")
966 (set_attr "type" "la")])
970 [(set (match_operand:DI 0 "register_operand" "")
971 (match_operand:QI 1 "address_operand" ""))
972 (clobber (reg:CC 33))])]
974 && preferred_la_operand_p (operands[1], const0_rtx)"
975 [(set (match_dup 0) (match_dup 1))]
979 [(set (match_operand:DI 0 "register_operand" "")
980 (match_operand:DI 1 "register_operand" ""))
983 (plus:DI (match_dup 0)
984 (match_operand:DI 2 "nonmemory_operand" "")))
985 (clobber (reg:CC 33))])]
987 && !reg_overlap_mentioned_p (operands[0], operands[2])
988 && preferred_la_operand_p (operands[1], operands[2])"
989 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
992 (define_expand "reload_indi"
993 [(parallel [(match_operand:DI 0 "register_operand" "=a")
994 (match_operand:DI 1 "s390_plus_operand" "")
995 (match_operand:DI 2 "register_operand" "=&a")])]
998 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1003 ; movsi instruction pattern(s).
1006 (define_expand "movsi"
1007 [(set (match_operand:SI 0 "general_operand" "")
1008 (match_operand:SI 1 "general_operand" ""))]
1011 /* Handle symbolic constants. */
1012 if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1013 emit_symbolic_move (operands);
1015 /* expr.c tries to load an effective address using
1016 force_reg. This fails because we don't have a
1017 generic load_address pattern. Convert the move
1018 to a proper arithmetic operation instead, unless
1019 it is guaranteed to be OK. */
1020 if (GET_CODE (operands[1]) == PLUS
1021 && !legitimate_la_operand_p (operands[1]))
1023 operands[1] = force_operand (operands[1], operands[0]);
1024 if (operands[1] == operands[0])
1028 /* During and after reload, we need to force constants
1029 to the literal pool ourselves, if necessary. */
1030 if ((reload_in_progress || reload_completed)
1031 && CONSTANT_P (operands[1])
1032 && (!legitimate_reload_constant_p (operands[1])
1033 || FP_REG_P (operands[0])))
1034 operands[1] = force_const_mem (SImode, operands[1]);
1037 (define_insn "*movsi_larl"
1038 [(set (match_operand:SI 0 "register_operand" "=d")
1039 (match_operand:SI 1 "larl_operand" "X"))]
1040 "!TARGET_64BIT && TARGET_CPU_ZARCH
1041 && !FP_REG_P (operands[0])"
1043 [(set_attr "op_type" "RIL")
1044 (set_attr "type" "larl")])
1046 (define_insn "*movsi_zarch"
1047 [(set (match_operand:SI 0 "nonimmediate_operand"
1048 "=d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,?Q")
1049 (match_operand:SI 1 "general_operand"
1050 "K,N0HS0,N1HS0,L,d,R,T,d,d,*f,R,T,*f,*f,?Q"))]
1068 [(set_attr "op_type" "RI,RI,RI,RXY,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1069 (set_attr "type" "*,*,*,la,lr,load,load,store,store,floads,floads,floads,fstores,fstores,cs")])
1071 (define_insn "*movsi_esa"
1072 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,?Q")
1073 (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,?Q"))]
1084 [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,SS")
1085 (set_attr "type" "*,lr,load,store,floads,floads,fstores,cs")])
1088 [(set (match_operand:SI 0 "register_operand" "")
1089 (mem:SI (match_operand 1 "address_operand" "")))]
1090 "!FP_REG_P (operands[0])
1091 && GET_CODE (operands[1]) == SYMBOL_REF
1092 && CONSTANT_POOL_ADDRESS_P (operands[1])
1093 && get_pool_mode (operands[1]) == SImode
1094 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1095 [(set (match_dup 0) (match_dup 2))]
1096 "operands[2] = get_pool_constant (operands[1]);")
1098 (define_insn "*la_31"
1099 [(set (match_operand:SI 0 "register_operand" "=d,d")
1100 (match_operand:QI 1 "address_operand" "U,W"))]
1101 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1105 [(set_attr "op_type" "RX,RXY")
1106 (set_attr "type" "la")])
1110 [(set (match_operand:SI 0 "register_operand" "")
1111 (match_operand:QI 1 "address_operand" ""))
1112 (clobber (reg:CC 33))])]
1114 && preferred_la_operand_p (operands[1], const0_rtx)"
1115 [(set (match_dup 0) (match_dup 1))]
1119 [(set (match_operand:SI 0 "register_operand" "")
1120 (match_operand:SI 1 "register_operand" ""))
1123 (plus:SI (match_dup 0)
1124 (match_operand:SI 2 "nonmemory_operand" "")))
1125 (clobber (reg:CC 33))])]
1127 && !reg_overlap_mentioned_p (operands[0], operands[2])
1128 && preferred_la_operand_p (operands[1], operands[2])"
1129 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1132 (define_insn "*la_31_and"
1133 [(set (match_operand:SI 0 "register_operand" "=d,d")
1134 (and:SI (match_operand:QI 1 "address_operand" "U,W")
1135 (const_int 2147483647)))]
1140 [(set_attr "op_type" "RX,RXY")
1141 (set_attr "type" "la")])
1143 (define_insn_and_split "*la_31_and_cc"
1144 [(set (match_operand:SI 0 "register_operand" "=d")
1145 (and:SI (match_operand:QI 1 "address_operand" "p")
1146 (const_int 2147483647)))
1147 (clobber (reg:CC 33))]
1150 "&& reload_completed"
1152 (and:SI (match_dup 1) (const_int 2147483647)))]
1154 [(set_attr "op_type" "RX")
1155 (set_attr "type" "la")])
1157 (define_insn "force_la_31"
1158 [(set (match_operand:SI 0 "register_operand" "=d,d")
1159 (match_operand:QI 1 "address_operand" "U,W"))
1160 (use (const_int 0))]
1165 [(set_attr "op_type" "RX")
1166 (set_attr "type" "la")])
1168 (define_expand "reload_insi"
1169 [(parallel [(match_operand:SI 0 "register_operand" "=a")
1170 (match_operand:SI 1 "s390_plus_operand" "")
1171 (match_operand:SI 2 "register_operand" "=&a")])]
1174 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1179 ; movhi instruction pattern(s).
1182 (define_expand "movhi"
1183 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1184 (match_operand:HI 1 "general_operand" ""))]
1187 /* Make it explicit that loading a register from memory
1188 always sign-extends (at least) to SImode. */
1189 if (optimize && !no_new_pseudos
1190 && register_operand (operands[0], VOIDmode)
1191 && GET_CODE (operands[1]) == MEM)
1193 rtx tmp = gen_reg_rtx (SImode);
1194 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1195 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1196 operands[1] = gen_lowpart (HImode, tmp);
1200 (define_insn "*movhi"
1201 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1202 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1212 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1213 (set_attr "type" "lr,*,*,*,store,store,cs")])
1216 [(set (match_operand:HI 0 "register_operand" "")
1217 (mem:HI (match_operand 1 "address_operand" "")))]
1218 "GET_CODE (operands[1]) == SYMBOL_REF
1219 && CONSTANT_POOL_ADDRESS_P (operands[1])
1220 && get_pool_mode (operands[1]) == HImode
1221 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1222 [(set (match_dup 0) (match_dup 2))]
1223 "operands[2] = get_pool_constant (operands[1]);")
1226 ; movqi instruction pattern(s).
1229 (define_expand "movqi"
1230 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1231 (match_operand:QI 1 "general_operand" ""))]
1234 /* On z/Architecture, zero-extending from memory to register
1235 is just as fast as a QImode load. */
1236 if (TARGET_ZARCH && optimize && !no_new_pseudos
1237 && register_operand (operands[0], VOIDmode)
1238 && GET_CODE (operands[1]) == MEM)
1240 rtx tmp = gen_reg_rtx (word_mode);
1241 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1242 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1243 operands[1] = gen_lowpart (QImode, tmp);
1247 (define_insn "*movqi"
1248 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1249 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1261 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1262 (set_attr "type" "lr,*,*,*,store,store,store,store,cs")])
1265 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1266 (mem:QI (match_operand 1 "address_operand" "")))]
1267 "GET_CODE (operands[1]) == SYMBOL_REF
1268 && CONSTANT_POOL_ADDRESS_P (operands[1])
1269 && get_pool_mode (operands[1]) == QImode
1270 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1271 [(set (match_dup 0) (match_dup 2))]
1272 "operands[2] = get_pool_constant (operands[1]);")
1275 ; movstrictqi instruction pattern(s).
1278 (define_insn "*movstrictqi"
1279 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1280 (match_operand:QI 1 "memory_operand" "R,T"))]
1285 [(set_attr "op_type" "RX,RXY")])
1288 ; movstricthi instruction pattern(s).
1291 (define_insn "*movstricthi"
1292 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1293 (match_operand:HI 1 "s_imm_operand" "Q,S"))
1294 (clobber (reg:CC 33))]
1299 [(set_attr "op_type" "RS,RSY")])
1302 ; movstrictsi instruction pattern(s).
1305 (define_insn "movstrictsi"
1306 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d"))
1307 (match_operand:SI 1 "general_operand" "d,R,T"))]
1313 [(set_attr "op_type" "RR,RX,RXY")
1314 (set_attr "type" "lr,load,load")])
1317 ; movdf instruction pattern(s).
1320 (define_expand "movdf"
1321 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1322 (match_operand:DF 1 "general_operand" ""))]
1325 /* During and after reload, we need to force constants
1326 to the literal pool ourselves, if necessary. */
1327 if ((reload_in_progress || reload_completed)
1328 && CONSTANT_P (operands[1]))
1329 operands[1] = force_const_mem (DFmode, operands[1]);
1332 (define_insn "*movdf_64"
1333 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1334 (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1346 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1347 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,cs")])
1349 (define_insn "*movdf_31"
1350 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1351 (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1364 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,NN,NN,SS")
1365 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,cs")])
1368 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1369 (match_operand:DF 1 "general_operand" ""))]
1370 "!TARGET_64BIT && reload_completed
1371 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1372 [(set (match_dup 2) (match_dup 4))
1373 (set (match_dup 3) (match_dup 5))]
1375 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1376 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1377 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1378 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1382 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1383 (match_operand:DF 1 "general_operand" ""))]
1384 "!TARGET_64BIT && reload_completed
1385 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1386 [(set (match_dup 2) (match_dup 4))
1387 (set (match_dup 3) (match_dup 5))]
1389 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1390 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1391 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1392 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1396 [(set (match_operand:DF 0 "register_operand" "")
1397 (match_operand:DF 1 "memory_operand" ""))]
1398 "!TARGET_64BIT && reload_completed
1399 && !FP_REG_P (operands[0])
1400 && !s_operand (operands[1], VOIDmode)"
1401 [(set (match_dup 0) (match_dup 1))]
1403 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1404 s390_load_address (addr, XEXP (operands[1], 0));
1405 operands[1] = replace_equiv_address (operands[1], addr);
1408 (define_expand "reload_outdf"
1409 [(parallel [(match_operand:DF 0 "memory_operand" "")
1410 (match_operand:DF 1 "register_operand" "d")
1411 (match_operand:SI 2 "register_operand" "=&a")])]
1414 s390_load_address (operands[2], XEXP (operands[0], 0));
1415 operands[0] = replace_equiv_address (operands[0], operands[2]);
1416 emit_move_insn (operands[0], operands[1]);
1421 ; movsf instruction pattern(s).
1424 (define_expand "movsf"
1425 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1426 (match_operand:SF 1 "general_operand" ""))]
1429 /* During and after reload, we need to force constants
1430 to the literal pool ourselves, if necessary. */
1431 if ((reload_in_progress || reload_completed)
1432 && CONSTANT_P (operands[1]))
1433 operands[1] = force_const_mem (SFmode, operands[1]);
1436 (define_insn "*movsf"
1437 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1438 (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1452 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1453 (set_attr "type" "floads,floads,floads,fstores,fstores,lr,load,load,store,store,cs")])
1456 ; load_multiple pattern(s).
1458 ; ??? Due to reload problems with replacing registers inside match_parallel
1459 ; we currently support load_multiple/store_multiple only after reload.
1462 (define_expand "load_multiple"
1463 [(match_par_dup 3 [(set (match_operand 0 "" "")
1464 (match_operand 1 "" ""))
1465 (use (match_operand 2 "" ""))])]
1468 enum machine_mode mode;
1474 /* Support only loading a constant number of fixed-point registers from
1475 memory and only bother with this if more than two */
1476 if (GET_CODE (operands[2]) != CONST_INT
1477 || INTVAL (operands[2]) < 2
1478 || INTVAL (operands[2]) > 16
1479 || GET_CODE (operands[1]) != MEM
1480 || GET_CODE (operands[0]) != REG
1481 || REGNO (operands[0]) >= 16)
1484 count = INTVAL (operands[2]);
1485 regno = REGNO (operands[0]);
1486 mode = GET_MODE (operands[0]);
1487 if (mode != SImode && mode != word_mode)
1490 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1493 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1495 from = XEXP (operands[1], 0);
1498 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1499 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1500 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1502 from = XEXP (XEXP (operands[1], 0), 0);
1503 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1510 from = force_reg (Pmode, XEXP (operands[1], 0));
1514 for (i = 0; i < count; i++)
1515 XVECEXP (operands[3], 0, i)
1516 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1517 change_address (operands[1], mode,
1518 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1521 (define_insn "*load_multiple_di"
1522 [(match_parallel 0 "load_multiple_operation"
1523 [(set (match_operand:DI 1 "register_operand" "=r")
1524 (match_operand:DI 2 "s_operand" "QS"))])]
1525 "reload_completed && word_mode == DImode"
1527 int words = XVECLEN (operands[0], 0);
1528 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1529 return "lmg\t%1,%0,%2";
1531 [(set_attr "op_type" "RSY")
1532 (set_attr "type" "lm")])
1534 (define_insn "*load_multiple_si"
1535 [(match_parallel 0 "load_multiple_operation"
1536 [(set (match_operand:SI 1 "register_operand" "=r,r")
1537 (match_operand:SI 2 "s_operand" "Q,S"))])]
1540 int words = XVECLEN (operands[0], 0);
1541 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1542 return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1544 [(set_attr "op_type" "RS,RSY")
1545 (set_attr "type" "lm")])
1548 ; store multiple pattern(s).
1551 (define_expand "store_multiple"
1552 [(match_par_dup 3 [(set (match_operand 0 "" "")
1553 (match_operand 1 "" ""))
1554 (use (match_operand 2 "" ""))])]
1557 enum machine_mode mode;
1563 /* Support only storing a constant number of fixed-point registers to
1564 memory and only bother with this if more than two. */
1565 if (GET_CODE (operands[2]) != CONST_INT
1566 || INTVAL (operands[2]) < 2
1567 || INTVAL (operands[2]) > 16
1568 || GET_CODE (operands[0]) != MEM
1569 || GET_CODE (operands[1]) != REG
1570 || REGNO (operands[1]) >= 16)
1573 count = INTVAL (operands[2]);
1574 regno = REGNO (operands[1]);
1575 mode = GET_MODE (operands[1]);
1576 if (mode != SImode && mode != word_mode)
1579 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1583 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1585 to = XEXP (operands[0], 0);
1588 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1589 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1590 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1592 to = XEXP (XEXP (operands[0], 0), 0);
1593 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1600 to = force_reg (Pmode, XEXP (operands[0], 0));
1604 for (i = 0; i < count; i++)
1605 XVECEXP (operands[3], 0, i)
1606 = gen_rtx_SET (VOIDmode,
1607 change_address (operands[0], mode,
1608 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1609 gen_rtx_REG (mode, regno + i));
1612 (define_insn "*store_multiple_di"
1613 [(match_parallel 0 "store_multiple_operation"
1614 [(set (match_operand:DI 1 "s_operand" "=QS")
1615 (match_operand:DI 2 "register_operand" "r"))])]
1616 "reload_completed && word_mode == DImode"
1618 int words = XVECLEN (operands[0], 0);
1619 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1620 return "stmg\t%2,%0,%1";
1622 [(set_attr "op_type" "RSY")
1623 (set_attr "type" "stm")])
1626 (define_insn "*store_multiple_si"
1627 [(match_parallel 0 "store_multiple_operation"
1628 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1629 (match_operand:SI 2 "register_operand" "r,r"))])]
1632 int words = XVECLEN (operands[0], 0);
1633 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1634 return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1636 [(set_attr "op_type" "RS,RSY")
1637 (set_attr "type" "stm")])
1640 ;; String instructions.
1644 ; strlenM instruction pattern(s).
1647 (define_expand "strlendi"
1648 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1651 (unspec:DI [(const_int 0)
1652 (match_operand:BLK 1 "memory_operand" "")
1654 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1655 (clobber (scratch:DI))
1656 (clobber (reg:CC 33))])
1658 [(set (match_operand:DI 0 "register_operand" "")
1659 (minus:DI (match_dup 4) (match_dup 5)))
1660 (clobber (reg:CC 33))])]
1663 operands[4] = gen_reg_rtx (DImode);
1664 operands[5] = gen_reg_rtx (DImode);
1665 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1666 operands[1] = replace_equiv_address (operands[1], operands[5]);
1669 (define_insn "*strlendi"
1670 [(set (match_operand:DI 0 "register_operand" "=a")
1671 (unspec:DI [(match_operand:DI 2 "general_operand" "0")
1672 (mem:BLK (match_operand:DI 3 "register_operand" "1"))
1674 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1675 (clobber (match_scratch:DI 1 "=a"))
1676 (clobber (reg:CC 33))]
1678 "srst\t%0,%1\;jo\t.-4"
1679 [(set_attr "op_type" "NN")
1680 (set_attr "type" "vs")
1681 (set_attr "length" "8")])
1683 (define_expand "strlensi"
1684 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1687 (unspec:SI [(const_int 0)
1688 (match_operand:BLK 1 "memory_operand" "")
1690 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1691 (clobber (scratch:SI))
1692 (clobber (reg:CC 33))])
1694 [(set (match_operand:SI 0 "register_operand" "")
1695 (minus:SI (match_dup 4) (match_dup 5)))
1696 (clobber (reg:CC 33))])]
1699 operands[4] = gen_reg_rtx (SImode);
1700 operands[5] = gen_reg_rtx (SImode);
1701 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1702 operands[1] = replace_equiv_address (operands[1], operands[5]);
1705 (define_insn "*strlensi"
1706 [(set (match_operand:SI 0 "register_operand" "=a")
1707 (unspec:SI [(match_operand:SI 2 "general_operand" "0")
1708 (mem:BLK (match_operand:SI 3 "register_operand" "1"))
1710 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1711 (clobber (match_scratch:SI 1 "=a"))
1712 (clobber (reg:CC 33))]
1714 "srst\t%0,%1\;jo\t.-4"
1715 [(set_attr "op_type" "NN")
1716 (set_attr "type" "vs")
1717 (set_attr "length" "8")])
1720 ; movmemM instruction pattern(s).
1723 (define_expand "movmemdi"
1724 [(set (match_operand:BLK 0 "memory_operand" "")
1725 (match_operand:BLK 1 "memory_operand" ""))
1726 (use (match_operand:DI 2 "general_operand" ""))
1727 (match_operand 3 "" "")]
1729 "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
1731 (define_expand "movmemsi"
1732 [(set (match_operand:BLK 0 "memory_operand" "")
1733 (match_operand:BLK 1 "memory_operand" ""))
1734 (use (match_operand:SI 2 "general_operand" ""))
1735 (match_operand 3 "" "")]
1737 "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
1739 ; Move a block that is up to 256 bytes in length.
1740 ; The block length is taken as (operands[2] % 256) + 1.
1742 (define_expand "movmem_short"
1744 [(set (match_operand:BLK 0 "memory_operand" "")
1745 (match_operand:BLK 1 "memory_operand" ""))
1746 (use (match_operand 2 "nonmemory_operand" ""))
1747 (clobber (match_dup 3))])]
1749 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1751 (define_insn "*movmem_short"
1752 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1753 (match_operand:BLK 1 "memory_operand" "Q,Q"))
1754 (use (match_operand 2 "nonmemory_operand" "n,a"))
1755 (clobber (match_scratch 3 "=X,&a"))]
1756 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
1757 && GET_MODE (operands[3]) == Pmode"
1759 switch (which_alternative)
1762 return "mvc\t%O0(%b2+1,%R0),%1";
1765 output_asm_insn ("bras\t%3,.+10", operands);
1766 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
1767 return "ex\t%2,0(%3)";
1773 [(set_attr "op_type" "SS,NN")
1774 (set_attr "type" "cs,cs")
1775 (set_attr "atype" "*,agen")
1776 (set_attr "length" "*,14")])
1778 ; Move a block of arbitrary length.
1780 (define_expand "movmem_long"
1782 [(clobber (match_dup 2))
1783 (clobber (match_dup 3))
1784 (set (match_operand:BLK 0 "memory_operand" "")
1785 (match_operand:BLK 1 "memory_operand" ""))
1786 (use (match_operand 2 "general_operand" ""))
1788 (clobber (reg:CC 33))])]
1791 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1792 rtx reg0 = gen_reg_rtx (dword_mode);
1793 rtx reg1 = gen_reg_rtx (dword_mode);
1794 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1795 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
1796 rtx len0 = gen_lowpart (Pmode, reg0);
1797 rtx len1 = gen_lowpart (Pmode, reg1);
1799 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1800 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1801 emit_move_insn (len0, operands[2]);
1803 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
1804 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1805 emit_move_insn (len1, operands[2]);
1807 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1808 operands[1] = replace_equiv_address_nv (operands[1], addr1);
1813 (define_insn "*movmem_long_64"
1814 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1815 (clobber (match_operand:TI 1 "register_operand" "=d"))
1816 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1817 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
1820 (clobber (reg:CC 33))]
1822 "mvcle\t%0,%1,0\;jo\t.-4"
1823 [(set_attr "op_type" "NN")
1824 (set_attr "type" "vs")
1825 (set_attr "length" "8")])
1827 (define_insn "*movmem_long_31"
1828 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1829 (clobber (match_operand:DI 1 "register_operand" "=d"))
1830 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1831 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
1834 (clobber (reg:CC 33))]
1836 "mvcle\t%0,%1,0\;jo\t.-4"
1837 [(set_attr "op_type" "NN")
1838 (set_attr "type" "vs")
1839 (set_attr "length" "8")])
1842 ; clrmemM instruction pattern(s).
1845 (define_expand "clrmemdi"
1846 [(set (match_operand:BLK 0 "memory_operand" "")
1848 (use (match_operand:DI 1 "general_operand" ""))
1849 (match_operand 2 "" "")]
1851 "s390_expand_clrmem (operands[0], operands[1]); DONE;")
1853 (define_expand "clrmemsi"
1854 [(set (match_operand:BLK 0 "memory_operand" "")
1856 (use (match_operand:SI 1 "general_operand" ""))
1857 (match_operand 2 "" "")]
1859 "s390_expand_clrmem (operands[0], operands[1]); DONE;")
1861 ; Clear a block that is up to 256 bytes in length.
1862 ; The block length is taken as (operands[1] % 256) + 1.
1864 (define_expand "clrmem_short"
1866 [(set (match_operand:BLK 0 "memory_operand" "")
1868 (use (match_operand 1 "nonmemory_operand" ""))
1869 (clobber (match_dup 2))
1870 (clobber (reg:CC 33))])]
1872 "operands[2] = gen_rtx_SCRATCH (Pmode);")
1874 (define_insn "*clrmem_short"
1875 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1877 (use (match_operand 1 "nonmemory_operand" "n,a"))
1878 (clobber (match_scratch 2 "=X,&a"))
1879 (clobber (reg:CC 33))]
1880 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
1881 && GET_MODE (operands[2]) == Pmode"
1883 switch (which_alternative)
1886 return "xc\t%O0(%b1+1,%R0),%0";
1889 output_asm_insn ("bras\t%2,.+10", operands);
1890 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
1891 return "ex\t%1,0(%2)";
1897 [(set_attr "op_type" "SS,NN")
1898 (set_attr "type" "cs,cs")
1899 (set_attr "atype" "*,agen")
1900 (set_attr "length" "*,14")])
1902 ; Clear a block of arbitrary length.
1904 (define_expand "clrmem_long"
1906 [(clobber (match_dup 1))
1907 (set (match_operand:BLK 0 "memory_operand" "")
1909 (use (match_operand 1 "general_operand" ""))
1911 (clobber (reg:CC 33))])]
1914 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1915 rtx reg0 = gen_reg_rtx (dword_mode);
1916 rtx reg1 = gen_reg_rtx (dword_mode);
1917 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1918 rtx len0 = gen_lowpart (Pmode, reg0);
1920 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1921 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1922 emit_move_insn (len0, operands[1]);
1924 emit_move_insn (reg1, const0_rtx);
1926 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1931 (define_insn "*clrmem_long_64"
1932 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1933 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1936 (use (match_operand:TI 1 "register_operand" "d"))
1937 (clobber (reg:CC 33))]
1939 "mvcle\t%0,%1,0\;jo\t.-4"
1940 [(set_attr "op_type" "NN")
1941 (set_attr "type" "vs")
1942 (set_attr "length" "8")])
1944 (define_insn "*clrmem_long_31"
1945 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1946 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1949 (use (match_operand:DI 1 "register_operand" "d"))
1950 (clobber (reg:CC 33))]
1952 "mvcle\t%0,%1,0\;jo\t.-4"
1953 [(set_attr "op_type" "NN")
1954 (set_attr "type" "vs")
1955 (set_attr "length" "8")])
1958 ; cmpmemM instruction pattern(s).
1961 (define_expand "cmpmemdi"
1962 [(set (match_operand:DI 0 "register_operand" "")
1963 (compare:DI (match_operand:BLK 1 "memory_operand" "")
1964 (match_operand:BLK 2 "memory_operand" "") ) )
1965 (use (match_operand:DI 3 "general_operand" ""))
1966 (use (match_operand:DI 4 "" ""))]
1968 "s390_expand_cmpmem (operands[0], operands[1],
1969 operands[2], operands[3]); DONE;")
1971 (define_expand "cmpmemsi"
1972 [(set (match_operand:SI 0 "register_operand" "")
1973 (compare:SI (match_operand:BLK 1 "memory_operand" "")
1974 (match_operand:BLK 2 "memory_operand" "") ) )
1975 (use (match_operand:SI 3 "general_operand" ""))
1976 (use (match_operand:SI 4 "" ""))]
1978 "s390_expand_cmpmem (operands[0], operands[1],
1979 operands[2], operands[3]); DONE;")
1981 ; Compare a block that is up to 256 bytes in length.
1982 ; The block length is taken as (operands[2] % 256) + 1.
1984 (define_expand "cmpmem_short"
1987 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
1988 (match_operand:BLK 1 "memory_operand" "")))
1989 (use (match_operand 2 "nonmemory_operand" ""))
1990 (clobber (match_dup 3))])]
1992 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1994 (define_insn "*cmpmem_short"
1996 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
1997 (match_operand:BLK 1 "memory_operand" "Q,Q")))
1998 (use (match_operand 2 "nonmemory_operand" "n,a"))
1999 (clobber (match_scratch 3 "=X,&a"))]
2000 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2001 && GET_MODE (operands[3]) == Pmode"
2003 switch (which_alternative)
2006 return "clc\t%O0(%b2+1,%R0),%1";
2009 output_asm_insn ("bras\t%3,.+10", operands);
2010 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2011 return "ex\t%2,0(%3)";
2017 [(set_attr "op_type" "SS,NN")
2018 (set_attr "type" "cs,cs")
2019 (set_attr "atype" "*,agen")
2020 (set_attr "length" "*,14")])
2022 ; Compare a block of arbitrary length.
2024 (define_expand "cmpmem_long"
2026 [(clobber (match_dup 2))
2027 (clobber (match_dup 3))
2029 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2030 (match_operand:BLK 1 "memory_operand" "")))
2031 (use (match_operand 2 "general_operand" ""))
2032 (use (match_dup 3))])]
2035 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2036 rtx reg0 = gen_reg_rtx (dword_mode);
2037 rtx reg1 = gen_reg_rtx (dword_mode);
2038 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2039 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2040 rtx len0 = gen_lowpart (Pmode, reg0);
2041 rtx len1 = gen_lowpart (Pmode, reg1);
2043 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2044 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2045 emit_move_insn (len0, operands[2]);
2047 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2048 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2049 emit_move_insn (len1, operands[2]);
2051 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2052 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2057 (define_insn "*cmpmem_long_64"
2058 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2059 (clobber (match_operand:TI 1 "register_operand" "=d"))
2061 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2062 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2064 (use (match_dup 3))]
2066 "clcle\t%0,%1,0\;jo\t.-4"
2067 [(set_attr "op_type" "NN")
2068 (set_attr "type" "vs")
2069 (set_attr "length" "8")])
2071 (define_insn "*cmpmem_long_31"
2072 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2073 (clobber (match_operand:DI 1 "register_operand" "=d"))
2075 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2076 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2078 (use (match_dup 3))]
2080 "clcle\t%0,%1,0\;jo\t.-4"
2081 [(set_attr "op_type" "NN")
2082 (set_attr "type" "vs")
2083 (set_attr "length" "8")])
2085 ; Convert condition code to integer in range (-1, 0, 1)
2087 (define_insn "cmpint_si"
2088 [(set (match_operand:SI 0 "register_operand" "=d")
2089 (compare:SI (reg:CCS 33) (const_int 0)))]
2092 output_asm_insn ("lhi\t%0,1", operands);
2093 output_asm_insn ("jh\t.+12", operands);
2094 output_asm_insn ("jl\t.+6", operands);
2095 output_asm_insn ("sr\t%0,%0", operands);
2096 return "lcr\t%0,%0";
2098 [(set_attr "op_type" "NN")
2099 (set_attr "length" "16")
2100 (set_attr "type" "other")])
2102 (define_insn "cmpint_di"
2103 [(set (match_operand:DI 0 "register_operand" "=d")
2104 (compare:DI (reg:CCS 33) (const_int 0)))]
2107 output_asm_insn ("lghi\t%0,1", operands);
2108 output_asm_insn ("jh\t.+16", operands);
2109 output_asm_insn ("jl\t.+8", operands);
2110 output_asm_insn ("sgr\t%0,%0", operands);
2111 return "lcgr\t%0,%0";
2113 [(set_attr "op_type" "NN")
2114 (set_attr "length" "20")
2115 (set_attr "type" "other")])
2119 ;;- Conversion instructions.
2122 (define_insn "*sethighqisi"
2123 [(set (match_operand:SI 0 "register_operand" "=d,d")
2124 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2125 (clobber (reg:CC 33))]
2130 [(set_attr "op_type" "RS,RSY")])
2132 (define_insn "*sethighhisi"
2133 [(set (match_operand:SI 0 "register_operand" "=d,d")
2134 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2135 (clobber (reg:CC 33))]
2140 [(set_attr "op_type" "RS,RSY")])
2142 (define_insn "*sethighqidi_64"
2143 [(set (match_operand:DI 0 "register_operand" "=d")
2144 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2145 (clobber (reg:CC 33))]
2148 [(set_attr "op_type" "RSY")])
2150 (define_insn "*sethighqidi_31"
2151 [(set (match_operand:DI 0 "register_operand" "=d,d")
2152 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2153 (clobber (reg:CC 33))]
2158 [(set_attr "op_type" "RS,RSY")])
2160 (define_insn_and_split "*extractqi"
2161 [(set (match_operand:SI 0 "register_operand" "=d")
2162 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2163 (match_operand 2 "const_int_operand" "n")
2165 (clobber (reg:CC 33))]
2167 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2169 "&& reload_completed"
2171 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2172 (clobber (reg:CC 33))])
2173 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2175 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2176 operands[1] = change_address (operands[1], QImode, 0);
2178 [(set_attr "atype" "agen")])
2180 (define_insn_and_split "*extracthi"
2181 [(set (match_operand:SI 0 "register_operand" "=d")
2182 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2183 (match_operand 2 "const_int_operand" "n")
2185 (clobber (reg:CC 33))]
2187 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2189 "&& reload_completed"
2191 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2192 (clobber (reg:CC 33))])
2193 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2195 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2196 operands[1] = change_address (operands[1], HImode, 0);
2198 [(set_attr "atype" "agen")])
2201 ; extendsidi2 instruction pattern(s).
2204 (define_expand "extendsidi2"
2205 [(set (match_operand:DI 0 "register_operand" "")
2206 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2212 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2213 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2214 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2215 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2221 (define_insn "*extendsidi2"
2222 [(set (match_operand:DI 0 "register_operand" "=d,d")
2223 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2228 [(set_attr "op_type" "RRE,RXY")])
2231 ; extendhidi2 instruction pattern(s).
2234 (define_expand "extendhidi2"
2235 [(set (match_operand:DI 0 "register_operand" "")
2236 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2242 rtx tmp = gen_reg_rtx (SImode);
2243 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2244 emit_insn (gen_extendsidi2 (operands[0], tmp));
2249 operands[1] = gen_lowpart (DImode, operands[1]);
2250 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2251 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2257 (define_insn "*extendhidi2"
2258 [(set (match_operand:DI 0 "register_operand" "=d")
2259 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2262 [(set_attr "op_type" "RXY")])
2265 ; extendqidi2 instruction pattern(s).
2268 (define_expand "extendqidi2"
2269 [(set (match_operand:DI 0 "register_operand" "")
2270 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2276 rtx tmp = gen_reg_rtx (SImode);
2277 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2278 emit_insn (gen_extendsidi2 (operands[0], tmp));
2283 operands[1] = gen_lowpart (DImode, operands[1]);
2284 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2285 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2291 (define_insn "*extendqidi2"
2292 [(set (match_operand:DI 0 "register_operand" "=d")
2293 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2294 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2296 [(set_attr "op_type" "RXY")])
2298 (define_insn_and_split "*extendqidi2_short_displ"
2299 [(set (match_operand:DI 0 "register_operand" "=d")
2300 (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))
2301 (clobber (reg:CC 33))]
2302 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2304 "&& reload_completed"
2306 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2307 (clobber (reg:CC 33))])
2309 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2310 (clobber (reg:CC 33))])]
2314 ; extendhisi2 instruction pattern(s).
2317 (define_expand "extendhisi2"
2318 [(set (match_operand:SI 0 "register_operand" "")
2319 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2323 operands[1] = gen_lowpart (SImode, operands[1]);
2324 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2325 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2330 (define_insn "*extendhisi2"
2331 [(set (match_operand:SI 0 "register_operand" "=d,d")
2332 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2337 [(set_attr "op_type" "RX,RXY")])
2340 ; extendqisi2 instruction pattern(s).
2343 (define_expand "extendqisi2"
2344 [(set (match_operand:SI 0 "register_operand" "")
2345 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2349 operands[1] = gen_lowpart (SImode, operands[1]);
2350 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2351 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2356 (define_insn "*extendqisi2"
2357 [(set (match_operand:SI 0 "register_operand" "=d")
2358 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2359 "TARGET_LONG_DISPLACEMENT"
2361 [(set_attr "op_type" "RXY")])
2363 (define_insn_and_split "*extendqisi2_short_displ"
2364 [(set (match_operand:SI 0 "register_operand" "=d")
2365 (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))
2366 (clobber (reg:CC 33))]
2367 "!TARGET_LONG_DISPLACEMENT"
2369 "&& reload_completed"
2371 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2372 (clobber (reg:CC 33))])
2374 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2375 (clobber (reg:CC 33))])]
2379 ; extendqihi2 instruction pattern(s).
2384 ; zero_extendsidi2 instruction pattern(s).
2387 (define_expand "zero_extendsidi2"
2388 [(set (match_operand:DI 0 "register_operand" "")
2389 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2395 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2396 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2397 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2403 (define_insn "*zero_extendsidi2"
2404 [(set (match_operand:DI 0 "register_operand" "=d,d")
2405 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2410 [(set_attr "op_type" "RRE,RXY")])
2413 ; zero_extendhidi2 instruction pattern(s).
2416 (define_expand "zero_extendhidi2"
2417 [(set (match_operand:DI 0 "register_operand" "")
2418 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2424 rtx tmp = gen_reg_rtx (SImode);
2425 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2426 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2431 operands[1] = gen_lowpart (DImode, operands[1]);
2432 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2433 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2439 (define_insn "*zero_extendhidi2"
2440 [(set (match_operand:DI 0 "register_operand" "=d")
2441 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2444 [(set_attr "op_type" "RXY")])
2447 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2450 (define_insn "*llgt_sisi"
2451 [(set (match_operand:SI 0 "register_operand" "=d,d")
2452 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2453 (const_int 2147483647)))]
2458 [(set_attr "op_type" "RRE,RXE")])
2461 [(set (match_operand:SI 0 "register_operand" "")
2462 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2463 (const_int 2147483647)))
2464 (clobber (reg:CC 33))]
2465 "TARGET_64BIT && reload_completed"
2467 (and:SI (match_dup 1)
2468 (const_int 2147483647)))]
2471 (define_insn "*llgt_didi"
2472 [(set (match_operand:DI 0 "register_operand" "=d,d")
2473 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2474 (const_int 2147483647)))]
2479 [(set_attr "op_type" "RRE,RXE")])
2482 [(set (match_operand:DI 0 "register_operand" "")
2483 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
2484 (const_int 2147483647)))
2485 (clobber (reg:CC 33))]
2486 "TARGET_64BIT && reload_completed"
2488 (and:DI (match_dup 1)
2489 (const_int 2147483647)))]
2492 (define_insn "*llgt_sidi"
2493 [(set (match_operand:DI 0 "register_operand" "=d")
2494 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2495 (const_int 2147483647)))]
2498 [(set_attr "op_type" "RXE")])
2500 (define_insn_and_split "*llgt_sidi_split"
2501 [(set (match_operand:DI 0 "register_operand" "=d")
2502 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2503 (const_int 2147483647)))
2504 (clobber (reg:CC 33))]
2507 "&& reload_completed"
2509 (and:DI (subreg:DI (match_dup 1) 0)
2510 (const_int 2147483647)))]
2514 ; zero_extendqidi2 instruction pattern(s)
2517 (define_expand "zero_extendqidi2"
2518 [(set (match_operand:DI 0 "register_operand" "")
2519 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2525 rtx tmp = gen_reg_rtx (SImode);
2526 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2527 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2532 operands[1] = gen_lowpart (DImode, operands[1]);
2533 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2534 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2540 (define_insn "*zero_extendqidi2"
2541 [(set (match_operand:DI 0 "register_operand" "=d")
2542 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2545 [(set_attr "op_type" "RXY")])
2548 ; zero_extendhisi2 instruction pattern(s).
2551 (define_expand "zero_extendhisi2"
2552 [(set (match_operand:SI 0 "register_operand" "")
2553 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2557 operands[1] = gen_lowpart (SImode, operands[1]);
2558 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2563 (define_insn "*zero_extendhisi2_64"
2564 [(set (match_operand:SI 0 "register_operand" "=d")
2565 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2568 [(set_attr "op_type" "RXY")])
2570 (define_insn_and_split "*zero_extendhisi2_31"
2571 [(set (match_operand:SI 0 "register_operand" "=&d")
2572 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2573 (clobber (reg:CC 33))]
2576 "&& reload_completed"
2577 [(set (match_dup 0) (const_int 0))
2579 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2580 (clobber (reg:CC 33))])]
2581 "operands[2] = gen_lowpart (HImode, operands[0]);"
2582 [(set_attr "atype" "agen")])
2585 ; zero_extendqisi2 instruction pattern(s).
2588 (define_expand "zero_extendqisi2"
2589 [(set (match_operand:SI 0 "register_operand" "")
2590 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2594 operands[1] = gen_lowpart (SImode, operands[1]);
2595 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2600 (define_insn "*zero_extendqisi2_64"
2601 [(set (match_operand:SI 0 "register_operand" "=d")
2602 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2605 [(set_attr "op_type" "RXY")])
2607 (define_insn_and_split "*zero_extendqisi2_31"
2608 [(set (match_operand:SI 0 "register_operand" "=&d")
2609 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2612 "&& reload_completed"
2613 [(set (match_dup 0) (const_int 0))
2614 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2615 "operands[2] = gen_lowpart (QImode, operands[0]);"
2616 [(set_attr "atype" "agen")])
2619 ; zero_extendqihi2 instruction pattern(s).
2622 (define_expand "zero_extendqihi2"
2623 [(set (match_operand:HI 0 "register_operand" "")
2624 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2628 operands[1] = gen_lowpart (HImode, operands[1]);
2629 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2634 (define_insn "*zero_extendqihi2_64"
2635 [(set (match_operand:HI 0 "register_operand" "=d")
2636 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2639 [(set_attr "op_type" "RXY")])
2641 (define_insn_and_split "*zero_extendqihi2_31"
2642 [(set (match_operand:HI 0 "register_operand" "=&d")
2643 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2646 "&& reload_completed"
2647 [(set (match_dup 0) (const_int 0))
2648 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2649 "operands[2] = gen_lowpart (QImode, operands[0]);"
2650 [(set_attr "atype" "agen")])
2654 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2657 (define_expand "fixuns_truncdfdi2"
2658 [(set (match_operand:DI 0 "register_operand" "")
2659 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2660 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2662 rtx label1 = gen_label_rtx ();
2663 rtx label2 = gen_label_rtx ();
2664 rtx temp = gen_reg_rtx (DFmode);
2665 operands[1] = force_reg (DFmode, operands[1]);
2667 emit_insn (gen_cmpdf (operands[1],
2668 CONST_DOUBLE_FROM_REAL_VALUE (
2669 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2670 emit_jump_insn (gen_blt (label1));
2671 emit_insn (gen_subdf3 (temp, operands[1],
2672 CONST_DOUBLE_FROM_REAL_VALUE (
2673 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2674 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2677 emit_label (label1);
2678 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2679 emit_label (label2);
2683 (define_expand "fix_truncdfdi2"
2684 [(set (match_operand:DI 0 "register_operand" "")
2685 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2686 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2688 operands[1] = force_reg (DFmode, operands[1]);
2689 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2693 (define_insn "fix_truncdfdi2_ieee"
2694 [(set (match_operand:DI 0 "register_operand" "=d")
2695 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2696 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2697 (clobber (reg:CC 33))]
2698 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2700 [(set_attr "op_type" "RRE")
2701 (set_attr "type" "ftoi")])
2704 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2707 (define_expand "fixuns_truncdfsi2"
2708 [(set (match_operand:SI 0 "register_operand" "")
2709 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2710 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2712 rtx label1 = gen_label_rtx ();
2713 rtx label2 = gen_label_rtx ();
2714 rtx temp = gen_reg_rtx (DFmode);
2716 operands[1] = force_reg (DFmode,operands[1]);
2717 emit_insn (gen_cmpdf (operands[1],
2718 CONST_DOUBLE_FROM_REAL_VALUE (
2719 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2720 emit_jump_insn (gen_blt (label1));
2721 emit_insn (gen_subdf3 (temp, operands[1],
2722 CONST_DOUBLE_FROM_REAL_VALUE (
2723 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2724 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2727 emit_label (label1);
2728 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2729 emit_label (label2);
2733 (define_expand "fix_truncdfsi2"
2734 [(set (match_operand:SI 0 "register_operand" "")
2735 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2738 if (TARGET_IBM_FLOAT)
2740 /* This is the algorithm from POP chapter A.5.7.2. */
2742 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2743 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2744 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2746 operands[1] = force_reg (DFmode, operands[1]);
2747 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2748 two31r, two32, temp));
2752 operands[1] = force_reg (DFmode, operands[1]);
2753 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2759 (define_insn "fix_truncdfsi2_ieee"
2760 [(set (match_operand:SI 0 "register_operand" "=d")
2761 (fix:SI (match_operand:DF 1 "register_operand" "f")))
2762 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2763 (clobber (reg:CC 33))]
2764 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2766 [(set_attr "op_type" "RRE")
2767 (set_attr "type" "other" )])
2769 (define_insn "fix_truncdfsi2_ibm"
2770 [(set (match_operand:SI 0 "register_operand" "=d")
2771 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2772 (use (match_operand:DI 2 "immediate_operand" "m"))
2773 (use (match_operand:DI 3 "immediate_operand" "m"))
2774 (use (match_operand:BLK 4 "memory_operand" "m"))
2775 (clobber (reg:CC 33))]
2776 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2778 output_asm_insn ("sd\t%1,%2", operands);
2779 output_asm_insn ("aw\t%1,%3", operands);
2780 output_asm_insn ("std\t%1,%4", operands);
2781 output_asm_insn ("xi\t%N4,128", operands);
2784 [(set_attr "op_type" "NN")
2785 (set_attr "type" "ftoi")
2786 (set_attr "atype" "agen")
2787 (set_attr "length" "20")])
2790 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
2793 (define_expand "fixuns_truncsfdi2"
2794 [(set (match_operand:DI 0 "register_operand" "")
2795 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2796 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2798 rtx label1 = gen_label_rtx ();
2799 rtx label2 = gen_label_rtx ();
2800 rtx temp = gen_reg_rtx (SFmode);
2802 operands[1] = force_reg (SFmode, operands[1]);
2803 emit_insn (gen_cmpsf (operands[1],
2804 CONST_DOUBLE_FROM_REAL_VALUE (
2805 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
2806 emit_jump_insn (gen_blt (label1));
2808 emit_insn (gen_subsf3 (temp, operands[1],
2809 CONST_DOUBLE_FROM_REAL_VALUE (
2810 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
2811 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
2814 emit_label (label1);
2815 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2816 emit_label (label2);
2820 (define_expand "fix_truncsfdi2"
2821 [(set (match_operand:DI 0 "register_operand" "")
2822 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
2823 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2825 operands[1] = force_reg (SFmode, operands[1]);
2826 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2830 (define_insn "fix_truncsfdi2_ieee"
2831 [(set (match_operand:DI 0 "register_operand" "=d")
2832 (fix:DI (match_operand:SF 1 "register_operand" "f")))
2833 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2834 (clobber (reg:CC 33))]
2835 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2837 [(set_attr "op_type" "RRE")
2838 (set_attr "type" "ftoi")])
2841 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
2844 (define_expand "fixuns_truncsfsi2"
2845 [(set (match_operand:SI 0 "register_operand" "")
2846 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
2847 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2849 rtx label1 = gen_label_rtx ();
2850 rtx label2 = gen_label_rtx ();
2851 rtx temp = gen_reg_rtx (SFmode);
2853 operands[1] = force_reg (SFmode, operands[1]);
2854 emit_insn (gen_cmpsf (operands[1],
2855 CONST_DOUBLE_FROM_REAL_VALUE (
2856 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
2857 emit_jump_insn (gen_blt (label1));
2858 emit_insn (gen_subsf3 (temp, operands[1],
2859 CONST_DOUBLE_FROM_REAL_VALUE (
2860 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
2861 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
2864 emit_label (label1);
2865 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2866 emit_label (label2);
2870 (define_expand "fix_truncsfsi2"
2871 [(set (match_operand:SI 0 "register_operand" "")
2872 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
2875 if (TARGET_IBM_FLOAT)
2877 /* Convert to DFmode and then use the POP algorithm. */
2878 rtx temp = gen_reg_rtx (DFmode);
2879 emit_insn (gen_extendsfdf2 (temp, operands[1]));
2880 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
2884 operands[1] = force_reg (SFmode, operands[1]);
2885 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2891 (define_insn "fix_truncsfsi2_ieee"
2892 [(set (match_operand:SI 0 "register_operand" "=d")
2893 (fix:SI (match_operand:SF 1 "register_operand" "f")))
2894 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2895 (clobber (reg:CC 33))]
2896 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2898 [(set_attr "op_type" "RRE")
2899 (set_attr "type" "ftoi")])
2902 ; floatdidf2 instruction pattern(s).
2905 (define_insn "floatdidf2"
2906 [(set (match_operand:DF 0 "register_operand" "=f")
2907 (float:DF (match_operand:DI 1 "register_operand" "d")))
2908 (clobber (reg:CC 33))]
2909 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2911 [(set_attr "op_type" "RRE")
2912 (set_attr "type" "itof" )])
2915 ; floatdisf2 instruction pattern(s).
2918 (define_insn "floatdisf2"
2919 [(set (match_operand:SF 0 "register_operand" "=f")
2920 (float:SF (match_operand:DI 1 "register_operand" "d")))
2921 (clobber (reg:CC 33))]
2922 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2924 [(set_attr "op_type" "RRE")
2925 (set_attr "type" "itof" )])
2928 ; floatsidf2 instruction pattern(s).
2931 (define_expand "floatsidf2"
2933 [(set (match_operand:DF 0 "register_operand" "")
2934 (float:DF (match_operand:SI 1 "register_operand" "")))
2935 (clobber (reg:CC 33))])]
2938 if (TARGET_IBM_FLOAT)
2940 /* This is the algorithm from POP chapter A.5.7.1. */
2942 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2943 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
2945 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
2950 (define_insn "floatsidf2_ieee"
2951 [(set (match_operand:DF 0 "register_operand" "=f")
2952 (float:DF (match_operand:SI 1 "register_operand" "d")))
2953 (clobber (reg:CC 33))]
2954 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2956 [(set_attr "op_type" "RRE")
2957 (set_attr "type" "itof" )])
2959 (define_insn "floatsidf2_ibm"
2960 [(set (match_operand:DF 0 "register_operand" "=f")
2961 (float:DF (match_operand:SI 1 "register_operand" "d")))
2962 (use (match_operand:DI 2 "immediate_operand" "m"))
2963 (use (match_operand:BLK 3 "memory_operand" "m"))
2964 (clobber (reg:CC 33))]
2965 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2967 output_asm_insn ("st\t%1,%N3", operands);
2968 output_asm_insn ("xi\t%N3,128", operands);
2969 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
2970 output_asm_insn ("ld\t%0,%3", operands);
2973 [(set_attr "op_type" "NN")
2974 (set_attr "type" "other" )
2975 (set_attr "atype" "agen")
2976 (set_attr "length" "20")])
2979 ; floatsisf2 instruction pattern(s).
2982 (define_expand "floatsisf2"
2984 [(set (match_operand:SF 0 "register_operand" "")
2985 (float:SF (match_operand:SI 1 "register_operand" "")))
2986 (clobber (reg:CC 33))])]
2989 if (TARGET_IBM_FLOAT)
2991 /* Use the POP algorithm to convert to DFmode and then truncate. */
2992 rtx temp = gen_reg_rtx (DFmode);
2993 emit_insn (gen_floatsidf2 (temp, operands[1]));
2994 emit_insn (gen_truncdfsf2 (operands[0], temp));
2999 (define_insn "floatsisf2_ieee"
3000 [(set (match_operand:SF 0 "register_operand" "=f")
3001 (float:SF (match_operand:SI 1 "register_operand" "d")))
3002 (clobber (reg:CC 33))]
3003 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3005 [(set_attr "op_type" "RRE")
3006 (set_attr "type" "itof" )])
3009 ; truncdfsf2 instruction pattern(s).
3012 (define_expand "truncdfsf2"
3013 [(set (match_operand:SF 0 "register_operand" "")
3014 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3018 (define_insn "truncdfsf2_ieee"
3019 [(set (match_operand:SF 0 "register_operand" "=f")
3020 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3021 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3023 [(set_attr "op_type" "RRE")])
3025 (define_insn "truncdfsf2_ibm"
3026 [(set (match_operand:SF 0 "register_operand" "=f,f")
3027 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3028 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3032 [(set_attr "op_type" "RR,RX")
3033 (set_attr "type" "floads,floads")])
3036 ; extendsfdf2 instruction pattern(s).
3039 (define_expand "extendsfdf2"
3040 [(set (match_operand:DF 0 "register_operand" "")
3041 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3044 if (TARGET_IBM_FLOAT)
3046 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3051 (define_insn "extendsfdf2_ieee"
3052 [(set (match_operand:DF 0 "register_operand" "=f,f")
3053 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3054 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3058 [(set_attr "op_type" "RRE,RXE")
3059 (set_attr "type" "floads,floads")])
3061 (define_insn "extendsfdf2_ibm"
3062 [(set (match_operand:DF 0 "register_operand" "=f,f")
3063 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3064 (clobber (reg:CC 33))]
3065 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3067 sdr\t%0,%0\;ler\t%0,%1
3068 sdr\t%0,%0\;le\t%0,%1"
3069 [(set_attr "op_type" "NN,NN")
3070 (set_attr "atype" "reg,agen")
3071 (set_attr "length" "4,6")
3072 (set_attr "type" "o2,o2")])
3076 ;; ARITHMETIC OPERATIONS
3078 ; arithmetic operations set the ConditionCode,
3079 ; because of unpredictable Bits in Register for Halfword and Byte
3080 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3083 ;;- Add instructions.
3087 ; addti3 instruction pattern(s).
3090 (define_insn_and_split "addti3"
3091 [(set (match_operand:TI 0 "register_operand" "=&d")
3092 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
3093 (match_operand:TI 2 "general_operand" "do") ) )
3094 (clobber (reg:CC 33))]
3097 "&& reload_completed"
3100 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
3102 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
3104 [(set (match_dup 3) (plus:DI (plus:DI (match_dup 4) (match_dup 5))
3105 (ltu:DI (reg:CCL1 33) (const_int 0))))
3106 (clobber (reg:CC 33))])]
3107 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3108 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3109 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3110 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3111 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3112 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
3113 [(set_attr "op_type" "NN")])
3116 ; adddi3 instruction pattern(s).
3119 (define_insn "*adddi3_sign"
3120 [(set (match_operand:DI 0 "register_operand" "=d,d")
3121 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3122 (match_operand:DI 1 "register_operand" "0,0")))
3123 (clobber (reg:CC 33))]
3128 [(set_attr "op_type" "RRE,RXY")])
3130 (define_insn "*adddi3_zero_cc"
3132 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3133 (match_operand:DI 1 "register_operand" "0,0"))
3135 (set (match_operand:DI 0 "register_operand" "=d,d")
3136 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3137 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3141 [(set_attr "op_type" "RRE,RXY")])
3143 (define_insn "*adddi3_zero_cconly"
3145 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3146 (match_operand:DI 1 "register_operand" "0,0"))
3148 (clobber (match_scratch:DI 0 "=d,d"))]
3149 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3153 [(set_attr "op_type" "RRE,RXY")])
3155 (define_insn "*adddi3_zero"
3156 [(set (match_operand:DI 0 "register_operand" "=d,d")
3157 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3158 (match_operand:DI 1 "register_operand" "0,0")))
3159 (clobber (reg:CC 33))]
3164 [(set_attr "op_type" "RRE,RXY")])
3166 (define_insn "*adddi3_imm_cc"
3168 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3169 (match_operand:DI 2 "const_int_operand" "K"))
3171 (set (match_operand:DI 0 "register_operand" "=d")
3172 (plus:DI (match_dup 1) (match_dup 2)))]
3174 && s390_match_ccmode (insn, CCAmode)
3175 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3177 [(set_attr "op_type" "RI")])
3179 (define_insn "*adddi3_carry1_cc"
3181 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3182 (match_operand:DI 2 "general_operand" "d,m"))
3184 (set (match_operand:DI 0 "register_operand" "=d,d")
3185 (plus:DI (match_dup 1) (match_dup 2)))]
3186 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3190 [(set_attr "op_type" "RRE,RXY")])
3192 (define_insn "*adddi3_carry1_cconly"
3194 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3195 (match_operand:DI 2 "general_operand" "d,m"))
3197 (clobber (match_scratch:DI 0 "=d,d"))]
3198 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3202 [(set_attr "op_type" "RRE,RXY")])
3204 (define_insn "*adddi3_carry2_cc"
3206 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3207 (match_operand:DI 2 "general_operand" "d,m"))
3209 (set (match_operand:DI 0 "register_operand" "=d,d")
3210 (plus:DI (match_dup 1) (match_dup 2)))]
3211 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3215 [(set_attr "op_type" "RRE,RXY")])
3217 (define_insn "*adddi3_carry2_cconly"
3219 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3220 (match_operand:DI 2 "general_operand" "d,m"))
3222 (clobber (match_scratch:DI 0 "=d,d"))]
3223 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3227 [(set_attr "op_type" "RRE,RXY")])
3229 (define_insn "*adddi3_cc"
3231 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3232 (match_operand:DI 2 "general_operand" "d,m"))
3234 (set (match_operand:DI 0 "register_operand" "=d,d")
3235 (plus:DI (match_dup 1) (match_dup 2)))]
3236 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3240 [(set_attr "op_type" "RRE,RXY")])
3242 (define_insn "*adddi3_cconly"
3244 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3245 (match_operand:DI 2 "general_operand" "d,m"))
3247 (clobber (match_scratch:DI 0 "=d,d"))]
3248 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3252 [(set_attr "op_type" "RRE,RXY")])
3254 (define_insn "*adddi3_cconly2"
3256 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3257 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3258 (clobber (match_scratch:DI 0 "=d,d"))]
3259 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3263 [(set_attr "op_type" "RRE,RXY")])
3265 (define_insn "*adddi3_64"
3266 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3267 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3268 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3269 (clobber (reg:CC 33))]
3275 [(set_attr "op_type" "RRE,RI,RXY")])
3277 (define_insn_and_split "*adddi3_31z"
3278 [(set (match_operand:DI 0 "register_operand" "=&d")
3279 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3280 (match_operand:DI 2 "general_operand" "do") ) )
3281 (clobber (reg:CC 33))]
3282 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3284 "&& reload_completed"
3287 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3289 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3291 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3292 (ltu:SI (reg:CCL1 33) (const_int 0))))
3293 (clobber (reg:CC 33))])]
3294 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3295 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3296 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3297 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3298 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3299 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3300 [(set_attr "op_type" "NN")])
3302 (define_insn_and_split "*adddi3_31"
3303 [(set (match_operand:DI 0 "register_operand" "=&d")
3304 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3305 (match_operand:DI 2 "general_operand" "do") ) )
3306 (clobber (reg:CC 33))]
3309 "&& reload_completed"
3311 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3312 (clobber (reg:CC 33))])
3315 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3317 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3319 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3321 (label_ref (match_dup 9))))
3323 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3324 (clobber (reg:CC 33))])
3326 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3327 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3328 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3329 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3330 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3331 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3332 operands[9] = gen_label_rtx ();"
3333 [(set_attr "op_type" "NN")])
3335 (define_expand "adddi3"
3337 [(set (match_operand:DI 0 "register_operand" "")
3338 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3339 (match_operand:DI 2 "general_operand" "")))
3340 (clobber (reg:CC 33))])]
3345 ; addsi3 instruction pattern(s).
3348 (define_insn "*addsi3_imm_cc"
3350 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3351 (match_operand:SI 2 "const_int_operand" "K"))
3353 (set (match_operand:SI 0 "register_operand" "=d")
3354 (plus:SI (match_dup 1) (match_dup 2)))]
3355 "s390_match_ccmode (insn, CCAmode)
3356 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3358 [(set_attr "op_type" "RI")])
3360 (define_insn "*addsi3_carry1_cc"
3362 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3363 (match_operand:SI 2 "general_operand" "d,R,T"))
3365 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3366 (plus:SI (match_dup 1) (match_dup 2)))]
3367 "s390_match_ccmode (insn, CCL1mode)"
3372 [(set_attr "op_type" "RR,RX,RXY")])
3374 (define_insn "*addsi3_carry1_cconly"
3376 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3377 (match_operand:SI 2 "general_operand" "d,R,T"))
3379 (clobber (match_scratch:SI 0 "=d,d,d"))]
3380 "s390_match_ccmode (insn, CCL1mode)"
3385 [(set_attr "op_type" "RR,RX,RXY")])
3387 (define_insn "*addsi3_carry2_cc"
3389 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3390 (match_operand:SI 2 "general_operand" "d,R,T"))
3392 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3393 (plus:SI (match_dup 1) (match_dup 2)))]
3394 "s390_match_ccmode (insn, CCL1mode)"
3399 [(set_attr "op_type" "RR,RX,RXY")])
3401 (define_insn "*addsi3_carry2_cconly"
3403 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3404 (match_operand:SI 2 "general_operand" "d,R,T"))
3406 (clobber (match_scratch:SI 0 "=d,d,d"))]
3407 "s390_match_ccmode (insn, CCL1mode)"
3412 [(set_attr "op_type" "RR,RX,RXY")])
3414 (define_insn "*addsi3_cc"
3416 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3417 (match_operand:SI 2 "general_operand" "d,R,T"))
3419 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3420 (plus:SI (match_dup 1) (match_dup 2)))]
3421 "s390_match_ccmode (insn, CCLmode)"
3426 [(set_attr "op_type" "RR,RX,RXY")])
3428 (define_insn "*addsi3_cconly"
3430 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3431 (match_operand:SI 2 "general_operand" "d,R,T"))
3433 (clobber (match_scratch:SI 0 "=d,d,d"))]
3434 "s390_match_ccmode (insn, CCLmode)"
3439 [(set_attr "op_type" "RR,RX,RXY")])
3441 (define_insn "*addsi3_cconly2"
3443 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3444 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3445 (clobber (match_scratch:SI 0 "=d,d,d"))]
3446 "s390_match_ccmode (insn, CCLmode)"
3451 [(set_attr "op_type" "RR,RX,RXY")])
3453 (define_insn "*addsi3_sign"
3454 [(set (match_operand:SI 0 "register_operand" "=d,d")
3455 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3456 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3457 (clobber (reg:CC 33))]
3462 [(set_attr "op_type" "RX,RXY")])
3464 (define_insn "addsi3"
3465 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3466 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3467 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3468 (clobber (reg:CC 33))]
3475 [(set_attr "op_type" "RR,RI,RX,RXY")])
3478 ; adddf3 instruction pattern(s).
3481 (define_expand "adddf3"
3483 [(set (match_operand:DF 0 "register_operand" "=f,f")
3484 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3485 (match_operand:DF 2 "general_operand" "f,R")))
3486 (clobber (reg:CC 33))])]
3490 (define_insn "*adddf3"
3491 [(set (match_operand:DF 0 "register_operand" "=f,f")
3492 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3493 (match_operand:DF 2 "general_operand" "f,R")))
3494 (clobber (reg:CC 33))]
3495 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3499 [(set_attr "op_type" "RRE,RXE")
3500 (set_attr "type" "fsimpd,fsimpd")])
3502 (define_insn "*adddf3_cc"
3504 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3505 (match_operand:DF 2 "general_operand" "f,R"))
3506 (match_operand:DF 3 "const0_operand" "")))
3507 (set (match_operand:DF 0 "register_operand" "=f,f")
3508 (plus:DF (match_dup 1) (match_dup 2)))]
3509 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3513 [(set_attr "op_type" "RRE,RXE")
3514 (set_attr "type" "fsimpd,fsimpd")])
3516 (define_insn "*adddf3_cconly"
3518 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3519 (match_operand:DF 2 "general_operand" "f,R"))
3520 (match_operand:DF 3 "const0_operand" "")))
3521 (clobber (match_scratch:DF 0 "=f,f"))]
3522 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3526 [(set_attr "op_type" "RRE,RXE")
3527 (set_attr "type" "fsimpd,fsimpd")])
3529 (define_insn "*adddf3_ibm"
3530 [(set (match_operand:DF 0 "register_operand" "=f,f")
3531 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3532 (match_operand:DF 2 "general_operand" "f,R")))
3533 (clobber (reg:CC 33))]
3534 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3538 [(set_attr "op_type" "RR,RX")
3539 (set_attr "type" "fsimpd,fsimpd")])
3542 ; addsf3 instruction pattern(s).
3545 (define_expand "addsf3"
3547 [(set (match_operand:SF 0 "register_operand" "=f,f")
3548 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3549 (match_operand:SF 2 "general_operand" "f,R")))
3550 (clobber (reg:CC 33))])]
3554 (define_insn "*addsf3"
3555 [(set (match_operand:SF 0 "register_operand" "=f,f")
3556 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3557 (match_operand:SF 2 "general_operand" "f,R")))
3558 (clobber (reg:CC 33))]
3559 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3563 [(set_attr "op_type" "RRE,RXE")
3564 (set_attr "type" "fsimps,fsimps")])
3566 (define_insn "*addsf3_cc"
3568 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3569 (match_operand:SF 2 "general_operand" "f,R"))
3570 (match_operand:SF 3 "const0_operand" "")))
3571 (set (match_operand:SF 0 "register_operand" "=f,f")
3572 (plus:SF (match_dup 1) (match_dup 2)))]
3573 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3577 [(set_attr "op_type" "RRE,RXE")
3578 (set_attr "type" "fsimps,fsimps")])
3580 (define_insn "*addsf3_cconly"
3582 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3583 (match_operand:SF 2 "general_operand" "f,R"))
3584 (match_operand:SF 3 "const0_operand" "")))
3585 (clobber (match_scratch:SF 0 "=f,f"))]
3586 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3590 [(set_attr "op_type" "RRE,RXE")
3591 (set_attr "type" "fsimps,fsimps")])
3593 (define_insn "*addsf3"
3594 [(set (match_operand:SF 0 "register_operand" "=f,f")
3595 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3596 (match_operand:SF 2 "general_operand" "f,R")))
3597 (clobber (reg:CC 33))]
3598 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3602 [(set_attr "op_type" "RR,RX")
3603 (set_attr "type" "fsimps,fsimps")])
3607 ;;- Subtract instructions.
3611 ; subti3 instruction pattern(s).
3614 (define_insn_and_split "subti3"
3615 [(set (match_operand:TI 0 "register_operand" "=&d")
3616 (minus:TI (match_operand:TI 1 "register_operand" "0")
3617 (match_operand:TI 2 "general_operand" "do") ) )
3618 (clobber (reg:CC 33))]
3621 "&& reload_completed"
3624 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
3626 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
3628 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
3629 (gtu:DI (reg:CCL2 33) (const_int 0))))
3630 (clobber (reg:CC 33))])]
3631 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3632 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3633 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3634 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3635 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3636 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
3637 [(set_attr "op_type" "NN")])
3640 ; subdi3 instruction pattern(s).
3643 (define_insn "*subdi3_sign"
3644 [(set (match_operand:DI 0 "register_operand" "=d,d")
3645 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3646 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3647 (clobber (reg:CC 33))]
3652 [(set_attr "op_type" "RRE,RXY")])
3654 (define_insn "*subdi3_zero_cc"
3656 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3657 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3659 (set (match_operand:DI 0 "register_operand" "=d,d")
3660 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3661 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3665 [(set_attr "op_type" "RRE,RXY")])
3667 (define_insn "*subdi3_zero_cconly"
3669 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3670 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3672 (clobber (match_scratch:DI 0 "=d,d"))]
3673 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3677 [(set_attr "op_type" "RRE,RXY")])
3679 (define_insn "*subdi3_zero"
3680 [(set (match_operand:DI 0 "register_operand" "=d,d")
3681 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3682 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3683 (clobber (reg:CC 33))]
3688 [(set_attr "op_type" "RRE,RXY")])
3690 (define_insn "*subdi3_borrow_cc"
3692 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3693 (match_operand:DI 2 "general_operand" "d,m"))
3695 (set (match_operand:DI 0 "register_operand" "=d,d")
3696 (minus:DI (match_dup 1) (match_dup 2)))]
3697 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3701 [(set_attr "op_type" "RRE,RXY")])
3703 (define_insn "*subdi3_borrow_cconly"
3705 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3706 (match_operand:DI 2 "general_operand" "d,m"))
3708 (clobber (match_scratch:DI 0 "=d,d"))]
3709 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3713 [(set_attr "op_type" "RRE,RXY")])
3715 (define_insn "*subdi3_cc"
3717 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3718 (match_operand:DI 2 "general_operand" "d,m"))
3720 (set (match_operand:DI 0 "register_operand" "=d,d")
3721 (minus:DI (match_dup 1) (match_dup 2)))]
3722 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3726 [(set_attr "op_type" "RRE,RXY")])
3728 (define_insn "*subdi3_cc2"
3730 (compare (match_operand:DI 1 "register_operand" "0,0")
3731 (match_operand:DI 2 "general_operand" "d,m")))
3732 (set (match_operand:DI 0 "register_operand" "=d,d")
3733 (minus:DI (match_dup 1) (match_dup 2)))]
3734 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3738 [(set_attr "op_type" "RRE,RXY")])
3740 (define_insn "*subdi3_cconly"
3742 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3743 (match_operand:DI 2 "general_operand" "d,m"))
3745 (clobber (match_scratch:DI 0 "=d,d"))]
3746 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3750 [(set_attr "op_type" "RRE,RXY")])
3752 (define_insn "*subdi3_cconly2"
3754 (compare (match_operand:DI 1 "register_operand" "0,0")
3755 (match_operand:DI 2 "general_operand" "d,m")))
3756 (clobber (match_scratch:DI 0 "=d,d"))]
3757 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3761 [(set_attr "op_type" "RRE,RXY")])
3763 (define_insn "*subdi3_64"
3764 [(set (match_operand:DI 0 "register_operand" "=d,d")
3765 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3766 (match_operand:DI 2 "general_operand" "d,m") ) )
3767 (clobber (reg:CC 33))]
3772 [(set_attr "op_type" "RRE,RRE")])
3774 (define_insn_and_split "*subdi3_31z"
3775 [(set (match_operand:DI 0 "register_operand" "=&d")
3776 (minus:DI (match_operand:DI 1 "register_operand" "0")
3777 (match_operand:DI 2 "general_operand" "do") ) )
3778 (clobber (reg:CC 33))]
3779 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3781 "&& reload_completed"
3784 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3786 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3788 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3789 (gtu:SI (reg:CCL2 33) (const_int 0))))
3790 (clobber (reg:CC 33))])]
3791 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3792 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3793 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3794 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3795 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3796 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3797 [(set_attr "op_type" "NN")])
3799 (define_insn_and_split "*subdi3_31"
3800 [(set (match_operand:DI 0 "register_operand" "=&d")
3801 (minus:DI (match_operand:DI 1 "register_operand" "0")
3802 (match_operand:DI 2 "general_operand" "do") ) )
3803 (clobber (reg:CC 33))]
3806 "&& reload_completed"
3808 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3809 (clobber (reg:CC 33))])
3812 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3814 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3816 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3818 (label_ref (match_dup 9))))
3820 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3821 (clobber (reg:CC 33))])
3823 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3824 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3825 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3826 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3827 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3828 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3829 operands[9] = gen_label_rtx ();"
3830 [(set_attr "op_type" "NN")])
3832 (define_expand "subdi3"
3834 [(set (match_operand:DI 0 "register_operand" "")
3835 (minus:DI (match_operand:DI 1 "register_operand" "")
3836 (match_operand:DI 2 "general_operand" "")))
3837 (clobber (reg:CC 33))])]
3842 ; subsi3 instruction pattern(s).
3845 (define_insn "*subsi3_borrow_cc"
3847 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3848 (match_operand:SI 2 "general_operand" "d,R,T"))
3850 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3851 (minus:SI (match_dup 1) (match_dup 2)))]
3852 "s390_match_ccmode (insn, CCL2mode)"
3857 [(set_attr "op_type" "RR,RX,RXY")])
3859 (define_insn "*subsi3_borrow_cconly"
3861 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3862 (match_operand:SI 2 "general_operand" "d,R,T"))
3864 (clobber (match_scratch:SI 0 "=d,d,d"))]
3865 "s390_match_ccmode (insn, CCL2mode)"
3870 [(set_attr "op_type" "RR,RX,RXY")])
3872 (define_insn "*subsi3_cc"
3874 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3875 (match_operand:SI 2 "general_operand" "d,R,T"))
3877 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3878 (minus:SI (match_dup 1) (match_dup 2)))]
3879 "s390_match_ccmode (insn, CCLmode)"
3884 [(set_attr "op_type" "RR,RX,RXY")])
3886 (define_insn "*subsi3_cc2"
3888 (compare (match_operand:SI 1 "register_operand" "0,0,0")
3889 (match_operand:SI 2 "general_operand" "d,R,T")))
3890 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3891 (minus:SI (match_dup 1) (match_dup 2)))]
3892 "s390_match_ccmode (insn, CCL3mode)"
3897 [(set_attr "op_type" "RR,RX,RXY")])
3899 (define_insn "*subsi3_cconly"
3901 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3902 (match_operand:SI 2 "general_operand" "d,R,T"))
3904 (clobber (match_scratch:SI 0 "=d,d,d"))]
3905 "s390_match_ccmode (insn, CCLmode)"
3910 [(set_attr "op_type" "RR,RX,RXY")])
3912 (define_insn "*subsi3_cconly2"
3914 (compare (match_operand:SI 1 "register_operand" "0,0,0")
3915 (match_operand:SI 2 "general_operand" "d,R,T")))
3916 (clobber (match_scratch:SI 0 "=d,d,d"))]
3917 "s390_match_ccmode (insn, CCL3mode)"
3922 [(set_attr "op_type" "RR,RX,RXY")])
3924 (define_insn "*subsi3_sign"
3925 [(set (match_operand:SI 0 "register_operand" "=d,d")
3926 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3927 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3928 (clobber (reg:CC 33))]
3933 [(set_attr "op_type" "RX,RXY")])
3935 (define_insn "subsi3"
3936 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
3937 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3938 (match_operand:SI 2 "general_operand" "d,R,T")))
3939 (clobber (reg:CC 33))]
3945 [(set_attr "op_type" "RR,RX,RXY")])
3949 ; subdf3 instruction pattern(s).
3952 (define_expand "subdf3"
3954 [(set (match_operand:DF 0 "register_operand" "=f,f")
3955 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3956 (match_operand:DF 2 "general_operand" "f,R")))
3957 (clobber (reg:CC 33))])]
3961 (define_insn "*subdf3"
3962 [(set (match_operand:DF 0 "register_operand" "=f,f")
3963 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3964 (match_operand:DF 2 "general_operand" "f,R")))
3965 (clobber (reg:CC 33))]
3966 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3970 [(set_attr "op_type" "RRE,RXE")
3971 (set_attr "type" "fsimpd,fsimpd")])
3973 (define_insn "*subdf3_cc"
3975 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
3976 (match_operand:DF 2 "general_operand" "f,R"))
3977 (match_operand:DF 3 "const0_operand" "")))
3978 (set (match_operand:DF 0 "register_operand" "=f,f")
3979 (plus:DF (match_dup 1) (match_dup 2)))]
3980 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3984 [(set_attr "op_type" "RRE,RXE")
3985 (set_attr "type" "fsimpd,fsimpd")])
3987 (define_insn "*subdf3_cconly"
3989 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
3990 (match_operand:DF 2 "general_operand" "f,R"))
3991 (match_operand:DF 3 "const0_operand" "")))
3992 (clobber (match_scratch:DF 0 "=f,f"))]
3993 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3997 [(set_attr "op_type" "RRE,RXE")
3998 (set_attr "type" "fsimpd,fsimpd")])
4000 (define_insn "*subdf3_ibm"
4001 [(set (match_operand:DF 0 "register_operand" "=f,f")
4002 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4003 (match_operand:DF 2 "general_operand" "f,R")))
4004 (clobber (reg:CC 33))]
4005 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4009 [(set_attr "op_type" "RR,RX")
4010 (set_attr "type" "fsimpd,fsimpd")])
4013 ; subsf3 instruction pattern(s).
4016 (define_expand "subsf3"
4018 [(set (match_operand:SF 0 "register_operand" "=f,f")
4019 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4020 (match_operand:SF 2 "general_operand" "f,R")))
4021 (clobber (reg:CC 33))])]
4025 (define_insn "*subsf3"
4026 [(set (match_operand:SF 0 "register_operand" "=f,f")
4027 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4028 (match_operand:SF 2 "general_operand" "f,R")))
4029 (clobber (reg:CC 33))]
4030 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4034 [(set_attr "op_type" "RRE,RXE")
4035 (set_attr "type" "fsimps,fsimps")])
4037 (define_insn "*subsf3_cc"
4039 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4040 (match_operand:SF 2 "general_operand" "f,R"))
4041 (match_operand:SF 3 "const0_operand" "")))
4042 (set (match_operand:SF 0 "register_operand" "=f,f")
4043 (minus:SF (match_dup 1) (match_dup 2)))]
4044 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4048 [(set_attr "op_type" "RRE,RXE")
4049 (set_attr "type" "fsimps,fsimps")])
4051 (define_insn "*subsf3_cconly"
4053 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4054 (match_operand:SF 2 "general_operand" "f,R"))
4055 (match_operand:SF 3 "const0_operand" "")))
4056 (clobber (match_scratch:SF 0 "=f,f"))]
4057 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4061 [(set_attr "op_type" "RRE,RXE")
4062 (set_attr "type" "fsimps,fsimps")])
4064 (define_insn "*subsf3_ibm"
4065 [(set (match_operand:SF 0 "register_operand" "=f,f")
4066 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4067 (match_operand:SF 2 "general_operand" "f,R")))
4068 (clobber (reg:CC 33))]
4069 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4073 [(set_attr "op_type" "RR,RX")
4074 (set_attr "type" "fsimps,fsimps")])
4078 ;;- Conditional add/subtract instructions.
4082 ; adddicc instruction pattern(s).
4085 (define_insn "*adddi3_alc_cc"
4088 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4089 (match_operand:DI 2 "general_operand" "d,m"))
4090 (match_operand:DI 3 "s390_alc_comparison" ""))
4092 (set (match_operand:DI 0 "register_operand" "=d,d")
4093 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4094 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4098 [(set_attr "op_type" "RRE,RXY")])
4100 (define_insn "*adddi3_alc"
4101 [(set (match_operand:DI 0 "register_operand" "=d,d")
4102 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4103 (match_operand:DI 2 "general_operand" "d,m"))
4104 (match_operand:DI 3 "s390_alc_comparison" "")))
4105 (clobber (reg:CC 33))]
4110 [(set_attr "op_type" "RRE,RXY")])
4112 (define_insn "*subdi3_slb_cc"
4115 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4116 (match_operand:DI 2 "general_operand" "d,m"))
4117 (match_operand:DI 3 "s390_slb_comparison" ""))
4119 (set (match_operand:DI 0 "register_operand" "=d,d")
4120 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4121 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4125 [(set_attr "op_type" "RRE,RXY")])
4127 (define_insn "*subdi3_slb"
4128 [(set (match_operand:DI 0 "register_operand" "=d,d")
4129 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4130 (match_operand:DI 2 "general_operand" "d,m"))
4131 (match_operand:DI 3 "s390_slb_comparison" "")))
4132 (clobber (reg:CC 33))]
4137 [(set_attr "op_type" "RRE,RXY")])
4139 (define_expand "adddicc"
4140 [(match_operand:DI 0 "register_operand" "")
4141 (match_operand 1 "comparison_operator" "")
4142 (match_operand:DI 2 "register_operand" "")
4143 (match_operand:DI 3 "const_int_operand" "")]
4145 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4146 s390_compare_op0, s390_compare_op1,
4147 operands[0], operands[2],
4148 operands[3])) FAIL; DONE;")
4151 ; addsicc instruction pattern(s).
4154 (define_insn "*addsi3_alc_cc"
4157 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4158 (match_operand:SI 2 "general_operand" "d,m"))
4159 (match_operand:SI 3 "s390_alc_comparison" ""))
4161 (set (match_operand:SI 0 "register_operand" "=d,d")
4162 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4163 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4167 [(set_attr "op_type" "RRE,RXY")])
4169 (define_insn "*addsi3_alc"
4170 [(set (match_operand:SI 0 "register_operand" "=d,d")
4171 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4172 (match_operand:SI 2 "general_operand" "d,m"))
4173 (match_operand:SI 3 "s390_alc_comparison" "")))
4174 (clobber (reg:CC 33))]
4179 [(set_attr "op_type" "RRE,RXY")])
4181 (define_insn "*subsi3_slb_cc"
4184 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4185 (match_operand:SI 2 "general_operand" "d,m"))
4186 (match_operand:SI 3 "s390_slb_comparison" ""))
4188 (set (match_operand:SI 0 "register_operand" "=d,d")
4189 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4190 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4194 [(set_attr "op_type" "RRE,RXY")])
4196 (define_insn "*subsi3_slb"
4197 [(set (match_operand:SI 0 "register_operand" "=d,d")
4198 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4199 (match_operand:SI 2 "general_operand" "d,m"))
4200 (match_operand:SI 3 "s390_slb_comparison" "")))
4201 (clobber (reg:CC 33))]
4206 [(set_attr "op_type" "RRE,RXY")])
4208 (define_expand "addsicc"
4209 [(match_operand:SI 0 "register_operand" "")
4210 (match_operand 1 "comparison_operator" "")
4211 (match_operand:SI 2 "register_operand" "")
4212 (match_operand:SI 3 "const_int_operand" "")]
4214 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4215 s390_compare_op0, s390_compare_op1,
4216 operands[0], operands[2],
4217 operands[3])) FAIL; DONE;")
4220 ; scond instruction pattern(s).
4223 (define_insn_and_split "*sconddi"
4224 [(set (match_operand:DI 0 "register_operand" "=&d")
4225 (match_operand:DI 1 "s390_alc_comparison" ""))
4226 (clobber (reg:CC 33))]
4229 "&& reload_completed"
4230 [(set (match_dup 0) (const_int 0))
4232 [(set (match_dup 0) (plus:DI (plus:DI (match_dup 0) (match_dup 0))
4234 (clobber (reg:CC 33))])]
4236 [(set_attr "op_type" "NN")])
4238 (define_insn_and_split "*scondsi"
4239 [(set (match_operand:SI 0 "register_operand" "=&d")
4240 (match_operand:SI 1 "s390_alc_comparison" ""))
4241 (clobber (reg:CC 33))]
4244 "&& reload_completed"
4245 [(set (match_dup 0) (const_int 0))
4247 [(set (match_dup 0) (plus:SI (plus:SI (match_dup 0) (match_dup 0))
4249 (clobber (reg:CC 33))])]
4251 [(set_attr "op_type" "NN")])
4253 (define_insn_and_split "*sconddi_neg"
4254 [(set (match_operand:DI 0 "register_operand" "=&d")
4255 (match_operand:DI 1 "s390_slb_comparison" ""))
4256 (clobber (reg:CC 33))]
4259 "&& reload_completed"
4260 [(set (match_dup 0) (const_int 0))
4262 [(set (match_dup 0) (minus:DI (minus:DI (match_dup 0) (match_dup 0))
4264 (clobber (reg:CC 33))])
4266 [(set (match_dup 0) (neg:DI (match_dup 0)))
4267 (clobber (reg:CC 33))])]
4269 [(set_attr "op_type" "NN")])
4271 (define_insn_and_split "*scondsi_neg"
4272 [(set (match_operand:SI 0 "register_operand" "=&d")
4273 (match_operand:SI 1 "s390_slb_comparison" ""))
4274 (clobber (reg:CC 33))]
4277 "&& reload_completed"
4278 [(set (match_dup 0) (const_int 0))
4280 [(set (match_dup 0) (minus:SI (minus:SI (match_dup 0) (match_dup 0))
4282 (clobber (reg:CC 33))])
4284 [(set (match_dup 0) (neg:SI (match_dup 0)))
4285 (clobber (reg:CC 33))])]
4287 [(set_attr "op_type" "NN")])
4289 (define_expand "sltu"
4290 [(match_operand:SI 0 "register_operand" "")]
4292 "if (!s390_expand_addcc (LTU, s390_compare_op0, s390_compare_op1,
4293 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4295 (define_expand "sgtu"
4296 [(match_operand:SI 0 "register_operand" "")]
4298 "if (!s390_expand_addcc (GTU, s390_compare_op0, s390_compare_op1,
4299 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4301 (define_expand "sleu"
4302 [(match_operand:SI 0 "register_operand" "")]
4304 "if (!s390_expand_addcc (LEU, s390_compare_op0, s390_compare_op1,
4305 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4307 (define_expand "sgeu"
4308 [(match_operand:SI 0 "register_operand" "")]
4310 "if (!s390_expand_addcc (GEU, s390_compare_op0, s390_compare_op1,
4311 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4315 ;;- Multiply instructions.
4319 ; muldi3 instruction pattern(s).
4322 (define_insn "*muldi3_sign"
4323 [(set (match_operand:DI 0 "register_operand" "=d,d")
4324 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4325 (match_operand:DI 1 "register_operand" "0,0")))]
4330 [(set_attr "op_type" "RRE,RXY")
4331 (set_attr "type" "imul")])
4333 (define_insn "muldi3"
4334 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4335 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4336 (match_operand:DI 2 "general_operand" "d,K,m")))]
4342 [(set_attr "op_type" "RRE,RI,RXY")
4343 (set_attr "type" "imul")])
4346 ; mulsi3 instruction pattern(s).
4349 (define_insn "*mulsi3_sign"
4350 [(set (match_operand:SI 0 "register_operand" "=d")
4351 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4352 (match_operand:SI 1 "register_operand" "0")))]
4355 [(set_attr "op_type" "RX")
4356 (set_attr "type" "imul")])
4358 (define_insn "mulsi3"
4359 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4360 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4361 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4368 [(set_attr "op_type" "RRE,RI,RX,RXY")
4369 (set_attr "type" "imul")])
4372 ; mulsidi3 instruction pattern(s).
4375 (define_insn "mulsidi3"
4376 [(set (match_operand:DI 0 "register_operand" "=d,d")
4377 (mult:DI (sign_extend:DI
4378 (match_operand:SI 1 "register_operand" "%0,0"))
4380 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4385 [(set_attr "op_type" "RR,RX")
4386 (set_attr "type" "imul")])
4389 ; umulsidi3 instruction pattern(s).
4392 (define_insn "umulsidi3"
4393 [(set (match_operand:DI 0 "register_operand" "=d,d")
4394 (mult:DI (zero_extend:DI
4395 (match_operand:SI 1 "register_operand" "%0,0"))
4397 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4398 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4402 [(set_attr "op_type" "RRE,RXY")
4403 (set_attr "type" "imul")])
4406 ; muldf3 instruction pattern(s).
4409 (define_expand "muldf3"
4410 [(set (match_operand:DF 0 "register_operand" "=f,f")
4411 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4412 (match_operand:DF 2 "general_operand" "f,R")))]
4416 (define_insn "*muldf3"
4417 [(set (match_operand:DF 0 "register_operand" "=f,f")
4418 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4419 (match_operand:DF 2 "general_operand" "f,R")))]
4420 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4424 [(set_attr "op_type" "RRE,RXE")
4425 (set_attr "type" "fmuld")])
4427 (define_insn "*muldf3_ibm"
4428 [(set (match_operand:DF 0 "register_operand" "=f,f")
4429 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4430 (match_operand:DF 2 "general_operand" "f,R")))]
4431 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4435 [(set_attr "op_type" "RR,RX")
4436 (set_attr "type" "fmuld")])
4438 (define_insn "*fmadddf"
4439 [(set (match_operand:DF 0 "register_operand" "=f,f")
4440 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4441 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4442 (match_operand:DF 3 "register_operand" "0,0")))]
4443 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4447 [(set_attr "op_type" "RRE,RXE")
4448 (set_attr "type" "fmuld")])
4450 (define_insn "*fmsubdf"
4451 [(set (match_operand:DF 0 "register_operand" "=f,f")
4452 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4453 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4454 (match_operand:DF 3 "register_operand" "0,0")))]
4455 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4459 [(set_attr "op_type" "RRE,RXE")
4460 (set_attr "type" "fmuld")])
4463 ; mulsf3 instruction pattern(s).
4466 (define_expand "mulsf3"
4467 [(set (match_operand:SF 0 "register_operand" "=f,f")
4468 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4469 (match_operand:SF 2 "general_operand" "f,R")))]
4473 (define_insn "*mulsf3"
4474 [(set (match_operand:SF 0 "register_operand" "=f,f")
4475 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4476 (match_operand:SF 2 "general_operand" "f,R")))]
4477 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4481 [(set_attr "op_type" "RRE,RXE")
4482 (set_attr "type" "fmuls")])
4484 (define_insn "*mulsf3_ibm"
4485 [(set (match_operand:SF 0 "register_operand" "=f,f")
4486 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4487 (match_operand:SF 2 "general_operand" "f,R")))]
4488 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4492 [(set_attr "op_type" "RR,RX")
4493 (set_attr "type" "fmuls")])
4495 (define_insn "*fmaddsf"
4496 [(set (match_operand:SF 0 "register_operand" "=f,f")
4497 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4498 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4499 (match_operand:SF 3 "register_operand" "0,0")))]
4500 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4504 [(set_attr "op_type" "RRE,RXE")
4505 (set_attr "type" "fmuls")])
4507 (define_insn "*fmsubsf"
4508 [(set (match_operand:SF 0 "register_operand" "=f,f")
4509 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4510 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4511 (match_operand:SF 3 "register_operand" "0,0")))]
4512 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4516 [(set_attr "op_type" "RRE,RXE")
4517 (set_attr "type" "fmuls")])
4520 ;;- Divide and modulo instructions.
4524 ; divmoddi4 instruction pattern(s).
4527 (define_expand "divmoddi4"
4528 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4529 (div:DI (match_operand:DI 1 "register_operand" "")
4530 (match_operand:DI 2 "general_operand" "")))
4531 (set (match_operand:DI 3 "general_operand" "")
4532 (mod:DI (match_dup 1) (match_dup 2)))])
4533 (clobber (match_dup 4))]
4536 rtx insn, div_equal, mod_equal;
4538 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4539 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4541 operands[4] = gen_reg_rtx(TImode);
4542 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4544 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4546 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4548 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4550 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4555 (define_insn "divmodtidi3"
4556 [(set (match_operand:TI 0 "register_operand" "=d,d")
4560 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4561 (match_operand:DI 2 "general_operand" "d,m")))
4563 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
4568 [(set_attr "op_type" "RRE,RXY")
4569 (set_attr "type" "idiv")])
4571 (define_insn "divmodtisi3"
4572 [(set (match_operand:TI 0 "register_operand" "=d,d")
4576 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4578 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4581 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
4586 [(set_attr "op_type" "RRE,RXY")
4587 (set_attr "type" "idiv")])
4590 ; udivmoddi4 instruction pattern(s).
4593 (define_expand "udivmoddi4"
4594 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4595 (udiv:DI (match_operand:DI 1 "general_operand" "")
4596 (match_operand:DI 2 "nonimmediate_operand" "")))
4597 (set (match_operand:DI 3 "general_operand" "")
4598 (umod:DI (match_dup 1) (match_dup 2)))])
4599 (clobber (match_dup 4))]
4602 rtx insn, div_equal, mod_equal, equal;
4604 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4605 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4606 equal = gen_rtx_IOR (TImode,
4607 gen_rtx_ASHIFT (TImode,
4608 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4610 gen_rtx_ZERO_EXTEND (TImode, div_equal));
4612 operands[4] = gen_reg_rtx(TImode);
4613 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4614 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4615 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4616 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4618 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4620 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4622 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4624 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4626 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4631 (define_insn "udivmodtidi3"
4632 [(set (match_operand:TI 0 "register_operand" "=d,d")
4637 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
4639 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4643 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
4648 [(set_attr "op_type" "RRE,RXY")
4649 (set_attr "type" "idiv")])
4652 ; divmodsi4 instruction pattern(s).
4655 (define_expand "divmodsi4"
4656 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4657 (div:SI (match_operand:SI 1 "general_operand" "")
4658 (match_operand:SI 2 "nonimmediate_operand" "")))
4659 (set (match_operand:SI 3 "general_operand" "")
4660 (mod:SI (match_dup 1) (match_dup 2)))])
4661 (clobber (match_dup 4))]
4664 rtx insn, div_equal, mod_equal, equal;
4666 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4667 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4668 equal = gen_rtx_IOR (DImode,
4669 gen_rtx_ASHIFT (DImode,
4670 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4672 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4674 operands[4] = gen_reg_rtx(DImode);
4675 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4676 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4678 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4680 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4682 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4684 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4686 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4691 (define_insn "divmoddisi3"
4692 [(set (match_operand:DI 0 "register_operand" "=d,d")
4697 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4699 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4703 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
4708 [(set_attr "op_type" "RR,RX")
4709 (set_attr "type" "idiv")])
4712 ; udivsi3 and umodsi3 instruction pattern(s).
4715 (define_expand "udivmodsi4"
4716 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4717 (udiv:SI (match_operand:SI 1 "general_operand" "")
4718 (match_operand:SI 2 "nonimmediate_operand" "")))
4719 (set (match_operand:SI 3 "general_operand" "")
4720 (umod:SI (match_dup 1) (match_dup 2)))])
4721 (clobber (match_dup 4))]
4722 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4724 rtx insn, div_equal, mod_equal, equal;
4726 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4727 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4728 equal = gen_rtx_IOR (DImode,
4729 gen_rtx_ASHIFT (DImode,
4730 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4732 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4734 operands[4] = gen_reg_rtx(DImode);
4735 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4736 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4737 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4738 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4740 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4742 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4744 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4746 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4748 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4753 (define_insn "udivmoddisi3"
4754 [(set (match_operand:DI 0 "register_operand" "=d,d")
4759 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
4761 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4765 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
4766 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4770 [(set_attr "op_type" "RRE,RXY")
4771 (set_attr "type" "idiv")])
4773 (define_expand "udivsi3"
4774 [(set (match_operand:SI 0 "register_operand" "=d")
4775 (udiv:SI (match_operand:SI 1 "general_operand" "")
4776 (match_operand:SI 2 "general_operand" "")))
4777 (clobber (match_dup 3))]
4778 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4780 rtx insn, udiv_equal, umod_equal, equal;
4782 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4783 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4784 equal = gen_rtx_IOR (DImode,
4785 gen_rtx_ASHIFT (DImode,
4786 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4788 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4790 operands[3] = gen_reg_rtx (DImode);
4792 if (CONSTANT_P (operands[2]))
4794 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4796 rtx label1 = gen_label_rtx ();
4798 operands[1] = make_safe_from (operands[1], operands[0]);
4799 emit_move_insn (operands[0], const0_rtx);
4800 emit_insn (gen_cmpsi (operands[1], operands[2]));
4801 emit_jump_insn (gen_bltu (label1));
4802 emit_move_insn (operands[0], const1_rtx);
4803 emit_label (label1);
4807 operands[2] = force_reg (SImode, operands[2]);
4808 operands[2] = make_safe_from (operands[2], operands[0]);
4810 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4811 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4814 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4816 insn = emit_move_insn (operands[0],
4817 gen_lowpart (SImode, operands[3]));
4819 gen_rtx_EXPR_LIST (REG_EQUAL,
4820 udiv_equal, REG_NOTES (insn));
4825 rtx label1 = gen_label_rtx ();
4826 rtx label2 = gen_label_rtx ();
4827 rtx label3 = gen_label_rtx ();
4829 operands[1] = force_reg (SImode, operands[1]);
4830 operands[1] = make_safe_from (operands[1], operands[0]);
4831 operands[2] = force_reg (SImode, operands[2]);
4832 operands[2] = make_safe_from (operands[2], operands[0]);
4834 emit_move_insn (operands[0], const0_rtx);
4835 emit_insn (gen_cmpsi (operands[2], operands[1]));
4836 emit_jump_insn (gen_bgtu (label3));
4837 emit_insn (gen_cmpsi (operands[2], const0_rtx));
4838 emit_jump_insn (gen_blt (label2));
4839 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4840 emit_jump_insn (gen_beq (label1));
4841 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4842 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4845 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4847 insn = emit_move_insn (operands[0],
4848 gen_lowpart (SImode, operands[3]));
4850 gen_rtx_EXPR_LIST (REG_EQUAL,
4851 udiv_equal, REG_NOTES (insn));
4853 emit_label (label1);
4854 emit_move_insn (operands[0], operands[1]);
4856 emit_label (label2);
4857 emit_move_insn (operands[0], const1_rtx);
4858 emit_label (label3);
4860 emit_move_insn (operands[0], operands[0]);
4864 (define_expand "umodsi3"
4865 [(set (match_operand:SI 0 "register_operand" "=d")
4866 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4867 (match_operand:SI 2 "nonimmediate_operand" "")))
4868 (clobber (match_dup 3))]
4869 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4871 rtx insn, udiv_equal, umod_equal, equal;
4873 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4874 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4875 equal = gen_rtx_IOR (DImode,
4876 gen_rtx_ASHIFT (DImode,
4877 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4879 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4881 operands[3] = gen_reg_rtx (DImode);
4883 if (CONSTANT_P (operands[2]))
4885 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4887 rtx label1 = gen_label_rtx ();
4889 operands[1] = make_safe_from (operands[1], operands[0]);
4890 emit_move_insn (operands[0], operands[1]);
4891 emit_insn (gen_cmpsi (operands[0], operands[2]));
4892 emit_jump_insn (gen_bltu (label1));
4893 emit_insn (gen_abssi2 (operands[0], operands[2]));
4894 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4895 emit_label (label1);
4899 operands[2] = force_reg (SImode, operands[2]);
4900 operands[2] = make_safe_from (operands[2], operands[0]);
4902 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4903 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4906 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4908 insn = emit_move_insn (operands[0],
4909 gen_highpart (SImode, operands[3]));
4911 gen_rtx_EXPR_LIST (REG_EQUAL,
4912 umod_equal, REG_NOTES (insn));
4917 rtx label1 = gen_label_rtx ();
4918 rtx label2 = gen_label_rtx ();
4919 rtx label3 = gen_label_rtx ();
4921 operands[1] = force_reg (SImode, operands[1]);
4922 operands[1] = make_safe_from (operands[1], operands[0]);
4923 operands[2] = force_reg (SImode, operands[2]);
4924 operands[2] = make_safe_from (operands[2], operands[0]);
4926 emit_move_insn(operands[0], operands[1]);
4927 emit_insn (gen_cmpsi (operands[2], operands[1]));
4928 emit_jump_insn (gen_bgtu (label3));
4929 emit_insn (gen_cmpsi (operands[2], const0_rtx));
4930 emit_jump_insn (gen_blt (label2));
4931 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4932 emit_jump_insn (gen_beq (label1));
4933 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4934 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4937 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4939 insn = emit_move_insn (operands[0],
4940 gen_highpart (SImode, operands[3]));
4942 gen_rtx_EXPR_LIST (REG_EQUAL,
4943 umod_equal, REG_NOTES (insn));
4945 emit_label (label1);
4946 emit_move_insn (operands[0], const0_rtx);
4948 emit_label (label2);
4949 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4950 emit_label (label3);
4956 ; divdf3 instruction pattern(s).
4959 (define_expand "divdf3"
4960 [(set (match_operand:DF 0 "register_operand" "=f,f")
4961 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4962 (match_operand:DF 2 "general_operand" "f,R")))]
4966 (define_insn "*divdf3"
4967 [(set (match_operand:DF 0 "register_operand" "=f,f")
4968 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4969 (match_operand:DF 2 "general_operand" "f,R")))]
4970 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4974 [(set_attr "op_type" "RRE,RXE")
4975 (set_attr "type" "fdivd")])
4977 (define_insn "*divdf3_ibm"
4978 [(set (match_operand:DF 0 "register_operand" "=f,f")
4979 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4980 (match_operand:DF 2 "general_operand" "f,R")))]
4981 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4985 [(set_attr "op_type" "RR,RX")
4986 (set_attr "type" "fdivd")])
4989 ; divsf3 instruction pattern(s).
4992 (define_expand "divsf3"
4993 [(set (match_operand:SF 0 "register_operand" "=f,f")
4994 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4995 (match_operand:SF 2 "general_operand" "f,R")))]
4999 (define_insn "*divsf3"
5000 [(set (match_operand:SF 0 "register_operand" "=f,f")
5001 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5002 (match_operand:SF 2 "general_operand" "f,R")))]
5003 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5007 [(set_attr "op_type" "RRE,RXE")
5008 (set_attr "type" "fdivs")])
5010 (define_insn "*divsf3"
5011 [(set (match_operand:SF 0 "register_operand" "=f,f")
5012 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5013 (match_operand:SF 2 "general_operand" "f,R")))]
5014 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5018 [(set_attr "op_type" "RR,RX")
5019 (set_attr "type" "fdivs")])
5023 ;;- And instructions.
5027 ; anddi3 instruction pattern(s).
5030 (define_insn "*anddi3_cc"
5032 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5033 (match_operand:DI 2 "general_operand" "d,m"))
5035 (set (match_operand:DI 0 "register_operand" "=d,d")
5036 (and:DI (match_dup 1) (match_dup 2)))]
5037 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5041 [(set_attr "op_type" "RRE,RXY")])
5043 (define_insn "*anddi3_cconly"
5045 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5046 (match_operand:DI 2 "general_operand" "d,m"))
5048 (clobber (match_scratch:DI 0 "=d,d"))]
5049 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
5050 /* Do not steal TM patterns. */
5051 && s390_single_part (operands[2], DImode, HImode, 0) < 0"
5055 [(set_attr "op_type" "RRE,RXY")])
5057 (define_insn "anddi3"
5058 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d,d,d")
5059 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o,0,0,0,0,0,0")
5060 (match_operand:DI 2 "general_operand"
5061 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m")))
5062 (clobber (reg:CC 33))]
5073 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY")])
5075 (define_insn "*anddi3_ss"
5076 [(set (match_operand:DI 0 "s_operand" "=Q")
5077 (and:DI (match_dup 0)
5078 (match_operand:DI 1 "s_imm_operand" "Q")))
5079 (clobber (reg:CC 33))]
5082 [(set_attr "op_type" "SS")])
5084 (define_insn "*anddi3_ss_inv"
5085 [(set (match_operand:DI 0 "s_operand" "=Q")
5086 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5088 (clobber (reg:CC 33))]
5091 [(set_attr "op_type" "SS")])
5094 ; andsi3 instruction pattern(s).
5097 (define_insn "*andsi3_cc"
5099 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5100 (match_operand:SI 2 "general_operand" "d,R,T"))
5102 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5103 (and:SI (match_dup 1) (match_dup 2)))]
5104 "s390_match_ccmode(insn, CCTmode)"
5109 [(set_attr "op_type" "RR,RX,RXY")])
5111 (define_insn "*andsi3_cconly"
5113 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5114 (match_operand:SI 2 "general_operand" "d,R,T"))
5116 (clobber (match_scratch:SI 0 "=d,d,d"))]
5117 "s390_match_ccmode(insn, CCTmode)
5118 /* Do not steal TM patterns. */
5119 && s390_single_part (operands[2], SImode, HImode, 0) < 0"
5124 [(set_attr "op_type" "RR,RX,RXY")])
5126 (define_expand "andsi3"
5128 [(set (match_operand:SI 0 "register_operand" "")
5129 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
5130 (match_operand:SI 2 "general_operand" "")))
5131 (clobber (reg:CC 33))])]
5135 (define_insn "*andsi3_zarch"
5136 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d,d,d")
5137 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,o,0,0,0,0,0")
5138 (match_operand:SI 2 "general_operand" "M,M,N0HSF,N1HSF,d,R,T")))
5139 (clobber (reg:CC 33))]
5149 [(set_attr "op_type" "RRE,RXE,RI,RI,RR,RX,RXY")])
5151 (define_insn "*andsi3_esa"
5152 [(set (match_operand:SI 0 "register_operand" "=d,d")
5153 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5154 (match_operand:SI 2 "general_operand" "d,R")))
5155 (clobber (reg:CC 33))]
5160 [(set_attr "op_type" "RR,RX")])
5162 (define_insn "*andsi3_ss"
5163 [(set (match_operand:SI 0 "s_operand" "=Q")
5164 (and:SI (match_dup 0)
5165 (match_operand:SI 1 "s_imm_operand" "Q")))
5166 (clobber (reg:CC 33))]
5169 [(set_attr "op_type" "SS")])
5171 (define_insn "*andsi3_ss_inv"
5172 [(set (match_operand:SI 0 "s_operand" "=Q")
5173 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5175 (clobber (reg:CC 33))]
5178 [(set_attr "op_type" "SS")])
5181 ; andhi3 instruction pattern(s).
5184 (define_insn "*andhi3_ni"
5185 [(set (match_operand:HI 0 "register_operand" "=d,d")
5186 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5187 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5188 (clobber (reg:CC 33))]
5193 [(set_attr "op_type" "RR,RI")])
5195 (define_insn "andhi3"
5196 [(set (match_operand:HI 0 "register_operand" "=d")
5197 (and:HI (match_operand:HI 1 "register_operand" "%0")
5198 (match_operand:HI 2 "nonmemory_operand" "d")))
5199 (clobber (reg:CC 33))]
5202 [(set_attr "op_type" "RR")])
5204 (define_insn "*andhi3_ss"
5205 [(set (match_operand:HI 0 "s_operand" "=Q")
5206 (and:HI (match_dup 0)
5207 (match_operand:HI 1 "s_imm_operand" "Q")))
5208 (clobber (reg:CC 33))]
5211 [(set_attr "op_type" "SS")])
5213 (define_insn "*andhi3_ss_inv"
5214 [(set (match_operand:HI 0 "s_operand" "=Q")
5215 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5217 (clobber (reg:CC 33))]
5220 [(set_attr "op_type" "SS")])
5223 ; andqi3 instruction pattern(s).
5226 (define_insn "*andqi3_ni"
5227 [(set (match_operand:QI 0 "register_operand" "=d,d")
5228 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5229 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5230 (clobber (reg:CC 33))]
5235 [(set_attr "op_type" "RR,RI")])
5237 (define_insn "andqi3"
5238 [(set (match_operand:QI 0 "register_operand" "=d")
5239 (and:QI (match_operand:QI 1 "register_operand" "%0")
5240 (match_operand:QI 2 "nonmemory_operand" "d")))
5241 (clobber (reg:CC 33))]
5244 [(set_attr "op_type" "RR")])
5246 (define_insn "*andqi3_ss"
5247 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5248 (and:QI (match_dup 0)
5249 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5250 (clobber (reg:CC 33))]
5256 [(set_attr "op_type" "SI,SIY,SS")])
5258 (define_insn "*andqi3_ss_inv"
5259 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5260 (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5262 (clobber (reg:CC 33))]
5268 [(set_attr "op_type" "SI,SIY,SS")])
5272 ;;- Bit set (inclusive or) instructions.
5276 ; iordi3 instruction pattern(s).
5279 (define_insn "*iordi3_cc"
5281 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5282 (match_operand:DI 2 "general_operand" "d,m"))
5284 (set (match_operand:DI 0 "register_operand" "=d,d")
5285 (ior:DI (match_dup 1) (match_dup 2)))]
5286 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5290 [(set_attr "op_type" "RRE,RXY")])
5292 (define_insn "*iordi3_cconly"
5294 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5295 (match_operand:DI 2 "general_operand" "d,m"))
5297 (clobber (match_scratch:DI 0 "=d,d"))]
5298 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5302 [(set_attr "op_type" "RRE,RXY")])
5304 (define_insn "iordi3"
5305 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d")
5306 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,0,0,0,0")
5307 (match_operand:DI 2 "general_operand" "N0HD0,N1HD0,N2HD0,N3HD0,d,m")))
5308 (clobber (reg:CC 33))]
5317 [(set_attr "op_type" "RI,RI,RI,RI,RRE,RXY")])
5319 (define_insn "*iordi3_ss"
5320 [(set (match_operand:DI 0 "s_operand" "=Q")
5321 (ior:DI (match_dup 0)
5322 (match_operand:DI 1 "s_imm_operand" "Q")))
5323 (clobber (reg:CC 33))]
5326 [(set_attr "op_type" "SS")])
5328 (define_insn "*iordi3_ss_inv"
5329 [(set (match_operand:DI 0 "s_operand" "=Q")
5330 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5332 (clobber (reg:CC 33))]
5335 [(set_attr "op_type" "SS")])
5338 ; iorsi3 instruction pattern(s).
5341 (define_insn "*iorsi3_cc"
5343 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5344 (match_operand:SI 2 "general_operand" "d,R,T"))
5346 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5347 (ior:SI (match_dup 1) (match_dup 2)))]
5348 "s390_match_ccmode(insn, CCTmode)"
5353 [(set_attr "op_type" "RR,RX,RXY")])
5355 (define_insn "*iorsi3_cconly"
5357 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5358 (match_operand:SI 2 "general_operand" "d,R,T"))
5360 (clobber (match_scratch:SI 0 "=d,d,d"))]
5361 "s390_match_ccmode(insn, CCTmode)"
5366 [(set_attr "op_type" "RR,RX,RXY")])
5368 (define_expand "iorsi3"
5370 [(set (match_operand:SI 0 "register_operand" "")
5371 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
5372 (match_operand:SI 2 "general_operand" "")))
5373 (clobber (reg:CC 33))])]
5377 (define_insn "iorsi3_zarch"
5378 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
5379 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0,0")
5380 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,d,R,T")))
5381 (clobber (reg:CC 33))]
5389 [(set_attr "op_type" "RI,RI,RR,RX,RXY")])
5391 (define_insn "iorsi3_esa"
5392 [(set (match_operand:SI 0 "register_operand" "=d,d")
5393 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
5394 (match_operand:SI 2 "general_operand" "d,R")))
5395 (clobber (reg:CC 33))]
5400 [(set_attr "op_type" "RR,RX")])
5402 (define_insn "*iorsi3_ss"
5403 [(set (match_operand:SI 0 "s_operand" "=Q")
5404 (ior:SI (match_dup 0)
5405 (match_operand:SI 1 "s_imm_operand" "Q")))
5406 (clobber (reg:CC 33))]
5409 [(set_attr "op_type" "SS")])
5411 (define_insn "*iorsi3_ss_inv"
5412 [(set (match_operand:SI 0 "s_operand" "=Q")
5413 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5415 (clobber (reg:CC 33))]
5418 [(set_attr "op_type" "SS")])
5421 ; iorhi3 instruction pattern(s).
5424 (define_insn "*iorhi3_oi"
5425 [(set (match_operand:HI 0 "register_operand" "=d,d")
5426 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5427 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5428 (clobber (reg:CC 33))]
5433 [(set_attr "op_type" "RR,RI")])
5435 (define_insn "iorhi3"
5436 [(set (match_operand:HI 0 "register_operand" "=d")
5437 (ior:HI (match_operand:HI 1 "register_operand" "%0")
5438 (match_operand:HI 2 "nonmemory_operand" "d")))
5439 (clobber (reg:CC 33))]
5442 [(set_attr "op_type" "RR")])
5444 (define_insn "*iorhi3_ss"
5445 [(set (match_operand:HI 0 "s_operand" "=Q")
5446 (ior:HI (match_dup 0)
5447 (match_operand:HI 1 "s_imm_operand" "Q")))
5448 (clobber (reg:CC 33))]
5451 [(set_attr "op_type" "SS")])
5453 (define_insn "*iorhi3_ss_inv"
5454 [(set (match_operand:HI 0 "s_operand" "=Q")
5455 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5457 (clobber (reg:CC 33))]
5460 [(set_attr "op_type" "SS")])
5463 ; iorqi3 instruction pattern(s).
5466 (define_insn "*iorqi3_oi"
5467 [(set (match_operand:QI 0 "register_operand" "=d,d")
5468 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5469 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5470 (clobber (reg:CC 33))]
5475 [(set_attr "op_type" "RR,RI")])
5477 (define_insn "iorqi3"
5478 [(set (match_operand:QI 0 "register_operand" "=d")
5479 (ior:QI (match_operand:QI 1 "register_operand" "%0")
5480 (match_operand:QI 2 "nonmemory_operand" "d")))
5481 (clobber (reg:CC 33))]
5484 [(set_attr "op_type" "RR")])
5486 (define_insn "*iorqi3_ss"
5487 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5488 (ior:QI (match_dup 0)
5489 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5490 (clobber (reg:CC 33))]
5496 [(set_attr "op_type" "SI,SIY,SS")])
5498 (define_insn "*iorqi3_ss_inv"
5499 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5500 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5502 (clobber (reg:CC 33))]
5508 [(set_attr "op_type" "SI,SIY,SS")])
5512 ;;- Xor instructions.
5516 ; xordi3 instruction pattern(s).
5519 (define_insn "*xordi3_cc"
5521 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5522 (match_operand:DI 2 "general_operand" "d,m"))
5524 (set (match_operand:DI 0 "register_operand" "=d,d")
5525 (xor:DI (match_dup 1) (match_dup 2)))]
5526 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5530 [(set_attr "op_type" "RRE,RXY")])
5532 (define_insn "*xordi3_cconly"
5534 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5535 (match_operand:DI 2 "general_operand" "d,m"))
5537 (clobber (match_scratch:DI 0 "=d,d"))]
5538 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5542 [(set_attr "op_type" "RRE,RXY")])
5544 (define_insn "xordi3"
5545 [(set (match_operand:DI 0 "register_operand" "=d,d")
5546 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5547 (match_operand:DI 2 "general_operand" "d,m")))
5548 (clobber (reg:CC 33))]
5553 [(set_attr "op_type" "RRE,RXY")])
5555 (define_insn "*xordi3_ss"
5556 [(set (match_operand:DI 0 "s_operand" "=Q")
5557 (xor:DI (match_dup 0)
5558 (match_operand:DI 1 "s_imm_operand" "Q")))
5559 (clobber (reg:CC 33))]
5562 [(set_attr "op_type" "SS")])
5564 (define_insn "*xordi3_ss_inv"
5565 [(set (match_operand:DI 0 "s_operand" "=Q")
5566 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5568 (clobber (reg:CC 33))]
5571 [(set_attr "op_type" "SS")])
5574 ; xorsi3 instruction pattern(s).
5577 (define_insn "*xorsi3_cc"
5579 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5580 (match_operand:SI 2 "general_operand" "d,R,T"))
5582 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5583 (xor:SI (match_dup 1) (match_dup 2)))]
5584 "s390_match_ccmode(insn, CCTmode)"
5589 [(set_attr "op_type" "RR,RX,RXY")])
5591 (define_insn "*xorsi3_cconly"
5593 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5594 (match_operand:SI 2 "general_operand" "d,R,T"))
5596 (clobber (match_scratch:SI 0 "=d,d,d"))]
5597 "s390_match_ccmode(insn, CCTmode)"
5602 [(set_attr "op_type" "RR,RX,RXY")])
5604 (define_insn "xorsi3"
5605 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5606 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5607 (match_operand:SI 2 "general_operand" "d,R,T")))
5608 (clobber (reg:CC 33))]
5614 [(set_attr "op_type" "RR,RX,RXY")])
5616 (define_insn "*xorsi3_ss"
5617 [(set (match_operand:SI 0 "s_operand" "=Q")
5618 (xor:SI (match_dup 0)
5619 (match_operand:SI 1 "s_imm_operand" "Q")))
5620 (clobber (reg:CC 33))]
5623 [(set_attr "op_type" "SS")])
5625 (define_insn "*xorsi3_ss_inv"
5626 [(set (match_operand:SI 0 "s_operand" "=Q")
5627 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5629 (clobber (reg:CC 33))]
5632 [(set_attr "op_type" "SS")])
5635 ; xorhi3 instruction pattern(s).
5638 (define_insn "xorhi3"
5639 [(set (match_operand:HI 0 "register_operand" "=d")
5640 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5641 (match_operand:HI 2 "nonmemory_operand" "d")))
5642 (clobber (reg:CC 33))]
5645 [(set_attr "op_type" "RR")])
5647 (define_insn "*xorhi3_ss"
5648 [(set (match_operand:HI 0 "s_operand" "=Q")
5649 (xor:HI (match_dup 0)
5650 (match_operand:HI 1 "s_imm_operand" "Q")))
5651 (clobber (reg:CC 33))]
5654 [(set_attr "op_type" "SS")])
5656 (define_insn "*xorhi3_ss_inv"
5657 [(set (match_operand:HI 0 "s_operand" "=Q")
5658 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5660 (clobber (reg:CC 33))]
5663 [(set_attr "op_type" "SS")])
5666 ; xorqi3 instruction pattern(s).
5669 (define_insn "xorqi3"
5670 [(set (match_operand:QI 0 "register_operand" "=d")
5671 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5672 (match_operand:QI 2 "nonmemory_operand" "d")))
5673 (clobber (reg:CC 33))]
5676 [(set_attr "op_type" "RR")])
5678 (define_insn "*xorqi3_ss"
5679 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5680 (xor:QI (match_dup 0)
5681 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5682 (clobber (reg:CC 33))]
5688 [(set_attr "op_type" "SI,SIY,SS")])
5690 (define_insn "*xorqi3_ss_inv"
5691 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5692 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5694 (clobber (reg:CC 33))]
5700 [(set_attr "op_type" "SI,SIY,SS")])
5704 ;;- Negate instructions.
5708 ; negdi2 instruction pattern(s).
5711 (define_expand "negdi2"
5713 [(set (match_operand:DI 0 "register_operand" "=d")
5714 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5715 (clobber (reg:CC 33))])]
5719 (define_insn "*negdi2_64"
5720 [(set (match_operand:DI 0 "register_operand" "=d")
5721 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5722 (clobber (reg:CC 33))]
5725 [(set_attr "op_type" "RR")])
5727 (define_insn "*negdi2_31"
5728 [(set (match_operand:DI 0 "register_operand" "=d")
5729 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5730 (clobber (reg:CC 33))]
5734 xop[0] = gen_label_rtx ();
5735 output_asm_insn ("lcr\t%0,%1", operands);
5736 output_asm_insn ("lcr\t%N0,%N1", operands);
5737 output_asm_insn ("je\t%l0", xop);
5738 output_asm_insn ("bctr\t%0,0", operands);
5739 targetm.asm_out.internal_label (asm_out_file, "L",
5740 CODE_LABEL_NUMBER (xop[0]));
5743 [(set_attr "op_type" "NN")
5744 (set_attr "type" "other")
5745 (set_attr "length" "10")])
5748 ; negsi2 instruction pattern(s).
5751 (define_insn "negsi2"
5752 [(set (match_operand:SI 0 "register_operand" "=d")
5753 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5754 (clobber (reg:CC 33))]
5757 [(set_attr "op_type" "RR")])
5760 ; negdf2 instruction pattern(s).
5763 (define_expand "negdf2"
5765 [(set (match_operand:DF 0 "register_operand" "=f")
5766 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5767 (clobber (reg:CC 33))])]
5771 (define_insn "*negdf2"
5772 [(set (match_operand:DF 0 "register_operand" "=f")
5773 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5774 (clobber (reg:CC 33))]
5775 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5777 [(set_attr "op_type" "RRE")
5778 (set_attr "type" "fsimpd")])
5780 (define_insn "*negdf2_ibm"
5781 [(set (match_operand:DF 0 "register_operand" "=f")
5782 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5783 (clobber (reg:CC 33))]
5784 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5786 [(set_attr "op_type" "RR")
5787 (set_attr "type" "fsimpd")])
5790 ; negsf2 instruction pattern(s).
5793 (define_expand "negsf2"
5795 [(set (match_operand:SF 0 "register_operand" "=f")
5796 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5797 (clobber (reg:CC 33))])]
5801 (define_insn "*negsf2"
5802 [(set (match_operand:SF 0 "register_operand" "=f")
5803 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5804 (clobber (reg:CC 33))]
5805 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5807 [(set_attr "op_type" "RRE")
5808 (set_attr "type" "fsimps")])
5810 (define_insn "*negsf2"
5811 [(set (match_operand:SF 0 "register_operand" "=f")
5812 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5813 (clobber (reg:CC 33))]
5814 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5816 [(set_attr "op_type" "RR")
5817 (set_attr "type" "fsimps")])
5821 ;;- Absolute value instructions.
5825 ; absdi2 instruction pattern(s).
5828 (define_insn "absdi2"
5829 [(set (match_operand:DI 0 "register_operand" "=d")
5830 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5831 (clobber (reg:CC 33))]
5834 [(set_attr "op_type" "RRE")])
5837 ; abssi2 instruction pattern(s).
5840 (define_insn "abssi2"
5841 [(set (match_operand:SI 0 "register_operand" "=d")
5842 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5843 (clobber (reg:CC 33))]
5846 [(set_attr "op_type" "RR")])
5849 ; absdf2 instruction pattern(s).
5852 (define_expand "absdf2"
5854 [(set (match_operand:DF 0 "register_operand" "=f")
5855 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5856 (clobber (reg:CC 33))])]
5860 (define_insn "*absdf2"
5861 [(set (match_operand:DF 0 "register_operand" "=f")
5862 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5863 (clobber (reg:CC 33))]
5864 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5866 [(set_attr "op_type" "RRE")
5867 (set_attr "type" "fsimpd")])
5869 (define_insn "*absdf2_ibm"
5870 [(set (match_operand:DF 0 "register_operand" "=f")
5871 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5872 (clobber (reg:CC 33))]
5873 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5875 [(set_attr "op_type" "RR")
5876 (set_attr "type" "fsimpd")])
5879 ; abssf2 instruction pattern(s).
5882 (define_expand "abssf2"
5884 [(set (match_operand:SF 0 "register_operand" "=f")
5885 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5886 (clobber (reg:CC 33))])]
5890 (define_insn "*abssf2"
5891 [(set (match_operand:SF 0 "register_operand" "=f")
5892 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5893 (clobber (reg:CC 33))]
5894 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5896 [(set_attr "op_type" "RRE")
5897 (set_attr "type" "fsimps")])
5899 (define_insn "*abssf2_ibm"
5900 [(set (match_operand:SF 0 "register_operand" "=f")
5901 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5902 (clobber (reg:CC 33))]
5903 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5905 [(set_attr "op_type" "RR")
5906 (set_attr "type" "fsimps")])
5909 ;;- Negated absolute value instructions
5916 (define_insn "*negabssi2"
5917 [(set (match_operand:SI 0 "register_operand" "=d")
5918 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
5919 (clobber (reg:CC 33))]
5922 [(set_attr "op_type" "RR")])
5924 (define_insn "*negabsdi2"
5925 [(set (match_operand:DI 0 "register_operand" "=d")
5926 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
5927 (clobber (reg:CC 33))]
5930 [(set_attr "op_type" "RRE")])
5936 (define_insn "*negabssf2"
5937 [(set (match_operand:SF 0 "register_operand" "=f")
5938 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5939 (clobber (reg:CC 33))]
5940 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5942 [(set_attr "op_type" "RRE")
5943 (set_attr "type" "fsimps")])
5945 (define_insn "*negabsdf2"
5946 [(set (match_operand:DF 0 "register_operand" "=f")
5947 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5948 (clobber (reg:CC 33))]
5949 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5951 [(set_attr "op_type" "RRE")
5952 (set_attr "type" "fsimpd")])
5955 ;;- Square root instructions.
5959 ; sqrtdf2 instruction pattern(s).
5962 (define_insn "sqrtdf2"
5963 [(set (match_operand:DF 0 "register_operand" "=f,f")
5964 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
5965 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5969 [(set_attr "op_type" "RRE,RXE")])
5972 ; sqrtsf2 instruction pattern(s).
5975 (define_insn "sqrtsf2"
5976 [(set (match_operand:SF 0 "register_operand" "=f,f")
5977 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
5978 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5982 [(set_attr "op_type" "RRE,RXE")])
5985 ;;- One complement instructions.
5989 ; one_cmpldi2 instruction pattern(s).
5992 (define_expand "one_cmpldi2"
5994 [(set (match_operand:DI 0 "register_operand" "")
5995 (xor:DI (match_operand:DI 1 "register_operand" "")
5997 (clobber (reg:CC 33))])]
6002 ; one_cmplsi2 instruction pattern(s).
6005 (define_expand "one_cmplsi2"
6007 [(set (match_operand:SI 0 "register_operand" "")
6008 (xor:SI (match_operand:SI 1 "register_operand" "")
6010 (clobber (reg:CC 33))])]
6015 ; one_cmplhi2 instruction pattern(s).
6018 (define_expand "one_cmplhi2"
6020 [(set (match_operand:HI 0 "register_operand" "")
6021 (xor:HI (match_operand:HI 1 "register_operand" "")
6023 (clobber (reg:CC 33))])]
6028 ; one_cmplqi2 instruction pattern(s).
6031 (define_expand "one_cmplqi2"
6033 [(set (match_operand:QI 0 "register_operand" "")
6034 (xor:QI (match_operand:QI 1 "register_operand" "")
6036 (clobber (reg:CC 33))])]
6042 ;;- Rotate instructions.
6046 ; rotldi3 instruction pattern(s).
6049 (define_insn "rotldi3"
6050 [(set (match_operand:DI 0 "register_operand" "=d")
6051 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6052 (match_operand:SI 2 "shift_count_operand" "Y")))]
6055 [(set_attr "op_type" "RSE")
6056 (set_attr "atype" "reg")])
6059 ; rotlsi3 instruction pattern(s).
6062 (define_insn "rotlsi3"
6063 [(set (match_operand:SI 0 "register_operand" "=d")
6064 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6065 (match_operand:SI 2 "shift_count_operand" "Y")))]
6068 [(set_attr "op_type" "RSE")
6069 (set_attr "atype" "reg")])
6073 ;;- Arithmetic shift instructions.
6077 ; ashldi3 instruction pattern(s).
6080 (define_expand "ashldi3"
6081 [(set (match_operand:DI 0 "register_operand" "")
6082 (ashift:DI (match_operand:DI 1 "register_operand" "")
6083 (match_operand:SI 2 "shift_count_operand" "")))]
6087 (define_insn "*ashldi3_31"
6088 [(set (match_operand:DI 0 "register_operand" "=d")
6089 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6090 (match_operand:SI 2 "shift_count_operand" "Y")))]
6093 [(set_attr "op_type" "RS")
6094 (set_attr "atype" "reg")])
6096 (define_insn "*ashldi3_64"
6097 [(set (match_operand:DI 0 "register_operand" "=d")
6098 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6099 (match_operand:SI 2 "shift_count_operand" "Y")))]
6102 [(set_attr "op_type" "RSE")
6103 (set_attr "atype" "reg")])
6106 ; ashrdi3 instruction pattern(s).
6109 (define_expand "ashrdi3"
6111 [(set (match_operand:DI 0 "register_operand" "")
6112 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6113 (match_operand:SI 2 "shift_count_operand" "")))
6114 (clobber (reg:CC 33))])]
6118 (define_insn "*ashrdi3_cc_31"
6120 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6121 (match_operand:SI 2 "shift_count_operand" "Y"))
6123 (set (match_operand:DI 0 "register_operand" "=d")
6124 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6125 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6127 [(set_attr "op_type" "RS")
6128 (set_attr "atype" "reg")])
6130 (define_insn "*ashrdi3_cconly_31"
6132 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6133 (match_operand:SI 2 "shift_count_operand" "Y"))
6135 (clobber (match_scratch:DI 0 "=d"))]
6136 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6138 [(set_attr "op_type" "RS")
6139 (set_attr "atype" "reg")])
6141 (define_insn "*ashrdi3_31"
6142 [(set (match_operand:DI 0 "register_operand" "=d")
6143 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6144 (match_operand:SI 2 "shift_count_operand" "Y")))
6145 (clobber (reg:CC 33))]
6148 [(set_attr "op_type" "RS")
6149 (set_attr "atype" "reg")])
6151 (define_insn "*ashrdi3_cc_64"
6153 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6154 (match_operand:SI 2 "shift_count_operand" "Y"))
6156 (set (match_operand:DI 0 "register_operand" "=d")
6157 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6158 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6160 [(set_attr "op_type" "RSE")
6161 (set_attr "atype" "reg")])
6163 (define_insn "*ashrdi3_cconly_64"
6165 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6166 (match_operand:SI 2 "shift_count_operand" "Y"))
6168 (clobber (match_scratch:DI 0 "=d"))]
6169 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6171 [(set_attr "op_type" "RSE")
6172 (set_attr "atype" "reg")])
6174 (define_insn "*ashrdi3_64"
6175 [(set (match_operand:DI 0 "register_operand" "=d")
6176 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6177 (match_operand:SI 2 "shift_count_operand" "Y")))
6178 (clobber (reg:CC 33))]
6181 [(set_attr "op_type" "RSE")
6182 (set_attr "atype" "reg")])
6186 ; ashlsi3 instruction pattern(s).
6189 (define_insn "ashlsi3"
6190 [(set (match_operand:SI 0 "register_operand" "=d")
6191 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6192 (match_operand:SI 2 "shift_count_operand" "Y")))]
6195 [(set_attr "op_type" "RS")
6196 (set_attr "atype" "reg")])
6199 ; ashrsi3 instruction pattern(s).
6202 (define_insn "*ashrsi3_cc"
6204 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6205 (match_operand:SI 2 "shift_count_operand" "Y"))
6207 (set (match_operand:SI 0 "register_operand" "=d")
6208 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6209 "s390_match_ccmode(insn, CCSmode)"
6211 [(set_attr "op_type" "RS")
6212 (set_attr "atype" "reg")])
6215 (define_insn "*ashrsi3_cconly"
6217 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6218 (match_operand:SI 2 "shift_count_operand" "Y"))
6220 (clobber (match_scratch:SI 0 "=d"))]
6221 "s390_match_ccmode(insn, CCSmode)"
6223 [(set_attr "op_type" "RS")
6224 (set_attr "atype" "reg")])
6226 (define_insn "ashrsi3"
6227 [(set (match_operand:SI 0 "register_operand" "=d")
6228 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6229 (match_operand:SI 2 "shift_count_operand" "Y")))
6230 (clobber (reg:CC 33))]
6233 [(set_attr "op_type" "RS")
6234 (set_attr "atype" "reg")])
6238 ;;- logical shift instructions.
6242 ; lshrdi3 instruction pattern(s).
6245 (define_expand "lshrdi3"
6246 [(set (match_operand:DI 0 "register_operand" "")
6247 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6248 (match_operand:SI 2 "shift_count_operand" "")))]
6252 (define_insn "*lshrdi3_31"
6253 [(set (match_operand:DI 0 "register_operand" "=d")
6254 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6255 (match_operand:SI 2 "shift_count_operand" "Y")))]
6258 [(set_attr "op_type" "RS")
6259 (set_attr "atype" "reg")])
6261 (define_insn "*lshrdi3_64"
6262 [(set (match_operand:DI 0 "register_operand" "=d")
6263 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6264 (match_operand:SI 2 "shift_count_operand" "Y")))]
6267 [(set_attr "op_type" "RSE")
6268 (set_attr "atype" "reg")])
6271 ; lshrsi3 instruction pattern(s).
6274 (define_insn "lshrsi3"
6275 [(set (match_operand:SI 0 "register_operand" "=d")
6276 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6277 (match_operand:SI 2 "shift_count_operand" "Y")))]
6280 [(set_attr "op_type" "RS")
6281 (set_attr "atype" "reg")])
6285 ;; Branch instruction patterns.
6288 (define_expand "beq"
6289 [(match_operand 0 "" "")]
6291 "s390_emit_jump (operands[0],
6292 s390_emit_compare (EQ, s390_compare_op0, s390_compare_op1)); DONE;")
6294 (define_expand "bne"
6295 [(match_operand 0 "" "")]
6297 "s390_emit_jump (operands[0],
6298 s390_emit_compare (NE, s390_compare_op0, s390_compare_op1)); DONE;")
6300 (define_expand "bgt"
6301 [(match_operand 0 "" "")]
6303 "s390_emit_jump (operands[0],
6304 s390_emit_compare (GT, s390_compare_op0, s390_compare_op1)); DONE;")
6306 (define_expand "bgtu"
6307 [(match_operand 0 "" "")]
6309 "s390_emit_jump (operands[0],
6310 s390_emit_compare (GTU, s390_compare_op0, s390_compare_op1)); DONE;")
6312 (define_expand "blt"
6313 [(match_operand 0 "" "")]
6315 "s390_emit_jump (operands[0],
6316 s390_emit_compare (LT, s390_compare_op0, s390_compare_op1)); DONE;")
6318 (define_expand "bltu"
6319 [(match_operand 0 "" "")]
6321 "s390_emit_jump (operands[0],
6322 s390_emit_compare (LTU, s390_compare_op0, s390_compare_op1)); DONE;")
6324 (define_expand "bge"
6325 [(match_operand 0 "" "")]
6327 "s390_emit_jump (operands[0],
6328 s390_emit_compare (GE, s390_compare_op0, s390_compare_op1)); DONE;")
6330 (define_expand "bgeu"
6331 [(match_operand 0 "" "")]
6333 "s390_emit_jump (operands[0],
6334 s390_emit_compare (GEU, s390_compare_op0, s390_compare_op1)); DONE;")
6336 (define_expand "ble"
6337 [(match_operand 0 "" "")]
6339 "s390_emit_jump (operands[0],
6340 s390_emit_compare (LE, s390_compare_op0, s390_compare_op1)); DONE;")
6342 (define_expand "bleu"
6343 [(match_operand 0 "" "")]
6345 "s390_emit_jump (operands[0],
6346 s390_emit_compare (LEU, s390_compare_op0, s390_compare_op1)); DONE;")
6348 (define_expand "bunordered"
6349 [(match_operand 0 "" "")]
6351 "s390_emit_jump (operands[0],
6352 s390_emit_compare (UNORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6354 (define_expand "bordered"
6355 [(match_operand 0 "" "")]
6357 "s390_emit_jump (operands[0],
6358 s390_emit_compare (ORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6360 (define_expand "buneq"
6361 [(match_operand 0 "" "")]
6363 "s390_emit_jump (operands[0],
6364 s390_emit_compare (UNEQ, s390_compare_op0, s390_compare_op1)); DONE;")
6366 (define_expand "bunlt"
6367 [(match_operand 0 "" "")]
6369 "s390_emit_jump (operands[0],
6370 s390_emit_compare (UNLT, s390_compare_op0, s390_compare_op1)); DONE;")
6372 (define_expand "bungt"
6373 [(match_operand 0 "" "")]
6375 "s390_emit_jump (operands[0],
6376 s390_emit_compare (UNGT, s390_compare_op0, s390_compare_op1)); DONE;")
6378 (define_expand "bunle"
6379 [(match_operand 0 "" "")]
6381 "s390_emit_jump (operands[0],
6382 s390_emit_compare (UNLE, s390_compare_op0, s390_compare_op1)); DONE;")
6384 (define_expand "bunge"
6385 [(match_operand 0 "" "")]
6387 "s390_emit_jump (operands[0],
6388 s390_emit_compare (UNGE, s390_compare_op0, s390_compare_op1)); DONE;")
6390 (define_expand "bltgt"
6391 [(match_operand 0 "" "")]
6393 "s390_emit_jump (operands[0],
6394 s390_emit_compare (LTGT, s390_compare_op0, s390_compare_op1)); DONE;")
6398 ;;- Conditional jump instructions.
6401 (define_insn "*cjump_64"
6404 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6405 (label_ref (match_operand 0 "" ""))
6409 if (get_attr_length (insn) == 4)
6412 return "jg%C1\t%l0";
6414 [(set_attr "op_type" "RI")
6415 (set_attr "type" "branch")
6416 (set (attr "length")
6417 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6418 (const_int 4) (const_int 6)))])
6420 (define_insn "*cjump_31"
6423 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6424 (label_ref (match_operand 0 "" ""))
6428 if (get_attr_length (insn) == 4)
6433 [(set_attr "op_type" "RI")
6434 (set_attr "type" "branch")
6435 (set (attr "length")
6436 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6437 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6438 (const_int 4) (const_int 6))
6439 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6440 (const_int 4) (const_int 8))))])
6442 (define_insn "*cjump_long"
6445 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6446 (match_operand 0 "address_operand" "U")
6450 if (get_attr_op_type (insn) == OP_TYPE_RR)
6455 [(set (attr "op_type")
6456 (if_then_else (match_operand 0 "register_operand" "")
6457 (const_string "RR") (const_string "RX")))
6458 (set_attr "type" "branch")
6459 (set_attr "atype" "agen")])
6463 ;;- Negated conditional jump instructions.
6466 (define_insn "*icjump_64"
6469 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6471 (label_ref (match_operand 0 "" ""))))]
6474 if (get_attr_length (insn) == 4)
6477 return "jg%D1\t%l0";
6479 [(set_attr "op_type" "RI")
6480 (set_attr "type" "branch")
6481 (set (attr "length")
6482 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6483 (const_int 4) (const_int 6)))])
6485 (define_insn "*icjump_31"
6488 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6490 (label_ref (match_operand 0 "" ""))))]
6493 if (get_attr_length (insn) == 4)
6498 [(set_attr "op_type" "RI")
6499 (set_attr "type" "branch")
6500 (set (attr "length")
6501 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6502 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6503 (const_int 4) (const_int 6))
6504 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6505 (const_int 4) (const_int 8))))])
6507 (define_insn "*icjump_long"
6510 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6512 (match_operand 0 "address_operand" "U")))]
6515 if (get_attr_op_type (insn) == OP_TYPE_RR)
6520 [(set (attr "op_type")
6521 (if_then_else (match_operand 0 "register_operand" "")
6522 (const_string "RR") (const_string "RX")))
6523 (set_attr "type" "branch")
6524 (set_attr "atype" "agen")])
6527 ;;- Trap instructions.
6531 [(trap_if (const_int 1) (const_int 0))]
6534 [(set_attr "op_type" "RI")
6535 (set_attr "type" "branch")])
6537 (define_expand "conditional_trap"
6538 [(trap_if (match_operand 0 "comparison_operator" "")
6539 (match_operand 1 "general_operand" ""))]
6542 if (operands[1] != const0_rtx) FAIL;
6543 operands[0] = s390_emit_compare (GET_CODE (operands[0]),
6544 s390_compare_op0, s390_compare_op1);
6547 (define_insn "*trap"
6548 [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6552 [(set_attr "op_type" "RI")
6553 (set_attr "type" "branch")])
6556 ;;- Loop instructions.
6558 ;; This is all complicated by the fact that since this is a jump insn
6559 ;; we must handle our own output reloads.
6561 (define_expand "doloop_end"
6562 [(use (match_operand 0 "" "")) ; loop pseudo
6563 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6564 (use (match_operand 2 "" "")) ; max iterations
6565 (use (match_operand 3 "" "")) ; loop level
6566 (use (match_operand 4 "" ""))] ; label
6569 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
6570 emit_jump_insn (gen_doloop_si31 (operands[4], operands[0], operands[0]));
6571 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
6572 emit_jump_insn (gen_doloop_si64 (operands[4], operands[0], operands[0]));
6573 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6574 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6581 (define_insn_and_split "doloop_si64"
6584 (ne (match_operand:SI 1 "register_operand" "d,d")
6586 (label_ref (match_operand 0 "" ""))
6588 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6589 (plus:SI (match_dup 1) (const_int -1)))
6590 (clobber (match_scratch:SI 3 "=X,&d"))
6591 (clobber (reg:CC 33))]
6594 if (which_alternative != 0)
6596 else if (get_attr_length (insn) == 4)
6597 return "brct\t%1,%l0";
6599 return "ahi\t%1,-1\;jgne\t%l0";
6601 "&& reload_completed
6602 && (! REG_P (operands[2])
6603 || ! rtx_equal_p (operands[1], operands[2]))"
6604 [(set (match_dup 3) (match_dup 1))
6605 (parallel [(set (reg:CCAN 33)
6606 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6608 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6609 (set (match_dup 2) (match_dup 3))
6610 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6611 (label_ref (match_dup 0))
6614 [(set_attr "op_type" "RI")
6615 (set_attr "type" "branch")
6616 (set (attr "length")
6617 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6618 (const_int 4) (const_int 10)))])
6620 (define_insn_and_split "doloop_si31"
6623 (ne (match_operand:SI 1 "register_operand" "d,d")
6625 (label_ref (match_operand 0 "" ""))
6627 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6628 (plus:SI (match_dup 1) (const_int -1)))
6629 (clobber (match_scratch:SI 3 "=X,&d"))
6630 (clobber (reg:CC 33))]
6633 if (which_alternative != 0)
6635 else if (get_attr_length (insn) == 4)
6636 return "brct\t%1,%l0";
6640 "&& reload_completed
6641 && (! REG_P (operands[2])
6642 || ! rtx_equal_p (operands[1], operands[2]))"
6643 [(set (match_dup 3) (match_dup 1))
6644 (parallel [(set (reg:CCAN 33)
6645 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6647 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6648 (set (match_dup 2) (match_dup 3))
6649 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6650 (label_ref (match_dup 0))
6653 [(set_attr "op_type" "RI")
6654 (set_attr "type" "branch")
6655 (set (attr "length")
6656 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6657 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6658 (const_int 4) (const_int 6))
6659 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6660 (const_int 4) (const_int 8))))])
6662 (define_insn "*doloop_si_long"
6665 (ne (match_operand:SI 1 "register_operand" "d,d")
6667 (match_operand 0 "address_operand" "U,U")
6669 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6670 (plus:SI (match_dup 1) (const_int -1)))
6671 (clobber (match_scratch:SI 3 "=X,&d"))
6672 (clobber (reg:CC 33))]
6675 if (get_attr_op_type (insn) == OP_TYPE_RR)
6676 return "bctr\t%1,%0";
6678 return "bct\t%1,%a0";
6680 [(set (attr "op_type")
6681 (if_then_else (match_operand 0 "register_operand" "")
6682 (const_string "RR") (const_string "RX")))
6683 (set_attr "type" "branch")
6684 (set_attr "atype" "agen")])
6686 (define_insn_and_split "doloop_di"
6689 (ne (match_operand:DI 1 "register_operand" "d,d")
6691 (label_ref (match_operand 0 "" ""))
6693 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?*m*r")
6694 (plus:DI (match_dup 1) (const_int -1)))
6695 (clobber (match_scratch:DI 3 "=X,&d"))
6696 (clobber (reg:CC 33))]
6699 if (which_alternative != 0)
6701 else if (get_attr_length (insn) == 4)
6702 return "brctg\t%1,%l0";
6704 return "aghi\t%1,-1\;jgne\t%l0";
6706 "&& reload_completed
6707 && (! REG_P (operands[2])
6708 || ! rtx_equal_p (operands[1], operands[2]))"
6709 [(set (match_dup 3) (match_dup 1))
6710 (parallel [(set (reg:CCAN 33)
6711 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6713 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6714 (set (match_dup 2) (match_dup 3))
6715 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6716 (label_ref (match_dup 0))
6719 [(set_attr "op_type" "RI")
6720 (set_attr "type" "branch")
6721 (set (attr "length")
6722 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6723 (const_int 4) (const_int 10)))])
6726 ;;- Unconditional jump instructions.
6730 ; jump instruction pattern(s).
6733 (define_expand "jump"
6734 [(match_operand 0 "" "")]
6736 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
6738 (define_insn "*jump64"
6739 [(set (pc) (label_ref (match_operand 0 "" "")))]
6742 if (get_attr_length (insn) == 4)
6747 [(set_attr "op_type" "RI")
6748 (set_attr "type" "branch")
6749 (set (attr "length")
6750 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6751 (const_int 4) (const_int 6)))])
6753 (define_insn "*jump31"
6754 [(set (pc) (label_ref (match_operand 0 "" "")))]
6757 if (get_attr_length (insn) == 4)
6762 [(set_attr "op_type" "RI")
6763 (set_attr "type" "branch")
6764 (set (attr "length")
6765 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6766 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6767 (const_int 4) (const_int 6))
6768 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6769 (const_int 4) (const_int 8))))])
6772 ; indirect-jump instruction pattern(s).
6775 (define_insn "indirect_jump"
6776 [(set (pc) (match_operand 0 "address_operand" "U"))]
6779 if (get_attr_op_type (insn) == OP_TYPE_RR)
6784 [(set (attr "op_type")
6785 (if_then_else (match_operand 0 "register_operand" "")
6786 (const_string "RR") (const_string "RX")))
6787 (set_attr "type" "branch")
6788 (set_attr "atype" "agen")])
6791 ; casesi instruction pattern(s).
6794 (define_insn "casesi_jump"
6795 [(set (pc) (match_operand 0 "address_operand" "U"))
6796 (use (label_ref (match_operand 1 "" "")))]
6799 if (get_attr_op_type (insn) == OP_TYPE_RR)
6804 [(set (attr "op_type")
6805 (if_then_else (match_operand 0 "register_operand" "")
6806 (const_string "RR") (const_string "RX")))
6807 (set_attr "type" "branch")
6808 (set_attr "atype" "agen")])
6810 (define_expand "casesi"
6811 [(match_operand:SI 0 "general_operand" "")
6812 (match_operand:SI 1 "general_operand" "")
6813 (match_operand:SI 2 "general_operand" "")
6814 (label_ref (match_operand 3 "" ""))
6815 (label_ref (match_operand 4 "" ""))]
6818 rtx index = gen_reg_rtx (SImode);
6819 rtx base = gen_reg_rtx (Pmode);
6820 rtx target = gen_reg_rtx (Pmode);
6822 emit_move_insn (index, operands[0]);
6823 emit_insn (gen_subsi3 (index, index, operands[1]));
6824 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6827 if (Pmode != SImode)
6828 index = convert_to_mode (Pmode, index, 1);
6829 if (GET_CODE (index) != REG)
6830 index = copy_to_mode_reg (Pmode, index);
6833 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6835 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
6837 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6839 index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
6840 emit_move_insn (target, index);
6843 target = gen_rtx_PLUS (Pmode, base, target);
6844 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6851 ;;- Jump to subroutine.
6856 ; untyped call instruction pattern(s).
6859 ;; Call subroutine returning any type.
6860 (define_expand "untyped_call"
6861 [(parallel [(call (match_operand 0 "" "")
6863 (match_operand 1 "" "")
6864 (match_operand 2 "" "")])]
6869 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6871 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6873 rtx set = XVECEXP (operands[2], 0, i);
6874 emit_move_insn (SET_DEST (set), SET_SRC (set));
6877 /* The optimizer does not know that the call sets the function value
6878 registers we stored in the result block. We avoid problems by
6879 claiming that all hard registers are used and clobbered at this
6881 emit_insn (gen_blockage ());
6886 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6887 ;; all of memory. This blocks insns from being moved across this point.
6889 (define_insn "blockage"
6890 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6893 [(set_attr "type" "none")
6894 (set_attr "length" "0")])
6900 (define_expand "sibcall"
6901 [(call (match_operand 0 "" "")
6902 (match_operand 1 "" ""))]
6905 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
6909 (define_insn "*sibcall_br"
6910 [(call (mem:QI (reg 1))
6911 (match_operand 0 "const_int_operand" "n"))]
6912 "SIBLING_CALL_P (insn)
6913 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
6915 [(set_attr "op_type" "RR")
6916 (set_attr "type" "branch")
6917 (set_attr "atype" "agen")])
6919 (define_insn "*sibcall_brc"
6920 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6921 (match_operand 1 "const_int_operand" "n"))]
6922 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
6924 [(set_attr "op_type" "RI")
6925 (set_attr "type" "branch")])
6927 (define_insn "*sibcall_brcl"
6928 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6929 (match_operand 1 "const_int_operand" "n"))]
6930 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
6932 [(set_attr "op_type" "RIL")
6933 (set_attr "type" "branch")])
6936 ; sibcall_value patterns
6939 (define_expand "sibcall_value"
6940 [(set (match_operand 0 "" "")
6941 (call (match_operand 1 "" "")
6942 (match_operand 2 "" "")))]
6945 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
6949 (define_insn "*sibcall_value_br"
6950 [(set (match_operand 0 "" "")
6951 (call (mem:QI (reg 1))
6952 (match_operand 1 "const_int_operand" "n")))]
6953 "SIBLING_CALL_P (insn)
6954 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
6956 [(set_attr "op_type" "RR")
6957 (set_attr "type" "branch")
6958 (set_attr "atype" "agen")])
6960 (define_insn "*sibcall_value_brc"
6961 [(set (match_operand 0 "" "")
6962 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
6963 (match_operand 2 "const_int_operand" "n")))]
6964 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
6966 [(set_attr "op_type" "RI")
6967 (set_attr "type" "branch")])
6969 (define_insn "*sibcall_value_brcl"
6970 [(set (match_operand 0 "" "")
6971 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
6972 (match_operand 2 "const_int_operand" "n")))]
6973 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
6975 [(set_attr "op_type" "RIL")
6976 (set_attr "type" "branch")])
6980 ; call instruction pattern(s).
6983 (define_expand "call"
6984 [(call (match_operand 0 "" "")
6985 (match_operand 1 "" ""))
6986 (use (match_operand 2 "" ""))]
6989 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
6990 gen_rtx_REG (Pmode, RETURN_REGNUM));
6994 (define_insn "*bras"
6995 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6996 (match_operand 1 "const_int_operand" "n"))
6997 (clobber (match_operand 2 "register_operand" "=r"))]
6998 "!SIBLING_CALL_P (insn)
6999 && TARGET_SMALL_EXEC
7000 && GET_MODE (operands[2]) == Pmode"
7002 [(set_attr "op_type" "RI")
7003 (set_attr "type" "jsr")])
7005 (define_insn "*brasl"
7006 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7007 (match_operand 1 "const_int_operand" "n"))
7008 (clobber (match_operand 2 "register_operand" "=r"))]
7009 "!SIBLING_CALL_P (insn)
7011 && GET_MODE (operands[2]) == Pmode"
7013 [(set_attr "op_type" "RIL")
7014 (set_attr "type" "jsr")])
7016 (define_insn "*basr"
7017 [(call (mem:QI (match_operand 0 "address_operand" "U"))
7018 (match_operand 1 "const_int_operand" "n"))
7019 (clobber (match_operand 2 "register_operand" "=r"))]
7020 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
7022 if (get_attr_op_type (insn) == OP_TYPE_RR)
7023 return "basr\t%2,%0";
7025 return "bas\t%2,%a0";
7027 [(set (attr "op_type")
7028 (if_then_else (match_operand 0 "register_operand" "")
7029 (const_string "RR") (const_string "RX")))
7030 (set_attr "type" "jsr")
7031 (set_attr "atype" "agen")])
7034 ; call_value instruction pattern(s).
7037 (define_expand "call_value"
7038 [(set (match_operand 0 "" "")
7039 (call (match_operand 1 "" "")
7040 (match_operand 2 "" "")))
7041 (use (match_operand 3 "" ""))]
7044 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
7045 gen_rtx_REG (Pmode, RETURN_REGNUM));
7049 (define_insn "*bras_r"
7050 [(set (match_operand 0 "" "")
7051 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7052 (match_operand:SI 2 "const_int_operand" "n")))
7053 (clobber (match_operand 3 "register_operand" "=r"))]
7054 "!SIBLING_CALL_P (insn)
7055 && TARGET_SMALL_EXEC
7056 && GET_MODE (operands[3]) == Pmode"
7058 [(set_attr "op_type" "RI")
7059 (set_attr "type" "jsr")])
7061 (define_insn "*brasl_r"
7062 [(set (match_operand 0 "" "")
7063 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7064 (match_operand 2 "const_int_operand" "n")))
7065 (clobber (match_operand 3 "register_operand" "=r"))]
7066 "!SIBLING_CALL_P (insn)
7068 && GET_MODE (operands[3]) == Pmode"
7070 [(set_attr "op_type" "RIL")
7071 (set_attr "type" "jsr")])
7073 (define_insn "*basr_r"
7074 [(set (match_operand 0 "" "")
7075 (call (mem:QI (match_operand 1 "address_operand" "U"))
7076 (match_operand 2 "const_int_operand" "n")))
7077 (clobber (match_operand 3 "register_operand" "=r"))]
7078 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7080 if (get_attr_op_type (insn) == OP_TYPE_RR)
7081 return "basr\t%3,%1";
7083 return "bas\t%3,%a1";
7085 [(set (attr "op_type")
7086 (if_then_else (match_operand 1 "register_operand" "")
7087 (const_string "RR") (const_string "RX")))
7088 (set_attr "type" "jsr")
7089 (set_attr "atype" "agen")])
7092 ;;- Thread-local storage support.
7095 (define_insn "get_tp_64"
7096 [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7097 (unspec:DI [(const_int 0)] UNSPEC_TP))]
7100 ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7102 [(set_attr "op_type" "NN,RS")
7103 (set_attr "atype" "reg,*")
7104 (set_attr "type" "o3,*")
7105 (set_attr "length" "14,*")])
7107 (define_insn "get_tp_31"
7108 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7109 (unspec:SI [(const_int 0)] UNSPEC_TP))]
7114 [(set_attr "op_type" "RRE,RS")])
7116 (define_insn "set_tp_64"
7117 [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7118 (clobber (match_scratch:SI 1 "=d,X"))]
7121 sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7123 [(set_attr "op_type" "NN,RS")
7124 (set_attr "atype" "reg,*")
7125 (set_attr "type" "o3,*")
7126 (set_attr "length" "14,*")])
7128 (define_insn "set_tp_31"
7129 [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7134 [(set_attr "op_type" "RRE,RS")])
7136 (define_insn "*tls_load_64"
7137 [(set (match_operand:DI 0 "register_operand" "=d")
7138 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7139 (match_operand:DI 2 "" "")]
7143 [(set_attr "op_type" "RXE")])
7145 (define_insn "*tls_load_31"
7146 [(set (match_operand:SI 0 "register_operand" "=d,d")
7147 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7148 (match_operand:SI 2 "" "")]
7154 [(set_attr "op_type" "RX,RXY")])
7156 (define_insn "*bras_tls"
7157 [(set (match_operand 0 "" "")
7158 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7159 (match_operand 2 "const_int_operand" "n")))
7160 (clobber (match_operand 3 "register_operand" "=r"))
7161 (use (match_operand 4 "" ""))]
7162 "!SIBLING_CALL_P (insn)
7163 && TARGET_SMALL_EXEC
7164 && GET_MODE (operands[3]) == Pmode"
7166 [(set_attr "op_type" "RI")
7167 (set_attr "type" "jsr")])
7169 (define_insn "*brasl_tls"
7170 [(set (match_operand 0 "" "")
7171 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7172 (match_operand 2 "const_int_operand" "n")))
7173 (clobber (match_operand 3 "register_operand" "=r"))
7174 (use (match_operand 4 "" ""))]
7175 "!SIBLING_CALL_P (insn)
7177 && GET_MODE (operands[3]) == Pmode"
7179 [(set_attr "op_type" "RIL")
7180 (set_attr "type" "jsr")])
7182 (define_insn "*basr_tls"
7183 [(set (match_operand 0 "" "")
7184 (call (mem:QI (match_operand 1 "address_operand" "U"))
7185 (match_operand 2 "const_int_operand" "n")))
7186 (clobber (match_operand 3 "register_operand" "=r"))
7187 (use (match_operand 4 "" ""))]
7188 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7190 if (get_attr_op_type (insn) == OP_TYPE_RR)
7191 return "basr\t%3,%1%J4";
7193 return "bas\t%3,%a1%J4";
7195 [(set (attr "op_type")
7196 (if_then_else (match_operand 1 "register_operand" "")
7197 (const_string "RR") (const_string "RX")))
7198 (set_attr "type" "jsr")
7199 (set_attr "atype" "agen")])
7202 ;;- Miscellaneous instructions.
7206 ; allocate stack instruction pattern(s).
7209 (define_expand "allocate_stack"
7211 (plus (reg 15) (match_operand 1 "general_operand" "")))
7212 (set (match_operand 0 "general_operand" "")
7214 "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN"
7216 rtx stack = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
7220 if (TARGET_KERNEL_BACKCHAIN)
7221 chain = plus_constant (stack, STACK_POINTER_OFFSET - UNITS_PER_WORD);
7225 chain = gen_rtx_MEM (Pmode, chain);
7226 temp = gen_reg_rtx (Pmode);
7228 emit_move_insn (temp, chain);
7231 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7233 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7235 emit_move_insn (chain, temp);
7237 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7243 ; setjmp instruction pattern.
7246 (define_expand "builtin_setjmp_receiver"
7247 [(match_operand 0 "" "")]
7250 emit_insn (s390_load_got ());
7251 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7255 ;; These patterns say how to save and restore the stack pointer. We need not
7256 ;; save the stack pointer at function level since we are careful to
7257 ;; preserve the backchain. At block level, we have to restore the backchain
7258 ;; when we restore the stack pointer.
7260 ;; For nonlocal gotos, we must save both the stack pointer and its
7261 ;; backchain and restore both. Note that in the nonlocal case, the
7262 ;; save area is a memory location.
7264 (define_expand "save_stack_function"
7265 [(match_operand 0 "general_operand" "")
7266 (match_operand 1 "general_operand" "")]
7270 (define_expand "restore_stack_function"
7271 [(match_operand 0 "general_operand" "")
7272 (match_operand 1 "general_operand" "")]
7276 (define_expand "restore_stack_block"
7277 [(use (match_operand 0 "register_operand" ""))
7278 (set (match_dup 2) (match_dup 3))
7279 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7280 (set (match_dup 3) (match_dup 2))]
7283 operands[2] = gen_reg_rtx (Pmode);
7284 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7287 (define_expand "save_stack_nonlocal"
7288 [(match_operand 0 "memory_operand" "")
7289 (match_operand 1 "register_operand" "")]
7292 rtx temp = gen_reg_rtx (Pmode);
7294 /* Copy the backchain to the first word, sp to the second and the literal pool
7295 base to the third. */
7296 emit_move_insn (operand_subword (operands[0], 2, 0,
7297 TARGET_64BIT ? OImode : TImode),
7298 gen_rtx_REG (Pmode, BASE_REGNUM));
7299 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7300 emit_move_insn (operand_subword (operands[0], 0, 0,
7301 TARGET_64BIT ? OImode : TImode),
7303 emit_move_insn (operand_subword (operands[0], 1, 0,
7304 TARGET_64BIT ? OImode : TImode),
7309 (define_expand "restore_stack_nonlocal"
7310 [(match_operand 0 "register_operand" "")
7311 (match_operand 1 "memory_operand" "")]
7314 rtx temp = gen_reg_rtx (Pmode);
7315 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
7317 /* Restore the backchain from the first word, sp from the second and the
7318 literal pool base from the third. */
7319 emit_move_insn (temp,
7320 operand_subword (operands[1], 0, 0,
7321 TARGET_64BIT ? OImode : TImode));
7322 emit_move_insn (operands[0],
7323 operand_subword (operands[1], 1, 0,
7324 TARGET_64BIT ? OImode : TImode));
7325 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7326 emit_move_insn (base,
7327 operand_subword (operands[1], 2, 0,
7328 TARGET_64BIT ? OImode : TImode));
7329 emit_insn (gen_rtx_USE (VOIDmode, base));
7336 ; nop instruction pattern(s).
7343 [(set_attr "op_type" "RR")])
7347 ; Special literal pool access instruction pattern(s).
7350 (define_insn "*pool_entry"
7351 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7352 UNSPECV_POOL_ENTRY)]
7355 enum machine_mode mode = GET_MODE (PATTERN (insn));
7356 unsigned int align = GET_MODE_BITSIZE (mode);
7357 s390_output_pool_entry (operands[0], mode, align);
7360 [(set_attr "op_type" "NN")
7361 (set (attr "length")
7362 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7364 (define_insn "pool_start_31"
7365 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7368 [(set_attr "op_type" "NN")
7369 (set_attr "length" "2")])
7371 (define_insn "pool_end_31"
7372 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7375 [(set_attr "op_type" "NN")
7376 (set_attr "length" "2")])
7378 (define_insn "pool_start_64"
7379 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7381 ".section\t.rodata\;.align\t8"
7382 [(set_attr "op_type" "NN")
7383 (set_attr "length" "0")])
7385 (define_insn "pool_end_64"
7386 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7389 [(set_attr "op_type" "NN")
7390 (set_attr "length" "0")])
7392 (define_insn "main_base_31_small"
7393 [(set (match_operand 0 "register_operand" "=a")
7394 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7395 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7397 [(set_attr "op_type" "RR")
7398 (set_attr "type" "la")])
7400 (define_insn "main_base_31_large"
7401 [(set (match_operand 0 "register_operand" "=a")
7402 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7403 (set (pc) (label_ref (match_operand 2 "" "")))]
7404 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7406 [(set_attr "op_type" "RI")])
7408 (define_insn "main_base_64"
7409 [(set (match_operand 0 "register_operand" "=a")
7410 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7411 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7413 [(set_attr "op_type" "RIL")
7414 (set_attr "type" "larl")])
7416 (define_insn "main_pool"
7417 [(set (match_operand 0 "register_operand" "=a")
7418 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
7419 "GET_MODE (operands[0]) == Pmode"
7421 [(set_attr "op_type" "NN")])
7423 (define_insn "reload_base_31"
7424 [(set (match_operand 0 "register_operand" "=a")
7425 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7426 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7427 "basr\t%0,0\;la\t%0,%1-.(%0)"
7428 [(set_attr "op_type" "NN")
7429 (set_attr "type" "la")
7430 (set_attr "length" "6")])
7432 (define_insn "reload_base_64"
7433 [(set (match_operand 0 "register_operand" "=a")
7434 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7435 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7437 [(set_attr "op_type" "RIL")
7438 (set_attr "type" "larl")])
7441 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7444 [(set_attr "op_type" "NN")
7445 (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7448 ;; Insns related to generating the function prologue and epilogue.
7452 (define_expand "prologue"
7453 [(use (const_int 0))]
7455 "s390_emit_prologue (); DONE;")
7457 (define_insn "prologue_tpf"
7458 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_PROLOGUE)
7459 (clobber (reg:DI 1))]
7460 "TARGET_TPF_PROFILING"
7462 [(set_attr "type" "jsr")
7463 (set_attr "op_type" "RX")])
7465 (define_expand "epilogue"
7466 [(use (const_int 1))]
7468 "s390_emit_epilogue (false); DONE;")
7470 (define_insn "epilogue_tpf"
7471 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_EPILOGUE)
7472 (clobber (reg:DI 1))]
7473 "TARGET_TPF_PROFILING"
7475 [(set_attr "type" "jsr")
7476 (set_attr "op_type" "RX")])
7479 (define_expand "sibcall_epilogue"
7480 [(use (const_int 0))]
7482 "s390_emit_epilogue (true); DONE;")
7484 (define_insn "*return"
7486 (use (match_operand 0 "register_operand" "a"))]
7487 "GET_MODE (operands[0]) == Pmode"
7489 [(set_attr "op_type" "RR")
7490 (set_attr "type" "jsr")
7491 (set_attr "atype" "agen")])
7494 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7495 ;; pointer. This is used for compatibility.
7497 (define_expand "ptr_extend"
7498 [(set (match_operand:DI 0 "register_operand" "=r")
7499 (match_operand:SI 1 "register_operand" "r"))]
7502 emit_insn (gen_anddi3 (operands[0],
7503 gen_lowpart (DImode, operands[1]),
7504 GEN_INT (0x7fffffff)));