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
123 (UNSPECV_POOL_START 201)
124 (UNSPECV_POOL_END 202)
125 (UNSPECV_POOL_ENTRY 203)
126 (UNSPECV_MAIN_POOL 300)
133 ;; Processor type. This attribute must exactly match the processor_type
134 ;; enumeration in s390.h.
136 (define_attr "cpu" "g5,g6,z900,z990"
137 (const (symbol_ref "s390_tune")))
139 ;; Define an insn type attribute. This is used in function unit delay
142 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
143 cs,vs,store,imul,idiv,
144 branch,jsr,fsimpd,fsimps,
145 floadd,floads,fstored, fstores,
146 fmuld,fmuls,fdivd,fdivs,
147 ftoi,itof,fsqrtd,fsqrts,
149 (const_string "integer"))
151 ;; Operand type. Used to default length attribute values
153 (define_attr "op_type"
154 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
157 ;; Insn are devide in two classes:
158 ;; agen: Insn using agen
159 ;; reg: Insn not using agen
161 (define_attr "atype" "agen,reg"
162 (cond [ (eq_attr "op_type" "E") (const_string "reg")
163 (eq_attr "op_type" "RR") (const_string "reg")
164 (eq_attr "op_type" "RX") (const_string "agen")
165 (eq_attr "op_type" "RI") (const_string "reg")
166 (eq_attr "op_type" "RRE") (const_string "reg")
167 (eq_attr "op_type" "RS") (const_string "agen")
168 (eq_attr "op_type" "RSI") (const_string "agen")
169 (eq_attr "op_type" "S") (const_string "agen")
170 (eq_attr "op_type" "SI") (const_string "agen")
171 (eq_attr "op_type" "SS") (const_string "agen")
172 (eq_attr "op_type" "SSE") (const_string "agen")
173 (eq_attr "op_type" "RXE") (const_string "agen")
174 (eq_attr "op_type" "RSE") (const_string "agen")
175 (eq_attr "op_type" "RIL") (const_string "agen")
176 (eq_attr "op_type" "RXY") (const_string "agen")
177 (eq_attr "op_type" "RSY") (const_string "agen")
178 (eq_attr "op_type" "SIY") (const_string "agen")]
179 (const_string "reg")))
181 ;; Generic pipeline function unit.
183 (define_function_unit "integer" 1 0
184 (eq_attr "type" "none") 0 0)
186 (define_function_unit "integer" 1 0
187 (eq_attr "type" "integer") 1 1)
189 (define_function_unit "integer" 1 0
190 (eq_attr "type" "fsimpd") 1 1)
192 (define_function_unit "integer" 1 0
193 (eq_attr "type" "fsimps") 1 1)
195 (define_function_unit "integer" 1 0
196 (eq_attr "type" "load") 1 1)
198 (define_function_unit "integer" 1 0
199 (eq_attr "type" "floadd") 1 1)
201 (define_function_unit "integer" 1 0
202 (eq_attr "type" "floads") 1 1)
204 (define_function_unit "integer" 1 0
205 (eq_attr "type" "la") 1 1)
207 (define_function_unit "integer" 1 0
208 (eq_attr "type" "larl") 1 1)
210 (define_function_unit "integer" 1 0
211 (eq_attr "type" "lr") 1 1)
213 (define_function_unit "integer" 1 0
214 (eq_attr "type" "branch") 1 1)
216 (define_function_unit "integer" 1 0
217 (eq_attr "type" "store") 1 1)
219 (define_function_unit "integer" 1 0
220 (eq_attr "type" "fstored") 1 1)
222 (define_function_unit "integer" 1 0
223 (eq_attr "type" "fstores") 1 1)
225 (define_function_unit "integer" 1 0
226 (eq_attr "type" "lm") 2 2)
228 (define_function_unit "integer" 1 0
229 (eq_attr "type" "stm") 2 2)
231 (define_function_unit "integer" 1 0
232 (eq_attr "type" "cs") 5 5)
234 (define_function_unit "integer" 1 0
235 (eq_attr "type" "vs") 30 30)
237 (define_function_unit "integer" 1 0
238 (eq_attr "type" "jsr") 5 5)
240 (define_function_unit "integer" 1 0
241 (eq_attr "type" "imul") 7 7)
243 (define_function_unit "integer" 1 0
244 (eq_attr "type" "fmuld") 6 6)
246 (define_function_unit "integer" 1 0
247 (eq_attr "type" "fmuls") 6 6)
249 (define_function_unit "integer" 1 0
250 (eq_attr "type" "idiv") 33 33)
252 (define_function_unit "integer" 1 0
253 (eq_attr "type" "fdivd") 33 33)
255 (define_function_unit "integer" 1 0
256 (eq_attr "type" "fdivs") 33 33)
258 (define_function_unit "integer" 1 0
259 (eq_attr "type" "fsqrtd") 30 30)
261 (define_function_unit "integer" 1 0
262 (eq_attr "type" "fsqrts") 30 30)
264 (define_function_unit "integer" 1 0
265 (eq_attr "type" "ftoi") 2 2)
267 (define_function_unit "integer" 1 0
268 (eq_attr "type" "itof") 2 2)
270 (define_function_unit "integer" 1 0
271 (eq_attr "type" "o2") 2 2)
273 (define_function_unit "integer" 1 0
274 (eq_attr "type" "o3") 3 3)
276 (define_function_unit "integer" 1 0
277 (eq_attr "type" "other") 5 5)
279 ;; Pipeline description for z900
286 (define_attr "length" ""
287 (cond [ (eq_attr "op_type" "E") (const_int 2)
288 (eq_attr "op_type" "RR") (const_int 2)
289 (eq_attr "op_type" "RX") (const_int 4)
290 (eq_attr "op_type" "RI") (const_int 4)
291 (eq_attr "op_type" "RRE") (const_int 4)
292 (eq_attr "op_type" "RS") (const_int 4)
293 (eq_attr "op_type" "RSI") (const_int 4)
294 (eq_attr "op_type" "S") (const_int 4)
295 (eq_attr "op_type" "SI") (const_int 4)
296 (eq_attr "op_type" "SS") (const_int 6)
297 (eq_attr "op_type" "SSE") (const_int 6)
298 (eq_attr "op_type" "RXE") (const_int 6)
299 (eq_attr "op_type" "RSE") (const_int 6)
300 (eq_attr "op_type" "RIL") (const_int 6)
301 (eq_attr "op_type" "RXY") (const_int 6)
302 (eq_attr "op_type" "RSY") (const_int 6)
303 (eq_attr "op_type" "SIY") (const_int 6)]
306 ;; Define attributes for `asm' insns.
308 (define_asm_attributes [(set_attr "type" "other")
309 (set_attr "op_type" "NN")])
315 ; CCL: Zero Nonzero Zero Nonzero (AL, ALR, SL, SLR, N, NC, NI, NR, O, OC, OI, OR, X, XC, XI, XR)
316 ; CCA: Zero <Zero >Zero Overflow (A, AR, AH, AHI, S, SR, SH, SHI, LTR, LCR, LNR, LPR, SLA, SLDA, SLA, SRDA)
317 ; CCU: Equal ULess UGreater -- (CL, CLR, CLI, CLM)
318 ; CCS: Equal SLess SGreater -- (C, CR, CH, CHI, ICM)
319 ; CCT: Zero Mixed Mixed Ones (TM, TMH, TML)
322 ; CCZ1 -> CCA/CCU/CCS/CCT
325 ; String: CLC, CLCL, CLCLE, CLST, CUSE, MVCL, MVCLE, MVPG, MVST, SRST
326 ; Clobber: CKSM, CFC, CS, CDS, CUUTF, CUTFU, PLO, SPM, STCK, STCKE, TS, TRT, TRE, UPT
330 ;;- Compare instructions.
333 (define_expand "cmpdi"
335 (compare:CC (match_operand:DI 0 "register_operand" "")
336 (match_operand:DI 1 "general_operand" "")))]
339 s390_compare_op0 = operands[0];
340 s390_compare_op1 = operands[1];
344 (define_expand "cmpsi"
346 (compare:CC (match_operand:SI 0 "register_operand" "")
347 (match_operand:SI 1 "general_operand" "")))]
350 s390_compare_op0 = operands[0];
351 s390_compare_op1 = operands[1];
355 (define_expand "cmpdf"
357 (compare:CC (match_operand:DF 0 "register_operand" "")
358 (match_operand:DF 1 "general_operand" "")))]
361 s390_compare_op0 = operands[0];
362 s390_compare_op1 = operands[1];
366 (define_expand "cmpsf"
368 (compare:CC (match_operand:SF 0 "register_operand" "")
369 (match_operand:SF 1 "general_operand" "")))]
372 s390_compare_op0 = operands[0];
373 s390_compare_op1 = operands[1];
378 ; Test-under-Mask (zero_extract) instructions
380 (define_insn "*tmdi_ext"
382 (compare (zero_extract:DI (match_operand:DI 0 "register_operand" "d")
383 (match_operand:DI 1 "const_int_operand" "n")
384 (match_operand:DI 2 "const_int_operand" "n"))
386 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
387 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
388 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 64
389 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
390 == INTVAL (operands[2]) >> 4"
392 int part = INTVAL (operands[2]) >> 4;
393 int block = (1 << INTVAL (operands[1])) - 1;
394 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
396 operands[2] = GEN_INT (block << shift);
400 case 0: return "tmhh\t%0,%x2";
401 case 1: return "tmhl\t%0,%x2";
402 case 2: return "tmlh\t%0,%x2";
403 case 3: return "tmll\t%0,%x2";
407 [(set_attr "op_type" "RI")])
409 (define_insn "*tmsi_ext"
411 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
412 (match_operand:SI 1 "const_int_operand" "n")
413 (match_operand:SI 2 "const_int_operand" "n"))
415 "s390_match_ccmode(insn, CCTmode)
416 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
417 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
418 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
419 == INTVAL (operands[2]) >> 4"
421 int part = INTVAL (operands[2]) >> 4;
422 int block = (1 << INTVAL (operands[1])) - 1;
423 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
425 operands[2] = GEN_INT (block << shift);
429 case 0: return "tmh\t%0,%x2";
430 case 1: return "tml\t%0,%x2";
434 [(set_attr "op_type" "RI")])
436 (define_insn "*tmqisi_ext"
438 (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,S")
439 (match_operand:SI 1 "const_int_operand" "n,n")
440 (match_operand:SI 2 "const_int_operand" "n,n"))
442 "!TARGET_64BIT && s390_match_ccmode(insn, CCTmode)
443 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
444 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
446 int block = (1 << INTVAL (operands[1])) - 1;
447 int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
449 operands[2] = GEN_INT (block << shift);
450 return which_alternative == 0 ? "tm\t%0,%b2" : "tmy\t%0,%b2";
452 [(set_attr "op_type" "SI,SIY")])
454 (define_insn "*tmqidi_ext"
456 (compare (zero_extract:DI (match_operand:QI 0 "memory_operand" "Q,S")
457 (match_operand:SI 1 "const_int_operand" "n,n")
458 (match_operand:SI 2 "const_int_operand" "n,n"))
460 "TARGET_64BIT && s390_match_ccmode(insn, CCTmode)
461 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
462 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
464 int block = (1 << INTVAL (operands[1])) - 1;
465 int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
467 operands[2] = GEN_INT (block << shift);
468 return which_alternative == 0 ? "tm\t%0,%b2" : "tmy\t%0,%b2";
470 [(set_attr "op_type" "SI,SIY")])
473 ; Test-under-Mask instructions
475 (define_insn "*tmdi_mem"
477 (compare (and:DI (match_operand:DI 0 "memory_operand" "Q,S")
478 (match_operand:DI 1 "immediate_operand" "n,n"))
479 (match_operand:DI 2 "immediate_operand" "n,n")))]
480 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
481 && s390_single_part (operands[1], DImode, QImode, 0) >= 0"
483 int part = s390_single_part (operands[1], DImode, QImode, 0);
484 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
486 operands[0] = gen_rtx_MEM (QImode,
487 plus_constant (XEXP (operands[0], 0), part));
488 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
490 [(set_attr "op_type" "SI,SIY")])
492 (define_insn "*tmsi_mem"
494 (compare (and:SI (match_operand:SI 0 "memory_operand" "Q,S")
495 (match_operand:SI 1 "immediate_operand" "n,n"))
496 (match_operand:SI 2 "immediate_operand" "n,n")))]
497 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
498 && s390_single_part (operands[1], SImode, QImode, 0) >= 0"
500 int part = s390_single_part (operands[1], SImode, QImode, 0);
501 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
503 operands[0] = gen_rtx_MEM (QImode,
504 plus_constant (XEXP (operands[0], 0), part));
505 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
507 [(set_attr "op_type" "SI")])
509 (define_insn "*tmhi_mem"
511 (compare (and:SI (subreg:SI (match_operand:HI 0 "memory_operand" "Q,S") 0)
512 (match_operand:SI 1 "immediate_operand" "n,n"))
513 (match_operand:SI 2 "immediate_operand" "n,n")))]
514 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
515 && s390_single_part (operands[1], HImode, QImode, 0) >= 0"
517 int part = s390_single_part (operands[1], HImode, QImode, 0);
518 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
520 operands[0] = gen_rtx_MEM (QImode,
521 plus_constant (XEXP (operands[0], 0), part));
522 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
524 [(set_attr "op_type" "SI")])
526 (define_insn "*tmqi_mem"
528 (compare (and:SI (subreg:SI (match_operand:QI 0 "memory_operand" "Q,S") 0)
529 (match_operand:SI 1 "immediate_operand" "n,n"))
530 (match_operand:SI 2 "immediate_operand" "n,n")))]
531 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))"
535 [(set_attr "op_type" "SI,SIY")])
537 (define_insn "*tmdi_reg"
539 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
540 (match_operand:DI 1 "immediate_operand"
541 "N0HD0,N1HD0,N2HD0,N3HD0"))
542 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
544 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
545 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
551 [(set_attr "op_type" "RI")])
553 (define_insn "*tmsi_reg"
555 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
556 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
557 (match_operand:SI 2 "immediate_operand" "n,n")))]
558 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
559 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
563 [(set_attr "op_type" "RI")])
565 (define_insn "*tmhi_full"
567 (compare (match_operand:HI 0 "register_operand" "d")
568 (match_operand:HI 1 "immediate_operand" "n")))]
569 "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
571 [(set_attr "op_type" "RX")])
573 (define_insn "*tmqi_full"
575 (compare (match_operand:QI 0 "register_operand" "d")
576 (match_operand:QI 1 "immediate_operand" "n")))]
577 "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
579 [(set_attr "op_type" "RI")])
582 ; Load-and-Test instructions
584 (define_insn "*tstdi_sign"
586 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
587 (const_int 32)) (const_int 32))
588 (match_operand:DI 1 "const0_operand" "")))
589 (set (match_operand:DI 2 "register_operand" "=d")
590 (sign_extend:DI (match_dup 0)))]
591 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
593 [(set_attr "op_type" "RRE")])
595 (define_insn "*tstdi"
597 (compare (match_operand:DI 0 "register_operand" "d")
598 (match_operand:DI 1 "const0_operand" "")))
599 (set (match_operand:DI 2 "register_operand" "=d")
601 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
603 [(set_attr "op_type" "RRE")])
605 (define_insn "*tstdi_cconly"
607 (compare (match_operand:DI 0 "register_operand" "d")
608 (match_operand:DI 1 "const0_operand" "")))]
609 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
611 [(set_attr "op_type" "RRE")])
613 (define_insn "*tstdi_cconly_31"
615 (compare (match_operand:DI 0 "register_operand" "d")
616 (match_operand:DI 1 "const0_operand" "")))]
617 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
619 [(set_attr "op_type" "RS")
620 (set_attr "atype" "reg")])
623 (define_insn "*tstsi"
625 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
626 (match_operand:SI 1 "const0_operand" "")))
627 (set (match_operand:SI 2 "register_operand" "=d,d,d")
629 "s390_match_ccmode(insn, CCSmode)"
634 [(set_attr "op_type" "RR,RS,RSY")])
636 (define_insn "*tstsi_cconly"
638 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
639 (match_operand:SI 1 "const0_operand" "")))
640 (clobber (match_scratch:SI 2 "=X,d,d"))]
641 "s390_match_ccmode(insn, CCSmode)"
646 [(set_attr "op_type" "RR,RS,RSY")])
648 (define_insn "*tstsi_cconly2"
650 (compare (match_operand:SI 0 "register_operand" "d")
651 (match_operand:SI 1 "const0_operand" "")))]
652 "s390_match_ccmode(insn, CCSmode)"
654 [(set_attr "op_type" "RR")])
656 (define_insn "*tsthiCCT"
658 (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d")
659 (match_operand:HI 1 "const0_operand" "")))
660 (set (match_operand:HI 2 "register_operand" "=d,d,0")
662 "s390_match_ccmode(insn, CCTmode)"
667 [(set_attr "op_type" "RS,RSY,RI")])
669 (define_insn "*tsthiCCT_cconly"
671 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
672 (match_operand:HI 1 "const0_operand" "")))
673 (clobber (match_scratch:HI 2 "=d,d,X"))]
674 "s390_match_ccmode(insn, CCTmode)"
679 [(set_attr "op_type" "RS,RSY,RI")])
681 (define_insn "*tsthi"
683 (compare (match_operand:HI 0 "s_operand" "Q,S")
684 (match_operand:HI 1 "const0_operand" "")))
685 (set (match_operand:HI 2 "register_operand" "=d,d")
687 "s390_match_ccmode(insn, CCSmode)"
691 [(set_attr "op_type" "RS,RSY")])
693 (define_insn "*tsthi_cconly"
695 (compare (match_operand:HI 0 "s_operand" "Q,S")
696 (match_operand:HI 1 "const0_operand" "")))
697 (clobber (match_scratch:HI 2 "=d,d"))]
698 "s390_match_ccmode(insn, CCSmode)"
702 [(set_attr "op_type" "RS,RSY")])
704 (define_insn "*tstqiCCT"
706 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
707 (match_operand:QI 1 "const0_operand" "")))
708 (set (match_operand:QI 2 "register_operand" "=d,d,0")
710 "s390_match_ccmode(insn, CCTmode)"
715 [(set_attr "op_type" "RS,RSY,RI")])
717 (define_insn "*tstqiCCT_cconly"
719 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
720 (match_operand:QI 1 "const0_operand" "")))]
721 "s390_match_ccmode(insn, CCTmode)"
726 [(set_attr "op_type" "SI,SIY,RI")])
728 (define_insn "*tstqi"
730 (compare (match_operand:QI 0 "s_operand" "Q,S")
731 (match_operand:QI 1 "const0_operand" "")))
732 (set (match_operand:QI 2 "register_operand" "=d,d")
734 "s390_match_ccmode(insn, CCSmode)"
738 [(set_attr "op_type" "RS,RSY")])
740 (define_insn "*tstqi_cconly"
742 (compare (match_operand:QI 0 "s_operand" "Q,S")
743 (match_operand:QI 1 "const0_operand" "")))
744 (clobber (match_scratch:QI 2 "=d,d"))]
745 "s390_match_ccmode(insn, CCSmode)"
749 [(set_attr "op_type" "RS,RSY")])
752 ; Compare (signed) instructions
754 (define_insn "*cmpdi_ccs_sign"
756 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
757 (match_operand:DI 0 "register_operand" "d,d")))]
758 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
762 [(set_attr "op_type" "RRE,RXY")])
764 (define_insn "*cmpdi_ccs"
766 (compare (match_operand:DI 0 "register_operand" "d,d,d")
767 (match_operand:DI 1 "general_operand" "d,K,m")))]
768 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
773 [(set_attr "op_type" "RRE,RI,RXY")])
775 (define_insn "*cmpsi_ccs_sign"
777 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
778 (match_operand:SI 0 "register_operand" "d,d")))]
779 "s390_match_ccmode(insn, CCSRmode)"
783 [(set_attr "op_type" "RX,RXY")])
785 (define_insn "*cmpsi_ccs"
787 (compare (match_operand:SI 0 "register_operand" "d,d,d,d")
788 (match_operand:SI 1 "general_operand" "d,K,R,T")))]
789 "s390_match_ccmode(insn, CCSmode)"
795 [(set_attr "op_type" "RR,RI,RX,RXY")])
798 ; Compare (unsigned) instructions
800 (define_insn "*cmpdi_ccu_zero"
802 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
803 (match_operand:DI 0 "register_operand" "d,d")))]
804 "s390_match_ccmode(insn, CCURmode) && TARGET_64BIT"
808 [(set_attr "op_type" "RRE,RXY")])
810 (define_insn "*cmpdi_ccu"
812 (compare (match_operand:DI 0 "register_operand" "d,d")
813 (match_operand:DI 1 "general_operand" "d,m")))]
814 "s390_match_ccmode(insn, CCUmode) && TARGET_64BIT"
818 [(set_attr "op_type" "RRE,RXY")])
820 (define_insn "*cmpsi_ccu"
822 (compare (match_operand:SI 0 "register_operand" "d,d,d")
823 (match_operand:SI 1 "general_operand" "d,R,T")))]
824 "s390_match_ccmode(insn, CCUmode)"
829 [(set_attr "op_type" "RR,RX,RXY")])
831 (define_insn "*cmphi_ccu"
833 (compare (match_operand:HI 0 "register_operand" "d,d")
834 (match_operand:HI 1 "s_imm_operand" "Q,S")))]
835 "s390_match_ccmode(insn, CCUmode)"
839 [(set_attr "op_type" "RS,RSY")])
841 (define_insn "*cmpqi_ccu"
843 (compare (match_operand:QI 0 "register_operand" "d,d")
844 (match_operand:QI 1 "s_imm_operand" "Q,S")))]
845 "s390_match_ccmode(insn, CCUmode)"
849 [(set_attr "op_type" "RS,RSY")])
853 (compare (match_operand:QI 0 "memory_operand" "Q,S")
854 (match_operand:QI 1 "immediate_operand" "n,n")))]
855 "s390_match_ccmode (insn, CCUmode)"
859 [(set_attr "op_type" "SI,SIY")])
861 (define_insn "*cmpdi_ccu_mem"
863 (compare (match_operand:DI 0 "s_operand" "Q")
864 (match_operand:DI 1 "s_imm_operand" "Q")))]
865 "s390_match_ccmode(insn, CCUmode)"
867 [(set_attr "op_type" "SS")])
869 (define_insn "*cmpsi_ccu_mem"
871 (compare (match_operand:SI 0 "s_operand" "Q")
872 (match_operand:SI 1 "s_imm_operand" "Q")))]
873 "s390_match_ccmode(insn, CCUmode)"
875 [(set_attr "op_type" "SS")])
877 (define_insn "*cmphi_ccu_mem"
879 (compare (match_operand:HI 0 "s_operand" "Q")
880 (match_operand:HI 1 "s_imm_operand" "Q")))]
881 "s390_match_ccmode(insn, CCUmode)"
883 [(set_attr "op_type" "SS")])
885 (define_insn "*cmpqi_ccu_mem"
887 (compare (match_operand:QI 0 "s_operand" "Q")
888 (match_operand:QI 1 "s_imm_operand" "Q")))]
889 "s390_match_ccmode(insn, CCUmode)"
891 [(set_attr "op_type" "SS")])
896 (define_insn "*cmpdf_ccs_0"
898 (compare (match_operand:DF 0 "register_operand" "f")
899 (match_operand:DF 1 "const0_operand" "")))]
900 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
902 [(set_attr "op_type" "RRE")
903 (set_attr "type" "fsimpd")])
905 (define_insn "*cmpdf_ccs_0_ibm"
907 (compare (match_operand:DF 0 "register_operand" "f")
908 (match_operand:DF 1 "const0_operand" "")))]
909 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
911 [(set_attr "op_type" "RR")
912 (set_attr "type" "fsimpd")])
914 (define_insn "*cmpdf_ccs"
916 (compare (match_operand:DF 0 "register_operand" "f,f")
917 (match_operand:DF 1 "general_operand" "f,R")))]
918 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
922 [(set_attr "op_type" "RRE,RXE")
923 (set_attr "type" "fsimpd")])
925 (define_insn "*cmpdf_ccs_ibm"
927 (compare (match_operand:DF 0 "register_operand" "f,f")
928 (match_operand:DF 1 "general_operand" "f,R")))]
929 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
933 [(set_attr "op_type" "RR,RX")
934 (set_attr "type" "fsimpd")])
939 (define_insn "*cmpsf_ccs_0"
941 (compare (match_operand:SF 0 "register_operand" "f")
942 (match_operand:SF 1 "const0_operand" "")))]
943 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
945 [(set_attr "op_type" "RRE")
946 (set_attr "type" "fsimps")])
948 (define_insn "*cmpsf_ccs_0_ibm"
950 (compare (match_operand:SF 0 "register_operand" "f")
951 (match_operand:SF 1 "const0_operand" "")))]
952 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
954 [(set_attr "op_type" "RR")
955 (set_attr "type" "fsimps")])
957 (define_insn "*cmpsf_ccs"
959 (compare (match_operand:SF 0 "register_operand" "f,f")
960 (match_operand:SF 1 "general_operand" "f,R")))]
961 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
965 [(set_attr "op_type" "RRE,RXE")
966 (set_attr "type" "fsimps")])
968 (define_insn "*cmpsf_ccs"
970 (compare (match_operand:SF 0 "register_operand" "f,f")
971 (match_operand:SF 1 "general_operand" "f,R")))]
972 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
976 [(set_attr "op_type" "RR,RX")
977 (set_attr "type" "fsimps")])
981 ;;- Move instructions.
985 ; movti instruction pattern(s).
989 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
990 (match_operand:TI 1 "general_operand" "QS,d,dKm,d,Q"))]
998 [(set_attr "op_type" "RSY,RSY,NN,NN,SS")
999 (set_attr "type" "lm,stm,*,*,cs")])
1002 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1003 (match_operand:TI 1 "general_operand" ""))]
1004 "TARGET_64BIT && reload_completed
1005 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
1006 [(set (match_dup 2) (match_dup 4))
1007 (set (match_dup 3) (match_dup 5))]
1009 operands[2] = operand_subword (operands[0], 0, 0, TImode);
1010 operands[3] = operand_subword (operands[0], 1, 0, TImode);
1011 operands[4] = operand_subword (operands[1], 0, 0, TImode);
1012 operands[5] = operand_subword (operands[1], 1, 0, TImode);
1016 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1017 (match_operand:TI 1 "general_operand" ""))]
1018 "TARGET_64BIT && reload_completed
1019 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
1020 [(set (match_dup 2) (match_dup 4))
1021 (set (match_dup 3) (match_dup 5))]
1023 operands[2] = operand_subword (operands[0], 1, 0, TImode);
1024 operands[3] = operand_subword (operands[0], 0, 0, TImode);
1025 operands[4] = operand_subword (operands[1], 1, 0, TImode);
1026 operands[5] = operand_subword (operands[1], 0, 0, TImode);
1030 [(set (match_operand:TI 0 "register_operand" "")
1031 (match_operand:TI 1 "memory_operand" ""))]
1032 "TARGET_64BIT && reload_completed
1033 && !s_operand (operands[1], VOIDmode)"
1034 [(set (match_dup 0) (match_dup 1))]
1036 rtx addr = operand_subword (operands[0], 1, 0, TImode);
1037 s390_load_address (addr, XEXP (operands[1], 0));
1038 operands[1] = replace_equiv_address (operands[1], addr);
1041 (define_expand "reload_outti"
1042 [(parallel [(match_operand:TI 0 "memory_operand" "")
1043 (match_operand:TI 1 "register_operand" "d")
1044 (match_operand:DI 2 "register_operand" "=&a")])]
1047 s390_load_address (operands[2], XEXP (operands[0], 0));
1048 operands[0] = replace_equiv_address (operands[0], operands[2]);
1049 emit_move_insn (operands[0], operands[1]);
1054 ; movdi instruction pattern(s).
1057 (define_expand "movdi"
1058 [(set (match_operand:DI 0 "general_operand" "")
1059 (match_operand:DI 1 "general_operand" ""))]
1062 /* Handle symbolic constants. */
1063 if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1064 emit_symbolic_move (operands);
1066 /* During and after reload, we need to force constants
1067 to the literal pool ourselves, if necessary. */
1068 if ((reload_in_progress || reload_completed)
1069 && CONSTANT_P (operands[1])
1070 && (!legitimate_reload_constant_p (operands[1])
1071 || FP_REG_P (operands[0])))
1072 operands[1] = force_const_mem (DImode, operands[1]);
1075 (define_insn "*movdi_larl"
1076 [(set (match_operand:DI 0 "register_operand" "=d")
1077 (match_operand:DI 1 "larl_operand" "X"))]
1079 && !FP_REG_P (operands[0])"
1081 [(set_attr "op_type" "RIL")
1082 (set_attr "type" "larl")])
1084 (define_insn "*movdi_64"
1085 [(set (match_operand:DI 0 "nonimmediate_operand"
1086 "=d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,?Q")
1087 (match_operand:DI 1 "general_operand"
1088 "K,N0HD0,N1HD0,N2HD0,N3HD0,L,d,m,d,*f,R,T,*f,*f,?Q"))]
1106 [(set_attr "op_type" "RI,RI,RI,RI,RI,RXY,RRE,RXY,RXY,RR,RX,RXY,RX,RXY,SS")
1107 (set_attr "type" "*,*,*,*,*,la,lr,load,store,floadd,floadd,floadd,
1108 fstored,fstored,cs")])
1110 (define_insn "*movdi_31"
1111 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,o,!*f,!*f,!*f,!R,!T,Q")
1112 (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,R,T,*f,*f,Q"))]
1125 [(set_attr "op_type" "RS,RS,NN,NN,RR,RX,RXY,RX,RXY,SS")
1126 (set_attr "type" "lm,stm,*,*,floadd,floadd,floadd,fstored,fstored,cs")])
1129 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1130 (match_operand:DI 1 "general_operand" ""))]
1131 "!TARGET_64BIT && reload_completed
1132 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1133 [(set (match_dup 2) (match_dup 4))
1134 (set (match_dup 3) (match_dup 5))]
1136 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1137 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1138 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1139 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1143 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1144 (match_operand:DI 1 "general_operand" ""))]
1145 "!TARGET_64BIT && reload_completed
1146 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1147 [(set (match_dup 2) (match_dup 4))
1148 (set (match_dup 3) (match_dup 5))]
1150 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1151 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1152 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1153 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1157 [(set (match_operand:DI 0 "register_operand" "")
1158 (match_operand:DI 1 "memory_operand" ""))]
1159 "!TARGET_64BIT && reload_completed
1160 && !FP_REG_P (operands[0])
1161 && !s_operand (operands[1], VOIDmode)"
1162 [(set (match_dup 0) (match_dup 1))]
1164 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1165 s390_load_address (addr, XEXP (operands[1], 0));
1166 operands[1] = replace_equiv_address (operands[1], addr);
1169 (define_expand "reload_outdi"
1170 [(parallel [(match_operand:DI 0 "memory_operand" "")
1171 (match_operand:DI 1 "register_operand" "d")
1172 (match_operand:SI 2 "register_operand" "=&a")])]
1175 s390_load_address (operands[2], XEXP (operands[0], 0));
1176 operands[0] = replace_equiv_address (operands[0], operands[2]);
1177 emit_move_insn (operands[0], operands[1]);
1182 [(set (match_operand:DI 0 "register_operand" "")
1183 (mem:DI (match_operand 1 "address_operand" "")))]
1185 && !FP_REG_P (operands[0])
1186 && GET_CODE (operands[1]) == SYMBOL_REF
1187 && CONSTANT_POOL_ADDRESS_P (operands[1])
1188 && get_pool_mode (operands[1]) == DImode
1189 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1190 [(set (match_dup 0) (match_dup 2))]
1191 "operands[2] = get_pool_constant (operands[1]);")
1193 (define_insn "*la_64"
1194 [(set (match_operand:DI 0 "register_operand" "=d,d")
1195 (match_operand:QI 1 "address_operand" "U,W"))]
1200 [(set_attr "op_type" "RX,RXY")
1201 (set_attr "type" "la")])
1205 [(set (match_operand:DI 0 "register_operand" "")
1206 (match_operand:QI 1 "address_operand" ""))
1207 (clobber (reg:CC 33))])]
1209 && strict_memory_address_p (VOIDmode, operands[1])
1210 && preferred_la_operand_p (operands[1])"
1211 [(set (match_dup 0) (match_dup 1))]
1215 [(set (match_operand:DI 0 "register_operand" "")
1216 (match_operand:DI 1 "register_operand" ""))
1219 (plus:DI (match_dup 0)
1220 (match_operand:DI 2 "nonmemory_operand" "")))
1221 (clobber (reg:CC 33))])]
1223 && !reg_overlap_mentioned_p (operands[0], operands[2])
1224 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (DImode, operands[1], operands[2]))
1225 && preferred_la_operand_p (gen_rtx_PLUS (DImode, operands[1], operands[2]))"
1226 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1229 (define_expand "reload_indi"
1230 [(parallel [(match_operand:DI 0 "register_operand" "=a")
1231 (match_operand:DI 1 "s390_plus_operand" "")
1232 (match_operand:DI 2 "register_operand" "=&a")])]
1235 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1240 ; movsi instruction pattern(s).
1243 (define_expand "movsi"
1244 [(set (match_operand:SI 0 "general_operand" "")
1245 (match_operand:SI 1 "general_operand" ""))]
1248 /* Handle symbolic constants. */
1249 if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1250 emit_symbolic_move (operands);
1252 /* expr.c tries to load an effective address using
1253 force_reg. This fails because we don't have a
1254 generic load_address pattern. Convert the move
1255 to a proper arithmetic operation instead, unless
1256 it is guaranteed to be OK. */
1257 if (GET_CODE (operands[1]) == PLUS
1258 && !legitimate_la_operand_p (operands[1]))
1260 operands[1] = force_operand (operands[1], operands[0]);
1261 if (operands[1] == operands[0])
1265 /* During and after reload, we need to force constants
1266 to the literal pool ourselves, if necessary. */
1267 if ((reload_in_progress || reload_completed)
1268 && CONSTANT_P (operands[1])
1269 && (!legitimate_reload_constant_p (operands[1])
1270 || FP_REG_P (operands[0])))
1271 operands[1] = force_const_mem (SImode, operands[1]);
1274 (define_insn "*movsi_larl"
1275 [(set (match_operand:SI 0 "register_operand" "=d")
1276 (match_operand:SI 1 "larl_operand" "X"))]
1277 "!TARGET_64BIT && TARGET_CPU_ZARCH
1278 && !FP_REG_P (operands[0])"
1280 [(set_attr "op_type" "RIL")
1281 (set_attr "type" "larl")])
1283 (define_insn "*movsi_zarch"
1284 [(set (match_operand:SI 0 "nonimmediate_operand"
1285 "=d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,?Q")
1286 (match_operand:SI 1 "general_operand"
1287 "K,N0HS0,N1HS0,L,d,R,T,d,d,*f,R,T,*f,*f,?Q"))]
1305 [(set_attr "op_type" "RI,RI,RI,RXY,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1306 (set_attr "type" "*,*,*,la,lr,load,load,store,store,floads,floads,floads,fstores,fstores,cs")])
1308 (define_insn "*movsi_esa"
1309 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,?Q")
1310 (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,?Q"))]
1321 [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,SS")
1322 (set_attr "type" "*,lr,load,store,floads,floads,fstores,cs")])
1325 [(set (match_operand:SI 0 "register_operand" "")
1326 (mem:SI (match_operand 1 "address_operand" "")))]
1327 "!FP_REG_P (operands[0])
1328 && GET_CODE (operands[1]) == SYMBOL_REF
1329 && CONSTANT_POOL_ADDRESS_P (operands[1])
1330 && get_pool_mode (operands[1]) == SImode
1331 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1332 [(set (match_dup 0) (match_dup 2))]
1333 "operands[2] = get_pool_constant (operands[1]);")
1335 (define_insn "*la_31"
1336 [(set (match_operand:SI 0 "register_operand" "=d,d")
1337 (match_operand:QI 1 "address_operand" "U,W"))]
1338 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1342 [(set_attr "op_type" "RX,RXY")
1343 (set_attr "type" "la")])
1347 [(set (match_operand:SI 0 "register_operand" "")
1348 (match_operand:QI 1 "address_operand" ""))
1349 (clobber (reg:CC 33))])]
1351 && strict_memory_address_p (VOIDmode, operands[1])
1352 && preferred_la_operand_p (operands[1])"
1353 [(set (match_dup 0) (match_dup 1))]
1357 [(set (match_operand:SI 0 "register_operand" "")
1358 (match_operand:SI 1 "register_operand" ""))
1361 (plus:SI (match_dup 0)
1362 (match_operand:SI 2 "nonmemory_operand" "")))
1363 (clobber (reg:CC 33))])]
1365 && !reg_overlap_mentioned_p (operands[0], operands[2])
1366 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
1367 && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
1368 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1371 (define_insn "*la_31_and"
1372 [(set (match_operand:SI 0 "register_operand" "=d,d")
1373 (and:SI (match_operand:QI 1 "address_operand" "U,W")
1374 (const_int 2147483647)))]
1379 [(set_attr "op_type" "RX,RXY")
1380 (set_attr "type" "la")])
1382 (define_insn_and_split "*la_31_and_cc"
1383 [(set (match_operand:SI 0 "register_operand" "=d")
1384 (and:SI (match_operand:QI 1 "address_operand" "p")
1385 (const_int 2147483647)))
1386 (clobber (reg:CC 33))]
1389 "&& reload_completed"
1391 (and:SI (match_dup 1) (const_int 2147483647)))]
1393 [(set_attr "op_type" "RX")
1394 (set_attr "type" "la")])
1396 (define_insn "force_la_31"
1397 [(set (match_operand:SI 0 "register_operand" "=d,d")
1398 (match_operand:QI 1 "address_operand" "U,W"))
1399 (use (const_int 0))]
1404 [(set_attr "op_type" "RX")
1405 (set_attr "type" "la")])
1407 (define_expand "reload_insi"
1408 [(parallel [(match_operand:SI 0 "register_operand" "=a")
1409 (match_operand:SI 1 "s390_plus_operand" "")
1410 (match_operand:SI 2 "register_operand" "=&a")])]
1413 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1418 ; movhi instruction pattern(s).
1421 (define_expand "movhi"
1422 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1423 (match_operand:HI 1 "general_operand" ""))]
1426 /* Make it explicit that loading a register from memory
1427 always sign-extends (at least) to SImode. */
1428 if (optimize && !no_new_pseudos
1429 && register_operand (operands[0], VOIDmode)
1430 && GET_CODE (operands[1]) == MEM
1431 && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
1433 rtx tmp = gen_reg_rtx (SImode);
1434 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1435 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1436 operands[1] = gen_lowpart (HImode, tmp);
1440 (define_insn "*movhi"
1441 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1442 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1452 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1453 (set_attr "type" "lr,*,*,*,store,store,cs")])
1456 [(set (match_operand:HI 0 "register_operand" "")
1457 (mem:HI (match_operand 1 "address_operand" "")))]
1458 "GET_CODE (operands[1]) == SYMBOL_REF
1459 && CONSTANT_POOL_ADDRESS_P (operands[1])
1460 && get_pool_mode (operands[1]) == HImode
1461 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1462 [(set (match_dup 0) (match_dup 2))]
1463 "operands[2] = get_pool_constant (operands[1]);")
1466 ; movqi instruction pattern(s).
1469 (define_expand "movqi"
1470 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1471 (match_operand:QI 1 "general_operand" ""))]
1474 /* On z/Architecture, zero-extending from memory to register
1475 is just as fast as a QImode load. */
1476 if (TARGET_ZARCH && optimize && !no_new_pseudos
1477 && register_operand (operands[0], VOIDmode)
1478 && GET_CODE (operands[1]) == MEM
1479 && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
1481 rtx tmp = gen_reg_rtx (word_mode);
1482 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1483 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1484 operands[1] = gen_lowpart (QImode, tmp);
1488 (define_insn "*movqi"
1489 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1490 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1502 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1503 (set_attr "type" "lr,*,*,*,store,store,store,store,cs")])
1506 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1507 (mem:QI (match_operand 1 "address_operand" "")))]
1508 "GET_CODE (operands[1]) == SYMBOL_REF
1509 && CONSTANT_POOL_ADDRESS_P (operands[1])
1510 && get_pool_mode (operands[1]) == QImode
1511 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1512 [(set (match_dup 0) (match_dup 2))]
1513 "operands[2] = get_pool_constant (operands[1]);")
1516 ; movstrictqi instruction pattern(s).
1519 (define_insn "*movstrictqi"
1520 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1521 (match_operand:QI 1 "memory_operand" "R,T"))]
1526 [(set_attr "op_type" "RX,RXY")])
1529 ; movstricthi instruction pattern(s).
1532 (define_insn "*movstricthi"
1533 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1534 (match_operand:HI 1 "s_imm_operand" "Q,S"))
1535 (clobber (reg:CC 33))]
1540 [(set_attr "op_type" "RS,RSY")])
1543 ; movstrictsi instruction pattern(s).
1546 (define_insn "movstrictsi"
1547 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d"))
1548 (match_operand:SI 1 "general_operand" "d,R,T"))]
1554 [(set_attr "op_type" "RR,RX,RXY")
1555 (set_attr "type" "lr,load,load")])
1558 ; movdf instruction pattern(s).
1561 (define_expand "movdf"
1562 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1563 (match_operand:DF 1 "general_operand" ""))]
1566 /* During and after reload, we need to force constants
1567 to the literal pool ourselves, if necessary. */
1568 if ((reload_in_progress || reload_completed)
1569 && CONSTANT_P (operands[1]))
1570 operands[1] = force_const_mem (DFmode, operands[1]);
1573 (define_insn "*movdf_64"
1574 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1575 (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1587 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1588 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,cs")])
1590 (define_insn "*movdf_31"
1591 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1592 (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1605 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,NN,NN,SS")
1606 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,cs")])
1609 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1610 (match_operand:DF 1 "general_operand" ""))]
1611 "!TARGET_64BIT && reload_completed
1612 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1613 [(set (match_dup 2) (match_dup 4))
1614 (set (match_dup 3) (match_dup 5))]
1616 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1617 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1618 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1619 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1623 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1624 (match_operand:DF 1 "general_operand" ""))]
1625 "!TARGET_64BIT && reload_completed
1626 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1627 [(set (match_dup 2) (match_dup 4))
1628 (set (match_dup 3) (match_dup 5))]
1630 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1631 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1632 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1633 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1637 [(set (match_operand:DF 0 "register_operand" "")
1638 (match_operand:DF 1 "memory_operand" ""))]
1639 "!TARGET_64BIT && reload_completed
1640 && !FP_REG_P (operands[0])
1641 && !s_operand (operands[1], VOIDmode)"
1642 [(set (match_dup 0) (match_dup 1))]
1644 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1645 s390_load_address (addr, XEXP (operands[1], 0));
1646 operands[1] = replace_equiv_address (operands[1], addr);
1649 (define_expand "reload_outdf"
1650 [(parallel [(match_operand:DF 0 "memory_operand" "")
1651 (match_operand:DF 1 "register_operand" "d")
1652 (match_operand:SI 2 "register_operand" "=&a")])]
1655 s390_load_address (operands[2], XEXP (operands[0], 0));
1656 operands[0] = replace_equiv_address (operands[0], operands[2]);
1657 emit_move_insn (operands[0], operands[1]);
1662 ; movsf instruction pattern(s).
1665 (define_expand "movsf"
1666 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1667 (match_operand:SF 1 "general_operand" ""))]
1670 /* During and after reload, we need to force constants
1671 to the literal pool ourselves, if necessary. */
1672 if ((reload_in_progress || reload_completed)
1673 && CONSTANT_P (operands[1]))
1674 operands[1] = force_const_mem (SFmode, operands[1]);
1677 (define_insn "*movsf"
1678 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1679 (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1693 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1694 (set_attr "type" "floads,floads,floads,fstores,fstores,lr,load,load,store,store,cs")])
1697 ; load_multiple pattern(s).
1699 ; ??? Due to reload problems with replacing registers inside match_parallel
1700 ; we currently support load_multiple/store_multiple only after reload.
1703 (define_expand "load_multiple"
1704 [(match_par_dup 3 [(set (match_operand 0 "" "")
1705 (match_operand 1 "" ""))
1706 (use (match_operand 2 "" ""))])]
1709 enum machine_mode mode;
1715 /* Support only loading a constant number of fixed-point registers from
1716 memory and only bother with this if more than two */
1717 if (GET_CODE (operands[2]) != CONST_INT
1718 || INTVAL (operands[2]) < 2
1719 || INTVAL (operands[2]) > 16
1720 || GET_CODE (operands[1]) != MEM
1721 || GET_CODE (operands[0]) != REG
1722 || REGNO (operands[0]) >= 16)
1725 count = INTVAL (operands[2]);
1726 regno = REGNO (operands[0]);
1727 mode = GET_MODE (operands[0]);
1728 if (mode != SImode && mode != word_mode)
1731 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1734 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1736 from = XEXP (operands[1], 0);
1739 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1740 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1741 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1743 from = XEXP (XEXP (operands[1], 0), 0);
1744 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1749 if (from == frame_pointer_rtx || from == arg_pointer_rtx)
1754 from = force_reg (Pmode, XEXP (operands[1], 0));
1758 for (i = 0; i < count; i++)
1759 XVECEXP (operands[3], 0, i)
1760 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1761 change_address (operands[1], mode,
1762 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1765 (define_insn "*load_multiple_di"
1766 [(match_parallel 0 "load_multiple_operation"
1767 [(set (match_operand:DI 1 "register_operand" "=r")
1768 (match_operand:DI 2 "s_operand" "QS"))])]
1769 "reload_completed && word_mode == DImode"
1771 int words = XVECLEN (operands[0], 0);
1772 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1773 return "lmg\t%1,%0,%2";
1775 [(set_attr "op_type" "RSY")
1776 (set_attr "type" "lm")])
1778 (define_insn "*load_multiple_si"
1779 [(match_parallel 0 "load_multiple_operation"
1780 [(set (match_operand:SI 1 "register_operand" "=r,r")
1781 (match_operand:SI 2 "s_operand" "Q,S"))])]
1784 int words = XVECLEN (operands[0], 0);
1785 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1786 return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1788 [(set_attr "op_type" "RS,RSY")
1789 (set_attr "type" "lm")])
1792 ; store multiple pattern(s).
1795 (define_expand "store_multiple"
1796 [(match_par_dup 3 [(set (match_operand 0 "" "")
1797 (match_operand 1 "" ""))
1798 (use (match_operand 2 "" ""))])]
1801 enum machine_mode mode;
1807 /* Support only storing a constant number of fixed-point registers to
1808 memory and only bother with this if more than two. */
1809 if (GET_CODE (operands[2]) != CONST_INT
1810 || INTVAL (operands[2]) < 2
1811 || INTVAL (operands[2]) > 16
1812 || GET_CODE (operands[0]) != MEM
1813 || GET_CODE (operands[1]) != REG
1814 || REGNO (operands[1]) >= 16)
1817 count = INTVAL (operands[2]);
1818 regno = REGNO (operands[1]);
1819 mode = GET_MODE (operands[1]);
1820 if (mode != SImode && mode != word_mode)
1823 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1827 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1829 to = XEXP (operands[0], 0);
1832 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1833 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1834 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1836 to = XEXP (XEXP (operands[0], 0), 0);
1837 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1842 if (to == frame_pointer_rtx || to == arg_pointer_rtx)
1847 to = force_reg (Pmode, XEXP (operands[0], 0));
1851 for (i = 0; i < count; i++)
1852 XVECEXP (operands[3], 0, i)
1853 = gen_rtx_SET (VOIDmode,
1854 change_address (operands[0], mode,
1855 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1856 gen_rtx_REG (mode, regno + i));
1859 (define_insn "*store_multiple_di"
1860 [(match_parallel 0 "store_multiple_operation"
1861 [(set (match_operand:DI 1 "s_operand" "=QS")
1862 (match_operand:DI 2 "register_operand" "r"))])]
1863 "reload_completed && word_mode == DImode"
1865 int words = XVECLEN (operands[0], 0);
1866 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1867 return "stmg\t%2,%0,%1";
1869 [(set_attr "op_type" "RSY")
1870 (set_attr "type" "stm")])
1873 (define_insn "*store_multiple_si"
1874 [(match_parallel 0 "store_multiple_operation"
1875 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1876 (match_operand:SI 2 "register_operand" "r,r"))])]
1879 int words = XVECLEN (operands[0], 0);
1880 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1881 return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1883 [(set_attr "op_type" "RS,RSY")
1884 (set_attr "type" "stm")])
1887 ;; String instructions.
1891 ; strlenM instruction pattern(s).
1894 (define_expand "strlendi"
1895 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1898 (unspec:DI [(const_int 0)
1899 (match_operand:BLK 1 "memory_operand" "")
1901 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1902 (clobber (scratch:DI))
1903 (clobber (reg:CC 33))])
1905 [(set (match_operand:DI 0 "register_operand" "")
1906 (minus:DI (match_dup 4) (match_dup 5)))
1907 (clobber (reg:CC 33))])]
1910 operands[4] = gen_reg_rtx (DImode);
1911 operands[5] = gen_reg_rtx (DImode);
1912 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1913 operands[1] = replace_equiv_address (operands[1], operands[5]);
1916 (define_insn "*strlendi"
1917 [(set (match_operand:DI 0 "register_operand" "=a")
1918 (unspec:DI [(match_operand:DI 2 "general_operand" "0")
1919 (mem:BLK (match_operand:DI 3 "register_operand" "1"))
1921 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1922 (clobber (match_scratch:DI 1 "=a"))
1923 (clobber (reg:CC 33))]
1925 "srst\t%0,%1\;jo\t.-4"
1926 [(set_attr "op_type" "NN")
1927 (set_attr "type" "vs")
1928 (set_attr "length" "8")])
1930 (define_expand "strlensi"
1931 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1934 (unspec:SI [(const_int 0)
1935 (match_operand:BLK 1 "memory_operand" "")
1937 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1938 (clobber (scratch:SI))
1939 (clobber (reg:CC 33))])
1941 [(set (match_operand:SI 0 "register_operand" "")
1942 (minus:SI (match_dup 4) (match_dup 5)))
1943 (clobber (reg:CC 33))])]
1946 operands[4] = gen_reg_rtx (SImode);
1947 operands[5] = gen_reg_rtx (SImode);
1948 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1949 operands[1] = replace_equiv_address (operands[1], operands[5]);
1952 (define_insn "*strlensi"
1953 [(set (match_operand:SI 0 "register_operand" "=a")
1954 (unspec:SI [(match_operand:SI 2 "general_operand" "0")
1955 (mem:BLK (match_operand:SI 3 "register_operand" "1"))
1957 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1958 (clobber (match_scratch:SI 1 "=a"))
1959 (clobber (reg:CC 33))]
1961 "srst\t%0,%1\;jo\t.-4"
1962 [(set_attr "op_type" "NN")
1963 (set_attr "type" "vs")
1964 (set_attr "length" "8")])
1967 ; movstrM instruction pattern(s).
1970 (define_expand "movstrdi"
1971 [(set (match_operand:BLK 0 "memory_operand" "")
1972 (match_operand:BLK 1 "memory_operand" ""))
1973 (use (match_operand:DI 2 "general_operand" ""))
1974 (match_operand 3 "" "")]
1976 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1978 (define_expand "movstrsi"
1979 [(set (match_operand:BLK 0 "memory_operand" "")
1980 (match_operand:BLK 1 "memory_operand" ""))
1981 (use (match_operand:SI 2 "general_operand" ""))
1982 (match_operand 3 "" "")]
1984 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1986 ; Move a block that is up to 256 bytes in length.
1987 ; The block length is taken as (operands[2] % 256) + 1.
1989 (define_expand "movstr_short"
1991 [(set (match_operand:BLK 0 "memory_operand" "")
1992 (match_operand:BLK 1 "memory_operand" ""))
1993 (use (match_operand 2 "nonmemory_operand" ""))
1994 (clobber (match_dup 3))])]
1996 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1998 (define_insn "*movstr_short"
1999 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
2000 (match_operand:BLK 1 "memory_operand" "Q,Q"))
2001 (use (match_operand 2 "nonmemory_operand" "n,a"))
2002 (clobber (match_scratch 3 "=X,&a"))]
2003 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2004 && GET_MODE (operands[3]) == Pmode"
2006 switch (which_alternative)
2009 return "mvc\t%O0(%b2+1,%R0),%1";
2012 output_asm_insn ("bras\t%3,.+10", operands);
2013 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
2014 return "ex\t%2,0(%3)";
2020 [(set_attr "op_type" "SS,NN")
2021 (set_attr "type" "cs,cs")
2022 (set_attr "atype" "*,agen")
2023 (set_attr "length" "*,14")])
2025 ; Move a block of arbitrary length.
2027 (define_expand "movstr_long"
2029 [(clobber (match_dup 2))
2030 (clobber (match_dup 3))
2031 (set (match_operand:BLK 0 "memory_operand" "")
2032 (match_operand:BLK 1 "memory_operand" ""))
2033 (use (match_operand 2 "general_operand" ""))
2035 (clobber (reg:CC 33))])]
2038 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2039 rtx reg0 = gen_reg_rtx (dword_mode);
2040 rtx reg1 = gen_reg_rtx (dword_mode);
2041 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2042 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2043 rtx len0 = gen_lowpart (Pmode, reg0);
2044 rtx len1 = gen_lowpart (Pmode, reg1);
2046 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2047 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2048 emit_move_insn (len0, operands[2]);
2050 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2051 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2052 emit_move_insn (len1, operands[2]);
2054 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2055 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2060 (define_insn "*movstr_long_64"
2061 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2062 (clobber (match_operand:TI 1 "register_operand" "=d"))
2063 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2064 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
2067 (clobber (reg:CC 33))]
2069 "mvcle\t%0,%1,0\;jo\t.-4"
2070 [(set_attr "op_type" "NN")
2071 (set_attr "type" "vs")
2072 (set_attr "length" "8")])
2074 (define_insn "*movstr_long_31"
2075 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2076 (clobber (match_operand:DI 1 "register_operand" "=d"))
2077 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2078 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
2081 (clobber (reg:CC 33))]
2083 "mvcle\t%0,%1,0\;jo\t.-4"
2084 [(set_attr "op_type" "NN")
2085 (set_attr "type" "vs")
2086 (set_attr "length" "8")])
2089 ; clrstrM instruction pattern(s).
2092 (define_expand "clrstrdi"
2093 [(set (match_operand:BLK 0 "memory_operand" "")
2095 (use (match_operand:DI 1 "general_operand" ""))
2096 (match_operand 2 "" "")]
2098 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
2100 (define_expand "clrstrsi"
2101 [(set (match_operand:BLK 0 "memory_operand" "")
2103 (use (match_operand:SI 1 "general_operand" ""))
2104 (match_operand 2 "" "")]
2106 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
2108 ; Clear a block that is up to 256 bytes in length.
2109 ; The block length is taken as (operands[1] % 256) + 1.
2111 (define_expand "clrstr_short"
2113 [(set (match_operand:BLK 0 "memory_operand" "")
2115 (use (match_operand 1 "nonmemory_operand" ""))
2116 (clobber (match_dup 2))
2117 (clobber (reg:CC 33))])]
2119 "operands[2] = gen_rtx_SCRATCH (Pmode);")
2121 (define_insn "*clrstr_short"
2122 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
2124 (use (match_operand 1 "nonmemory_operand" "n,a"))
2125 (clobber (match_scratch 2 "=X,&a"))
2126 (clobber (reg:CC 33))]
2127 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
2128 && GET_MODE (operands[2]) == Pmode"
2130 switch (which_alternative)
2133 return "xc\t%O0(%b1+1,%R0),%0";
2136 output_asm_insn ("bras\t%2,.+10", operands);
2137 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
2138 return "ex\t%1,0(%2)";
2144 [(set_attr "op_type" "SS,NN")
2145 (set_attr "type" "cs,cs")
2146 (set_attr "atype" "*,agen")
2147 (set_attr "length" "*,14")])
2149 ; Clear a block of arbitrary length.
2151 (define_expand "clrstr_long"
2153 [(clobber (match_dup 1))
2154 (set (match_operand:BLK 0 "memory_operand" "")
2156 (use (match_operand 1 "general_operand" ""))
2158 (clobber (reg:CC 33))])]
2161 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2162 rtx reg0 = gen_reg_rtx (dword_mode);
2163 rtx reg1 = gen_reg_rtx (dword_mode);
2164 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2165 rtx len0 = gen_lowpart (Pmode, reg0);
2167 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2168 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2169 emit_move_insn (len0, operands[1]);
2171 emit_move_insn (reg1, const0_rtx);
2173 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2178 (define_insn "*clrstr_long_64"
2179 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2180 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2183 (use (match_operand:TI 1 "register_operand" "d"))
2184 (clobber (reg:CC 33))]
2186 "mvcle\t%0,%1,0\;jo\t.-4"
2187 [(set_attr "op_type" "NN")
2188 (set_attr "type" "vs")
2189 (set_attr "length" "8")])
2191 (define_insn "*clrstr_long_31"
2192 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2193 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2196 (use (match_operand:DI 1 "register_operand" "d"))
2197 (clobber (reg:CC 33))]
2199 "mvcle\t%0,%1,0\;jo\t.-4"
2200 [(set_attr "op_type" "NN")
2201 (set_attr "type" "vs")
2202 (set_attr "length" "8")])
2205 ; cmpmemM instruction pattern(s).
2208 (define_expand "cmpmemdi"
2209 [(set (match_operand:DI 0 "register_operand" "")
2210 (compare:DI (match_operand:BLK 1 "memory_operand" "")
2211 (match_operand:BLK 2 "memory_operand" "") ) )
2212 (use (match_operand:DI 3 "general_operand" ""))
2213 (use (match_operand:DI 4 "" ""))]
2215 "s390_expand_cmpmem (operands[0], operands[1],
2216 operands[2], operands[3]); DONE;")
2218 (define_expand "cmpmemsi"
2219 [(set (match_operand:SI 0 "register_operand" "")
2220 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2221 (match_operand:BLK 2 "memory_operand" "") ) )
2222 (use (match_operand:SI 3 "general_operand" ""))
2223 (use (match_operand:SI 4 "" ""))]
2225 "s390_expand_cmpmem (operands[0], operands[1],
2226 operands[2], operands[3]); DONE;")
2228 ; Compare a block that is up to 256 bytes in length.
2229 ; The block length is taken as (operands[2] % 256) + 1.
2231 (define_expand "cmpmem_short"
2234 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2235 (match_operand:BLK 1 "memory_operand" "")))
2236 (use (match_operand 2 "nonmemory_operand" ""))
2237 (clobber (match_dup 3))])]
2239 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2241 (define_insn "*cmpmem_short"
2243 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2244 (match_operand:BLK 1 "memory_operand" "Q,Q")))
2245 (use (match_operand 2 "nonmemory_operand" "n,a"))
2246 (clobber (match_scratch 3 "=X,&a"))]
2247 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2248 && GET_MODE (operands[3]) == Pmode"
2250 switch (which_alternative)
2253 return "clc\t%O0(%b2+1,%R0),%1";
2256 output_asm_insn ("bras\t%3,.+10", operands);
2257 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2258 return "ex\t%2,0(%3)";
2264 [(set_attr "op_type" "SS,NN")
2265 (set_attr "type" "cs,cs")
2266 (set_attr "atype" "*,agen")
2267 (set_attr "length" "*,14")])
2269 ; Compare a block of arbitrary length.
2271 (define_expand "cmpmem_long"
2273 [(clobber (match_dup 2))
2274 (clobber (match_dup 3))
2276 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2277 (match_operand:BLK 1 "memory_operand" "")))
2278 (use (match_operand 2 "general_operand" ""))
2279 (use (match_dup 3))])]
2282 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2283 rtx reg0 = gen_reg_rtx (dword_mode);
2284 rtx reg1 = gen_reg_rtx (dword_mode);
2285 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2286 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2287 rtx len0 = gen_lowpart (Pmode, reg0);
2288 rtx len1 = gen_lowpart (Pmode, reg1);
2290 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2291 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2292 emit_move_insn (len0, operands[2]);
2294 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2295 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2296 emit_move_insn (len1, operands[2]);
2298 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2299 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2304 (define_insn "*cmpmem_long_64"
2305 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2306 (clobber (match_operand:TI 1 "register_operand" "=d"))
2308 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2309 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2311 (use (match_dup 3))]
2313 "clcle\t%0,%1,0\;jo\t.-4"
2314 [(set_attr "op_type" "NN")
2315 (set_attr "type" "vs")
2316 (set_attr "length" "8")])
2318 (define_insn "*cmpmem_long_31"
2319 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2320 (clobber (match_operand:DI 1 "register_operand" "=d"))
2322 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2323 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2325 (use (match_dup 3))]
2327 "clcle\t%0,%1,0\;jo\t.-4"
2328 [(set_attr "op_type" "NN")
2329 (set_attr "type" "vs")
2330 (set_attr "length" "8")])
2332 ; Convert condition code to integer in range (-1, 0, 1)
2334 (define_insn "cmpint_si"
2335 [(set (match_operand:SI 0 "register_operand" "=d")
2336 (compare:SI (reg:CCS 33) (const_int 0)))]
2339 output_asm_insn ("lhi\t%0,1", operands);
2340 output_asm_insn ("jh\t.+12", operands);
2341 output_asm_insn ("jl\t.+6", operands);
2342 output_asm_insn ("sr\t%0,%0", operands);
2343 return "lcr\t%0,%0";
2345 [(set_attr "op_type" "NN")
2346 (set_attr "length" "16")
2347 (set_attr "type" "other")])
2349 (define_insn "cmpint_di"
2350 [(set (match_operand:DI 0 "register_operand" "=d")
2351 (compare:DI (reg:CCS 33) (const_int 0)))]
2354 output_asm_insn ("lghi\t%0,1", operands);
2355 output_asm_insn ("jh\t.+16", operands);
2356 output_asm_insn ("jl\t.+8", operands);
2357 output_asm_insn ("sgr\t%0,%0", operands);
2358 return "lcgr\t%0,%0";
2360 [(set_attr "op_type" "NN")
2361 (set_attr "length" "20")
2362 (set_attr "type" "other")])
2366 ;;- Conversion instructions.
2369 (define_insn "*sethighqisi"
2370 [(set (match_operand:SI 0 "register_operand" "=d,d")
2371 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2372 (clobber (reg:CC 33))]
2377 [(set_attr "op_type" "RS,RSY")])
2379 (define_insn "*sethighhisi"
2380 [(set (match_operand:SI 0 "register_operand" "=d,d")
2381 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2382 (clobber (reg:CC 33))]
2387 [(set_attr "op_type" "RS,RSY")])
2389 (define_insn "*sethighqidi_64"
2390 [(set (match_operand:DI 0 "register_operand" "=d")
2391 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2392 (clobber (reg:CC 33))]
2395 [(set_attr "op_type" "RSY")])
2397 (define_insn "*sethighqidi_31"
2398 [(set (match_operand:DI 0 "register_operand" "=d,d")
2399 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2400 (clobber (reg:CC 33))]
2405 [(set_attr "op_type" "RS,RSY")])
2407 (define_insn_and_split "*extractqi"
2408 [(set (match_operand:SI 0 "register_operand" "=d")
2409 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2410 (match_operand 2 "const_int_operand" "n")
2412 (clobber (reg:CC 33))]
2414 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2416 "&& reload_completed"
2418 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2419 (clobber (reg:CC 33))])
2420 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2422 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2423 operands[1] = change_address (operands[1], QImode, 0);
2425 [(set_attr "atype" "agen")])
2427 (define_insn_and_split "*extracthi"
2428 [(set (match_operand:SI 0 "register_operand" "=d")
2429 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2430 (match_operand 2 "const_int_operand" "n")
2432 (clobber (reg:CC 33))]
2434 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2436 "&& reload_completed"
2438 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2439 (clobber (reg:CC 33))])
2440 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2442 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2443 operands[1] = change_address (operands[1], HImode, 0);
2445 [(set_attr "atype" "agen")])
2448 ; extendsidi2 instruction pattern(s).
2451 (define_expand "extendsidi2"
2452 [(set (match_operand:DI 0 "register_operand" "")
2453 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2459 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2460 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2461 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2462 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2468 (define_insn "*extendsidi2"
2469 [(set (match_operand:DI 0 "register_operand" "=d,d")
2470 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2475 [(set_attr "op_type" "RRE,RXY")])
2478 ; extendhidi2 instruction pattern(s).
2481 (define_expand "extendhidi2"
2482 [(set (match_operand:DI 0 "register_operand" "")
2483 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2489 rtx tmp = gen_reg_rtx (SImode);
2490 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2491 emit_insn (gen_extendsidi2 (operands[0], tmp));
2496 operands[1] = gen_lowpart (DImode, operands[1]);
2497 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2498 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2504 (define_insn "*extendhidi2"
2505 [(set (match_operand:DI 0 "register_operand" "=d")
2506 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2509 [(set_attr "op_type" "RXY")])
2512 ; extendqidi2 instruction pattern(s).
2515 (define_expand "extendqidi2"
2516 [(set (match_operand:DI 0 "register_operand" "")
2517 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2523 rtx tmp = gen_reg_rtx (SImode);
2524 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2525 emit_insn (gen_extendsidi2 (operands[0], tmp));
2530 operands[1] = gen_lowpart (DImode, operands[1]);
2531 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2532 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2538 (define_insn "*extendqidi2"
2539 [(set (match_operand:DI 0 "register_operand" "=d")
2540 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2541 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2543 [(set_attr "op_type" "RXY")])
2545 (define_insn_and_split "*extendqidi2_short_displ"
2546 [(set (match_operand:DI 0 "register_operand" "=d")
2547 (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))
2548 (clobber (reg:CC 33))]
2549 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2551 "&& reload_completed"
2553 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2554 (clobber (reg:CC 33))])
2556 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2557 (clobber (reg:CC 33))])]
2561 ; extendhisi2 instruction pattern(s).
2564 (define_expand "extendhisi2"
2565 [(set (match_operand:SI 0 "register_operand" "")
2566 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2570 operands[1] = gen_lowpart (SImode, operands[1]);
2571 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2572 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2577 (define_insn "*extendhisi2"
2578 [(set (match_operand:SI 0 "register_operand" "=d,d")
2579 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2584 [(set_attr "op_type" "RX,RXY")])
2587 ; extendqisi2 instruction pattern(s).
2590 (define_expand "extendqisi2"
2591 [(set (match_operand:SI 0 "register_operand" "")
2592 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2596 operands[1] = gen_lowpart (SImode, operands[1]);
2597 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2598 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2603 (define_insn "*extendqisi2"
2604 [(set (match_operand:SI 0 "register_operand" "=d")
2605 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2606 "TARGET_LONG_DISPLACEMENT"
2608 [(set_attr "op_type" "RXY")])
2610 (define_insn_and_split "*extendsiqi2_short_displ"
2611 [(set (match_operand:SI 0 "register_operand" "=d")
2612 (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))
2613 (clobber (reg:CC 33))]
2614 "!TARGET_LONG_DISPLACEMENT"
2616 "&& reload_completed"
2618 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2619 (clobber (reg:CC 33))])
2621 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2622 (clobber (reg:CC 33))])]
2626 ; extendqihi2 instruction pattern(s).
2631 ; zero_extendsidi2 instruction pattern(s).
2634 (define_expand "zero_extendsidi2"
2635 [(set (match_operand:DI 0 "register_operand" "")
2636 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2642 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2643 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2644 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2650 (define_insn "*zero_extendsidi2"
2651 [(set (match_operand:DI 0 "register_operand" "=d,d")
2652 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2657 [(set_attr "op_type" "RRE,RXY")])
2660 ; zero_extendhidi2 instruction pattern(s).
2663 (define_expand "zero_extendhidi2"
2664 [(set (match_operand:DI 0 "register_operand" "")
2665 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2671 rtx tmp = gen_reg_rtx (SImode);
2672 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2673 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2678 operands[1] = gen_lowpart (DImode, operands[1]);
2679 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2680 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2686 (define_insn "*zero_extendhidi2"
2687 [(set (match_operand:DI 0 "register_operand" "=d")
2688 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2691 [(set_attr "op_type" "RXY")])
2694 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2697 (define_insn "*llgt_sisi"
2698 [(set (match_operand:SI 0 "register_operand" "=d,d")
2699 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2700 (const_int 2147483647)))]
2705 [(set_attr "op_type" "RRE,RXE")])
2708 [(set (match_operand:SI 0 "register_operand" "")
2709 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2710 (const_int 2147483647)))
2711 (clobber (reg:CC 33))]
2712 "TARGET_64BIT && reload_completed"
2714 (and:SI (match_dup 1)
2715 (const_int 2147483647)))]
2718 (define_insn "*llgt_didi"
2719 [(set (match_operand:DI 0 "register_operand" "=d,d")
2720 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2721 (const_int 2147483647)))]
2726 [(set_attr "op_type" "RRE,RXE")])
2729 [(set (match_operand:DI 0 "register_operand" "")
2730 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
2731 (const_int 2147483647)))
2732 (clobber (reg:CC 33))]
2733 "TARGET_64BIT && reload_completed"
2735 (and:DI (match_dup 1)
2736 (const_int 2147483647)))]
2739 (define_insn "*llgt_sidi"
2740 [(set (match_operand:DI 0 "register_operand" "=d")
2741 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2742 (const_int 2147483647)))]
2745 [(set_attr "op_type" "RXE")])
2747 (define_insn_and_split "*llgt_sidi_split"
2748 [(set (match_operand:DI 0 "register_operand" "=d")
2749 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2750 (const_int 2147483647)))
2751 (clobber (reg:CC 33))]
2754 "&& reload_completed"
2756 (and:DI (subreg:DI (match_dup 1) 0)
2757 (const_int 2147483647)))]
2761 ; zero_extendqidi2 instruction pattern(s)
2764 (define_expand "zero_extendqidi2"
2765 [(set (match_operand:DI 0 "register_operand" "")
2766 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2772 rtx tmp = gen_reg_rtx (SImode);
2773 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2774 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2779 operands[1] = gen_lowpart (DImode, operands[1]);
2780 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2781 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2787 (define_insn "*zero_extendqidi2"
2788 [(set (match_operand:DI 0 "register_operand" "=d")
2789 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2792 [(set_attr "op_type" "RXY")])
2795 ; zero_extendhisi2 instruction pattern(s).
2798 (define_expand "zero_extendhisi2"
2799 [(set (match_operand:SI 0 "register_operand" "")
2800 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2804 operands[1] = gen_lowpart (SImode, operands[1]);
2805 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2810 (define_insn "*zero_extendhisi2_64"
2811 [(set (match_operand:SI 0 "register_operand" "=d")
2812 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2815 [(set_attr "op_type" "RXY")])
2817 (define_insn_and_split "*zero_extendhisi2_31"
2818 [(set (match_operand:SI 0 "register_operand" "=&d")
2819 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2820 (clobber (reg:CC 33))]
2823 "&& reload_completed"
2824 [(set (match_dup 0) (const_int 0))
2826 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2827 (clobber (reg:CC 33))])]
2828 "operands[2] = gen_lowpart (HImode, operands[0]);"
2829 [(set_attr "atype" "agen")])
2832 ; zero_extendqisi2 instruction pattern(s).
2835 (define_expand "zero_extendqisi2"
2836 [(set (match_operand:SI 0 "register_operand" "")
2837 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2841 operands[1] = gen_lowpart (SImode, operands[1]);
2842 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2847 (define_insn "*zero_extendqisi2_64"
2848 [(set (match_operand:SI 0 "register_operand" "=d")
2849 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2852 [(set_attr "op_type" "RXY")])
2854 (define_insn_and_split "*zero_extendqisi2_31"
2855 [(set (match_operand:SI 0 "register_operand" "=&d")
2856 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2859 "&& reload_completed"
2860 [(set (match_dup 0) (const_int 0))
2861 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2862 "operands[2] = gen_lowpart (QImode, operands[0]);"
2863 [(set_attr "atype" "agen")])
2866 ; zero_extendqihi2 instruction pattern(s).
2869 (define_expand "zero_extendqihi2"
2870 [(set (match_operand:HI 0 "register_operand" "")
2871 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2875 operands[1] = gen_lowpart (HImode, operands[1]);
2876 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2881 (define_insn "*zero_extendqihi2_64"
2882 [(set (match_operand:HI 0 "register_operand" "=d")
2883 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2886 [(set_attr "op_type" "RXY")])
2888 (define_insn_and_split "*zero_extendqihi2_31"
2889 [(set (match_operand:HI 0 "register_operand" "=&d")
2890 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2893 "&& reload_completed"
2894 [(set (match_dup 0) (const_int 0))
2895 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2896 "operands[2] = gen_lowpart (QImode, operands[0]);"
2897 [(set_attr "atype" "agen")])
2901 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2904 (define_expand "fixuns_truncdfdi2"
2905 [(set (match_operand:DI 0 "register_operand" "")
2906 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2907 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2909 rtx label1 = gen_label_rtx ();
2910 rtx label2 = gen_label_rtx ();
2911 rtx temp = gen_reg_rtx (DFmode);
2912 operands[1] = force_reg (DFmode, operands[1]);
2914 emit_insn (gen_cmpdf (operands[1],
2915 CONST_DOUBLE_FROM_REAL_VALUE (
2916 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2917 emit_jump_insn (gen_blt (label1));
2918 emit_insn (gen_subdf3 (temp, operands[1],
2919 CONST_DOUBLE_FROM_REAL_VALUE (
2920 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2921 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2924 emit_label (label1);
2925 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2926 emit_label (label2);
2930 (define_expand "fix_truncdfdi2"
2931 [(set (match_operand:DI 0 "register_operand" "")
2932 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2933 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2935 operands[1] = force_reg (DFmode, operands[1]);
2936 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2940 (define_insn "fix_truncdfdi2_ieee"
2941 [(set (match_operand:DI 0 "register_operand" "=d")
2942 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2943 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2944 (clobber (reg:CC 33))]
2945 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2947 [(set_attr "op_type" "RRE")
2948 (set_attr "type" "ftoi")])
2951 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2954 (define_expand "fixuns_truncdfsi2"
2955 [(set (match_operand:SI 0 "register_operand" "")
2956 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2957 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2959 rtx label1 = gen_label_rtx ();
2960 rtx label2 = gen_label_rtx ();
2961 rtx temp = gen_reg_rtx (DFmode);
2963 operands[1] = force_reg (DFmode,operands[1]);
2964 emit_insn (gen_cmpdf (operands[1],
2965 CONST_DOUBLE_FROM_REAL_VALUE (
2966 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2967 emit_jump_insn (gen_blt (label1));
2968 emit_insn (gen_subdf3 (temp, operands[1],
2969 CONST_DOUBLE_FROM_REAL_VALUE (
2970 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2971 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2974 emit_label (label1);
2975 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2976 emit_label (label2);
2980 (define_expand "fix_truncdfsi2"
2981 [(set (match_operand:SI 0 "register_operand" "")
2982 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2985 if (TARGET_IBM_FLOAT)
2987 /* This is the algorithm from POP chapter A.5.7.2. */
2989 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2990 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2991 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2993 operands[1] = force_reg (DFmode, operands[1]);
2994 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2995 two31r, two32, temp));
2999 operands[1] = force_reg (DFmode, operands[1]);
3000 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3006 (define_insn "fix_truncdfsi2_ieee"
3007 [(set (match_operand:SI 0 "register_operand" "=d")
3008 (fix:SI (match_operand:DF 1 "register_operand" "f")))
3009 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3010 (clobber (reg:CC 33))]
3011 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3013 [(set_attr "op_type" "RRE")
3014 (set_attr "type" "other" )])
3016 (define_insn "fix_truncdfsi2_ibm"
3017 [(set (match_operand:SI 0 "register_operand" "=d")
3018 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
3019 (use (match_operand:DI 2 "immediate_operand" "m"))
3020 (use (match_operand:DI 3 "immediate_operand" "m"))
3021 (use (match_operand:BLK 4 "memory_operand" "m"))
3022 (clobber (reg:CC 33))]
3023 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3025 output_asm_insn ("sd\t%1,%2", operands);
3026 output_asm_insn ("aw\t%1,%3", operands);
3027 output_asm_insn ("std\t%1,%4", operands);
3028 output_asm_insn ("xi\t%N4,128", operands);
3031 [(set_attr "op_type" "NN")
3032 (set_attr "type" "ftoi")
3033 (set_attr "atype" "agen")
3034 (set_attr "length" "20")])
3037 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
3040 (define_expand "fixuns_truncsfdi2"
3041 [(set (match_operand:DI 0 "register_operand" "")
3042 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
3043 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3045 rtx label1 = gen_label_rtx ();
3046 rtx label2 = gen_label_rtx ();
3047 rtx temp = gen_reg_rtx (SFmode);
3049 operands[1] = force_reg (SFmode, operands[1]);
3050 emit_insn (gen_cmpsf (operands[1],
3051 CONST_DOUBLE_FROM_REAL_VALUE (
3052 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
3053 emit_jump_insn (gen_blt (label1));
3055 emit_insn (gen_subsf3 (temp, operands[1],
3056 CONST_DOUBLE_FROM_REAL_VALUE (
3057 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
3058 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
3061 emit_label (label1);
3062 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
3063 emit_label (label2);
3067 (define_expand "fix_truncsfdi2"
3068 [(set (match_operand:DI 0 "register_operand" "")
3069 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
3070 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3072 operands[1] = force_reg (SFmode, operands[1]);
3073 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
3077 (define_insn "fix_truncsfdi2_ieee"
3078 [(set (match_operand:DI 0 "register_operand" "=d")
3079 (fix:DI (match_operand:SF 1 "register_operand" "f")))
3080 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3081 (clobber (reg:CC 33))]
3082 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3084 [(set_attr "op_type" "RRE")
3085 (set_attr "type" "ftoi")])
3088 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
3091 (define_expand "fixuns_truncsfsi2"
3092 [(set (match_operand:SI 0 "register_operand" "")
3093 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
3094 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3096 rtx label1 = gen_label_rtx ();
3097 rtx label2 = gen_label_rtx ();
3098 rtx temp = gen_reg_rtx (SFmode);
3100 operands[1] = force_reg (SFmode, operands[1]);
3101 emit_insn (gen_cmpsf (operands[1],
3102 CONST_DOUBLE_FROM_REAL_VALUE (
3103 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
3104 emit_jump_insn (gen_blt (label1));
3105 emit_insn (gen_subsf3 (temp, operands[1],
3106 CONST_DOUBLE_FROM_REAL_VALUE (
3107 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
3108 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
3111 emit_label (label1);
3112 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3113 emit_label (label2);
3117 (define_expand "fix_truncsfsi2"
3118 [(set (match_operand:SI 0 "register_operand" "")
3119 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
3122 if (TARGET_IBM_FLOAT)
3124 /* Convert to DFmode and then use the POP algorithm. */
3125 rtx temp = gen_reg_rtx (DFmode);
3126 emit_insn (gen_extendsfdf2 (temp, operands[1]));
3127 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
3131 operands[1] = force_reg (SFmode, operands[1]);
3132 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3138 (define_insn "fix_truncsfsi2_ieee"
3139 [(set (match_operand:SI 0 "register_operand" "=d")
3140 (fix:SI (match_operand:SF 1 "register_operand" "f")))
3141 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3142 (clobber (reg:CC 33))]
3143 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3145 [(set_attr "op_type" "RRE")
3146 (set_attr "type" "ftoi")])
3149 ; floatdidf2 instruction pattern(s).
3152 (define_insn "floatdidf2"
3153 [(set (match_operand:DF 0 "register_operand" "=f")
3154 (float:DF (match_operand:DI 1 "register_operand" "d")))
3155 (clobber (reg:CC 33))]
3156 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3158 [(set_attr "op_type" "RRE")
3159 (set_attr "type" "itof" )])
3162 ; floatdisf2 instruction pattern(s).
3165 (define_insn "floatdisf2"
3166 [(set (match_operand:SF 0 "register_operand" "=f")
3167 (float:SF (match_operand:DI 1 "register_operand" "d")))
3168 (clobber (reg:CC 33))]
3169 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3171 [(set_attr "op_type" "RRE")
3172 (set_attr "type" "itof" )])
3175 ; floatsidf2 instruction pattern(s).
3178 (define_expand "floatsidf2"
3180 [(set (match_operand:DF 0 "register_operand" "")
3181 (float:DF (match_operand:SI 1 "register_operand" "")))
3182 (clobber (reg:CC 33))])]
3185 if (TARGET_IBM_FLOAT)
3187 /* This is the algorithm from POP chapter A.5.7.1. */
3189 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3190 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
3192 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
3197 (define_insn "floatsidf2_ieee"
3198 [(set (match_operand:DF 0 "register_operand" "=f")
3199 (float:DF (match_operand:SI 1 "register_operand" "d")))
3200 (clobber (reg:CC 33))]
3201 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3203 [(set_attr "op_type" "RRE")
3204 (set_attr "type" "itof" )])
3206 (define_insn "floatsidf2_ibm"
3207 [(set (match_operand:DF 0 "register_operand" "=f")
3208 (float:DF (match_operand:SI 1 "register_operand" "d")))
3209 (use (match_operand:DI 2 "immediate_operand" "m"))
3210 (use (match_operand:BLK 3 "memory_operand" "m"))
3211 (clobber (reg:CC 33))]
3212 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3214 output_asm_insn ("st\t%1,%N3", operands);
3215 output_asm_insn ("xi\t%N3,128", operands);
3216 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3217 output_asm_insn ("ld\t%0,%3", operands);
3220 [(set_attr "op_type" "NN")
3221 (set_attr "type" "other" )
3222 (set_attr "atype" "agen")
3223 (set_attr "length" "20")])
3226 ; floatsisf2 instruction pattern(s).
3229 (define_expand "floatsisf2"
3231 [(set (match_operand:SF 0 "register_operand" "")
3232 (float:SF (match_operand:SI 1 "register_operand" "")))
3233 (clobber (reg:CC 33))])]
3236 if (TARGET_IBM_FLOAT)
3238 /* Use the POP algorithm to convert to DFmode and then truncate. */
3239 rtx temp = gen_reg_rtx (DFmode);
3240 emit_insn (gen_floatsidf2 (temp, operands[1]));
3241 emit_insn (gen_truncdfsf2 (operands[0], temp));
3246 (define_insn "floatsisf2_ieee"
3247 [(set (match_operand:SF 0 "register_operand" "=f")
3248 (float:SF (match_operand:SI 1 "register_operand" "d")))
3249 (clobber (reg:CC 33))]
3250 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3252 [(set_attr "op_type" "RRE")
3253 (set_attr "type" "itof" )])
3256 ; truncdfsf2 instruction pattern(s).
3259 (define_expand "truncdfsf2"
3260 [(set (match_operand:SF 0 "register_operand" "")
3261 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3265 (define_insn "truncdfsf2_ieee"
3266 [(set (match_operand:SF 0 "register_operand" "=f")
3267 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3268 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3270 [(set_attr "op_type" "RRE")])
3272 (define_insn "truncdfsf2_ibm"
3273 [(set (match_operand:SF 0 "register_operand" "=f,f")
3274 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3275 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3279 [(set_attr "op_type" "RR,RX")
3280 (set_attr "type" "floads,floads")])
3283 ; extendsfdf2 instruction pattern(s).
3286 (define_expand "extendsfdf2"
3287 [(set (match_operand:DF 0 "register_operand" "")
3288 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3291 if (TARGET_IBM_FLOAT)
3293 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3298 (define_insn "extendsfdf2_ieee"
3299 [(set (match_operand:DF 0 "register_operand" "=f,f")
3300 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3301 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3305 [(set_attr "op_type" "RRE,RXE")
3306 (set_attr "type" "floads,floads")])
3308 (define_insn "extendsfdf2_ibm"
3309 [(set (match_operand:DF 0 "register_operand" "=f,f")
3310 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3311 (clobber (reg:CC 33))]
3312 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3314 sdr\t%0,%0\;ler\t%0,%1
3315 sdr\t%0,%0\;le\t%0,%1"
3316 [(set_attr "op_type" "NN,NN")
3317 (set_attr "atype" "reg,agen")
3318 (set_attr "length" "4,6")
3319 (set_attr "type" "o2,o2")])
3323 ;; ARITHMETIC OPERATIONS
3325 ; arithmetic operations set the ConditionCode,
3326 ; because of unpredictable Bits in Register for Halfword and Byte
3327 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3330 ;;- Add instructions.
3334 ; adddi3 instruction pattern(s).
3337 (define_insn "*adddi3_sign"
3338 [(set (match_operand:DI 0 "register_operand" "=d,d")
3339 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3340 (match_operand:DI 1 "register_operand" "0,0")))
3341 (clobber (reg:CC 33))]
3346 [(set_attr "op_type" "RRE,RXY")])
3348 (define_insn "*adddi3_zero_cc"
3350 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3351 (match_operand:DI 1 "register_operand" "0,0"))
3353 (set (match_operand:DI 0 "register_operand" "=d,d")
3354 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3355 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3359 [(set_attr "op_type" "RRE,RXY")])
3361 (define_insn "*adddi3_zero_cconly"
3363 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3364 (match_operand:DI 1 "register_operand" "0,0"))
3366 (clobber (match_scratch:DI 0 "=d,d"))]
3367 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3371 [(set_attr "op_type" "RRE,RXY")])
3373 (define_insn "*adddi3_zero"
3374 [(set (match_operand:DI 0 "register_operand" "=d,d")
3375 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3376 (match_operand:DI 1 "register_operand" "0,0")))
3377 (clobber (reg:CC 33))]
3382 [(set_attr "op_type" "RRE,RXY")])
3384 (define_insn "*adddi3_imm_cc"
3386 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3387 (match_operand:DI 2 "const_int_operand" "K"))
3389 (set (match_operand:DI 0 "register_operand" "=d")
3390 (plus:DI (match_dup 1) (match_dup 2)))]
3392 && s390_match_ccmode (insn, CCAmode)
3393 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3395 [(set_attr "op_type" "RI")])
3397 (define_insn "*adddi3_carry1_cc"
3399 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3400 (match_operand:DI 2 "general_operand" "d,m"))
3402 (set (match_operand:DI 0 "register_operand" "=d,d")
3403 (plus:DI (match_dup 1) (match_dup 2)))]
3404 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3408 [(set_attr "op_type" "RRE,RXY")])
3410 (define_insn "*adddi3_carry1_cconly"
3412 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3413 (match_operand:DI 2 "general_operand" "d,m"))
3415 (clobber (match_scratch:DI 0 "=d,d"))]
3416 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3420 [(set_attr "op_type" "RRE,RXY")])
3422 (define_insn "*adddi3_carry2_cc"
3424 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3425 (match_operand:DI 2 "general_operand" "d,m"))
3427 (set (match_operand:DI 0 "register_operand" "=d,d")
3428 (plus:DI (match_dup 1) (match_dup 2)))]
3429 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3433 [(set_attr "op_type" "RRE,RXY")])
3435 (define_insn "*adddi3_carry2_cconly"
3437 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3438 (match_operand:DI 2 "general_operand" "d,m"))
3440 (clobber (match_scratch:DI 0 "=d,d"))]
3441 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3445 [(set_attr "op_type" "RRE,RXY")])
3447 (define_insn "*adddi3_cc"
3449 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3450 (match_operand:DI 2 "general_operand" "d,m"))
3452 (set (match_operand:DI 0 "register_operand" "=d,d")
3453 (plus:DI (match_dup 1) (match_dup 2)))]
3454 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3458 [(set_attr "op_type" "RRE,RXY")])
3460 (define_insn "*adddi3_cconly"
3462 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3463 (match_operand:DI 2 "general_operand" "d,m"))
3465 (clobber (match_scratch:DI 0 "=d,d"))]
3466 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3470 [(set_attr "op_type" "RRE,RXY")])
3472 (define_insn "*adddi3_cconly2"
3474 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3475 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3476 (clobber (match_scratch:DI 0 "=d,d"))]
3477 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3481 [(set_attr "op_type" "RRE,RXY")])
3483 (define_insn "*adddi3_64"
3484 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3485 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3486 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3487 (clobber (reg:CC 33))]
3493 [(set_attr "op_type" "RRE,RI,RXY")])
3495 (define_insn_and_split "*adddi3_31z"
3496 [(set (match_operand:DI 0 "register_operand" "=&d")
3497 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3498 (match_operand:DI 2 "general_operand" "do") ) )
3499 (clobber (reg:CC 33))]
3500 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3502 "&& reload_completed"
3505 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3507 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3509 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3510 (ltu:SI (reg:CCL1 33) (const_int 0))))
3511 (clobber (reg:CC 33))])]
3512 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3513 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3514 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3515 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3516 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3517 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3518 [(set_attr "op_type" "NN")])
3520 (define_insn_and_split "*adddi3_31"
3521 [(set (match_operand:DI 0 "register_operand" "=&d")
3522 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3523 (match_operand:DI 2 "general_operand" "do") ) )
3524 (clobber (reg:CC 33))]
3527 "&& reload_completed"
3529 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3530 (clobber (reg:CC 33))])
3533 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3535 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3537 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3539 (label_ref (match_dup 9))))
3541 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3542 (clobber (reg:CC 33))])
3544 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3545 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3546 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3547 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3548 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3549 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3550 operands[9] = gen_label_rtx ();"
3551 [(set_attr "op_type" "NN")])
3553 (define_expand "adddi3"
3555 [(set (match_operand:DI 0 "register_operand" "")
3556 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3557 (match_operand:DI 2 "general_operand" "")))
3558 (clobber (reg:CC 33))])]
3563 ; addsi3 instruction pattern(s).
3566 (define_insn "*addsi3_imm_cc"
3568 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3569 (match_operand:SI 2 "const_int_operand" "K"))
3571 (set (match_operand:SI 0 "register_operand" "=d")
3572 (plus:SI (match_dup 1) (match_dup 2)))]
3573 "s390_match_ccmode (insn, CCAmode)
3574 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3576 [(set_attr "op_type" "RI")])
3578 (define_insn "*addsi3_carry1_cc"
3580 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3581 (match_operand:SI 2 "general_operand" "d,R,T"))
3583 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3584 (plus:SI (match_dup 1) (match_dup 2)))]
3585 "s390_match_ccmode (insn, CCL1mode)"
3590 [(set_attr "op_type" "RR,RX,RXY")])
3592 (define_insn "*addsi3_carry1_cconly"
3594 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3595 (match_operand:SI 2 "general_operand" "d,R,T"))
3597 (clobber (match_scratch:SI 0 "=d,d,d"))]
3598 "s390_match_ccmode (insn, CCL1mode)"
3603 [(set_attr "op_type" "RR,RX,RXY")])
3605 (define_insn "*addsi3_carry2_cc"
3607 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3608 (match_operand:SI 2 "general_operand" "d,R,T"))
3610 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3611 (plus:SI (match_dup 1) (match_dup 2)))]
3612 "s390_match_ccmode (insn, CCL1mode)"
3617 [(set_attr "op_type" "RR,RX,RXY")])
3619 (define_insn "*addsi3_carry2_cconly"
3621 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3622 (match_operand:SI 2 "general_operand" "d,R,T"))
3624 (clobber (match_scratch:SI 0 "=d,d,d"))]
3625 "s390_match_ccmode (insn, CCL1mode)"
3630 [(set_attr "op_type" "RR,RX,RXY")])
3632 (define_insn "*addsi3_cc"
3634 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3635 (match_operand:SI 2 "general_operand" "d,R,T"))
3637 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3638 (plus:SI (match_dup 1) (match_dup 2)))]
3639 "s390_match_ccmode (insn, CCLmode)"
3644 [(set_attr "op_type" "RR,RX,RXY")])
3646 (define_insn "*addsi3_cconly"
3648 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3649 (match_operand:SI 2 "general_operand" "d,R,T"))
3651 (clobber (match_scratch:SI 0 "=d,d,d"))]
3652 "s390_match_ccmode (insn, CCLmode)"
3657 [(set_attr "op_type" "RR,RX,RXY")])
3659 (define_insn "*addsi3_cconly2"
3661 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3662 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3663 (clobber (match_scratch:SI 0 "=d,d,d"))]
3664 "s390_match_ccmode (insn, CCLmode)"
3669 [(set_attr "op_type" "RR,RX,RXY")])
3671 (define_insn "*addsi3_sign"
3672 [(set (match_operand:SI 0 "register_operand" "=d,d")
3673 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3674 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3675 (clobber (reg:CC 33))]
3680 [(set_attr "op_type" "RX,RXY")])
3682 (define_insn "addsi3"
3683 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3684 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3685 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3686 (clobber (reg:CC 33))]
3693 [(set_attr "op_type" "RR,RI,RX,RXY")])
3696 ; adddf3 instruction pattern(s).
3699 (define_expand "adddf3"
3701 [(set (match_operand:DF 0 "register_operand" "=f,f")
3702 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3703 (match_operand:DF 2 "general_operand" "f,R")))
3704 (clobber (reg:CC 33))])]
3708 (define_insn "*adddf3"
3709 [(set (match_operand:DF 0 "register_operand" "=f,f")
3710 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3711 (match_operand:DF 2 "general_operand" "f,R")))
3712 (clobber (reg:CC 33))]
3713 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3717 [(set_attr "op_type" "RRE,RXE")
3718 (set_attr "type" "fsimpd,fsimpd")])
3720 (define_insn "*adddf3_cc"
3722 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3723 (match_operand:DF 2 "general_operand" "f,R"))
3724 (match_operand:DF 3 "const0_operand" "")))
3725 (set (match_operand:DF 0 "register_operand" "=f,f")
3726 (plus:DF (match_dup 1) (match_dup 2)))]
3727 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3731 [(set_attr "op_type" "RRE,RXE")
3732 (set_attr "type" "fsimpd,fsimpd")])
3734 (define_insn "*adddf3_cconly"
3736 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3737 (match_operand:DF 2 "general_operand" "f,R"))
3738 (match_operand:DF 3 "const0_operand" "")))
3739 (clobber (match_scratch:DF 0 "=f,f"))]
3740 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3744 [(set_attr "op_type" "RRE,RXE")
3745 (set_attr "type" "fsimpd,fsimpd")])
3747 (define_insn "*adddf3_ibm"
3748 [(set (match_operand:DF 0 "register_operand" "=f,f")
3749 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3750 (match_operand:DF 2 "general_operand" "f,R")))
3751 (clobber (reg:CC 33))]
3752 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3756 [(set_attr "op_type" "RR,RX")
3757 (set_attr "type" "fsimpd,fsimpd")])
3760 ; addsf3 instruction pattern(s).
3763 (define_expand "addsf3"
3765 [(set (match_operand:SF 0 "register_operand" "=f,f")
3766 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3767 (match_operand:SF 2 "general_operand" "f,R")))
3768 (clobber (reg:CC 33))])]
3772 (define_insn "*addsf3"
3773 [(set (match_operand:SF 0 "register_operand" "=f,f")
3774 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3775 (match_operand:SF 2 "general_operand" "f,R")))
3776 (clobber (reg:CC 33))]
3777 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3781 [(set_attr "op_type" "RRE,RXE")
3782 (set_attr "type" "fsimps,fsimps")])
3784 (define_insn "*addsf3_cc"
3786 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3787 (match_operand:SF 2 "general_operand" "f,R"))
3788 (match_operand:SF 3 "const0_operand" "")))
3789 (set (match_operand:SF 0 "register_operand" "=f,f")
3790 (plus:SF (match_dup 1) (match_dup 2)))]
3791 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3795 [(set_attr "op_type" "RRE,RXE")
3796 (set_attr "type" "fsimps,fsimps")])
3798 (define_insn "*addsf3_cconly"
3800 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3801 (match_operand:SF 2 "general_operand" "f,R"))
3802 (match_operand:SF 3 "const0_operand" "")))
3803 (clobber (match_scratch:SF 0 "=f,f"))]
3804 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3808 [(set_attr "op_type" "RRE,RXE")
3809 (set_attr "type" "fsimps,fsimps")])
3811 (define_insn "*addsf3"
3812 [(set (match_operand:SF 0 "register_operand" "=f,f")
3813 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3814 (match_operand:SF 2 "general_operand" "f,R")))
3815 (clobber (reg:CC 33))]
3816 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3820 [(set_attr "op_type" "RR,RX")
3821 (set_attr "type" "fsimps,fsimps")])
3825 ;;- Subtract instructions.
3829 ; subdi3 instruction pattern(s).
3832 (define_insn "*subdi3_sign"
3833 [(set (match_operand:DI 0 "register_operand" "=d,d")
3834 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3835 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3836 (clobber (reg:CC 33))]
3841 [(set_attr "op_type" "RRE,RXY")])
3843 (define_insn "*subdi3_zero_cc"
3845 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3846 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3848 (set (match_operand:DI 0 "register_operand" "=d,d")
3849 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3850 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3854 [(set_attr "op_type" "RRE,RXY")])
3856 (define_insn "*subdi3_zero_cconly"
3858 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3859 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3861 (clobber (match_scratch:DI 0 "=d,d"))]
3862 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3866 [(set_attr "op_type" "RRE,RXY")])
3868 (define_insn "*subdi3_zero"
3869 [(set (match_operand:DI 0 "register_operand" "=d,d")
3870 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3871 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3872 (clobber (reg:CC 33))]
3877 [(set_attr "op_type" "RRE,RXY")])
3879 (define_insn "*subdi3_borrow_cc"
3881 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3882 (match_operand:DI 2 "general_operand" "d,m"))
3884 (set (match_operand:DI 0 "register_operand" "=d,d")
3885 (minus:DI (match_dup 1) (match_dup 2)))]
3886 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3890 [(set_attr "op_type" "RRE,RXY")])
3892 (define_insn "*subdi3_borrow_cconly"
3894 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3895 (match_operand:DI 2 "general_operand" "d,m"))
3897 (clobber (match_scratch:DI 0 "=d,d"))]
3898 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3902 [(set_attr "op_type" "RRE,RXY")])
3904 (define_insn "*subdi3_cc"
3906 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3907 (match_operand:DI 2 "general_operand" "d,m"))
3909 (set (match_operand:DI 0 "register_operand" "=d,d")
3910 (minus:DI (match_dup 1) (match_dup 2)))]
3911 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3915 [(set_attr "op_type" "RRE,RXY")])
3917 (define_insn "*subdi3_cconly"
3919 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3920 (match_operand:DI 2 "general_operand" "d,m"))
3922 (clobber (match_scratch:DI 0 "=d,d"))]
3923 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3927 [(set_attr "op_type" "RRE,RXY")])
3929 (define_insn "*subdi3_64"
3930 [(set (match_operand:DI 0 "register_operand" "=d,d")
3931 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3932 (match_operand:DI 2 "general_operand" "d,m") ) )
3933 (clobber (reg:CC 33))]
3938 [(set_attr "op_type" "RRE,RRE")])
3940 (define_insn_and_split "*subdi3_31z"
3941 [(set (match_operand:DI 0 "register_operand" "=&d")
3942 (minus:DI (match_operand:DI 1 "register_operand" "0")
3943 (match_operand:DI 2 "general_operand" "do") ) )
3944 (clobber (reg:CC 33))]
3945 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3947 "&& reload_completed"
3950 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3952 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3954 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3955 (gtu:SI (reg:CCL2 33) (const_int 0))))
3956 (clobber (reg:CC 33))])]
3957 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3958 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3959 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3960 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3961 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3962 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3963 [(set_attr "op_type" "NN")])
3965 (define_insn_and_split "*subdi3_31"
3966 [(set (match_operand:DI 0 "register_operand" "=&d")
3967 (minus:DI (match_operand:DI 1 "register_operand" "0")
3968 (match_operand:DI 2 "general_operand" "do") ) )
3969 (clobber (reg:CC 33))]
3972 "&& reload_completed"
3974 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3975 (clobber (reg:CC 33))])
3978 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3980 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3982 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3984 (label_ref (match_dup 9))))
3986 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3987 (clobber (reg:CC 33))])
3989 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3990 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3991 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3992 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3993 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3994 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3995 operands[9] = gen_label_rtx ();"
3996 [(set_attr "op_type" "NN")])
3998 (define_expand "subdi3"
4000 [(set (match_operand:DI 0 "register_operand" "")
4001 (minus:DI (match_operand:DI 1 "register_operand" "")
4002 (match_operand:DI 2 "general_operand" "")))
4003 (clobber (reg:CC 33))])]
4008 ; subsi3 instruction pattern(s).
4011 (define_insn "*subsi3_borrow_cc"
4013 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4014 (match_operand:SI 2 "general_operand" "d,R,T"))
4016 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4017 (minus:SI (match_dup 1) (match_dup 2)))]
4018 "s390_match_ccmode (insn, CCL2mode)"
4023 [(set_attr "op_type" "RR,RX,RXY")])
4025 (define_insn "*subsi3_borrow_cconly"
4027 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4028 (match_operand:SI 2 "general_operand" "d,R,T"))
4030 (clobber (match_scratch:SI 0 "=d,d,d"))]
4031 "s390_match_ccmode (insn, CCL2mode)"
4036 [(set_attr "op_type" "RR,RX,RXY")])
4038 (define_insn "*subsi3_cc"
4040 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4041 (match_operand:SI 2 "general_operand" "d,R,T"))
4043 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4044 (minus:SI (match_dup 1) (match_dup 2)))]
4045 "s390_match_ccmode (insn, CCLmode)"
4050 [(set_attr "op_type" "RR,RX,RXY")])
4052 (define_insn "*subsi3_cconly"
4054 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4055 (match_operand:SI 2 "general_operand" "d,R,T"))
4057 (clobber (match_scratch:SI 0 "=d,d,d"))]
4058 "s390_match_ccmode (insn, CCLmode)"
4063 [(set_attr "op_type" "RR,RX,RXY")])
4065 (define_insn "*subsi3_sign"
4066 [(set (match_operand:SI 0 "register_operand" "=d,d")
4067 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
4068 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4069 (clobber (reg:CC 33))]
4074 [(set_attr "op_type" "RX,RXY")])
4076 (define_insn "subsi3"
4077 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4078 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4079 (match_operand:SI 2 "general_operand" "d,R,T")))
4080 (clobber (reg:CC 33))]
4086 [(set_attr "op_type" "RR,RX,RXY")])
4090 ; subdf3 instruction pattern(s).
4093 (define_expand "subdf3"
4095 [(set (match_operand:DF 0 "register_operand" "=f,f")
4096 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4097 (match_operand:DF 2 "general_operand" "f,R")))
4098 (clobber (reg:CC 33))])]
4102 (define_insn "*subdf3"
4103 [(set (match_operand:DF 0 "register_operand" "=f,f")
4104 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4105 (match_operand:DF 2 "general_operand" "f,R")))
4106 (clobber (reg:CC 33))]
4107 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4111 [(set_attr "op_type" "RRE,RXE")
4112 (set_attr "type" "fsimpd,fsimpd")])
4114 (define_insn "*subdf3_cc"
4116 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4117 (match_operand:DF 2 "general_operand" "f,R"))
4118 (match_operand:DF 3 "const0_operand" "")))
4119 (set (match_operand:DF 0 "register_operand" "=f,f")
4120 (plus:DF (match_dup 1) (match_dup 2)))]
4121 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4125 [(set_attr "op_type" "RRE,RXE")
4126 (set_attr "type" "fsimpd,fsimpd")])
4128 (define_insn "*subdf3_cconly"
4130 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4131 (match_operand:DF 2 "general_operand" "f,R"))
4132 (match_operand:DF 3 "const0_operand" "")))
4133 (clobber (match_scratch:DF 0 "=f,f"))]
4134 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4138 [(set_attr "op_type" "RRE,RXE")
4139 (set_attr "type" "fsimpd,fsimpd")])
4141 (define_insn "*subdf3_ibm"
4142 [(set (match_operand:DF 0 "register_operand" "=f,f")
4143 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4144 (match_operand:DF 2 "general_operand" "f,R")))
4145 (clobber (reg:CC 33))]
4146 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4150 [(set_attr "op_type" "RR,RX")
4151 (set_attr "type" "fsimpd,fsimpd")])
4154 ; subsf3 instruction pattern(s).
4157 (define_expand "subsf3"
4159 [(set (match_operand:SF 0 "register_operand" "=f,f")
4160 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4161 (match_operand:SF 2 "general_operand" "f,R")))
4162 (clobber (reg:CC 33))])]
4166 (define_insn "*subsf3"
4167 [(set (match_operand:SF 0 "register_operand" "=f,f")
4168 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4169 (match_operand:SF 2 "general_operand" "f,R")))
4170 (clobber (reg:CC 33))]
4171 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4175 [(set_attr "op_type" "RRE,RXE")
4176 (set_attr "type" "fsimps,fsimps")])
4178 (define_insn "*subsf3_cc"
4180 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4181 (match_operand:SF 2 "general_operand" "f,R"))
4182 (match_operand:SF 3 "const0_operand" "")))
4183 (set (match_operand:SF 0 "register_operand" "=f,f")
4184 (minus:SF (match_dup 1) (match_dup 2)))]
4185 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4189 [(set_attr "op_type" "RRE,RXE")
4190 (set_attr "type" "fsimps,fsimps")])
4192 (define_insn "*subsf3_cconly"
4194 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4195 (match_operand:SF 2 "general_operand" "f,R"))
4196 (match_operand:SF 3 "const0_operand" "")))
4197 (clobber (match_scratch:SF 0 "=f,f"))]
4198 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4202 [(set_attr "op_type" "RRE,RXE")
4203 (set_attr "type" "fsimps,fsimps")])
4205 (define_insn "*subsf3_ibm"
4206 [(set (match_operand:SF 0 "register_operand" "=f,f")
4207 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4208 (match_operand:SF 2 "general_operand" "f,R")))
4209 (clobber (reg:CC 33))]
4210 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4214 [(set_attr "op_type" "RR,RX")
4215 (set_attr "type" "fsimps,fsimps")])
4219 ;;- Conditional add/subtract instructions.
4223 ; adddicc instruction pattern(s).
4226 (define_insn "*adddi3_alc_cc"
4229 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4230 (match_operand:DI 2 "general_operand" "d,m"))
4231 (match_operand:DI 3 "s390_alc_comparison" ""))
4233 (set (match_operand:DI 0 "register_operand" "=d,d")
4234 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4235 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4239 [(set_attr "op_type" "RRE,RXY")])
4241 (define_insn "*adddi3_alc"
4242 [(set (match_operand:DI 0 "register_operand" "=d,d")
4243 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4244 (match_operand:DI 2 "general_operand" "d,m"))
4245 (match_operand:DI 3 "s390_alc_comparison" "")))
4246 (clobber (reg:CC 33))]
4251 [(set_attr "op_type" "RRE,RXY")])
4253 (define_insn "*subdi3_slb_cc"
4256 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4257 (match_operand:DI 2 "general_operand" "d,m"))
4258 (match_operand:DI 3 "s390_slb_comparison" ""))
4260 (set (match_operand:DI 0 "register_operand" "=d,d")
4261 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4262 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4266 [(set_attr "op_type" "RRE,RXY")])
4268 (define_insn "*subdi3_slb"
4269 [(set (match_operand:DI 0 "register_operand" "=d,d")
4270 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4271 (match_operand:DI 2 "general_operand" "d,m"))
4272 (match_operand:DI 3 "s390_slb_comparison" "")))
4273 (clobber (reg:CC 33))]
4278 [(set_attr "op_type" "RRE,RXY")])
4281 ; addsicc instruction pattern(s).
4284 (define_insn "*addsi3_alc_cc"
4287 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4288 (match_operand:SI 2 "general_operand" "d,m"))
4289 (match_operand:SI 3 "s390_alc_comparison" ""))
4291 (set (match_operand:SI 0 "register_operand" "=d,d")
4292 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4293 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4297 [(set_attr "op_type" "RRE,RXY")])
4299 (define_insn "*addsi3_alc"
4300 [(set (match_operand:SI 0 "register_operand" "=d,d")
4301 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4302 (match_operand:SI 2 "general_operand" "d,m"))
4303 (match_operand:SI 3 "s390_alc_comparison" "")))
4304 (clobber (reg:CC 33))]
4309 [(set_attr "op_type" "RRE,RXY")])
4311 (define_insn "*subsi3_slb_cc"
4314 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4315 (match_operand:SI 2 "general_operand" "d,m"))
4316 (match_operand:SI 3 "s390_slb_comparison" ""))
4318 (set (match_operand:SI 0 "register_operand" "=d,d")
4319 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4320 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4324 [(set_attr "op_type" "RRE,RXY")])
4326 (define_insn "*subsi3_slb"
4327 [(set (match_operand:SI 0 "register_operand" "=d,d")
4328 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4329 (match_operand:SI 2 "general_operand" "d,m"))
4330 (match_operand:SI 3 "s390_slb_comparison" "")))
4331 (clobber (reg:CC 33))]
4336 [(set_attr "op_type" "RRE,RXY")])
4340 ;;- Multiply instructions.
4344 ; muldi3 instruction pattern(s).
4347 (define_insn "*muldi3_sign"
4348 [(set (match_operand:DI 0 "register_operand" "=d,d")
4349 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4350 (match_operand:DI 1 "register_operand" "0,0")))]
4355 [(set_attr "op_type" "RRE,RXY")
4356 (set_attr "type" "imul")])
4358 (define_insn "muldi3"
4359 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4360 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4361 (match_operand:DI 2 "general_operand" "d,K,m")))]
4367 [(set_attr "op_type" "RRE,RI,RXY")
4368 (set_attr "type" "imul")])
4371 ; mulsi3 instruction pattern(s).
4374 (define_insn "*mulsi3_sign"
4375 [(set (match_operand:SI 0 "register_operand" "=d")
4376 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4377 (match_operand:SI 1 "register_operand" "0")))]
4380 [(set_attr "op_type" "RX")
4381 (set_attr "type" "imul")])
4383 (define_insn "mulsi3"
4384 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4385 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4386 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4393 [(set_attr "op_type" "RRE,RI,RX,RXY")
4394 (set_attr "type" "imul")])
4397 ; mulsidi3 instruction pattern(s).
4400 (define_insn "mulsidi3"
4401 [(set (match_operand:DI 0 "register_operand" "=d,d")
4402 (mult:DI (sign_extend:DI
4403 (match_operand:SI 1 "register_operand" "%0,0"))
4405 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4410 [(set_attr "op_type" "RR,RX")
4411 (set_attr "type" "imul")])
4414 ; umulsidi3 instruction pattern(s).
4417 (define_insn "umulsidi3"
4418 [(set (match_operand:DI 0 "register_operand" "=d,d")
4419 (mult:DI (zero_extend:DI
4420 (match_operand:SI 1 "register_operand" "%0,0"))
4422 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4423 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4427 [(set_attr "op_type" "RRE,RXY")
4428 (set_attr "type" "imul")])
4431 ; muldf3 instruction pattern(s).
4434 (define_expand "muldf3"
4435 [(set (match_operand:DF 0 "register_operand" "=f,f")
4436 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4437 (match_operand:DF 2 "general_operand" "f,R")))]
4441 (define_insn "*muldf3"
4442 [(set (match_operand:DF 0 "register_operand" "=f,f")
4443 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4444 (match_operand:DF 2 "general_operand" "f,R")))]
4445 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4449 [(set_attr "op_type" "RRE,RXE")
4450 (set_attr "type" "fmuld")])
4452 (define_insn "*muldf3_ibm"
4453 [(set (match_operand:DF 0 "register_operand" "=f,f")
4454 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4455 (match_operand:DF 2 "general_operand" "f,R")))]
4456 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4460 [(set_attr "op_type" "RR,RX")
4461 (set_attr "type" "fmuld")])
4463 (define_insn "*fmadddf"
4464 [(set (match_operand:DF 0 "register_operand" "=f,f")
4465 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4466 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4467 (match_operand:DF 3 "register_operand" "0,0")))]
4468 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4472 [(set_attr "op_type" "RRE,RXE")
4473 (set_attr "type" "fmuld")])
4475 (define_insn "*fmsubdf"
4476 [(set (match_operand:DF 0 "register_operand" "=f,f")
4477 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4478 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4479 (match_operand:DF 3 "register_operand" "0,0")))]
4480 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4484 [(set_attr "op_type" "RRE,RXE")
4485 (set_attr "type" "fmuld")])
4488 ; mulsf3 instruction pattern(s).
4491 (define_expand "mulsf3"
4492 [(set (match_operand:SF 0 "register_operand" "=f,f")
4493 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4494 (match_operand:SF 2 "general_operand" "f,R")))]
4498 (define_insn "*mulsf3"
4499 [(set (match_operand:SF 0 "register_operand" "=f,f")
4500 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4501 (match_operand:SF 2 "general_operand" "f,R")))]
4502 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4506 [(set_attr "op_type" "RRE,RXE")
4507 (set_attr "type" "fmuls")])
4509 (define_insn "*mulsf3_ibm"
4510 [(set (match_operand:SF 0 "register_operand" "=f,f")
4511 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4512 (match_operand:SF 2 "general_operand" "f,R")))]
4513 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4517 [(set_attr "op_type" "RR,RX")
4518 (set_attr "type" "fmuls")])
4520 (define_insn "*fmaddsf"
4521 [(set (match_operand:SF 0 "register_operand" "=f,f")
4522 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4523 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4524 (match_operand:SF 3 "register_operand" "0,0")))]
4525 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4529 [(set_attr "op_type" "RRE,RXE")
4530 (set_attr "type" "fmuls")])
4532 (define_insn "*fmsubsf"
4533 [(set (match_operand:SF 0 "register_operand" "=f,f")
4534 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4535 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4536 (match_operand:SF 3 "register_operand" "0,0")))]
4537 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4541 [(set_attr "op_type" "RRE,RXE")
4542 (set_attr "type" "fmuls")])
4545 ;;- Divide and modulo instructions.
4549 ; divmoddi4 instruction pattern(s).
4552 (define_expand "divmoddi4"
4553 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4554 (div:DI (match_operand:DI 1 "register_operand" "")
4555 (match_operand:DI 2 "general_operand" "")))
4556 (set (match_operand:DI 3 "general_operand" "")
4557 (mod:DI (match_dup 1) (match_dup 2)))])
4558 (clobber (match_dup 4))]
4561 rtx insn, div_equal, mod_equal;
4563 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4564 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4566 operands[4] = gen_reg_rtx(TImode);
4567 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4569 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4571 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4573 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4575 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4580 (define_insn "divmodtidi3"
4581 [(set (match_operand:TI 0 "register_operand" "=d,d")
4584 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4585 (match_operand:DI 2 "general_operand" "d,m")))
4588 (mod:DI (match_dup 1)
4595 [(set_attr "op_type" "RRE,RXY")
4596 (set_attr "type" "idiv")])
4598 (define_insn "divmodtisi3"
4599 [(set (match_operand:TI 0 "register_operand" "=d,d")
4602 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4603 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4606 (mod:DI (match_dup 1)
4607 (sign_extend:DI (match_dup 2))))
4613 [(set_attr "op_type" "RRE,RXY")
4614 (set_attr "type" "idiv")])
4617 ; udivmoddi4 instruction pattern(s).
4620 (define_expand "udivmoddi4"
4621 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4622 (udiv:DI (match_operand:DI 1 "general_operand" "")
4623 (match_operand:DI 2 "nonimmediate_operand" "")))
4624 (set (match_operand:DI 3 "general_operand" "")
4625 (umod:DI (match_dup 1) (match_dup 2)))])
4626 (clobber (match_dup 4))]
4629 rtx insn, div_equal, mod_equal, equal;
4631 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4632 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4633 equal = gen_rtx_IOR (TImode,
4634 gen_rtx_ZERO_EXTEND (TImode, div_equal),
4635 gen_rtx_ASHIFT (TImode,
4636 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4639 operands[4] = gen_reg_rtx(TImode);
4640 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4641 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4642 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4643 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4645 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4647 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4649 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4651 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4653 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4658 (define_insn "udivmodtidi3"
4659 [(set (match_operand:TI 0 "register_operand" "=d,d")
4660 (ior:TI (zero_extend:TI
4662 (udiv:TI (match_operand:TI 1 "register_operand" "0,0")
4664 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4668 (umod:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))
4674 [(set_attr "op_type" "RRE,RXY")
4675 (set_attr "type" "idiv")])
4678 ; divmodsi4 instruction pattern(s).
4681 (define_expand "divmodsi4"
4682 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4683 (div:SI (match_operand:SI 1 "general_operand" "")
4684 (match_operand:SI 2 "nonimmediate_operand" "")))
4685 (set (match_operand:SI 3 "general_operand" "")
4686 (mod:SI (match_dup 1) (match_dup 2)))])
4687 (clobber (match_dup 4))]
4690 rtx insn, div_equal, mod_equal, equal;
4692 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4693 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4694 equal = gen_rtx_IOR (DImode,
4695 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4696 gen_rtx_ASHIFT (DImode,
4697 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4700 operands[4] = gen_reg_rtx(DImode);
4701 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4702 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4704 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4706 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4708 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4710 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4712 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4717 (define_insn "divmoddisi3"
4718 [(set (match_operand:DI 0 "register_operand" "=d,d")
4719 (ior:DI (zero_extend:DI
4721 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4723 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4727 (mod:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))
4733 [(set_attr "op_type" "RR,RX")
4734 (set_attr "type" "idiv")])
4737 ; udivsi3 and umodsi3 instruction pattern(s).
4740 (define_expand "udivmodsi4"
4741 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4742 (udiv:SI (match_operand:SI 1 "general_operand" "")
4743 (match_operand:SI 2 "nonimmediate_operand" "")))
4744 (set (match_operand:SI 3 "general_operand" "")
4745 (umod:SI (match_dup 1) (match_dup 2)))])
4746 (clobber (match_dup 4))]
4747 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4749 rtx insn, div_equal, mod_equal, equal;
4751 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4752 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4753 equal = gen_rtx_IOR (DImode,
4754 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4755 gen_rtx_ASHIFT (DImode,
4756 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4759 operands[4] = gen_reg_rtx(DImode);
4760 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4761 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4762 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4763 insn = emit_insn (gen_udivmoddisi3 (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 "udivmoddisi3"
4779 [(set (match_operand:DI 0 "register_operand" "=d,d")
4780 (ior:DI (zero_extend:DI
4782 (udiv:DI (match_operand:DI 1 "register_operand" "0,0")
4784 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4788 (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))
4790 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4794 [(set_attr "op_type" "RRE,RXY")
4795 (set_attr "type" "idiv")])
4797 (define_expand "udivsi3"
4798 [(set (match_operand:SI 0 "register_operand" "=d")
4799 (udiv:SI (match_operand:SI 1 "general_operand" "")
4800 (match_operand:SI 2 "general_operand" "")))
4801 (clobber (match_dup 3))]
4802 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4804 rtx insn, udiv_equal, umod_equal, equal;
4806 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4807 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4808 equal = gen_rtx_IOR (DImode,
4809 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4810 gen_rtx_ASHIFT (DImode,
4811 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4814 operands[3] = gen_reg_rtx (DImode);
4816 if (CONSTANT_P (operands[2]))
4818 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4820 rtx label1 = gen_label_rtx ();
4822 operands[1] = make_safe_from (operands[1], operands[0]);
4823 emit_move_insn (operands[0], const0_rtx);
4824 emit_insn (gen_cmpsi (operands[1], operands[2]));
4825 emit_jump_insn (gen_bltu (label1));
4826 emit_move_insn (operands[0], const1_rtx);
4827 emit_label (label1);
4831 operands[2] = force_reg (SImode, operands[2]);
4832 operands[2] = make_safe_from (operands[2], operands[0]);
4834 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4835 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4838 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4840 insn = emit_move_insn (operands[0],
4841 gen_lowpart (SImode, operands[3]));
4843 gen_rtx_EXPR_LIST (REG_EQUAL,
4844 udiv_equal, REG_NOTES (insn));
4849 rtx label1 = gen_label_rtx ();
4850 rtx label2 = gen_label_rtx ();
4851 rtx label3 = gen_label_rtx ();
4853 operands[1] = force_reg (SImode, operands[1]);
4854 operands[1] = make_safe_from (operands[1], operands[0]);
4855 operands[2] = force_reg (SImode, operands[2]);
4856 operands[2] = make_safe_from (operands[2], operands[0]);
4858 emit_move_insn (operands[0], const0_rtx);
4859 emit_insn (gen_cmpsi (operands[2], operands[1]));
4860 emit_jump_insn (gen_bgtu (label3));
4861 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4862 emit_jump_insn (gen_blt (label2));
4863 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4864 emit_jump_insn (gen_beq (label1));
4865 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4866 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4869 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4871 insn = emit_move_insn (operands[0],
4872 gen_lowpart (SImode, operands[3]));
4874 gen_rtx_EXPR_LIST (REG_EQUAL,
4875 udiv_equal, REG_NOTES (insn));
4877 emit_label (label1);
4878 emit_move_insn (operands[0], operands[1]);
4880 emit_label (label2);
4881 emit_move_insn (operands[0], const1_rtx);
4882 emit_label (label3);
4884 emit_move_insn (operands[0], operands[0]);
4888 (define_expand "umodsi3"
4889 [(set (match_operand:SI 0 "register_operand" "=d")
4890 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4891 (match_operand:SI 2 "nonimmediate_operand" "")))
4892 (clobber (match_dup 3))]
4893 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4895 rtx insn, udiv_equal, umod_equal, equal;
4897 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4898 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4899 equal = gen_rtx_IOR (DImode,
4900 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4901 gen_rtx_ASHIFT (DImode,
4902 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4905 operands[3] = gen_reg_rtx (DImode);
4907 if (CONSTANT_P (operands[2]))
4909 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4911 rtx label1 = gen_label_rtx ();
4913 operands[1] = make_safe_from (operands[1], operands[0]);
4914 emit_move_insn (operands[0], operands[1]);
4915 emit_insn (gen_cmpsi (operands[0], operands[2]));
4916 emit_jump_insn (gen_bltu (label1));
4917 emit_insn (gen_abssi2 (operands[0], operands[2]));
4918 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4919 emit_label (label1);
4923 operands[2] = force_reg (SImode, operands[2]);
4924 operands[2] = make_safe_from (operands[2], operands[0]);
4926 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4927 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4930 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4932 insn = emit_move_insn (operands[0],
4933 gen_highpart (SImode, operands[3]));
4935 gen_rtx_EXPR_LIST (REG_EQUAL,
4936 umod_equal, REG_NOTES (insn));
4941 rtx label1 = gen_label_rtx ();
4942 rtx label2 = gen_label_rtx ();
4943 rtx label3 = gen_label_rtx ();
4945 operands[1] = force_reg (SImode, operands[1]);
4946 operands[1] = make_safe_from (operands[1], operands[0]);
4947 operands[2] = force_reg (SImode, operands[2]);
4948 operands[2] = make_safe_from (operands[2], operands[0]);
4950 emit_move_insn(operands[0], operands[1]);
4951 emit_insn (gen_cmpsi (operands[2], operands[1]));
4952 emit_jump_insn (gen_bgtu (label3));
4953 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4954 emit_jump_insn (gen_blt (label2));
4955 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4956 emit_jump_insn (gen_beq (label1));
4957 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4958 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4961 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4963 insn = emit_move_insn (operands[0],
4964 gen_highpart (SImode, operands[3]));
4966 gen_rtx_EXPR_LIST (REG_EQUAL,
4967 umod_equal, REG_NOTES (insn));
4969 emit_label (label1);
4970 emit_move_insn (operands[0], const0_rtx);
4972 emit_label (label2);
4973 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4974 emit_label (label3);
4980 ; divdf3 instruction pattern(s).
4983 (define_expand "divdf3"
4984 [(set (match_operand:DF 0 "register_operand" "=f,f")
4985 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4986 (match_operand:DF 2 "general_operand" "f,R")))]
4990 (define_insn "*divdf3"
4991 [(set (match_operand:DF 0 "register_operand" "=f,f")
4992 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4993 (match_operand:DF 2 "general_operand" "f,R")))]
4994 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4998 [(set_attr "op_type" "RRE,RXE")
4999 (set_attr "type" "fdivd")])
5001 (define_insn "*divdf3_ibm"
5002 [(set (match_operand:DF 0 "register_operand" "=f,f")
5003 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5004 (match_operand:DF 2 "general_operand" "f,R")))]
5005 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5009 [(set_attr "op_type" "RR,RX")
5010 (set_attr "type" "fdivd")])
5013 ; divsf3 instruction pattern(s).
5016 (define_expand "divsf3"
5017 [(set (match_operand:SF 0 "register_operand" "=f,f")
5018 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5019 (match_operand:SF 2 "general_operand" "f,R")))]
5023 (define_insn "*divsf3"
5024 [(set (match_operand:SF 0 "register_operand" "=f,f")
5025 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5026 (match_operand:SF 2 "general_operand" "f,R")))]
5027 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5031 [(set_attr "op_type" "RRE,RXE")
5032 (set_attr "type" "fdivs")])
5034 (define_insn "*divsf3"
5035 [(set (match_operand:SF 0 "register_operand" "=f,f")
5036 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5037 (match_operand:SF 2 "general_operand" "f,R")))]
5038 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5042 [(set_attr "op_type" "RR,RX")
5043 (set_attr "type" "fdivs")])
5047 ;;- And instructions.
5051 ; anddi3 instruction pattern(s).
5054 (define_insn "*anddi3_cc"
5056 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5057 (match_operand:DI 2 "general_operand" "d,m"))
5059 (set (match_operand:DI 0 "register_operand" "=d,d")
5060 (and:DI (match_dup 1) (match_dup 2)))]
5061 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5065 [(set_attr "op_type" "RRE,RXY")])
5067 (define_insn "*anddi3_cconly"
5069 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5070 (match_operand:DI 2 "general_operand" "d,m"))
5072 (clobber (match_scratch:DI 0 "=d,d"))]
5073 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5077 [(set_attr "op_type" "RRE,RXY")])
5079 (define_insn "anddi3"
5080 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d,d,d")
5081 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o,0,0,0,0,0,0")
5082 (match_operand:DI 2 "general_operand"
5083 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m")))
5084 (clobber (reg:CC 33))]
5095 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY")])
5097 (define_insn "*anddi3_ss"
5098 [(set (match_operand:DI 0 "s_operand" "=Q")
5099 (and:DI (match_dup 0)
5100 (match_operand:DI 1 "s_imm_operand" "Q")))
5101 (clobber (reg:CC 33))]
5104 [(set_attr "op_type" "SS")])
5106 (define_insn "*anddi3_ss_inv"
5107 [(set (match_operand:DI 0 "s_operand" "=Q")
5108 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5110 (clobber (reg:CC 33))]
5113 [(set_attr "op_type" "SS")])
5116 ; andsi3 instruction pattern(s).
5119 (define_insn "*andsi3_cc"
5121 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5122 (match_operand:SI 2 "general_operand" "d,R,T"))
5124 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5125 (and:SI (match_dup 1) (match_dup 2)))]
5126 "s390_match_ccmode(insn, CCTmode)"
5131 [(set_attr "op_type" "RR,RX,RXY")])
5133 (define_insn "*andsi3_cconly"
5135 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5136 (match_operand:SI 2 "general_operand" "d,R,T"))
5138 (clobber (match_scratch:SI 0 "=d,d,d"))]
5139 "s390_match_ccmode(insn, CCTmode)"
5144 [(set_attr "op_type" "RR,RX,RXY")])
5146 (define_expand "andsi3"
5148 [(set (match_operand:SI 0 "register_operand" "")
5149 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
5150 (match_operand:SI 2 "general_operand" "")))
5151 (clobber (reg:CC 33))])]
5155 (define_insn "*andsi3_zarch"
5156 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d,d,d")
5157 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,o,0,0,0,0,0")
5158 (match_operand:SI 2 "general_operand" "M,M,N0HSF,N1HSF,d,R,T")))
5159 (clobber (reg:CC 33))]
5169 [(set_attr "op_type" "RRE,RXE,RI,RI,RR,RX,RXY")])
5171 (define_insn "*andsi3_esa"
5172 [(set (match_operand:SI 0 "register_operand" "=d,d")
5173 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5174 (match_operand:SI 2 "general_operand" "d,R")))
5175 (clobber (reg:CC 33))]
5180 [(set_attr "op_type" "RR,RX")])
5182 (define_insn "*andsi3_ss"
5183 [(set (match_operand:SI 0 "s_operand" "=Q")
5184 (and:SI (match_dup 0)
5185 (match_operand:SI 1 "s_imm_operand" "Q")))
5186 (clobber (reg:CC 33))]
5189 [(set_attr "op_type" "SS")])
5191 (define_insn "*andsi3_ss_inv"
5192 [(set (match_operand:SI 0 "s_operand" "=Q")
5193 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5195 (clobber (reg:CC 33))]
5198 [(set_attr "op_type" "SS")])
5201 ; andhi3 instruction pattern(s).
5204 (define_insn "*andhi3_ni"
5205 [(set (match_operand:HI 0 "register_operand" "=d,d")
5206 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5207 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5208 (clobber (reg:CC 33))]
5213 [(set_attr "op_type" "RR,RI")])
5215 (define_insn "andhi3"
5216 [(set (match_operand:HI 0 "register_operand" "=d")
5217 (and:HI (match_operand:HI 1 "register_operand" "%0")
5218 (match_operand:HI 2 "nonmemory_operand" "d")))
5219 (clobber (reg:CC 33))]
5222 [(set_attr "op_type" "RR")])
5224 (define_insn "*andhi3_ss"
5225 [(set (match_operand:HI 0 "s_operand" "=Q")
5226 (and:HI (match_dup 0)
5227 (match_operand:HI 1 "s_imm_operand" "Q")))
5228 (clobber (reg:CC 33))]
5231 [(set_attr "op_type" "SS")])
5233 (define_insn "*andhi3_ss_inv"
5234 [(set (match_operand:HI 0 "s_operand" "=Q")
5235 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5237 (clobber (reg:CC 33))]
5240 [(set_attr "op_type" "SS")])
5243 ; andqi3 instruction pattern(s).
5246 (define_insn "*andqi3_ni"
5247 [(set (match_operand:QI 0 "register_operand" "=d,d")
5248 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5249 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5250 (clobber (reg:CC 33))]
5255 [(set_attr "op_type" "RR,RI")])
5257 (define_insn "andqi3"
5258 [(set (match_operand:QI 0 "register_operand" "=d")
5259 (and:QI (match_operand:QI 1 "register_operand" "%0")
5260 (match_operand:QI 2 "nonmemory_operand" "d")))
5261 (clobber (reg:CC 33))]
5264 [(set_attr "op_type" "RR")])
5266 (define_insn "*andqi3_ss"
5267 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5268 (and:QI (match_dup 0)
5269 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5270 (clobber (reg:CC 33))]
5276 [(set_attr "op_type" "SI,SIY,SS")])
5278 (define_insn "*andqi3_ss_inv"
5279 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5280 (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5282 (clobber (reg:CC 33))]
5288 [(set_attr "op_type" "SI,SIY,SS")])
5292 ;;- Bit set (inclusive or) instructions.
5296 ; iordi3 instruction pattern(s).
5299 (define_insn "*iordi3_cc"
5301 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5302 (match_operand:DI 2 "general_operand" "d,m"))
5304 (set (match_operand:DI 0 "register_operand" "=d,d")
5305 (ior:DI (match_dup 1) (match_dup 2)))]
5306 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5310 [(set_attr "op_type" "RRE,RXY")])
5312 (define_insn "*iordi3_cconly"
5314 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5315 (match_operand:DI 2 "general_operand" "d,m"))
5317 (clobber (match_scratch:DI 0 "=d,d"))]
5318 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5322 [(set_attr "op_type" "RRE,RXY")])
5324 (define_insn "iordi3"
5325 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d")
5326 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,0,0,0,0")
5327 (match_operand:DI 2 "general_operand" "N0HD0,N1HD0,N2HD0,N3HD0,d,m")))
5328 (clobber (reg:CC 33))]
5337 [(set_attr "op_type" "RI,RI,RI,RI,RRE,RXY")])
5339 (define_insn "*iordi3_ss"
5340 [(set (match_operand:DI 0 "s_operand" "=Q")
5341 (ior:DI (match_dup 0)
5342 (match_operand:DI 1 "s_imm_operand" "Q")))
5343 (clobber (reg:CC 33))]
5346 [(set_attr "op_type" "SS")])
5348 (define_insn "*iordi3_ss_inv"
5349 [(set (match_operand:DI 0 "s_operand" "=Q")
5350 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5352 (clobber (reg:CC 33))]
5355 [(set_attr "op_type" "SS")])
5358 ; iorsi3 instruction pattern(s).
5361 (define_insn "*iorsi3_cc"
5363 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5364 (match_operand:SI 2 "general_operand" "d,R,T"))
5366 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5367 (ior:SI (match_dup 1) (match_dup 2)))]
5368 "s390_match_ccmode(insn, CCTmode)"
5373 [(set_attr "op_type" "RR,RX,RXY")])
5375 (define_insn "*iorsi3_cconly"
5377 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5378 (match_operand:SI 2 "general_operand" "d,R,T"))
5380 (clobber (match_scratch:SI 0 "=d,d,d"))]
5381 "s390_match_ccmode(insn, CCTmode)"
5386 [(set_attr "op_type" "RR,RX,RXY")])
5388 (define_expand "iorsi3"
5390 [(set (match_operand:SI 0 "register_operand" "")
5391 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
5392 (match_operand:SI 2 "general_operand" "")))
5393 (clobber (reg:CC 33))])]
5397 (define_insn "iorsi3_zarch"
5398 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
5399 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0,0")
5400 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,d,R,T")))
5401 (clobber (reg:CC 33))]
5409 [(set_attr "op_type" "RI,RI,RR,RX,RXY")])
5411 (define_insn "iorsi3_esa"
5412 [(set (match_operand:SI 0 "register_operand" "=d,d")
5413 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
5414 (match_operand:SI 2 "general_operand" "d,R")))
5415 (clobber (reg:CC 33))]
5420 [(set_attr "op_type" "RR,RX")])
5422 (define_insn "*iorsi3_ss"
5423 [(set (match_operand:SI 0 "s_operand" "=Q")
5424 (ior:SI (match_dup 0)
5425 (match_operand:SI 1 "s_imm_operand" "Q")))
5426 (clobber (reg:CC 33))]
5429 [(set_attr "op_type" "SS")])
5431 (define_insn "*iorsi3_ss_inv"
5432 [(set (match_operand:SI 0 "s_operand" "=Q")
5433 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5435 (clobber (reg:CC 33))]
5438 [(set_attr "op_type" "SS")])
5441 ; iorhi3 instruction pattern(s).
5444 (define_insn "*iorhi3_oi"
5445 [(set (match_operand:HI 0 "register_operand" "=d,d")
5446 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5447 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5448 (clobber (reg:CC 33))]
5453 [(set_attr "op_type" "RR,RI")])
5455 (define_insn "iorhi3"
5456 [(set (match_operand:HI 0 "register_operand" "=d")
5457 (ior:HI (match_operand:HI 1 "register_operand" "%0")
5458 (match_operand:HI 2 "nonmemory_operand" "d")))
5459 (clobber (reg:CC 33))]
5462 [(set_attr "op_type" "RR")])
5464 (define_insn "*iorhi3_ss"
5465 [(set (match_operand:HI 0 "s_operand" "=Q")
5466 (ior:HI (match_dup 0)
5467 (match_operand:HI 1 "s_imm_operand" "Q")))
5468 (clobber (reg:CC 33))]
5471 [(set_attr "op_type" "SS")])
5473 (define_insn "*iorhi3_ss_inv"
5474 [(set (match_operand:HI 0 "s_operand" "=Q")
5475 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5477 (clobber (reg:CC 33))]
5480 [(set_attr "op_type" "SS")])
5483 ; iorqi3 instruction pattern(s).
5486 (define_insn "*iorqi3_oi"
5487 [(set (match_operand:QI 0 "register_operand" "=d,d")
5488 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5489 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5490 (clobber (reg:CC 33))]
5495 [(set_attr "op_type" "RR,RI")])
5497 (define_insn "iorqi3"
5498 [(set (match_operand:QI 0 "register_operand" "=d")
5499 (ior:QI (match_operand:QI 1 "register_operand" "%0")
5500 (match_operand:QI 2 "nonmemory_operand" "d")))
5501 (clobber (reg:CC 33))]
5504 [(set_attr "op_type" "RR")])
5506 (define_insn "*iorqi3_ss"
5507 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5508 (ior:QI (match_dup 0)
5509 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5510 (clobber (reg:CC 33))]
5516 [(set_attr "op_type" "SI,SIY,SS")])
5518 (define_insn "*iorqi3_ss_inv"
5519 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5520 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5522 (clobber (reg:CC 33))]
5528 [(set_attr "op_type" "SI,SIY,SS")])
5532 ;;- Xor instructions.
5536 ; xordi3 instruction pattern(s).
5539 (define_insn "*xordi3_cc"
5541 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5542 (match_operand:DI 2 "general_operand" "d,m"))
5544 (set (match_operand:DI 0 "register_operand" "=d,d")
5545 (xor:DI (match_dup 1) (match_dup 2)))]
5546 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5550 [(set_attr "op_type" "RRE,RXY")])
5552 (define_insn "*xordi3_cconly"
5554 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5555 (match_operand:DI 2 "general_operand" "d,m"))
5557 (clobber (match_scratch:DI 0 "=d,d"))]
5558 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5562 [(set_attr "op_type" "RRE,RXY")])
5564 (define_insn "xordi3"
5565 [(set (match_operand:DI 0 "register_operand" "=d,d")
5566 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5567 (match_operand:DI 2 "general_operand" "d,m")))
5568 (clobber (reg:CC 33))]
5573 [(set_attr "op_type" "RRE,RXY")])
5575 (define_insn "*xordi3_ss"
5576 [(set (match_operand:DI 0 "s_operand" "=Q")
5577 (xor:DI (match_dup 0)
5578 (match_operand:DI 1 "s_imm_operand" "Q")))
5579 (clobber (reg:CC 33))]
5582 [(set_attr "op_type" "SS")])
5584 (define_insn "*xordi3_ss_inv"
5585 [(set (match_operand:DI 0 "s_operand" "=Q")
5586 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5588 (clobber (reg:CC 33))]
5591 [(set_attr "op_type" "SS")])
5594 ; xorsi3 instruction pattern(s).
5597 (define_insn "*xorsi3_cc"
5599 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5600 (match_operand:SI 2 "general_operand" "d,R,T"))
5602 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5603 (xor:SI (match_dup 1) (match_dup 2)))]
5604 "s390_match_ccmode(insn, CCTmode)"
5609 [(set_attr "op_type" "RR,RX,RXY")])
5611 (define_insn "*xorsi3_cconly"
5613 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5614 (match_operand:SI 2 "general_operand" "d,R,T"))
5616 (clobber (match_scratch:SI 0 "=d,d,d"))]
5617 "s390_match_ccmode(insn, CCTmode)"
5622 [(set_attr "op_type" "RR,RX,RXY")])
5624 (define_insn "xorsi3"
5625 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5626 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5627 (match_operand:SI 2 "general_operand" "d,R,T")))
5628 (clobber (reg:CC 33))]
5634 [(set_attr "op_type" "RR,RX,RXY")])
5636 (define_insn "*xorsi3_ss"
5637 [(set (match_operand:SI 0 "s_operand" "=Q")
5638 (xor:SI (match_dup 0)
5639 (match_operand:SI 1 "s_imm_operand" "Q")))
5640 (clobber (reg:CC 33))]
5643 [(set_attr "op_type" "SS")])
5645 (define_insn "*xorsi3_ss_inv"
5646 [(set (match_operand:SI 0 "s_operand" "=Q")
5647 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5649 (clobber (reg:CC 33))]
5652 [(set_attr "op_type" "SS")])
5655 ; xorhi3 instruction pattern(s).
5658 (define_insn "xorhi3"
5659 [(set (match_operand:HI 0 "register_operand" "=d")
5660 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5661 (match_operand:HI 2 "nonmemory_operand" "d")))
5662 (clobber (reg:CC 33))]
5665 [(set_attr "op_type" "RR")])
5667 (define_insn "*xorhi3_ss"
5668 [(set (match_operand:HI 0 "s_operand" "=Q")
5669 (xor:HI (match_dup 0)
5670 (match_operand:HI 1 "s_imm_operand" "Q")))
5671 (clobber (reg:CC 33))]
5674 [(set_attr "op_type" "SS")])
5676 (define_insn "*xorhi3_ss_inv"
5677 [(set (match_operand:HI 0 "s_operand" "=Q")
5678 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5680 (clobber (reg:CC 33))]
5683 [(set_attr "op_type" "SS")])
5686 ; xorqi3 instruction pattern(s).
5689 (define_insn "xorqi3"
5690 [(set (match_operand:QI 0 "register_operand" "=d")
5691 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5692 (match_operand:QI 2 "nonmemory_operand" "d")))
5693 (clobber (reg:CC 33))]
5696 [(set_attr "op_type" "RR")])
5698 (define_insn "*xorqi3_ss"
5699 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5700 (xor:QI (match_dup 0)
5701 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5702 (clobber (reg:CC 33))]
5708 [(set_attr "op_type" "SI,SIY,SS")])
5710 (define_insn "*xorqi3_ss_inv"
5711 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5712 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5714 (clobber (reg:CC 33))]
5720 [(set_attr "op_type" "SI,SIY,SS")])
5724 ;;- Negate instructions.
5728 ; negdi2 instruction pattern(s).
5731 (define_expand "negdi2"
5733 [(set (match_operand:DI 0 "register_operand" "=d")
5734 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5735 (clobber (reg:CC 33))])]
5739 (define_insn "*negdi2_64"
5740 [(set (match_operand:DI 0 "register_operand" "=d")
5741 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5742 (clobber (reg:CC 33))]
5745 [(set_attr "op_type" "RR")])
5747 (define_insn "*negdi2_31"
5748 [(set (match_operand:DI 0 "register_operand" "=d")
5749 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5750 (clobber (reg:CC 33))]
5754 xop[0] = gen_label_rtx ();
5755 output_asm_insn ("lcr\t%0,%1", operands);
5756 output_asm_insn ("lcr\t%N0,%N1", operands);
5757 output_asm_insn ("je\t%l0", xop);
5758 output_asm_insn ("bctr\t%0,0", operands);
5759 targetm.asm_out.internal_label (asm_out_file, "L",
5760 CODE_LABEL_NUMBER (xop[0]));
5763 [(set_attr "op_type" "NN")
5764 (set_attr "type" "other")
5765 (set_attr "length" "10")])
5768 ; negsi2 instruction pattern(s).
5771 (define_insn "negsi2"
5772 [(set (match_operand:SI 0 "register_operand" "=d")
5773 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5774 (clobber (reg:CC 33))]
5777 [(set_attr "op_type" "RR")])
5780 ; negdf2 instruction pattern(s).
5783 (define_expand "negdf2"
5785 [(set (match_operand:DF 0 "register_operand" "=f")
5786 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5787 (clobber (reg:CC 33))])]
5791 (define_insn "*negdf2"
5792 [(set (match_operand:DF 0 "register_operand" "=f")
5793 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5794 (clobber (reg:CC 33))]
5795 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5797 [(set_attr "op_type" "RRE")
5798 (set_attr "type" "fsimpd")])
5800 (define_insn "*negdf2_ibm"
5801 [(set (match_operand:DF 0 "register_operand" "=f")
5802 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5803 (clobber (reg:CC 33))]
5804 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5806 [(set_attr "op_type" "RR")
5807 (set_attr "type" "fsimpd")])
5810 ; negsf2 instruction pattern(s).
5813 (define_expand "negsf2"
5815 [(set (match_operand:SF 0 "register_operand" "=f")
5816 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5817 (clobber (reg:CC 33))])]
5821 (define_insn "*negsf2"
5822 [(set (match_operand:SF 0 "register_operand" "=f")
5823 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5824 (clobber (reg:CC 33))]
5825 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5827 [(set_attr "op_type" "RRE")
5828 (set_attr "type" "fsimps")])
5830 (define_insn "*negsf2"
5831 [(set (match_operand:SF 0 "register_operand" "=f")
5832 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5833 (clobber (reg:CC 33))]
5834 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5836 [(set_attr "op_type" "RR")
5837 (set_attr "type" "fsimps")])
5841 ;;- Absolute value instructions.
5845 ; absdi2 instruction pattern(s).
5848 (define_insn "absdi2"
5849 [(set (match_operand:DI 0 "register_operand" "=d")
5850 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5851 (clobber (reg:CC 33))]
5854 [(set_attr "op_type" "RRE")])
5857 ; abssi2 instruction pattern(s).
5860 (define_insn "abssi2"
5861 [(set (match_operand:SI 0 "register_operand" "=d")
5862 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5863 (clobber (reg:CC 33))]
5866 [(set_attr "op_type" "RR")])
5869 ; absdf2 instruction pattern(s).
5872 (define_expand "absdf2"
5874 [(set (match_operand:DF 0 "register_operand" "=f")
5875 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5876 (clobber (reg:CC 33))])]
5880 (define_insn "*absdf2"
5881 [(set (match_operand:DF 0 "register_operand" "=f")
5882 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5883 (clobber (reg:CC 33))]
5884 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5886 [(set_attr "op_type" "RRE")
5887 (set_attr "type" "fsimpd")])
5889 (define_insn "*absdf2_ibm"
5890 [(set (match_operand:DF 0 "register_operand" "=f")
5891 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5892 (clobber (reg:CC 33))]
5893 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5895 [(set_attr "op_type" "RR")
5896 (set_attr "type" "fsimpd")])
5899 ; abssf2 instruction pattern(s).
5902 (define_expand "abssf2"
5904 [(set (match_operand:SF 0 "register_operand" "=f")
5905 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5906 (clobber (reg:CC 33))])]
5910 (define_insn "*abssf2"
5911 [(set (match_operand:SF 0 "register_operand" "=f")
5912 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5913 (clobber (reg:CC 33))]
5914 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5916 [(set_attr "op_type" "RRE")
5917 (set_attr "type" "fsimps")])
5919 (define_insn "*abssf2_ibm"
5920 [(set (match_operand:SF 0 "register_operand" "=f")
5921 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5922 (clobber (reg:CC 33))]
5923 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5925 [(set_attr "op_type" "RR")
5926 (set_attr "type" "fsimps")])
5929 ;;- Negated absolute value instructions
5936 (define_insn "*negabssi2"
5937 [(set (match_operand:SI 0 "register_operand" "=d")
5938 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
5939 (clobber (reg:CC 33))]
5942 [(set_attr "op_type" "RR")])
5944 (define_insn "*negabsdi2"
5945 [(set (match_operand:DI 0 "register_operand" "=d")
5946 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
5947 (clobber (reg:CC 33))]
5950 [(set_attr "op_type" "RRE")])
5956 (define_insn "*negabssf2"
5957 [(set (match_operand:SF 0 "register_operand" "=f")
5958 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5959 (clobber (reg:CC 33))]
5960 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5962 [(set_attr "op_type" "RRE")
5963 (set_attr "type" "fsimps")])
5965 (define_insn "*negabsdf2"
5966 [(set (match_operand:DF 0 "register_operand" "=f")
5967 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5968 (clobber (reg:CC 33))]
5969 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5971 [(set_attr "op_type" "RRE")
5972 (set_attr "type" "fsimpd")])
5975 ;;- Square root instructions.
5979 ; sqrtdf2 instruction pattern(s).
5982 (define_insn "sqrtdf2"
5983 [(set (match_operand:DF 0 "register_operand" "=f,f")
5984 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
5985 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5989 [(set_attr "op_type" "RRE,RXE")])
5992 ; sqrtsf2 instruction pattern(s).
5995 (define_insn "sqrtsf2"
5996 [(set (match_operand:SF 0 "register_operand" "=f,f")
5997 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
5998 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6002 [(set_attr "op_type" "RRE,RXE")])
6005 ;;- One complement instructions.
6009 ; one_cmpldi2 instruction pattern(s).
6012 (define_expand "one_cmpldi2"
6014 [(set (match_operand:DI 0 "register_operand" "")
6015 (xor:DI (match_operand:DI 1 "register_operand" "")
6017 (clobber (reg:CC 33))])]
6022 ; one_cmplsi2 instruction pattern(s).
6025 (define_expand "one_cmplsi2"
6027 [(set (match_operand:SI 0 "register_operand" "")
6028 (xor:SI (match_operand:SI 1 "register_operand" "")
6030 (clobber (reg:CC 33))])]
6035 ; one_cmplhi2 instruction pattern(s).
6038 (define_expand "one_cmplhi2"
6040 [(set (match_operand:HI 0 "register_operand" "")
6041 (xor:HI (match_operand:HI 1 "register_operand" "")
6043 (clobber (reg:CC 33))])]
6048 ; one_cmplqi2 instruction pattern(s).
6051 (define_expand "one_cmplqi2"
6053 [(set (match_operand:QI 0 "register_operand" "")
6054 (xor:QI (match_operand:QI 1 "register_operand" "")
6056 (clobber (reg:CC 33))])]
6062 ;;- Rotate instructions.
6066 ; rotldi3 instruction pattern(s).
6069 (define_insn "rotldi3"
6070 [(set (match_operand:DI 0 "register_operand" "=d")
6071 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6072 (match_operand:SI 2 "shift_count_operand" "Y")))]
6075 [(set_attr "op_type" "RSE")
6076 (set_attr "atype" "reg")])
6079 ; rotlsi3 instruction pattern(s).
6082 (define_insn "rotlsi3"
6083 [(set (match_operand:SI 0 "register_operand" "=d")
6084 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6085 (match_operand:SI 2 "shift_count_operand" "Y")))]
6088 [(set_attr "op_type" "RSE")
6089 (set_attr "atype" "reg")])
6093 ;;- Arithmetic shift instructions.
6097 ; ashldi3 instruction pattern(s).
6100 (define_expand "ashldi3"
6101 [(set (match_operand:DI 0 "register_operand" "")
6102 (ashift:DI (match_operand:DI 1 "register_operand" "")
6103 (match_operand:SI 2 "shift_count_operand" "")))]
6107 (define_insn "*ashldi3_31"
6108 [(set (match_operand:DI 0 "register_operand" "=d")
6109 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6110 (match_operand:SI 2 "shift_count_operand" "Y")))]
6113 [(set_attr "op_type" "RS")
6114 (set_attr "atype" "reg")])
6116 (define_insn "*ashldi3_64"
6117 [(set (match_operand:DI 0 "register_operand" "=d")
6118 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6119 (match_operand:SI 2 "shift_count_operand" "Y")))]
6122 [(set_attr "op_type" "RSE")
6123 (set_attr "atype" "reg")])
6126 ; ashrdi3 instruction pattern(s).
6129 (define_expand "ashrdi3"
6131 [(set (match_operand:DI 0 "register_operand" "")
6132 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6133 (match_operand:SI 2 "shift_count_operand" "")))
6134 (clobber (reg:CC 33))])]
6138 (define_insn "*ashrdi3_cc_31"
6140 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6141 (match_operand:SI 2 "shift_count_operand" "Y"))
6143 (set (match_operand:DI 0 "register_operand" "=d")
6144 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6145 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6147 [(set_attr "op_type" "RS")
6148 (set_attr "atype" "reg")])
6150 (define_insn "*ashrdi3_cconly_31"
6152 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6153 (match_operand:SI 2 "shift_count_operand" "Y"))
6155 (clobber (match_scratch:DI 0 "=d"))]
6156 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6158 [(set_attr "op_type" "RS")
6159 (set_attr "atype" "reg")])
6161 (define_insn "*ashrdi3_31"
6162 [(set (match_operand:DI 0 "register_operand" "=d")
6163 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6164 (match_operand:SI 2 "shift_count_operand" "Y")))
6165 (clobber (reg:CC 33))]
6168 [(set_attr "op_type" "RS")
6169 (set_attr "atype" "reg")])
6171 (define_insn "*ashrdi3_cc_64"
6173 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6174 (match_operand:SI 2 "shift_count_operand" "Y"))
6176 (set (match_operand:DI 0 "register_operand" "=d")
6177 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6178 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6180 [(set_attr "op_type" "RSE")
6181 (set_attr "atype" "reg")])
6183 (define_insn "*ashrdi3_cconly_64"
6185 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6186 (match_operand:SI 2 "shift_count_operand" "Y"))
6188 (clobber (match_scratch:DI 0 "=d"))]
6189 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6191 [(set_attr "op_type" "RSE")
6192 (set_attr "atype" "reg")])
6194 (define_insn "*ashrdi3_64"
6195 [(set (match_operand:DI 0 "register_operand" "=d")
6196 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6197 (match_operand:SI 2 "shift_count_operand" "Y")))
6198 (clobber (reg:CC 33))]
6201 [(set_attr "op_type" "RSE")
6202 (set_attr "atype" "reg")])
6206 ; ashlsi3 instruction pattern(s).
6209 (define_insn "ashlsi3"
6210 [(set (match_operand:SI 0 "register_operand" "=d")
6211 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6212 (match_operand:SI 2 "shift_count_operand" "Y")))]
6215 [(set_attr "op_type" "RS")
6216 (set_attr "atype" "reg")])
6219 ; ashrsi3 instruction pattern(s).
6222 (define_insn "*ashrsi3_cc"
6224 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6225 (match_operand:SI 2 "shift_count_operand" "Y"))
6227 (set (match_operand:SI 0 "register_operand" "=d")
6228 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6229 "s390_match_ccmode(insn, CCSmode)"
6231 [(set_attr "op_type" "RS")
6232 (set_attr "atype" "reg")])
6235 (define_insn "*ashrsi3_cconly"
6237 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6238 (match_operand:SI 2 "shift_count_operand" "Y"))
6240 (clobber (match_scratch:SI 0 "=d"))]
6241 "s390_match_ccmode(insn, CCSmode)"
6243 [(set_attr "op_type" "RS")
6244 (set_attr "atype" "reg")])
6246 (define_insn "ashrsi3"
6247 [(set (match_operand:SI 0 "register_operand" "=d")
6248 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6249 (match_operand:SI 2 "shift_count_operand" "Y")))
6250 (clobber (reg:CC 33))]
6253 [(set_attr "op_type" "RS")
6254 (set_attr "atype" "reg")])
6258 ;;- logical shift instructions.
6262 ; lshrdi3 instruction pattern(s).
6265 (define_expand "lshrdi3"
6266 [(set (match_operand:DI 0 "register_operand" "")
6267 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6268 (match_operand:SI 2 "shift_count_operand" "")))]
6272 (define_insn "*lshrdi3_31"
6273 [(set (match_operand:DI 0 "register_operand" "=d")
6274 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6275 (match_operand:SI 2 "shift_count_operand" "Y")))]
6278 [(set_attr "op_type" "RS")
6279 (set_attr "atype" "reg")])
6281 (define_insn "*lshrdi3_64"
6282 [(set (match_operand:DI 0 "register_operand" "=d")
6283 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6284 (match_operand:SI 2 "shift_count_operand" "Y")))]
6287 [(set_attr "op_type" "RSE")
6288 (set_attr "atype" "reg")])
6291 ; lshrsi3 instruction pattern(s).
6294 (define_insn "lshrsi3"
6295 [(set (match_operand:SI 0 "register_operand" "=d")
6296 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6297 (match_operand:SI 2 "shift_count_operand" "Y")))]
6300 [(set_attr "op_type" "RS")
6301 (set_attr "atype" "reg")])
6305 ;; Branch instruction patterns.
6308 (define_expand "beq"
6309 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6311 (if_then_else (eq (reg:CCZ 33) (const_int 0))
6312 (label_ref (match_operand 0 "" ""))
6315 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6317 (define_expand "bne"
6318 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6320 (if_then_else (ne (reg:CCZ 33) (const_int 0))
6321 (label_ref (match_operand 0 "" ""))
6324 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6326 (define_expand "bgt"
6327 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6329 (if_then_else (gt (reg:CCS 33) (const_int 0))
6330 (label_ref (match_operand 0 "" ""))
6333 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6335 (define_expand "bgtu"
6336 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6338 (if_then_else (gtu (reg:CCU 33) (const_int 0))
6339 (label_ref (match_operand 0 "" ""))
6342 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6344 (define_expand "blt"
6345 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6347 (if_then_else (lt (reg:CCS 33) (const_int 0))
6348 (label_ref (match_operand 0 "" ""))
6351 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6353 (define_expand "bltu"
6354 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6356 (if_then_else (ltu (reg:CCU 33) (const_int 0))
6357 (label_ref (match_operand 0 "" ""))
6360 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6362 (define_expand "bge"
6363 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6365 (if_then_else (ge (reg:CCS 33) (const_int 0))
6366 (label_ref (match_operand 0 "" ""))
6369 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6371 (define_expand "bgeu"
6372 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6374 (if_then_else (geu (reg:CCU 33) (const_int 0))
6375 (label_ref (match_operand 0 "" ""))
6378 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6380 (define_expand "ble"
6381 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6383 (if_then_else (le (reg:CCS 33) (const_int 0))
6384 (label_ref (match_operand 0 "" ""))
6387 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6389 (define_expand "bleu"
6390 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6392 (if_then_else (leu (reg:CCU 33) (const_int 0))
6393 (label_ref (match_operand 0 "" ""))
6396 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6398 (define_expand "bunordered"
6399 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6401 (if_then_else (unordered (reg:CCS 33) (const_int 0))
6402 (label_ref (match_operand 0 "" ""))
6405 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6407 (define_expand "bordered"
6408 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6410 (if_then_else (ordered (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 "buneq"
6417 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6419 (if_then_else (uneq (reg:CCS 33) (const_int 0))
6420 (label_ref (match_operand 0 "" ""))
6423 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6425 (define_expand "bungt"
6426 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6428 (if_then_else (ungt (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 "bunlt"
6435 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6437 (if_then_else (unlt (reg:CCS 33) (const_int 0))
6438 (label_ref (match_operand 0 "" ""))
6441 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6443 (define_expand "bunge"
6444 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6446 (if_then_else (unge (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 "bunle"
6453 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6455 (if_then_else (unle (reg:CCS 33) (const_int 0))
6456 (label_ref (match_operand 0 "" ""))
6459 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6461 (define_expand "bltgt"
6462 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6464 (if_then_else (ltgt (reg:CCS 33) (const_int 0))
6465 (label_ref (match_operand 0 "" ""))
6468 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6472 ;;- Conditional jump instructions.
6475 (define_insn "cjump"
6478 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6479 (label_ref (match_operand 0 "" ""))
6483 if (get_attr_length (insn) == 4)
6485 else if (TARGET_CPU_ZARCH)
6486 return "jg%C1\t%l0";
6490 [(set_attr "op_type" "RI")
6491 (set_attr "type" "branch")
6492 (set (attr "length")
6493 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6495 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6497 (eq (symbol_ref "flag_pic") (const_int 0))
6498 (const_int 6)] (const_int 8)))])
6500 (define_insn "*cjump_long"
6503 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6504 (match_operand 0 "address_operand" "U")
6508 if (get_attr_op_type (insn) == OP_TYPE_RR)
6513 [(set (attr "op_type")
6514 (if_then_else (match_operand 0 "register_operand" "")
6515 (const_string "RR") (const_string "RX")))
6516 (set_attr "type" "branch")
6517 (set_attr "atype" "agen")])
6521 ;;- Negated conditional jump instructions.
6524 (define_insn "icjump"
6527 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6529 (label_ref (match_operand 0 "" ""))))]
6532 if (get_attr_length (insn) == 4)
6534 else if (TARGET_CPU_ZARCH)
6535 return "jg%D1\t%l0";
6539 [(set_attr "op_type" "RI")
6540 (set_attr "type" "branch")
6541 (set (attr "length")
6542 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6544 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6546 (eq (symbol_ref "flag_pic") (const_int 0))
6547 (const_int 6)] (const_int 8)))])
6549 (define_insn "*icjump_long"
6552 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6554 (match_operand 0 "address_operand" "U")))]
6557 if (get_attr_op_type (insn) == OP_TYPE_RR)
6562 [(set (attr "op_type")
6563 (if_then_else (match_operand 0 "register_operand" "")
6564 (const_string "RR") (const_string "RX")))
6565 (set_attr "type" "branch")
6566 (set_attr "atype" "agen")])
6569 ;;- Trap instructions.
6573 [(trap_if (const_int 1) (const_int 0))]
6576 [(set_attr "op_type" "RX")
6577 (set_attr "type" "branch")])
6579 (define_expand "conditional_trap"
6580 [(set (match_dup 2) (match_dup 3))
6581 (trap_if (match_operator 0 "comparison_operator"
6582 [(match_dup 2) (const_int 0)])
6583 (match_operand:SI 1 "general_operand" ""))]
6586 enum machine_mode ccmode;
6588 if (operands[1] != const0_rtx) FAIL;
6590 ccmode = s390_select_ccmode (GET_CODE (operands[0]),
6591 s390_compare_op0, s390_compare_op1);
6592 operands[2] = gen_rtx_REG (ccmode, 33);
6593 operands[3] = gen_rtx_COMPARE (ccmode, s390_compare_op0, s390_compare_op1);
6596 (define_insn "*trap"
6597 [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6601 [(set_attr "op_type" "RI")
6602 (set_attr "type" "branch")])
6605 ;;- Loop instructions.
6607 ;; This is all complicated by the fact that since this is a jump insn
6608 ;; we must handle our own output reloads.
6610 (define_expand "doloop_end"
6611 [(use (match_operand 0 "" "")) ; loop pseudo
6612 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6613 (use (match_operand 2 "" "")) ; max iterations
6614 (use (match_operand 3 "" "")) ; loop level
6615 (use (match_operand 4 "" ""))] ; label
6618 if (GET_MODE (operands[0]) == SImode)
6619 emit_jump_insn (gen_doloop_si (operands[4], operands[0], operands[0]));
6620 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6621 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6628 (define_insn "doloop_si"
6631 (ne (match_operand:SI 1 "register_operand" "d,d")
6633 (label_ref (match_operand 0 "" ""))
6635 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6636 (plus:SI (match_dup 1) (const_int -1)))
6637 (clobber (match_scratch:SI 3 "=X,&d"))
6638 (clobber (reg:CC 33))]
6641 if (which_alternative != 0)
6643 else if (get_attr_length (insn) == 4)
6644 return "brct\t%1,%l0";
6645 else if (TARGET_CPU_ZARCH)
6646 return "ahi\t%1,-1\;jgne\t%l0";
6650 [(set_attr "op_type" "RI")
6651 (set_attr "type" "branch")
6652 (set (attr "length")
6653 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6655 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6657 (eq (symbol_ref "flag_pic") (const_int 0))
6658 (const_int 6)] (const_int 8)))])
6660 (define_insn "*doloop_si_long"
6663 (ne (match_operand:SI 1 "register_operand" "d,d")
6665 (match_operand 0 "address_operand" "U,U")
6667 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6668 (plus:SI (match_dup 1) (const_int -1)))
6669 (clobber (match_scratch:SI 3 "=X,&d"))
6670 (clobber (reg:CC 33))]
6673 if (get_attr_op_type (insn) == OP_TYPE_RR)
6674 return "bctr\t%1,%0";
6676 return "bct\t%1,%a0";
6678 [(set (attr "op_type")
6679 (if_then_else (match_operand 0 "register_operand" "")
6680 (const_string "RR") (const_string "RX")))
6681 (set_attr "type" "branch")
6682 (set_attr "atype" "agen")])
6686 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
6688 (match_operand 0 "" "")
6690 (set (match_operand:SI 2 "nonimmediate_operand" "")
6691 (plus:SI (match_dup 1) (const_int -1)))
6692 (clobber (match_scratch:SI 3 ""))
6693 (clobber (reg:CC 33))]
6695 && (! REG_P (operands[2])
6696 || ! rtx_equal_p (operands[1], operands[2]))"
6697 [(set (match_dup 3) (match_dup 1))
6698 (parallel [(set (reg:CCAN 33)
6699 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6701 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6702 (set (match_dup 2) (match_dup 3))
6703 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6708 (define_insn "doloop_di"
6711 (ne (match_operand:DI 1 "register_operand" "d,d")
6713 (label_ref (match_operand 0 "" ""))
6715 (set (match_operand:DI 2 "register_operand" "=1,?*m*r")
6716 (plus:DI (match_dup 1) (const_int -1)))
6717 (clobber (match_scratch:DI 3 "=X,&d"))
6718 (clobber (reg:CC 33))]
6721 if (which_alternative != 0)
6723 else if (get_attr_length (insn) == 4)
6724 return "brctg\t%1,%l0";
6726 return "aghi\t%1,-1\;jgne\t%l0";
6728 [(set_attr "op_type" "RI")
6729 (set_attr "type" "branch")
6730 (set (attr "length")
6731 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6732 (const_int 4) (const_int 10)))])
6736 (if_then_else (ne (match_operand:DI 1 "register_operand" "")
6738 (match_operand 0 "" "")
6740 (set (match_operand:DI 2 "nonimmediate_operand" "")
6741 (plus:DI (match_dup 1) (const_int -1)))
6742 (clobber (match_scratch:DI 3 ""))
6743 (clobber (reg:CC 33))]
6745 && (! REG_P (operands[2])
6746 || ! rtx_equal_p (operands[1], operands[2]))"
6747 [(set (match_dup 3) (match_dup 1))
6748 (parallel [(set (reg:CCAN 33)
6749 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6751 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6752 (set (match_dup 2) (match_dup 3))
6753 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6759 ;;- Unconditional jump instructions.
6763 ; jump instruction pattern(s).
6767 [(set (pc) (label_ref (match_operand 0 "" "")))]
6770 if (get_attr_length (insn) == 4)
6772 else if (TARGET_CPU_ZARCH)
6777 [(set_attr "op_type" "RI")
6778 (set_attr "type" "branch")
6779 (set (attr "length")
6780 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6782 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6784 (eq (symbol_ref "flag_pic") (const_int 0))
6785 (const_int 6)] (const_int 8)))])
6788 ; indirect-jump instruction pattern(s).
6791 (define_insn "indirect_jump"
6792 [(set (pc) (match_operand 0 "address_operand" "U"))]
6795 if (get_attr_op_type (insn) == OP_TYPE_RR)
6800 [(set (attr "op_type")
6801 (if_then_else (match_operand 0 "register_operand" "")
6802 (const_string "RR") (const_string "RX")))
6803 (set_attr "type" "branch")
6804 (set_attr "atype" "agen")])
6807 ; casesi instruction pattern(s).
6810 (define_insn "casesi_jump"
6811 [(set (pc) (match_operand 0 "address_operand" "U"))
6812 (use (label_ref (match_operand 1 "" "")))]
6815 if (get_attr_op_type (insn) == OP_TYPE_RR)
6820 [(set (attr "op_type")
6821 (if_then_else (match_operand 0 "register_operand" "")
6822 (const_string "RR") (const_string "RX")))
6823 (set_attr "type" "branch")
6824 (set_attr "atype" "agen")])
6826 (define_expand "casesi"
6827 [(match_operand:SI 0 "general_operand" "")
6828 (match_operand:SI 1 "general_operand" "")
6829 (match_operand:SI 2 "general_operand" "")
6830 (label_ref (match_operand 3 "" ""))
6831 (label_ref (match_operand 4 "" ""))]
6834 rtx index = gen_reg_rtx (SImode);
6835 rtx base = gen_reg_rtx (Pmode);
6836 rtx target = gen_reg_rtx (Pmode);
6838 emit_move_insn (index, operands[0]);
6839 emit_insn (gen_subsi3 (index, index, operands[1]));
6840 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6843 if (Pmode != SImode)
6844 index = convert_to_mode (Pmode, index, 1);
6845 if (GET_CODE (index) != REG)
6846 index = copy_to_mode_reg (Pmode, index);
6849 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6851 emit_insn (gen_ashlsi3 (index, index, GEN_INT (2)));
6853 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6855 index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
6856 emit_move_insn (target, index);
6859 target = gen_rtx_PLUS (Pmode, base, target);
6860 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6867 ;;- Jump to subroutine.
6872 ; untyped call instruction pattern(s).
6875 ;; Call subroutine returning any type.
6876 (define_expand "untyped_call"
6877 [(parallel [(call (match_operand 0 "" "")
6879 (match_operand 1 "" "")
6880 (match_operand 2 "" "")])]
6885 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6887 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6889 rtx set = XVECEXP (operands[2], 0, i);
6890 emit_move_insn (SET_DEST (set), SET_SRC (set));
6893 /* The optimizer does not know that the call sets the function value
6894 registers we stored in the result block. We avoid problems by
6895 claiming that all hard registers are used and clobbered at this
6897 emit_insn (gen_blockage ());
6902 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6903 ;; all of memory. This blocks insns from being moved across this point.
6905 (define_insn "blockage"
6906 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6909 [(set_attr "type" "none")
6910 (set_attr "length" "0")])
6915 ; call instruction pattern(s).
6918 (define_expand "call"
6919 [(call (match_operand 0 "" "")
6920 (match_operand 1 "" ""))
6921 (use (match_operand 2 "" ""))]
6924 bool plt_call = false;
6927 /* Direct function calls need special treatment. */
6928 if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
6930 rtx sym = XEXP (operands[0], 0);
6932 /* When calling a global routine in PIC mode, we must
6933 replace the symbol itself with the PLT stub. */
6934 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
6936 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
6937 sym = gen_rtx_CONST (Pmode, sym);
6941 /* Unless we can use the bras(l) insn, force the
6942 routine address into a register. */
6943 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
6946 sym = legitimize_pic_address (sym, 0);
6948 sym = force_reg (Pmode, sym);
6951 operands[0] = gen_rtx_MEM (QImode, sym);
6955 insn = emit_call_insn (gen_call_exp (operands[0], operands[1],
6956 gen_rtx_REG (Pmode, RETURN_REGNUM)));
6958 /* 31-bit PLT stubs use the GOT register implicitly. */
6959 if (!TARGET_64BIT && plt_call)
6960 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
6965 (define_expand "call_exp"
6966 [(parallel [(call (match_operand 0 "" "")
6967 (match_operand 1 "" ""))
6968 (clobber (match_operand 2 "" ""))])]
6972 (define_insn "*bras"
6973 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6974 (match_operand 1 "const_int_operand" "n"))
6975 (clobber (match_operand 2 "register_operand" "=r"))]
6976 "TARGET_SMALL_EXEC && GET_MODE (operands[2]) == Pmode"
6978 [(set_attr "op_type" "RI")
6979 (set_attr "type" "jsr")])
6981 (define_insn "*brasl"
6982 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6983 (match_operand 1 "const_int_operand" "n"))
6984 (clobber (match_operand 2 "register_operand" "=r"))]
6985 "TARGET_CPU_ZARCH && GET_MODE (operands[2]) == Pmode"
6987 [(set_attr "op_type" "RIL")
6988 (set_attr "type" "jsr")])
6990 (define_insn "*basr"
6991 [(call (mem:QI (match_operand 0 "address_operand" "U"))
6992 (match_operand 1 "const_int_operand" "n"))
6993 (clobber (match_operand 2 "register_operand" "=r"))]
6994 "GET_MODE (operands[2]) == Pmode"
6996 if (get_attr_op_type (insn) == OP_TYPE_RR)
6997 return "basr\t%2,%0";
6999 return "bas\t%2,%a0";
7001 [(set (attr "op_type")
7002 (if_then_else (match_operand 0 "register_operand" "")
7003 (const_string "RR") (const_string "RX")))
7004 (set_attr "type" "jsr")
7005 (set_attr "atype" "agen")])
7008 ; call_value instruction pattern(s).
7011 (define_expand "call_value"
7012 [(set (match_operand 0 "" "")
7013 (call (match_operand 1 "" "")
7014 (match_operand 2 "" "")))
7015 (use (match_operand 3 "" ""))]
7018 bool plt_call = false;
7021 /* Direct function calls need special treatment. */
7022 if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
7024 rtx sym = XEXP (operands[1], 0);
7026 /* When calling a global routine in PIC mode, we must
7027 replace the symbol itself with the PLT stub. */
7028 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
7030 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7031 sym = gen_rtx_CONST (Pmode, sym);
7035 /* Unless we can use the bras(l) insn, force the
7036 routine address into a register. */
7037 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7040 sym = legitimize_pic_address (sym, 0);
7042 sym = force_reg (Pmode, sym);
7045 operands[1] = gen_rtx_MEM (QImode, sym);
7049 insn = emit_call_insn (
7050 gen_call_value_exp (operands[0], operands[1], operands[2],
7051 gen_rtx_REG (Pmode, RETURN_REGNUM)));
7053 /* 31-bit PLT stubs use the GOT register implicitly. */
7054 if (!TARGET_64BIT && plt_call)
7055 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7060 (define_expand "call_value_exp"
7061 [(parallel [(set (match_operand 0 "" "")
7062 (call (match_operand 1 "" "")
7063 (match_operand 2 "" "")))
7064 (clobber (match_operand 3 "" ""))])]
7068 (define_insn "*bras_r"
7069 [(set (match_operand 0 "" "")
7070 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7071 (match_operand:SI 2 "const_int_operand" "n")))
7072 (clobber (match_operand 3 "register_operand" "=r"))]
7073 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7075 [(set_attr "op_type" "RI")
7076 (set_attr "type" "jsr")])
7078 (define_insn "*brasl_r"
7079 [(set (match_operand 0 "" "")
7080 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7081 (match_operand 2 "const_int_operand" "n")))
7082 (clobber (match_operand 3 "register_operand" "=r"))]
7083 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7085 [(set_attr "op_type" "RIL")
7086 (set_attr "type" "jsr")])
7088 (define_insn "*basr_r"
7089 [(set (match_operand 0 "" "")
7090 (call (mem:QI (match_operand 1 "address_operand" "U"))
7091 (match_operand 2 "const_int_operand" "n")))
7092 (clobber (match_operand 3 "register_operand" "=r"))]
7093 "GET_MODE (operands[3]) == Pmode"
7095 if (get_attr_op_type (insn) == OP_TYPE_RR)
7096 return "basr\t%3,%1";
7098 return "bas\t%3,%a1";
7100 [(set (attr "op_type")
7101 (if_then_else (match_operand 1 "register_operand" "")
7102 (const_string "RR") (const_string "RX")))
7103 (set_attr "type" "jsr")
7104 (set_attr "atype" "agen")])
7107 ;;- Thread-local storage support.
7110 (define_insn "get_tp_64"
7111 [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7112 (unspec:DI [(const_int 0)] UNSPEC_TP))]
7115 ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7117 [(set_attr "op_type" "NN,RS")
7118 (set_attr "atype" "reg,*")
7119 (set_attr "type" "o3,*")
7120 (set_attr "length" "14,*")])
7122 (define_insn "get_tp_31"
7123 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7124 (unspec:SI [(const_int 0)] UNSPEC_TP))]
7129 [(set_attr "op_type" "RRE,RS")])
7131 (define_insn "set_tp_64"
7132 [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7133 (clobber (match_scratch:SI 1 "=d,X"))]
7136 sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7138 [(set_attr "op_type" "NN,RS")
7139 (set_attr "atype" "reg,*")
7140 (set_attr "type" "o3,*")
7141 (set_attr "length" "14,*")])
7143 (define_insn "set_tp_31"
7144 [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7149 [(set_attr "op_type" "RRE,RS")])
7151 (define_insn "*tls_load_64"
7152 [(set (match_operand:DI 0 "register_operand" "=d")
7153 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7154 (match_operand:DI 2 "" "")]
7158 [(set_attr "op_type" "RXE")])
7160 (define_insn "*tls_load_31"
7161 [(set (match_operand:SI 0 "register_operand" "=d,d")
7162 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7163 (match_operand:SI 2 "" "")]
7169 [(set_attr "op_type" "RX,RXY")])
7171 (define_expand "call_value_tls"
7172 [(set (match_operand 0 "" "")
7173 (call (const_int 0) (const_int 0)))
7174 (use (match_operand 1 "" ""))]
7182 sym = s390_tls_get_offset ();
7183 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7184 sym = gen_rtx_CONST (Pmode, sym);
7186 /* Unless we can use the bras(l) insn, force the
7187 routine address into a register. */
7188 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7191 sym = legitimize_pic_address (sym, 0);
7193 sym = force_reg (Pmode, sym);
7196 sym = gen_rtx_MEM (QImode, sym);
7199 insn = emit_call_insn (
7200 gen_call_value_tls_exp (operands[0], sym, const0_rtx,
7201 gen_rtx_REG (Pmode, RETURN_REGNUM),
7204 /* The calling convention of __tls_get_offset uses the
7205 GOT register implicitly. */
7206 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7207 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), operands[0]);
7208 CONST_OR_PURE_CALL_P (insn) = 1;
7213 (define_expand "call_value_tls_exp"
7214 [(parallel [(set (match_operand 0 "" "")
7215 (call (match_operand 1 "" "")
7216 (match_operand 2 "" "")))
7217 (clobber (match_operand 3 "" ""))
7218 (use (match_operand 4 "" ""))])]
7222 (define_insn "*bras_tls"
7223 [(set (match_operand 0 "" "")
7224 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7225 (match_operand 2 "const_int_operand" "n")))
7226 (clobber (match_operand 3 "register_operand" "=r"))
7227 (use (match_operand 4 "" ""))]
7228 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7230 [(set_attr "op_type" "RI")
7231 (set_attr "type" "jsr")])
7233 (define_insn "*brasl_tls"
7234 [(set (match_operand 0 "" "")
7235 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7236 (match_operand 2 "const_int_operand" "n")))
7237 (clobber (match_operand 3 "register_operand" "=r"))
7238 (use (match_operand 4 "" ""))]
7239 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7241 [(set_attr "op_type" "RIL")
7242 (set_attr "type" "jsr")])
7244 (define_insn "*basr_tls"
7245 [(set (match_operand 0 "" "")
7246 (call (mem:QI (match_operand 1 "address_operand" "U"))
7247 (match_operand 2 "const_int_operand" "n")))
7248 (clobber (match_operand 3 "register_operand" "=r"))
7249 (use (match_operand 4 "" ""))]
7250 "GET_MODE (operands[3]) == Pmode"
7252 if (get_attr_op_type (insn) == OP_TYPE_RR)
7253 return "basr\t%3,%1%J4";
7255 return "bas\t%3,%a1%J4";
7257 [(set (attr "op_type")
7258 (if_then_else (match_operand 1 "register_operand" "")
7259 (const_string "RR") (const_string "RX")))
7260 (set_attr "type" "jsr")
7261 (set_attr "atype" "agen")])
7264 ;;- Miscellaneous instructions.
7268 ; allocate stack instruction pattern(s).
7271 (define_expand "allocate_stack"
7273 (plus (reg 15) (match_operand 1 "general_operand" "")))
7274 (set (match_operand 0 "general_operand" "")
7278 rtx stack = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
7279 rtx chain = gen_rtx (MEM, Pmode, stack);
7280 rtx temp = gen_reg_rtx (Pmode);
7282 emit_move_insn (temp, chain);
7285 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7287 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7289 emit_move_insn (chain, temp);
7291 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7297 ; setjmp instruction pattern.
7300 (define_expand "builtin_setjmp_receiver"
7301 [(match_operand 0 "" "")]
7304 s390_load_got (false);
7305 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7309 ;; These patterns say how to save and restore the stack pointer. We need not
7310 ;; save the stack pointer at function level since we are careful to
7311 ;; preserve the backchain. At block level, we have to restore the backchain
7312 ;; when we restore the stack pointer.
7314 ;; For nonlocal gotos, we must save both the stack pointer and its
7315 ;; backchain and restore both. Note that in the nonlocal case, the
7316 ;; save area is a memory location.
7318 (define_expand "save_stack_function"
7319 [(match_operand 0 "general_operand" "")
7320 (match_operand 1 "general_operand" "")]
7324 (define_expand "restore_stack_function"
7325 [(match_operand 0 "general_operand" "")
7326 (match_operand 1 "general_operand" "")]
7330 (define_expand "restore_stack_block"
7331 [(use (match_operand 0 "register_operand" ""))
7332 (set (match_dup 2) (match_dup 3))
7333 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7334 (set (match_dup 3) (match_dup 2))]
7337 operands[2] = gen_reg_rtx (Pmode);
7338 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7341 (define_expand "save_stack_nonlocal"
7342 [(match_operand 0 "memory_operand" "")
7343 (match_operand 1 "register_operand" "")]
7346 rtx temp = gen_reg_rtx (Pmode);
7348 /* Copy the backchain to the first word, sp to the second and the literal pool
7349 base to the third. */
7350 emit_move_insn (operand_subword (operands[0], 2, 0,
7351 TARGET_64BIT ? OImode : TImode),
7352 gen_rtx_REG (Pmode, BASE_REGISTER));
7353 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7354 emit_move_insn (operand_subword (operands[0], 0, 0,
7355 TARGET_64BIT ? OImode : TImode),
7357 emit_move_insn (operand_subword (operands[0], 1, 0,
7358 TARGET_64BIT ? OImode : TImode),
7363 (define_expand "restore_stack_nonlocal"
7364 [(match_operand 0 "register_operand" "")
7365 (match_operand 1 "memory_operand" "")]
7368 rtx temp = gen_reg_rtx (Pmode);
7369 rtx base = gen_rtx_REG (Pmode, BASE_REGISTER);
7371 /* Restore the backchain from the first word, sp from the second and the
7372 literal pool base from the third. */
7373 emit_move_insn (temp,
7374 operand_subword (operands[1], 0, 0,
7375 TARGET_64BIT ? OImode : TImode));
7376 emit_move_insn (operands[0],
7377 operand_subword (operands[1], 1, 0,
7378 TARGET_64BIT ? OImode : TImode));
7379 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7380 emit_move_insn (base,
7381 operand_subword (operands[1], 2, 0,
7382 TARGET_64BIT ? OImode : TImode));
7383 emit_insn (gen_rtx_USE (VOIDmode, base));
7390 ; nop instruction pattern(s).
7397 [(set_attr "op_type" "RR")])
7401 ; Special literal pool access instruction pattern(s).
7404 (define_insn "*pool_entry"
7405 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7406 UNSPECV_POOL_ENTRY)]
7409 enum machine_mode mode = GET_MODE (PATTERN (insn));
7410 unsigned int align = GET_MODE_BITSIZE (mode);
7411 s390_output_pool_entry (asm_out_file, operands[0], mode, align);
7414 [(set_attr "op_type" "NN")
7415 (set (attr "length")
7416 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7418 (define_insn "pool_start_31"
7419 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7422 [(set_attr "op_type" "NN")
7423 (set_attr "length" "2")])
7425 (define_insn "pool_end_31"
7426 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7429 [(set_attr "op_type" "NN")
7430 (set_attr "length" "2")])
7432 (define_insn "pool_start_64"
7433 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7435 ".section\t.rodata\;.align\t8"
7436 [(set_attr "op_type" "NN")
7437 (set_attr "length" "0")])
7439 (define_insn "pool_end_64"
7440 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7443 [(set_attr "op_type" "NN")
7444 (set_attr "length" "0")])
7446 (define_insn "main_base_31_small"
7447 [(set (match_operand 0 "register_operand" "=a")
7448 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7449 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7451 [(set_attr "op_type" "RR")
7452 (set_attr "type" "la")])
7454 (define_insn "main_base_31_large"
7455 [(set (match_operand 0 "register_operand" "=a")
7456 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7457 (set (pc) (label_ref (match_operand 2 "" "")))]
7458 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7460 [(set_attr "op_type" "RI")])
7462 (define_insn "main_base_64"
7463 [(set (match_operand 0 "register_operand" "=a")
7464 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7465 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7467 [(set_attr "op_type" "RIL")
7468 (set_attr "type" "larl")])
7470 (define_insn "main_pool"
7471 [(unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL)]
7474 [(set_attr "op_type" "NN")])
7476 (define_insn "reload_base_31"
7477 [(set (match_operand 0 "register_operand" "=a")
7478 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7479 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7480 "basr\t%0,0\;la\t%0,%1-.(%0)"
7481 [(set_attr "op_type" "NN")
7482 (set_attr "type" "la")
7483 (set_attr "length" "6")])
7485 (define_insn "reload_base_64"
7486 [(set (match_operand 0 "register_operand" "=a")
7487 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7488 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7490 [(set_attr "op_type" "RIL")
7491 (set_attr "type" "larl")])
7494 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7497 [(set_attr "op_type" "NN")
7498 (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7501 ;; Insns related to generating the function prologue and epilogue.
7505 (define_expand "prologue"
7506 [(use (const_int 0))]
7508 "s390_emit_prologue (); DONE;")
7510 (define_expand "epilogue"
7511 [(use (const_int 1))]
7513 "s390_emit_epilogue (); DONE;")
7515 (define_insn "*return"
7517 (use (match_operand 0 "register_operand" "a"))]
7518 "GET_MODE (operands[0]) == Pmode"
7520 [(set_attr "op_type" "RR")
7521 (set_attr "type" "jsr")
7522 (set_attr "atype" "agen")])
7525 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7526 ;; pointer. This is used for compatibility.
7528 (define_expand "ptr_extend"
7529 [(set (match_operand:DI 0 "register_operand" "=r")
7530 (match_operand:SI 1 "register_operand" "r"))]
7533 emit_insn (gen_anddi3 (operands[0],
7534 gen_lowpart (DImode, operands[1]),
7535 GEN_INT (0x7fffffff)));