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)
96 ; TLS relocation specifiers
101 (UNSPEC_GOTNTPOFF 504)
102 (UNSPEC_INDNTPOFF 505)
106 (UNSPEC_TLSLDM_NTPOFF 511)
107 (UNSPEC_TLS_LOAD 512)
114 ;; UNSPEC_VOLATILE usage
122 (UNSPECV_TPF_PROLOGUE 20)
123 (UNSPECV_TPF_EPILOGUE 21)
127 (UNSPECV_POOL_START 201)
128 (UNSPECV_POOL_END 202)
129 (UNSPECV_POOL_ENTRY 203)
130 (UNSPECV_MAIN_POOL 300)
137 ;; Processor type. This attribute must exactly match the processor_type
138 ;; enumeration in s390.h.
140 (define_attr "cpu" "g5,g6,z900,z990"
141 (const (symbol_ref "s390_tune")))
143 ;; Define an insn type attribute. This is used in function unit delay
146 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
147 cs,vs,store,imul,idiv,
148 branch,jsr,fsimpd,fsimps,
149 floadd,floads,fstored, fstores,
150 fmuld,fmuls,fdivd,fdivs,
151 ftoi,itof,fsqrtd,fsqrts,
153 (const_string "integer"))
155 ;; Operand type. Used to default length attribute values
157 (define_attr "op_type"
158 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
161 ;; Insn are devide in two classes:
162 ;; agen: Insn using agen
163 ;; reg: Insn not using agen
165 (define_attr "atype" "agen,reg"
166 (cond [ (eq_attr "op_type" "E") (const_string "reg")
167 (eq_attr "op_type" "RR") (const_string "reg")
168 (eq_attr "op_type" "RX") (const_string "agen")
169 (eq_attr "op_type" "RI") (const_string "reg")
170 (eq_attr "op_type" "RRE") (const_string "reg")
171 (eq_attr "op_type" "RS") (const_string "agen")
172 (eq_attr "op_type" "RSI") (const_string "agen")
173 (eq_attr "op_type" "S") (const_string "agen")
174 (eq_attr "op_type" "SI") (const_string "agen")
175 (eq_attr "op_type" "SS") (const_string "agen")
176 (eq_attr "op_type" "SSE") (const_string "agen")
177 (eq_attr "op_type" "RXE") (const_string "agen")
178 (eq_attr "op_type" "RSE") (const_string "agen")
179 (eq_attr "op_type" "RIL") (const_string "agen")
180 (eq_attr "op_type" "RXY") (const_string "agen")
181 (eq_attr "op_type" "RSY") (const_string "agen")
182 (eq_attr "op_type" "SIY") (const_string "agen")]
183 (const_string "reg")))
185 ;; Generic pipeline function unit.
187 (define_function_unit "integer" 1 0
188 (eq_attr "type" "none") 0 0)
190 (define_function_unit "integer" 1 0
191 (eq_attr "type" "integer") 1 1)
193 (define_function_unit "integer" 1 0
194 (eq_attr "type" "fsimpd") 1 1)
196 (define_function_unit "integer" 1 0
197 (eq_attr "type" "fsimps") 1 1)
199 (define_function_unit "integer" 1 0
200 (eq_attr "type" "load") 1 1)
202 (define_function_unit "integer" 1 0
203 (eq_attr "type" "floadd") 1 1)
205 (define_function_unit "integer" 1 0
206 (eq_attr "type" "floads") 1 1)
208 (define_function_unit "integer" 1 0
209 (eq_attr "type" "la") 1 1)
211 (define_function_unit "integer" 1 0
212 (eq_attr "type" "larl") 1 1)
214 (define_function_unit "integer" 1 0
215 (eq_attr "type" "lr") 1 1)
217 (define_function_unit "integer" 1 0
218 (eq_attr "type" "branch") 1 1)
220 (define_function_unit "integer" 1 0
221 (eq_attr "type" "store") 1 1)
223 (define_function_unit "integer" 1 0
224 (eq_attr "type" "fstored") 1 1)
226 (define_function_unit "integer" 1 0
227 (eq_attr "type" "fstores") 1 1)
229 (define_function_unit "integer" 1 0
230 (eq_attr "type" "lm") 2 2)
232 (define_function_unit "integer" 1 0
233 (eq_attr "type" "stm") 2 2)
235 (define_function_unit "integer" 1 0
236 (eq_attr "type" "cs") 5 5)
238 (define_function_unit "integer" 1 0
239 (eq_attr "type" "vs") 30 30)
241 (define_function_unit "integer" 1 0
242 (eq_attr "type" "jsr") 5 5)
244 (define_function_unit "integer" 1 0
245 (eq_attr "type" "imul") 7 7)
247 (define_function_unit "integer" 1 0
248 (eq_attr "type" "fmuld") 6 6)
250 (define_function_unit "integer" 1 0
251 (eq_attr "type" "fmuls") 6 6)
253 (define_function_unit "integer" 1 0
254 (eq_attr "type" "idiv") 33 33)
256 (define_function_unit "integer" 1 0
257 (eq_attr "type" "fdivd") 33 33)
259 (define_function_unit "integer" 1 0
260 (eq_attr "type" "fdivs") 33 33)
262 (define_function_unit "integer" 1 0
263 (eq_attr "type" "fsqrtd") 30 30)
265 (define_function_unit "integer" 1 0
266 (eq_attr "type" "fsqrts") 30 30)
268 (define_function_unit "integer" 1 0
269 (eq_attr "type" "ftoi") 2 2)
271 (define_function_unit "integer" 1 0
272 (eq_attr "type" "itof") 2 2)
274 (define_function_unit "integer" 1 0
275 (eq_attr "type" "o2") 2 2)
277 (define_function_unit "integer" 1 0
278 (eq_attr "type" "o3") 3 3)
280 (define_function_unit "integer" 1 0
281 (eq_attr "type" "other") 5 5)
283 ;; Pipeline description for z900
290 (define_attr "length" ""
291 (cond [ (eq_attr "op_type" "E") (const_int 2)
292 (eq_attr "op_type" "RR") (const_int 2)
293 (eq_attr "op_type" "RX") (const_int 4)
294 (eq_attr "op_type" "RI") (const_int 4)
295 (eq_attr "op_type" "RRE") (const_int 4)
296 (eq_attr "op_type" "RS") (const_int 4)
297 (eq_attr "op_type" "RSI") (const_int 4)
298 (eq_attr "op_type" "S") (const_int 4)
299 (eq_attr "op_type" "SI") (const_int 4)
300 (eq_attr "op_type" "SS") (const_int 6)
301 (eq_attr "op_type" "SSE") (const_int 6)
302 (eq_attr "op_type" "RXE") (const_int 6)
303 (eq_attr "op_type" "RSE") (const_int 6)
304 (eq_attr "op_type" "RIL") (const_int 6)
305 (eq_attr "op_type" "RXY") (const_int 6)
306 (eq_attr "op_type" "RSY") (const_int 6)
307 (eq_attr "op_type" "SIY") (const_int 6)]
310 ;; Define attributes for `asm' insns.
312 (define_asm_attributes [(set_attr "type" "other")
313 (set_attr "op_type" "NN")])
319 ; CCL: Zero Nonzero Zero Nonzero (AL, ALR, SL, SLR, N, NC, NI, NR, O, OC, OI, OR, X, XC, XI, XR)
320 ; CCA: Zero <Zero >Zero Overflow (A, AR, AH, AHI, S, SR, SH, SHI, LTR, LCR, LNR, LPR, SLA, SLDA, SLA, SRDA)
321 ; CCU: Equal ULess UGreater -- (CL, CLR, CLI, CLM)
322 ; CCS: Equal SLess SGreater -- (C, CR, CH, CHI, ICM)
323 ; CCT: Zero Mixed Mixed Ones (TM, TMH, TML)
326 ; CCZ1 -> CCA/CCU/CCS/CCT
329 ; String: CLC, CLCL, CLCLE, CLST, CUSE, MVCL, MVCLE, MVPG, MVST, SRST
330 ; Clobber: CKSM, CFC, CS, CDS, CUUTF, CUTFU, PLO, SPM, STCK, STCKE, TS, TRT, TRE, UPT
334 ;;- Compare instructions.
337 (define_expand "cmpdi"
339 (compare:CC (match_operand:DI 0 "register_operand" "")
340 (match_operand:DI 1 "general_operand" "")))]
343 s390_compare_op0 = operands[0];
344 s390_compare_op1 = operands[1];
348 (define_expand "cmpsi"
350 (compare:CC (match_operand:SI 0 "register_operand" "")
351 (match_operand:SI 1 "general_operand" "")))]
354 s390_compare_op0 = operands[0];
355 s390_compare_op1 = operands[1];
359 (define_expand "cmpdf"
361 (compare:CC (match_operand:DF 0 "register_operand" "")
362 (match_operand:DF 1 "general_operand" "")))]
365 s390_compare_op0 = operands[0];
366 s390_compare_op1 = operands[1];
370 (define_expand "cmpsf"
372 (compare:CC (match_operand:SF 0 "register_operand" "")
373 (match_operand:SF 1 "general_operand" "")))]
376 s390_compare_op0 = operands[0];
377 s390_compare_op1 = operands[1];
382 ; Test-under-Mask (zero_extract) instructions
384 (define_insn "*tmdi_ext"
386 (compare (zero_extract:DI (match_operand:DI 0 "register_operand" "d")
387 (match_operand:DI 1 "const_int_operand" "n")
388 (match_operand:DI 2 "const_int_operand" "n"))
390 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
391 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
392 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 64
393 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
394 == INTVAL (operands[2]) >> 4"
396 int part = INTVAL (operands[2]) >> 4;
397 int block = (1 << INTVAL (operands[1])) - 1;
398 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
400 operands[2] = GEN_INT (block << shift);
404 case 0: return "tmhh\t%0,%x2";
405 case 1: return "tmhl\t%0,%x2";
406 case 2: return "tmlh\t%0,%x2";
407 case 3: return "tmll\t%0,%x2";
411 [(set_attr "op_type" "RI")])
413 (define_insn "*tmsi_ext"
415 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
416 (match_operand:SI 1 "const_int_operand" "n")
417 (match_operand:SI 2 "const_int_operand" "n"))
419 "s390_match_ccmode(insn, CCTmode)
420 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
421 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
422 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
423 == INTVAL (operands[2]) >> 4"
425 int part = INTVAL (operands[2]) >> 4;
426 int block = (1 << INTVAL (operands[1])) - 1;
427 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
429 operands[2] = GEN_INT (block << shift);
433 case 0: return "tmh\t%0,%x2";
434 case 1: return "tml\t%0,%x2";
438 [(set_attr "op_type" "RI")])
440 (define_insn "*tmqisi_ext"
442 (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,S")
443 (match_operand:SI 1 "const_int_operand" "n,n")
444 (match_operand:SI 2 "const_int_operand" "n,n"))
446 "!TARGET_64BIT && s390_match_ccmode(insn, CCTmode)
447 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
448 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
450 int block = (1 << INTVAL (operands[1])) - 1;
451 int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
453 operands[2] = GEN_INT (block << shift);
454 return which_alternative == 0 ? "tm\t%0,%b2" : "tmy\t%0,%b2";
456 [(set_attr "op_type" "SI,SIY")])
458 (define_insn "*tmqidi_ext"
460 (compare (zero_extract:DI (match_operand:QI 0 "memory_operand" "Q,S")
461 (match_operand:SI 1 "const_int_operand" "n,n")
462 (match_operand:SI 2 "const_int_operand" "n,n"))
464 "TARGET_64BIT && s390_match_ccmode(insn, CCTmode)
465 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
466 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
468 int block = (1 << INTVAL (operands[1])) - 1;
469 int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
471 operands[2] = GEN_INT (block << shift);
472 return which_alternative == 0 ? "tm\t%0,%b2" : "tmy\t%0,%b2";
474 [(set_attr "op_type" "SI,SIY")])
477 ; Test-under-Mask instructions
479 (define_insn "*tmdi_mem"
481 (compare (and:DI (match_operand:DI 0 "memory_operand" "Q,S")
482 (match_operand:DI 1 "immediate_operand" "n,n"))
483 (match_operand:DI 2 "immediate_operand" "n,n")))]
484 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
485 && s390_single_part (operands[1], DImode, QImode, 0) >= 0"
487 int part = s390_single_part (operands[1], DImode, QImode, 0);
488 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
490 operands[0] = gen_rtx_MEM (QImode,
491 plus_constant (XEXP (operands[0], 0), part));
492 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
494 [(set_attr "op_type" "SI,SIY")])
496 (define_insn "*tmsi_mem"
498 (compare (and:SI (match_operand:SI 0 "memory_operand" "Q,S")
499 (match_operand:SI 1 "immediate_operand" "n,n"))
500 (match_operand:SI 2 "immediate_operand" "n,n")))]
501 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
502 && s390_single_part (operands[1], SImode, QImode, 0) >= 0"
504 int part = s390_single_part (operands[1], SImode, QImode, 0);
505 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
507 operands[0] = gen_rtx_MEM (QImode,
508 plus_constant (XEXP (operands[0], 0), part));
509 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
511 [(set_attr "op_type" "SI")])
513 (define_insn "*tmhi_mem"
515 (compare (and:SI (subreg:SI (match_operand:HI 0 "memory_operand" "Q,S") 0)
516 (match_operand:SI 1 "immediate_operand" "n,n"))
517 (match_operand:SI 2 "immediate_operand" "n,n")))]
518 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
519 && s390_single_part (operands[1], HImode, QImode, 0) >= 0"
521 int part = s390_single_part (operands[1], HImode, QImode, 0);
522 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
524 operands[0] = gen_rtx_MEM (QImode,
525 plus_constant (XEXP (operands[0], 0), part));
526 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
528 [(set_attr "op_type" "SI")])
530 (define_insn "*tmqi_mem"
532 (compare (and:SI (subreg:SI (match_operand:QI 0 "memory_operand" "Q,S") 0)
533 (match_operand:SI 1 "immediate_operand" "n,n"))
534 (match_operand:SI 2 "immediate_operand" "n,n")))]
535 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))"
539 [(set_attr "op_type" "SI,SIY")])
541 (define_insn "*tmdi_reg"
543 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
544 (match_operand:DI 1 "immediate_operand"
545 "N0HD0,N1HD0,N2HD0,N3HD0"))
546 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
548 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
549 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
555 [(set_attr "op_type" "RI")])
557 (define_insn "*tmsi_reg"
559 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
560 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
561 (match_operand:SI 2 "immediate_operand" "n,n")))]
562 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
563 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
567 [(set_attr "op_type" "RI")])
569 (define_insn "*tmhi_full"
571 (compare (match_operand:HI 0 "register_operand" "d")
572 (match_operand:HI 1 "immediate_operand" "n")))]
573 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
575 [(set_attr "op_type" "RX")])
577 (define_insn "*tmqi_full"
579 (compare (match_operand:QI 0 "register_operand" "d")
580 (match_operand:QI 1 "immediate_operand" "n")))]
581 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
583 [(set_attr "op_type" "RI")])
586 ; Load-and-Test instructions
588 (define_insn "*tstdi_sign"
590 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
591 (const_int 32)) (const_int 32))
592 (match_operand:DI 1 "const0_operand" "")))
593 (set (match_operand:DI 2 "register_operand" "=d")
594 (sign_extend:DI (match_dup 0)))]
595 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
597 [(set_attr "op_type" "RRE")])
599 (define_insn "*tstdi"
601 (compare (match_operand:DI 0 "register_operand" "d")
602 (match_operand:DI 1 "const0_operand" "")))
603 (set (match_operand:DI 2 "register_operand" "=d")
605 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
607 [(set_attr "op_type" "RRE")])
609 (define_insn "*tstdi_cconly"
611 (compare (match_operand:DI 0 "register_operand" "d")
612 (match_operand:DI 1 "const0_operand" "")))]
613 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
615 [(set_attr "op_type" "RRE")])
617 (define_insn "*tstdi_cconly_31"
619 (compare (match_operand:DI 0 "register_operand" "d")
620 (match_operand:DI 1 "const0_operand" "")))]
621 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
623 [(set_attr "op_type" "RS")
624 (set_attr "atype" "reg")])
627 (define_insn "*tstsi"
629 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
630 (match_operand:SI 1 "const0_operand" "")))
631 (set (match_operand:SI 2 "register_operand" "=d,d,d")
633 "s390_match_ccmode(insn, CCSmode)"
638 [(set_attr "op_type" "RR,RS,RSY")])
640 (define_insn "*tstsi_cconly"
642 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
643 (match_operand:SI 1 "const0_operand" "")))
644 (clobber (match_scratch:SI 2 "=X,d,d"))]
645 "s390_match_ccmode(insn, CCSmode)"
650 [(set_attr "op_type" "RR,RS,RSY")])
652 (define_insn "*tstsi_cconly2"
654 (compare (match_operand:SI 0 "register_operand" "d")
655 (match_operand:SI 1 "const0_operand" "")))]
656 "s390_match_ccmode(insn, CCSmode)"
658 [(set_attr "op_type" "RR")])
660 (define_insn "*tsthiCCT"
662 (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d")
663 (match_operand:HI 1 "const0_operand" "")))
664 (set (match_operand:HI 2 "register_operand" "=d,d,0")
666 "s390_match_ccmode(insn, CCTmode)"
671 [(set_attr "op_type" "RS,RSY,RI")])
673 (define_insn "*tsthiCCT_cconly"
675 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
676 (match_operand:HI 1 "const0_operand" "")))
677 (clobber (match_scratch:HI 2 "=d,d,X"))]
678 "s390_match_ccmode(insn, CCTmode)"
683 [(set_attr "op_type" "RS,RSY,RI")])
685 (define_insn "*tsthi"
687 (compare (match_operand:HI 0 "s_operand" "Q,S")
688 (match_operand:HI 1 "const0_operand" "")))
689 (set (match_operand:HI 2 "register_operand" "=d,d")
691 "s390_match_ccmode(insn, CCSmode)"
695 [(set_attr "op_type" "RS,RSY")])
697 (define_insn "*tsthi_cconly"
699 (compare (match_operand:HI 0 "s_operand" "Q,S")
700 (match_operand:HI 1 "const0_operand" "")))
701 (clobber (match_scratch:HI 2 "=d,d"))]
702 "s390_match_ccmode(insn, CCSmode)"
706 [(set_attr "op_type" "RS,RSY")])
708 (define_insn "*tstqiCCT"
710 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
711 (match_operand:QI 1 "const0_operand" "")))
712 (set (match_operand:QI 2 "register_operand" "=d,d,0")
714 "s390_match_ccmode(insn, CCTmode)"
719 [(set_attr "op_type" "RS,RSY,RI")])
721 (define_insn "*tstqiCCT_cconly"
723 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
724 (match_operand:QI 1 "const0_operand" "")))]
725 "s390_match_ccmode(insn, CCTmode)"
730 [(set_attr "op_type" "SI,SIY,RI")])
732 (define_insn "*tstqi"
734 (compare (match_operand:QI 0 "s_operand" "Q,S")
735 (match_operand:QI 1 "const0_operand" "")))
736 (set (match_operand:QI 2 "register_operand" "=d,d")
738 "s390_match_ccmode(insn, CCSmode)"
742 [(set_attr "op_type" "RS,RSY")])
744 (define_insn "*tstqi_cconly"
746 (compare (match_operand:QI 0 "s_operand" "Q,S")
747 (match_operand:QI 1 "const0_operand" "")))
748 (clobber (match_scratch:QI 2 "=d,d"))]
749 "s390_match_ccmode(insn, CCSmode)"
753 [(set_attr "op_type" "RS,RSY")])
756 ; Compare (signed) instructions
758 (define_insn "*cmpdi_ccs_sign"
760 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
761 (match_operand:DI 0 "register_operand" "d,d")))]
762 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
766 [(set_attr "op_type" "RRE,RXY")])
768 (define_insn "*cmpdi_ccs"
770 (compare (match_operand:DI 0 "register_operand" "d,d,d")
771 (match_operand:DI 1 "general_operand" "d,K,m")))]
772 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
777 [(set_attr "op_type" "RRE,RI,RXY")])
779 (define_insn "*cmpsi_ccs_sign"
781 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
782 (match_operand:SI 0 "register_operand" "d,d")))]
783 "s390_match_ccmode(insn, CCSRmode)"
787 [(set_attr "op_type" "RX,RXY")])
789 (define_insn "*cmpsi_ccs"
791 (compare (match_operand:SI 0 "register_operand" "d,d,d,d")
792 (match_operand:SI 1 "general_operand" "d,K,R,T")))]
793 "s390_match_ccmode(insn, CCSmode)"
799 [(set_attr "op_type" "RR,RI,RX,RXY")])
802 ; Compare (unsigned) instructions
804 (define_insn "*cmpdi_ccu_zero"
806 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
807 (match_operand:DI 0 "register_operand" "d,d")))]
808 "s390_match_ccmode(insn, CCURmode) && TARGET_64BIT"
812 [(set_attr "op_type" "RRE,RXY")])
814 (define_insn "*cmpdi_ccu"
816 (compare (match_operand:DI 0 "register_operand" "d,d")
817 (match_operand:DI 1 "general_operand" "d,m")))]
818 "s390_match_ccmode(insn, CCUmode) && TARGET_64BIT"
822 [(set_attr "op_type" "RRE,RXY")])
824 (define_insn "*cmpsi_ccu"
826 (compare (match_operand:SI 0 "register_operand" "d,d,d")
827 (match_operand:SI 1 "general_operand" "d,R,T")))]
828 "s390_match_ccmode(insn, CCUmode)"
833 [(set_attr "op_type" "RR,RX,RXY")])
835 (define_insn "*cmphi_ccu"
837 (compare (match_operand:HI 0 "register_operand" "d,d")
838 (match_operand:HI 1 "s_imm_operand" "Q,S")))]
839 "s390_match_ccmode(insn, CCUmode)"
843 [(set_attr "op_type" "RS,RSY")])
845 (define_insn "*cmpqi_ccu"
847 (compare (match_operand:QI 0 "register_operand" "d,d")
848 (match_operand:QI 1 "s_imm_operand" "Q,S")))]
849 "s390_match_ccmode(insn, CCUmode)"
853 [(set_attr "op_type" "RS,RSY")])
857 (compare (match_operand:QI 0 "memory_operand" "Q,S")
858 (match_operand:QI 1 "immediate_operand" "n,n")))]
859 "s390_match_ccmode (insn, CCUmode)"
863 [(set_attr "op_type" "SI,SIY")])
865 (define_insn "*cmpdi_ccu_mem"
867 (compare (match_operand:DI 0 "s_operand" "Q")
868 (match_operand:DI 1 "s_imm_operand" "Q")))]
869 "s390_match_ccmode(insn, CCUmode)"
871 [(set_attr "op_type" "SS")])
873 (define_insn "*cmpsi_ccu_mem"
875 (compare (match_operand:SI 0 "s_operand" "Q")
876 (match_operand:SI 1 "s_imm_operand" "Q")))]
877 "s390_match_ccmode(insn, CCUmode)"
879 [(set_attr "op_type" "SS")])
881 (define_insn "*cmphi_ccu_mem"
883 (compare (match_operand:HI 0 "s_operand" "Q")
884 (match_operand:HI 1 "s_imm_operand" "Q")))]
885 "s390_match_ccmode(insn, CCUmode)"
887 [(set_attr "op_type" "SS")])
889 (define_insn "*cmpqi_ccu_mem"
891 (compare (match_operand:QI 0 "s_operand" "Q")
892 (match_operand:QI 1 "s_imm_operand" "Q")))]
893 "s390_match_ccmode(insn, CCUmode)"
895 [(set_attr "op_type" "SS")])
900 (define_insn "*cmpdf_ccs_0"
902 (compare (match_operand:DF 0 "register_operand" "f")
903 (match_operand:DF 1 "const0_operand" "")))]
904 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
906 [(set_attr "op_type" "RRE")
907 (set_attr "type" "fsimpd")])
909 (define_insn "*cmpdf_ccs_0_ibm"
911 (compare (match_operand:DF 0 "register_operand" "f")
912 (match_operand:DF 1 "const0_operand" "")))]
913 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
915 [(set_attr "op_type" "RR")
916 (set_attr "type" "fsimpd")])
918 (define_insn "*cmpdf_ccs"
920 (compare (match_operand:DF 0 "register_operand" "f,f")
921 (match_operand:DF 1 "general_operand" "f,R")))]
922 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
926 [(set_attr "op_type" "RRE,RXE")
927 (set_attr "type" "fsimpd")])
929 (define_insn "*cmpdf_ccs_ibm"
931 (compare (match_operand:DF 0 "register_operand" "f,f")
932 (match_operand:DF 1 "general_operand" "f,R")))]
933 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
937 [(set_attr "op_type" "RR,RX")
938 (set_attr "type" "fsimpd")])
943 (define_insn "*cmpsf_ccs_0"
945 (compare (match_operand:SF 0 "register_operand" "f")
946 (match_operand:SF 1 "const0_operand" "")))]
947 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
949 [(set_attr "op_type" "RRE")
950 (set_attr "type" "fsimps")])
952 (define_insn "*cmpsf_ccs_0_ibm"
954 (compare (match_operand:SF 0 "register_operand" "f")
955 (match_operand:SF 1 "const0_operand" "")))]
956 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
958 [(set_attr "op_type" "RR")
959 (set_attr "type" "fsimps")])
961 (define_insn "*cmpsf_ccs"
963 (compare (match_operand:SF 0 "register_operand" "f,f")
964 (match_operand:SF 1 "general_operand" "f,R")))]
965 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
969 [(set_attr "op_type" "RRE,RXE")
970 (set_attr "type" "fsimps")])
972 (define_insn "*cmpsf_ccs"
974 (compare (match_operand:SF 0 "register_operand" "f,f")
975 (match_operand:SF 1 "general_operand" "f,R")))]
976 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
980 [(set_attr "op_type" "RR,RX")
981 (set_attr "type" "fsimps")])
985 ;;- Move instructions.
989 ; movti instruction pattern(s).
993 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
994 (match_operand:TI 1 "general_operand" "QS,d,dKm,d,Q"))]
1001 mvc\t%O0(16,%R0),%1"
1002 [(set_attr "op_type" "RSY,RSY,NN,NN,SS")
1003 (set_attr "type" "lm,stm,*,*,cs")])
1006 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1007 (match_operand:TI 1 "general_operand" ""))]
1008 "TARGET_64BIT && reload_completed
1009 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
1010 [(set (match_dup 2) (match_dup 4))
1011 (set (match_dup 3) (match_dup 5))]
1013 operands[2] = operand_subword (operands[0], 0, 0, TImode);
1014 operands[3] = operand_subword (operands[0], 1, 0, TImode);
1015 operands[4] = operand_subword (operands[1], 0, 0, TImode);
1016 operands[5] = operand_subword (operands[1], 1, 0, TImode);
1020 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1021 (match_operand:TI 1 "general_operand" ""))]
1022 "TARGET_64BIT && reload_completed
1023 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
1024 [(set (match_dup 2) (match_dup 4))
1025 (set (match_dup 3) (match_dup 5))]
1027 operands[2] = operand_subword (operands[0], 1, 0, TImode);
1028 operands[3] = operand_subword (operands[0], 0, 0, TImode);
1029 operands[4] = operand_subword (operands[1], 1, 0, TImode);
1030 operands[5] = operand_subword (operands[1], 0, 0, TImode);
1034 [(set (match_operand:TI 0 "register_operand" "")
1035 (match_operand:TI 1 "memory_operand" ""))]
1036 "TARGET_64BIT && reload_completed
1037 && !s_operand (operands[1], VOIDmode)"
1038 [(set (match_dup 0) (match_dup 1))]
1040 rtx addr = operand_subword (operands[0], 1, 0, TImode);
1041 s390_load_address (addr, XEXP (operands[1], 0));
1042 operands[1] = replace_equiv_address (operands[1], addr);
1045 (define_expand "reload_outti"
1046 [(parallel [(match_operand:TI 0 "memory_operand" "")
1047 (match_operand:TI 1 "register_operand" "d")
1048 (match_operand:DI 2 "register_operand" "=&a")])]
1051 s390_load_address (operands[2], XEXP (operands[0], 0));
1052 operands[0] = replace_equiv_address (operands[0], operands[2]);
1053 emit_move_insn (operands[0], operands[1]);
1058 ; movdi instruction pattern(s).
1061 (define_expand "movdi"
1062 [(set (match_operand:DI 0 "general_operand" "")
1063 (match_operand:DI 1 "general_operand" ""))]
1066 /* Handle symbolic constants. */
1067 if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1068 emit_symbolic_move (operands);
1070 /* During and after reload, we need to force constants
1071 to the literal pool ourselves, if necessary. */
1072 if ((reload_in_progress || reload_completed)
1073 && CONSTANT_P (operands[1])
1074 && (!legitimate_reload_constant_p (operands[1])
1075 || FP_REG_P (operands[0])))
1076 operands[1] = force_const_mem (DImode, operands[1]);
1079 (define_insn "*movdi_larl"
1080 [(set (match_operand:DI 0 "register_operand" "=d")
1081 (match_operand:DI 1 "larl_operand" "X"))]
1083 && !FP_REG_P (operands[0])"
1085 [(set_attr "op_type" "RIL")
1086 (set_attr "type" "larl")])
1088 (define_insn "*movdi_64"
1089 [(set (match_operand:DI 0 "nonimmediate_operand"
1090 "=d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,?Q")
1091 (match_operand:DI 1 "general_operand"
1092 "K,N0HD0,N1HD0,N2HD0,N3HD0,L,d,m,d,*f,R,T,*f,*f,?Q"))]
1110 [(set_attr "op_type" "RI,RI,RI,RI,RI,RXY,RRE,RXY,RXY,RR,RX,RXY,RX,RXY,SS")
1111 (set_attr "type" "*,*,*,*,*,la,lr,load,store,floadd,floadd,floadd,
1112 fstored,fstored,cs")])
1114 (define_insn "*movdi_31"
1115 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,o,!*f,!*f,!*f,!R,!T,Q")
1116 (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,R,T,*f,*f,Q"))]
1129 [(set_attr "op_type" "RS,RS,NN,NN,RR,RX,RXY,RX,RXY,SS")
1130 (set_attr "type" "lm,stm,*,*,floadd,floadd,floadd,fstored,fstored,cs")])
1133 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1134 (match_operand:DI 1 "general_operand" ""))]
1135 "!TARGET_64BIT && reload_completed
1136 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1137 [(set (match_dup 2) (match_dup 4))
1138 (set (match_dup 3) (match_dup 5))]
1140 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1141 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1142 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1143 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1147 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1148 (match_operand:DI 1 "general_operand" ""))]
1149 "!TARGET_64BIT && reload_completed
1150 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1151 [(set (match_dup 2) (match_dup 4))
1152 (set (match_dup 3) (match_dup 5))]
1154 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1155 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1156 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1157 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1161 [(set (match_operand:DI 0 "register_operand" "")
1162 (match_operand:DI 1 "memory_operand" ""))]
1163 "!TARGET_64BIT && reload_completed
1164 && !FP_REG_P (operands[0])
1165 && !s_operand (operands[1], VOIDmode)"
1166 [(set (match_dup 0) (match_dup 1))]
1168 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1169 s390_load_address (addr, XEXP (operands[1], 0));
1170 operands[1] = replace_equiv_address (operands[1], addr);
1173 (define_expand "reload_outdi"
1174 [(parallel [(match_operand:DI 0 "memory_operand" "")
1175 (match_operand:DI 1 "register_operand" "d")
1176 (match_operand:SI 2 "register_operand" "=&a")])]
1179 s390_load_address (operands[2], XEXP (operands[0], 0));
1180 operands[0] = replace_equiv_address (operands[0], operands[2]);
1181 emit_move_insn (operands[0], operands[1]);
1186 [(set (match_operand:DI 0 "register_operand" "")
1187 (mem:DI (match_operand 1 "address_operand" "")))]
1189 && !FP_REG_P (operands[0])
1190 && GET_CODE (operands[1]) == SYMBOL_REF
1191 && CONSTANT_POOL_ADDRESS_P (operands[1])
1192 && get_pool_mode (operands[1]) == DImode
1193 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1194 [(set (match_dup 0) (match_dup 2))]
1195 "operands[2] = get_pool_constant (operands[1]);")
1197 (define_insn "*la_64"
1198 [(set (match_operand:DI 0 "register_operand" "=d,d")
1199 (match_operand:QI 1 "address_operand" "U,W"))]
1204 [(set_attr "op_type" "RX,RXY")
1205 (set_attr "type" "la")])
1209 [(set (match_operand:DI 0 "register_operand" "")
1210 (match_operand:QI 1 "address_operand" ""))
1211 (clobber (reg:CC 33))])]
1213 && strict_memory_address_p (VOIDmode, operands[1])
1214 && preferred_la_operand_p (operands[1])"
1215 [(set (match_dup 0) (match_dup 1))]
1219 [(set (match_operand:DI 0 "register_operand" "")
1220 (match_operand:DI 1 "register_operand" ""))
1223 (plus:DI (match_dup 0)
1224 (match_operand:DI 2 "nonmemory_operand" "")))
1225 (clobber (reg:CC 33))])]
1227 && !reg_overlap_mentioned_p (operands[0], operands[2])
1228 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (DImode, operands[1], operands[2]))
1229 && preferred_la_operand_p (gen_rtx_PLUS (DImode, operands[1], operands[2]))"
1230 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1233 (define_expand "reload_indi"
1234 [(parallel [(match_operand:DI 0 "register_operand" "=a")
1235 (match_operand:DI 1 "s390_plus_operand" "")
1236 (match_operand:DI 2 "register_operand" "=&a")])]
1239 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1244 ; movsi instruction pattern(s).
1247 (define_expand "movsi"
1248 [(set (match_operand:SI 0 "general_operand" "")
1249 (match_operand:SI 1 "general_operand" ""))]
1252 /* Handle symbolic constants. */
1253 if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1254 emit_symbolic_move (operands);
1256 /* expr.c tries to load an effective address using
1257 force_reg. This fails because we don't have a
1258 generic load_address pattern. Convert the move
1259 to a proper arithmetic operation instead, unless
1260 it is guaranteed to be OK. */
1261 if (GET_CODE (operands[1]) == PLUS
1262 && !legitimate_la_operand_p (operands[1]))
1264 operands[1] = force_operand (operands[1], operands[0]);
1265 if (operands[1] == operands[0])
1269 /* During and after reload, we need to force constants
1270 to the literal pool ourselves, if necessary. */
1271 if ((reload_in_progress || reload_completed)
1272 && CONSTANT_P (operands[1])
1273 && (!legitimate_reload_constant_p (operands[1])
1274 || FP_REG_P (operands[0])))
1275 operands[1] = force_const_mem (SImode, operands[1]);
1278 (define_insn "*movsi_larl"
1279 [(set (match_operand:SI 0 "register_operand" "=d")
1280 (match_operand:SI 1 "larl_operand" "X"))]
1281 "!TARGET_64BIT && TARGET_CPU_ZARCH
1282 && !FP_REG_P (operands[0])"
1284 [(set_attr "op_type" "RIL")
1285 (set_attr "type" "larl")])
1287 (define_insn "*movsi_zarch"
1288 [(set (match_operand:SI 0 "nonimmediate_operand"
1289 "=d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,?Q")
1290 (match_operand:SI 1 "general_operand"
1291 "K,N0HS0,N1HS0,L,d,R,T,d,d,*f,R,T,*f,*f,?Q"))]
1309 [(set_attr "op_type" "RI,RI,RI,RXY,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1310 (set_attr "type" "*,*,*,la,lr,load,load,store,store,floads,floads,floads,fstores,fstores,cs")])
1312 (define_insn "*movsi_esa"
1313 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,?Q")
1314 (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,?Q"))]
1325 [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,SS")
1326 (set_attr "type" "*,lr,load,store,floads,floads,fstores,cs")])
1329 [(set (match_operand:SI 0 "register_operand" "")
1330 (mem:SI (match_operand 1 "address_operand" "")))]
1331 "!FP_REG_P (operands[0])
1332 && GET_CODE (operands[1]) == SYMBOL_REF
1333 && CONSTANT_POOL_ADDRESS_P (operands[1])
1334 && get_pool_mode (operands[1]) == SImode
1335 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1336 [(set (match_dup 0) (match_dup 2))]
1337 "operands[2] = get_pool_constant (operands[1]);")
1339 (define_insn "*la_31"
1340 [(set (match_operand:SI 0 "register_operand" "=d,d")
1341 (match_operand:QI 1 "address_operand" "U,W"))]
1342 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1346 [(set_attr "op_type" "RX,RXY")
1347 (set_attr "type" "la")])
1351 [(set (match_operand:SI 0 "register_operand" "")
1352 (match_operand:QI 1 "address_operand" ""))
1353 (clobber (reg:CC 33))])]
1355 && strict_memory_address_p (VOIDmode, operands[1])
1356 && preferred_la_operand_p (operands[1])"
1357 [(set (match_dup 0) (match_dup 1))]
1361 [(set (match_operand:SI 0 "register_operand" "")
1362 (match_operand:SI 1 "register_operand" ""))
1365 (plus:SI (match_dup 0)
1366 (match_operand:SI 2 "nonmemory_operand" "")))
1367 (clobber (reg:CC 33))])]
1369 && !reg_overlap_mentioned_p (operands[0], operands[2])
1370 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
1371 && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
1372 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1375 (define_insn "*la_31_and"
1376 [(set (match_operand:SI 0 "register_operand" "=d,d")
1377 (and:SI (match_operand:QI 1 "address_operand" "U,W")
1378 (const_int 2147483647)))]
1383 [(set_attr "op_type" "RX,RXY")
1384 (set_attr "type" "la")])
1386 (define_insn_and_split "*la_31_and_cc"
1387 [(set (match_operand:SI 0 "register_operand" "=d")
1388 (and:SI (match_operand:QI 1 "address_operand" "p")
1389 (const_int 2147483647)))
1390 (clobber (reg:CC 33))]
1393 "&& reload_completed"
1395 (and:SI (match_dup 1) (const_int 2147483647)))]
1397 [(set_attr "op_type" "RX")
1398 (set_attr "type" "la")])
1400 (define_insn "force_la_31"
1401 [(set (match_operand:SI 0 "register_operand" "=d,d")
1402 (match_operand:QI 1 "address_operand" "U,W"))
1403 (use (const_int 0))]
1408 [(set_attr "op_type" "RX")
1409 (set_attr "type" "la")])
1411 (define_expand "reload_insi"
1412 [(parallel [(match_operand:SI 0 "register_operand" "=a")
1413 (match_operand:SI 1 "s390_plus_operand" "")
1414 (match_operand:SI 2 "register_operand" "=&a")])]
1417 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1422 ; movhi instruction pattern(s).
1425 (define_expand "movhi"
1426 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1427 (match_operand:HI 1 "general_operand" ""))]
1430 /* Make it explicit that loading a register from memory
1431 always sign-extends (at least) to SImode. */
1432 if (optimize && !no_new_pseudos
1433 && register_operand (operands[0], VOIDmode)
1434 && GET_CODE (operands[1]) == MEM
1435 && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
1437 rtx tmp = gen_reg_rtx (SImode);
1438 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1439 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1440 operands[1] = gen_lowpart (HImode, tmp);
1444 (define_insn "*movhi"
1445 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1446 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1456 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1457 (set_attr "type" "lr,*,*,*,store,store,cs")])
1460 [(set (match_operand:HI 0 "register_operand" "")
1461 (mem:HI (match_operand 1 "address_operand" "")))]
1462 "GET_CODE (operands[1]) == SYMBOL_REF
1463 && CONSTANT_POOL_ADDRESS_P (operands[1])
1464 && get_pool_mode (operands[1]) == HImode
1465 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1466 [(set (match_dup 0) (match_dup 2))]
1467 "operands[2] = get_pool_constant (operands[1]);")
1470 ; movqi instruction pattern(s).
1473 (define_expand "movqi"
1474 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1475 (match_operand:QI 1 "general_operand" ""))]
1478 /* On z/Architecture, zero-extending from memory to register
1479 is just as fast as a QImode load. */
1480 if (TARGET_ZARCH && optimize && !no_new_pseudos
1481 && register_operand (operands[0], VOIDmode)
1482 && GET_CODE (operands[1]) == MEM
1483 && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
1485 rtx tmp = gen_reg_rtx (word_mode);
1486 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1487 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1488 operands[1] = gen_lowpart (QImode, tmp);
1492 (define_insn "*movqi"
1493 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1494 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1506 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1507 (set_attr "type" "lr,*,*,*,store,store,store,store,cs")])
1510 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1511 (mem:QI (match_operand 1 "address_operand" "")))]
1512 "GET_CODE (operands[1]) == SYMBOL_REF
1513 && CONSTANT_POOL_ADDRESS_P (operands[1])
1514 && get_pool_mode (operands[1]) == QImode
1515 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1516 [(set (match_dup 0) (match_dup 2))]
1517 "operands[2] = get_pool_constant (operands[1]);")
1520 ; movstrictqi instruction pattern(s).
1523 (define_insn "*movstrictqi"
1524 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1525 (match_operand:QI 1 "memory_operand" "R,T"))]
1530 [(set_attr "op_type" "RX,RXY")])
1533 ; movstricthi instruction pattern(s).
1536 (define_insn "*movstricthi"
1537 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1538 (match_operand:HI 1 "s_imm_operand" "Q,S"))
1539 (clobber (reg:CC 33))]
1544 [(set_attr "op_type" "RS,RSY")])
1547 ; movstrictsi instruction pattern(s).
1550 (define_insn "movstrictsi"
1551 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d"))
1552 (match_operand:SI 1 "general_operand" "d,R,T"))]
1558 [(set_attr "op_type" "RR,RX,RXY")
1559 (set_attr "type" "lr,load,load")])
1562 ; movdf instruction pattern(s).
1565 (define_expand "movdf"
1566 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1567 (match_operand:DF 1 "general_operand" ""))]
1570 /* During and after reload, we need to force constants
1571 to the literal pool ourselves, if necessary. */
1572 if ((reload_in_progress || reload_completed)
1573 && CONSTANT_P (operands[1]))
1574 operands[1] = force_const_mem (DFmode, operands[1]);
1577 (define_insn "*movdf_64"
1578 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1579 (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1591 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1592 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,cs")])
1594 (define_insn "*movdf_31"
1595 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1596 (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1609 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,NN,NN,SS")
1610 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,cs")])
1613 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1614 (match_operand:DF 1 "general_operand" ""))]
1615 "!TARGET_64BIT && reload_completed
1616 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1617 [(set (match_dup 2) (match_dup 4))
1618 (set (match_dup 3) (match_dup 5))]
1620 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1621 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1622 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1623 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1627 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1628 (match_operand:DF 1 "general_operand" ""))]
1629 "!TARGET_64BIT && reload_completed
1630 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1631 [(set (match_dup 2) (match_dup 4))
1632 (set (match_dup 3) (match_dup 5))]
1634 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1635 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1636 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1637 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1641 [(set (match_operand:DF 0 "register_operand" "")
1642 (match_operand:DF 1 "memory_operand" ""))]
1643 "!TARGET_64BIT && reload_completed
1644 && !FP_REG_P (operands[0])
1645 && !s_operand (operands[1], VOIDmode)"
1646 [(set (match_dup 0) (match_dup 1))]
1648 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1649 s390_load_address (addr, XEXP (operands[1], 0));
1650 operands[1] = replace_equiv_address (operands[1], addr);
1653 (define_expand "reload_outdf"
1654 [(parallel [(match_operand:DF 0 "memory_operand" "")
1655 (match_operand:DF 1 "register_operand" "d")
1656 (match_operand:SI 2 "register_operand" "=&a")])]
1659 s390_load_address (operands[2], XEXP (operands[0], 0));
1660 operands[0] = replace_equiv_address (operands[0], operands[2]);
1661 emit_move_insn (operands[0], operands[1]);
1666 ; movsf instruction pattern(s).
1669 (define_expand "movsf"
1670 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1671 (match_operand:SF 1 "general_operand" ""))]
1674 /* During and after reload, we need to force constants
1675 to the literal pool ourselves, if necessary. */
1676 if ((reload_in_progress || reload_completed)
1677 && CONSTANT_P (operands[1]))
1678 operands[1] = force_const_mem (SFmode, operands[1]);
1681 (define_insn "*movsf"
1682 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1683 (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1697 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1698 (set_attr "type" "floads,floads,floads,fstores,fstores,lr,load,load,store,store,cs")])
1701 ; load_multiple pattern(s).
1703 ; ??? Due to reload problems with replacing registers inside match_parallel
1704 ; we currently support load_multiple/store_multiple only after reload.
1707 (define_expand "load_multiple"
1708 [(match_par_dup 3 [(set (match_operand 0 "" "")
1709 (match_operand 1 "" ""))
1710 (use (match_operand 2 "" ""))])]
1713 enum machine_mode mode;
1719 /* Support only loading a constant number of fixed-point registers from
1720 memory and only bother with this if more than two */
1721 if (GET_CODE (operands[2]) != CONST_INT
1722 || INTVAL (operands[2]) < 2
1723 || INTVAL (operands[2]) > 16
1724 || GET_CODE (operands[1]) != MEM
1725 || GET_CODE (operands[0]) != REG
1726 || REGNO (operands[0]) >= 16)
1729 count = INTVAL (operands[2]);
1730 regno = REGNO (operands[0]);
1731 mode = GET_MODE (operands[0]);
1732 if (mode != SImode && mode != word_mode)
1735 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1738 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1740 from = XEXP (operands[1], 0);
1743 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1744 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1745 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1747 from = XEXP (XEXP (operands[1], 0), 0);
1748 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1753 if (from == frame_pointer_rtx || from == arg_pointer_rtx)
1758 from = force_reg (Pmode, XEXP (operands[1], 0));
1762 for (i = 0; i < count; i++)
1763 XVECEXP (operands[3], 0, i)
1764 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1765 change_address (operands[1], mode,
1766 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1769 (define_insn "*load_multiple_di"
1770 [(match_parallel 0 "load_multiple_operation"
1771 [(set (match_operand:DI 1 "register_operand" "=r")
1772 (match_operand:DI 2 "s_operand" "QS"))])]
1773 "reload_completed && word_mode == DImode"
1775 int words = XVECLEN (operands[0], 0);
1776 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1777 return "lmg\t%1,%0,%2";
1779 [(set_attr "op_type" "RSY")
1780 (set_attr "type" "lm")])
1782 (define_insn "*load_multiple_si"
1783 [(match_parallel 0 "load_multiple_operation"
1784 [(set (match_operand:SI 1 "register_operand" "=r,r")
1785 (match_operand:SI 2 "s_operand" "Q,S"))])]
1788 int words = XVECLEN (operands[0], 0);
1789 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1790 return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1792 [(set_attr "op_type" "RS,RSY")
1793 (set_attr "type" "lm")])
1796 ; store multiple pattern(s).
1799 (define_expand "store_multiple"
1800 [(match_par_dup 3 [(set (match_operand 0 "" "")
1801 (match_operand 1 "" ""))
1802 (use (match_operand 2 "" ""))])]
1805 enum machine_mode mode;
1811 /* Support only storing a constant number of fixed-point registers to
1812 memory and only bother with this if more than two. */
1813 if (GET_CODE (operands[2]) != CONST_INT
1814 || INTVAL (operands[2]) < 2
1815 || INTVAL (operands[2]) > 16
1816 || GET_CODE (operands[0]) != MEM
1817 || GET_CODE (operands[1]) != REG
1818 || REGNO (operands[1]) >= 16)
1821 count = INTVAL (operands[2]);
1822 regno = REGNO (operands[1]);
1823 mode = GET_MODE (operands[1]);
1824 if (mode != SImode && mode != word_mode)
1827 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1831 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1833 to = XEXP (operands[0], 0);
1836 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1837 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1838 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1840 to = XEXP (XEXP (operands[0], 0), 0);
1841 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1846 if (to == frame_pointer_rtx || to == arg_pointer_rtx)
1851 to = force_reg (Pmode, XEXP (operands[0], 0));
1855 for (i = 0; i < count; i++)
1856 XVECEXP (operands[3], 0, i)
1857 = gen_rtx_SET (VOIDmode,
1858 change_address (operands[0], mode,
1859 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1860 gen_rtx_REG (mode, regno + i));
1863 (define_insn "*store_multiple_di"
1864 [(match_parallel 0 "store_multiple_operation"
1865 [(set (match_operand:DI 1 "s_operand" "=QS")
1866 (match_operand:DI 2 "register_operand" "r"))])]
1867 "reload_completed && word_mode == DImode"
1869 int words = XVECLEN (operands[0], 0);
1870 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1871 return "stmg\t%2,%0,%1";
1873 [(set_attr "op_type" "RSY")
1874 (set_attr "type" "stm")])
1877 (define_insn "*store_multiple_si"
1878 [(match_parallel 0 "store_multiple_operation"
1879 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1880 (match_operand:SI 2 "register_operand" "r,r"))])]
1883 int words = XVECLEN (operands[0], 0);
1884 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1885 return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1887 [(set_attr "op_type" "RS,RSY")
1888 (set_attr "type" "stm")])
1891 ;; String instructions.
1895 ; strlenM instruction pattern(s).
1898 (define_expand "strlendi"
1899 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1902 (unspec:DI [(const_int 0)
1903 (match_operand:BLK 1 "memory_operand" "")
1905 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1906 (clobber (scratch:DI))
1907 (clobber (reg:CC 33))])
1909 [(set (match_operand:DI 0 "register_operand" "")
1910 (minus:DI (match_dup 4) (match_dup 5)))
1911 (clobber (reg:CC 33))])]
1914 operands[4] = gen_reg_rtx (DImode);
1915 operands[5] = gen_reg_rtx (DImode);
1916 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1917 operands[1] = replace_equiv_address (operands[1], operands[5]);
1920 (define_insn "*strlendi"
1921 [(set (match_operand:DI 0 "register_operand" "=a")
1922 (unspec:DI [(match_operand:DI 2 "general_operand" "0")
1923 (mem:BLK (match_operand:DI 3 "register_operand" "1"))
1925 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1926 (clobber (match_scratch:DI 1 "=a"))
1927 (clobber (reg:CC 33))]
1929 "srst\t%0,%1\;jo\t.-4"
1930 [(set_attr "op_type" "NN")
1931 (set_attr "type" "vs")
1932 (set_attr "length" "8")])
1934 (define_expand "strlensi"
1935 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1938 (unspec:SI [(const_int 0)
1939 (match_operand:BLK 1 "memory_operand" "")
1941 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1942 (clobber (scratch:SI))
1943 (clobber (reg:CC 33))])
1945 [(set (match_operand:SI 0 "register_operand" "")
1946 (minus:SI (match_dup 4) (match_dup 5)))
1947 (clobber (reg:CC 33))])]
1950 operands[4] = gen_reg_rtx (SImode);
1951 operands[5] = gen_reg_rtx (SImode);
1952 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1953 operands[1] = replace_equiv_address (operands[1], operands[5]);
1956 (define_insn "*strlensi"
1957 [(set (match_operand:SI 0 "register_operand" "=a")
1958 (unspec:SI [(match_operand:SI 2 "general_operand" "0")
1959 (mem:BLK (match_operand:SI 3 "register_operand" "1"))
1961 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1962 (clobber (match_scratch:SI 1 "=a"))
1963 (clobber (reg:CC 33))]
1965 "srst\t%0,%1\;jo\t.-4"
1966 [(set_attr "op_type" "NN")
1967 (set_attr "type" "vs")
1968 (set_attr "length" "8")])
1971 ; movstrM instruction pattern(s).
1974 (define_expand "movstrdi"
1975 [(set (match_operand:BLK 0 "memory_operand" "")
1976 (match_operand:BLK 1 "memory_operand" ""))
1977 (use (match_operand:DI 2 "general_operand" ""))
1978 (match_operand 3 "" "")]
1980 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1982 (define_expand "movstrsi"
1983 [(set (match_operand:BLK 0 "memory_operand" "")
1984 (match_operand:BLK 1 "memory_operand" ""))
1985 (use (match_operand:SI 2 "general_operand" ""))
1986 (match_operand 3 "" "")]
1988 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1990 ; Move a block that is up to 256 bytes in length.
1991 ; The block length is taken as (operands[2] % 256) + 1.
1993 (define_expand "movstr_short"
1995 [(set (match_operand:BLK 0 "memory_operand" "")
1996 (match_operand:BLK 1 "memory_operand" ""))
1997 (use (match_operand 2 "nonmemory_operand" ""))
1998 (clobber (match_dup 3))])]
2000 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2002 (define_insn "*movstr_short"
2003 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
2004 (match_operand:BLK 1 "memory_operand" "Q,Q"))
2005 (use (match_operand 2 "nonmemory_operand" "n,a"))
2006 (clobber (match_scratch 3 "=X,&a"))]
2007 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2008 && GET_MODE (operands[3]) == Pmode"
2010 switch (which_alternative)
2013 return "mvc\t%O0(%b2+1,%R0),%1";
2016 output_asm_insn ("bras\t%3,.+10", operands);
2017 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
2018 return "ex\t%2,0(%3)";
2024 [(set_attr "op_type" "SS,NN")
2025 (set_attr "type" "cs,cs")
2026 (set_attr "atype" "*,agen")
2027 (set_attr "length" "*,14")])
2029 ; Move a block of arbitrary length.
2031 (define_expand "movstr_long"
2033 [(clobber (match_dup 2))
2034 (clobber (match_dup 3))
2035 (set (match_operand:BLK 0 "memory_operand" "")
2036 (match_operand:BLK 1 "memory_operand" ""))
2037 (use (match_operand 2 "general_operand" ""))
2039 (clobber (reg:CC 33))])]
2042 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2043 rtx reg0 = gen_reg_rtx (dword_mode);
2044 rtx reg1 = gen_reg_rtx (dword_mode);
2045 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2046 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2047 rtx len0 = gen_lowpart (Pmode, reg0);
2048 rtx len1 = gen_lowpart (Pmode, reg1);
2050 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2051 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2052 emit_move_insn (len0, operands[2]);
2054 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2055 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2056 emit_move_insn (len1, operands[2]);
2058 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2059 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2064 (define_insn "*movstr_long_64"
2065 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2066 (clobber (match_operand:TI 1 "register_operand" "=d"))
2067 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2068 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
2071 (clobber (reg:CC 33))]
2073 "mvcle\t%0,%1,0\;jo\t.-4"
2074 [(set_attr "op_type" "NN")
2075 (set_attr "type" "vs")
2076 (set_attr "length" "8")])
2078 (define_insn "*movstr_long_31"
2079 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2080 (clobber (match_operand:DI 1 "register_operand" "=d"))
2081 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2082 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
2085 (clobber (reg:CC 33))]
2087 "mvcle\t%0,%1,0\;jo\t.-4"
2088 [(set_attr "op_type" "NN")
2089 (set_attr "type" "vs")
2090 (set_attr "length" "8")])
2093 ; clrstrM instruction pattern(s).
2096 (define_expand "clrstrdi"
2097 [(set (match_operand:BLK 0 "memory_operand" "")
2099 (use (match_operand:DI 1 "general_operand" ""))
2100 (match_operand 2 "" "")]
2102 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
2104 (define_expand "clrstrsi"
2105 [(set (match_operand:BLK 0 "memory_operand" "")
2107 (use (match_operand:SI 1 "general_operand" ""))
2108 (match_operand 2 "" "")]
2110 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
2112 ; Clear a block that is up to 256 bytes in length.
2113 ; The block length is taken as (operands[1] % 256) + 1.
2115 (define_expand "clrstr_short"
2117 [(set (match_operand:BLK 0 "memory_operand" "")
2119 (use (match_operand 1 "nonmemory_operand" ""))
2120 (clobber (match_dup 2))
2121 (clobber (reg:CC 33))])]
2123 "operands[2] = gen_rtx_SCRATCH (Pmode);")
2125 (define_insn "*clrstr_short"
2126 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
2128 (use (match_operand 1 "nonmemory_operand" "n,a"))
2129 (clobber (match_scratch 2 "=X,&a"))
2130 (clobber (reg:CC 33))]
2131 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
2132 && GET_MODE (operands[2]) == Pmode"
2134 switch (which_alternative)
2137 return "xc\t%O0(%b1+1,%R0),%0";
2140 output_asm_insn ("bras\t%2,.+10", operands);
2141 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
2142 return "ex\t%1,0(%2)";
2148 [(set_attr "op_type" "SS,NN")
2149 (set_attr "type" "cs,cs")
2150 (set_attr "atype" "*,agen")
2151 (set_attr "length" "*,14")])
2153 ; Clear a block of arbitrary length.
2155 (define_expand "clrstr_long"
2157 [(clobber (match_dup 1))
2158 (set (match_operand:BLK 0 "memory_operand" "")
2160 (use (match_operand 1 "general_operand" ""))
2162 (clobber (reg:CC 33))])]
2165 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2166 rtx reg0 = gen_reg_rtx (dword_mode);
2167 rtx reg1 = gen_reg_rtx (dword_mode);
2168 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2169 rtx len0 = gen_lowpart (Pmode, reg0);
2171 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2172 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2173 emit_move_insn (len0, operands[1]);
2175 emit_move_insn (reg1, const0_rtx);
2177 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2182 (define_insn "*clrstr_long_64"
2183 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2184 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2187 (use (match_operand:TI 1 "register_operand" "d"))
2188 (clobber (reg:CC 33))]
2190 "mvcle\t%0,%1,0\;jo\t.-4"
2191 [(set_attr "op_type" "NN")
2192 (set_attr "type" "vs")
2193 (set_attr "length" "8")])
2195 (define_insn "*clrstr_long_31"
2196 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2197 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2200 (use (match_operand:DI 1 "register_operand" "d"))
2201 (clobber (reg:CC 33))]
2203 "mvcle\t%0,%1,0\;jo\t.-4"
2204 [(set_attr "op_type" "NN")
2205 (set_attr "type" "vs")
2206 (set_attr "length" "8")])
2209 ; cmpmemM instruction pattern(s).
2212 (define_expand "cmpmemdi"
2213 [(set (match_operand:DI 0 "register_operand" "")
2214 (compare:DI (match_operand:BLK 1 "memory_operand" "")
2215 (match_operand:BLK 2 "memory_operand" "") ) )
2216 (use (match_operand:DI 3 "general_operand" ""))
2217 (use (match_operand:DI 4 "" ""))]
2219 "s390_expand_cmpmem (operands[0], operands[1],
2220 operands[2], operands[3]); DONE;")
2222 (define_expand "cmpmemsi"
2223 [(set (match_operand:SI 0 "register_operand" "")
2224 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2225 (match_operand:BLK 2 "memory_operand" "") ) )
2226 (use (match_operand:SI 3 "general_operand" ""))
2227 (use (match_operand:SI 4 "" ""))]
2229 "s390_expand_cmpmem (operands[0], operands[1],
2230 operands[2], operands[3]); DONE;")
2232 ; Compare a block that is up to 256 bytes in length.
2233 ; The block length is taken as (operands[2] % 256) + 1.
2235 (define_expand "cmpmem_short"
2238 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2239 (match_operand:BLK 1 "memory_operand" "")))
2240 (use (match_operand 2 "nonmemory_operand" ""))
2241 (clobber (match_dup 3))])]
2243 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2245 (define_insn "*cmpmem_short"
2247 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2248 (match_operand:BLK 1 "memory_operand" "Q,Q")))
2249 (use (match_operand 2 "nonmemory_operand" "n,a"))
2250 (clobber (match_scratch 3 "=X,&a"))]
2251 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2252 && GET_MODE (operands[3]) == Pmode"
2254 switch (which_alternative)
2257 return "clc\t%O0(%b2+1,%R0),%1";
2260 output_asm_insn ("bras\t%3,.+10", operands);
2261 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2262 return "ex\t%2,0(%3)";
2268 [(set_attr "op_type" "SS,NN")
2269 (set_attr "type" "cs,cs")
2270 (set_attr "atype" "*,agen")
2271 (set_attr "length" "*,14")])
2273 ; Compare a block of arbitrary length.
2275 (define_expand "cmpmem_long"
2277 [(clobber (match_dup 2))
2278 (clobber (match_dup 3))
2280 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2281 (match_operand:BLK 1 "memory_operand" "")))
2282 (use (match_operand 2 "general_operand" ""))
2283 (use (match_dup 3))])]
2286 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2287 rtx reg0 = gen_reg_rtx (dword_mode);
2288 rtx reg1 = gen_reg_rtx (dword_mode);
2289 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2290 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2291 rtx len0 = gen_lowpart (Pmode, reg0);
2292 rtx len1 = gen_lowpart (Pmode, reg1);
2294 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2295 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2296 emit_move_insn (len0, operands[2]);
2298 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2299 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2300 emit_move_insn (len1, operands[2]);
2302 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2303 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2308 (define_insn "*cmpmem_long_64"
2309 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2310 (clobber (match_operand:TI 1 "register_operand" "=d"))
2312 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2313 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2315 (use (match_dup 3))]
2317 "clcle\t%0,%1,0\;jo\t.-4"
2318 [(set_attr "op_type" "NN")
2319 (set_attr "type" "vs")
2320 (set_attr "length" "8")])
2322 (define_insn "*cmpmem_long_31"
2323 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2324 (clobber (match_operand:DI 1 "register_operand" "=d"))
2326 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2327 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2329 (use (match_dup 3))]
2331 "clcle\t%0,%1,0\;jo\t.-4"
2332 [(set_attr "op_type" "NN")
2333 (set_attr "type" "vs")
2334 (set_attr "length" "8")])
2336 ; Convert condition code to integer in range (-1, 0, 1)
2338 (define_insn "cmpint_si"
2339 [(set (match_operand:SI 0 "register_operand" "=d")
2340 (compare:SI (reg:CCS 33) (const_int 0)))]
2343 output_asm_insn ("lhi\t%0,1", operands);
2344 output_asm_insn ("jh\t.+12", operands);
2345 output_asm_insn ("jl\t.+6", operands);
2346 output_asm_insn ("sr\t%0,%0", operands);
2347 return "lcr\t%0,%0";
2349 [(set_attr "op_type" "NN")
2350 (set_attr "length" "16")
2351 (set_attr "type" "other")])
2353 (define_insn "cmpint_di"
2354 [(set (match_operand:DI 0 "register_operand" "=d")
2355 (compare:DI (reg:CCS 33) (const_int 0)))]
2358 output_asm_insn ("lghi\t%0,1", operands);
2359 output_asm_insn ("jh\t.+16", operands);
2360 output_asm_insn ("jl\t.+8", operands);
2361 output_asm_insn ("sgr\t%0,%0", operands);
2362 return "lcgr\t%0,%0";
2364 [(set_attr "op_type" "NN")
2365 (set_attr "length" "20")
2366 (set_attr "type" "other")])
2370 ;;- Conversion instructions.
2373 (define_insn "*sethighqisi"
2374 [(set (match_operand:SI 0 "register_operand" "=d,d")
2375 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2376 (clobber (reg:CC 33))]
2381 [(set_attr "op_type" "RS,RSY")])
2383 (define_insn "*sethighhisi"
2384 [(set (match_operand:SI 0 "register_operand" "=d,d")
2385 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2386 (clobber (reg:CC 33))]
2391 [(set_attr "op_type" "RS,RSY")])
2393 (define_insn "*sethighqidi_64"
2394 [(set (match_operand:DI 0 "register_operand" "=d")
2395 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2396 (clobber (reg:CC 33))]
2399 [(set_attr "op_type" "RSY")])
2401 (define_insn "*sethighqidi_31"
2402 [(set (match_operand:DI 0 "register_operand" "=d,d")
2403 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2404 (clobber (reg:CC 33))]
2409 [(set_attr "op_type" "RS,RSY")])
2411 (define_insn_and_split "*extractqi"
2412 [(set (match_operand:SI 0 "register_operand" "=d")
2413 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2414 (match_operand 2 "const_int_operand" "n")
2416 (clobber (reg:CC 33))]
2418 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2420 "&& reload_completed"
2422 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2423 (clobber (reg:CC 33))])
2424 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2426 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2427 operands[1] = change_address (operands[1], QImode, 0);
2429 [(set_attr "atype" "agen")])
2431 (define_insn_and_split "*extracthi"
2432 [(set (match_operand:SI 0 "register_operand" "=d")
2433 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2434 (match_operand 2 "const_int_operand" "n")
2436 (clobber (reg:CC 33))]
2438 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2440 "&& reload_completed"
2442 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2443 (clobber (reg:CC 33))])
2444 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2446 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2447 operands[1] = change_address (operands[1], HImode, 0);
2449 [(set_attr "atype" "agen")])
2452 ; extendsidi2 instruction pattern(s).
2455 (define_expand "extendsidi2"
2456 [(set (match_operand:DI 0 "register_operand" "")
2457 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2463 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2464 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2465 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2466 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2472 (define_insn "*extendsidi2"
2473 [(set (match_operand:DI 0 "register_operand" "=d,d")
2474 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2479 [(set_attr "op_type" "RRE,RXY")])
2482 ; extendhidi2 instruction pattern(s).
2485 (define_expand "extendhidi2"
2486 [(set (match_operand:DI 0 "register_operand" "")
2487 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2493 rtx tmp = gen_reg_rtx (SImode);
2494 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2495 emit_insn (gen_extendsidi2 (operands[0], tmp));
2500 operands[1] = gen_lowpart (DImode, operands[1]);
2501 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2502 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2508 (define_insn "*extendhidi2"
2509 [(set (match_operand:DI 0 "register_operand" "=d")
2510 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2513 [(set_attr "op_type" "RXY")])
2516 ; extendqidi2 instruction pattern(s).
2519 (define_expand "extendqidi2"
2520 [(set (match_operand:DI 0 "register_operand" "")
2521 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2527 rtx tmp = gen_reg_rtx (SImode);
2528 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2529 emit_insn (gen_extendsidi2 (operands[0], tmp));
2534 operands[1] = gen_lowpart (DImode, operands[1]);
2535 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2536 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2542 (define_insn "*extendqidi2"
2543 [(set (match_operand:DI 0 "register_operand" "=d")
2544 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2545 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2547 [(set_attr "op_type" "RXY")])
2549 (define_insn_and_split "*extendqidi2_short_displ"
2550 [(set (match_operand:DI 0 "register_operand" "=d")
2551 (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))
2552 (clobber (reg:CC 33))]
2553 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2555 "&& reload_completed"
2557 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2558 (clobber (reg:CC 33))])
2560 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2561 (clobber (reg:CC 33))])]
2565 ; extendhisi2 instruction pattern(s).
2568 (define_expand "extendhisi2"
2569 [(set (match_operand:SI 0 "register_operand" "")
2570 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2574 operands[1] = gen_lowpart (SImode, operands[1]);
2575 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2576 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2581 (define_insn "*extendhisi2"
2582 [(set (match_operand:SI 0 "register_operand" "=d,d")
2583 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2588 [(set_attr "op_type" "RX,RXY")])
2591 ; extendqisi2 instruction pattern(s).
2594 (define_expand "extendqisi2"
2595 [(set (match_operand:SI 0 "register_operand" "")
2596 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2600 operands[1] = gen_lowpart (SImode, operands[1]);
2601 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2602 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2607 (define_insn "*extendqisi2"
2608 [(set (match_operand:SI 0 "register_operand" "=d")
2609 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2610 "TARGET_LONG_DISPLACEMENT"
2612 [(set_attr "op_type" "RXY")])
2614 (define_insn_and_split "*extendqisi2_short_displ"
2615 [(set (match_operand:SI 0 "register_operand" "=d")
2616 (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))
2617 (clobber (reg:CC 33))]
2618 "!TARGET_LONG_DISPLACEMENT"
2620 "&& reload_completed"
2622 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2623 (clobber (reg:CC 33))])
2625 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2626 (clobber (reg:CC 33))])]
2630 ; extendqihi2 instruction pattern(s).
2635 ; zero_extendsidi2 instruction pattern(s).
2638 (define_expand "zero_extendsidi2"
2639 [(set (match_operand:DI 0 "register_operand" "")
2640 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2646 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2647 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2648 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2654 (define_insn "*zero_extendsidi2"
2655 [(set (match_operand:DI 0 "register_operand" "=d,d")
2656 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2661 [(set_attr "op_type" "RRE,RXY")])
2664 ; zero_extendhidi2 instruction pattern(s).
2667 (define_expand "zero_extendhidi2"
2668 [(set (match_operand:DI 0 "register_operand" "")
2669 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2675 rtx tmp = gen_reg_rtx (SImode);
2676 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2677 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2682 operands[1] = gen_lowpart (DImode, operands[1]);
2683 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2684 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2690 (define_insn "*zero_extendhidi2"
2691 [(set (match_operand:DI 0 "register_operand" "=d")
2692 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2695 [(set_attr "op_type" "RXY")])
2698 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2701 (define_insn "*llgt_sisi"
2702 [(set (match_operand:SI 0 "register_operand" "=d,d")
2703 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2704 (const_int 2147483647)))]
2709 [(set_attr "op_type" "RRE,RXE")])
2712 [(set (match_operand:SI 0 "register_operand" "")
2713 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2714 (const_int 2147483647)))
2715 (clobber (reg:CC 33))]
2716 "TARGET_64BIT && reload_completed"
2718 (and:SI (match_dup 1)
2719 (const_int 2147483647)))]
2722 (define_insn "*llgt_didi"
2723 [(set (match_operand:DI 0 "register_operand" "=d,d")
2724 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2725 (const_int 2147483647)))]
2730 [(set_attr "op_type" "RRE,RXE")])
2733 [(set (match_operand:DI 0 "register_operand" "")
2734 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
2735 (const_int 2147483647)))
2736 (clobber (reg:CC 33))]
2737 "TARGET_64BIT && reload_completed"
2739 (and:DI (match_dup 1)
2740 (const_int 2147483647)))]
2743 (define_insn "*llgt_sidi"
2744 [(set (match_operand:DI 0 "register_operand" "=d")
2745 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2746 (const_int 2147483647)))]
2749 [(set_attr "op_type" "RXE")])
2751 (define_insn_and_split "*llgt_sidi_split"
2752 [(set (match_operand:DI 0 "register_operand" "=d")
2753 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2754 (const_int 2147483647)))
2755 (clobber (reg:CC 33))]
2758 "&& reload_completed"
2760 (and:DI (subreg:DI (match_dup 1) 0)
2761 (const_int 2147483647)))]
2765 ; zero_extendqidi2 instruction pattern(s)
2768 (define_expand "zero_extendqidi2"
2769 [(set (match_operand:DI 0 "register_operand" "")
2770 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2776 rtx tmp = gen_reg_rtx (SImode);
2777 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2778 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2783 operands[1] = gen_lowpart (DImode, operands[1]);
2784 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2785 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2791 (define_insn "*zero_extendqidi2"
2792 [(set (match_operand:DI 0 "register_operand" "=d")
2793 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2796 [(set_attr "op_type" "RXY")])
2799 ; zero_extendhisi2 instruction pattern(s).
2802 (define_expand "zero_extendhisi2"
2803 [(set (match_operand:SI 0 "register_operand" "")
2804 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2808 operands[1] = gen_lowpart (SImode, operands[1]);
2809 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2814 (define_insn "*zero_extendhisi2_64"
2815 [(set (match_operand:SI 0 "register_operand" "=d")
2816 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2819 [(set_attr "op_type" "RXY")])
2821 (define_insn_and_split "*zero_extendhisi2_31"
2822 [(set (match_operand:SI 0 "register_operand" "=&d")
2823 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2824 (clobber (reg:CC 33))]
2827 "&& reload_completed"
2828 [(set (match_dup 0) (const_int 0))
2830 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2831 (clobber (reg:CC 33))])]
2832 "operands[2] = gen_lowpart (HImode, operands[0]);"
2833 [(set_attr "atype" "agen")])
2836 ; zero_extendqisi2 instruction pattern(s).
2839 (define_expand "zero_extendqisi2"
2840 [(set (match_operand:SI 0 "register_operand" "")
2841 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2845 operands[1] = gen_lowpart (SImode, operands[1]);
2846 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2851 (define_insn "*zero_extendqisi2_64"
2852 [(set (match_operand:SI 0 "register_operand" "=d")
2853 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2856 [(set_attr "op_type" "RXY")])
2858 (define_insn_and_split "*zero_extendqisi2_31"
2859 [(set (match_operand:SI 0 "register_operand" "=&d")
2860 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2863 "&& reload_completed"
2864 [(set (match_dup 0) (const_int 0))
2865 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2866 "operands[2] = gen_lowpart (QImode, operands[0]);"
2867 [(set_attr "atype" "agen")])
2870 ; zero_extendqihi2 instruction pattern(s).
2873 (define_expand "zero_extendqihi2"
2874 [(set (match_operand:HI 0 "register_operand" "")
2875 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2879 operands[1] = gen_lowpart (HImode, operands[1]);
2880 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2885 (define_insn "*zero_extendqihi2_64"
2886 [(set (match_operand:HI 0 "register_operand" "=d")
2887 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2890 [(set_attr "op_type" "RXY")])
2892 (define_insn_and_split "*zero_extendqihi2_31"
2893 [(set (match_operand:HI 0 "register_operand" "=&d")
2894 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2897 "&& reload_completed"
2898 [(set (match_dup 0) (const_int 0))
2899 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2900 "operands[2] = gen_lowpart (QImode, operands[0]);"
2901 [(set_attr "atype" "agen")])
2905 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2908 (define_expand "fixuns_truncdfdi2"
2909 [(set (match_operand:DI 0 "register_operand" "")
2910 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2911 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2913 rtx label1 = gen_label_rtx ();
2914 rtx label2 = gen_label_rtx ();
2915 rtx temp = gen_reg_rtx (DFmode);
2916 operands[1] = force_reg (DFmode, operands[1]);
2918 emit_insn (gen_cmpdf (operands[1],
2919 CONST_DOUBLE_FROM_REAL_VALUE (
2920 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2921 emit_jump_insn (gen_blt (label1));
2922 emit_insn (gen_subdf3 (temp, operands[1],
2923 CONST_DOUBLE_FROM_REAL_VALUE (
2924 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2925 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2928 emit_label (label1);
2929 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2930 emit_label (label2);
2934 (define_expand "fix_truncdfdi2"
2935 [(set (match_operand:DI 0 "register_operand" "")
2936 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2937 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2939 operands[1] = force_reg (DFmode, operands[1]);
2940 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2944 (define_insn "fix_truncdfdi2_ieee"
2945 [(set (match_operand:DI 0 "register_operand" "=d")
2946 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2947 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2948 (clobber (reg:CC 33))]
2949 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2951 [(set_attr "op_type" "RRE")
2952 (set_attr "type" "ftoi")])
2955 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2958 (define_expand "fixuns_truncdfsi2"
2959 [(set (match_operand:SI 0 "register_operand" "")
2960 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2961 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2963 rtx label1 = gen_label_rtx ();
2964 rtx label2 = gen_label_rtx ();
2965 rtx temp = gen_reg_rtx (DFmode);
2967 operands[1] = force_reg (DFmode,operands[1]);
2968 emit_insn (gen_cmpdf (operands[1],
2969 CONST_DOUBLE_FROM_REAL_VALUE (
2970 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2971 emit_jump_insn (gen_blt (label1));
2972 emit_insn (gen_subdf3 (temp, operands[1],
2973 CONST_DOUBLE_FROM_REAL_VALUE (
2974 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2975 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2978 emit_label (label1);
2979 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2980 emit_label (label2);
2984 (define_expand "fix_truncdfsi2"
2985 [(set (match_operand:SI 0 "register_operand" "")
2986 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2989 if (TARGET_IBM_FLOAT)
2991 /* This is the algorithm from POP chapter A.5.7.2. */
2993 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2994 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2995 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2997 operands[1] = force_reg (DFmode, operands[1]);
2998 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2999 two31r, two32, temp));
3003 operands[1] = force_reg (DFmode, operands[1]);
3004 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3010 (define_insn "fix_truncdfsi2_ieee"
3011 [(set (match_operand:SI 0 "register_operand" "=d")
3012 (fix:SI (match_operand:DF 1 "register_operand" "f")))
3013 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3014 (clobber (reg:CC 33))]
3015 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3017 [(set_attr "op_type" "RRE")
3018 (set_attr "type" "other" )])
3020 (define_insn "fix_truncdfsi2_ibm"
3021 [(set (match_operand:SI 0 "register_operand" "=d")
3022 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
3023 (use (match_operand:DI 2 "immediate_operand" "m"))
3024 (use (match_operand:DI 3 "immediate_operand" "m"))
3025 (use (match_operand:BLK 4 "memory_operand" "m"))
3026 (clobber (reg:CC 33))]
3027 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3029 output_asm_insn ("sd\t%1,%2", operands);
3030 output_asm_insn ("aw\t%1,%3", operands);
3031 output_asm_insn ("std\t%1,%4", operands);
3032 output_asm_insn ("xi\t%N4,128", operands);
3035 [(set_attr "op_type" "NN")
3036 (set_attr "type" "ftoi")
3037 (set_attr "atype" "agen")
3038 (set_attr "length" "20")])
3041 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
3044 (define_expand "fixuns_truncsfdi2"
3045 [(set (match_operand:DI 0 "register_operand" "")
3046 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
3047 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3049 rtx label1 = gen_label_rtx ();
3050 rtx label2 = gen_label_rtx ();
3051 rtx temp = gen_reg_rtx (SFmode);
3053 operands[1] = force_reg (SFmode, operands[1]);
3054 emit_insn (gen_cmpsf (operands[1],
3055 CONST_DOUBLE_FROM_REAL_VALUE (
3056 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
3057 emit_jump_insn (gen_blt (label1));
3059 emit_insn (gen_subsf3 (temp, operands[1],
3060 CONST_DOUBLE_FROM_REAL_VALUE (
3061 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
3062 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
3065 emit_label (label1);
3066 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
3067 emit_label (label2);
3071 (define_expand "fix_truncsfdi2"
3072 [(set (match_operand:DI 0 "register_operand" "")
3073 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
3074 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3076 operands[1] = force_reg (SFmode, operands[1]);
3077 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
3081 (define_insn "fix_truncsfdi2_ieee"
3082 [(set (match_operand:DI 0 "register_operand" "=d")
3083 (fix:DI (match_operand:SF 1 "register_operand" "f")))
3084 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3085 (clobber (reg:CC 33))]
3086 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3088 [(set_attr "op_type" "RRE")
3089 (set_attr "type" "ftoi")])
3092 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
3095 (define_expand "fixuns_truncsfsi2"
3096 [(set (match_operand:SI 0 "register_operand" "")
3097 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
3098 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3100 rtx label1 = gen_label_rtx ();
3101 rtx label2 = gen_label_rtx ();
3102 rtx temp = gen_reg_rtx (SFmode);
3104 operands[1] = force_reg (SFmode, operands[1]);
3105 emit_insn (gen_cmpsf (operands[1],
3106 CONST_DOUBLE_FROM_REAL_VALUE (
3107 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
3108 emit_jump_insn (gen_blt (label1));
3109 emit_insn (gen_subsf3 (temp, operands[1],
3110 CONST_DOUBLE_FROM_REAL_VALUE (
3111 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
3112 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
3115 emit_label (label1);
3116 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3117 emit_label (label2);
3121 (define_expand "fix_truncsfsi2"
3122 [(set (match_operand:SI 0 "register_operand" "")
3123 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
3126 if (TARGET_IBM_FLOAT)
3128 /* Convert to DFmode and then use the POP algorithm. */
3129 rtx temp = gen_reg_rtx (DFmode);
3130 emit_insn (gen_extendsfdf2 (temp, operands[1]));
3131 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
3135 operands[1] = force_reg (SFmode, operands[1]);
3136 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3142 (define_insn "fix_truncsfsi2_ieee"
3143 [(set (match_operand:SI 0 "register_operand" "=d")
3144 (fix:SI (match_operand:SF 1 "register_operand" "f")))
3145 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3146 (clobber (reg:CC 33))]
3147 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3149 [(set_attr "op_type" "RRE")
3150 (set_attr "type" "ftoi")])
3153 ; floatdidf2 instruction pattern(s).
3156 (define_insn "floatdidf2"
3157 [(set (match_operand:DF 0 "register_operand" "=f")
3158 (float:DF (match_operand:DI 1 "register_operand" "d")))
3159 (clobber (reg:CC 33))]
3160 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3162 [(set_attr "op_type" "RRE")
3163 (set_attr "type" "itof" )])
3166 ; floatdisf2 instruction pattern(s).
3169 (define_insn "floatdisf2"
3170 [(set (match_operand:SF 0 "register_operand" "=f")
3171 (float:SF (match_operand:DI 1 "register_operand" "d")))
3172 (clobber (reg:CC 33))]
3173 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3175 [(set_attr "op_type" "RRE")
3176 (set_attr "type" "itof" )])
3179 ; floatsidf2 instruction pattern(s).
3182 (define_expand "floatsidf2"
3184 [(set (match_operand:DF 0 "register_operand" "")
3185 (float:DF (match_operand:SI 1 "register_operand" "")))
3186 (clobber (reg:CC 33))])]
3189 if (TARGET_IBM_FLOAT)
3191 /* This is the algorithm from POP chapter A.5.7.1. */
3193 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3194 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
3196 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
3201 (define_insn "floatsidf2_ieee"
3202 [(set (match_operand:DF 0 "register_operand" "=f")
3203 (float:DF (match_operand:SI 1 "register_operand" "d")))
3204 (clobber (reg:CC 33))]
3205 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3207 [(set_attr "op_type" "RRE")
3208 (set_attr "type" "itof" )])
3210 (define_insn "floatsidf2_ibm"
3211 [(set (match_operand:DF 0 "register_operand" "=f")
3212 (float:DF (match_operand:SI 1 "register_operand" "d")))
3213 (use (match_operand:DI 2 "immediate_operand" "m"))
3214 (use (match_operand:BLK 3 "memory_operand" "m"))
3215 (clobber (reg:CC 33))]
3216 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3218 output_asm_insn ("st\t%1,%N3", operands);
3219 output_asm_insn ("xi\t%N3,128", operands);
3220 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3221 output_asm_insn ("ld\t%0,%3", operands);
3224 [(set_attr "op_type" "NN")
3225 (set_attr "type" "other" )
3226 (set_attr "atype" "agen")
3227 (set_attr "length" "20")])
3230 ; floatsisf2 instruction pattern(s).
3233 (define_expand "floatsisf2"
3235 [(set (match_operand:SF 0 "register_operand" "")
3236 (float:SF (match_operand:SI 1 "register_operand" "")))
3237 (clobber (reg:CC 33))])]
3240 if (TARGET_IBM_FLOAT)
3242 /* Use the POP algorithm to convert to DFmode and then truncate. */
3243 rtx temp = gen_reg_rtx (DFmode);
3244 emit_insn (gen_floatsidf2 (temp, operands[1]));
3245 emit_insn (gen_truncdfsf2 (operands[0], temp));
3250 (define_insn "floatsisf2_ieee"
3251 [(set (match_operand:SF 0 "register_operand" "=f")
3252 (float:SF (match_operand:SI 1 "register_operand" "d")))
3253 (clobber (reg:CC 33))]
3254 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3256 [(set_attr "op_type" "RRE")
3257 (set_attr "type" "itof" )])
3260 ; truncdfsf2 instruction pattern(s).
3263 (define_expand "truncdfsf2"
3264 [(set (match_operand:SF 0 "register_operand" "")
3265 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3269 (define_insn "truncdfsf2_ieee"
3270 [(set (match_operand:SF 0 "register_operand" "=f")
3271 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3272 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3274 [(set_attr "op_type" "RRE")])
3276 (define_insn "truncdfsf2_ibm"
3277 [(set (match_operand:SF 0 "register_operand" "=f,f")
3278 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3279 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3283 [(set_attr "op_type" "RR,RX")
3284 (set_attr "type" "floads,floads")])
3287 ; extendsfdf2 instruction pattern(s).
3290 (define_expand "extendsfdf2"
3291 [(set (match_operand:DF 0 "register_operand" "")
3292 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3295 if (TARGET_IBM_FLOAT)
3297 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3302 (define_insn "extendsfdf2_ieee"
3303 [(set (match_operand:DF 0 "register_operand" "=f,f")
3304 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3305 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3309 [(set_attr "op_type" "RRE,RXE")
3310 (set_attr "type" "floads,floads")])
3312 (define_insn "extendsfdf2_ibm"
3313 [(set (match_operand:DF 0 "register_operand" "=f,f")
3314 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3315 (clobber (reg:CC 33))]
3316 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3318 sdr\t%0,%0\;ler\t%0,%1
3319 sdr\t%0,%0\;le\t%0,%1"
3320 [(set_attr "op_type" "NN,NN")
3321 (set_attr "atype" "reg,agen")
3322 (set_attr "length" "4,6")
3323 (set_attr "type" "o2,o2")])
3327 ;; ARITHMETIC OPERATIONS
3329 ; arithmetic operations set the ConditionCode,
3330 ; because of unpredictable Bits in Register for Halfword and Byte
3331 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3334 ;;- Add instructions.
3338 ; addti3 instruction pattern(s).
3341 (define_insn_and_split "addti3"
3342 [(set (match_operand:TI 0 "register_operand" "=&d")
3343 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
3344 (match_operand:TI 2 "general_operand" "do") ) )
3345 (clobber (reg:CC 33))]
3348 "&& reload_completed"
3351 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
3353 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
3355 [(set (match_dup 3) (plus:DI (plus:DI (match_dup 4) (match_dup 5))
3356 (ltu:DI (reg:CCL1 33) (const_int 0))))
3357 (clobber (reg:CC 33))])]
3358 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3359 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3360 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3361 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3362 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3363 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
3364 [(set_attr "op_type" "NN")])
3367 ; adddi3 instruction pattern(s).
3370 (define_insn "*adddi3_sign"
3371 [(set (match_operand:DI 0 "register_operand" "=d,d")
3372 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3373 (match_operand:DI 1 "register_operand" "0,0")))
3374 (clobber (reg:CC 33))]
3379 [(set_attr "op_type" "RRE,RXY")])
3381 (define_insn "*adddi3_zero_cc"
3383 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3384 (match_operand:DI 1 "register_operand" "0,0"))
3386 (set (match_operand:DI 0 "register_operand" "=d,d")
3387 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3388 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3392 [(set_attr "op_type" "RRE,RXY")])
3394 (define_insn "*adddi3_zero_cconly"
3396 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3397 (match_operand:DI 1 "register_operand" "0,0"))
3399 (clobber (match_scratch:DI 0 "=d,d"))]
3400 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3404 [(set_attr "op_type" "RRE,RXY")])
3406 (define_insn "*adddi3_zero"
3407 [(set (match_operand:DI 0 "register_operand" "=d,d")
3408 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3409 (match_operand:DI 1 "register_operand" "0,0")))
3410 (clobber (reg:CC 33))]
3415 [(set_attr "op_type" "RRE,RXY")])
3417 (define_insn "*adddi3_imm_cc"
3419 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3420 (match_operand:DI 2 "const_int_operand" "K"))
3422 (set (match_operand:DI 0 "register_operand" "=d")
3423 (plus:DI (match_dup 1) (match_dup 2)))]
3425 && s390_match_ccmode (insn, CCAmode)
3426 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3428 [(set_attr "op_type" "RI")])
3430 (define_insn "*adddi3_carry1_cc"
3432 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3433 (match_operand:DI 2 "general_operand" "d,m"))
3435 (set (match_operand:DI 0 "register_operand" "=d,d")
3436 (plus:DI (match_dup 1) (match_dup 2)))]
3437 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3441 [(set_attr "op_type" "RRE,RXY")])
3443 (define_insn "*adddi3_carry1_cconly"
3445 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3446 (match_operand:DI 2 "general_operand" "d,m"))
3448 (clobber (match_scratch:DI 0 "=d,d"))]
3449 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3453 [(set_attr "op_type" "RRE,RXY")])
3455 (define_insn "*adddi3_carry2_cc"
3457 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3458 (match_operand:DI 2 "general_operand" "d,m"))
3460 (set (match_operand:DI 0 "register_operand" "=d,d")
3461 (plus:DI (match_dup 1) (match_dup 2)))]
3462 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3466 [(set_attr "op_type" "RRE,RXY")])
3468 (define_insn "*adddi3_carry2_cconly"
3470 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3471 (match_operand:DI 2 "general_operand" "d,m"))
3473 (clobber (match_scratch:DI 0 "=d,d"))]
3474 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3478 [(set_attr "op_type" "RRE,RXY")])
3480 (define_insn "*adddi3_cc"
3482 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3483 (match_operand:DI 2 "general_operand" "d,m"))
3485 (set (match_operand:DI 0 "register_operand" "=d,d")
3486 (plus:DI (match_dup 1) (match_dup 2)))]
3487 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3491 [(set_attr "op_type" "RRE,RXY")])
3493 (define_insn "*adddi3_cconly"
3495 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3496 (match_operand:DI 2 "general_operand" "d,m"))
3498 (clobber (match_scratch:DI 0 "=d,d"))]
3499 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3503 [(set_attr "op_type" "RRE,RXY")])
3505 (define_insn "*adddi3_cconly2"
3507 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3508 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3509 (clobber (match_scratch:DI 0 "=d,d"))]
3510 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3514 [(set_attr "op_type" "RRE,RXY")])
3516 (define_insn "*adddi3_64"
3517 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3518 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3519 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3520 (clobber (reg:CC 33))]
3526 [(set_attr "op_type" "RRE,RI,RXY")])
3528 (define_insn_and_split "*adddi3_31z"
3529 [(set (match_operand:DI 0 "register_operand" "=&d")
3530 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3531 (match_operand:DI 2 "general_operand" "do") ) )
3532 (clobber (reg:CC 33))]
3533 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3535 "&& reload_completed"
3538 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3540 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3542 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3543 (ltu:SI (reg:CCL1 33) (const_int 0))))
3544 (clobber (reg:CC 33))])]
3545 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3546 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3547 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3548 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3549 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3550 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3551 [(set_attr "op_type" "NN")])
3553 (define_insn_and_split "*adddi3_31"
3554 [(set (match_operand:DI 0 "register_operand" "=&d")
3555 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3556 (match_operand:DI 2 "general_operand" "do") ) )
3557 (clobber (reg:CC 33))]
3560 "&& reload_completed"
3562 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3563 (clobber (reg:CC 33))])
3566 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3568 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3570 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3572 (label_ref (match_dup 9))))
3574 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3575 (clobber (reg:CC 33))])
3577 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3578 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3579 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3580 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3581 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3582 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3583 operands[9] = gen_label_rtx ();"
3584 [(set_attr "op_type" "NN")])
3586 (define_expand "adddi3"
3588 [(set (match_operand:DI 0 "register_operand" "")
3589 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3590 (match_operand:DI 2 "general_operand" "")))
3591 (clobber (reg:CC 33))])]
3596 ; addsi3 instruction pattern(s).
3599 (define_insn "*addsi3_imm_cc"
3601 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3602 (match_operand:SI 2 "const_int_operand" "K"))
3604 (set (match_operand:SI 0 "register_operand" "=d")
3605 (plus:SI (match_dup 1) (match_dup 2)))]
3606 "s390_match_ccmode (insn, CCAmode)
3607 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3609 [(set_attr "op_type" "RI")])
3611 (define_insn "*addsi3_carry1_cc"
3613 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3614 (match_operand:SI 2 "general_operand" "d,R,T"))
3616 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3617 (plus:SI (match_dup 1) (match_dup 2)))]
3618 "s390_match_ccmode (insn, CCL1mode)"
3623 [(set_attr "op_type" "RR,RX,RXY")])
3625 (define_insn "*addsi3_carry1_cconly"
3627 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3628 (match_operand:SI 2 "general_operand" "d,R,T"))
3630 (clobber (match_scratch:SI 0 "=d,d,d"))]
3631 "s390_match_ccmode (insn, CCL1mode)"
3636 [(set_attr "op_type" "RR,RX,RXY")])
3638 (define_insn "*addsi3_carry2_cc"
3640 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3641 (match_operand:SI 2 "general_operand" "d,R,T"))
3643 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3644 (plus:SI (match_dup 1) (match_dup 2)))]
3645 "s390_match_ccmode (insn, CCL1mode)"
3650 [(set_attr "op_type" "RR,RX,RXY")])
3652 (define_insn "*addsi3_carry2_cconly"
3654 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3655 (match_operand:SI 2 "general_operand" "d,R,T"))
3657 (clobber (match_scratch:SI 0 "=d,d,d"))]
3658 "s390_match_ccmode (insn, CCL1mode)"
3663 [(set_attr "op_type" "RR,RX,RXY")])
3665 (define_insn "*addsi3_cc"
3667 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3668 (match_operand:SI 2 "general_operand" "d,R,T"))
3670 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3671 (plus:SI (match_dup 1) (match_dup 2)))]
3672 "s390_match_ccmode (insn, CCLmode)"
3677 [(set_attr "op_type" "RR,RX,RXY")])
3679 (define_insn "*addsi3_cconly"
3681 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3682 (match_operand:SI 2 "general_operand" "d,R,T"))
3684 (clobber (match_scratch:SI 0 "=d,d,d"))]
3685 "s390_match_ccmode (insn, CCLmode)"
3690 [(set_attr "op_type" "RR,RX,RXY")])
3692 (define_insn "*addsi3_cconly2"
3694 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3695 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3696 (clobber (match_scratch:SI 0 "=d,d,d"))]
3697 "s390_match_ccmode (insn, CCLmode)"
3702 [(set_attr "op_type" "RR,RX,RXY")])
3704 (define_insn "*addsi3_sign"
3705 [(set (match_operand:SI 0 "register_operand" "=d,d")
3706 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3707 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3708 (clobber (reg:CC 33))]
3713 [(set_attr "op_type" "RX,RXY")])
3715 (define_insn "addsi3"
3716 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3717 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3718 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3719 (clobber (reg:CC 33))]
3726 [(set_attr "op_type" "RR,RI,RX,RXY")])
3729 ; adddf3 instruction pattern(s).
3732 (define_expand "adddf3"
3734 [(set (match_operand:DF 0 "register_operand" "=f,f")
3735 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3736 (match_operand:DF 2 "general_operand" "f,R")))
3737 (clobber (reg:CC 33))])]
3741 (define_insn "*adddf3"
3742 [(set (match_operand:DF 0 "register_operand" "=f,f")
3743 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3744 (match_operand:DF 2 "general_operand" "f,R")))
3745 (clobber (reg:CC 33))]
3746 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3750 [(set_attr "op_type" "RRE,RXE")
3751 (set_attr "type" "fsimpd,fsimpd")])
3753 (define_insn "*adddf3_cc"
3755 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3756 (match_operand:DF 2 "general_operand" "f,R"))
3757 (match_operand:DF 3 "const0_operand" "")))
3758 (set (match_operand:DF 0 "register_operand" "=f,f")
3759 (plus:DF (match_dup 1) (match_dup 2)))]
3760 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3764 [(set_attr "op_type" "RRE,RXE")
3765 (set_attr "type" "fsimpd,fsimpd")])
3767 (define_insn "*adddf3_cconly"
3769 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3770 (match_operand:DF 2 "general_operand" "f,R"))
3771 (match_operand:DF 3 "const0_operand" "")))
3772 (clobber (match_scratch:DF 0 "=f,f"))]
3773 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3777 [(set_attr "op_type" "RRE,RXE")
3778 (set_attr "type" "fsimpd,fsimpd")])
3780 (define_insn "*adddf3_ibm"
3781 [(set (match_operand:DF 0 "register_operand" "=f,f")
3782 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3783 (match_operand:DF 2 "general_operand" "f,R")))
3784 (clobber (reg:CC 33))]
3785 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3789 [(set_attr "op_type" "RR,RX")
3790 (set_attr "type" "fsimpd,fsimpd")])
3793 ; addsf3 instruction pattern(s).
3796 (define_expand "addsf3"
3798 [(set (match_operand:SF 0 "register_operand" "=f,f")
3799 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3800 (match_operand:SF 2 "general_operand" "f,R")))
3801 (clobber (reg:CC 33))])]
3805 (define_insn "*addsf3"
3806 [(set (match_operand:SF 0 "register_operand" "=f,f")
3807 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3808 (match_operand:SF 2 "general_operand" "f,R")))
3809 (clobber (reg:CC 33))]
3810 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3814 [(set_attr "op_type" "RRE,RXE")
3815 (set_attr "type" "fsimps,fsimps")])
3817 (define_insn "*addsf3_cc"
3819 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3820 (match_operand:SF 2 "general_operand" "f,R"))
3821 (match_operand:SF 3 "const0_operand" "")))
3822 (set (match_operand:SF 0 "register_operand" "=f,f")
3823 (plus:SF (match_dup 1) (match_dup 2)))]
3824 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3828 [(set_attr "op_type" "RRE,RXE")
3829 (set_attr "type" "fsimps,fsimps")])
3831 (define_insn "*addsf3_cconly"
3833 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3834 (match_operand:SF 2 "general_operand" "f,R"))
3835 (match_operand:SF 3 "const0_operand" "")))
3836 (clobber (match_scratch:SF 0 "=f,f"))]
3837 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3841 [(set_attr "op_type" "RRE,RXE")
3842 (set_attr "type" "fsimps,fsimps")])
3844 (define_insn "*addsf3"
3845 [(set (match_operand:SF 0 "register_operand" "=f,f")
3846 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3847 (match_operand:SF 2 "general_operand" "f,R")))
3848 (clobber (reg:CC 33))]
3849 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3853 [(set_attr "op_type" "RR,RX")
3854 (set_attr "type" "fsimps,fsimps")])
3858 ;;- Subtract instructions.
3862 ; subti3 instruction pattern(s).
3865 (define_insn_and_split "subti3"
3866 [(set (match_operand:TI 0 "register_operand" "=&d")
3867 (minus:TI (match_operand:TI 1 "register_operand" "0")
3868 (match_operand:TI 2 "general_operand" "do") ) )
3869 (clobber (reg:CC 33))]
3872 "&& reload_completed"
3875 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
3877 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
3879 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
3880 (gtu:DI (reg:CCL2 33) (const_int 0))))
3881 (clobber (reg:CC 33))])]
3882 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3883 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3884 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3885 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3886 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3887 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
3888 [(set_attr "op_type" "NN")])
3891 ; subdi3 instruction pattern(s).
3894 (define_insn "*subdi3_sign"
3895 [(set (match_operand:DI 0 "register_operand" "=d,d")
3896 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3897 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3898 (clobber (reg:CC 33))]
3903 [(set_attr "op_type" "RRE,RXY")])
3905 (define_insn "*subdi3_zero_cc"
3907 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3908 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3910 (set (match_operand:DI 0 "register_operand" "=d,d")
3911 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3912 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3916 [(set_attr "op_type" "RRE,RXY")])
3918 (define_insn "*subdi3_zero_cconly"
3920 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3921 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3923 (clobber (match_scratch:DI 0 "=d,d"))]
3924 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3928 [(set_attr "op_type" "RRE,RXY")])
3930 (define_insn "*subdi3_zero"
3931 [(set (match_operand:DI 0 "register_operand" "=d,d")
3932 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3933 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3934 (clobber (reg:CC 33))]
3939 [(set_attr "op_type" "RRE,RXY")])
3941 (define_insn "*subdi3_borrow_cc"
3943 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3944 (match_operand:DI 2 "general_operand" "d,m"))
3946 (set (match_operand:DI 0 "register_operand" "=d,d")
3947 (minus:DI (match_dup 1) (match_dup 2)))]
3948 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3952 [(set_attr "op_type" "RRE,RXY")])
3954 (define_insn "*subdi3_borrow_cconly"
3956 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3957 (match_operand:DI 2 "general_operand" "d,m"))
3959 (clobber (match_scratch:DI 0 "=d,d"))]
3960 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3964 [(set_attr "op_type" "RRE,RXY")])
3966 (define_insn "*subdi3_cc"
3968 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3969 (match_operand:DI 2 "general_operand" "d,m"))
3971 (set (match_operand:DI 0 "register_operand" "=d,d")
3972 (minus:DI (match_dup 1) (match_dup 2)))]
3973 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3977 [(set_attr "op_type" "RRE,RXY")])
3979 (define_insn "*subdi3_cconly"
3981 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3982 (match_operand:DI 2 "general_operand" "d,m"))
3984 (clobber (match_scratch:DI 0 "=d,d"))]
3985 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3989 [(set_attr "op_type" "RRE,RXY")])
3991 (define_insn "*subdi3_64"
3992 [(set (match_operand:DI 0 "register_operand" "=d,d")
3993 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3994 (match_operand:DI 2 "general_operand" "d,m") ) )
3995 (clobber (reg:CC 33))]
4000 [(set_attr "op_type" "RRE,RRE")])
4002 (define_insn_and_split "*subdi3_31z"
4003 [(set (match_operand:DI 0 "register_operand" "=&d")
4004 (minus:DI (match_operand:DI 1 "register_operand" "0")
4005 (match_operand:DI 2 "general_operand" "do") ) )
4006 (clobber (reg:CC 33))]
4007 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4009 "&& reload_completed"
4012 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
4014 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
4016 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
4017 (gtu:SI (reg:CCL2 33) (const_int 0))))
4018 (clobber (reg:CC 33))])]
4019 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
4020 operands[4] = operand_subword (operands[1], 0, 0, DImode);
4021 operands[5] = operand_subword (operands[2], 0, 0, DImode);
4022 operands[6] = operand_subword (operands[0], 1, 0, DImode);
4023 operands[7] = operand_subword (operands[1], 1, 0, DImode);
4024 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
4025 [(set_attr "op_type" "NN")])
4027 (define_insn_and_split "*subdi3_31"
4028 [(set (match_operand:DI 0 "register_operand" "=&d")
4029 (minus:DI (match_operand:DI 1 "register_operand" "0")
4030 (match_operand:DI 2 "general_operand" "do") ) )
4031 (clobber (reg:CC 33))]
4034 "&& reload_completed"
4036 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
4037 (clobber (reg:CC 33))])
4040 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
4042 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
4044 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
4046 (label_ref (match_dup 9))))
4048 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
4049 (clobber (reg:CC 33))])
4051 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
4052 operands[4] = operand_subword (operands[1], 0, 0, DImode);
4053 operands[5] = operand_subword (operands[2], 0, 0, DImode);
4054 operands[6] = operand_subword (operands[0], 1, 0, DImode);
4055 operands[7] = operand_subword (operands[1], 1, 0, DImode);
4056 operands[8] = operand_subword (operands[2], 1, 0, DImode);
4057 operands[9] = gen_label_rtx ();"
4058 [(set_attr "op_type" "NN")])
4060 (define_expand "subdi3"
4062 [(set (match_operand:DI 0 "register_operand" "")
4063 (minus:DI (match_operand:DI 1 "register_operand" "")
4064 (match_operand:DI 2 "general_operand" "")))
4065 (clobber (reg:CC 33))])]
4070 ; subsi3 instruction pattern(s).
4073 (define_insn "*subsi3_borrow_cc"
4075 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4076 (match_operand:SI 2 "general_operand" "d,R,T"))
4078 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4079 (minus:SI (match_dup 1) (match_dup 2)))]
4080 "s390_match_ccmode (insn, CCL2mode)"
4085 [(set_attr "op_type" "RR,RX,RXY")])
4087 (define_insn "*subsi3_borrow_cconly"
4089 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4090 (match_operand:SI 2 "general_operand" "d,R,T"))
4092 (clobber (match_scratch:SI 0 "=d,d,d"))]
4093 "s390_match_ccmode (insn, CCL2mode)"
4098 [(set_attr "op_type" "RR,RX,RXY")])
4100 (define_insn "*subsi3_cc"
4102 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4103 (match_operand:SI 2 "general_operand" "d,R,T"))
4105 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4106 (minus:SI (match_dup 1) (match_dup 2)))]
4107 "s390_match_ccmode (insn, CCLmode)"
4112 [(set_attr "op_type" "RR,RX,RXY")])
4114 (define_insn "*subsi3_cconly"
4116 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4117 (match_operand:SI 2 "general_operand" "d,R,T"))
4119 (clobber (match_scratch:SI 0 "=d,d,d"))]
4120 "s390_match_ccmode (insn, CCLmode)"
4125 [(set_attr "op_type" "RR,RX,RXY")])
4127 (define_insn "*subsi3_sign"
4128 [(set (match_operand:SI 0 "register_operand" "=d,d")
4129 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
4130 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4131 (clobber (reg:CC 33))]
4136 [(set_attr "op_type" "RX,RXY")])
4138 (define_insn "subsi3"
4139 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4140 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4141 (match_operand:SI 2 "general_operand" "d,R,T")))
4142 (clobber (reg:CC 33))]
4148 [(set_attr "op_type" "RR,RX,RXY")])
4152 ; subdf3 instruction pattern(s).
4155 (define_expand "subdf3"
4157 [(set (match_operand:DF 0 "register_operand" "=f,f")
4158 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4159 (match_operand:DF 2 "general_operand" "f,R")))
4160 (clobber (reg:CC 33))])]
4164 (define_insn "*subdf3"
4165 [(set (match_operand:DF 0 "register_operand" "=f,f")
4166 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4167 (match_operand:DF 2 "general_operand" "f,R")))
4168 (clobber (reg:CC 33))]
4169 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4173 [(set_attr "op_type" "RRE,RXE")
4174 (set_attr "type" "fsimpd,fsimpd")])
4176 (define_insn "*subdf3_cc"
4178 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4179 (match_operand:DF 2 "general_operand" "f,R"))
4180 (match_operand:DF 3 "const0_operand" "")))
4181 (set (match_operand:DF 0 "register_operand" "=f,f")
4182 (plus:DF (match_dup 1) (match_dup 2)))]
4183 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4187 [(set_attr "op_type" "RRE,RXE")
4188 (set_attr "type" "fsimpd,fsimpd")])
4190 (define_insn "*subdf3_cconly"
4192 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4193 (match_operand:DF 2 "general_operand" "f,R"))
4194 (match_operand:DF 3 "const0_operand" "")))
4195 (clobber (match_scratch:DF 0 "=f,f"))]
4196 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4200 [(set_attr "op_type" "RRE,RXE")
4201 (set_attr "type" "fsimpd,fsimpd")])
4203 (define_insn "*subdf3_ibm"
4204 [(set (match_operand:DF 0 "register_operand" "=f,f")
4205 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4206 (match_operand:DF 2 "general_operand" "f,R")))
4207 (clobber (reg:CC 33))]
4208 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4212 [(set_attr "op_type" "RR,RX")
4213 (set_attr "type" "fsimpd,fsimpd")])
4216 ; subsf3 instruction pattern(s).
4219 (define_expand "subsf3"
4221 [(set (match_operand:SF 0 "register_operand" "=f,f")
4222 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4223 (match_operand:SF 2 "general_operand" "f,R")))
4224 (clobber (reg:CC 33))])]
4228 (define_insn "*subsf3"
4229 [(set (match_operand:SF 0 "register_operand" "=f,f")
4230 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4231 (match_operand:SF 2 "general_operand" "f,R")))
4232 (clobber (reg:CC 33))]
4233 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4237 [(set_attr "op_type" "RRE,RXE")
4238 (set_attr "type" "fsimps,fsimps")])
4240 (define_insn "*subsf3_cc"
4242 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4243 (match_operand:SF 2 "general_operand" "f,R"))
4244 (match_operand:SF 3 "const0_operand" "")))
4245 (set (match_operand:SF 0 "register_operand" "=f,f")
4246 (minus:SF (match_dup 1) (match_dup 2)))]
4247 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4251 [(set_attr "op_type" "RRE,RXE")
4252 (set_attr "type" "fsimps,fsimps")])
4254 (define_insn "*subsf3_cconly"
4256 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4257 (match_operand:SF 2 "general_operand" "f,R"))
4258 (match_operand:SF 3 "const0_operand" "")))
4259 (clobber (match_scratch:SF 0 "=f,f"))]
4260 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4264 [(set_attr "op_type" "RRE,RXE")
4265 (set_attr "type" "fsimps,fsimps")])
4267 (define_insn "*subsf3_ibm"
4268 [(set (match_operand:SF 0 "register_operand" "=f,f")
4269 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4270 (match_operand:SF 2 "general_operand" "f,R")))
4271 (clobber (reg:CC 33))]
4272 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4276 [(set_attr "op_type" "RR,RX")
4277 (set_attr "type" "fsimps,fsimps")])
4281 ;;- Conditional add/subtract instructions.
4285 ; adddicc instruction pattern(s).
4288 (define_insn "*adddi3_alc_cc"
4291 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4292 (match_operand:DI 2 "general_operand" "d,m"))
4293 (match_operand:DI 3 "s390_alc_comparison" ""))
4295 (set (match_operand:DI 0 "register_operand" "=d,d")
4296 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4297 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4301 [(set_attr "op_type" "RRE,RXY")])
4303 (define_insn "*adddi3_alc"
4304 [(set (match_operand:DI 0 "register_operand" "=d,d")
4305 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4306 (match_operand:DI 2 "general_operand" "d,m"))
4307 (match_operand:DI 3 "s390_alc_comparison" "")))
4308 (clobber (reg:CC 33))]
4313 [(set_attr "op_type" "RRE,RXY")])
4315 (define_insn "*subdi3_slb_cc"
4318 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4319 (match_operand:DI 2 "general_operand" "d,m"))
4320 (match_operand:DI 3 "s390_slb_comparison" ""))
4322 (set (match_operand:DI 0 "register_operand" "=d,d")
4323 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4324 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4328 [(set_attr "op_type" "RRE,RXY")])
4330 (define_insn "*subdi3_slb"
4331 [(set (match_operand:DI 0 "register_operand" "=d,d")
4332 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4333 (match_operand:DI 2 "general_operand" "d,m"))
4334 (match_operand:DI 3 "s390_slb_comparison" "")))
4335 (clobber (reg:CC 33))]
4340 [(set_attr "op_type" "RRE,RXY")])
4343 ; addsicc instruction pattern(s).
4346 (define_insn "*addsi3_alc_cc"
4349 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4350 (match_operand:SI 2 "general_operand" "d,m"))
4351 (match_operand:SI 3 "s390_alc_comparison" ""))
4353 (set (match_operand:SI 0 "register_operand" "=d,d")
4354 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4355 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4359 [(set_attr "op_type" "RRE,RXY")])
4361 (define_insn "*addsi3_alc"
4362 [(set (match_operand:SI 0 "register_operand" "=d,d")
4363 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4364 (match_operand:SI 2 "general_operand" "d,m"))
4365 (match_operand:SI 3 "s390_alc_comparison" "")))
4366 (clobber (reg:CC 33))]
4371 [(set_attr "op_type" "RRE,RXY")])
4373 (define_insn "*subsi3_slb_cc"
4376 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4377 (match_operand:SI 2 "general_operand" "d,m"))
4378 (match_operand:SI 3 "s390_slb_comparison" ""))
4380 (set (match_operand:SI 0 "register_operand" "=d,d")
4381 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4382 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4386 [(set_attr "op_type" "RRE,RXY")])
4388 (define_insn "*subsi3_slb"
4389 [(set (match_operand:SI 0 "register_operand" "=d,d")
4390 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4391 (match_operand:SI 2 "general_operand" "d,m"))
4392 (match_operand:SI 3 "s390_slb_comparison" "")))
4393 (clobber (reg:CC 33))]
4398 [(set_attr "op_type" "RRE,RXY")])
4402 ;;- Multiply instructions.
4406 ; muldi3 instruction pattern(s).
4409 (define_insn "*muldi3_sign"
4410 [(set (match_operand:DI 0 "register_operand" "=d,d")
4411 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4412 (match_operand:DI 1 "register_operand" "0,0")))]
4417 [(set_attr "op_type" "RRE,RXY")
4418 (set_attr "type" "imul")])
4420 (define_insn "muldi3"
4421 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4422 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4423 (match_operand:DI 2 "general_operand" "d,K,m")))]
4429 [(set_attr "op_type" "RRE,RI,RXY")
4430 (set_attr "type" "imul")])
4433 ; mulsi3 instruction pattern(s).
4436 (define_insn "*mulsi3_sign"
4437 [(set (match_operand:SI 0 "register_operand" "=d")
4438 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4439 (match_operand:SI 1 "register_operand" "0")))]
4442 [(set_attr "op_type" "RX")
4443 (set_attr "type" "imul")])
4445 (define_insn "mulsi3"
4446 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4447 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4448 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4455 [(set_attr "op_type" "RRE,RI,RX,RXY")
4456 (set_attr "type" "imul")])
4459 ; mulsidi3 instruction pattern(s).
4462 (define_insn "mulsidi3"
4463 [(set (match_operand:DI 0 "register_operand" "=d,d")
4464 (mult:DI (sign_extend:DI
4465 (match_operand:SI 1 "register_operand" "%0,0"))
4467 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4472 [(set_attr "op_type" "RR,RX")
4473 (set_attr "type" "imul")])
4476 ; umulsidi3 instruction pattern(s).
4479 (define_insn "umulsidi3"
4480 [(set (match_operand:DI 0 "register_operand" "=d,d")
4481 (mult:DI (zero_extend:DI
4482 (match_operand:SI 1 "register_operand" "%0,0"))
4484 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4485 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4489 [(set_attr "op_type" "RRE,RXY")
4490 (set_attr "type" "imul")])
4493 ; muldf3 instruction pattern(s).
4496 (define_expand "muldf3"
4497 [(set (match_operand:DF 0 "register_operand" "=f,f")
4498 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4499 (match_operand:DF 2 "general_operand" "f,R")))]
4503 (define_insn "*muldf3"
4504 [(set (match_operand:DF 0 "register_operand" "=f,f")
4505 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4506 (match_operand:DF 2 "general_operand" "f,R")))]
4507 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4511 [(set_attr "op_type" "RRE,RXE")
4512 (set_attr "type" "fmuld")])
4514 (define_insn "*muldf3_ibm"
4515 [(set (match_operand:DF 0 "register_operand" "=f,f")
4516 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4517 (match_operand:DF 2 "general_operand" "f,R")))]
4518 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4522 [(set_attr "op_type" "RR,RX")
4523 (set_attr "type" "fmuld")])
4525 (define_insn "*fmadddf"
4526 [(set (match_operand:DF 0 "register_operand" "=f,f")
4527 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4528 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4529 (match_operand:DF 3 "register_operand" "0,0")))]
4530 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4534 [(set_attr "op_type" "RRE,RXE")
4535 (set_attr "type" "fmuld")])
4537 (define_insn "*fmsubdf"
4538 [(set (match_operand:DF 0 "register_operand" "=f,f")
4539 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4540 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4541 (match_operand:DF 3 "register_operand" "0,0")))]
4542 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4546 [(set_attr "op_type" "RRE,RXE")
4547 (set_attr "type" "fmuld")])
4550 ; mulsf3 instruction pattern(s).
4553 (define_expand "mulsf3"
4554 [(set (match_operand:SF 0 "register_operand" "=f,f")
4555 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4556 (match_operand:SF 2 "general_operand" "f,R")))]
4560 (define_insn "*mulsf3"
4561 [(set (match_operand:SF 0 "register_operand" "=f,f")
4562 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4563 (match_operand:SF 2 "general_operand" "f,R")))]
4564 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4568 [(set_attr "op_type" "RRE,RXE")
4569 (set_attr "type" "fmuls")])
4571 (define_insn "*mulsf3_ibm"
4572 [(set (match_operand:SF 0 "register_operand" "=f,f")
4573 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4574 (match_operand:SF 2 "general_operand" "f,R")))]
4575 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4579 [(set_attr "op_type" "RR,RX")
4580 (set_attr "type" "fmuls")])
4582 (define_insn "*fmaddsf"
4583 [(set (match_operand:SF 0 "register_operand" "=f,f")
4584 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4585 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4586 (match_operand:SF 3 "register_operand" "0,0")))]
4587 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4591 [(set_attr "op_type" "RRE,RXE")
4592 (set_attr "type" "fmuls")])
4594 (define_insn "*fmsubsf"
4595 [(set (match_operand:SF 0 "register_operand" "=f,f")
4596 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4597 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4598 (match_operand:SF 3 "register_operand" "0,0")))]
4599 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4603 [(set_attr "op_type" "RRE,RXE")
4604 (set_attr "type" "fmuls")])
4607 ;;- Divide and modulo instructions.
4611 ; divmoddi4 instruction pattern(s).
4614 (define_expand "divmoddi4"
4615 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4616 (div:DI (match_operand:DI 1 "register_operand" "")
4617 (match_operand:DI 2 "general_operand" "")))
4618 (set (match_operand:DI 3 "general_operand" "")
4619 (mod:DI (match_dup 1) (match_dup 2)))])
4620 (clobber (match_dup 4))]
4623 rtx insn, div_equal, mod_equal;
4625 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4626 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4628 operands[4] = gen_reg_rtx(TImode);
4629 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4631 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4633 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4635 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4637 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4642 (define_insn "divmodtidi3"
4643 [(set (match_operand:TI 0 "register_operand" "=d,d")
4647 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4648 (match_operand:DI 2 "general_operand" "d,m")))
4650 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
4655 [(set_attr "op_type" "RRE,RXY")
4656 (set_attr "type" "idiv")])
4658 (define_insn "divmodtisi3"
4659 [(set (match_operand:TI 0 "register_operand" "=d,d")
4663 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4665 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4668 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
4673 [(set_attr "op_type" "RRE,RXY")
4674 (set_attr "type" "idiv")])
4677 ; udivmoddi4 instruction pattern(s).
4680 (define_expand "udivmoddi4"
4681 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4682 (udiv:DI (match_operand:DI 1 "general_operand" "")
4683 (match_operand:DI 2 "nonimmediate_operand" "")))
4684 (set (match_operand:DI 3 "general_operand" "")
4685 (umod:DI (match_dup 1) (match_dup 2)))])
4686 (clobber (match_dup 4))]
4689 rtx insn, div_equal, mod_equal, equal;
4691 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4692 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4693 equal = gen_rtx_IOR (TImode,
4694 gen_rtx_ASHIFT (TImode,
4695 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4697 gen_rtx_ZERO_EXTEND (TImode, div_equal));
4699 operands[4] = gen_reg_rtx(TImode);
4700 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4701 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4702 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4703 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4705 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4707 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4709 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4711 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4713 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4718 (define_insn "udivmodtidi3"
4719 [(set (match_operand:TI 0 "register_operand" "=d,d")
4724 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
4726 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4730 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
4735 [(set_attr "op_type" "RRE,RXY")
4736 (set_attr "type" "idiv")])
4739 ; divmodsi4 instruction pattern(s).
4742 (define_expand "divmodsi4"
4743 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4744 (div:SI (match_operand:SI 1 "general_operand" "")
4745 (match_operand:SI 2 "nonimmediate_operand" "")))
4746 (set (match_operand:SI 3 "general_operand" "")
4747 (mod:SI (match_dup 1) (match_dup 2)))])
4748 (clobber (match_dup 4))]
4751 rtx insn, div_equal, mod_equal, equal;
4753 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4754 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4755 equal = gen_rtx_IOR (DImode,
4756 gen_rtx_ASHIFT (DImode,
4757 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4759 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4761 operands[4] = gen_reg_rtx(DImode);
4762 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4763 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4765 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4767 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4769 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4771 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4773 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4778 (define_insn "divmoddisi3"
4779 [(set (match_operand:DI 0 "register_operand" "=d,d")
4784 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4786 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4790 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
4795 [(set_attr "op_type" "RR,RX")
4796 (set_attr "type" "idiv")])
4799 ; udivsi3 and umodsi3 instruction pattern(s).
4802 (define_expand "udivmodsi4"
4803 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4804 (udiv:SI (match_operand:SI 1 "general_operand" "")
4805 (match_operand:SI 2 "nonimmediate_operand" "")))
4806 (set (match_operand:SI 3 "general_operand" "")
4807 (umod:SI (match_dup 1) (match_dup 2)))])
4808 (clobber (match_dup 4))]
4809 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4811 rtx insn, div_equal, mod_equal, equal;
4813 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4814 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4815 equal = gen_rtx_IOR (DImode,
4816 gen_rtx_ASHIFT (DImode,
4817 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4819 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4821 operands[4] = gen_reg_rtx(DImode);
4822 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4823 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4824 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4825 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4827 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4829 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4831 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4833 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4835 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4840 (define_insn "udivmoddisi3"
4841 [(set (match_operand:DI 0 "register_operand" "=d,d")
4846 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
4848 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4852 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
4853 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4857 [(set_attr "op_type" "RRE,RXY")
4858 (set_attr "type" "idiv")])
4860 (define_expand "udivsi3"
4861 [(set (match_operand:SI 0 "register_operand" "=d")
4862 (udiv:SI (match_operand:SI 1 "general_operand" "")
4863 (match_operand:SI 2 "general_operand" "")))
4864 (clobber (match_dup 3))]
4865 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4867 rtx insn, udiv_equal, umod_equal, equal;
4869 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4870 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4871 equal = gen_rtx_IOR (DImode,
4872 gen_rtx_ASHIFT (DImode,
4873 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4875 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4877 operands[3] = gen_reg_rtx (DImode);
4879 if (CONSTANT_P (operands[2]))
4881 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4883 rtx label1 = gen_label_rtx ();
4885 operands[1] = make_safe_from (operands[1], operands[0]);
4886 emit_move_insn (operands[0], const0_rtx);
4887 emit_insn (gen_cmpsi (operands[1], operands[2]));
4888 emit_jump_insn (gen_bltu (label1));
4889 emit_move_insn (operands[0], const1_rtx);
4890 emit_label (label1);
4894 operands[2] = force_reg (SImode, operands[2]);
4895 operands[2] = make_safe_from (operands[2], operands[0]);
4897 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4898 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4901 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4903 insn = emit_move_insn (operands[0],
4904 gen_lowpart (SImode, operands[3]));
4906 gen_rtx_EXPR_LIST (REG_EQUAL,
4907 udiv_equal, REG_NOTES (insn));
4912 rtx label1 = gen_label_rtx ();
4913 rtx label2 = gen_label_rtx ();
4914 rtx label3 = gen_label_rtx ();
4916 operands[1] = force_reg (SImode, operands[1]);
4917 operands[1] = make_safe_from (operands[1], operands[0]);
4918 operands[2] = force_reg (SImode, operands[2]);
4919 operands[2] = make_safe_from (operands[2], operands[0]);
4921 emit_move_insn (operands[0], const0_rtx);
4922 emit_insn (gen_cmpsi (operands[2], operands[1]));
4923 emit_jump_insn (gen_bgtu (label3));
4924 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4925 emit_jump_insn (gen_blt (label2));
4926 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4927 emit_jump_insn (gen_beq (label1));
4928 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4929 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4932 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4934 insn = emit_move_insn (operands[0],
4935 gen_lowpart (SImode, operands[3]));
4937 gen_rtx_EXPR_LIST (REG_EQUAL,
4938 udiv_equal, REG_NOTES (insn));
4940 emit_label (label1);
4941 emit_move_insn (operands[0], operands[1]);
4943 emit_label (label2);
4944 emit_move_insn (operands[0], const1_rtx);
4945 emit_label (label3);
4947 emit_move_insn (operands[0], operands[0]);
4951 (define_expand "umodsi3"
4952 [(set (match_operand:SI 0 "register_operand" "=d")
4953 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4954 (match_operand:SI 2 "nonimmediate_operand" "")))
4955 (clobber (match_dup 3))]
4956 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4958 rtx insn, udiv_equal, umod_equal, equal;
4960 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4961 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4962 equal = gen_rtx_IOR (DImode,
4963 gen_rtx_ASHIFT (DImode,
4964 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4966 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4968 operands[3] = gen_reg_rtx (DImode);
4970 if (CONSTANT_P (operands[2]))
4972 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4974 rtx label1 = gen_label_rtx ();
4976 operands[1] = make_safe_from (operands[1], operands[0]);
4977 emit_move_insn (operands[0], operands[1]);
4978 emit_insn (gen_cmpsi (operands[0], operands[2]));
4979 emit_jump_insn (gen_bltu (label1));
4980 emit_insn (gen_abssi2 (operands[0], operands[2]));
4981 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4982 emit_label (label1);
4986 operands[2] = force_reg (SImode, operands[2]);
4987 operands[2] = make_safe_from (operands[2], operands[0]);
4989 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4990 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4993 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4995 insn = emit_move_insn (operands[0],
4996 gen_highpart (SImode, operands[3]));
4998 gen_rtx_EXPR_LIST (REG_EQUAL,
4999 umod_equal, REG_NOTES (insn));
5004 rtx label1 = gen_label_rtx ();
5005 rtx label2 = gen_label_rtx ();
5006 rtx label3 = gen_label_rtx ();
5008 operands[1] = force_reg (SImode, operands[1]);
5009 operands[1] = make_safe_from (operands[1], operands[0]);
5010 operands[2] = force_reg (SImode, operands[2]);
5011 operands[2] = make_safe_from (operands[2], operands[0]);
5013 emit_move_insn(operands[0], operands[1]);
5014 emit_insn (gen_cmpsi (operands[2], operands[1]));
5015 emit_jump_insn (gen_bgtu (label3));
5016 emit_insn (gen_cmpsi (operands[2], const1_rtx));
5017 emit_jump_insn (gen_blt (label2));
5018 emit_insn (gen_cmpsi (operands[2], const1_rtx));
5019 emit_jump_insn (gen_beq (label1));
5020 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5021 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5024 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5026 insn = emit_move_insn (operands[0],
5027 gen_highpart (SImode, operands[3]));
5029 gen_rtx_EXPR_LIST (REG_EQUAL,
5030 umod_equal, REG_NOTES (insn));
5032 emit_label (label1);
5033 emit_move_insn (operands[0], const0_rtx);
5035 emit_label (label2);
5036 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
5037 emit_label (label3);
5043 ; divdf3 instruction pattern(s).
5046 (define_expand "divdf3"
5047 [(set (match_operand:DF 0 "register_operand" "=f,f")
5048 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5049 (match_operand:DF 2 "general_operand" "f,R")))]
5053 (define_insn "*divdf3"
5054 [(set (match_operand:DF 0 "register_operand" "=f,f")
5055 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5056 (match_operand:DF 2 "general_operand" "f,R")))]
5057 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5061 [(set_attr "op_type" "RRE,RXE")
5062 (set_attr "type" "fdivd")])
5064 (define_insn "*divdf3_ibm"
5065 [(set (match_operand:DF 0 "register_operand" "=f,f")
5066 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5067 (match_operand:DF 2 "general_operand" "f,R")))]
5068 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5072 [(set_attr "op_type" "RR,RX")
5073 (set_attr "type" "fdivd")])
5076 ; divsf3 instruction pattern(s).
5079 (define_expand "divsf3"
5080 [(set (match_operand:SF 0 "register_operand" "=f,f")
5081 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5082 (match_operand:SF 2 "general_operand" "f,R")))]
5086 (define_insn "*divsf3"
5087 [(set (match_operand:SF 0 "register_operand" "=f,f")
5088 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5089 (match_operand:SF 2 "general_operand" "f,R")))]
5090 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5094 [(set_attr "op_type" "RRE,RXE")
5095 (set_attr "type" "fdivs")])
5097 (define_insn "*divsf3"
5098 [(set (match_operand:SF 0 "register_operand" "=f,f")
5099 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5100 (match_operand:SF 2 "general_operand" "f,R")))]
5101 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5105 [(set_attr "op_type" "RR,RX")
5106 (set_attr "type" "fdivs")])
5110 ;;- And instructions.
5114 ; anddi3 instruction pattern(s).
5117 (define_insn "*anddi3_cc"
5119 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5120 (match_operand:DI 2 "general_operand" "d,m"))
5122 (set (match_operand:DI 0 "register_operand" "=d,d")
5123 (and:DI (match_dup 1) (match_dup 2)))]
5124 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5128 [(set_attr "op_type" "RRE,RXY")])
5130 (define_insn "*anddi3_cconly"
5132 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5133 (match_operand:DI 2 "general_operand" "d,m"))
5135 (clobber (match_scratch:DI 0 "=d,d"))]
5136 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5140 [(set_attr "op_type" "RRE,RXY")])
5142 (define_insn "anddi3"
5143 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d,d,d")
5144 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o,0,0,0,0,0,0")
5145 (match_operand:DI 2 "general_operand"
5146 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m")))
5147 (clobber (reg:CC 33))]
5158 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY")])
5160 (define_insn "*anddi3_ss"
5161 [(set (match_operand:DI 0 "s_operand" "=Q")
5162 (and:DI (match_dup 0)
5163 (match_operand:DI 1 "s_imm_operand" "Q")))
5164 (clobber (reg:CC 33))]
5167 [(set_attr "op_type" "SS")])
5169 (define_insn "*anddi3_ss_inv"
5170 [(set (match_operand:DI 0 "s_operand" "=Q")
5171 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5173 (clobber (reg:CC 33))]
5176 [(set_attr "op_type" "SS")])
5179 ; andsi3 instruction pattern(s).
5182 (define_insn "*andsi3_cc"
5184 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5185 (match_operand:SI 2 "general_operand" "d,R,T"))
5187 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5188 (and:SI (match_dup 1) (match_dup 2)))]
5189 "s390_match_ccmode(insn, CCTmode)"
5194 [(set_attr "op_type" "RR,RX,RXY")])
5196 (define_insn "*andsi3_cconly"
5198 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5199 (match_operand:SI 2 "general_operand" "d,R,T"))
5201 (clobber (match_scratch:SI 0 "=d,d,d"))]
5202 "s390_match_ccmode(insn, CCTmode)"
5207 [(set_attr "op_type" "RR,RX,RXY")])
5209 (define_expand "andsi3"
5211 [(set (match_operand:SI 0 "register_operand" "")
5212 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
5213 (match_operand:SI 2 "general_operand" "")))
5214 (clobber (reg:CC 33))])]
5218 (define_insn "*andsi3_zarch"
5219 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d,d,d")
5220 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,o,0,0,0,0,0")
5221 (match_operand:SI 2 "general_operand" "M,M,N0HSF,N1HSF,d,R,T")))
5222 (clobber (reg:CC 33))]
5232 [(set_attr "op_type" "RRE,RXE,RI,RI,RR,RX,RXY")])
5234 (define_insn "*andsi3_esa"
5235 [(set (match_operand:SI 0 "register_operand" "=d,d")
5236 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5237 (match_operand:SI 2 "general_operand" "d,R")))
5238 (clobber (reg:CC 33))]
5243 [(set_attr "op_type" "RR,RX")])
5245 (define_insn "*andsi3_ss"
5246 [(set (match_operand:SI 0 "s_operand" "=Q")
5247 (and:SI (match_dup 0)
5248 (match_operand:SI 1 "s_imm_operand" "Q")))
5249 (clobber (reg:CC 33))]
5252 [(set_attr "op_type" "SS")])
5254 (define_insn "*andsi3_ss_inv"
5255 [(set (match_operand:SI 0 "s_operand" "=Q")
5256 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5258 (clobber (reg:CC 33))]
5261 [(set_attr "op_type" "SS")])
5264 ; andhi3 instruction pattern(s).
5267 (define_insn "*andhi3_ni"
5268 [(set (match_operand:HI 0 "register_operand" "=d,d")
5269 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5270 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5271 (clobber (reg:CC 33))]
5276 [(set_attr "op_type" "RR,RI")])
5278 (define_insn "andhi3"
5279 [(set (match_operand:HI 0 "register_operand" "=d")
5280 (and:HI (match_operand:HI 1 "register_operand" "%0")
5281 (match_operand:HI 2 "nonmemory_operand" "d")))
5282 (clobber (reg:CC 33))]
5285 [(set_attr "op_type" "RR")])
5287 (define_insn "*andhi3_ss"
5288 [(set (match_operand:HI 0 "s_operand" "=Q")
5289 (and:HI (match_dup 0)
5290 (match_operand:HI 1 "s_imm_operand" "Q")))
5291 (clobber (reg:CC 33))]
5294 [(set_attr "op_type" "SS")])
5296 (define_insn "*andhi3_ss_inv"
5297 [(set (match_operand:HI 0 "s_operand" "=Q")
5298 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5300 (clobber (reg:CC 33))]
5303 [(set_attr "op_type" "SS")])
5306 ; andqi3 instruction pattern(s).
5309 (define_insn "*andqi3_ni"
5310 [(set (match_operand:QI 0 "register_operand" "=d,d")
5311 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5312 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5313 (clobber (reg:CC 33))]
5318 [(set_attr "op_type" "RR,RI")])
5320 (define_insn "andqi3"
5321 [(set (match_operand:QI 0 "register_operand" "=d")
5322 (and:QI (match_operand:QI 1 "register_operand" "%0")
5323 (match_operand:QI 2 "nonmemory_operand" "d")))
5324 (clobber (reg:CC 33))]
5327 [(set_attr "op_type" "RR")])
5329 (define_insn "*andqi3_ss"
5330 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5331 (and:QI (match_dup 0)
5332 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5333 (clobber (reg:CC 33))]
5339 [(set_attr "op_type" "SI,SIY,SS")])
5341 (define_insn "*andqi3_ss_inv"
5342 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5343 (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5345 (clobber (reg:CC 33))]
5351 [(set_attr "op_type" "SI,SIY,SS")])
5355 ;;- Bit set (inclusive or) instructions.
5359 ; iordi3 instruction pattern(s).
5362 (define_insn "*iordi3_cc"
5364 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5365 (match_operand:DI 2 "general_operand" "d,m"))
5367 (set (match_operand:DI 0 "register_operand" "=d,d")
5368 (ior:DI (match_dup 1) (match_dup 2)))]
5369 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5373 [(set_attr "op_type" "RRE,RXY")])
5375 (define_insn "*iordi3_cconly"
5377 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5378 (match_operand:DI 2 "general_operand" "d,m"))
5380 (clobber (match_scratch:DI 0 "=d,d"))]
5381 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5385 [(set_attr "op_type" "RRE,RXY")])
5387 (define_insn "iordi3"
5388 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d")
5389 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,0,0,0,0")
5390 (match_operand:DI 2 "general_operand" "N0HD0,N1HD0,N2HD0,N3HD0,d,m")))
5391 (clobber (reg:CC 33))]
5400 [(set_attr "op_type" "RI,RI,RI,RI,RRE,RXY")])
5402 (define_insn "*iordi3_ss"
5403 [(set (match_operand:DI 0 "s_operand" "=Q")
5404 (ior:DI (match_dup 0)
5405 (match_operand:DI 1 "s_imm_operand" "Q")))
5406 (clobber (reg:CC 33))]
5409 [(set_attr "op_type" "SS")])
5411 (define_insn "*iordi3_ss_inv"
5412 [(set (match_operand:DI 0 "s_operand" "=Q")
5413 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5415 (clobber (reg:CC 33))]
5418 [(set_attr "op_type" "SS")])
5421 ; iorsi3 instruction pattern(s).
5424 (define_insn "*iorsi3_cc"
5426 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5427 (match_operand:SI 2 "general_operand" "d,R,T"))
5429 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5430 (ior:SI (match_dup 1) (match_dup 2)))]
5431 "s390_match_ccmode(insn, CCTmode)"
5436 [(set_attr "op_type" "RR,RX,RXY")])
5438 (define_insn "*iorsi3_cconly"
5440 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5441 (match_operand:SI 2 "general_operand" "d,R,T"))
5443 (clobber (match_scratch:SI 0 "=d,d,d"))]
5444 "s390_match_ccmode(insn, CCTmode)"
5449 [(set_attr "op_type" "RR,RX,RXY")])
5451 (define_expand "iorsi3"
5453 [(set (match_operand:SI 0 "register_operand" "")
5454 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
5455 (match_operand:SI 2 "general_operand" "")))
5456 (clobber (reg:CC 33))])]
5460 (define_insn "iorsi3_zarch"
5461 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
5462 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0,0")
5463 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,d,R,T")))
5464 (clobber (reg:CC 33))]
5472 [(set_attr "op_type" "RI,RI,RR,RX,RXY")])
5474 (define_insn "iorsi3_esa"
5475 [(set (match_operand:SI 0 "register_operand" "=d,d")
5476 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
5477 (match_operand:SI 2 "general_operand" "d,R")))
5478 (clobber (reg:CC 33))]
5483 [(set_attr "op_type" "RR,RX")])
5485 (define_insn "*iorsi3_ss"
5486 [(set (match_operand:SI 0 "s_operand" "=Q")
5487 (ior:SI (match_dup 0)
5488 (match_operand:SI 1 "s_imm_operand" "Q")))
5489 (clobber (reg:CC 33))]
5492 [(set_attr "op_type" "SS")])
5494 (define_insn "*iorsi3_ss_inv"
5495 [(set (match_operand:SI 0 "s_operand" "=Q")
5496 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5498 (clobber (reg:CC 33))]
5501 [(set_attr "op_type" "SS")])
5504 ; iorhi3 instruction pattern(s).
5507 (define_insn "*iorhi3_oi"
5508 [(set (match_operand:HI 0 "register_operand" "=d,d")
5509 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5510 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5511 (clobber (reg:CC 33))]
5516 [(set_attr "op_type" "RR,RI")])
5518 (define_insn "iorhi3"
5519 [(set (match_operand:HI 0 "register_operand" "=d")
5520 (ior:HI (match_operand:HI 1 "register_operand" "%0")
5521 (match_operand:HI 2 "nonmemory_operand" "d")))
5522 (clobber (reg:CC 33))]
5525 [(set_attr "op_type" "RR")])
5527 (define_insn "*iorhi3_ss"
5528 [(set (match_operand:HI 0 "s_operand" "=Q")
5529 (ior:HI (match_dup 0)
5530 (match_operand:HI 1 "s_imm_operand" "Q")))
5531 (clobber (reg:CC 33))]
5534 [(set_attr "op_type" "SS")])
5536 (define_insn "*iorhi3_ss_inv"
5537 [(set (match_operand:HI 0 "s_operand" "=Q")
5538 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5540 (clobber (reg:CC 33))]
5543 [(set_attr "op_type" "SS")])
5546 ; iorqi3 instruction pattern(s).
5549 (define_insn "*iorqi3_oi"
5550 [(set (match_operand:QI 0 "register_operand" "=d,d")
5551 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5552 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5553 (clobber (reg:CC 33))]
5558 [(set_attr "op_type" "RR,RI")])
5560 (define_insn "iorqi3"
5561 [(set (match_operand:QI 0 "register_operand" "=d")
5562 (ior:QI (match_operand:QI 1 "register_operand" "%0")
5563 (match_operand:QI 2 "nonmemory_operand" "d")))
5564 (clobber (reg:CC 33))]
5567 [(set_attr "op_type" "RR")])
5569 (define_insn "*iorqi3_ss"
5570 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5571 (ior:QI (match_dup 0)
5572 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5573 (clobber (reg:CC 33))]
5579 [(set_attr "op_type" "SI,SIY,SS")])
5581 (define_insn "*iorqi3_ss_inv"
5582 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5583 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5585 (clobber (reg:CC 33))]
5591 [(set_attr "op_type" "SI,SIY,SS")])
5595 ;;- Xor instructions.
5599 ; xordi3 instruction pattern(s).
5602 (define_insn "*xordi3_cc"
5604 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5605 (match_operand:DI 2 "general_operand" "d,m"))
5607 (set (match_operand:DI 0 "register_operand" "=d,d")
5608 (xor:DI (match_dup 1) (match_dup 2)))]
5609 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5613 [(set_attr "op_type" "RRE,RXY")])
5615 (define_insn "*xordi3_cconly"
5617 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5618 (match_operand:DI 2 "general_operand" "d,m"))
5620 (clobber (match_scratch:DI 0 "=d,d"))]
5621 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5625 [(set_attr "op_type" "RRE,RXY")])
5627 (define_insn "xordi3"
5628 [(set (match_operand:DI 0 "register_operand" "=d,d")
5629 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5630 (match_operand:DI 2 "general_operand" "d,m")))
5631 (clobber (reg:CC 33))]
5636 [(set_attr "op_type" "RRE,RXY")])
5638 (define_insn "*xordi3_ss"
5639 [(set (match_operand:DI 0 "s_operand" "=Q")
5640 (xor:DI (match_dup 0)
5641 (match_operand:DI 1 "s_imm_operand" "Q")))
5642 (clobber (reg:CC 33))]
5645 [(set_attr "op_type" "SS")])
5647 (define_insn "*xordi3_ss_inv"
5648 [(set (match_operand:DI 0 "s_operand" "=Q")
5649 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5651 (clobber (reg:CC 33))]
5654 [(set_attr "op_type" "SS")])
5657 ; xorsi3 instruction pattern(s).
5660 (define_insn "*xorsi3_cc"
5662 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5663 (match_operand:SI 2 "general_operand" "d,R,T"))
5665 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5666 (xor:SI (match_dup 1) (match_dup 2)))]
5667 "s390_match_ccmode(insn, CCTmode)"
5672 [(set_attr "op_type" "RR,RX,RXY")])
5674 (define_insn "*xorsi3_cconly"
5676 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5677 (match_operand:SI 2 "general_operand" "d,R,T"))
5679 (clobber (match_scratch:SI 0 "=d,d,d"))]
5680 "s390_match_ccmode(insn, CCTmode)"
5685 [(set_attr "op_type" "RR,RX,RXY")])
5687 (define_insn "xorsi3"
5688 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5689 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5690 (match_operand:SI 2 "general_operand" "d,R,T")))
5691 (clobber (reg:CC 33))]
5697 [(set_attr "op_type" "RR,RX,RXY")])
5699 (define_insn "*xorsi3_ss"
5700 [(set (match_operand:SI 0 "s_operand" "=Q")
5701 (xor:SI (match_dup 0)
5702 (match_operand:SI 1 "s_imm_operand" "Q")))
5703 (clobber (reg:CC 33))]
5706 [(set_attr "op_type" "SS")])
5708 (define_insn "*xorsi3_ss_inv"
5709 [(set (match_operand:SI 0 "s_operand" "=Q")
5710 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5712 (clobber (reg:CC 33))]
5715 [(set_attr "op_type" "SS")])
5718 ; xorhi3 instruction pattern(s).
5721 (define_insn "xorhi3"
5722 [(set (match_operand:HI 0 "register_operand" "=d")
5723 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5724 (match_operand:HI 2 "nonmemory_operand" "d")))
5725 (clobber (reg:CC 33))]
5728 [(set_attr "op_type" "RR")])
5730 (define_insn "*xorhi3_ss"
5731 [(set (match_operand:HI 0 "s_operand" "=Q")
5732 (xor:HI (match_dup 0)
5733 (match_operand:HI 1 "s_imm_operand" "Q")))
5734 (clobber (reg:CC 33))]
5737 [(set_attr "op_type" "SS")])
5739 (define_insn "*xorhi3_ss_inv"
5740 [(set (match_operand:HI 0 "s_operand" "=Q")
5741 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5743 (clobber (reg:CC 33))]
5746 [(set_attr "op_type" "SS")])
5749 ; xorqi3 instruction pattern(s).
5752 (define_insn "xorqi3"
5753 [(set (match_operand:QI 0 "register_operand" "=d")
5754 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5755 (match_operand:QI 2 "nonmemory_operand" "d")))
5756 (clobber (reg:CC 33))]
5759 [(set_attr "op_type" "RR")])
5761 (define_insn "*xorqi3_ss"
5762 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5763 (xor:QI (match_dup 0)
5764 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5765 (clobber (reg:CC 33))]
5771 [(set_attr "op_type" "SI,SIY,SS")])
5773 (define_insn "*xorqi3_ss_inv"
5774 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5775 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5777 (clobber (reg:CC 33))]
5783 [(set_attr "op_type" "SI,SIY,SS")])
5787 ;;- Negate instructions.
5791 ; negdi2 instruction pattern(s).
5794 (define_expand "negdi2"
5796 [(set (match_operand:DI 0 "register_operand" "=d")
5797 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5798 (clobber (reg:CC 33))])]
5802 (define_insn "*negdi2_64"
5803 [(set (match_operand:DI 0 "register_operand" "=d")
5804 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5805 (clobber (reg:CC 33))]
5808 [(set_attr "op_type" "RR")])
5810 (define_insn "*negdi2_31"
5811 [(set (match_operand:DI 0 "register_operand" "=d")
5812 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5813 (clobber (reg:CC 33))]
5817 xop[0] = gen_label_rtx ();
5818 output_asm_insn ("lcr\t%0,%1", operands);
5819 output_asm_insn ("lcr\t%N0,%N1", operands);
5820 output_asm_insn ("je\t%l0", xop);
5821 output_asm_insn ("bctr\t%0,0", operands);
5822 targetm.asm_out.internal_label (asm_out_file, "L",
5823 CODE_LABEL_NUMBER (xop[0]));
5826 [(set_attr "op_type" "NN")
5827 (set_attr "type" "other")
5828 (set_attr "length" "10")])
5831 ; negsi2 instruction pattern(s).
5834 (define_insn "negsi2"
5835 [(set (match_operand:SI 0 "register_operand" "=d")
5836 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5837 (clobber (reg:CC 33))]
5840 [(set_attr "op_type" "RR")])
5843 ; negdf2 instruction pattern(s).
5846 (define_expand "negdf2"
5848 [(set (match_operand:DF 0 "register_operand" "=f")
5849 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5850 (clobber (reg:CC 33))])]
5854 (define_insn "*negdf2"
5855 [(set (match_operand:DF 0 "register_operand" "=f")
5856 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5857 (clobber (reg:CC 33))]
5858 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5860 [(set_attr "op_type" "RRE")
5861 (set_attr "type" "fsimpd")])
5863 (define_insn "*negdf2_ibm"
5864 [(set (match_operand:DF 0 "register_operand" "=f")
5865 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5866 (clobber (reg:CC 33))]
5867 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5869 [(set_attr "op_type" "RR")
5870 (set_attr "type" "fsimpd")])
5873 ; negsf2 instruction pattern(s).
5876 (define_expand "negsf2"
5878 [(set (match_operand:SF 0 "register_operand" "=f")
5879 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5880 (clobber (reg:CC 33))])]
5884 (define_insn "*negsf2"
5885 [(set (match_operand:SF 0 "register_operand" "=f")
5886 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5887 (clobber (reg:CC 33))]
5888 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5890 [(set_attr "op_type" "RRE")
5891 (set_attr "type" "fsimps")])
5893 (define_insn "*negsf2"
5894 [(set (match_operand:SF 0 "register_operand" "=f")
5895 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5896 (clobber (reg:CC 33))]
5897 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5899 [(set_attr "op_type" "RR")
5900 (set_attr "type" "fsimps")])
5904 ;;- Absolute value instructions.
5908 ; absdi2 instruction pattern(s).
5911 (define_insn "absdi2"
5912 [(set (match_operand:DI 0 "register_operand" "=d")
5913 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5914 (clobber (reg:CC 33))]
5917 [(set_attr "op_type" "RRE")])
5920 ; abssi2 instruction pattern(s).
5923 (define_insn "abssi2"
5924 [(set (match_operand:SI 0 "register_operand" "=d")
5925 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5926 (clobber (reg:CC 33))]
5929 [(set_attr "op_type" "RR")])
5932 ; absdf2 instruction pattern(s).
5935 (define_expand "absdf2"
5937 [(set (match_operand:DF 0 "register_operand" "=f")
5938 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5939 (clobber (reg:CC 33))])]
5943 (define_insn "*absdf2"
5944 [(set (match_operand:DF 0 "register_operand" "=f")
5945 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5946 (clobber (reg:CC 33))]
5947 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5949 [(set_attr "op_type" "RRE")
5950 (set_attr "type" "fsimpd")])
5952 (define_insn "*absdf2_ibm"
5953 [(set (match_operand:DF 0 "register_operand" "=f")
5954 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5955 (clobber (reg:CC 33))]
5956 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5958 [(set_attr "op_type" "RR")
5959 (set_attr "type" "fsimpd")])
5962 ; abssf2 instruction pattern(s).
5965 (define_expand "abssf2"
5967 [(set (match_operand:SF 0 "register_operand" "=f")
5968 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5969 (clobber (reg:CC 33))])]
5973 (define_insn "*abssf2"
5974 [(set (match_operand:SF 0 "register_operand" "=f")
5975 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5976 (clobber (reg:CC 33))]
5977 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5979 [(set_attr "op_type" "RRE")
5980 (set_attr "type" "fsimps")])
5982 (define_insn "*abssf2_ibm"
5983 [(set (match_operand:SF 0 "register_operand" "=f")
5984 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5985 (clobber (reg:CC 33))]
5986 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5988 [(set_attr "op_type" "RR")
5989 (set_attr "type" "fsimps")])
5992 ;;- Negated absolute value instructions
5999 (define_insn "*negabssi2"
6000 [(set (match_operand:SI 0 "register_operand" "=d")
6001 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
6002 (clobber (reg:CC 33))]
6005 [(set_attr "op_type" "RR")])
6007 (define_insn "*negabsdi2"
6008 [(set (match_operand:DI 0 "register_operand" "=d")
6009 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
6010 (clobber (reg:CC 33))]
6013 [(set_attr "op_type" "RRE")])
6019 (define_insn "*negabssf2"
6020 [(set (match_operand:SF 0 "register_operand" "=f")
6021 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
6022 (clobber (reg:CC 33))]
6023 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6025 [(set_attr "op_type" "RRE")
6026 (set_attr "type" "fsimps")])
6028 (define_insn "*negabsdf2"
6029 [(set (match_operand:DF 0 "register_operand" "=f")
6030 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
6031 (clobber (reg:CC 33))]
6032 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6034 [(set_attr "op_type" "RRE")
6035 (set_attr "type" "fsimpd")])
6038 ;;- Square root instructions.
6042 ; sqrtdf2 instruction pattern(s).
6045 (define_insn "sqrtdf2"
6046 [(set (match_operand:DF 0 "register_operand" "=f,f")
6047 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
6048 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6052 [(set_attr "op_type" "RRE,RXE")])
6055 ; sqrtsf2 instruction pattern(s).
6058 (define_insn "sqrtsf2"
6059 [(set (match_operand:SF 0 "register_operand" "=f,f")
6060 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
6061 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6065 [(set_attr "op_type" "RRE,RXE")])
6068 ;;- One complement instructions.
6072 ; one_cmpldi2 instruction pattern(s).
6075 (define_expand "one_cmpldi2"
6077 [(set (match_operand:DI 0 "register_operand" "")
6078 (xor:DI (match_operand:DI 1 "register_operand" "")
6080 (clobber (reg:CC 33))])]
6085 ; one_cmplsi2 instruction pattern(s).
6088 (define_expand "one_cmplsi2"
6090 [(set (match_operand:SI 0 "register_operand" "")
6091 (xor:SI (match_operand:SI 1 "register_operand" "")
6093 (clobber (reg:CC 33))])]
6098 ; one_cmplhi2 instruction pattern(s).
6101 (define_expand "one_cmplhi2"
6103 [(set (match_operand:HI 0 "register_operand" "")
6104 (xor:HI (match_operand:HI 1 "register_operand" "")
6106 (clobber (reg:CC 33))])]
6111 ; one_cmplqi2 instruction pattern(s).
6114 (define_expand "one_cmplqi2"
6116 [(set (match_operand:QI 0 "register_operand" "")
6117 (xor:QI (match_operand:QI 1 "register_operand" "")
6119 (clobber (reg:CC 33))])]
6125 ;;- Rotate instructions.
6129 ; rotldi3 instruction pattern(s).
6132 (define_insn "rotldi3"
6133 [(set (match_operand:DI 0 "register_operand" "=d")
6134 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6135 (match_operand:SI 2 "shift_count_operand" "Y")))]
6138 [(set_attr "op_type" "RSE")
6139 (set_attr "atype" "reg")])
6142 ; rotlsi3 instruction pattern(s).
6145 (define_insn "rotlsi3"
6146 [(set (match_operand:SI 0 "register_operand" "=d")
6147 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6148 (match_operand:SI 2 "shift_count_operand" "Y")))]
6151 [(set_attr "op_type" "RSE")
6152 (set_attr "atype" "reg")])
6156 ;;- Arithmetic shift instructions.
6160 ; ashldi3 instruction pattern(s).
6163 (define_expand "ashldi3"
6164 [(set (match_operand:DI 0 "register_operand" "")
6165 (ashift:DI (match_operand:DI 1 "register_operand" "")
6166 (match_operand:SI 2 "shift_count_operand" "")))]
6170 (define_insn "*ashldi3_31"
6171 [(set (match_operand:DI 0 "register_operand" "=d")
6172 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6173 (match_operand:SI 2 "shift_count_operand" "Y")))]
6176 [(set_attr "op_type" "RS")
6177 (set_attr "atype" "reg")])
6179 (define_insn "*ashldi3_64"
6180 [(set (match_operand:DI 0 "register_operand" "=d")
6181 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6182 (match_operand:SI 2 "shift_count_operand" "Y")))]
6185 [(set_attr "op_type" "RSE")
6186 (set_attr "atype" "reg")])
6189 ; ashrdi3 instruction pattern(s).
6192 (define_expand "ashrdi3"
6194 [(set (match_operand:DI 0 "register_operand" "")
6195 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6196 (match_operand:SI 2 "shift_count_operand" "")))
6197 (clobber (reg:CC 33))])]
6201 (define_insn "*ashrdi3_cc_31"
6203 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6204 (match_operand:SI 2 "shift_count_operand" "Y"))
6206 (set (match_operand:DI 0 "register_operand" "=d")
6207 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6208 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6210 [(set_attr "op_type" "RS")
6211 (set_attr "atype" "reg")])
6213 (define_insn "*ashrdi3_cconly_31"
6215 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6216 (match_operand:SI 2 "shift_count_operand" "Y"))
6218 (clobber (match_scratch:DI 0 "=d"))]
6219 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6221 [(set_attr "op_type" "RS")
6222 (set_attr "atype" "reg")])
6224 (define_insn "*ashrdi3_31"
6225 [(set (match_operand:DI 0 "register_operand" "=d")
6226 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6227 (match_operand:SI 2 "shift_count_operand" "Y")))
6228 (clobber (reg:CC 33))]
6231 [(set_attr "op_type" "RS")
6232 (set_attr "atype" "reg")])
6234 (define_insn "*ashrdi3_cc_64"
6236 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6237 (match_operand:SI 2 "shift_count_operand" "Y"))
6239 (set (match_operand:DI 0 "register_operand" "=d")
6240 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6241 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6243 [(set_attr "op_type" "RSE")
6244 (set_attr "atype" "reg")])
6246 (define_insn "*ashrdi3_cconly_64"
6248 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6249 (match_operand:SI 2 "shift_count_operand" "Y"))
6251 (clobber (match_scratch:DI 0 "=d"))]
6252 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6254 [(set_attr "op_type" "RSE")
6255 (set_attr "atype" "reg")])
6257 (define_insn "*ashrdi3_64"
6258 [(set (match_operand:DI 0 "register_operand" "=d")
6259 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6260 (match_operand:SI 2 "shift_count_operand" "Y")))
6261 (clobber (reg:CC 33))]
6264 [(set_attr "op_type" "RSE")
6265 (set_attr "atype" "reg")])
6269 ; ashlsi3 instruction pattern(s).
6272 (define_insn "ashlsi3"
6273 [(set (match_operand:SI 0 "register_operand" "=d")
6274 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6275 (match_operand:SI 2 "shift_count_operand" "Y")))]
6278 [(set_attr "op_type" "RS")
6279 (set_attr "atype" "reg")])
6282 ; ashrsi3 instruction pattern(s).
6285 (define_insn "*ashrsi3_cc"
6287 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6288 (match_operand:SI 2 "shift_count_operand" "Y"))
6290 (set (match_operand:SI 0 "register_operand" "=d")
6291 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6292 "s390_match_ccmode(insn, CCSmode)"
6294 [(set_attr "op_type" "RS")
6295 (set_attr "atype" "reg")])
6298 (define_insn "*ashrsi3_cconly"
6300 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6301 (match_operand:SI 2 "shift_count_operand" "Y"))
6303 (clobber (match_scratch:SI 0 "=d"))]
6304 "s390_match_ccmode(insn, CCSmode)"
6306 [(set_attr "op_type" "RS")
6307 (set_attr "atype" "reg")])
6309 (define_insn "ashrsi3"
6310 [(set (match_operand:SI 0 "register_operand" "=d")
6311 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6312 (match_operand:SI 2 "shift_count_operand" "Y")))
6313 (clobber (reg:CC 33))]
6316 [(set_attr "op_type" "RS")
6317 (set_attr "atype" "reg")])
6321 ;;- logical shift instructions.
6325 ; lshrdi3 instruction pattern(s).
6328 (define_expand "lshrdi3"
6329 [(set (match_operand:DI 0 "register_operand" "")
6330 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6331 (match_operand:SI 2 "shift_count_operand" "")))]
6335 (define_insn "*lshrdi3_31"
6336 [(set (match_operand:DI 0 "register_operand" "=d")
6337 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6338 (match_operand:SI 2 "shift_count_operand" "Y")))]
6341 [(set_attr "op_type" "RS")
6342 (set_attr "atype" "reg")])
6344 (define_insn "*lshrdi3_64"
6345 [(set (match_operand:DI 0 "register_operand" "=d")
6346 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6347 (match_operand:SI 2 "shift_count_operand" "Y")))]
6350 [(set_attr "op_type" "RSE")
6351 (set_attr "atype" "reg")])
6354 ; lshrsi3 instruction pattern(s).
6357 (define_insn "lshrsi3"
6358 [(set (match_operand:SI 0 "register_operand" "=d")
6359 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6360 (match_operand:SI 2 "shift_count_operand" "Y")))]
6363 [(set_attr "op_type" "RS")
6364 (set_attr "atype" "reg")])
6368 ;; Branch instruction patterns.
6371 (define_expand "beq"
6372 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6374 (if_then_else (eq (reg:CCZ 33) (const_int 0))
6375 (label_ref (match_operand 0 "" ""))
6378 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6380 (define_expand "bne"
6381 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6383 (if_then_else (ne (reg:CCZ 33) (const_int 0))
6384 (label_ref (match_operand 0 "" ""))
6387 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6389 (define_expand "bgt"
6390 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6392 (if_then_else (gt (reg:CCS 33) (const_int 0))
6393 (label_ref (match_operand 0 "" ""))
6396 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6398 (define_expand "bgtu"
6399 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6401 (if_then_else (gtu (reg:CCU 33) (const_int 0))
6402 (label_ref (match_operand 0 "" ""))
6405 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6407 (define_expand "blt"
6408 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6410 (if_then_else (lt (reg:CCS 33) (const_int 0))
6411 (label_ref (match_operand 0 "" ""))
6414 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6416 (define_expand "bltu"
6417 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6419 (if_then_else (ltu (reg:CCU 33) (const_int 0))
6420 (label_ref (match_operand 0 "" ""))
6423 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6425 (define_expand "bge"
6426 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6428 (if_then_else (ge (reg:CCS 33) (const_int 0))
6429 (label_ref (match_operand 0 "" ""))
6432 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6434 (define_expand "bgeu"
6435 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6437 (if_then_else (geu (reg:CCU 33) (const_int 0))
6438 (label_ref (match_operand 0 "" ""))
6441 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6443 (define_expand "ble"
6444 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6446 (if_then_else (le (reg:CCS 33) (const_int 0))
6447 (label_ref (match_operand 0 "" ""))
6450 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6452 (define_expand "bleu"
6453 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6455 (if_then_else (leu (reg:CCU 33) (const_int 0))
6456 (label_ref (match_operand 0 "" ""))
6459 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6461 (define_expand "bunordered"
6462 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6464 (if_then_else (unordered (reg:CCS 33) (const_int 0))
6465 (label_ref (match_operand 0 "" ""))
6468 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6470 (define_expand "bordered"
6471 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6473 (if_then_else (ordered (reg:CCS 33) (const_int 0))
6474 (label_ref (match_operand 0 "" ""))
6477 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6479 (define_expand "buneq"
6480 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6482 (if_then_else (uneq (reg:CCS 33) (const_int 0))
6483 (label_ref (match_operand 0 "" ""))
6486 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6488 (define_expand "bungt"
6489 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6491 (if_then_else (ungt (reg:CCS 33) (const_int 0))
6492 (label_ref (match_operand 0 "" ""))
6495 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6497 (define_expand "bunlt"
6498 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6500 (if_then_else (unlt (reg:CCS 33) (const_int 0))
6501 (label_ref (match_operand 0 "" ""))
6504 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6506 (define_expand "bunge"
6507 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6509 (if_then_else (unge (reg:CCS 33) (const_int 0))
6510 (label_ref (match_operand 0 "" ""))
6513 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6515 (define_expand "bunle"
6516 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6518 (if_then_else (unle (reg:CCS 33) (const_int 0))
6519 (label_ref (match_operand 0 "" ""))
6522 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6524 (define_expand "bltgt"
6525 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6527 (if_then_else (ltgt (reg:CCS 33) (const_int 0))
6528 (label_ref (match_operand 0 "" ""))
6531 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6535 ;;- Conditional jump instructions.
6538 (define_insn "cjump"
6541 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6542 (label_ref (match_operand 0 "" ""))
6546 if (get_attr_length (insn) == 4)
6548 else if (TARGET_CPU_ZARCH)
6549 return "jg%C1\t%l0";
6553 [(set_attr "op_type" "RI")
6554 (set_attr "type" "branch")
6555 (set (attr "length")
6556 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6558 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6560 (eq (symbol_ref "flag_pic") (const_int 0))
6561 (const_int 6)] (const_int 8)))])
6563 (define_insn "*cjump_long"
6566 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6567 (match_operand 0 "address_operand" "U")
6571 if (get_attr_op_type (insn) == OP_TYPE_RR)
6576 [(set (attr "op_type")
6577 (if_then_else (match_operand 0 "register_operand" "")
6578 (const_string "RR") (const_string "RX")))
6579 (set_attr "type" "branch")
6580 (set_attr "atype" "agen")])
6584 ;;- Negated conditional jump instructions.
6587 (define_insn "icjump"
6590 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6592 (label_ref (match_operand 0 "" ""))))]
6595 if (get_attr_length (insn) == 4)
6597 else if (TARGET_CPU_ZARCH)
6598 return "jg%D1\t%l0";
6602 [(set_attr "op_type" "RI")
6603 (set_attr "type" "branch")
6604 (set (attr "length")
6605 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6607 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6609 (eq (symbol_ref "flag_pic") (const_int 0))
6610 (const_int 6)] (const_int 8)))])
6612 (define_insn "*icjump_long"
6615 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6617 (match_operand 0 "address_operand" "U")))]
6620 if (get_attr_op_type (insn) == OP_TYPE_RR)
6625 [(set (attr "op_type")
6626 (if_then_else (match_operand 0 "register_operand" "")
6627 (const_string "RR") (const_string "RX")))
6628 (set_attr "type" "branch")
6629 (set_attr "atype" "agen")])
6632 ;;- Trap instructions.
6636 [(trap_if (const_int 1) (const_int 0))]
6639 [(set_attr "op_type" "RX")
6640 (set_attr "type" "branch")])
6642 (define_expand "conditional_trap"
6643 [(set (match_dup 2) (match_dup 3))
6644 (trap_if (match_operator 0 "comparison_operator"
6645 [(match_dup 2) (const_int 0)])
6646 (match_operand:SI 1 "general_operand" ""))]
6649 enum machine_mode ccmode;
6651 if (operands[1] != const0_rtx) FAIL;
6653 ccmode = s390_select_ccmode (GET_CODE (operands[0]),
6654 s390_compare_op0, s390_compare_op1);
6655 operands[2] = gen_rtx_REG (ccmode, 33);
6656 operands[3] = gen_rtx_COMPARE (ccmode, s390_compare_op0, s390_compare_op1);
6659 (define_insn "*trap"
6660 [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6664 [(set_attr "op_type" "RI")
6665 (set_attr "type" "branch")])
6668 ;;- Loop instructions.
6670 ;; This is all complicated by the fact that since this is a jump insn
6671 ;; we must handle our own output reloads.
6673 (define_expand "doloop_end"
6674 [(use (match_operand 0 "" "")) ; loop pseudo
6675 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6676 (use (match_operand 2 "" "")) ; max iterations
6677 (use (match_operand 3 "" "")) ; loop level
6678 (use (match_operand 4 "" ""))] ; label
6681 if (GET_MODE (operands[0]) == SImode)
6682 emit_jump_insn (gen_doloop_si (operands[4], operands[0], operands[0]));
6683 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6684 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6691 (define_insn "doloop_si"
6694 (ne (match_operand:SI 1 "register_operand" "d,d")
6696 (label_ref (match_operand 0 "" ""))
6698 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6699 (plus:SI (match_dup 1) (const_int -1)))
6700 (clobber (match_scratch:SI 3 "=X,&d"))
6701 (clobber (reg:CC 33))]
6704 if (which_alternative != 0)
6706 else if (get_attr_length (insn) == 4)
6707 return "brct\t%1,%l0";
6708 else if (TARGET_CPU_ZARCH)
6709 return "ahi\t%1,-1\;jgne\t%l0";
6713 [(set_attr "op_type" "RI")
6714 (set_attr "type" "branch")
6715 (set (attr "length")
6716 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6718 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6720 (eq (symbol_ref "flag_pic") (const_int 0))
6721 (const_int 6)] (const_int 8)))])
6723 (define_insn "*doloop_si_long"
6726 (ne (match_operand:SI 1 "register_operand" "d,d")
6728 (match_operand 0 "address_operand" "U,U")
6730 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6731 (plus:SI (match_dup 1) (const_int -1)))
6732 (clobber (match_scratch:SI 3 "=X,&d"))
6733 (clobber (reg:CC 33))]
6736 if (get_attr_op_type (insn) == OP_TYPE_RR)
6737 return "bctr\t%1,%0";
6739 return "bct\t%1,%a0";
6741 [(set (attr "op_type")
6742 (if_then_else (match_operand 0 "register_operand" "")
6743 (const_string "RR") (const_string "RX")))
6744 (set_attr "type" "branch")
6745 (set_attr "atype" "agen")])
6749 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
6751 (match_operand 0 "" "")
6753 (set (match_operand:SI 2 "nonimmediate_operand" "")
6754 (plus:SI (match_dup 1) (const_int -1)))
6755 (clobber (match_scratch:SI 3 ""))
6756 (clobber (reg:CC 33))]
6758 && (! REG_P (operands[2])
6759 || ! rtx_equal_p (operands[1], operands[2]))"
6760 [(set (match_dup 3) (match_dup 1))
6761 (parallel [(set (reg:CCAN 33)
6762 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6764 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6765 (set (match_dup 2) (match_dup 3))
6766 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6771 (define_insn "doloop_di"
6774 (ne (match_operand:DI 1 "register_operand" "d,d")
6776 (label_ref (match_operand 0 "" ""))
6778 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?*m*r")
6779 (plus:DI (match_dup 1) (const_int -1)))
6780 (clobber (match_scratch:DI 3 "=X,&d"))
6781 (clobber (reg:CC 33))]
6784 if (which_alternative != 0)
6786 else if (get_attr_length (insn) == 4)
6787 return "brctg\t%1,%l0";
6789 return "aghi\t%1,-1\;jgne\t%l0";
6791 [(set_attr "op_type" "RI")
6792 (set_attr "type" "branch")
6793 (set (attr "length")
6794 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6795 (const_int 4) (const_int 10)))])
6799 (if_then_else (ne (match_operand:DI 1 "register_operand" "")
6801 (match_operand 0 "" "")
6803 (set (match_operand:DI 2 "nonimmediate_operand" "")
6804 (plus:DI (match_dup 1) (const_int -1)))
6805 (clobber (match_scratch:DI 3 ""))
6806 (clobber (reg:CC 33))]
6808 && (! REG_P (operands[2])
6809 || ! rtx_equal_p (operands[1], operands[2]))"
6810 [(set (match_dup 3) (match_dup 1))
6811 (parallel [(set (reg:CCAN 33)
6812 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6814 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6815 (set (match_dup 2) (match_dup 3))
6816 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6822 ;;- Unconditional jump instructions.
6826 ; jump instruction pattern(s).
6830 [(set (pc) (label_ref (match_operand 0 "" "")))]
6833 if (get_attr_length (insn) == 4)
6835 else if (TARGET_CPU_ZARCH)
6840 [(set_attr "op_type" "RI")
6841 (set_attr "type" "branch")
6842 (set (attr "length")
6843 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6845 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6847 (eq (symbol_ref "flag_pic") (const_int 0))
6848 (const_int 6)] (const_int 8)))])
6851 ; indirect-jump instruction pattern(s).
6854 (define_insn "indirect_jump"
6855 [(set (pc) (match_operand 0 "address_operand" "U"))]
6858 if (get_attr_op_type (insn) == OP_TYPE_RR)
6863 [(set (attr "op_type")
6864 (if_then_else (match_operand 0 "register_operand" "")
6865 (const_string "RR") (const_string "RX")))
6866 (set_attr "type" "branch")
6867 (set_attr "atype" "agen")])
6870 ; casesi instruction pattern(s).
6873 (define_insn "casesi_jump"
6874 [(set (pc) (match_operand 0 "address_operand" "U"))
6875 (use (label_ref (match_operand 1 "" "")))]
6878 if (get_attr_op_type (insn) == OP_TYPE_RR)
6883 [(set (attr "op_type")
6884 (if_then_else (match_operand 0 "register_operand" "")
6885 (const_string "RR") (const_string "RX")))
6886 (set_attr "type" "branch")
6887 (set_attr "atype" "agen")])
6889 (define_expand "casesi"
6890 [(match_operand:SI 0 "general_operand" "")
6891 (match_operand:SI 1 "general_operand" "")
6892 (match_operand:SI 2 "general_operand" "")
6893 (label_ref (match_operand 3 "" ""))
6894 (label_ref (match_operand 4 "" ""))]
6897 rtx index = gen_reg_rtx (SImode);
6898 rtx base = gen_reg_rtx (Pmode);
6899 rtx target = gen_reg_rtx (Pmode);
6901 emit_move_insn (index, operands[0]);
6902 emit_insn (gen_subsi3 (index, index, operands[1]));
6903 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6906 if (Pmode != SImode)
6907 index = convert_to_mode (Pmode, index, 1);
6908 if (GET_CODE (index) != REG)
6909 index = copy_to_mode_reg (Pmode, index);
6912 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6914 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
6916 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6918 index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
6919 RTX_UNCHANGING_P (index) = 1;
6920 MEM_NOTRAP_P (index) = 1;
6921 emit_move_insn (target, index);
6924 target = gen_rtx_PLUS (Pmode, base, target);
6925 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6932 ;;- Jump to subroutine.
6937 ; untyped call instruction pattern(s).
6940 ;; Call subroutine returning any type.
6941 (define_expand "untyped_call"
6942 [(parallel [(call (match_operand 0 "" "")
6944 (match_operand 1 "" "")
6945 (match_operand 2 "" "")])]
6950 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6952 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6954 rtx set = XVECEXP (operands[2], 0, i);
6955 emit_move_insn (SET_DEST (set), SET_SRC (set));
6958 /* The optimizer does not know that the call sets the function value
6959 registers we stored in the result block. We avoid problems by
6960 claiming that all hard registers are used and clobbered at this
6962 emit_insn (gen_blockage ());
6967 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6968 ;; all of memory. This blocks insns from being moved across this point.
6970 (define_insn "blockage"
6971 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6974 [(set_attr "type" "none")
6975 (set_attr "length" "0")])
6981 (define_expand "sibcall"
6982 [(call (match_operand 0 "" "")
6983 (match_operand 1 "" ""))]
6986 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
6990 (define_insn "*sibcall_br"
6991 [(call (mem:QI (reg 1))
6992 (match_operand 0 "const_int_operand" "n"))]
6993 "SIBLING_CALL_P (insn)
6994 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
6996 [(set_attr "op_type" "RR")
6997 (set_attr "type" "branch")
6998 (set_attr "atype" "agen")])
7000 (define_insn "*sibcall_brc"
7001 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7002 (match_operand 1 "const_int_operand" "n"))]
7003 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7005 [(set_attr "op_type" "RI")
7006 (set_attr "type" "branch")])
7008 (define_insn "*sibcall_brcl"
7009 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7010 (match_operand 1 "const_int_operand" "n"))]
7011 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7013 [(set_attr "op_type" "RIL")
7014 (set_attr "type" "branch")])
7017 ; sibcall_value patterns
7020 (define_expand "sibcall_value"
7021 [(set (match_operand 0 "" "")
7022 (call (match_operand 1 "" "")
7023 (match_operand 2 "" "")))]
7026 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
7030 (define_insn "*sibcall_value_br"
7031 [(set (match_operand 0 "" "")
7032 (call (mem:QI (reg 1))
7033 (match_operand 1 "const_int_operand" "n")))]
7034 "SIBLING_CALL_P (insn)
7035 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
7037 [(set_attr "op_type" "RR")
7038 (set_attr "type" "branch")
7039 (set_attr "atype" "agen")])
7041 (define_insn "*sibcall_value_brc"
7042 [(set (match_operand 0 "" "")
7043 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7044 (match_operand 2 "const_int_operand" "n")))]
7045 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7047 [(set_attr "op_type" "RI")
7048 (set_attr "type" "branch")])
7050 (define_insn "*sibcall_value_brcl"
7051 [(set (match_operand 0 "" "")
7052 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7053 (match_operand 2 "const_int_operand" "n")))]
7054 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7056 [(set_attr "op_type" "RIL")
7057 (set_attr "type" "branch")])
7061 ; call instruction pattern(s).
7064 (define_expand "call"
7065 [(call (match_operand 0 "" "")
7066 (match_operand 1 "" ""))
7067 (use (match_operand 2 "" ""))]
7070 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
7071 gen_rtx_REG (Pmode, RETURN_REGNUM));
7075 (define_insn "*bras"
7076 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7077 (match_operand 1 "const_int_operand" "n"))
7078 (clobber (match_operand 2 "register_operand" "=r"))]
7079 "!SIBLING_CALL_P (insn)
7080 && TARGET_SMALL_EXEC
7081 && GET_MODE (operands[2]) == Pmode"
7083 [(set_attr "op_type" "RI")
7084 (set_attr "type" "jsr")])
7086 (define_insn "*brasl"
7087 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7088 (match_operand 1 "const_int_operand" "n"))
7089 (clobber (match_operand 2 "register_operand" "=r"))]
7090 "!SIBLING_CALL_P (insn)
7092 && GET_MODE (operands[2]) == Pmode"
7094 [(set_attr "op_type" "RIL")
7095 (set_attr "type" "jsr")])
7097 (define_insn "*basr"
7098 [(call (mem:QI (match_operand 0 "address_operand" "U"))
7099 (match_operand 1 "const_int_operand" "n"))
7100 (clobber (match_operand 2 "register_operand" "=r"))]
7101 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
7103 if (get_attr_op_type (insn) == OP_TYPE_RR)
7104 return "basr\t%2,%0";
7106 return "bas\t%2,%a0";
7108 [(set (attr "op_type")
7109 (if_then_else (match_operand 0 "register_operand" "")
7110 (const_string "RR") (const_string "RX")))
7111 (set_attr "type" "jsr")
7112 (set_attr "atype" "agen")])
7115 ; call_value instruction pattern(s).
7118 (define_expand "call_value"
7119 [(set (match_operand 0 "" "")
7120 (call (match_operand 1 "" "")
7121 (match_operand 2 "" "")))
7122 (use (match_operand 3 "" ""))]
7125 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
7126 gen_rtx_REG (Pmode, RETURN_REGNUM));
7130 (define_insn "*bras_r"
7131 [(set (match_operand 0 "" "")
7132 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7133 (match_operand:SI 2 "const_int_operand" "n")))
7134 (clobber (match_operand 3 "register_operand" "=r"))]
7135 "!SIBLING_CALL_P (insn)
7136 && TARGET_SMALL_EXEC
7137 && GET_MODE (operands[3]) == Pmode"
7139 [(set_attr "op_type" "RI")
7140 (set_attr "type" "jsr")])
7142 (define_insn "*brasl_r"
7143 [(set (match_operand 0 "" "")
7144 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7145 (match_operand 2 "const_int_operand" "n")))
7146 (clobber (match_operand 3 "register_operand" "=r"))]
7147 "!SIBLING_CALL_P (insn)
7149 && GET_MODE (operands[3]) == Pmode"
7151 [(set_attr "op_type" "RIL")
7152 (set_attr "type" "jsr")])
7154 (define_insn "*basr_r"
7155 [(set (match_operand 0 "" "")
7156 (call (mem:QI (match_operand 1 "address_operand" "U"))
7157 (match_operand 2 "const_int_operand" "n")))
7158 (clobber (match_operand 3 "register_operand" "=r"))]
7159 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7161 if (get_attr_op_type (insn) == OP_TYPE_RR)
7162 return "basr\t%3,%1";
7164 return "bas\t%3,%a1";
7166 [(set (attr "op_type")
7167 (if_then_else (match_operand 1 "register_operand" "")
7168 (const_string "RR") (const_string "RX")))
7169 (set_attr "type" "jsr")
7170 (set_attr "atype" "agen")])
7173 ;;- Thread-local storage support.
7176 (define_insn "get_tp_64"
7177 [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7178 (unspec:DI [(const_int 0)] UNSPEC_TP))]
7181 ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7183 [(set_attr "op_type" "NN,RS")
7184 (set_attr "atype" "reg,*")
7185 (set_attr "type" "o3,*")
7186 (set_attr "length" "14,*")])
7188 (define_insn "get_tp_31"
7189 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7190 (unspec:SI [(const_int 0)] UNSPEC_TP))]
7195 [(set_attr "op_type" "RRE,RS")])
7197 (define_insn "set_tp_64"
7198 [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7199 (clobber (match_scratch:SI 1 "=d,X"))]
7202 sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7204 [(set_attr "op_type" "NN,RS")
7205 (set_attr "atype" "reg,*")
7206 (set_attr "type" "o3,*")
7207 (set_attr "length" "14,*")])
7209 (define_insn "set_tp_31"
7210 [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7215 [(set_attr "op_type" "RRE,RS")])
7217 (define_insn "*tls_load_64"
7218 [(set (match_operand:DI 0 "register_operand" "=d")
7219 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7220 (match_operand:DI 2 "" "")]
7224 [(set_attr "op_type" "RXE")])
7226 (define_insn "*tls_load_31"
7227 [(set (match_operand:SI 0 "register_operand" "=d,d")
7228 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7229 (match_operand:SI 2 "" "")]
7235 [(set_attr "op_type" "RX,RXY")])
7237 (define_insn "*bras_tls"
7238 [(set (match_operand 0 "" "")
7239 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7240 (match_operand 2 "const_int_operand" "n")))
7241 (clobber (match_operand 3 "register_operand" "=r"))
7242 (use (match_operand 4 "" ""))]
7243 "!SIBLING_CALL_P (insn)
7244 && TARGET_SMALL_EXEC
7245 && GET_MODE (operands[3]) == Pmode"
7247 [(set_attr "op_type" "RI")
7248 (set_attr "type" "jsr")])
7250 (define_insn "*brasl_tls"
7251 [(set (match_operand 0 "" "")
7252 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7253 (match_operand 2 "const_int_operand" "n")))
7254 (clobber (match_operand 3 "register_operand" "=r"))
7255 (use (match_operand 4 "" ""))]
7256 "!SIBLING_CALL_P (insn)
7258 && GET_MODE (operands[3]) == Pmode"
7260 [(set_attr "op_type" "RIL")
7261 (set_attr "type" "jsr")])
7263 (define_insn "*basr_tls"
7264 [(set (match_operand 0 "" "")
7265 (call (mem:QI (match_operand 1 "address_operand" "U"))
7266 (match_operand 2 "const_int_operand" "n")))
7267 (clobber (match_operand 3 "register_operand" "=r"))
7268 (use (match_operand 4 "" ""))]
7269 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7271 if (get_attr_op_type (insn) == OP_TYPE_RR)
7272 return "basr\t%3,%1%J4";
7274 return "bas\t%3,%a1%J4";
7276 [(set (attr "op_type")
7277 (if_then_else (match_operand 1 "register_operand" "")
7278 (const_string "RR") (const_string "RX")))
7279 (set_attr "type" "jsr")
7280 (set_attr "atype" "agen")])
7283 ;;- Miscellaneous instructions.
7287 ; allocate stack instruction pattern(s).
7290 (define_expand "allocate_stack"
7292 (plus (reg 15) (match_operand 1 "general_operand" "")))
7293 (set (match_operand 0 "general_operand" "")
7297 rtx stack = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
7298 rtx chain = gen_rtx_MEM (Pmode, stack);
7299 rtx temp = gen_reg_rtx (Pmode);
7301 emit_move_insn (temp, chain);
7304 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7306 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7308 emit_move_insn (chain, temp);
7310 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7316 ; setjmp instruction pattern.
7319 (define_expand "builtin_setjmp_receiver"
7320 [(match_operand 0 "" "")]
7323 s390_load_got (false);
7324 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7328 ;; These patterns say how to save and restore the stack pointer. We need not
7329 ;; save the stack pointer at function level since we are careful to
7330 ;; preserve the backchain. At block level, we have to restore the backchain
7331 ;; when we restore the stack pointer.
7333 ;; For nonlocal gotos, we must save both the stack pointer and its
7334 ;; backchain and restore both. Note that in the nonlocal case, the
7335 ;; save area is a memory location.
7337 (define_expand "save_stack_function"
7338 [(match_operand 0 "general_operand" "")
7339 (match_operand 1 "general_operand" "")]
7343 (define_expand "restore_stack_function"
7344 [(match_operand 0 "general_operand" "")
7345 (match_operand 1 "general_operand" "")]
7349 (define_expand "restore_stack_block"
7350 [(use (match_operand 0 "register_operand" ""))
7351 (set (match_dup 2) (match_dup 3))
7352 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7353 (set (match_dup 3) (match_dup 2))]
7356 operands[2] = gen_reg_rtx (Pmode);
7357 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7360 (define_expand "save_stack_nonlocal"
7361 [(match_operand 0 "memory_operand" "")
7362 (match_operand 1 "register_operand" "")]
7365 rtx temp = gen_reg_rtx (Pmode);
7367 /* Copy the backchain to the first word, sp to the second and the literal pool
7368 base to the third. */
7369 emit_move_insn (operand_subword (operands[0], 2, 0,
7370 TARGET_64BIT ? OImode : TImode),
7371 gen_rtx_REG (Pmode, BASE_REGISTER));
7372 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7373 emit_move_insn (operand_subword (operands[0], 0, 0,
7374 TARGET_64BIT ? OImode : TImode),
7376 emit_move_insn (operand_subword (operands[0], 1, 0,
7377 TARGET_64BIT ? OImode : TImode),
7382 (define_expand "restore_stack_nonlocal"
7383 [(match_operand 0 "register_operand" "")
7384 (match_operand 1 "memory_operand" "")]
7387 rtx temp = gen_reg_rtx (Pmode);
7388 rtx base = gen_rtx_REG (Pmode, BASE_REGISTER);
7390 /* Restore the backchain from the first word, sp from the second and the
7391 literal pool base from the third. */
7392 emit_move_insn (temp,
7393 operand_subword (operands[1], 0, 0,
7394 TARGET_64BIT ? OImode : TImode));
7395 emit_move_insn (operands[0],
7396 operand_subword (operands[1], 1, 0,
7397 TARGET_64BIT ? OImode : TImode));
7398 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7399 emit_move_insn (base,
7400 operand_subword (operands[1], 2, 0,
7401 TARGET_64BIT ? OImode : TImode));
7402 emit_insn (gen_rtx_USE (VOIDmode, base));
7409 ; nop instruction pattern(s).
7416 [(set_attr "op_type" "RR")])
7420 ; Special literal pool access instruction pattern(s).
7423 (define_insn "*pool_entry"
7424 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7425 UNSPECV_POOL_ENTRY)]
7428 enum machine_mode mode = GET_MODE (PATTERN (insn));
7429 unsigned int align = GET_MODE_BITSIZE (mode);
7430 s390_output_pool_entry (operands[0], mode, align);
7433 [(set_attr "op_type" "NN")
7434 (set (attr "length")
7435 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7437 (define_insn "pool_start_31"
7438 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7441 [(set_attr "op_type" "NN")
7442 (set_attr "length" "2")])
7444 (define_insn "pool_end_31"
7445 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7448 [(set_attr "op_type" "NN")
7449 (set_attr "length" "2")])
7451 (define_insn "pool_start_64"
7452 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7454 ".section\t.rodata\;.align\t8"
7455 [(set_attr "op_type" "NN")
7456 (set_attr "length" "0")])
7458 (define_insn "pool_end_64"
7459 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7462 [(set_attr "op_type" "NN")
7463 (set_attr "length" "0")])
7465 (define_insn "main_base_31_small"
7466 [(set (match_operand 0 "register_operand" "=a")
7467 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7468 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7470 [(set_attr "op_type" "RR")
7471 (set_attr "type" "la")])
7473 (define_insn "main_base_31_large"
7474 [(set (match_operand 0 "register_operand" "=a")
7475 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7476 (set (pc) (label_ref (match_operand 2 "" "")))]
7477 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7479 [(set_attr "op_type" "RI")])
7481 (define_insn "main_base_64"
7482 [(set (match_operand 0 "register_operand" "=a")
7483 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7484 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7486 [(set_attr "op_type" "RIL")
7487 (set_attr "type" "larl")])
7489 (define_insn "main_pool"
7490 [(unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL)]
7493 [(set_attr "op_type" "NN")])
7495 (define_insn "reload_base_31"
7496 [(set (match_operand 0 "register_operand" "=a")
7497 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7498 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7499 "basr\t%0,0\;la\t%0,%1-.(%0)"
7500 [(set_attr "op_type" "NN")
7501 (set_attr "type" "la")
7502 (set_attr "length" "6")])
7504 (define_insn "reload_base_64"
7505 [(set (match_operand 0 "register_operand" "=a")
7506 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7507 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7509 [(set_attr "op_type" "RIL")
7510 (set_attr "type" "larl")])
7513 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7516 [(set_attr "op_type" "NN")
7517 (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7520 ;; Insns related to generating the function prologue and epilogue.
7524 (define_expand "prologue"
7525 [(use (const_int 0))]
7527 "s390_emit_prologue (); DONE;")
7529 (define_insn "prologue_tpf"
7530 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_PROLOGUE)
7531 (clobber (reg:DI 1))]
7532 "TARGET_TPF_PROFILING"
7534 [(set_attr "type" "jsr")
7535 (set_attr "op_type" "RX")])
7537 (define_expand "epilogue"
7538 [(use (const_int 1))]
7540 "s390_emit_epilogue (false); DONE;")
7542 (define_insn "epilogue_tpf"
7543 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_EPILOGUE)
7544 (clobber (reg:DI 1))]
7545 "TARGET_TPF_PROFILING"
7547 [(set_attr "type" "jsr")
7548 (set_attr "op_type" "RX")])
7551 (define_expand "sibcall_epilogue"
7552 [(use (const_int 0))]
7554 "s390_emit_epilogue (true); DONE;")
7556 (define_insn "*return"
7558 (use (match_operand 0 "register_operand" "a"))]
7559 "GET_MODE (operands[0]) == Pmode"
7561 [(set_attr "op_type" "RR")
7562 (set_attr "type" "jsr")
7563 (set_attr "atype" "agen")])
7566 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7567 ;; pointer. This is used for compatibility.
7569 (define_expand "ptr_extend"
7570 [(set (match_operand:DI 0 "register_operand" "=r")
7571 (match_operand:SI 1 "register_operand" "r"))]
7574 emit_insn (gen_anddi3 (operands[0],
7575 gen_lowpart (DImode, operands[1]),
7576 GEN_INT (0x7fffffff)));