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 && strict_memory_address_p (VOIDmode, operands[1])
975 && preferred_la_operand_p (operands[1])"
976 [(set (match_dup 0) (match_dup 1))]
980 [(set (match_operand:DI 0 "register_operand" "")
981 (match_operand:DI 1 "register_operand" ""))
984 (plus:DI (match_dup 0)
985 (match_operand:DI 2 "nonmemory_operand" "")))
986 (clobber (reg:CC 33))])]
988 && !reg_overlap_mentioned_p (operands[0], operands[2])
989 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (DImode, operands[1], operands[2]))
990 && preferred_la_operand_p (gen_rtx_PLUS (DImode, operands[1], operands[2]))"
991 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
994 (define_expand "reload_indi"
995 [(parallel [(match_operand:DI 0 "register_operand" "=a")
996 (match_operand:DI 1 "s390_plus_operand" "")
997 (match_operand:DI 2 "register_operand" "=&a")])]
1000 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1005 ; movsi instruction pattern(s).
1008 (define_expand "movsi"
1009 [(set (match_operand:SI 0 "general_operand" "")
1010 (match_operand:SI 1 "general_operand" ""))]
1013 /* Handle symbolic constants. */
1014 if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1015 emit_symbolic_move (operands);
1017 /* expr.c tries to load an effective address using
1018 force_reg. This fails because we don't have a
1019 generic load_address pattern. Convert the move
1020 to a proper arithmetic operation instead, unless
1021 it is guaranteed to be OK. */
1022 if (GET_CODE (operands[1]) == PLUS
1023 && !legitimate_la_operand_p (operands[1]))
1025 operands[1] = force_operand (operands[1], operands[0]);
1026 if (operands[1] == operands[0])
1030 /* During and after reload, we need to force constants
1031 to the literal pool ourselves, if necessary. */
1032 if ((reload_in_progress || reload_completed)
1033 && CONSTANT_P (operands[1])
1034 && (!legitimate_reload_constant_p (operands[1])
1035 || FP_REG_P (operands[0])))
1036 operands[1] = force_const_mem (SImode, operands[1]);
1039 (define_insn "*movsi_larl"
1040 [(set (match_operand:SI 0 "register_operand" "=d")
1041 (match_operand:SI 1 "larl_operand" "X"))]
1042 "!TARGET_64BIT && TARGET_CPU_ZARCH
1043 && !FP_REG_P (operands[0])"
1045 [(set_attr "op_type" "RIL")
1046 (set_attr "type" "larl")])
1048 (define_insn "*movsi_zarch"
1049 [(set (match_operand:SI 0 "nonimmediate_operand"
1050 "=d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,?Q")
1051 (match_operand:SI 1 "general_operand"
1052 "K,N0HS0,N1HS0,L,d,R,T,d,d,*f,R,T,*f,*f,?Q"))]
1070 [(set_attr "op_type" "RI,RI,RI,RXY,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1071 (set_attr "type" "*,*,*,la,lr,load,load,store,store,floads,floads,floads,fstores,fstores,cs")])
1073 (define_insn "*movsi_esa"
1074 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,?Q")
1075 (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,?Q"))]
1086 [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,SS")
1087 (set_attr "type" "*,lr,load,store,floads,floads,fstores,cs")])
1090 [(set (match_operand:SI 0 "register_operand" "")
1091 (mem:SI (match_operand 1 "address_operand" "")))]
1092 "!FP_REG_P (operands[0])
1093 && GET_CODE (operands[1]) == SYMBOL_REF
1094 && CONSTANT_POOL_ADDRESS_P (operands[1])
1095 && get_pool_mode (operands[1]) == SImode
1096 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1097 [(set (match_dup 0) (match_dup 2))]
1098 "operands[2] = get_pool_constant (operands[1]);")
1100 (define_insn "*la_31"
1101 [(set (match_operand:SI 0 "register_operand" "=d,d")
1102 (match_operand:QI 1 "address_operand" "U,W"))]
1103 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1107 [(set_attr "op_type" "RX,RXY")
1108 (set_attr "type" "la")])
1112 [(set (match_operand:SI 0 "register_operand" "")
1113 (match_operand:QI 1 "address_operand" ""))
1114 (clobber (reg:CC 33))])]
1116 && strict_memory_address_p (VOIDmode, operands[1])
1117 && preferred_la_operand_p (operands[1])"
1118 [(set (match_dup 0) (match_dup 1))]
1122 [(set (match_operand:SI 0 "register_operand" "")
1123 (match_operand:SI 1 "register_operand" ""))
1126 (plus:SI (match_dup 0)
1127 (match_operand:SI 2 "nonmemory_operand" "")))
1128 (clobber (reg:CC 33))])]
1130 && !reg_overlap_mentioned_p (operands[0], operands[2])
1131 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
1132 && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
1133 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1136 (define_insn "*la_31_and"
1137 [(set (match_operand:SI 0 "register_operand" "=d,d")
1138 (and:SI (match_operand:QI 1 "address_operand" "U,W")
1139 (const_int 2147483647)))]
1144 [(set_attr "op_type" "RX,RXY")
1145 (set_attr "type" "la")])
1147 (define_insn_and_split "*la_31_and_cc"
1148 [(set (match_operand:SI 0 "register_operand" "=d")
1149 (and:SI (match_operand:QI 1 "address_operand" "p")
1150 (const_int 2147483647)))
1151 (clobber (reg:CC 33))]
1154 "&& reload_completed"
1156 (and:SI (match_dup 1) (const_int 2147483647)))]
1158 [(set_attr "op_type" "RX")
1159 (set_attr "type" "la")])
1161 (define_insn "force_la_31"
1162 [(set (match_operand:SI 0 "register_operand" "=d,d")
1163 (match_operand:QI 1 "address_operand" "U,W"))
1164 (use (const_int 0))]
1169 [(set_attr "op_type" "RX")
1170 (set_attr "type" "la")])
1172 (define_expand "reload_insi"
1173 [(parallel [(match_operand:SI 0 "register_operand" "=a")
1174 (match_operand:SI 1 "s390_plus_operand" "")
1175 (match_operand:SI 2 "register_operand" "=&a")])]
1178 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1183 ; movhi instruction pattern(s).
1186 (define_expand "movhi"
1187 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1188 (match_operand:HI 1 "general_operand" ""))]
1191 /* Make it explicit that loading a register from memory
1192 always sign-extends (at least) to SImode. */
1193 if (optimize && !no_new_pseudos
1194 && register_operand (operands[0], VOIDmode)
1195 && GET_CODE (operands[1]) == MEM)
1197 rtx tmp = gen_reg_rtx (SImode);
1198 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1199 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1200 operands[1] = gen_lowpart (HImode, tmp);
1204 (define_insn "*movhi"
1205 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1206 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1216 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1217 (set_attr "type" "lr,*,*,*,store,store,cs")])
1220 [(set (match_operand:HI 0 "register_operand" "")
1221 (mem:HI (match_operand 1 "address_operand" "")))]
1222 "GET_CODE (operands[1]) == SYMBOL_REF
1223 && CONSTANT_POOL_ADDRESS_P (operands[1])
1224 && get_pool_mode (operands[1]) == HImode
1225 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1226 [(set (match_dup 0) (match_dup 2))]
1227 "operands[2] = get_pool_constant (operands[1]);")
1230 ; movqi instruction pattern(s).
1233 (define_expand "movqi"
1234 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1235 (match_operand:QI 1 "general_operand" ""))]
1238 /* On z/Architecture, zero-extending from memory to register
1239 is just as fast as a QImode load. */
1240 if (TARGET_ZARCH && optimize && !no_new_pseudos
1241 && register_operand (operands[0], VOIDmode)
1242 && GET_CODE (operands[1]) == MEM)
1244 rtx tmp = gen_reg_rtx (word_mode);
1245 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1246 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1247 operands[1] = gen_lowpart (QImode, tmp);
1251 (define_insn "*movqi"
1252 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1253 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1265 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1266 (set_attr "type" "lr,*,*,*,store,store,store,store,cs")])
1269 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1270 (mem:QI (match_operand 1 "address_operand" "")))]
1271 "GET_CODE (operands[1]) == SYMBOL_REF
1272 && CONSTANT_POOL_ADDRESS_P (operands[1])
1273 && get_pool_mode (operands[1]) == QImode
1274 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1275 [(set (match_dup 0) (match_dup 2))]
1276 "operands[2] = get_pool_constant (operands[1]);")
1279 ; movstrictqi instruction pattern(s).
1282 (define_insn "*movstrictqi"
1283 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1284 (match_operand:QI 1 "memory_operand" "R,T"))]
1289 [(set_attr "op_type" "RX,RXY")])
1292 ; movstricthi instruction pattern(s).
1295 (define_insn "*movstricthi"
1296 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1297 (match_operand:HI 1 "s_imm_operand" "Q,S"))
1298 (clobber (reg:CC 33))]
1303 [(set_attr "op_type" "RS,RSY")])
1306 ; movstrictsi instruction pattern(s).
1309 (define_insn "movstrictsi"
1310 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d"))
1311 (match_operand:SI 1 "general_operand" "d,R,T"))]
1317 [(set_attr "op_type" "RR,RX,RXY")
1318 (set_attr "type" "lr,load,load")])
1321 ; movdf instruction pattern(s).
1324 (define_expand "movdf"
1325 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1326 (match_operand:DF 1 "general_operand" ""))]
1329 /* During and after reload, we need to force constants
1330 to the literal pool ourselves, if necessary. */
1331 if ((reload_in_progress || reload_completed)
1332 && CONSTANT_P (operands[1]))
1333 operands[1] = force_const_mem (DFmode, operands[1]);
1336 (define_insn "*movdf_64"
1337 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1338 (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1350 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1351 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,cs")])
1353 (define_insn "*movdf_31"
1354 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1355 (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1368 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,NN,NN,SS")
1369 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,cs")])
1372 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1373 (match_operand:DF 1 "general_operand" ""))]
1374 "!TARGET_64BIT && reload_completed
1375 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1376 [(set (match_dup 2) (match_dup 4))
1377 (set (match_dup 3) (match_dup 5))]
1379 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1380 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1381 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1382 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1386 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1387 (match_operand:DF 1 "general_operand" ""))]
1388 "!TARGET_64BIT && reload_completed
1389 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1390 [(set (match_dup 2) (match_dup 4))
1391 (set (match_dup 3) (match_dup 5))]
1393 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1394 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1395 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1396 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1400 [(set (match_operand:DF 0 "register_operand" "")
1401 (match_operand:DF 1 "memory_operand" ""))]
1402 "!TARGET_64BIT && reload_completed
1403 && !FP_REG_P (operands[0])
1404 && !s_operand (operands[1], VOIDmode)"
1405 [(set (match_dup 0) (match_dup 1))]
1407 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1408 s390_load_address (addr, XEXP (operands[1], 0));
1409 operands[1] = replace_equiv_address (operands[1], addr);
1412 (define_expand "reload_outdf"
1413 [(parallel [(match_operand:DF 0 "memory_operand" "")
1414 (match_operand:DF 1 "register_operand" "d")
1415 (match_operand:SI 2 "register_operand" "=&a")])]
1418 s390_load_address (operands[2], XEXP (operands[0], 0));
1419 operands[0] = replace_equiv_address (operands[0], operands[2]);
1420 emit_move_insn (operands[0], operands[1]);
1425 ; movsf instruction pattern(s).
1428 (define_expand "movsf"
1429 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1430 (match_operand:SF 1 "general_operand" ""))]
1433 /* During and after reload, we need to force constants
1434 to the literal pool ourselves, if necessary. */
1435 if ((reload_in_progress || reload_completed)
1436 && CONSTANT_P (operands[1]))
1437 operands[1] = force_const_mem (SFmode, operands[1]);
1440 (define_insn "*movsf"
1441 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1442 (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1456 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1457 (set_attr "type" "floads,floads,floads,fstores,fstores,lr,load,load,store,store,cs")])
1460 ; load_multiple pattern(s).
1462 ; ??? Due to reload problems with replacing registers inside match_parallel
1463 ; we currently support load_multiple/store_multiple only after reload.
1466 (define_expand "load_multiple"
1467 [(match_par_dup 3 [(set (match_operand 0 "" "")
1468 (match_operand 1 "" ""))
1469 (use (match_operand 2 "" ""))])]
1472 enum machine_mode mode;
1478 /* Support only loading a constant number of fixed-point registers from
1479 memory and only bother with this if more than two */
1480 if (GET_CODE (operands[2]) != CONST_INT
1481 || INTVAL (operands[2]) < 2
1482 || INTVAL (operands[2]) > 16
1483 || GET_CODE (operands[1]) != MEM
1484 || GET_CODE (operands[0]) != REG
1485 || REGNO (operands[0]) >= 16)
1488 count = INTVAL (operands[2]);
1489 regno = REGNO (operands[0]);
1490 mode = GET_MODE (operands[0]);
1491 if (mode != SImode && mode != word_mode)
1494 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1497 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1499 from = XEXP (operands[1], 0);
1502 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1503 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1504 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1506 from = XEXP (XEXP (operands[1], 0), 0);
1507 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1514 from = force_reg (Pmode, XEXP (operands[1], 0));
1518 for (i = 0; i < count; i++)
1519 XVECEXP (operands[3], 0, i)
1520 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1521 change_address (operands[1], mode,
1522 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1525 (define_insn "*load_multiple_di"
1526 [(match_parallel 0 "load_multiple_operation"
1527 [(set (match_operand:DI 1 "register_operand" "=r")
1528 (match_operand:DI 2 "s_operand" "QS"))])]
1529 "reload_completed && word_mode == DImode"
1531 int words = XVECLEN (operands[0], 0);
1532 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1533 return "lmg\t%1,%0,%2";
1535 [(set_attr "op_type" "RSY")
1536 (set_attr "type" "lm")])
1538 (define_insn "*load_multiple_si"
1539 [(match_parallel 0 "load_multiple_operation"
1540 [(set (match_operand:SI 1 "register_operand" "=r,r")
1541 (match_operand:SI 2 "s_operand" "Q,S"))])]
1544 int words = XVECLEN (operands[0], 0);
1545 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1546 return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1548 [(set_attr "op_type" "RS,RSY")
1549 (set_attr "type" "lm")])
1552 ; store multiple pattern(s).
1555 (define_expand "store_multiple"
1556 [(match_par_dup 3 [(set (match_operand 0 "" "")
1557 (match_operand 1 "" ""))
1558 (use (match_operand 2 "" ""))])]
1561 enum machine_mode mode;
1567 /* Support only storing a constant number of fixed-point registers to
1568 memory and only bother with this if more than two. */
1569 if (GET_CODE (operands[2]) != CONST_INT
1570 || INTVAL (operands[2]) < 2
1571 || INTVAL (operands[2]) > 16
1572 || GET_CODE (operands[0]) != MEM
1573 || GET_CODE (operands[1]) != REG
1574 || REGNO (operands[1]) >= 16)
1577 count = INTVAL (operands[2]);
1578 regno = REGNO (operands[1]);
1579 mode = GET_MODE (operands[1]);
1580 if (mode != SImode && mode != word_mode)
1583 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1587 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1589 to = XEXP (operands[0], 0);
1592 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1593 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1594 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1596 to = XEXP (XEXP (operands[0], 0), 0);
1597 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1604 to = force_reg (Pmode, XEXP (operands[0], 0));
1608 for (i = 0; i < count; i++)
1609 XVECEXP (operands[3], 0, i)
1610 = gen_rtx_SET (VOIDmode,
1611 change_address (operands[0], mode,
1612 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1613 gen_rtx_REG (mode, regno + i));
1616 (define_insn "*store_multiple_di"
1617 [(match_parallel 0 "store_multiple_operation"
1618 [(set (match_operand:DI 1 "s_operand" "=QS")
1619 (match_operand:DI 2 "register_operand" "r"))])]
1620 "reload_completed && word_mode == DImode"
1622 int words = XVECLEN (operands[0], 0);
1623 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1624 return "stmg\t%2,%0,%1";
1626 [(set_attr "op_type" "RSY")
1627 (set_attr "type" "stm")])
1630 (define_insn "*store_multiple_si"
1631 [(match_parallel 0 "store_multiple_operation"
1632 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1633 (match_operand:SI 2 "register_operand" "r,r"))])]
1636 int words = XVECLEN (operands[0], 0);
1637 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1638 return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1640 [(set_attr "op_type" "RS,RSY")
1641 (set_attr "type" "stm")])
1644 ;; String instructions.
1648 ; strlenM instruction pattern(s).
1651 (define_expand "strlendi"
1652 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1655 (unspec:DI [(const_int 0)
1656 (match_operand:BLK 1 "memory_operand" "")
1658 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1659 (clobber (scratch:DI))
1660 (clobber (reg:CC 33))])
1662 [(set (match_operand:DI 0 "register_operand" "")
1663 (minus:DI (match_dup 4) (match_dup 5)))
1664 (clobber (reg:CC 33))])]
1667 operands[4] = gen_reg_rtx (DImode);
1668 operands[5] = gen_reg_rtx (DImode);
1669 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1670 operands[1] = replace_equiv_address (operands[1], operands[5]);
1673 (define_insn "*strlendi"
1674 [(set (match_operand:DI 0 "register_operand" "=a")
1675 (unspec:DI [(match_operand:DI 2 "general_operand" "0")
1676 (mem:BLK (match_operand:DI 3 "register_operand" "1"))
1678 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1679 (clobber (match_scratch:DI 1 "=a"))
1680 (clobber (reg:CC 33))]
1682 "srst\t%0,%1\;jo\t.-4"
1683 [(set_attr "op_type" "NN")
1684 (set_attr "type" "vs")
1685 (set_attr "length" "8")])
1687 (define_expand "strlensi"
1688 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1691 (unspec:SI [(const_int 0)
1692 (match_operand:BLK 1 "memory_operand" "")
1694 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1695 (clobber (scratch:SI))
1696 (clobber (reg:CC 33))])
1698 [(set (match_operand:SI 0 "register_operand" "")
1699 (minus:SI (match_dup 4) (match_dup 5)))
1700 (clobber (reg:CC 33))])]
1703 operands[4] = gen_reg_rtx (SImode);
1704 operands[5] = gen_reg_rtx (SImode);
1705 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1706 operands[1] = replace_equiv_address (operands[1], operands[5]);
1709 (define_insn "*strlensi"
1710 [(set (match_operand:SI 0 "register_operand" "=a")
1711 (unspec:SI [(match_operand:SI 2 "general_operand" "0")
1712 (mem:BLK (match_operand:SI 3 "register_operand" "1"))
1714 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1715 (clobber (match_scratch:SI 1 "=a"))
1716 (clobber (reg:CC 33))]
1718 "srst\t%0,%1\;jo\t.-4"
1719 [(set_attr "op_type" "NN")
1720 (set_attr "type" "vs")
1721 (set_attr "length" "8")])
1724 ; movmemM instruction pattern(s).
1727 (define_expand "movmemdi"
1728 [(set (match_operand:BLK 0 "memory_operand" "")
1729 (match_operand:BLK 1 "memory_operand" ""))
1730 (use (match_operand:DI 2 "general_operand" ""))
1731 (match_operand 3 "" "")]
1733 "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
1735 (define_expand "movmemsi"
1736 [(set (match_operand:BLK 0 "memory_operand" "")
1737 (match_operand:BLK 1 "memory_operand" ""))
1738 (use (match_operand:SI 2 "general_operand" ""))
1739 (match_operand 3 "" "")]
1741 "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
1743 ; Move a block that is up to 256 bytes in length.
1744 ; The block length is taken as (operands[2] % 256) + 1.
1746 (define_expand "movmem_short"
1748 [(set (match_operand:BLK 0 "memory_operand" "")
1749 (match_operand:BLK 1 "memory_operand" ""))
1750 (use (match_operand 2 "nonmemory_operand" ""))
1751 (clobber (match_dup 3))])]
1753 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1755 (define_insn "*movmem_short"
1756 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1757 (match_operand:BLK 1 "memory_operand" "Q,Q"))
1758 (use (match_operand 2 "nonmemory_operand" "n,a"))
1759 (clobber (match_scratch 3 "=X,&a"))]
1760 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
1761 && GET_MODE (operands[3]) == Pmode"
1763 switch (which_alternative)
1766 return "mvc\t%O0(%b2+1,%R0),%1";
1769 output_asm_insn ("bras\t%3,.+10", operands);
1770 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
1771 return "ex\t%2,0(%3)";
1777 [(set_attr "op_type" "SS,NN")
1778 (set_attr "type" "cs,cs")
1779 (set_attr "atype" "*,agen")
1780 (set_attr "length" "*,14")])
1782 ; Move a block of arbitrary length.
1784 (define_expand "movmem_long"
1786 [(clobber (match_dup 2))
1787 (clobber (match_dup 3))
1788 (set (match_operand:BLK 0 "memory_operand" "")
1789 (match_operand:BLK 1 "memory_operand" ""))
1790 (use (match_operand 2 "general_operand" ""))
1792 (clobber (reg:CC 33))])]
1795 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1796 rtx reg0 = gen_reg_rtx (dword_mode);
1797 rtx reg1 = gen_reg_rtx (dword_mode);
1798 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1799 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
1800 rtx len0 = gen_lowpart (Pmode, reg0);
1801 rtx len1 = gen_lowpart (Pmode, reg1);
1803 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1804 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1805 emit_move_insn (len0, operands[2]);
1807 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
1808 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1809 emit_move_insn (len1, operands[2]);
1811 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1812 operands[1] = replace_equiv_address_nv (operands[1], addr1);
1817 (define_insn "*movmem_long_64"
1818 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1819 (clobber (match_operand:TI 1 "register_operand" "=d"))
1820 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1821 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
1824 (clobber (reg:CC 33))]
1826 "mvcle\t%0,%1,0\;jo\t.-4"
1827 [(set_attr "op_type" "NN")
1828 (set_attr "type" "vs")
1829 (set_attr "length" "8")])
1831 (define_insn "*movmem_long_31"
1832 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1833 (clobber (match_operand:DI 1 "register_operand" "=d"))
1834 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1835 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
1838 (clobber (reg:CC 33))]
1840 "mvcle\t%0,%1,0\;jo\t.-4"
1841 [(set_attr "op_type" "NN")
1842 (set_attr "type" "vs")
1843 (set_attr "length" "8")])
1846 ; clrmemM instruction pattern(s).
1849 (define_expand "clrmemdi"
1850 [(set (match_operand:BLK 0 "memory_operand" "")
1852 (use (match_operand:DI 1 "general_operand" ""))
1853 (match_operand 2 "" "")]
1855 "s390_expand_clrmem (operands[0], operands[1]); DONE;")
1857 (define_expand "clrmemsi"
1858 [(set (match_operand:BLK 0 "memory_operand" "")
1860 (use (match_operand:SI 1 "general_operand" ""))
1861 (match_operand 2 "" "")]
1863 "s390_expand_clrmem (operands[0], operands[1]); DONE;")
1865 ; Clear a block that is up to 256 bytes in length.
1866 ; The block length is taken as (operands[1] % 256) + 1.
1868 (define_expand "clrmem_short"
1870 [(set (match_operand:BLK 0 "memory_operand" "")
1872 (use (match_operand 1 "nonmemory_operand" ""))
1873 (clobber (match_dup 2))
1874 (clobber (reg:CC 33))])]
1876 "operands[2] = gen_rtx_SCRATCH (Pmode);")
1878 (define_insn "*clrmem_short"
1879 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1881 (use (match_operand 1 "nonmemory_operand" "n,a"))
1882 (clobber (match_scratch 2 "=X,&a"))
1883 (clobber (reg:CC 33))]
1884 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
1885 && GET_MODE (operands[2]) == Pmode"
1887 switch (which_alternative)
1890 return "xc\t%O0(%b1+1,%R0),%0";
1893 output_asm_insn ("bras\t%2,.+10", operands);
1894 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
1895 return "ex\t%1,0(%2)";
1901 [(set_attr "op_type" "SS,NN")
1902 (set_attr "type" "cs,cs")
1903 (set_attr "atype" "*,agen")
1904 (set_attr "length" "*,14")])
1906 ; Clear a block of arbitrary length.
1908 (define_expand "clrmem_long"
1910 [(clobber (match_dup 1))
1911 (set (match_operand:BLK 0 "memory_operand" "")
1913 (use (match_operand 1 "general_operand" ""))
1915 (clobber (reg:CC 33))])]
1918 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1919 rtx reg0 = gen_reg_rtx (dword_mode);
1920 rtx reg1 = gen_reg_rtx (dword_mode);
1921 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1922 rtx len0 = gen_lowpart (Pmode, reg0);
1924 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1925 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1926 emit_move_insn (len0, operands[1]);
1928 emit_move_insn (reg1, const0_rtx);
1930 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1935 (define_insn "*clrmem_long_64"
1936 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1937 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1940 (use (match_operand:TI 1 "register_operand" "d"))
1941 (clobber (reg:CC 33))]
1943 "mvcle\t%0,%1,0\;jo\t.-4"
1944 [(set_attr "op_type" "NN")
1945 (set_attr "type" "vs")
1946 (set_attr "length" "8")])
1948 (define_insn "*clrmem_long_31"
1949 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1950 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1953 (use (match_operand:DI 1 "register_operand" "d"))
1954 (clobber (reg:CC 33))]
1956 "mvcle\t%0,%1,0\;jo\t.-4"
1957 [(set_attr "op_type" "NN")
1958 (set_attr "type" "vs")
1959 (set_attr "length" "8")])
1962 ; cmpmemM instruction pattern(s).
1965 (define_expand "cmpmemdi"
1966 [(set (match_operand:DI 0 "register_operand" "")
1967 (compare:DI (match_operand:BLK 1 "memory_operand" "")
1968 (match_operand:BLK 2 "memory_operand" "") ) )
1969 (use (match_operand:DI 3 "general_operand" ""))
1970 (use (match_operand:DI 4 "" ""))]
1972 "s390_expand_cmpmem (operands[0], operands[1],
1973 operands[2], operands[3]); DONE;")
1975 (define_expand "cmpmemsi"
1976 [(set (match_operand:SI 0 "register_operand" "")
1977 (compare:SI (match_operand:BLK 1 "memory_operand" "")
1978 (match_operand:BLK 2 "memory_operand" "") ) )
1979 (use (match_operand:SI 3 "general_operand" ""))
1980 (use (match_operand:SI 4 "" ""))]
1982 "s390_expand_cmpmem (operands[0], operands[1],
1983 operands[2], operands[3]); DONE;")
1985 ; Compare a block that is up to 256 bytes in length.
1986 ; The block length is taken as (operands[2] % 256) + 1.
1988 (define_expand "cmpmem_short"
1991 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
1992 (match_operand:BLK 1 "memory_operand" "")))
1993 (use (match_operand 2 "nonmemory_operand" ""))
1994 (clobber (match_dup 3))])]
1996 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1998 (define_insn "*cmpmem_short"
2000 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2001 (match_operand:BLK 1 "memory_operand" "Q,Q")))
2002 (use (match_operand 2 "nonmemory_operand" "n,a"))
2003 (clobber (match_scratch 3 "=X,&a"))]
2004 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2005 && GET_MODE (operands[3]) == Pmode"
2007 switch (which_alternative)
2010 return "clc\t%O0(%b2+1,%R0),%1";
2013 output_asm_insn ("bras\t%3,.+10", operands);
2014 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2015 return "ex\t%2,0(%3)";
2021 [(set_attr "op_type" "SS,NN")
2022 (set_attr "type" "cs,cs")
2023 (set_attr "atype" "*,agen")
2024 (set_attr "length" "*,14")])
2026 ; Compare a block of arbitrary length.
2028 (define_expand "cmpmem_long"
2030 [(clobber (match_dup 2))
2031 (clobber (match_dup 3))
2033 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2034 (match_operand:BLK 1 "memory_operand" "")))
2035 (use (match_operand 2 "general_operand" ""))
2036 (use (match_dup 3))])]
2039 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2040 rtx reg0 = gen_reg_rtx (dword_mode);
2041 rtx reg1 = gen_reg_rtx (dword_mode);
2042 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2043 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2044 rtx len0 = gen_lowpart (Pmode, reg0);
2045 rtx len1 = gen_lowpart (Pmode, reg1);
2047 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2048 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2049 emit_move_insn (len0, operands[2]);
2051 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2052 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2053 emit_move_insn (len1, operands[2]);
2055 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2056 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2061 (define_insn "*cmpmem_long_64"
2062 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2063 (clobber (match_operand:TI 1 "register_operand" "=d"))
2065 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2066 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2068 (use (match_dup 3))]
2070 "clcle\t%0,%1,0\;jo\t.-4"
2071 [(set_attr "op_type" "NN")
2072 (set_attr "type" "vs")
2073 (set_attr "length" "8")])
2075 (define_insn "*cmpmem_long_31"
2076 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2077 (clobber (match_operand:DI 1 "register_operand" "=d"))
2079 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2080 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2082 (use (match_dup 3))]
2084 "clcle\t%0,%1,0\;jo\t.-4"
2085 [(set_attr "op_type" "NN")
2086 (set_attr "type" "vs")
2087 (set_attr "length" "8")])
2089 ; Convert condition code to integer in range (-1, 0, 1)
2091 (define_insn "cmpint_si"
2092 [(set (match_operand:SI 0 "register_operand" "=d")
2093 (compare:SI (reg:CCS 33) (const_int 0)))]
2096 output_asm_insn ("lhi\t%0,1", operands);
2097 output_asm_insn ("jh\t.+12", operands);
2098 output_asm_insn ("jl\t.+6", operands);
2099 output_asm_insn ("sr\t%0,%0", operands);
2100 return "lcr\t%0,%0";
2102 [(set_attr "op_type" "NN")
2103 (set_attr "length" "16")
2104 (set_attr "type" "other")])
2106 (define_insn "cmpint_di"
2107 [(set (match_operand:DI 0 "register_operand" "=d")
2108 (compare:DI (reg:CCS 33) (const_int 0)))]
2111 output_asm_insn ("lghi\t%0,1", operands);
2112 output_asm_insn ("jh\t.+16", operands);
2113 output_asm_insn ("jl\t.+8", operands);
2114 output_asm_insn ("sgr\t%0,%0", operands);
2115 return "lcgr\t%0,%0";
2117 [(set_attr "op_type" "NN")
2118 (set_attr "length" "20")
2119 (set_attr "type" "other")])
2123 ;;- Conversion instructions.
2126 (define_insn "*sethighqisi"
2127 [(set (match_operand:SI 0 "register_operand" "=d,d")
2128 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2129 (clobber (reg:CC 33))]
2134 [(set_attr "op_type" "RS,RSY")])
2136 (define_insn "*sethighhisi"
2137 [(set (match_operand:SI 0 "register_operand" "=d,d")
2138 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2139 (clobber (reg:CC 33))]
2144 [(set_attr "op_type" "RS,RSY")])
2146 (define_insn "*sethighqidi_64"
2147 [(set (match_operand:DI 0 "register_operand" "=d")
2148 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2149 (clobber (reg:CC 33))]
2152 [(set_attr "op_type" "RSY")])
2154 (define_insn "*sethighqidi_31"
2155 [(set (match_operand:DI 0 "register_operand" "=d,d")
2156 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2157 (clobber (reg:CC 33))]
2162 [(set_attr "op_type" "RS,RSY")])
2164 (define_insn_and_split "*extractqi"
2165 [(set (match_operand:SI 0 "register_operand" "=d")
2166 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2167 (match_operand 2 "const_int_operand" "n")
2169 (clobber (reg:CC 33))]
2171 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2173 "&& reload_completed"
2175 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2176 (clobber (reg:CC 33))])
2177 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2179 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2180 operands[1] = change_address (operands[1], QImode, 0);
2182 [(set_attr "atype" "agen")])
2184 (define_insn_and_split "*extracthi"
2185 [(set (match_operand:SI 0 "register_operand" "=d")
2186 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2187 (match_operand 2 "const_int_operand" "n")
2189 (clobber (reg:CC 33))]
2191 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2193 "&& reload_completed"
2195 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2196 (clobber (reg:CC 33))])
2197 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2199 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2200 operands[1] = change_address (operands[1], HImode, 0);
2202 [(set_attr "atype" "agen")])
2205 ; extendsidi2 instruction pattern(s).
2208 (define_expand "extendsidi2"
2209 [(set (match_operand:DI 0 "register_operand" "")
2210 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2216 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2217 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2218 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2219 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2225 (define_insn "*extendsidi2"
2226 [(set (match_operand:DI 0 "register_operand" "=d,d")
2227 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2232 [(set_attr "op_type" "RRE,RXY")])
2235 ; extendhidi2 instruction pattern(s).
2238 (define_expand "extendhidi2"
2239 [(set (match_operand:DI 0 "register_operand" "")
2240 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2246 rtx tmp = gen_reg_rtx (SImode);
2247 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2248 emit_insn (gen_extendsidi2 (operands[0], tmp));
2253 operands[1] = gen_lowpart (DImode, operands[1]);
2254 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2255 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2261 (define_insn "*extendhidi2"
2262 [(set (match_operand:DI 0 "register_operand" "=d")
2263 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2266 [(set_attr "op_type" "RXY")])
2269 ; extendqidi2 instruction pattern(s).
2272 (define_expand "extendqidi2"
2273 [(set (match_operand:DI 0 "register_operand" "")
2274 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2280 rtx tmp = gen_reg_rtx (SImode);
2281 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2282 emit_insn (gen_extendsidi2 (operands[0], tmp));
2287 operands[1] = gen_lowpart (DImode, operands[1]);
2288 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2289 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2295 (define_insn "*extendqidi2"
2296 [(set (match_operand:DI 0 "register_operand" "=d")
2297 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2298 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2300 [(set_attr "op_type" "RXY")])
2302 (define_insn_and_split "*extendqidi2_short_displ"
2303 [(set (match_operand:DI 0 "register_operand" "=d")
2304 (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))
2305 (clobber (reg:CC 33))]
2306 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2308 "&& reload_completed"
2310 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2311 (clobber (reg:CC 33))])
2313 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2314 (clobber (reg:CC 33))])]
2318 ; extendhisi2 instruction pattern(s).
2321 (define_expand "extendhisi2"
2322 [(set (match_operand:SI 0 "register_operand" "")
2323 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2327 operands[1] = gen_lowpart (SImode, operands[1]);
2328 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2329 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2334 (define_insn "*extendhisi2"
2335 [(set (match_operand:SI 0 "register_operand" "=d,d")
2336 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2341 [(set_attr "op_type" "RX,RXY")])
2344 ; extendqisi2 instruction pattern(s).
2347 (define_expand "extendqisi2"
2348 [(set (match_operand:SI 0 "register_operand" "")
2349 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2353 operands[1] = gen_lowpart (SImode, operands[1]);
2354 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2355 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2360 (define_insn "*extendqisi2"
2361 [(set (match_operand:SI 0 "register_operand" "=d")
2362 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2363 "TARGET_LONG_DISPLACEMENT"
2365 [(set_attr "op_type" "RXY")])
2367 (define_insn_and_split "*extendqisi2_short_displ"
2368 [(set (match_operand:SI 0 "register_operand" "=d")
2369 (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))
2370 (clobber (reg:CC 33))]
2371 "!TARGET_LONG_DISPLACEMENT"
2373 "&& reload_completed"
2375 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2376 (clobber (reg:CC 33))])
2378 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2379 (clobber (reg:CC 33))])]
2383 ; extendqihi2 instruction pattern(s).
2388 ; zero_extendsidi2 instruction pattern(s).
2391 (define_expand "zero_extendsidi2"
2392 [(set (match_operand:DI 0 "register_operand" "")
2393 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2399 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2400 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2401 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2407 (define_insn "*zero_extendsidi2"
2408 [(set (match_operand:DI 0 "register_operand" "=d,d")
2409 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2414 [(set_attr "op_type" "RRE,RXY")])
2417 ; zero_extendhidi2 instruction pattern(s).
2420 (define_expand "zero_extendhidi2"
2421 [(set (match_operand:DI 0 "register_operand" "")
2422 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2428 rtx tmp = gen_reg_rtx (SImode);
2429 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2430 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2435 operands[1] = gen_lowpart (DImode, operands[1]);
2436 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2437 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2443 (define_insn "*zero_extendhidi2"
2444 [(set (match_operand:DI 0 "register_operand" "=d")
2445 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2448 [(set_attr "op_type" "RXY")])
2451 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2454 (define_insn "*llgt_sisi"
2455 [(set (match_operand:SI 0 "register_operand" "=d,d")
2456 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2457 (const_int 2147483647)))]
2462 [(set_attr "op_type" "RRE,RXE")])
2465 [(set (match_operand:SI 0 "register_operand" "")
2466 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2467 (const_int 2147483647)))
2468 (clobber (reg:CC 33))]
2469 "TARGET_64BIT && reload_completed"
2471 (and:SI (match_dup 1)
2472 (const_int 2147483647)))]
2475 (define_insn "*llgt_didi"
2476 [(set (match_operand:DI 0 "register_operand" "=d,d")
2477 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2478 (const_int 2147483647)))]
2483 [(set_attr "op_type" "RRE,RXE")])
2486 [(set (match_operand:DI 0 "register_operand" "")
2487 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
2488 (const_int 2147483647)))
2489 (clobber (reg:CC 33))]
2490 "TARGET_64BIT && reload_completed"
2492 (and:DI (match_dup 1)
2493 (const_int 2147483647)))]
2496 (define_insn "*llgt_sidi"
2497 [(set (match_operand:DI 0 "register_operand" "=d")
2498 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2499 (const_int 2147483647)))]
2502 [(set_attr "op_type" "RXE")])
2504 (define_insn_and_split "*llgt_sidi_split"
2505 [(set (match_operand:DI 0 "register_operand" "=d")
2506 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2507 (const_int 2147483647)))
2508 (clobber (reg:CC 33))]
2511 "&& reload_completed"
2513 (and:DI (subreg:DI (match_dup 1) 0)
2514 (const_int 2147483647)))]
2518 ; zero_extendqidi2 instruction pattern(s)
2521 (define_expand "zero_extendqidi2"
2522 [(set (match_operand:DI 0 "register_operand" "")
2523 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2529 rtx tmp = gen_reg_rtx (SImode);
2530 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2531 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2536 operands[1] = gen_lowpart (DImode, operands[1]);
2537 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2538 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2544 (define_insn "*zero_extendqidi2"
2545 [(set (match_operand:DI 0 "register_operand" "=d")
2546 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2549 [(set_attr "op_type" "RXY")])
2552 ; zero_extendhisi2 instruction pattern(s).
2555 (define_expand "zero_extendhisi2"
2556 [(set (match_operand:SI 0 "register_operand" "")
2557 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2561 operands[1] = gen_lowpart (SImode, operands[1]);
2562 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2567 (define_insn "*zero_extendhisi2_64"
2568 [(set (match_operand:SI 0 "register_operand" "=d")
2569 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2572 [(set_attr "op_type" "RXY")])
2574 (define_insn_and_split "*zero_extendhisi2_31"
2575 [(set (match_operand:SI 0 "register_operand" "=&d")
2576 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2577 (clobber (reg:CC 33))]
2580 "&& reload_completed"
2581 [(set (match_dup 0) (const_int 0))
2583 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2584 (clobber (reg:CC 33))])]
2585 "operands[2] = gen_lowpart (HImode, operands[0]);"
2586 [(set_attr "atype" "agen")])
2589 ; zero_extendqisi2 instruction pattern(s).
2592 (define_expand "zero_extendqisi2"
2593 [(set (match_operand:SI 0 "register_operand" "")
2594 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2598 operands[1] = gen_lowpart (SImode, operands[1]);
2599 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2604 (define_insn "*zero_extendqisi2_64"
2605 [(set (match_operand:SI 0 "register_operand" "=d")
2606 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2609 [(set_attr "op_type" "RXY")])
2611 (define_insn_and_split "*zero_extendqisi2_31"
2612 [(set (match_operand:SI 0 "register_operand" "=&d")
2613 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2616 "&& reload_completed"
2617 [(set (match_dup 0) (const_int 0))
2618 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2619 "operands[2] = gen_lowpart (QImode, operands[0]);"
2620 [(set_attr "atype" "agen")])
2623 ; zero_extendqihi2 instruction pattern(s).
2626 (define_expand "zero_extendqihi2"
2627 [(set (match_operand:HI 0 "register_operand" "")
2628 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2632 operands[1] = gen_lowpart (HImode, operands[1]);
2633 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2638 (define_insn "*zero_extendqihi2_64"
2639 [(set (match_operand:HI 0 "register_operand" "=d")
2640 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2643 [(set_attr "op_type" "RXY")])
2645 (define_insn_and_split "*zero_extendqihi2_31"
2646 [(set (match_operand:HI 0 "register_operand" "=&d")
2647 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2650 "&& reload_completed"
2651 [(set (match_dup 0) (const_int 0))
2652 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2653 "operands[2] = gen_lowpart (QImode, operands[0]);"
2654 [(set_attr "atype" "agen")])
2658 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2661 (define_expand "fixuns_truncdfdi2"
2662 [(set (match_operand:DI 0 "register_operand" "")
2663 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2664 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2666 rtx label1 = gen_label_rtx ();
2667 rtx label2 = gen_label_rtx ();
2668 rtx temp = gen_reg_rtx (DFmode);
2669 operands[1] = force_reg (DFmode, operands[1]);
2671 emit_insn (gen_cmpdf (operands[1],
2672 CONST_DOUBLE_FROM_REAL_VALUE (
2673 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2674 emit_jump_insn (gen_blt (label1));
2675 emit_insn (gen_subdf3 (temp, operands[1],
2676 CONST_DOUBLE_FROM_REAL_VALUE (
2677 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2678 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2681 emit_label (label1);
2682 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2683 emit_label (label2);
2687 (define_expand "fix_truncdfdi2"
2688 [(set (match_operand:DI 0 "register_operand" "")
2689 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2690 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2692 operands[1] = force_reg (DFmode, operands[1]);
2693 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2697 (define_insn "fix_truncdfdi2_ieee"
2698 [(set (match_operand:DI 0 "register_operand" "=d")
2699 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2700 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2701 (clobber (reg:CC 33))]
2702 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2704 [(set_attr "op_type" "RRE")
2705 (set_attr "type" "ftoi")])
2708 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2711 (define_expand "fixuns_truncdfsi2"
2712 [(set (match_operand:SI 0 "register_operand" "")
2713 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2714 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2716 rtx label1 = gen_label_rtx ();
2717 rtx label2 = gen_label_rtx ();
2718 rtx temp = gen_reg_rtx (DFmode);
2720 operands[1] = force_reg (DFmode,operands[1]);
2721 emit_insn (gen_cmpdf (operands[1],
2722 CONST_DOUBLE_FROM_REAL_VALUE (
2723 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2724 emit_jump_insn (gen_blt (label1));
2725 emit_insn (gen_subdf3 (temp, operands[1],
2726 CONST_DOUBLE_FROM_REAL_VALUE (
2727 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2728 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2731 emit_label (label1);
2732 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2733 emit_label (label2);
2737 (define_expand "fix_truncdfsi2"
2738 [(set (match_operand:SI 0 "register_operand" "")
2739 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2742 if (TARGET_IBM_FLOAT)
2744 /* This is the algorithm from POP chapter A.5.7.2. */
2746 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2747 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2748 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2750 operands[1] = force_reg (DFmode, operands[1]);
2751 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2752 two31r, two32, temp));
2756 operands[1] = force_reg (DFmode, operands[1]);
2757 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2763 (define_insn "fix_truncdfsi2_ieee"
2764 [(set (match_operand:SI 0 "register_operand" "=d")
2765 (fix:SI (match_operand:DF 1 "register_operand" "f")))
2766 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2767 (clobber (reg:CC 33))]
2768 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2770 [(set_attr "op_type" "RRE")
2771 (set_attr "type" "other" )])
2773 (define_insn "fix_truncdfsi2_ibm"
2774 [(set (match_operand:SI 0 "register_operand" "=d")
2775 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2776 (use (match_operand:DI 2 "immediate_operand" "m"))
2777 (use (match_operand:DI 3 "immediate_operand" "m"))
2778 (use (match_operand:BLK 4 "memory_operand" "m"))
2779 (clobber (reg:CC 33))]
2780 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2782 output_asm_insn ("sd\t%1,%2", operands);
2783 output_asm_insn ("aw\t%1,%3", operands);
2784 output_asm_insn ("std\t%1,%4", operands);
2785 output_asm_insn ("xi\t%N4,128", operands);
2788 [(set_attr "op_type" "NN")
2789 (set_attr "type" "ftoi")
2790 (set_attr "atype" "agen")
2791 (set_attr "length" "20")])
2794 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
2797 (define_expand "fixuns_truncsfdi2"
2798 [(set (match_operand:DI 0 "register_operand" "")
2799 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2800 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2802 rtx label1 = gen_label_rtx ();
2803 rtx label2 = gen_label_rtx ();
2804 rtx temp = gen_reg_rtx (SFmode);
2806 operands[1] = force_reg (SFmode, operands[1]);
2807 emit_insn (gen_cmpsf (operands[1],
2808 CONST_DOUBLE_FROM_REAL_VALUE (
2809 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
2810 emit_jump_insn (gen_blt (label1));
2812 emit_insn (gen_subsf3 (temp, operands[1],
2813 CONST_DOUBLE_FROM_REAL_VALUE (
2814 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
2815 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
2818 emit_label (label1);
2819 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2820 emit_label (label2);
2824 (define_expand "fix_truncsfdi2"
2825 [(set (match_operand:DI 0 "register_operand" "")
2826 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
2827 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2829 operands[1] = force_reg (SFmode, operands[1]);
2830 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2834 (define_insn "fix_truncsfdi2_ieee"
2835 [(set (match_operand:DI 0 "register_operand" "=d")
2836 (fix:DI (match_operand:SF 1 "register_operand" "f")))
2837 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2838 (clobber (reg:CC 33))]
2839 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2841 [(set_attr "op_type" "RRE")
2842 (set_attr "type" "ftoi")])
2845 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
2848 (define_expand "fixuns_truncsfsi2"
2849 [(set (match_operand:SI 0 "register_operand" "")
2850 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
2851 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2853 rtx label1 = gen_label_rtx ();
2854 rtx label2 = gen_label_rtx ();
2855 rtx temp = gen_reg_rtx (SFmode);
2857 operands[1] = force_reg (SFmode, operands[1]);
2858 emit_insn (gen_cmpsf (operands[1],
2859 CONST_DOUBLE_FROM_REAL_VALUE (
2860 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
2861 emit_jump_insn (gen_blt (label1));
2862 emit_insn (gen_subsf3 (temp, operands[1],
2863 CONST_DOUBLE_FROM_REAL_VALUE (
2864 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
2865 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
2868 emit_label (label1);
2869 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2870 emit_label (label2);
2874 (define_expand "fix_truncsfsi2"
2875 [(set (match_operand:SI 0 "register_operand" "")
2876 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
2879 if (TARGET_IBM_FLOAT)
2881 /* Convert to DFmode and then use the POP algorithm. */
2882 rtx temp = gen_reg_rtx (DFmode);
2883 emit_insn (gen_extendsfdf2 (temp, operands[1]));
2884 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
2888 operands[1] = force_reg (SFmode, operands[1]);
2889 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2895 (define_insn "fix_truncsfsi2_ieee"
2896 [(set (match_operand:SI 0 "register_operand" "=d")
2897 (fix:SI (match_operand:SF 1 "register_operand" "f")))
2898 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2899 (clobber (reg:CC 33))]
2900 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2902 [(set_attr "op_type" "RRE")
2903 (set_attr "type" "ftoi")])
2906 ; floatdidf2 instruction pattern(s).
2909 (define_insn "floatdidf2"
2910 [(set (match_operand:DF 0 "register_operand" "=f")
2911 (float:DF (match_operand:DI 1 "register_operand" "d")))
2912 (clobber (reg:CC 33))]
2913 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2915 [(set_attr "op_type" "RRE")
2916 (set_attr "type" "itof" )])
2919 ; floatdisf2 instruction pattern(s).
2922 (define_insn "floatdisf2"
2923 [(set (match_operand:SF 0 "register_operand" "=f")
2924 (float:SF (match_operand:DI 1 "register_operand" "d")))
2925 (clobber (reg:CC 33))]
2926 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2928 [(set_attr "op_type" "RRE")
2929 (set_attr "type" "itof" )])
2932 ; floatsidf2 instruction pattern(s).
2935 (define_expand "floatsidf2"
2937 [(set (match_operand:DF 0 "register_operand" "")
2938 (float:DF (match_operand:SI 1 "register_operand" "")))
2939 (clobber (reg:CC 33))])]
2942 if (TARGET_IBM_FLOAT)
2944 /* This is the algorithm from POP chapter A.5.7.1. */
2946 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2947 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
2949 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
2954 (define_insn "floatsidf2_ieee"
2955 [(set (match_operand:DF 0 "register_operand" "=f")
2956 (float:DF (match_operand:SI 1 "register_operand" "d")))
2957 (clobber (reg:CC 33))]
2958 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2960 [(set_attr "op_type" "RRE")
2961 (set_attr "type" "itof" )])
2963 (define_insn "floatsidf2_ibm"
2964 [(set (match_operand:DF 0 "register_operand" "=f")
2965 (float:DF (match_operand:SI 1 "register_operand" "d")))
2966 (use (match_operand:DI 2 "immediate_operand" "m"))
2967 (use (match_operand:BLK 3 "memory_operand" "m"))
2968 (clobber (reg:CC 33))]
2969 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2971 output_asm_insn ("st\t%1,%N3", operands);
2972 output_asm_insn ("xi\t%N3,128", operands);
2973 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
2974 output_asm_insn ("ld\t%0,%3", operands);
2977 [(set_attr "op_type" "NN")
2978 (set_attr "type" "other" )
2979 (set_attr "atype" "agen")
2980 (set_attr "length" "20")])
2983 ; floatsisf2 instruction pattern(s).
2986 (define_expand "floatsisf2"
2988 [(set (match_operand:SF 0 "register_operand" "")
2989 (float:SF (match_operand:SI 1 "register_operand" "")))
2990 (clobber (reg:CC 33))])]
2993 if (TARGET_IBM_FLOAT)
2995 /* Use the POP algorithm to convert to DFmode and then truncate. */
2996 rtx temp = gen_reg_rtx (DFmode);
2997 emit_insn (gen_floatsidf2 (temp, operands[1]));
2998 emit_insn (gen_truncdfsf2 (operands[0], temp));
3003 (define_insn "floatsisf2_ieee"
3004 [(set (match_operand:SF 0 "register_operand" "=f")
3005 (float:SF (match_operand:SI 1 "register_operand" "d")))
3006 (clobber (reg:CC 33))]
3007 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3009 [(set_attr "op_type" "RRE")
3010 (set_attr "type" "itof" )])
3013 ; truncdfsf2 instruction pattern(s).
3016 (define_expand "truncdfsf2"
3017 [(set (match_operand:SF 0 "register_operand" "")
3018 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3022 (define_insn "truncdfsf2_ieee"
3023 [(set (match_operand:SF 0 "register_operand" "=f")
3024 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3025 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3027 [(set_attr "op_type" "RRE")])
3029 (define_insn "truncdfsf2_ibm"
3030 [(set (match_operand:SF 0 "register_operand" "=f,f")
3031 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3032 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3036 [(set_attr "op_type" "RR,RX")
3037 (set_attr "type" "floads,floads")])
3040 ; extendsfdf2 instruction pattern(s).
3043 (define_expand "extendsfdf2"
3044 [(set (match_operand:DF 0 "register_operand" "")
3045 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3048 if (TARGET_IBM_FLOAT)
3050 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3055 (define_insn "extendsfdf2_ieee"
3056 [(set (match_operand:DF 0 "register_operand" "=f,f")
3057 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3058 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3062 [(set_attr "op_type" "RRE,RXE")
3063 (set_attr "type" "floads,floads")])
3065 (define_insn "extendsfdf2_ibm"
3066 [(set (match_operand:DF 0 "register_operand" "=f,f")
3067 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3068 (clobber (reg:CC 33))]
3069 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3071 sdr\t%0,%0\;ler\t%0,%1
3072 sdr\t%0,%0\;le\t%0,%1"
3073 [(set_attr "op_type" "NN,NN")
3074 (set_attr "atype" "reg,agen")
3075 (set_attr "length" "4,6")
3076 (set_attr "type" "o2,o2")])
3080 ;; ARITHMETIC OPERATIONS
3082 ; arithmetic operations set the ConditionCode,
3083 ; because of unpredictable Bits in Register for Halfword and Byte
3084 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3087 ;;- Add instructions.
3091 ; addti3 instruction pattern(s).
3094 (define_insn_and_split "addti3"
3095 [(set (match_operand:TI 0 "register_operand" "=&d")
3096 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
3097 (match_operand:TI 2 "general_operand" "do") ) )
3098 (clobber (reg:CC 33))]
3101 "&& reload_completed"
3104 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
3106 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
3108 [(set (match_dup 3) (plus:DI (plus:DI (match_dup 4) (match_dup 5))
3109 (ltu:DI (reg:CCL1 33) (const_int 0))))
3110 (clobber (reg:CC 33))])]
3111 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3112 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3113 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3114 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3115 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3116 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
3117 [(set_attr "op_type" "NN")])
3120 ; adddi3 instruction pattern(s).
3123 (define_insn "*adddi3_sign"
3124 [(set (match_operand:DI 0 "register_operand" "=d,d")
3125 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3126 (match_operand:DI 1 "register_operand" "0,0")))
3127 (clobber (reg:CC 33))]
3132 [(set_attr "op_type" "RRE,RXY")])
3134 (define_insn "*adddi3_zero_cc"
3136 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3137 (match_operand:DI 1 "register_operand" "0,0"))
3139 (set (match_operand:DI 0 "register_operand" "=d,d")
3140 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3141 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3145 [(set_attr "op_type" "RRE,RXY")])
3147 (define_insn "*adddi3_zero_cconly"
3149 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3150 (match_operand:DI 1 "register_operand" "0,0"))
3152 (clobber (match_scratch:DI 0 "=d,d"))]
3153 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3157 [(set_attr "op_type" "RRE,RXY")])
3159 (define_insn "*adddi3_zero"
3160 [(set (match_operand:DI 0 "register_operand" "=d,d")
3161 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3162 (match_operand:DI 1 "register_operand" "0,0")))
3163 (clobber (reg:CC 33))]
3168 [(set_attr "op_type" "RRE,RXY")])
3170 (define_insn "*adddi3_imm_cc"
3172 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3173 (match_operand:DI 2 "const_int_operand" "K"))
3175 (set (match_operand:DI 0 "register_operand" "=d")
3176 (plus:DI (match_dup 1) (match_dup 2)))]
3178 && s390_match_ccmode (insn, CCAmode)
3179 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3181 [(set_attr "op_type" "RI")])
3183 (define_insn "*adddi3_carry1_cc"
3185 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3186 (match_operand:DI 2 "general_operand" "d,m"))
3188 (set (match_operand:DI 0 "register_operand" "=d,d")
3189 (plus:DI (match_dup 1) (match_dup 2)))]
3190 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3194 [(set_attr "op_type" "RRE,RXY")])
3196 (define_insn "*adddi3_carry1_cconly"
3198 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3199 (match_operand:DI 2 "general_operand" "d,m"))
3201 (clobber (match_scratch:DI 0 "=d,d"))]
3202 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3206 [(set_attr "op_type" "RRE,RXY")])
3208 (define_insn "*adddi3_carry2_cc"
3210 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3211 (match_operand:DI 2 "general_operand" "d,m"))
3213 (set (match_operand:DI 0 "register_operand" "=d,d")
3214 (plus:DI (match_dup 1) (match_dup 2)))]
3215 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3219 [(set_attr "op_type" "RRE,RXY")])
3221 (define_insn "*adddi3_carry2_cconly"
3223 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3224 (match_operand:DI 2 "general_operand" "d,m"))
3226 (clobber (match_scratch:DI 0 "=d,d"))]
3227 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3231 [(set_attr "op_type" "RRE,RXY")])
3233 (define_insn "*adddi3_cc"
3235 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3236 (match_operand:DI 2 "general_operand" "d,m"))
3238 (set (match_operand:DI 0 "register_operand" "=d,d")
3239 (plus:DI (match_dup 1) (match_dup 2)))]
3240 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3244 [(set_attr "op_type" "RRE,RXY")])
3246 (define_insn "*adddi3_cconly"
3248 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3249 (match_operand:DI 2 "general_operand" "d,m"))
3251 (clobber (match_scratch:DI 0 "=d,d"))]
3252 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3256 [(set_attr "op_type" "RRE,RXY")])
3258 (define_insn "*adddi3_cconly2"
3260 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3261 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3262 (clobber (match_scratch:DI 0 "=d,d"))]
3263 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3267 [(set_attr "op_type" "RRE,RXY")])
3269 (define_insn "*adddi3_64"
3270 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3271 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3272 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3273 (clobber (reg:CC 33))]
3279 [(set_attr "op_type" "RRE,RI,RXY")])
3281 (define_insn_and_split "*adddi3_31z"
3282 [(set (match_operand:DI 0 "register_operand" "=&d")
3283 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3284 (match_operand:DI 2 "general_operand" "do") ) )
3285 (clobber (reg:CC 33))]
3286 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3288 "&& reload_completed"
3291 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3293 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3295 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3296 (ltu:SI (reg:CCL1 33) (const_int 0))))
3297 (clobber (reg:CC 33))])]
3298 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3299 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3300 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3301 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3302 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3303 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3304 [(set_attr "op_type" "NN")])
3306 (define_insn_and_split "*adddi3_31"
3307 [(set (match_operand:DI 0 "register_operand" "=&d")
3308 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3309 (match_operand:DI 2 "general_operand" "do") ) )
3310 (clobber (reg:CC 33))]
3313 "&& reload_completed"
3315 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3316 (clobber (reg:CC 33))])
3319 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3321 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3323 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3325 (label_ref (match_dup 9))))
3327 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3328 (clobber (reg:CC 33))])
3330 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3331 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3332 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3333 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3334 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3335 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3336 operands[9] = gen_label_rtx ();"
3337 [(set_attr "op_type" "NN")])
3339 (define_expand "adddi3"
3341 [(set (match_operand:DI 0 "register_operand" "")
3342 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3343 (match_operand:DI 2 "general_operand" "")))
3344 (clobber (reg:CC 33))])]
3349 ; addsi3 instruction pattern(s).
3352 (define_insn "*addsi3_imm_cc"
3354 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3355 (match_operand:SI 2 "const_int_operand" "K"))
3357 (set (match_operand:SI 0 "register_operand" "=d")
3358 (plus:SI (match_dup 1) (match_dup 2)))]
3359 "s390_match_ccmode (insn, CCAmode)
3360 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3362 [(set_attr "op_type" "RI")])
3364 (define_insn "*addsi3_carry1_cc"
3366 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3367 (match_operand:SI 2 "general_operand" "d,R,T"))
3369 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3370 (plus:SI (match_dup 1) (match_dup 2)))]
3371 "s390_match_ccmode (insn, CCL1mode)"
3376 [(set_attr "op_type" "RR,RX,RXY")])
3378 (define_insn "*addsi3_carry1_cconly"
3380 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3381 (match_operand:SI 2 "general_operand" "d,R,T"))
3383 (clobber (match_scratch:SI 0 "=d,d,d"))]
3384 "s390_match_ccmode (insn, CCL1mode)"
3389 [(set_attr "op_type" "RR,RX,RXY")])
3391 (define_insn "*addsi3_carry2_cc"
3393 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3394 (match_operand:SI 2 "general_operand" "d,R,T"))
3396 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3397 (plus:SI (match_dup 1) (match_dup 2)))]
3398 "s390_match_ccmode (insn, CCL1mode)"
3403 [(set_attr "op_type" "RR,RX,RXY")])
3405 (define_insn "*addsi3_carry2_cconly"
3407 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3408 (match_operand:SI 2 "general_operand" "d,R,T"))
3410 (clobber (match_scratch:SI 0 "=d,d,d"))]
3411 "s390_match_ccmode (insn, CCL1mode)"
3416 [(set_attr "op_type" "RR,RX,RXY")])
3418 (define_insn "*addsi3_cc"
3420 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3421 (match_operand:SI 2 "general_operand" "d,R,T"))
3423 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3424 (plus:SI (match_dup 1) (match_dup 2)))]
3425 "s390_match_ccmode (insn, CCLmode)"
3430 [(set_attr "op_type" "RR,RX,RXY")])
3432 (define_insn "*addsi3_cconly"
3434 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3435 (match_operand:SI 2 "general_operand" "d,R,T"))
3437 (clobber (match_scratch:SI 0 "=d,d,d"))]
3438 "s390_match_ccmode (insn, CCLmode)"
3443 [(set_attr "op_type" "RR,RX,RXY")])
3445 (define_insn "*addsi3_cconly2"
3447 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3448 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3449 (clobber (match_scratch:SI 0 "=d,d,d"))]
3450 "s390_match_ccmode (insn, CCLmode)"
3455 [(set_attr "op_type" "RR,RX,RXY")])
3457 (define_insn "*addsi3_sign"
3458 [(set (match_operand:SI 0 "register_operand" "=d,d")
3459 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3460 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3461 (clobber (reg:CC 33))]
3466 [(set_attr "op_type" "RX,RXY")])
3468 (define_insn "addsi3"
3469 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3470 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3471 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3472 (clobber (reg:CC 33))]
3479 [(set_attr "op_type" "RR,RI,RX,RXY")])
3482 ; adddf3 instruction pattern(s).
3485 (define_expand "adddf3"
3487 [(set (match_operand:DF 0 "register_operand" "=f,f")
3488 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3489 (match_operand:DF 2 "general_operand" "f,R")))
3490 (clobber (reg:CC 33))])]
3494 (define_insn "*adddf3"
3495 [(set (match_operand:DF 0 "register_operand" "=f,f")
3496 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3497 (match_operand:DF 2 "general_operand" "f,R")))
3498 (clobber (reg:CC 33))]
3499 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3503 [(set_attr "op_type" "RRE,RXE")
3504 (set_attr "type" "fsimpd,fsimpd")])
3506 (define_insn "*adddf3_cc"
3508 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3509 (match_operand:DF 2 "general_operand" "f,R"))
3510 (match_operand:DF 3 "const0_operand" "")))
3511 (set (match_operand:DF 0 "register_operand" "=f,f")
3512 (plus:DF (match_dup 1) (match_dup 2)))]
3513 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3517 [(set_attr "op_type" "RRE,RXE")
3518 (set_attr "type" "fsimpd,fsimpd")])
3520 (define_insn "*adddf3_cconly"
3522 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3523 (match_operand:DF 2 "general_operand" "f,R"))
3524 (match_operand:DF 3 "const0_operand" "")))
3525 (clobber (match_scratch:DF 0 "=f,f"))]
3526 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3530 [(set_attr "op_type" "RRE,RXE")
3531 (set_attr "type" "fsimpd,fsimpd")])
3533 (define_insn "*adddf3_ibm"
3534 [(set (match_operand:DF 0 "register_operand" "=f,f")
3535 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3536 (match_operand:DF 2 "general_operand" "f,R")))
3537 (clobber (reg:CC 33))]
3538 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3542 [(set_attr "op_type" "RR,RX")
3543 (set_attr "type" "fsimpd,fsimpd")])
3546 ; addsf3 instruction pattern(s).
3549 (define_expand "addsf3"
3551 [(set (match_operand:SF 0 "register_operand" "=f,f")
3552 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3553 (match_operand:SF 2 "general_operand" "f,R")))
3554 (clobber (reg:CC 33))])]
3558 (define_insn "*addsf3"
3559 [(set (match_operand:SF 0 "register_operand" "=f,f")
3560 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3561 (match_operand:SF 2 "general_operand" "f,R")))
3562 (clobber (reg:CC 33))]
3563 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3567 [(set_attr "op_type" "RRE,RXE")
3568 (set_attr "type" "fsimps,fsimps")])
3570 (define_insn "*addsf3_cc"
3572 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3573 (match_operand:SF 2 "general_operand" "f,R"))
3574 (match_operand:SF 3 "const0_operand" "")))
3575 (set (match_operand:SF 0 "register_operand" "=f,f")
3576 (plus:SF (match_dup 1) (match_dup 2)))]
3577 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3581 [(set_attr "op_type" "RRE,RXE")
3582 (set_attr "type" "fsimps,fsimps")])
3584 (define_insn "*addsf3_cconly"
3586 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3587 (match_operand:SF 2 "general_operand" "f,R"))
3588 (match_operand:SF 3 "const0_operand" "")))
3589 (clobber (match_scratch:SF 0 "=f,f"))]
3590 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3594 [(set_attr "op_type" "RRE,RXE")
3595 (set_attr "type" "fsimps,fsimps")])
3597 (define_insn "*addsf3"
3598 [(set (match_operand:SF 0 "register_operand" "=f,f")
3599 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3600 (match_operand:SF 2 "general_operand" "f,R")))
3601 (clobber (reg:CC 33))]
3602 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3606 [(set_attr "op_type" "RR,RX")
3607 (set_attr "type" "fsimps,fsimps")])
3611 ;;- Subtract instructions.
3615 ; subti3 instruction pattern(s).
3618 (define_insn_and_split "subti3"
3619 [(set (match_operand:TI 0 "register_operand" "=&d")
3620 (minus:TI (match_operand:TI 1 "register_operand" "0")
3621 (match_operand:TI 2 "general_operand" "do") ) )
3622 (clobber (reg:CC 33))]
3625 "&& reload_completed"
3628 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
3630 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
3632 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
3633 (gtu:DI (reg:CCL2 33) (const_int 0))))
3634 (clobber (reg:CC 33))])]
3635 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3636 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3637 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3638 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3639 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3640 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
3641 [(set_attr "op_type" "NN")])
3644 ; subdi3 instruction pattern(s).
3647 (define_insn "*subdi3_sign"
3648 [(set (match_operand:DI 0 "register_operand" "=d,d")
3649 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3650 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3651 (clobber (reg:CC 33))]
3656 [(set_attr "op_type" "RRE,RXY")])
3658 (define_insn "*subdi3_zero_cc"
3660 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3661 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3663 (set (match_operand:DI 0 "register_operand" "=d,d")
3664 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3665 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3669 [(set_attr "op_type" "RRE,RXY")])
3671 (define_insn "*subdi3_zero_cconly"
3673 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3674 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3676 (clobber (match_scratch:DI 0 "=d,d"))]
3677 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3681 [(set_attr "op_type" "RRE,RXY")])
3683 (define_insn "*subdi3_zero"
3684 [(set (match_operand:DI 0 "register_operand" "=d,d")
3685 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3686 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3687 (clobber (reg:CC 33))]
3692 [(set_attr "op_type" "RRE,RXY")])
3694 (define_insn "*subdi3_borrow_cc"
3696 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3697 (match_operand:DI 2 "general_operand" "d,m"))
3699 (set (match_operand:DI 0 "register_operand" "=d,d")
3700 (minus:DI (match_dup 1) (match_dup 2)))]
3701 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3705 [(set_attr "op_type" "RRE,RXY")])
3707 (define_insn "*subdi3_borrow_cconly"
3709 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3710 (match_operand:DI 2 "general_operand" "d,m"))
3712 (clobber (match_scratch:DI 0 "=d,d"))]
3713 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3717 [(set_attr "op_type" "RRE,RXY")])
3719 (define_insn "*subdi3_cc"
3721 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3722 (match_operand:DI 2 "general_operand" "d,m"))
3724 (set (match_operand:DI 0 "register_operand" "=d,d")
3725 (minus:DI (match_dup 1) (match_dup 2)))]
3726 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3730 [(set_attr "op_type" "RRE,RXY")])
3732 (define_insn "*subdi3_cc2"
3734 (compare (match_operand:DI 1 "register_operand" "0,0")
3735 (match_operand:DI 2 "general_operand" "d,m")))
3736 (set (match_operand:DI 0 "register_operand" "=d,d")
3737 (minus:DI (match_dup 1) (match_dup 2)))]
3738 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3742 [(set_attr "op_type" "RRE,RXY")])
3744 (define_insn "*subdi3_cconly"
3746 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3747 (match_operand:DI 2 "general_operand" "d,m"))
3749 (clobber (match_scratch:DI 0 "=d,d"))]
3750 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3754 [(set_attr "op_type" "RRE,RXY")])
3756 (define_insn "*subdi3_cconly2"
3758 (compare (match_operand:DI 1 "register_operand" "0,0")
3759 (match_operand:DI 2 "general_operand" "d,m")))
3760 (clobber (match_scratch:DI 0 "=d,d"))]
3761 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3765 [(set_attr "op_type" "RRE,RXY")])
3767 (define_insn "*subdi3_64"
3768 [(set (match_operand:DI 0 "register_operand" "=d,d")
3769 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3770 (match_operand:DI 2 "general_operand" "d,m") ) )
3771 (clobber (reg:CC 33))]
3776 [(set_attr "op_type" "RRE,RRE")])
3778 (define_insn_and_split "*subdi3_31z"
3779 [(set (match_operand:DI 0 "register_operand" "=&d")
3780 (minus:DI (match_operand:DI 1 "register_operand" "0")
3781 (match_operand:DI 2 "general_operand" "do") ) )
3782 (clobber (reg:CC 33))]
3783 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3785 "&& reload_completed"
3788 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3790 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3792 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3793 (gtu:SI (reg:CCL2 33) (const_int 0))))
3794 (clobber (reg:CC 33))])]
3795 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3796 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3797 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3798 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3799 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3800 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3801 [(set_attr "op_type" "NN")])
3803 (define_insn_and_split "*subdi3_31"
3804 [(set (match_operand:DI 0 "register_operand" "=&d")
3805 (minus:DI (match_operand:DI 1 "register_operand" "0")
3806 (match_operand:DI 2 "general_operand" "do") ) )
3807 (clobber (reg:CC 33))]
3810 "&& reload_completed"
3812 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3813 (clobber (reg:CC 33))])
3816 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3818 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3820 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3822 (label_ref (match_dup 9))))
3824 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3825 (clobber (reg:CC 33))])
3827 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3828 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3829 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3830 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3831 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3832 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3833 operands[9] = gen_label_rtx ();"
3834 [(set_attr "op_type" "NN")])
3836 (define_expand "subdi3"
3838 [(set (match_operand:DI 0 "register_operand" "")
3839 (minus:DI (match_operand:DI 1 "register_operand" "")
3840 (match_operand:DI 2 "general_operand" "")))
3841 (clobber (reg:CC 33))])]
3846 ; subsi3 instruction pattern(s).
3849 (define_insn "*subsi3_borrow_cc"
3851 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3852 (match_operand:SI 2 "general_operand" "d,R,T"))
3854 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3855 (minus:SI (match_dup 1) (match_dup 2)))]
3856 "s390_match_ccmode (insn, CCL2mode)"
3861 [(set_attr "op_type" "RR,RX,RXY")])
3863 (define_insn "*subsi3_borrow_cconly"
3865 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3866 (match_operand:SI 2 "general_operand" "d,R,T"))
3868 (clobber (match_scratch:SI 0 "=d,d,d"))]
3869 "s390_match_ccmode (insn, CCL2mode)"
3874 [(set_attr "op_type" "RR,RX,RXY")])
3876 (define_insn "*subsi3_cc"
3878 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3879 (match_operand:SI 2 "general_operand" "d,R,T"))
3881 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3882 (minus:SI (match_dup 1) (match_dup 2)))]
3883 "s390_match_ccmode (insn, CCLmode)"
3888 [(set_attr "op_type" "RR,RX,RXY")])
3890 (define_insn "*subsi3_cc2"
3892 (compare (match_operand:SI 1 "register_operand" "0,0,0")
3893 (match_operand:SI 2 "general_operand" "d,R,T")))
3894 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3895 (minus:SI (match_dup 1) (match_dup 2)))]
3896 "s390_match_ccmode (insn, CCL3mode)"
3901 [(set_attr "op_type" "RR,RX,RXY")])
3903 (define_insn "*subsi3_cconly"
3905 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3906 (match_operand:SI 2 "general_operand" "d,R,T"))
3908 (clobber (match_scratch:SI 0 "=d,d,d"))]
3909 "s390_match_ccmode (insn, CCLmode)"
3914 [(set_attr "op_type" "RR,RX,RXY")])
3916 (define_insn "*subsi3_cconly2"
3918 (compare (match_operand:SI 1 "register_operand" "0,0,0")
3919 (match_operand:SI 2 "general_operand" "d,R,T")))
3920 (clobber (match_scratch:SI 0 "=d,d,d"))]
3921 "s390_match_ccmode (insn, CCL3mode)"
3926 [(set_attr "op_type" "RR,RX,RXY")])
3928 (define_insn "*subsi3_sign"
3929 [(set (match_operand:SI 0 "register_operand" "=d,d")
3930 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3931 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3932 (clobber (reg:CC 33))]
3937 [(set_attr "op_type" "RX,RXY")])
3939 (define_insn "subsi3"
3940 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
3941 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3942 (match_operand:SI 2 "general_operand" "d,R,T")))
3943 (clobber (reg:CC 33))]
3949 [(set_attr "op_type" "RR,RX,RXY")])
3953 ; subdf3 instruction pattern(s).
3956 (define_expand "subdf3"
3958 [(set (match_operand:DF 0 "register_operand" "=f,f")
3959 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3960 (match_operand:DF 2 "general_operand" "f,R")))
3961 (clobber (reg:CC 33))])]
3965 (define_insn "*subdf3"
3966 [(set (match_operand:DF 0 "register_operand" "=f,f")
3967 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3968 (match_operand:DF 2 "general_operand" "f,R")))
3969 (clobber (reg:CC 33))]
3970 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3974 [(set_attr "op_type" "RRE,RXE")
3975 (set_attr "type" "fsimpd,fsimpd")])
3977 (define_insn "*subdf3_cc"
3979 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
3980 (match_operand:DF 2 "general_operand" "f,R"))
3981 (match_operand:DF 3 "const0_operand" "")))
3982 (set (match_operand:DF 0 "register_operand" "=f,f")
3983 (plus:DF (match_dup 1) (match_dup 2)))]
3984 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3988 [(set_attr "op_type" "RRE,RXE")
3989 (set_attr "type" "fsimpd,fsimpd")])
3991 (define_insn "*subdf3_cconly"
3993 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
3994 (match_operand:DF 2 "general_operand" "f,R"))
3995 (match_operand:DF 3 "const0_operand" "")))
3996 (clobber (match_scratch:DF 0 "=f,f"))]
3997 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4001 [(set_attr "op_type" "RRE,RXE")
4002 (set_attr "type" "fsimpd,fsimpd")])
4004 (define_insn "*subdf3_ibm"
4005 [(set (match_operand:DF 0 "register_operand" "=f,f")
4006 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4007 (match_operand:DF 2 "general_operand" "f,R")))
4008 (clobber (reg:CC 33))]
4009 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4013 [(set_attr "op_type" "RR,RX")
4014 (set_attr "type" "fsimpd,fsimpd")])
4017 ; subsf3 instruction pattern(s).
4020 (define_expand "subsf3"
4022 [(set (match_operand:SF 0 "register_operand" "=f,f")
4023 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4024 (match_operand:SF 2 "general_operand" "f,R")))
4025 (clobber (reg:CC 33))])]
4029 (define_insn "*subsf3"
4030 [(set (match_operand:SF 0 "register_operand" "=f,f")
4031 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4032 (match_operand:SF 2 "general_operand" "f,R")))
4033 (clobber (reg:CC 33))]
4034 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4038 [(set_attr "op_type" "RRE,RXE")
4039 (set_attr "type" "fsimps,fsimps")])
4041 (define_insn "*subsf3_cc"
4043 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4044 (match_operand:SF 2 "general_operand" "f,R"))
4045 (match_operand:SF 3 "const0_operand" "")))
4046 (set (match_operand:SF 0 "register_operand" "=f,f")
4047 (minus:SF (match_dup 1) (match_dup 2)))]
4048 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4052 [(set_attr "op_type" "RRE,RXE")
4053 (set_attr "type" "fsimps,fsimps")])
4055 (define_insn "*subsf3_cconly"
4057 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4058 (match_operand:SF 2 "general_operand" "f,R"))
4059 (match_operand:SF 3 "const0_operand" "")))
4060 (clobber (match_scratch:SF 0 "=f,f"))]
4061 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4065 [(set_attr "op_type" "RRE,RXE")
4066 (set_attr "type" "fsimps,fsimps")])
4068 (define_insn "*subsf3_ibm"
4069 [(set (match_operand:SF 0 "register_operand" "=f,f")
4070 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4071 (match_operand:SF 2 "general_operand" "f,R")))
4072 (clobber (reg:CC 33))]
4073 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4077 [(set_attr "op_type" "RR,RX")
4078 (set_attr "type" "fsimps,fsimps")])
4082 ;;- Conditional add/subtract instructions.
4086 ; adddicc instruction pattern(s).
4089 (define_insn "*adddi3_alc_cc"
4092 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4093 (match_operand:DI 2 "general_operand" "d,m"))
4094 (match_operand:DI 3 "s390_alc_comparison" ""))
4096 (set (match_operand:DI 0 "register_operand" "=d,d")
4097 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4098 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4102 [(set_attr "op_type" "RRE,RXY")])
4104 (define_insn "*adddi3_alc"
4105 [(set (match_operand:DI 0 "register_operand" "=d,d")
4106 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4107 (match_operand:DI 2 "general_operand" "d,m"))
4108 (match_operand:DI 3 "s390_alc_comparison" "")))
4109 (clobber (reg:CC 33))]
4114 [(set_attr "op_type" "RRE,RXY")])
4116 (define_insn "*subdi3_slb_cc"
4119 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4120 (match_operand:DI 2 "general_operand" "d,m"))
4121 (match_operand:DI 3 "s390_slb_comparison" ""))
4123 (set (match_operand:DI 0 "register_operand" "=d,d")
4124 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4125 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4129 [(set_attr "op_type" "RRE,RXY")])
4131 (define_insn "*subdi3_slb"
4132 [(set (match_operand:DI 0 "register_operand" "=d,d")
4133 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4134 (match_operand:DI 2 "general_operand" "d,m"))
4135 (match_operand:DI 3 "s390_slb_comparison" "")))
4136 (clobber (reg:CC 33))]
4141 [(set_attr "op_type" "RRE,RXY")])
4143 (define_expand "adddicc"
4144 [(match_operand:DI 0 "register_operand" "")
4145 (match_operand 1 "comparison_operator" "")
4146 (match_operand:DI 2 "register_operand" "")
4147 (match_operand:DI 3 "const_int_operand" "")]
4149 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4150 s390_compare_op0, s390_compare_op1,
4151 operands[0], operands[2],
4152 operands[3])) FAIL; DONE;")
4155 ; addsicc instruction pattern(s).
4158 (define_insn "*addsi3_alc_cc"
4161 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4162 (match_operand:SI 2 "general_operand" "d,m"))
4163 (match_operand:SI 3 "s390_alc_comparison" ""))
4165 (set (match_operand:SI 0 "register_operand" "=d,d")
4166 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4167 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4171 [(set_attr "op_type" "RRE,RXY")])
4173 (define_insn "*addsi3_alc"
4174 [(set (match_operand:SI 0 "register_operand" "=d,d")
4175 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4176 (match_operand:SI 2 "general_operand" "d,m"))
4177 (match_operand:SI 3 "s390_alc_comparison" "")))
4178 (clobber (reg:CC 33))]
4183 [(set_attr "op_type" "RRE,RXY")])
4185 (define_insn "*subsi3_slb_cc"
4188 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4189 (match_operand:SI 2 "general_operand" "d,m"))
4190 (match_operand:SI 3 "s390_slb_comparison" ""))
4192 (set (match_operand:SI 0 "register_operand" "=d,d")
4193 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4194 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4198 [(set_attr "op_type" "RRE,RXY")])
4200 (define_insn "*subsi3_slb"
4201 [(set (match_operand:SI 0 "register_operand" "=d,d")
4202 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4203 (match_operand:SI 2 "general_operand" "d,m"))
4204 (match_operand:SI 3 "s390_slb_comparison" "")))
4205 (clobber (reg:CC 33))]
4210 [(set_attr "op_type" "RRE,RXY")])
4212 (define_expand "addsicc"
4213 [(match_operand:SI 0 "register_operand" "")
4214 (match_operand 1 "comparison_operator" "")
4215 (match_operand:SI 2 "register_operand" "")
4216 (match_operand:SI 3 "const_int_operand" "")]
4218 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4219 s390_compare_op0, s390_compare_op1,
4220 operands[0], operands[2],
4221 operands[3])) FAIL; DONE;")
4224 ; scond instruction pattern(s).
4227 (define_insn_and_split "*sconddi"
4228 [(set (match_operand:DI 0 "register_operand" "=&d")
4229 (match_operand:DI 1 "s390_alc_comparison" ""))
4230 (clobber (reg:CC 33))]
4233 "&& reload_completed"
4234 [(set (match_dup 0) (const_int 0))
4236 [(set (match_dup 0) (plus:DI (plus:DI (match_dup 0) (match_dup 0))
4238 (clobber (reg:CC 33))])]
4240 [(set_attr "op_type" "NN")])
4242 (define_insn_and_split "*scondsi"
4243 [(set (match_operand:SI 0 "register_operand" "=&d")
4244 (match_operand:SI 1 "s390_alc_comparison" ""))
4245 (clobber (reg:CC 33))]
4248 "&& reload_completed"
4249 [(set (match_dup 0) (const_int 0))
4251 [(set (match_dup 0) (plus:SI (plus:SI (match_dup 0) (match_dup 0))
4253 (clobber (reg:CC 33))])]
4255 [(set_attr "op_type" "NN")])
4257 (define_insn_and_split "*sconddi_neg"
4258 [(set (match_operand:DI 0 "register_operand" "=&d")
4259 (match_operand:DI 1 "s390_slb_comparison" ""))
4260 (clobber (reg:CC 33))]
4263 "&& reload_completed"
4264 [(set (match_dup 0) (const_int 0))
4266 [(set (match_dup 0) (minus:DI (minus:DI (match_dup 0) (match_dup 0))
4268 (clobber (reg:CC 33))])
4270 [(set (match_dup 0) (neg:DI (match_dup 0)))
4271 (clobber (reg:CC 33))])]
4273 [(set_attr "op_type" "NN")])
4275 (define_insn_and_split "*scondsi_neg"
4276 [(set (match_operand:SI 0 "register_operand" "=&d")
4277 (match_operand:SI 1 "s390_slb_comparison" ""))
4278 (clobber (reg:CC 33))]
4281 "&& reload_completed"
4282 [(set (match_dup 0) (const_int 0))
4284 [(set (match_dup 0) (minus:SI (minus:SI (match_dup 0) (match_dup 0))
4286 (clobber (reg:CC 33))])
4288 [(set (match_dup 0) (neg:SI (match_dup 0)))
4289 (clobber (reg:CC 33))])]
4291 [(set_attr "op_type" "NN")])
4293 (define_expand "sltu"
4294 [(match_operand:SI 0 "register_operand" "")]
4296 "if (!s390_expand_addcc (LTU, s390_compare_op0, s390_compare_op1,
4297 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4299 (define_expand "sgtu"
4300 [(match_operand:SI 0 "register_operand" "")]
4302 "if (!s390_expand_addcc (GTU, s390_compare_op0, s390_compare_op1,
4303 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4305 (define_expand "sleu"
4306 [(match_operand:SI 0 "register_operand" "")]
4308 "if (!s390_expand_addcc (LEU, s390_compare_op0, s390_compare_op1,
4309 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4311 (define_expand "sgeu"
4312 [(match_operand:SI 0 "register_operand" "")]
4314 "if (!s390_expand_addcc (GEU, s390_compare_op0, s390_compare_op1,
4315 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4319 ;;- Multiply instructions.
4323 ; muldi3 instruction pattern(s).
4326 (define_insn "*muldi3_sign"
4327 [(set (match_operand:DI 0 "register_operand" "=d,d")
4328 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4329 (match_operand:DI 1 "register_operand" "0,0")))]
4334 [(set_attr "op_type" "RRE,RXY")
4335 (set_attr "type" "imul")])
4337 (define_insn "muldi3"
4338 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4339 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4340 (match_operand:DI 2 "general_operand" "d,K,m")))]
4346 [(set_attr "op_type" "RRE,RI,RXY")
4347 (set_attr "type" "imul")])
4350 ; mulsi3 instruction pattern(s).
4353 (define_insn "*mulsi3_sign"
4354 [(set (match_operand:SI 0 "register_operand" "=d")
4355 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4356 (match_operand:SI 1 "register_operand" "0")))]
4359 [(set_attr "op_type" "RX")
4360 (set_attr "type" "imul")])
4362 (define_insn "mulsi3"
4363 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4364 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4365 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4372 [(set_attr "op_type" "RRE,RI,RX,RXY")
4373 (set_attr "type" "imul")])
4376 ; mulsidi3 instruction pattern(s).
4379 (define_insn "mulsidi3"
4380 [(set (match_operand:DI 0 "register_operand" "=d,d")
4381 (mult:DI (sign_extend:DI
4382 (match_operand:SI 1 "register_operand" "%0,0"))
4384 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4389 [(set_attr "op_type" "RR,RX")
4390 (set_attr "type" "imul")])
4393 ; umulsidi3 instruction pattern(s).
4396 (define_insn "umulsidi3"
4397 [(set (match_operand:DI 0 "register_operand" "=d,d")
4398 (mult:DI (zero_extend:DI
4399 (match_operand:SI 1 "register_operand" "%0,0"))
4401 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4402 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4406 [(set_attr "op_type" "RRE,RXY")
4407 (set_attr "type" "imul")])
4410 ; muldf3 instruction pattern(s).
4413 (define_expand "muldf3"
4414 [(set (match_operand:DF 0 "register_operand" "=f,f")
4415 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4416 (match_operand:DF 2 "general_operand" "f,R")))]
4420 (define_insn "*muldf3"
4421 [(set (match_operand:DF 0 "register_operand" "=f,f")
4422 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4423 (match_operand:DF 2 "general_operand" "f,R")))]
4424 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4428 [(set_attr "op_type" "RRE,RXE")
4429 (set_attr "type" "fmuld")])
4431 (define_insn "*muldf3_ibm"
4432 [(set (match_operand:DF 0 "register_operand" "=f,f")
4433 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4434 (match_operand:DF 2 "general_operand" "f,R")))]
4435 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4439 [(set_attr "op_type" "RR,RX")
4440 (set_attr "type" "fmuld")])
4442 (define_insn "*fmadddf"
4443 [(set (match_operand:DF 0 "register_operand" "=f,f")
4444 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4445 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4446 (match_operand:DF 3 "register_operand" "0,0")))]
4447 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4451 [(set_attr "op_type" "RRE,RXE")
4452 (set_attr "type" "fmuld")])
4454 (define_insn "*fmsubdf"
4455 [(set (match_operand:DF 0 "register_operand" "=f,f")
4456 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4457 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4458 (match_operand:DF 3 "register_operand" "0,0")))]
4459 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4463 [(set_attr "op_type" "RRE,RXE")
4464 (set_attr "type" "fmuld")])
4467 ; mulsf3 instruction pattern(s).
4470 (define_expand "mulsf3"
4471 [(set (match_operand:SF 0 "register_operand" "=f,f")
4472 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4473 (match_operand:SF 2 "general_operand" "f,R")))]
4477 (define_insn "*mulsf3"
4478 [(set (match_operand:SF 0 "register_operand" "=f,f")
4479 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4480 (match_operand:SF 2 "general_operand" "f,R")))]
4481 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4485 [(set_attr "op_type" "RRE,RXE")
4486 (set_attr "type" "fmuls")])
4488 (define_insn "*mulsf3_ibm"
4489 [(set (match_operand:SF 0 "register_operand" "=f,f")
4490 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4491 (match_operand:SF 2 "general_operand" "f,R")))]
4492 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4496 [(set_attr "op_type" "RR,RX")
4497 (set_attr "type" "fmuls")])
4499 (define_insn "*fmaddsf"
4500 [(set (match_operand:SF 0 "register_operand" "=f,f")
4501 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4502 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4503 (match_operand:SF 3 "register_operand" "0,0")))]
4504 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4508 [(set_attr "op_type" "RRE,RXE")
4509 (set_attr "type" "fmuls")])
4511 (define_insn "*fmsubsf"
4512 [(set (match_operand:SF 0 "register_operand" "=f,f")
4513 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4514 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4515 (match_operand:SF 3 "register_operand" "0,0")))]
4516 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4520 [(set_attr "op_type" "RRE,RXE")
4521 (set_attr "type" "fmuls")])
4524 ;;- Divide and modulo instructions.
4528 ; divmoddi4 instruction pattern(s).
4531 (define_expand "divmoddi4"
4532 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4533 (div:DI (match_operand:DI 1 "register_operand" "")
4534 (match_operand:DI 2 "general_operand" "")))
4535 (set (match_operand:DI 3 "general_operand" "")
4536 (mod:DI (match_dup 1) (match_dup 2)))])
4537 (clobber (match_dup 4))]
4540 rtx insn, div_equal, mod_equal;
4542 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4543 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4545 operands[4] = gen_reg_rtx(TImode);
4546 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4548 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4550 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4552 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4554 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4559 (define_insn "divmodtidi3"
4560 [(set (match_operand:TI 0 "register_operand" "=d,d")
4564 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4565 (match_operand:DI 2 "general_operand" "d,m")))
4567 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
4572 [(set_attr "op_type" "RRE,RXY")
4573 (set_attr "type" "idiv")])
4575 (define_insn "divmodtisi3"
4576 [(set (match_operand:TI 0 "register_operand" "=d,d")
4580 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4582 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4585 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
4590 [(set_attr "op_type" "RRE,RXY")
4591 (set_attr "type" "idiv")])
4594 ; udivmoddi4 instruction pattern(s).
4597 (define_expand "udivmoddi4"
4598 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4599 (udiv:DI (match_operand:DI 1 "general_operand" "")
4600 (match_operand:DI 2 "nonimmediate_operand" "")))
4601 (set (match_operand:DI 3 "general_operand" "")
4602 (umod:DI (match_dup 1) (match_dup 2)))])
4603 (clobber (match_dup 4))]
4606 rtx insn, div_equal, mod_equal, equal;
4608 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4609 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4610 equal = gen_rtx_IOR (TImode,
4611 gen_rtx_ASHIFT (TImode,
4612 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4614 gen_rtx_ZERO_EXTEND (TImode, div_equal));
4616 operands[4] = gen_reg_rtx(TImode);
4617 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4618 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4619 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4620 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4622 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4624 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4626 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4628 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4630 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4635 (define_insn "udivmodtidi3"
4636 [(set (match_operand:TI 0 "register_operand" "=d,d")
4641 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
4643 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4647 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
4652 [(set_attr "op_type" "RRE,RXY")
4653 (set_attr "type" "idiv")])
4656 ; divmodsi4 instruction pattern(s).
4659 (define_expand "divmodsi4"
4660 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4661 (div:SI (match_operand:SI 1 "general_operand" "")
4662 (match_operand:SI 2 "nonimmediate_operand" "")))
4663 (set (match_operand:SI 3 "general_operand" "")
4664 (mod:SI (match_dup 1) (match_dup 2)))])
4665 (clobber (match_dup 4))]
4668 rtx insn, div_equal, mod_equal, equal;
4670 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4671 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4672 equal = gen_rtx_IOR (DImode,
4673 gen_rtx_ASHIFT (DImode,
4674 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4676 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4678 operands[4] = gen_reg_rtx(DImode);
4679 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4680 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4682 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4684 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4686 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4688 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4690 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4695 (define_insn "divmoddisi3"
4696 [(set (match_operand:DI 0 "register_operand" "=d,d")
4701 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4703 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4707 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
4712 [(set_attr "op_type" "RR,RX")
4713 (set_attr "type" "idiv")])
4716 ; udivsi3 and umodsi3 instruction pattern(s).
4719 (define_expand "udivmodsi4"
4720 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4721 (udiv:SI (match_operand:SI 1 "general_operand" "")
4722 (match_operand:SI 2 "nonimmediate_operand" "")))
4723 (set (match_operand:SI 3 "general_operand" "")
4724 (umod:SI (match_dup 1) (match_dup 2)))])
4725 (clobber (match_dup 4))]
4726 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4728 rtx insn, div_equal, mod_equal, equal;
4730 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4731 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4732 equal = gen_rtx_IOR (DImode,
4733 gen_rtx_ASHIFT (DImode,
4734 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4736 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4738 operands[4] = gen_reg_rtx(DImode);
4739 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4740 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4741 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4742 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4744 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4746 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4748 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4750 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4752 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4757 (define_insn "udivmoddisi3"
4758 [(set (match_operand:DI 0 "register_operand" "=d,d")
4763 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
4765 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4769 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
4770 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4774 [(set_attr "op_type" "RRE,RXY")
4775 (set_attr "type" "idiv")])
4777 (define_expand "udivsi3"
4778 [(set (match_operand:SI 0 "register_operand" "=d")
4779 (udiv:SI (match_operand:SI 1 "general_operand" "")
4780 (match_operand:SI 2 "general_operand" "")))
4781 (clobber (match_dup 3))]
4782 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4784 rtx insn, udiv_equal, umod_equal, equal;
4786 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4787 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4788 equal = gen_rtx_IOR (DImode,
4789 gen_rtx_ASHIFT (DImode,
4790 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4792 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4794 operands[3] = gen_reg_rtx (DImode);
4796 if (CONSTANT_P (operands[2]))
4798 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4800 rtx label1 = gen_label_rtx ();
4802 operands[1] = make_safe_from (operands[1], operands[0]);
4803 emit_move_insn (operands[0], const0_rtx);
4804 emit_insn (gen_cmpsi (operands[1], operands[2]));
4805 emit_jump_insn (gen_bltu (label1));
4806 emit_move_insn (operands[0], const1_rtx);
4807 emit_label (label1);
4811 operands[2] = force_reg (SImode, operands[2]);
4812 operands[2] = make_safe_from (operands[2], operands[0]);
4814 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4815 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4818 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4820 insn = emit_move_insn (operands[0],
4821 gen_lowpart (SImode, operands[3]));
4823 gen_rtx_EXPR_LIST (REG_EQUAL,
4824 udiv_equal, REG_NOTES (insn));
4829 rtx label1 = gen_label_rtx ();
4830 rtx label2 = gen_label_rtx ();
4831 rtx label3 = gen_label_rtx ();
4833 operands[1] = force_reg (SImode, operands[1]);
4834 operands[1] = make_safe_from (operands[1], operands[0]);
4835 operands[2] = force_reg (SImode, operands[2]);
4836 operands[2] = make_safe_from (operands[2], operands[0]);
4838 emit_move_insn (operands[0], const0_rtx);
4839 emit_insn (gen_cmpsi (operands[2], operands[1]));
4840 emit_jump_insn (gen_bgtu (label3));
4841 emit_insn (gen_cmpsi (operands[2], const0_rtx));
4842 emit_jump_insn (gen_blt (label2));
4843 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4844 emit_jump_insn (gen_beq (label1));
4845 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4846 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4849 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4851 insn = emit_move_insn (operands[0],
4852 gen_lowpart (SImode, operands[3]));
4854 gen_rtx_EXPR_LIST (REG_EQUAL,
4855 udiv_equal, REG_NOTES (insn));
4857 emit_label (label1);
4858 emit_move_insn (operands[0], operands[1]);
4860 emit_label (label2);
4861 emit_move_insn (operands[0], const1_rtx);
4862 emit_label (label3);
4864 emit_move_insn (operands[0], operands[0]);
4868 (define_expand "umodsi3"
4869 [(set (match_operand:SI 0 "register_operand" "=d")
4870 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4871 (match_operand:SI 2 "nonimmediate_operand" "")))
4872 (clobber (match_dup 3))]
4873 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4875 rtx insn, udiv_equal, umod_equal, equal;
4877 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4878 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4879 equal = gen_rtx_IOR (DImode,
4880 gen_rtx_ASHIFT (DImode,
4881 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4883 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4885 operands[3] = gen_reg_rtx (DImode);
4887 if (CONSTANT_P (operands[2]))
4889 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4891 rtx label1 = gen_label_rtx ();
4893 operands[1] = make_safe_from (operands[1], operands[0]);
4894 emit_move_insn (operands[0], operands[1]);
4895 emit_insn (gen_cmpsi (operands[0], operands[2]));
4896 emit_jump_insn (gen_bltu (label1));
4897 emit_insn (gen_abssi2 (operands[0], operands[2]));
4898 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4899 emit_label (label1);
4903 operands[2] = force_reg (SImode, operands[2]);
4904 operands[2] = make_safe_from (operands[2], operands[0]);
4906 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4907 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4910 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4912 insn = emit_move_insn (operands[0],
4913 gen_highpart (SImode, operands[3]));
4915 gen_rtx_EXPR_LIST (REG_EQUAL,
4916 umod_equal, REG_NOTES (insn));
4921 rtx label1 = gen_label_rtx ();
4922 rtx label2 = gen_label_rtx ();
4923 rtx label3 = gen_label_rtx ();
4925 operands[1] = force_reg (SImode, operands[1]);
4926 operands[1] = make_safe_from (operands[1], operands[0]);
4927 operands[2] = force_reg (SImode, operands[2]);
4928 operands[2] = make_safe_from (operands[2], operands[0]);
4930 emit_move_insn(operands[0], operands[1]);
4931 emit_insn (gen_cmpsi (operands[2], operands[1]));
4932 emit_jump_insn (gen_bgtu (label3));
4933 emit_insn (gen_cmpsi (operands[2], const0_rtx));
4934 emit_jump_insn (gen_blt (label2));
4935 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4936 emit_jump_insn (gen_beq (label1));
4937 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4938 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4941 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4943 insn = emit_move_insn (operands[0],
4944 gen_highpart (SImode, operands[3]));
4946 gen_rtx_EXPR_LIST (REG_EQUAL,
4947 umod_equal, REG_NOTES (insn));
4949 emit_label (label1);
4950 emit_move_insn (operands[0], const0_rtx);
4952 emit_label (label2);
4953 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4954 emit_label (label3);
4960 ; divdf3 instruction pattern(s).
4963 (define_expand "divdf3"
4964 [(set (match_operand:DF 0 "register_operand" "=f,f")
4965 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4966 (match_operand:DF 2 "general_operand" "f,R")))]
4970 (define_insn "*divdf3"
4971 [(set (match_operand:DF 0 "register_operand" "=f,f")
4972 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4973 (match_operand:DF 2 "general_operand" "f,R")))]
4974 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4978 [(set_attr "op_type" "RRE,RXE")
4979 (set_attr "type" "fdivd")])
4981 (define_insn "*divdf3_ibm"
4982 [(set (match_operand:DF 0 "register_operand" "=f,f")
4983 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4984 (match_operand:DF 2 "general_operand" "f,R")))]
4985 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4989 [(set_attr "op_type" "RR,RX")
4990 (set_attr "type" "fdivd")])
4993 ; divsf3 instruction pattern(s).
4996 (define_expand "divsf3"
4997 [(set (match_operand:SF 0 "register_operand" "=f,f")
4998 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4999 (match_operand:SF 2 "general_operand" "f,R")))]
5003 (define_insn "*divsf3"
5004 [(set (match_operand:SF 0 "register_operand" "=f,f")
5005 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5006 (match_operand:SF 2 "general_operand" "f,R")))]
5007 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5011 [(set_attr "op_type" "RRE,RXE")
5012 (set_attr "type" "fdivs")])
5014 (define_insn "*divsf3"
5015 [(set (match_operand:SF 0 "register_operand" "=f,f")
5016 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5017 (match_operand:SF 2 "general_operand" "f,R")))]
5018 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5022 [(set_attr "op_type" "RR,RX")
5023 (set_attr "type" "fdivs")])
5027 ;;- And instructions.
5031 ; anddi3 instruction pattern(s).
5034 (define_insn "*anddi3_cc"
5036 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5037 (match_operand:DI 2 "general_operand" "d,m"))
5039 (set (match_operand:DI 0 "register_operand" "=d,d")
5040 (and:DI (match_dup 1) (match_dup 2)))]
5041 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5045 [(set_attr "op_type" "RRE,RXY")])
5047 (define_insn "*anddi3_cconly"
5049 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5050 (match_operand:DI 2 "general_operand" "d,m"))
5052 (clobber (match_scratch:DI 0 "=d,d"))]
5053 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
5054 /* Do not steal TM patterns. */
5055 && s390_single_part (operands[2], DImode, HImode, 0) < 0"
5059 [(set_attr "op_type" "RRE,RXY")])
5061 (define_insn "anddi3"
5062 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d,d,d")
5063 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o,0,0,0,0,0,0")
5064 (match_operand:DI 2 "general_operand"
5065 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m")))
5066 (clobber (reg:CC 33))]
5077 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY")])
5079 (define_insn "*anddi3_ss"
5080 [(set (match_operand:DI 0 "s_operand" "=Q")
5081 (and:DI (match_dup 0)
5082 (match_operand:DI 1 "s_imm_operand" "Q")))
5083 (clobber (reg:CC 33))]
5086 [(set_attr "op_type" "SS")])
5088 (define_insn "*anddi3_ss_inv"
5089 [(set (match_operand:DI 0 "s_operand" "=Q")
5090 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5092 (clobber (reg:CC 33))]
5095 [(set_attr "op_type" "SS")])
5098 ; andsi3 instruction pattern(s).
5101 (define_insn "*andsi3_cc"
5103 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5104 (match_operand:SI 2 "general_operand" "d,R,T"))
5106 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5107 (and:SI (match_dup 1) (match_dup 2)))]
5108 "s390_match_ccmode(insn, CCTmode)"
5113 [(set_attr "op_type" "RR,RX,RXY")])
5115 (define_insn "*andsi3_cconly"
5117 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5118 (match_operand:SI 2 "general_operand" "d,R,T"))
5120 (clobber (match_scratch:SI 0 "=d,d,d"))]
5121 "s390_match_ccmode(insn, CCTmode)
5122 /* Do not steal TM patterns. */
5123 && s390_single_part (operands[2], SImode, HImode, 0) < 0"
5128 [(set_attr "op_type" "RR,RX,RXY")])
5130 (define_expand "andsi3"
5132 [(set (match_operand:SI 0 "register_operand" "")
5133 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
5134 (match_operand:SI 2 "general_operand" "")))
5135 (clobber (reg:CC 33))])]
5139 (define_insn "*andsi3_zarch"
5140 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d,d,d")
5141 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,o,0,0,0,0,0")
5142 (match_operand:SI 2 "general_operand" "M,M,N0HSF,N1HSF,d,R,T")))
5143 (clobber (reg:CC 33))]
5153 [(set_attr "op_type" "RRE,RXE,RI,RI,RR,RX,RXY")])
5155 (define_insn "*andsi3_esa"
5156 [(set (match_operand:SI 0 "register_operand" "=d,d")
5157 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5158 (match_operand:SI 2 "general_operand" "d,R")))
5159 (clobber (reg:CC 33))]
5164 [(set_attr "op_type" "RR,RX")])
5166 (define_insn "*andsi3_ss"
5167 [(set (match_operand:SI 0 "s_operand" "=Q")
5168 (and:SI (match_dup 0)
5169 (match_operand:SI 1 "s_imm_operand" "Q")))
5170 (clobber (reg:CC 33))]
5173 [(set_attr "op_type" "SS")])
5175 (define_insn "*andsi3_ss_inv"
5176 [(set (match_operand:SI 0 "s_operand" "=Q")
5177 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5179 (clobber (reg:CC 33))]
5182 [(set_attr "op_type" "SS")])
5185 ; andhi3 instruction pattern(s).
5188 (define_insn "*andhi3_ni"
5189 [(set (match_operand:HI 0 "register_operand" "=d,d")
5190 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5191 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5192 (clobber (reg:CC 33))]
5197 [(set_attr "op_type" "RR,RI")])
5199 (define_insn "andhi3"
5200 [(set (match_operand:HI 0 "register_operand" "=d")
5201 (and:HI (match_operand:HI 1 "register_operand" "%0")
5202 (match_operand:HI 2 "nonmemory_operand" "d")))
5203 (clobber (reg:CC 33))]
5206 [(set_attr "op_type" "RR")])
5208 (define_insn "*andhi3_ss"
5209 [(set (match_operand:HI 0 "s_operand" "=Q")
5210 (and:HI (match_dup 0)
5211 (match_operand:HI 1 "s_imm_operand" "Q")))
5212 (clobber (reg:CC 33))]
5215 [(set_attr "op_type" "SS")])
5217 (define_insn "*andhi3_ss_inv"
5218 [(set (match_operand:HI 0 "s_operand" "=Q")
5219 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5221 (clobber (reg:CC 33))]
5224 [(set_attr "op_type" "SS")])
5227 ; andqi3 instruction pattern(s).
5230 (define_insn "*andqi3_ni"
5231 [(set (match_operand:QI 0 "register_operand" "=d,d")
5232 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5233 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5234 (clobber (reg:CC 33))]
5239 [(set_attr "op_type" "RR,RI")])
5241 (define_insn "andqi3"
5242 [(set (match_operand:QI 0 "register_operand" "=d")
5243 (and:QI (match_operand:QI 1 "register_operand" "%0")
5244 (match_operand:QI 2 "nonmemory_operand" "d")))
5245 (clobber (reg:CC 33))]
5248 [(set_attr "op_type" "RR")])
5250 (define_insn "*andqi3_ss"
5251 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5252 (and:QI (match_dup 0)
5253 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5254 (clobber (reg:CC 33))]
5260 [(set_attr "op_type" "SI,SIY,SS")])
5262 (define_insn "*andqi3_ss_inv"
5263 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5264 (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5266 (clobber (reg:CC 33))]
5272 [(set_attr "op_type" "SI,SIY,SS")])
5276 ;;- Bit set (inclusive or) instructions.
5280 ; iordi3 instruction pattern(s).
5283 (define_insn "*iordi3_cc"
5285 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5286 (match_operand:DI 2 "general_operand" "d,m"))
5288 (set (match_operand:DI 0 "register_operand" "=d,d")
5289 (ior:DI (match_dup 1) (match_dup 2)))]
5290 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5294 [(set_attr "op_type" "RRE,RXY")])
5296 (define_insn "*iordi3_cconly"
5298 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5299 (match_operand:DI 2 "general_operand" "d,m"))
5301 (clobber (match_scratch:DI 0 "=d,d"))]
5302 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5306 [(set_attr "op_type" "RRE,RXY")])
5308 (define_insn "iordi3"
5309 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d")
5310 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,0,0,0,0")
5311 (match_operand:DI 2 "general_operand" "N0HD0,N1HD0,N2HD0,N3HD0,d,m")))
5312 (clobber (reg:CC 33))]
5321 [(set_attr "op_type" "RI,RI,RI,RI,RRE,RXY")])
5323 (define_insn "*iordi3_ss"
5324 [(set (match_operand:DI 0 "s_operand" "=Q")
5325 (ior:DI (match_dup 0)
5326 (match_operand:DI 1 "s_imm_operand" "Q")))
5327 (clobber (reg:CC 33))]
5330 [(set_attr "op_type" "SS")])
5332 (define_insn "*iordi3_ss_inv"
5333 [(set (match_operand:DI 0 "s_operand" "=Q")
5334 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5336 (clobber (reg:CC 33))]
5339 [(set_attr "op_type" "SS")])
5342 ; iorsi3 instruction pattern(s).
5345 (define_insn "*iorsi3_cc"
5347 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5348 (match_operand:SI 2 "general_operand" "d,R,T"))
5350 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5351 (ior:SI (match_dup 1) (match_dup 2)))]
5352 "s390_match_ccmode(insn, CCTmode)"
5357 [(set_attr "op_type" "RR,RX,RXY")])
5359 (define_insn "*iorsi3_cconly"
5361 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5362 (match_operand:SI 2 "general_operand" "d,R,T"))
5364 (clobber (match_scratch:SI 0 "=d,d,d"))]
5365 "s390_match_ccmode(insn, CCTmode)"
5370 [(set_attr "op_type" "RR,RX,RXY")])
5372 (define_expand "iorsi3"
5374 [(set (match_operand:SI 0 "register_operand" "")
5375 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
5376 (match_operand:SI 2 "general_operand" "")))
5377 (clobber (reg:CC 33))])]
5381 (define_insn "iorsi3_zarch"
5382 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
5383 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0,0")
5384 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,d,R,T")))
5385 (clobber (reg:CC 33))]
5393 [(set_attr "op_type" "RI,RI,RR,RX,RXY")])
5395 (define_insn "iorsi3_esa"
5396 [(set (match_operand:SI 0 "register_operand" "=d,d")
5397 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
5398 (match_operand:SI 2 "general_operand" "d,R")))
5399 (clobber (reg:CC 33))]
5404 [(set_attr "op_type" "RR,RX")])
5406 (define_insn "*iorsi3_ss"
5407 [(set (match_operand:SI 0 "s_operand" "=Q")
5408 (ior:SI (match_dup 0)
5409 (match_operand:SI 1 "s_imm_operand" "Q")))
5410 (clobber (reg:CC 33))]
5413 [(set_attr "op_type" "SS")])
5415 (define_insn "*iorsi3_ss_inv"
5416 [(set (match_operand:SI 0 "s_operand" "=Q")
5417 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5419 (clobber (reg:CC 33))]
5422 [(set_attr "op_type" "SS")])
5425 ; iorhi3 instruction pattern(s).
5428 (define_insn "*iorhi3_oi"
5429 [(set (match_operand:HI 0 "register_operand" "=d,d")
5430 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5431 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5432 (clobber (reg:CC 33))]
5437 [(set_attr "op_type" "RR,RI")])
5439 (define_insn "iorhi3"
5440 [(set (match_operand:HI 0 "register_operand" "=d")
5441 (ior:HI (match_operand:HI 1 "register_operand" "%0")
5442 (match_operand:HI 2 "nonmemory_operand" "d")))
5443 (clobber (reg:CC 33))]
5446 [(set_attr "op_type" "RR")])
5448 (define_insn "*iorhi3_ss"
5449 [(set (match_operand:HI 0 "s_operand" "=Q")
5450 (ior:HI (match_dup 0)
5451 (match_operand:HI 1 "s_imm_operand" "Q")))
5452 (clobber (reg:CC 33))]
5455 [(set_attr "op_type" "SS")])
5457 (define_insn "*iorhi3_ss_inv"
5458 [(set (match_operand:HI 0 "s_operand" "=Q")
5459 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5461 (clobber (reg:CC 33))]
5464 [(set_attr "op_type" "SS")])
5467 ; iorqi3 instruction pattern(s).
5470 (define_insn "*iorqi3_oi"
5471 [(set (match_operand:QI 0 "register_operand" "=d,d")
5472 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5473 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5474 (clobber (reg:CC 33))]
5479 [(set_attr "op_type" "RR,RI")])
5481 (define_insn "iorqi3"
5482 [(set (match_operand:QI 0 "register_operand" "=d")
5483 (ior:QI (match_operand:QI 1 "register_operand" "%0")
5484 (match_operand:QI 2 "nonmemory_operand" "d")))
5485 (clobber (reg:CC 33))]
5488 [(set_attr "op_type" "RR")])
5490 (define_insn "*iorqi3_ss"
5491 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5492 (ior:QI (match_dup 0)
5493 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5494 (clobber (reg:CC 33))]
5500 [(set_attr "op_type" "SI,SIY,SS")])
5502 (define_insn "*iorqi3_ss_inv"
5503 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5504 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5506 (clobber (reg:CC 33))]
5512 [(set_attr "op_type" "SI,SIY,SS")])
5516 ;;- Xor instructions.
5520 ; xordi3 instruction pattern(s).
5523 (define_insn "*xordi3_cc"
5525 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5526 (match_operand:DI 2 "general_operand" "d,m"))
5528 (set (match_operand:DI 0 "register_operand" "=d,d")
5529 (xor:DI (match_dup 1) (match_dup 2)))]
5530 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5534 [(set_attr "op_type" "RRE,RXY")])
5536 (define_insn "*xordi3_cconly"
5538 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5539 (match_operand:DI 2 "general_operand" "d,m"))
5541 (clobber (match_scratch:DI 0 "=d,d"))]
5542 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5546 [(set_attr "op_type" "RRE,RXY")])
5548 (define_insn "xordi3"
5549 [(set (match_operand:DI 0 "register_operand" "=d,d")
5550 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5551 (match_operand:DI 2 "general_operand" "d,m")))
5552 (clobber (reg:CC 33))]
5557 [(set_attr "op_type" "RRE,RXY")])
5559 (define_insn "*xordi3_ss"
5560 [(set (match_operand:DI 0 "s_operand" "=Q")
5561 (xor:DI (match_dup 0)
5562 (match_operand:DI 1 "s_imm_operand" "Q")))
5563 (clobber (reg:CC 33))]
5566 [(set_attr "op_type" "SS")])
5568 (define_insn "*xordi3_ss_inv"
5569 [(set (match_operand:DI 0 "s_operand" "=Q")
5570 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5572 (clobber (reg:CC 33))]
5575 [(set_attr "op_type" "SS")])
5578 ; xorsi3 instruction pattern(s).
5581 (define_insn "*xorsi3_cc"
5583 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5584 (match_operand:SI 2 "general_operand" "d,R,T"))
5586 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5587 (xor:SI (match_dup 1) (match_dup 2)))]
5588 "s390_match_ccmode(insn, CCTmode)"
5593 [(set_attr "op_type" "RR,RX,RXY")])
5595 (define_insn "*xorsi3_cconly"
5597 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5598 (match_operand:SI 2 "general_operand" "d,R,T"))
5600 (clobber (match_scratch:SI 0 "=d,d,d"))]
5601 "s390_match_ccmode(insn, CCTmode)"
5606 [(set_attr "op_type" "RR,RX,RXY")])
5608 (define_insn "xorsi3"
5609 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5610 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5611 (match_operand:SI 2 "general_operand" "d,R,T")))
5612 (clobber (reg:CC 33))]
5618 [(set_attr "op_type" "RR,RX,RXY")])
5620 (define_insn "*xorsi3_ss"
5621 [(set (match_operand:SI 0 "s_operand" "=Q")
5622 (xor:SI (match_dup 0)
5623 (match_operand:SI 1 "s_imm_operand" "Q")))
5624 (clobber (reg:CC 33))]
5627 [(set_attr "op_type" "SS")])
5629 (define_insn "*xorsi3_ss_inv"
5630 [(set (match_operand:SI 0 "s_operand" "=Q")
5631 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5633 (clobber (reg:CC 33))]
5636 [(set_attr "op_type" "SS")])
5639 ; xorhi3 instruction pattern(s).
5642 (define_insn "xorhi3"
5643 [(set (match_operand:HI 0 "register_operand" "=d")
5644 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5645 (match_operand:HI 2 "nonmemory_operand" "d")))
5646 (clobber (reg:CC 33))]
5649 [(set_attr "op_type" "RR")])
5651 (define_insn "*xorhi3_ss"
5652 [(set (match_operand:HI 0 "s_operand" "=Q")
5653 (xor:HI (match_dup 0)
5654 (match_operand:HI 1 "s_imm_operand" "Q")))
5655 (clobber (reg:CC 33))]
5658 [(set_attr "op_type" "SS")])
5660 (define_insn "*xorhi3_ss_inv"
5661 [(set (match_operand:HI 0 "s_operand" "=Q")
5662 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5664 (clobber (reg:CC 33))]
5667 [(set_attr "op_type" "SS")])
5670 ; xorqi3 instruction pattern(s).
5673 (define_insn "xorqi3"
5674 [(set (match_operand:QI 0 "register_operand" "=d")
5675 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5676 (match_operand:QI 2 "nonmemory_operand" "d")))
5677 (clobber (reg:CC 33))]
5680 [(set_attr "op_type" "RR")])
5682 (define_insn "*xorqi3_ss"
5683 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5684 (xor:QI (match_dup 0)
5685 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5686 (clobber (reg:CC 33))]
5692 [(set_attr "op_type" "SI,SIY,SS")])
5694 (define_insn "*xorqi3_ss_inv"
5695 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5696 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5698 (clobber (reg:CC 33))]
5704 [(set_attr "op_type" "SI,SIY,SS")])
5708 ;;- Negate instructions.
5712 ; negdi2 instruction pattern(s).
5715 (define_expand "negdi2"
5717 [(set (match_operand:DI 0 "register_operand" "=d")
5718 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5719 (clobber (reg:CC 33))])]
5723 (define_insn "*negdi2_64"
5724 [(set (match_operand:DI 0 "register_operand" "=d")
5725 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5726 (clobber (reg:CC 33))]
5729 [(set_attr "op_type" "RR")])
5731 (define_insn "*negdi2_31"
5732 [(set (match_operand:DI 0 "register_operand" "=d")
5733 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5734 (clobber (reg:CC 33))]
5738 xop[0] = gen_label_rtx ();
5739 output_asm_insn ("lcr\t%0,%1", operands);
5740 output_asm_insn ("lcr\t%N0,%N1", operands);
5741 output_asm_insn ("je\t%l0", xop);
5742 output_asm_insn ("bctr\t%0,0", operands);
5743 targetm.asm_out.internal_label (asm_out_file, "L",
5744 CODE_LABEL_NUMBER (xop[0]));
5747 [(set_attr "op_type" "NN")
5748 (set_attr "type" "other")
5749 (set_attr "length" "10")])
5752 ; negsi2 instruction pattern(s).
5755 (define_insn "negsi2"
5756 [(set (match_operand:SI 0 "register_operand" "=d")
5757 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5758 (clobber (reg:CC 33))]
5761 [(set_attr "op_type" "RR")])
5764 ; negdf2 instruction pattern(s).
5767 (define_expand "negdf2"
5769 [(set (match_operand:DF 0 "register_operand" "=f")
5770 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5771 (clobber (reg:CC 33))])]
5775 (define_insn "*negdf2"
5776 [(set (match_operand:DF 0 "register_operand" "=f")
5777 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5778 (clobber (reg:CC 33))]
5779 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5781 [(set_attr "op_type" "RRE")
5782 (set_attr "type" "fsimpd")])
5784 (define_insn "*negdf2_ibm"
5785 [(set (match_operand:DF 0 "register_operand" "=f")
5786 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5787 (clobber (reg:CC 33))]
5788 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5790 [(set_attr "op_type" "RR")
5791 (set_attr "type" "fsimpd")])
5794 ; negsf2 instruction pattern(s).
5797 (define_expand "negsf2"
5799 [(set (match_operand:SF 0 "register_operand" "=f")
5800 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5801 (clobber (reg:CC 33))])]
5805 (define_insn "*negsf2"
5806 [(set (match_operand:SF 0 "register_operand" "=f")
5807 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5808 (clobber (reg:CC 33))]
5809 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5811 [(set_attr "op_type" "RRE")
5812 (set_attr "type" "fsimps")])
5814 (define_insn "*negsf2"
5815 [(set (match_operand:SF 0 "register_operand" "=f")
5816 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5817 (clobber (reg:CC 33))]
5818 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5820 [(set_attr "op_type" "RR")
5821 (set_attr "type" "fsimps")])
5825 ;;- Absolute value instructions.
5829 ; absdi2 instruction pattern(s).
5832 (define_insn "absdi2"
5833 [(set (match_operand:DI 0 "register_operand" "=d")
5834 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5835 (clobber (reg:CC 33))]
5838 [(set_attr "op_type" "RRE")])
5841 ; abssi2 instruction pattern(s).
5844 (define_insn "abssi2"
5845 [(set (match_operand:SI 0 "register_operand" "=d")
5846 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5847 (clobber (reg:CC 33))]
5850 [(set_attr "op_type" "RR")])
5853 ; absdf2 instruction pattern(s).
5856 (define_expand "absdf2"
5858 [(set (match_operand:DF 0 "register_operand" "=f")
5859 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5860 (clobber (reg:CC 33))])]
5864 (define_insn "*absdf2"
5865 [(set (match_operand:DF 0 "register_operand" "=f")
5866 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5867 (clobber (reg:CC 33))]
5868 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5870 [(set_attr "op_type" "RRE")
5871 (set_attr "type" "fsimpd")])
5873 (define_insn "*absdf2_ibm"
5874 [(set (match_operand:DF 0 "register_operand" "=f")
5875 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5876 (clobber (reg:CC 33))]
5877 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5879 [(set_attr "op_type" "RR")
5880 (set_attr "type" "fsimpd")])
5883 ; abssf2 instruction pattern(s).
5886 (define_expand "abssf2"
5888 [(set (match_operand:SF 0 "register_operand" "=f")
5889 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5890 (clobber (reg:CC 33))])]
5894 (define_insn "*abssf2"
5895 [(set (match_operand:SF 0 "register_operand" "=f")
5896 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5897 (clobber (reg:CC 33))]
5898 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5900 [(set_attr "op_type" "RRE")
5901 (set_attr "type" "fsimps")])
5903 (define_insn "*abssf2_ibm"
5904 [(set (match_operand:SF 0 "register_operand" "=f")
5905 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5906 (clobber (reg:CC 33))]
5907 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5909 [(set_attr "op_type" "RR")
5910 (set_attr "type" "fsimps")])
5913 ;;- Negated absolute value instructions
5920 (define_insn "*negabssi2"
5921 [(set (match_operand:SI 0 "register_operand" "=d")
5922 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
5923 (clobber (reg:CC 33))]
5926 [(set_attr "op_type" "RR")])
5928 (define_insn "*negabsdi2"
5929 [(set (match_operand:DI 0 "register_operand" "=d")
5930 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
5931 (clobber (reg:CC 33))]
5934 [(set_attr "op_type" "RRE")])
5940 (define_insn "*negabssf2"
5941 [(set (match_operand:SF 0 "register_operand" "=f")
5942 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5943 (clobber (reg:CC 33))]
5944 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5946 [(set_attr "op_type" "RRE")
5947 (set_attr "type" "fsimps")])
5949 (define_insn "*negabsdf2"
5950 [(set (match_operand:DF 0 "register_operand" "=f")
5951 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5952 (clobber (reg:CC 33))]
5953 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5955 [(set_attr "op_type" "RRE")
5956 (set_attr "type" "fsimpd")])
5959 ;;- Square root instructions.
5963 ; sqrtdf2 instruction pattern(s).
5966 (define_insn "sqrtdf2"
5967 [(set (match_operand:DF 0 "register_operand" "=f,f")
5968 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
5969 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5973 [(set_attr "op_type" "RRE,RXE")])
5976 ; sqrtsf2 instruction pattern(s).
5979 (define_insn "sqrtsf2"
5980 [(set (match_operand:SF 0 "register_operand" "=f,f")
5981 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
5982 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5986 [(set_attr "op_type" "RRE,RXE")])
5989 ;;- One complement instructions.
5993 ; one_cmpldi2 instruction pattern(s).
5996 (define_expand "one_cmpldi2"
5998 [(set (match_operand:DI 0 "register_operand" "")
5999 (xor:DI (match_operand:DI 1 "register_operand" "")
6001 (clobber (reg:CC 33))])]
6006 ; one_cmplsi2 instruction pattern(s).
6009 (define_expand "one_cmplsi2"
6011 [(set (match_operand:SI 0 "register_operand" "")
6012 (xor:SI (match_operand:SI 1 "register_operand" "")
6014 (clobber (reg:CC 33))])]
6019 ; one_cmplhi2 instruction pattern(s).
6022 (define_expand "one_cmplhi2"
6024 [(set (match_operand:HI 0 "register_operand" "")
6025 (xor:HI (match_operand:HI 1 "register_operand" "")
6027 (clobber (reg:CC 33))])]
6032 ; one_cmplqi2 instruction pattern(s).
6035 (define_expand "one_cmplqi2"
6037 [(set (match_operand:QI 0 "register_operand" "")
6038 (xor:QI (match_operand:QI 1 "register_operand" "")
6040 (clobber (reg:CC 33))])]
6046 ;;- Rotate instructions.
6050 ; rotldi3 instruction pattern(s).
6053 (define_insn "rotldi3"
6054 [(set (match_operand:DI 0 "register_operand" "=d")
6055 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6056 (match_operand:SI 2 "shift_count_operand" "Y")))]
6059 [(set_attr "op_type" "RSE")
6060 (set_attr "atype" "reg")])
6063 ; rotlsi3 instruction pattern(s).
6066 (define_insn "rotlsi3"
6067 [(set (match_operand:SI 0 "register_operand" "=d")
6068 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6069 (match_operand:SI 2 "shift_count_operand" "Y")))]
6072 [(set_attr "op_type" "RSE")
6073 (set_attr "atype" "reg")])
6077 ;;- Arithmetic shift instructions.
6081 ; ashldi3 instruction pattern(s).
6084 (define_expand "ashldi3"
6085 [(set (match_operand:DI 0 "register_operand" "")
6086 (ashift:DI (match_operand:DI 1 "register_operand" "")
6087 (match_operand:SI 2 "shift_count_operand" "")))]
6091 (define_insn "*ashldi3_31"
6092 [(set (match_operand:DI 0 "register_operand" "=d")
6093 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6094 (match_operand:SI 2 "shift_count_operand" "Y")))]
6097 [(set_attr "op_type" "RS")
6098 (set_attr "atype" "reg")])
6100 (define_insn "*ashldi3_64"
6101 [(set (match_operand:DI 0 "register_operand" "=d")
6102 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6103 (match_operand:SI 2 "shift_count_operand" "Y")))]
6106 [(set_attr "op_type" "RSE")
6107 (set_attr "atype" "reg")])
6110 ; ashrdi3 instruction pattern(s).
6113 (define_expand "ashrdi3"
6115 [(set (match_operand:DI 0 "register_operand" "")
6116 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6117 (match_operand:SI 2 "shift_count_operand" "")))
6118 (clobber (reg:CC 33))])]
6122 (define_insn "*ashrdi3_cc_31"
6124 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6125 (match_operand:SI 2 "shift_count_operand" "Y"))
6127 (set (match_operand:DI 0 "register_operand" "=d")
6128 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6129 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6131 [(set_attr "op_type" "RS")
6132 (set_attr "atype" "reg")])
6134 (define_insn "*ashrdi3_cconly_31"
6136 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6137 (match_operand:SI 2 "shift_count_operand" "Y"))
6139 (clobber (match_scratch:DI 0 "=d"))]
6140 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6142 [(set_attr "op_type" "RS")
6143 (set_attr "atype" "reg")])
6145 (define_insn "*ashrdi3_31"
6146 [(set (match_operand:DI 0 "register_operand" "=d")
6147 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6148 (match_operand:SI 2 "shift_count_operand" "Y")))
6149 (clobber (reg:CC 33))]
6152 [(set_attr "op_type" "RS")
6153 (set_attr "atype" "reg")])
6155 (define_insn "*ashrdi3_cc_64"
6157 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6158 (match_operand:SI 2 "shift_count_operand" "Y"))
6160 (set (match_operand:DI 0 "register_operand" "=d")
6161 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6162 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6164 [(set_attr "op_type" "RSE")
6165 (set_attr "atype" "reg")])
6167 (define_insn "*ashrdi3_cconly_64"
6169 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6170 (match_operand:SI 2 "shift_count_operand" "Y"))
6172 (clobber (match_scratch:DI 0 "=d"))]
6173 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6175 [(set_attr "op_type" "RSE")
6176 (set_attr "atype" "reg")])
6178 (define_insn "*ashrdi3_64"
6179 [(set (match_operand:DI 0 "register_operand" "=d")
6180 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6181 (match_operand:SI 2 "shift_count_operand" "Y")))
6182 (clobber (reg:CC 33))]
6185 [(set_attr "op_type" "RSE")
6186 (set_attr "atype" "reg")])
6190 ; ashlsi3 instruction pattern(s).
6193 (define_insn "ashlsi3"
6194 [(set (match_operand:SI 0 "register_operand" "=d")
6195 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6196 (match_operand:SI 2 "shift_count_operand" "Y")))]
6199 [(set_attr "op_type" "RS")
6200 (set_attr "atype" "reg")])
6203 ; ashrsi3 instruction pattern(s).
6206 (define_insn "*ashrsi3_cc"
6208 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6209 (match_operand:SI 2 "shift_count_operand" "Y"))
6211 (set (match_operand:SI 0 "register_operand" "=d")
6212 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6213 "s390_match_ccmode(insn, CCSmode)"
6215 [(set_attr "op_type" "RS")
6216 (set_attr "atype" "reg")])
6219 (define_insn "*ashrsi3_cconly"
6221 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6222 (match_operand:SI 2 "shift_count_operand" "Y"))
6224 (clobber (match_scratch:SI 0 "=d"))]
6225 "s390_match_ccmode(insn, CCSmode)"
6227 [(set_attr "op_type" "RS")
6228 (set_attr "atype" "reg")])
6230 (define_insn "ashrsi3"
6231 [(set (match_operand:SI 0 "register_operand" "=d")
6232 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6233 (match_operand:SI 2 "shift_count_operand" "Y")))
6234 (clobber (reg:CC 33))]
6237 [(set_attr "op_type" "RS")
6238 (set_attr "atype" "reg")])
6242 ;;- logical shift instructions.
6246 ; lshrdi3 instruction pattern(s).
6249 (define_expand "lshrdi3"
6250 [(set (match_operand:DI 0 "register_operand" "")
6251 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6252 (match_operand:SI 2 "shift_count_operand" "")))]
6256 (define_insn "*lshrdi3_31"
6257 [(set (match_operand:DI 0 "register_operand" "=d")
6258 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6259 (match_operand:SI 2 "shift_count_operand" "Y")))]
6262 [(set_attr "op_type" "RS")
6263 (set_attr "atype" "reg")])
6265 (define_insn "*lshrdi3_64"
6266 [(set (match_operand:DI 0 "register_operand" "=d")
6267 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6268 (match_operand:SI 2 "shift_count_operand" "Y")))]
6271 [(set_attr "op_type" "RSE")
6272 (set_attr "atype" "reg")])
6275 ; lshrsi3 instruction pattern(s).
6278 (define_insn "lshrsi3"
6279 [(set (match_operand:SI 0 "register_operand" "=d")
6280 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6281 (match_operand:SI 2 "shift_count_operand" "Y")))]
6284 [(set_attr "op_type" "RS")
6285 (set_attr "atype" "reg")])
6289 ;; Branch instruction patterns.
6292 (define_expand "beq"
6293 [(match_operand 0 "" "")]
6295 "s390_emit_jump (operands[0],
6296 s390_emit_compare (EQ, s390_compare_op0, s390_compare_op1)); DONE;")
6298 (define_expand "bne"
6299 [(match_operand 0 "" "")]
6301 "s390_emit_jump (operands[0],
6302 s390_emit_compare (NE, s390_compare_op0, s390_compare_op1)); DONE;")
6304 (define_expand "bgt"
6305 [(match_operand 0 "" "")]
6307 "s390_emit_jump (operands[0],
6308 s390_emit_compare (GT, s390_compare_op0, s390_compare_op1)); DONE;")
6310 (define_expand "bgtu"
6311 [(match_operand 0 "" "")]
6313 "s390_emit_jump (operands[0],
6314 s390_emit_compare (GTU, s390_compare_op0, s390_compare_op1)); DONE;")
6316 (define_expand "blt"
6317 [(match_operand 0 "" "")]
6319 "s390_emit_jump (operands[0],
6320 s390_emit_compare (LT, s390_compare_op0, s390_compare_op1)); DONE;")
6322 (define_expand "bltu"
6323 [(match_operand 0 "" "")]
6325 "s390_emit_jump (operands[0],
6326 s390_emit_compare (LTU, s390_compare_op0, s390_compare_op1)); DONE;")
6328 (define_expand "bge"
6329 [(match_operand 0 "" "")]
6331 "s390_emit_jump (operands[0],
6332 s390_emit_compare (GE, s390_compare_op0, s390_compare_op1)); DONE;")
6334 (define_expand "bgeu"
6335 [(match_operand 0 "" "")]
6337 "s390_emit_jump (operands[0],
6338 s390_emit_compare (GEU, s390_compare_op0, s390_compare_op1)); DONE;")
6340 (define_expand "ble"
6341 [(match_operand 0 "" "")]
6343 "s390_emit_jump (operands[0],
6344 s390_emit_compare (LE, s390_compare_op0, s390_compare_op1)); DONE;")
6346 (define_expand "bleu"
6347 [(match_operand 0 "" "")]
6349 "s390_emit_jump (operands[0],
6350 s390_emit_compare (LEU, s390_compare_op0, s390_compare_op1)); DONE;")
6352 (define_expand "bunordered"
6353 [(match_operand 0 "" "")]
6355 "s390_emit_jump (operands[0],
6356 s390_emit_compare (UNORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6358 (define_expand "bordered"
6359 [(match_operand 0 "" "")]
6361 "s390_emit_jump (operands[0],
6362 s390_emit_compare (ORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6364 (define_expand "buneq"
6365 [(match_operand 0 "" "")]
6367 "s390_emit_jump (operands[0],
6368 s390_emit_compare (UNEQ, s390_compare_op0, s390_compare_op1)); DONE;")
6370 (define_expand "bunlt"
6371 [(match_operand 0 "" "")]
6373 "s390_emit_jump (operands[0],
6374 s390_emit_compare (UNLT, s390_compare_op0, s390_compare_op1)); DONE;")
6376 (define_expand "bungt"
6377 [(match_operand 0 "" "")]
6379 "s390_emit_jump (operands[0],
6380 s390_emit_compare (UNGT, s390_compare_op0, s390_compare_op1)); DONE;")
6382 (define_expand "bunle"
6383 [(match_operand 0 "" "")]
6385 "s390_emit_jump (operands[0],
6386 s390_emit_compare (UNLE, s390_compare_op0, s390_compare_op1)); DONE;")
6388 (define_expand "bunge"
6389 [(match_operand 0 "" "")]
6391 "s390_emit_jump (operands[0],
6392 s390_emit_compare (UNGE, s390_compare_op0, s390_compare_op1)); DONE;")
6394 (define_expand "bltgt"
6395 [(match_operand 0 "" "")]
6397 "s390_emit_jump (operands[0],
6398 s390_emit_compare (LTGT, s390_compare_op0, s390_compare_op1)); DONE;")
6402 ;;- Conditional jump instructions.
6405 (define_insn "*cjump_64"
6408 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6409 (label_ref (match_operand 0 "" ""))
6413 if (get_attr_length (insn) == 4)
6416 return "jg%C1\t%l0";
6418 [(set_attr "op_type" "RI")
6419 (set_attr "type" "branch")
6420 (set (attr "length")
6421 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6422 (const_int 4) (const_int 6)))])
6424 (define_insn "*cjump_31"
6427 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6428 (label_ref (match_operand 0 "" ""))
6432 if (get_attr_length (insn) == 4)
6437 [(set_attr "op_type" "RI")
6438 (set_attr "type" "branch")
6439 (set (attr "length")
6440 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6441 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6442 (const_int 4) (const_int 6))
6443 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6444 (const_int 4) (const_int 8))))])
6446 (define_insn "*cjump_long"
6449 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6450 (match_operand 0 "address_operand" "U")
6454 if (get_attr_op_type (insn) == OP_TYPE_RR)
6459 [(set (attr "op_type")
6460 (if_then_else (match_operand 0 "register_operand" "")
6461 (const_string "RR") (const_string "RX")))
6462 (set_attr "type" "branch")
6463 (set_attr "atype" "agen")])
6467 ;;- Negated conditional jump instructions.
6470 (define_insn "*icjump_64"
6473 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6475 (label_ref (match_operand 0 "" ""))))]
6478 if (get_attr_length (insn) == 4)
6481 return "jg%D1\t%l0";
6483 [(set_attr "op_type" "RI")
6484 (set_attr "type" "branch")
6485 (set (attr "length")
6486 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6487 (const_int 4) (const_int 6)))])
6489 (define_insn "*icjump_31"
6492 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6494 (label_ref (match_operand 0 "" ""))))]
6497 if (get_attr_length (insn) == 4)
6502 [(set_attr "op_type" "RI")
6503 (set_attr "type" "branch")
6504 (set (attr "length")
6505 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6506 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6507 (const_int 4) (const_int 6))
6508 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6509 (const_int 4) (const_int 8))))])
6511 (define_insn "*icjump_long"
6514 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6516 (match_operand 0 "address_operand" "U")))]
6519 if (get_attr_op_type (insn) == OP_TYPE_RR)
6524 [(set (attr "op_type")
6525 (if_then_else (match_operand 0 "register_operand" "")
6526 (const_string "RR") (const_string "RX")))
6527 (set_attr "type" "branch")
6528 (set_attr "atype" "agen")])
6531 ;;- Trap instructions.
6535 [(trap_if (const_int 1) (const_int 0))]
6538 [(set_attr "op_type" "RI")
6539 (set_attr "type" "branch")])
6541 (define_expand "conditional_trap"
6542 [(trap_if (match_operand 0 "comparison_operator" "")
6543 (match_operand 1 "general_operand" ""))]
6546 if (operands[1] != const0_rtx) FAIL;
6547 operands[0] = s390_emit_compare (GET_CODE (operands[0]),
6548 s390_compare_op0, s390_compare_op1);
6551 (define_insn "*trap"
6552 [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6556 [(set_attr "op_type" "RI")
6557 (set_attr "type" "branch")])
6560 ;;- Loop instructions.
6562 ;; This is all complicated by the fact that since this is a jump insn
6563 ;; we must handle our own output reloads.
6565 (define_expand "doloop_end"
6566 [(use (match_operand 0 "" "")) ; loop pseudo
6567 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6568 (use (match_operand 2 "" "")) ; max iterations
6569 (use (match_operand 3 "" "")) ; loop level
6570 (use (match_operand 4 "" ""))] ; label
6573 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
6574 emit_jump_insn (gen_doloop_si31 (operands[4], operands[0], operands[0]));
6575 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
6576 emit_jump_insn (gen_doloop_si64 (operands[4], operands[0], operands[0]));
6577 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6578 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6585 (define_insn_and_split "doloop_si64"
6588 (ne (match_operand:SI 1 "register_operand" "d,d")
6590 (label_ref (match_operand 0 "" ""))
6592 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6593 (plus:SI (match_dup 1) (const_int -1)))
6594 (clobber (match_scratch:SI 3 "=X,&d"))
6595 (clobber (reg:CC 33))]
6598 if (which_alternative != 0)
6600 else if (get_attr_length (insn) == 4)
6601 return "brct\t%1,%l0";
6603 return "ahi\t%1,-1\;jgne\t%l0";
6605 "&& reload_completed
6606 && (! REG_P (operands[2])
6607 || ! rtx_equal_p (operands[1], operands[2]))"
6608 [(set (match_dup 3) (match_dup 1))
6609 (parallel [(set (reg:CCAN 33)
6610 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6612 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6613 (set (match_dup 2) (match_dup 3))
6614 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6615 (label_ref (match_dup 0))
6618 [(set_attr "op_type" "RI")
6619 (set_attr "type" "branch")
6620 (set (attr "length")
6621 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6622 (const_int 4) (const_int 10)))])
6624 (define_insn_and_split "doloop_si31"
6627 (ne (match_operand:SI 1 "register_operand" "d,d")
6629 (label_ref (match_operand 0 "" ""))
6631 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6632 (plus:SI (match_dup 1) (const_int -1)))
6633 (clobber (match_scratch:SI 3 "=X,&d"))
6634 (clobber (reg:CC 33))]
6637 if (which_alternative != 0)
6639 else if (get_attr_length (insn) == 4)
6640 return "brct\t%1,%l0";
6644 "&& reload_completed
6645 && (! REG_P (operands[2])
6646 || ! rtx_equal_p (operands[1], operands[2]))"
6647 [(set (match_dup 3) (match_dup 1))
6648 (parallel [(set (reg:CCAN 33)
6649 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6651 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6652 (set (match_dup 2) (match_dup 3))
6653 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6654 (label_ref (match_dup 0))
6657 [(set_attr "op_type" "RI")
6658 (set_attr "type" "branch")
6659 (set (attr "length")
6660 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6661 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6662 (const_int 4) (const_int 6))
6663 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6664 (const_int 4) (const_int 8))))])
6666 (define_insn "*doloop_si_long"
6669 (ne (match_operand:SI 1 "register_operand" "d,d")
6671 (match_operand 0 "address_operand" "U,U")
6673 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6674 (plus:SI (match_dup 1) (const_int -1)))
6675 (clobber (match_scratch:SI 3 "=X,&d"))
6676 (clobber (reg:CC 33))]
6679 if (get_attr_op_type (insn) == OP_TYPE_RR)
6680 return "bctr\t%1,%0";
6682 return "bct\t%1,%a0";
6684 [(set (attr "op_type")
6685 (if_then_else (match_operand 0 "register_operand" "")
6686 (const_string "RR") (const_string "RX")))
6687 (set_attr "type" "branch")
6688 (set_attr "atype" "agen")])
6690 (define_insn_and_split "doloop_di"
6693 (ne (match_operand:DI 1 "register_operand" "d,d")
6695 (label_ref (match_operand 0 "" ""))
6697 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?*m*r")
6698 (plus:DI (match_dup 1) (const_int -1)))
6699 (clobber (match_scratch:DI 3 "=X,&d"))
6700 (clobber (reg:CC 33))]
6703 if (which_alternative != 0)
6705 else if (get_attr_length (insn) == 4)
6706 return "brctg\t%1,%l0";
6708 return "aghi\t%1,-1\;jgne\t%l0";
6710 "&& reload_completed
6711 && (! REG_P (operands[2])
6712 || ! rtx_equal_p (operands[1], operands[2]))"
6713 [(set (match_dup 3) (match_dup 1))
6714 (parallel [(set (reg:CCAN 33)
6715 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6717 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6718 (set (match_dup 2) (match_dup 3))
6719 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6720 (label_ref (match_dup 0))
6723 [(set_attr "op_type" "RI")
6724 (set_attr "type" "branch")
6725 (set (attr "length")
6726 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6727 (const_int 4) (const_int 10)))])
6730 ;;- Unconditional jump instructions.
6734 ; jump instruction pattern(s).
6737 (define_expand "jump"
6738 [(match_operand 0 "" "")]
6740 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
6742 (define_insn "*jump64"
6743 [(set (pc) (label_ref (match_operand 0 "" "")))]
6746 if (get_attr_length (insn) == 4)
6751 [(set_attr "op_type" "RI")
6752 (set_attr "type" "branch")
6753 (set (attr "length")
6754 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6755 (const_int 4) (const_int 6)))])
6757 (define_insn "*jump31"
6758 [(set (pc) (label_ref (match_operand 0 "" "")))]
6761 if (get_attr_length (insn) == 4)
6766 [(set_attr "op_type" "RI")
6767 (set_attr "type" "branch")
6768 (set (attr "length")
6769 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6770 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6771 (const_int 4) (const_int 6))
6772 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6773 (const_int 4) (const_int 8))))])
6776 ; indirect-jump instruction pattern(s).
6779 (define_insn "indirect_jump"
6780 [(set (pc) (match_operand 0 "address_operand" "U"))]
6783 if (get_attr_op_type (insn) == OP_TYPE_RR)
6788 [(set (attr "op_type")
6789 (if_then_else (match_operand 0 "register_operand" "")
6790 (const_string "RR") (const_string "RX")))
6791 (set_attr "type" "branch")
6792 (set_attr "atype" "agen")])
6795 ; casesi instruction pattern(s).
6798 (define_insn "casesi_jump"
6799 [(set (pc) (match_operand 0 "address_operand" "U"))
6800 (use (label_ref (match_operand 1 "" "")))]
6803 if (get_attr_op_type (insn) == OP_TYPE_RR)
6808 [(set (attr "op_type")
6809 (if_then_else (match_operand 0 "register_operand" "")
6810 (const_string "RR") (const_string "RX")))
6811 (set_attr "type" "branch")
6812 (set_attr "atype" "agen")])
6814 (define_expand "casesi"
6815 [(match_operand:SI 0 "general_operand" "")
6816 (match_operand:SI 1 "general_operand" "")
6817 (match_operand:SI 2 "general_operand" "")
6818 (label_ref (match_operand 3 "" ""))
6819 (label_ref (match_operand 4 "" ""))]
6822 rtx index = gen_reg_rtx (SImode);
6823 rtx base = gen_reg_rtx (Pmode);
6824 rtx target = gen_reg_rtx (Pmode);
6826 emit_move_insn (index, operands[0]);
6827 emit_insn (gen_subsi3 (index, index, operands[1]));
6828 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6831 if (Pmode != SImode)
6832 index = convert_to_mode (Pmode, index, 1);
6833 if (GET_CODE (index) != REG)
6834 index = copy_to_mode_reg (Pmode, index);
6837 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6839 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
6841 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6843 index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
6844 emit_move_insn (target, index);
6847 target = gen_rtx_PLUS (Pmode, base, target);
6848 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6855 ;;- Jump to subroutine.
6860 ; untyped call instruction pattern(s).
6863 ;; Call subroutine returning any type.
6864 (define_expand "untyped_call"
6865 [(parallel [(call (match_operand 0 "" "")
6867 (match_operand 1 "" "")
6868 (match_operand 2 "" "")])]
6873 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6875 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6877 rtx set = XVECEXP (operands[2], 0, i);
6878 emit_move_insn (SET_DEST (set), SET_SRC (set));
6881 /* The optimizer does not know that the call sets the function value
6882 registers we stored in the result block. We avoid problems by
6883 claiming that all hard registers are used and clobbered at this
6885 emit_insn (gen_blockage ());
6890 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6891 ;; all of memory. This blocks insns from being moved across this point.
6893 (define_insn "blockage"
6894 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6897 [(set_attr "type" "none")
6898 (set_attr "length" "0")])
6904 (define_expand "sibcall"
6905 [(call (match_operand 0 "" "")
6906 (match_operand 1 "" ""))]
6909 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
6913 (define_insn "*sibcall_br"
6914 [(call (mem:QI (reg 1))
6915 (match_operand 0 "const_int_operand" "n"))]
6916 "SIBLING_CALL_P (insn)
6917 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
6919 [(set_attr "op_type" "RR")
6920 (set_attr "type" "branch")
6921 (set_attr "atype" "agen")])
6923 (define_insn "*sibcall_brc"
6924 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6925 (match_operand 1 "const_int_operand" "n"))]
6926 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
6928 [(set_attr "op_type" "RI")
6929 (set_attr "type" "branch")])
6931 (define_insn "*sibcall_brcl"
6932 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6933 (match_operand 1 "const_int_operand" "n"))]
6934 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
6936 [(set_attr "op_type" "RIL")
6937 (set_attr "type" "branch")])
6940 ; sibcall_value patterns
6943 (define_expand "sibcall_value"
6944 [(set (match_operand 0 "" "")
6945 (call (match_operand 1 "" "")
6946 (match_operand 2 "" "")))]
6949 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
6953 (define_insn "*sibcall_value_br"
6954 [(set (match_operand 0 "" "")
6955 (call (mem:QI (reg 1))
6956 (match_operand 1 "const_int_operand" "n")))]
6957 "SIBLING_CALL_P (insn)
6958 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
6960 [(set_attr "op_type" "RR")
6961 (set_attr "type" "branch")
6962 (set_attr "atype" "agen")])
6964 (define_insn "*sibcall_value_brc"
6965 [(set (match_operand 0 "" "")
6966 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
6967 (match_operand 2 "const_int_operand" "n")))]
6968 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
6970 [(set_attr "op_type" "RI")
6971 (set_attr "type" "branch")])
6973 (define_insn "*sibcall_value_brcl"
6974 [(set (match_operand 0 "" "")
6975 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
6976 (match_operand 2 "const_int_operand" "n")))]
6977 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
6979 [(set_attr "op_type" "RIL")
6980 (set_attr "type" "branch")])
6984 ; call instruction pattern(s).
6987 (define_expand "call"
6988 [(call (match_operand 0 "" "")
6989 (match_operand 1 "" ""))
6990 (use (match_operand 2 "" ""))]
6993 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
6994 gen_rtx_REG (Pmode, RETURN_REGNUM));
6998 (define_insn "*bras"
6999 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7000 (match_operand 1 "const_int_operand" "n"))
7001 (clobber (match_operand 2 "register_operand" "=r"))]
7002 "!SIBLING_CALL_P (insn)
7003 && TARGET_SMALL_EXEC
7004 && GET_MODE (operands[2]) == Pmode"
7006 [(set_attr "op_type" "RI")
7007 (set_attr "type" "jsr")])
7009 (define_insn "*brasl"
7010 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7011 (match_operand 1 "const_int_operand" "n"))
7012 (clobber (match_operand 2 "register_operand" "=r"))]
7013 "!SIBLING_CALL_P (insn)
7015 && GET_MODE (operands[2]) == Pmode"
7017 [(set_attr "op_type" "RIL")
7018 (set_attr "type" "jsr")])
7020 (define_insn "*basr"
7021 [(call (mem:QI (match_operand 0 "address_operand" "U"))
7022 (match_operand 1 "const_int_operand" "n"))
7023 (clobber (match_operand 2 "register_operand" "=r"))]
7024 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
7026 if (get_attr_op_type (insn) == OP_TYPE_RR)
7027 return "basr\t%2,%0";
7029 return "bas\t%2,%a0";
7031 [(set (attr "op_type")
7032 (if_then_else (match_operand 0 "register_operand" "")
7033 (const_string "RR") (const_string "RX")))
7034 (set_attr "type" "jsr")
7035 (set_attr "atype" "agen")])
7038 ; call_value instruction pattern(s).
7041 (define_expand "call_value"
7042 [(set (match_operand 0 "" "")
7043 (call (match_operand 1 "" "")
7044 (match_operand 2 "" "")))
7045 (use (match_operand 3 "" ""))]
7048 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
7049 gen_rtx_REG (Pmode, RETURN_REGNUM));
7053 (define_insn "*bras_r"
7054 [(set (match_operand 0 "" "")
7055 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7056 (match_operand:SI 2 "const_int_operand" "n")))
7057 (clobber (match_operand 3 "register_operand" "=r"))]
7058 "!SIBLING_CALL_P (insn)
7059 && TARGET_SMALL_EXEC
7060 && GET_MODE (operands[3]) == Pmode"
7062 [(set_attr "op_type" "RI")
7063 (set_attr "type" "jsr")])
7065 (define_insn "*brasl_r"
7066 [(set (match_operand 0 "" "")
7067 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7068 (match_operand 2 "const_int_operand" "n")))
7069 (clobber (match_operand 3 "register_operand" "=r"))]
7070 "!SIBLING_CALL_P (insn)
7072 && GET_MODE (operands[3]) == Pmode"
7074 [(set_attr "op_type" "RIL")
7075 (set_attr "type" "jsr")])
7077 (define_insn "*basr_r"
7078 [(set (match_operand 0 "" "")
7079 (call (mem:QI (match_operand 1 "address_operand" "U"))
7080 (match_operand 2 "const_int_operand" "n")))
7081 (clobber (match_operand 3 "register_operand" "=r"))]
7082 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7084 if (get_attr_op_type (insn) == OP_TYPE_RR)
7085 return "basr\t%3,%1";
7087 return "bas\t%3,%a1";
7089 [(set (attr "op_type")
7090 (if_then_else (match_operand 1 "register_operand" "")
7091 (const_string "RR") (const_string "RX")))
7092 (set_attr "type" "jsr")
7093 (set_attr "atype" "agen")])
7096 ;;- Thread-local storage support.
7099 (define_insn "get_tp_64"
7100 [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7101 (unspec:DI [(const_int 0)] UNSPEC_TP))]
7104 ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7106 [(set_attr "op_type" "NN,RS")
7107 (set_attr "atype" "reg,*")
7108 (set_attr "type" "o3,*")
7109 (set_attr "length" "14,*")])
7111 (define_insn "get_tp_31"
7112 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7113 (unspec:SI [(const_int 0)] UNSPEC_TP))]
7118 [(set_attr "op_type" "RRE,RS")])
7120 (define_insn "set_tp_64"
7121 [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7122 (clobber (match_scratch:SI 1 "=d,X"))]
7125 sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7127 [(set_attr "op_type" "NN,RS")
7128 (set_attr "atype" "reg,*")
7129 (set_attr "type" "o3,*")
7130 (set_attr "length" "14,*")])
7132 (define_insn "set_tp_31"
7133 [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7138 [(set_attr "op_type" "RRE,RS")])
7140 (define_insn "*tls_load_64"
7141 [(set (match_operand:DI 0 "register_operand" "=d")
7142 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7143 (match_operand:DI 2 "" "")]
7147 [(set_attr "op_type" "RXE")])
7149 (define_insn "*tls_load_31"
7150 [(set (match_operand:SI 0 "register_operand" "=d,d")
7151 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7152 (match_operand:SI 2 "" "")]
7158 [(set_attr "op_type" "RX,RXY")])
7160 (define_insn "*bras_tls"
7161 [(set (match_operand 0 "" "")
7162 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7163 (match_operand 2 "const_int_operand" "n")))
7164 (clobber (match_operand 3 "register_operand" "=r"))
7165 (use (match_operand 4 "" ""))]
7166 "!SIBLING_CALL_P (insn)
7167 && TARGET_SMALL_EXEC
7168 && GET_MODE (operands[3]) == Pmode"
7170 [(set_attr "op_type" "RI")
7171 (set_attr "type" "jsr")])
7173 (define_insn "*brasl_tls"
7174 [(set (match_operand 0 "" "")
7175 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7176 (match_operand 2 "const_int_operand" "n")))
7177 (clobber (match_operand 3 "register_operand" "=r"))
7178 (use (match_operand 4 "" ""))]
7179 "!SIBLING_CALL_P (insn)
7181 && GET_MODE (operands[3]) == Pmode"
7183 [(set_attr "op_type" "RIL")
7184 (set_attr "type" "jsr")])
7186 (define_insn "*basr_tls"
7187 [(set (match_operand 0 "" "")
7188 (call (mem:QI (match_operand 1 "address_operand" "U"))
7189 (match_operand 2 "const_int_operand" "n")))
7190 (clobber (match_operand 3 "register_operand" "=r"))
7191 (use (match_operand 4 "" ""))]
7192 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7194 if (get_attr_op_type (insn) == OP_TYPE_RR)
7195 return "basr\t%3,%1%J4";
7197 return "bas\t%3,%a1%J4";
7199 [(set (attr "op_type")
7200 (if_then_else (match_operand 1 "register_operand" "")
7201 (const_string "RR") (const_string "RX")))
7202 (set_attr "type" "jsr")
7203 (set_attr "atype" "agen")])
7206 ;;- Miscellaneous instructions.
7210 ; allocate stack instruction pattern(s).
7213 (define_expand "allocate_stack"
7215 (plus (reg 15) (match_operand 1 "general_operand" "")))
7216 (set (match_operand 0 "general_operand" "")
7218 "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN"
7220 rtx stack = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
7224 if (TARGET_KERNEL_BACKCHAIN)
7225 chain = plus_constant (stack, STACK_POINTER_OFFSET - UNITS_PER_WORD);
7229 chain = gen_rtx_MEM (Pmode, chain);
7230 temp = gen_reg_rtx (Pmode);
7232 emit_move_insn (temp, chain);
7235 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7237 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7239 emit_move_insn (chain, temp);
7241 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7247 ; setjmp instruction pattern.
7250 (define_expand "builtin_setjmp_receiver"
7251 [(match_operand 0 "" "")]
7254 emit_insn (s390_load_got ());
7255 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7259 ;; These patterns say how to save and restore the stack pointer. We need not
7260 ;; save the stack pointer at function level since we are careful to
7261 ;; preserve the backchain. At block level, we have to restore the backchain
7262 ;; when we restore the stack pointer.
7264 ;; For nonlocal gotos, we must save both the stack pointer and its
7265 ;; backchain and restore both. Note that in the nonlocal case, the
7266 ;; save area is a memory location.
7268 (define_expand "save_stack_function"
7269 [(match_operand 0 "general_operand" "")
7270 (match_operand 1 "general_operand" "")]
7274 (define_expand "restore_stack_function"
7275 [(match_operand 0 "general_operand" "")
7276 (match_operand 1 "general_operand" "")]
7280 (define_expand "restore_stack_block"
7281 [(use (match_operand 0 "register_operand" ""))
7282 (set (match_dup 2) (match_dup 3))
7283 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7284 (set (match_dup 3) (match_dup 2))]
7287 operands[2] = gen_reg_rtx (Pmode);
7288 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7291 (define_expand "save_stack_nonlocal"
7292 [(match_operand 0 "memory_operand" "")
7293 (match_operand 1 "register_operand" "")]
7296 rtx temp = gen_reg_rtx (Pmode);
7298 /* Copy the backchain to the first word, sp to the second and the literal pool
7299 base to the third. */
7300 emit_move_insn (operand_subword (operands[0], 2, 0,
7301 TARGET_64BIT ? OImode : TImode),
7302 gen_rtx_REG (Pmode, BASE_REGNUM));
7303 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7304 emit_move_insn (operand_subword (operands[0], 0, 0,
7305 TARGET_64BIT ? OImode : TImode),
7307 emit_move_insn (operand_subword (operands[0], 1, 0,
7308 TARGET_64BIT ? OImode : TImode),
7313 (define_expand "restore_stack_nonlocal"
7314 [(match_operand 0 "register_operand" "")
7315 (match_operand 1 "memory_operand" "")]
7318 rtx temp = gen_reg_rtx (Pmode);
7319 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
7321 /* Restore the backchain from the first word, sp from the second and the
7322 literal pool base from the third. */
7323 emit_move_insn (temp,
7324 operand_subword (operands[1], 0, 0,
7325 TARGET_64BIT ? OImode : TImode));
7326 emit_move_insn (operands[0],
7327 operand_subword (operands[1], 1, 0,
7328 TARGET_64BIT ? OImode : TImode));
7329 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7330 emit_move_insn (base,
7331 operand_subword (operands[1], 2, 0,
7332 TARGET_64BIT ? OImode : TImode));
7333 emit_insn (gen_rtx_USE (VOIDmode, base));
7340 ; nop instruction pattern(s).
7347 [(set_attr "op_type" "RR")])
7351 ; Special literal pool access instruction pattern(s).
7354 (define_insn "*pool_entry"
7355 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7356 UNSPECV_POOL_ENTRY)]
7359 enum machine_mode mode = GET_MODE (PATTERN (insn));
7360 unsigned int align = GET_MODE_BITSIZE (mode);
7361 s390_output_pool_entry (operands[0], mode, align);
7364 [(set_attr "op_type" "NN")
7365 (set (attr "length")
7366 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7368 (define_insn "pool_start_31"
7369 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7372 [(set_attr "op_type" "NN")
7373 (set_attr "length" "2")])
7375 (define_insn "pool_end_31"
7376 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7379 [(set_attr "op_type" "NN")
7380 (set_attr "length" "2")])
7382 (define_insn "pool_start_64"
7383 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7385 ".section\t.rodata\;.align\t8"
7386 [(set_attr "op_type" "NN")
7387 (set_attr "length" "0")])
7389 (define_insn "pool_end_64"
7390 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7393 [(set_attr "op_type" "NN")
7394 (set_attr "length" "0")])
7396 (define_insn "main_base_31_small"
7397 [(set (match_operand 0 "register_operand" "=a")
7398 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7399 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7401 [(set_attr "op_type" "RR")
7402 (set_attr "type" "la")])
7404 (define_insn "main_base_31_large"
7405 [(set (match_operand 0 "register_operand" "=a")
7406 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7407 (set (pc) (label_ref (match_operand 2 "" "")))]
7408 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7410 [(set_attr "op_type" "RI")])
7412 (define_insn "main_base_64"
7413 [(set (match_operand 0 "register_operand" "=a")
7414 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7415 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7417 [(set_attr "op_type" "RIL")
7418 (set_attr "type" "larl")])
7420 (define_insn "main_pool"
7421 [(set (match_operand 0 "register_operand" "=a")
7422 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
7423 "GET_MODE (operands[0]) == Pmode"
7425 [(set_attr "op_type" "NN")])
7427 (define_insn "reload_base_31"
7428 [(set (match_operand 0 "register_operand" "=a")
7429 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7430 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7431 "basr\t%0,0\;la\t%0,%1-.(%0)"
7432 [(set_attr "op_type" "NN")
7433 (set_attr "type" "la")
7434 (set_attr "length" "6")])
7436 (define_insn "reload_base_64"
7437 [(set (match_operand 0 "register_operand" "=a")
7438 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7439 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7441 [(set_attr "op_type" "RIL")
7442 (set_attr "type" "larl")])
7445 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7448 [(set_attr "op_type" "NN")
7449 (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7452 ;; Insns related to generating the function prologue and epilogue.
7456 (define_expand "prologue"
7457 [(use (const_int 0))]
7459 "s390_emit_prologue (); DONE;")
7461 (define_insn "prologue_tpf"
7462 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_PROLOGUE)
7463 (clobber (reg:DI 1))]
7464 "TARGET_TPF_PROFILING"
7466 [(set_attr "type" "jsr")
7467 (set_attr "op_type" "RX")])
7469 (define_expand "epilogue"
7470 [(use (const_int 1))]
7472 "s390_emit_epilogue (false); DONE;")
7474 (define_insn "epilogue_tpf"
7475 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_EPILOGUE)
7476 (clobber (reg:DI 1))]
7477 "TARGET_TPF_PROFILING"
7479 [(set_attr "type" "jsr")
7480 (set_attr "op_type" "RX")])
7483 (define_expand "sibcall_epilogue"
7484 [(use (const_int 0))]
7486 "s390_emit_epilogue (true); DONE;")
7488 (define_insn "*return"
7490 (use (match_operand 0 "register_operand" "a"))]
7491 "GET_MODE (operands[0]) == Pmode"
7493 [(set_attr "op_type" "RR")
7494 (set_attr "type" "jsr")
7495 (set_attr "atype" "agen")])
7498 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7499 ;; pointer. This is used for compatibility.
7501 (define_expand "ptr_extend"
7502 [(set (match_operand:DI 0 "register_operand" "=r")
7503 (match_operand:SI 1 "register_operand" "r"))]
7506 emit_insn (gen_anddi3 (operands[0],
7507 gen_lowpart (DImode, operands[1]),
7508 GEN_INT (0x7fffffff)));