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 (constm1_rtx, 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 (constm1_rtx, 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).
1700 (define_expand "load_multiple"
1701 [(match_par_dup 3 [(set (match_operand 0 "" "")
1702 (match_operand 1 "" ""))
1703 (use (match_operand 2 "" ""))])]
1706 enum machine_mode mode;
1712 /* Support only loading a constant number of fixed-point registers from
1713 memory and only bother with this if more than two */
1714 if (GET_CODE (operands[2]) != CONST_INT
1715 || INTVAL (operands[2]) < 2
1716 || INTVAL (operands[2]) > 16
1717 || GET_CODE (operands[1]) != MEM
1718 || GET_CODE (operands[0]) != REG
1719 || REGNO (operands[0]) >= 16)
1722 count = INTVAL (operands[2]);
1723 regno = REGNO (operands[0]);
1724 mode = GET_MODE (operands[0]);
1725 if (mode != SImode && mode != word_mode)
1728 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1731 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1733 from = XEXP (operands[1], 0);
1736 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1737 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1738 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1740 from = XEXP (XEXP (operands[1], 0), 0);
1741 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1746 if (from == frame_pointer_rtx || from == arg_pointer_rtx)
1751 from = force_reg (Pmode, XEXP (operands[1], 0));
1755 for (i = 0; i < count; i++)
1756 XVECEXP (operands[3], 0, i)
1757 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1758 change_address (operands[1], mode,
1759 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1762 (define_insn "*load_multiple_di"
1763 [(match_parallel 0 "load_multiple_operation"
1764 [(set (match_operand:DI 1 "register_operand" "=r")
1765 (match_operand:DI 2 "s_operand" "QS"))])]
1766 "word_mode == DImode"
1768 int words = XVECLEN (operands[0], 0);
1769 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1770 return "lmg\t%1,%0,%2";
1772 [(set_attr "op_type" "RSY")
1773 (set_attr "type" "lm")])
1775 (define_insn "*load_multiple_si"
1776 [(match_parallel 0 "load_multiple_operation"
1777 [(set (match_operand:SI 1 "register_operand" "=r,r")
1778 (match_operand:SI 2 "s_operand" "Q,S"))])]
1781 int words = XVECLEN (operands[0], 0);
1782 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1783 return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1785 [(set_attr "op_type" "RS,RSY")
1786 (set_attr "type" "lm")])
1789 ; store multiple pattern(s).
1792 (define_expand "store_multiple"
1793 [(match_par_dup 3 [(set (match_operand 0 "" "")
1794 (match_operand 1 "" ""))
1795 (use (match_operand 2 "" ""))])]
1798 enum machine_mode mode;
1804 /* Support only storing a constant number of fixed-point registers to
1805 memory and only bother with this if more than two. */
1806 if (GET_CODE (operands[2]) != CONST_INT
1807 || INTVAL (operands[2]) < 2
1808 || INTVAL (operands[2]) > 16
1809 || GET_CODE (operands[0]) != MEM
1810 || GET_CODE (operands[1]) != REG
1811 || REGNO (operands[1]) >= 16)
1814 count = INTVAL (operands[2]);
1815 regno = REGNO (operands[1]);
1816 mode = GET_MODE (operands[1]);
1817 if (mode != SImode && mode != word_mode)
1820 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1824 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1826 to = XEXP (operands[0], 0);
1829 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1830 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1831 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1833 to = XEXP (XEXP (operands[0], 0), 0);
1834 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1839 if (to == frame_pointer_rtx || to == arg_pointer_rtx)
1844 to = force_reg (Pmode, XEXP (operands[0], 0));
1848 for (i = 0; i < count; i++)
1849 XVECEXP (operands[3], 0, i)
1850 = gen_rtx_SET (VOIDmode,
1851 change_address (operands[0], mode,
1852 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1853 gen_rtx_REG (mode, regno + i));
1856 (define_insn "*store_multiple_di"
1857 [(match_parallel 0 "store_multiple_operation"
1858 [(set (match_operand:DI 1 "s_operand" "=QS")
1859 (match_operand:DI 2 "register_operand" "r"))])]
1860 "word_mode == DImode"
1862 int words = XVECLEN (operands[0], 0);
1863 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1864 return "stmg\t%2,%0,%1";
1866 [(set_attr "op_type" "RSY")
1867 (set_attr "type" "stm")])
1870 (define_insn "*store_multiple_si"
1871 [(match_parallel 0 "store_multiple_operation"
1872 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1873 (match_operand:SI 2 "register_operand" "r,r"))])]
1876 int words = XVECLEN (operands[0], 0);
1877 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1878 return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1880 [(set_attr "op_type" "RS,RSY")
1881 (set_attr "type" "stm")])
1884 ;; String instructions.
1888 ; strlenM instruction pattern(s).
1891 (define_expand "strlendi"
1892 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1895 (unspec:DI [(const_int 0)
1896 (match_operand:BLK 1 "memory_operand" "")
1898 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1899 (clobber (scratch:DI))
1900 (clobber (reg:CC 33))])
1902 [(set (match_operand:DI 0 "register_operand" "")
1903 (minus:DI (match_dup 4) (match_dup 5)))
1904 (clobber (reg:CC 33))])]
1907 operands[4] = gen_reg_rtx (DImode);
1908 operands[5] = gen_reg_rtx (DImode);
1909 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1910 operands[1] = replace_equiv_address (operands[1], operands[5]);
1913 (define_insn "*strlendi"
1914 [(set (match_operand:DI 0 "register_operand" "=a")
1915 (unspec:DI [(match_operand:DI 2 "general_operand" "0")
1916 (mem:BLK (match_operand:DI 3 "register_operand" "1"))
1918 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1919 (clobber (match_scratch:DI 1 "=a"))
1920 (clobber (reg:CC 33))]
1922 "srst\t%0,%1\;jo\t.-4"
1923 [(set_attr "op_type" "NN")
1924 (set_attr "type" "vs")
1925 (set_attr "length" "8")])
1927 (define_expand "strlensi"
1928 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1931 (unspec:SI [(const_int 0)
1932 (match_operand:BLK 1 "memory_operand" "")
1934 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1935 (clobber (scratch:SI))
1936 (clobber (reg:CC 33))])
1938 [(set (match_operand:SI 0 "register_operand" "")
1939 (minus:SI (match_dup 4) (match_dup 5)))
1940 (clobber (reg:CC 33))])]
1943 operands[4] = gen_reg_rtx (SImode);
1944 operands[5] = gen_reg_rtx (SImode);
1945 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1946 operands[1] = replace_equiv_address (operands[1], operands[5]);
1949 (define_insn "*strlensi"
1950 [(set (match_operand:SI 0 "register_operand" "=a")
1951 (unspec:SI [(match_operand:SI 2 "general_operand" "0")
1952 (mem:BLK (match_operand:SI 3 "register_operand" "1"))
1954 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1955 (clobber (match_scratch:SI 1 "=a"))
1956 (clobber (reg:CC 33))]
1958 "srst\t%0,%1\;jo\t.-4"
1959 [(set_attr "op_type" "NN")
1960 (set_attr "type" "vs")
1961 (set_attr "length" "8")])
1964 ; movstrM instruction pattern(s).
1967 (define_expand "movstrdi"
1968 [(set (match_operand:BLK 0 "memory_operand" "")
1969 (match_operand:BLK 1 "memory_operand" ""))
1970 (use (match_operand:DI 2 "general_operand" ""))
1971 (match_operand 3 "" "")]
1973 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1975 (define_expand "movstrsi"
1976 [(set (match_operand:BLK 0 "memory_operand" "")
1977 (match_operand:BLK 1 "memory_operand" ""))
1978 (use (match_operand:SI 2 "general_operand" ""))
1979 (match_operand 3 "" "")]
1981 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1983 ; Move a block that is up to 256 bytes in length.
1984 ; The block length is taken as (operands[2] % 256) + 1.
1986 (define_expand "movstr_short"
1988 [(set (match_operand:BLK 0 "memory_operand" "")
1989 (match_operand:BLK 1 "memory_operand" ""))
1990 (use (match_operand 2 "nonmemory_operand" ""))
1991 (clobber (match_dup 3))])]
1993 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1995 (define_insn "*movstr_short"
1996 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1997 (match_operand:BLK 1 "memory_operand" "Q,Q"))
1998 (use (match_operand 2 "nonmemory_operand" "n,a"))
1999 (clobber (match_scratch 3 "=X,&a"))]
2000 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2001 && GET_MODE (operands[3]) == Pmode"
2003 switch (which_alternative)
2006 return "mvc\t%O0(%b2+1,%R0),%1";
2009 output_asm_insn ("bras\t%3,.+10", operands);
2010 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
2011 return "ex\t%2,0(%3)";
2017 [(set_attr "op_type" "SS,NN")
2018 (set_attr "type" "cs,cs")
2019 (set_attr "atype" "*,agen")
2020 (set_attr "length" "*,14")])
2022 ; Move a block of arbitrary length.
2024 (define_expand "movstr_long"
2026 [(clobber (match_dup 2))
2027 (clobber (match_dup 3))
2028 (set (match_operand:BLK 0 "memory_operand" "")
2029 (match_operand:BLK 1 "memory_operand" ""))
2030 (use (match_operand 2 "general_operand" ""))
2032 (clobber (reg:CC 33))])]
2035 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2036 rtx reg0 = gen_reg_rtx (dword_mode);
2037 rtx reg1 = gen_reg_rtx (dword_mode);
2038 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2039 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2040 rtx len0 = gen_lowpart (Pmode, reg0);
2041 rtx len1 = gen_lowpart (Pmode, reg1);
2043 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2044 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2045 emit_move_insn (len0, operands[2]);
2047 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2048 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2049 emit_move_insn (len1, operands[2]);
2051 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2052 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2057 (define_insn "*movstr_long_64"
2058 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2059 (clobber (match_operand:TI 1 "register_operand" "=d"))
2060 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2061 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
2064 (clobber (reg:CC 33))]
2066 "mvcle\t%0,%1,0\;jo\t.-4"
2067 [(set_attr "op_type" "NN")
2068 (set_attr "type" "vs")
2069 (set_attr "length" "8")])
2071 (define_insn "*movstr_long_31"
2072 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2073 (clobber (match_operand:DI 1 "register_operand" "=d"))
2074 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2075 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
2078 (clobber (reg:CC 33))]
2080 "mvcle\t%0,%1,0\;jo\t.-4"
2081 [(set_attr "op_type" "NN")
2082 (set_attr "type" "vs")
2083 (set_attr "length" "8")])
2086 ; clrstrM instruction pattern(s).
2089 (define_expand "clrstrdi"
2090 [(set (match_operand:BLK 0 "memory_operand" "")
2092 (use (match_operand:DI 1 "general_operand" ""))
2093 (match_operand 2 "" "")]
2095 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
2097 (define_expand "clrstrsi"
2098 [(set (match_operand:BLK 0 "memory_operand" "")
2100 (use (match_operand:SI 1 "general_operand" ""))
2101 (match_operand 2 "" "")]
2103 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
2105 ; Clear a block that is up to 256 bytes in length.
2106 ; The block length is taken as (operands[1] % 256) + 1.
2108 (define_expand "clrstr_short"
2110 [(set (match_operand:BLK 0 "memory_operand" "")
2112 (use (match_operand 1 "nonmemory_operand" ""))
2113 (clobber (match_dup 2))
2114 (clobber (reg:CC 33))])]
2116 "operands[2] = gen_rtx_SCRATCH (Pmode);")
2118 (define_insn "*clrstr_short"
2119 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
2121 (use (match_operand 1 "nonmemory_operand" "n,a"))
2122 (clobber (match_scratch 2 "=X,&a"))
2123 (clobber (reg:CC 33))]
2124 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
2125 && GET_MODE (operands[2]) == Pmode"
2127 switch (which_alternative)
2130 return "xc\t%O0(%b1+1,%R0),%0";
2133 output_asm_insn ("bras\t%2,.+10", operands);
2134 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
2135 return "ex\t%1,0(%2)";
2141 [(set_attr "op_type" "SS,NN")
2142 (set_attr "type" "cs,cs")
2143 (set_attr "atype" "*,agen")
2144 (set_attr "length" "*,14")])
2146 ; Clear a block of arbitrary length.
2148 (define_expand "clrstr_long"
2150 [(clobber (match_dup 1))
2151 (set (match_operand:BLK 0 "memory_operand" "")
2153 (use (match_operand 1 "general_operand" ""))
2155 (clobber (reg:CC 33))])]
2158 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2159 rtx reg0 = gen_reg_rtx (dword_mode);
2160 rtx reg1 = gen_reg_rtx (dword_mode);
2161 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2162 rtx len0 = gen_lowpart (Pmode, reg0);
2164 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2165 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2166 emit_move_insn (len0, operands[1]);
2168 emit_move_insn (reg1, const0_rtx);
2170 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2175 (define_insn "*clrstr_long_64"
2176 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2177 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2180 (use (match_operand:TI 1 "register_operand" "d"))
2181 (clobber (reg:CC 33))]
2183 "mvcle\t%0,%1,0\;jo\t.-4"
2184 [(set_attr "op_type" "NN")
2185 (set_attr "type" "vs")
2186 (set_attr "length" "8")])
2188 (define_insn "*clrstr_long_31"
2189 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2190 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2193 (use (match_operand:DI 1 "register_operand" "d"))
2194 (clobber (reg:CC 33))]
2196 "mvcle\t%0,%1,0\;jo\t.-4"
2197 [(set_attr "op_type" "NN")
2198 (set_attr "type" "vs")
2199 (set_attr "length" "8")])
2202 ; cmpmemM instruction pattern(s).
2205 (define_expand "cmpmemdi"
2206 [(set (match_operand:DI 0 "register_operand" "")
2207 (compare:DI (match_operand:BLK 1 "memory_operand" "")
2208 (match_operand:BLK 2 "memory_operand" "") ) )
2209 (use (match_operand:DI 3 "general_operand" ""))
2210 (use (match_operand:DI 4 "" ""))]
2212 "s390_expand_cmpmem (operands[0], operands[1],
2213 operands[2], operands[3]); DONE;")
2215 (define_expand "cmpmemsi"
2216 [(set (match_operand:SI 0 "register_operand" "")
2217 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2218 (match_operand:BLK 2 "memory_operand" "") ) )
2219 (use (match_operand:SI 3 "general_operand" ""))
2220 (use (match_operand:SI 4 "" ""))]
2222 "s390_expand_cmpmem (operands[0], operands[1],
2223 operands[2], operands[3]); DONE;")
2225 ; Compare a block that is up to 256 bytes in length.
2226 ; The block length is taken as (operands[2] % 256) + 1.
2228 (define_expand "cmpmem_short"
2231 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2232 (match_operand:BLK 1 "memory_operand" "")))
2233 (use (match_operand 2 "nonmemory_operand" ""))
2234 (clobber (match_dup 3))])]
2236 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2238 (define_insn "*cmpmem_short"
2240 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2241 (match_operand:BLK 1 "memory_operand" "Q,Q")))
2242 (use (match_operand 2 "nonmemory_operand" "n,a"))
2243 (clobber (match_scratch 3 "=X,&a"))]
2244 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2245 && GET_MODE (operands[3]) == Pmode"
2247 switch (which_alternative)
2250 return "clc\t%O0(%b2+1,%R0),%1";
2253 output_asm_insn ("bras\t%3,.+10", operands);
2254 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2255 return "ex\t%2,0(%3)";
2261 [(set_attr "op_type" "SS,NN")
2262 (set_attr "type" "cs,cs")
2263 (set_attr "atype" "*,agen")
2264 (set_attr "length" "*,14")])
2266 ; Compare a block of arbitrary length.
2268 (define_expand "cmpmem_long"
2270 [(clobber (match_dup 2))
2271 (clobber (match_dup 3))
2273 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2274 (match_operand:BLK 1 "memory_operand" "")))
2275 (use (match_operand 2 "general_operand" ""))
2276 (use (match_dup 3))])]
2279 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2280 rtx reg0 = gen_reg_rtx (dword_mode);
2281 rtx reg1 = gen_reg_rtx (dword_mode);
2282 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2283 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2284 rtx len0 = gen_lowpart (Pmode, reg0);
2285 rtx len1 = gen_lowpart (Pmode, reg1);
2287 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2288 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2289 emit_move_insn (len0, operands[2]);
2291 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2292 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2293 emit_move_insn (len1, operands[2]);
2295 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2296 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2301 (define_insn "*cmpmem_long_64"
2302 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2303 (clobber (match_operand:TI 1 "register_operand" "=d"))
2305 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2306 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2308 (use (match_dup 3))]
2310 "clcle\t%0,%1,0\;jo\t.-4"
2311 [(set_attr "op_type" "NN")
2312 (set_attr "type" "vs")
2313 (set_attr "length" "8")])
2315 (define_insn "*cmpmem_long_31"
2316 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2317 (clobber (match_operand:DI 1 "register_operand" "=d"))
2319 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2320 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2322 (use (match_dup 3))]
2324 "clcle\t%0,%1,0\;jo\t.-4"
2325 [(set_attr "op_type" "NN")
2326 (set_attr "type" "vs")
2327 (set_attr "length" "8")])
2329 ; Convert condition code to integer in range (-1, 0, 1)
2331 (define_insn "cmpint_si"
2332 [(set (match_operand:SI 0 "register_operand" "=d")
2333 (compare:SI (reg:CCS 33) (const_int 0)))]
2336 output_asm_insn ("lhi\t%0,1", operands);
2337 output_asm_insn ("jh\t.+12", operands);
2338 output_asm_insn ("jl\t.+6", operands);
2339 output_asm_insn ("sr\t%0,%0", operands);
2340 return "lcr\t%0,%0";
2342 [(set_attr "op_type" "NN")
2343 (set_attr "length" "16")
2344 (set_attr "type" "other")])
2346 (define_insn "cmpint_di"
2347 [(set (match_operand:DI 0 "register_operand" "=d")
2348 (compare:DI (reg:CCS 33) (const_int 0)))]
2351 output_asm_insn ("lghi\t%0,1", operands);
2352 output_asm_insn ("jh\t.+16", operands);
2353 output_asm_insn ("jl\t.+8", operands);
2354 output_asm_insn ("sgr\t%0,%0", operands);
2355 return "lcgr\t%0,%0";
2357 [(set_attr "op_type" "NN")
2358 (set_attr "length" "20")
2359 (set_attr "type" "other")])
2363 ;;- Conversion instructions.
2366 (define_insn "*sethighqisi"
2367 [(set (match_operand:SI 0 "register_operand" "=d,d")
2368 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2369 (clobber (reg:CC 33))]
2374 [(set_attr "op_type" "RS,RSY")])
2376 (define_insn "*sethighhisi"
2377 [(set (match_operand:SI 0 "register_operand" "=d,d")
2378 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2379 (clobber (reg:CC 33))]
2384 [(set_attr "op_type" "RS,RSY")])
2386 (define_insn "*sethighqidi_64"
2387 [(set (match_operand:DI 0 "register_operand" "=d")
2388 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2389 (clobber (reg:CC 33))]
2392 [(set_attr "op_type" "RSY")])
2394 (define_insn "*sethighqidi_31"
2395 [(set (match_operand:DI 0 "register_operand" "=d,d")
2396 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2397 (clobber (reg:CC 33))]
2402 [(set_attr "op_type" "RS,RSY")])
2404 (define_insn_and_split "*extractqi"
2405 [(set (match_operand:SI 0 "register_operand" "=d")
2406 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2407 (match_operand 2 "const_int_operand" "n")
2409 (clobber (reg:CC 33))]
2411 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2413 "&& reload_completed"
2415 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2416 (clobber (reg:CC 33))])
2417 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2419 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2420 operands[1] = change_address (operands[1], QImode, 0);
2422 [(set_attr "atype" "agen")])
2424 (define_insn_and_split "*extracthi"
2425 [(set (match_operand:SI 0 "register_operand" "=d")
2426 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2427 (match_operand 2 "const_int_operand" "n")
2429 (clobber (reg:CC 33))]
2431 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2433 "&& reload_completed"
2435 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2436 (clobber (reg:CC 33))])
2437 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2439 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2440 operands[1] = change_address (operands[1], HImode, 0);
2442 [(set_attr "atype" "agen")])
2445 ; extendsidi2 instruction pattern(s).
2448 (define_expand "extendsidi2"
2449 [(set (match_operand:DI 0 "register_operand" "")
2450 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2456 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2457 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2458 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2459 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2465 (define_insn "*extendsidi2"
2466 [(set (match_operand:DI 0 "register_operand" "=d,d")
2467 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2472 [(set_attr "op_type" "RRE,RXY")])
2475 ; extendhidi2 instruction pattern(s).
2478 (define_expand "extendhidi2"
2479 [(set (match_operand:DI 0 "register_operand" "")
2480 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2486 rtx tmp = gen_reg_rtx (SImode);
2487 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2488 emit_insn (gen_extendsidi2 (operands[0], tmp));
2493 operands[1] = gen_lowpart (DImode, operands[1]);
2494 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2495 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2501 (define_insn "*extendhidi2"
2502 [(set (match_operand:DI 0 "register_operand" "=d")
2503 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2506 [(set_attr "op_type" "RXY")])
2509 ; extendqidi2 instruction pattern(s).
2512 (define_expand "extendqidi2"
2513 [(set (match_operand:DI 0 "register_operand" "")
2514 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2520 rtx tmp = gen_reg_rtx (SImode);
2521 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2522 emit_insn (gen_extendsidi2 (operands[0], tmp));
2527 operands[1] = gen_lowpart (DImode, operands[1]);
2528 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2529 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2535 (define_insn "*extendqidi2"
2536 [(set (match_operand:DI 0 "register_operand" "=d")
2537 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2538 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2540 [(set_attr "op_type" "RXY")])
2542 (define_insn_and_split "*extendqidi2_short_displ"
2543 [(set (match_operand:DI 0 "register_operand" "=d")
2544 (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))]
2545 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2547 "&& reload_completed"
2549 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2550 (clobber (reg:CC 33))])
2552 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2553 (clobber (reg:CC 33))])]
2557 ; extendhisi2 instruction pattern(s).
2560 (define_expand "extendhisi2"
2561 [(set (match_operand:SI 0 "register_operand" "")
2562 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2566 operands[1] = gen_lowpart (SImode, operands[1]);
2567 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2568 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2573 (define_insn "*extendhisi2"
2574 [(set (match_operand:SI 0 "register_operand" "=d,d")
2575 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2580 [(set_attr "op_type" "RX,RXY")])
2583 ; extendqisi2 instruction pattern(s).
2586 (define_expand "extendqisi2"
2587 [(set (match_operand:SI 0 "register_operand" "")
2588 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2592 operands[1] = gen_lowpart (SImode, operands[1]);
2593 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2594 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2599 (define_insn "*extendqisi2"
2600 [(set (match_operand:SI 0 "register_operand" "=d")
2601 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2602 "TARGET_LONG_DISPLACEMENT"
2604 [(set_attr "op_type" "RXY")])
2606 (define_insn_and_split "*extendqisi2_short_displ"
2607 [(set (match_operand:SI 0 "register_operand" "=d")
2608 (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))]
2609 "!TARGET_LONG_DISPLACEMENT"
2611 "&& reload_completed"
2613 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2614 (clobber (reg:CC 33))])
2616 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2617 (clobber (reg:CC 33))])]
2621 ; extendqihi2 instruction pattern(s).
2626 ; zero_extendsidi2 instruction pattern(s).
2629 (define_expand "zero_extendsidi2"
2630 [(set (match_operand:DI 0 "register_operand" "")
2631 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2637 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2638 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2639 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2645 (define_insn "*zero_extendsidi2"
2646 [(set (match_operand:DI 0 "register_operand" "=d,d")
2647 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2652 [(set_attr "op_type" "RRE,RXY")])
2655 ; zero_extendhidi2 instruction pattern(s).
2658 (define_expand "zero_extendhidi2"
2659 [(set (match_operand:DI 0 "register_operand" "")
2660 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2666 rtx tmp = gen_reg_rtx (SImode);
2667 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2668 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2673 operands[1] = gen_lowpart (DImode, operands[1]);
2674 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2675 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2681 (define_insn "*zero_extendhidi2"
2682 [(set (match_operand:DI 0 "register_operand" "=d")
2683 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2686 [(set_attr "op_type" "RXY")])
2689 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2692 (define_insn "*llgt_sisi"
2693 [(set (match_operand:SI 0 "register_operand" "=d,d")
2694 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2695 (const_int 2147483647)))]
2700 [(set_attr "op_type" "RRE,RXE")])
2703 [(set (match_operand:SI 0 "register_operand" "")
2704 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2705 (const_int 2147483647)))
2706 (clobber (reg:CC 33))]
2707 "TARGET_64BIT && reload_completed"
2709 (and:SI (match_dup 1)
2710 (const_int 2147483647)))]
2713 (define_insn "*llgt_didi"
2714 [(set (match_operand:DI 0 "register_operand" "=d,d")
2715 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2716 (const_int 2147483647)))]
2721 [(set_attr "op_type" "RRE,RXE")])
2724 [(set (match_operand:DI 0 "register_operand" "")
2725 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
2726 (const_int 2147483647)))
2727 (clobber (reg:CC 33))]
2728 "TARGET_64BIT && reload_completed"
2730 (and:DI (match_dup 1)
2731 (const_int 2147483647)))]
2734 (define_insn "*llgt_sidi"
2735 [(set (match_operand:DI 0 "register_operand" "=d")
2736 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2737 (const_int 2147483647)))]
2740 [(set_attr "op_type" "RXE")])
2742 (define_insn_and_split "*llgt_sidi_split"
2743 [(set (match_operand:DI 0 "register_operand" "=d")
2744 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2745 (const_int 2147483647)))
2746 (clobber (reg:CC 33))]
2749 "&& reload_completed"
2751 (and:DI (subreg:DI (match_dup 1) 0)
2752 (const_int 2147483647)))]
2756 ; zero_extendqidi2 instruction pattern(s)
2759 (define_expand "zero_extendqidi2"
2760 [(set (match_operand:DI 0 "register_operand" "")
2761 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2767 rtx tmp = gen_reg_rtx (SImode);
2768 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2769 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2774 operands[1] = gen_lowpart (DImode, operands[1]);
2775 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2776 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2782 (define_insn "*zero_extendqidi2"
2783 [(set (match_operand:DI 0 "register_operand" "=d")
2784 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2787 [(set_attr "op_type" "RXY")])
2790 ; zero_extendhisi2 instruction pattern(s).
2793 (define_expand "zero_extendhisi2"
2794 [(set (match_operand:SI 0 "register_operand" "")
2795 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2799 operands[1] = gen_lowpart (SImode, operands[1]);
2800 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2805 (define_insn "*zero_extendhisi2_64"
2806 [(set (match_operand:SI 0 "register_operand" "=d")
2807 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2810 [(set_attr "op_type" "RXY")])
2812 (define_insn_and_split "*zero_extendhisi2_31"
2813 [(set (match_operand:SI 0 "register_operand" "=&d")
2814 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2815 (clobber (reg:CC 33))]
2818 "&& reload_completed"
2819 [(set (match_dup 0) (const_int 0))
2821 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2822 (clobber (reg:CC 33))])]
2823 "operands[2] = gen_lowpart (HImode, operands[0]);"
2824 [(set_attr "atype" "agen")])
2827 ; zero_extendqisi2 instruction pattern(s).
2830 (define_expand "zero_extendqisi2"
2831 [(set (match_operand:SI 0 "register_operand" "")
2832 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2836 operands[1] = gen_lowpart (SImode, operands[1]);
2837 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2842 (define_insn "*zero_extendqisi2_64"
2843 [(set (match_operand:SI 0 "register_operand" "=d")
2844 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2847 [(set_attr "op_type" "RXY")])
2849 (define_insn_and_split "*zero_extendqisi2_31"
2850 [(set (match_operand:SI 0 "register_operand" "=&d")
2851 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2854 "&& reload_completed"
2855 [(set (match_dup 0) (const_int 0))
2856 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2857 "operands[2] = gen_lowpart (QImode, operands[0]);"
2858 [(set_attr "atype" "agen")])
2861 ; zero_extendqihi2 instruction pattern(s).
2864 (define_expand "zero_extendqihi2"
2865 [(set (match_operand:HI 0 "register_operand" "")
2866 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2870 operands[1] = gen_lowpart (HImode, operands[1]);
2871 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2876 (define_insn "*zero_extendqihi2_64"
2877 [(set (match_operand:HI 0 "register_operand" "=d")
2878 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2881 [(set_attr "op_type" "RXY")])
2883 (define_insn_and_split "*zero_extendqihi2_31"
2884 [(set (match_operand:HI 0 "register_operand" "=&d")
2885 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2888 "&& reload_completed"
2889 [(set (match_dup 0) (const_int 0))
2890 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2891 "operands[2] = gen_lowpart (QImode, operands[0]);"
2892 [(set_attr "atype" "agen")])
2896 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2899 (define_expand "fixuns_truncdfdi2"
2900 [(set (match_operand:DI 0 "register_operand" "")
2901 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2902 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2904 rtx label1 = gen_label_rtx ();
2905 rtx label2 = gen_label_rtx ();
2906 rtx temp = gen_reg_rtx (DFmode);
2907 operands[1] = force_reg (DFmode, operands[1]);
2909 emit_insn (gen_cmpdf (operands[1],
2910 CONST_DOUBLE_FROM_REAL_VALUE (
2911 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2912 emit_jump_insn (gen_blt (label1));
2913 emit_insn (gen_subdf3 (temp, operands[1],
2914 CONST_DOUBLE_FROM_REAL_VALUE (
2915 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2916 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2919 emit_label (label1);
2920 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2921 emit_label (label2);
2925 (define_expand "fix_truncdfdi2"
2926 [(set (match_operand:DI 0 "register_operand" "")
2927 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2928 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2930 operands[1] = force_reg (DFmode, operands[1]);
2931 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2935 (define_insn "fix_truncdfdi2_ieee"
2936 [(set (match_operand:DI 0 "register_operand" "=d")
2937 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2938 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2939 (clobber (reg:CC 33))]
2940 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2942 [(set_attr "op_type" "RRE")
2943 (set_attr "type" "ftoi")])
2946 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2949 (define_expand "fixuns_truncdfsi2"
2950 [(set (match_operand:SI 0 "register_operand" "")
2951 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2952 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2954 rtx label1 = gen_label_rtx ();
2955 rtx label2 = gen_label_rtx ();
2956 rtx temp = gen_reg_rtx (DFmode);
2958 operands[1] = force_reg (DFmode,operands[1]);
2959 emit_insn (gen_cmpdf (operands[1],
2960 CONST_DOUBLE_FROM_REAL_VALUE (
2961 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2962 emit_jump_insn (gen_blt (label1));
2963 emit_insn (gen_subdf3 (temp, operands[1],
2964 CONST_DOUBLE_FROM_REAL_VALUE (
2965 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2966 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2969 emit_label (label1);
2970 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2971 emit_label (label2);
2975 (define_expand "fix_truncdfsi2"
2976 [(set (match_operand:SI 0 "register_operand" "")
2977 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2980 if (TARGET_IBM_FLOAT)
2982 /* This is the algorithm from POP chapter A.5.7.2. */
2984 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2985 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2986 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2988 operands[1] = force_reg (DFmode, operands[1]);
2989 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2990 two31r, two32, temp));
2994 operands[1] = force_reg (DFmode, operands[1]);
2995 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3001 (define_insn "fix_truncdfsi2_ieee"
3002 [(set (match_operand:SI 0 "register_operand" "=d")
3003 (fix:SI (match_operand:DF 1 "register_operand" "f")))
3004 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3005 (clobber (reg:CC 33))]
3006 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3008 [(set_attr "op_type" "RRE")
3009 (set_attr "type" "other" )])
3011 (define_insn "fix_truncdfsi2_ibm"
3012 [(set (match_operand:SI 0 "register_operand" "=d")
3013 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
3014 (use (match_operand:DI 2 "immediate_operand" "m"))
3015 (use (match_operand:DI 3 "immediate_operand" "m"))
3016 (use (match_operand:BLK 4 "memory_operand" "m"))
3017 (clobber (reg:CC 33))]
3018 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3020 output_asm_insn ("sd\t%1,%2", operands);
3021 output_asm_insn ("aw\t%1,%3", operands);
3022 output_asm_insn ("std\t%1,%4", operands);
3023 output_asm_insn ("xi\t%N4,128", operands);
3026 [(set_attr "op_type" "NN")
3027 (set_attr "type" "ftoi")
3028 (set_attr "atype" "agen")
3029 (set_attr "length" "20")])
3032 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
3035 (define_expand "fixuns_truncsfdi2"
3036 [(set (match_operand:DI 0 "register_operand" "")
3037 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
3038 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3040 rtx label1 = gen_label_rtx ();
3041 rtx label2 = gen_label_rtx ();
3042 rtx temp = gen_reg_rtx (SFmode);
3044 operands[1] = force_reg (SFmode, operands[1]);
3045 emit_insn (gen_cmpsf (operands[1],
3046 CONST_DOUBLE_FROM_REAL_VALUE (
3047 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
3048 emit_jump_insn (gen_blt (label1));
3050 emit_insn (gen_subsf3 (temp, operands[1],
3051 CONST_DOUBLE_FROM_REAL_VALUE (
3052 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
3053 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
3056 emit_label (label1);
3057 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
3058 emit_label (label2);
3062 (define_expand "fix_truncsfdi2"
3063 [(set (match_operand:DI 0 "register_operand" "")
3064 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
3065 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3067 operands[1] = force_reg (SFmode, operands[1]);
3068 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
3072 (define_insn "fix_truncsfdi2_ieee"
3073 [(set (match_operand:DI 0 "register_operand" "=d")
3074 (fix:DI (match_operand:SF 1 "register_operand" "f")))
3075 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3076 (clobber (reg:CC 33))]
3077 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3079 [(set_attr "op_type" "RRE")
3080 (set_attr "type" "ftoi")])
3083 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
3086 (define_expand "fixuns_truncsfsi2"
3087 [(set (match_operand:SI 0 "register_operand" "")
3088 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
3089 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3091 rtx label1 = gen_label_rtx ();
3092 rtx label2 = gen_label_rtx ();
3093 rtx temp = gen_reg_rtx (SFmode);
3095 operands[1] = force_reg (SFmode, operands[1]);
3096 emit_insn (gen_cmpsf (operands[1],
3097 CONST_DOUBLE_FROM_REAL_VALUE (
3098 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
3099 emit_jump_insn (gen_blt (label1));
3100 emit_insn (gen_subsf3 (temp, operands[1],
3101 CONST_DOUBLE_FROM_REAL_VALUE (
3102 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
3103 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
3106 emit_label (label1);
3107 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3108 emit_label (label2);
3112 (define_expand "fix_truncsfsi2"
3113 [(set (match_operand:SI 0 "register_operand" "")
3114 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
3117 if (TARGET_IBM_FLOAT)
3119 /* Convert to DFmode and then use the POP algorithm. */
3120 rtx temp = gen_reg_rtx (DFmode);
3121 emit_insn (gen_extendsfdf2 (temp, operands[1]));
3122 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
3126 operands[1] = force_reg (SFmode, operands[1]);
3127 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3133 (define_insn "fix_truncsfsi2_ieee"
3134 [(set (match_operand:SI 0 "register_operand" "=d")
3135 (fix:SI (match_operand:SF 1 "register_operand" "f")))
3136 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3137 (clobber (reg:CC 33))]
3138 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3140 [(set_attr "op_type" "RRE")
3141 (set_attr "type" "ftoi")])
3144 ; floatdidf2 instruction pattern(s).
3147 (define_insn "floatdidf2"
3148 [(set (match_operand:DF 0 "register_operand" "=f")
3149 (float:DF (match_operand:DI 1 "register_operand" "d")))
3150 (clobber (reg:CC 33))]
3151 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3153 [(set_attr "op_type" "RRE")
3154 (set_attr "type" "itof" )])
3157 ; floatdisf2 instruction pattern(s).
3160 (define_insn "floatdisf2"
3161 [(set (match_operand:SF 0 "register_operand" "=f")
3162 (float:SF (match_operand:DI 1 "register_operand" "d")))
3163 (clobber (reg:CC 33))]
3164 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3166 [(set_attr "op_type" "RRE")
3167 (set_attr "type" "itof" )])
3170 ; floatsidf2 instruction pattern(s).
3173 (define_expand "floatsidf2"
3175 [(set (match_operand:DF 0 "register_operand" "")
3176 (float:DF (match_operand:SI 1 "register_operand" "")))
3177 (clobber (reg:CC 33))])]
3180 if (TARGET_IBM_FLOAT)
3182 /* This is the algorithm from POP chapter A.5.7.1. */
3184 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3185 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
3187 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
3192 (define_insn "floatsidf2_ieee"
3193 [(set (match_operand:DF 0 "register_operand" "=f")
3194 (float:DF (match_operand:SI 1 "register_operand" "d")))
3195 (clobber (reg:CC 33))]
3196 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3198 [(set_attr "op_type" "RRE")
3199 (set_attr "type" "itof" )])
3201 (define_insn "floatsidf2_ibm"
3202 [(set (match_operand:DF 0 "register_operand" "=f")
3203 (float:DF (match_operand:SI 1 "register_operand" "d")))
3204 (use (match_operand:DI 2 "immediate_operand" "m"))
3205 (use (match_operand:BLK 3 "memory_operand" "m"))
3206 (clobber (reg:CC 33))]
3207 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3209 output_asm_insn ("st\t%1,%N3", operands);
3210 output_asm_insn ("xi\t%N3,128", operands);
3211 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3212 output_asm_insn ("ld\t%0,%3", operands);
3215 [(set_attr "op_type" "NN")
3216 (set_attr "type" "other" )
3217 (set_attr "atype" "agen")
3218 (set_attr "length" "20")])
3221 ; floatsisf2 instruction pattern(s).
3224 (define_expand "floatsisf2"
3226 [(set (match_operand:SF 0 "register_operand" "")
3227 (float:SF (match_operand:SI 1 "register_operand" "")))
3228 (clobber (reg:CC 33))])]
3231 if (TARGET_IBM_FLOAT)
3233 /* Use the POP algorithm to convert to DFmode and then truncate. */
3234 rtx temp = gen_reg_rtx (DFmode);
3235 emit_insn (gen_floatsidf2 (temp, operands[1]));
3236 emit_insn (gen_truncdfsf2 (operands[0], temp));
3241 (define_insn "floatsisf2_ieee"
3242 [(set (match_operand:SF 0 "register_operand" "=f")
3243 (float:SF (match_operand:SI 1 "register_operand" "d")))
3244 (clobber (reg:CC 33))]
3245 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3247 [(set_attr "op_type" "RRE")
3248 (set_attr "type" "itof" )])
3251 ; truncdfsf2 instruction pattern(s).
3254 (define_expand "truncdfsf2"
3255 [(set (match_operand:SF 0 "register_operand" "")
3256 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3260 (define_insn "truncdfsf2_ieee"
3261 [(set (match_operand:SF 0 "register_operand" "=f")
3262 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3263 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3265 [(set_attr "op_type" "RRE")])
3267 (define_insn "truncdfsf2_ibm"
3268 [(set (match_operand:SF 0 "register_operand" "=f,f")
3269 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3270 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3274 [(set_attr "op_type" "RR,RX")
3275 (set_attr "type" "floads,floads")])
3278 ; extendsfdf2 instruction pattern(s).
3281 (define_expand "extendsfdf2"
3282 [(set (match_operand:DF 0 "register_operand" "")
3283 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3286 if (TARGET_IBM_FLOAT)
3288 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3293 (define_insn "extendsfdf2_ieee"
3294 [(set (match_operand:DF 0 "register_operand" "=f,f")
3295 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3296 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3300 [(set_attr "op_type" "RRE,RXE")
3301 (set_attr "type" "floads,floads")])
3303 (define_insn "extendsfdf2_ibm"
3304 [(set (match_operand:DF 0 "register_operand" "=f,f")
3305 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3306 (clobber (reg:CC 33))]
3307 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3309 sdr\t%0,%0\;ler\t%0,%1
3310 sdr\t%0,%0\;le\t%0,%1"
3311 [(set_attr "op_type" "NN,NN")
3312 (set_attr "atype" "reg,agen")
3313 (set_attr "length" "4,6")
3314 (set_attr "type" "o2,o2")])
3318 ;; ARITHMETIC OPERATIONS
3320 ; arithmetic operations set the ConditionCode,
3321 ; because of unpredictable Bits in Register for Halfword and Byte
3322 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3325 ;;- Add instructions.
3329 ; adddi3 instruction pattern(s).
3332 (define_insn "*adddi3_sign"
3333 [(set (match_operand:DI 0 "register_operand" "=d,d")
3334 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3335 (match_operand:DI 1 "register_operand" "0,0")))
3336 (clobber (reg:CC 33))]
3341 [(set_attr "op_type" "RRE,RXY")])
3343 (define_insn "*adddi3_zero_cc"
3345 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3346 (match_operand:DI 1 "register_operand" "0,0"))
3348 (set (match_operand:DI 0 "register_operand" "=d,d")
3349 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3350 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3354 [(set_attr "op_type" "RRE,RXY")])
3356 (define_insn "*adddi3_zero_cconly"
3358 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3359 (match_operand:DI 1 "register_operand" "0,0"))
3361 (clobber (match_scratch:DI 0 "=d,d"))]
3362 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3366 [(set_attr "op_type" "RRE,RXY")])
3368 (define_insn "*adddi3_zero"
3369 [(set (match_operand:DI 0 "register_operand" "=d,d")
3370 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3371 (match_operand:DI 1 "register_operand" "0,0")))
3372 (clobber (reg:CC 33))]
3377 [(set_attr "op_type" "RRE,RXY")])
3379 (define_insn "*adddi3_imm_cc"
3381 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3382 (match_operand:DI 2 "const_int_operand" "K"))
3384 (set (match_operand:DI 0 "register_operand" "=d")
3385 (plus:DI (match_dup 1) (match_dup 2)))]
3387 && s390_match_ccmode (insn, CCAmode)
3388 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3390 [(set_attr "op_type" "RI")])
3392 (define_insn "*adddi3_carry1_cc"
3394 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3395 (match_operand:DI 2 "general_operand" "d,m"))
3397 (set (match_operand:DI 0 "register_operand" "=d,d")
3398 (plus:DI (match_dup 1) (match_dup 2)))]
3399 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3403 [(set_attr "op_type" "RRE,RXY")])
3405 (define_insn "*adddi3_carry1_cconly"
3407 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3408 (match_operand:DI 2 "general_operand" "d,m"))
3410 (clobber (match_scratch:DI 0 "=d,d"))]
3411 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3415 [(set_attr "op_type" "RRE,RXY")])
3417 (define_insn "*adddi3_carry2_cc"
3419 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3420 (match_operand:DI 2 "general_operand" "d,m"))
3422 (set (match_operand:DI 0 "register_operand" "=d,d")
3423 (plus:DI (match_dup 1) (match_dup 2)))]
3424 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3428 [(set_attr "op_type" "RRE,RXY")])
3430 (define_insn "*adddi3_carry2_cconly"
3432 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3433 (match_operand:DI 2 "general_operand" "d,m"))
3435 (clobber (match_scratch:DI 0 "=d,d"))]
3436 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3440 [(set_attr "op_type" "RRE,RXY")])
3442 (define_insn "*adddi3_cc"
3444 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3445 (match_operand:DI 2 "general_operand" "d,m"))
3447 (set (match_operand:DI 0 "register_operand" "=d,d")
3448 (plus:DI (match_dup 1) (match_dup 2)))]
3449 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3453 [(set_attr "op_type" "RRE,RXY")])
3455 (define_insn "*adddi3_cconly"
3457 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3458 (match_operand:DI 2 "general_operand" "d,m"))
3460 (clobber (match_scratch:DI 0 "=d,d"))]
3461 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3465 [(set_attr "op_type" "RRE,RXY")])
3467 (define_insn "*adddi3_cconly2"
3469 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3470 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3471 (clobber (match_scratch:DI 0 "=d,d"))]
3472 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3476 [(set_attr "op_type" "RRE,RXY")])
3478 (define_insn "*adddi3_64"
3479 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3480 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3481 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3482 (clobber (reg:CC 33))]
3488 [(set_attr "op_type" "RRE,RI,RXY")])
3490 (define_insn_and_split "*adddi3_31z"
3491 [(set (match_operand:DI 0 "register_operand" "=&d")
3492 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3493 (match_operand:DI 2 "general_operand" "do") ) )
3494 (clobber (reg:CC 33))]
3495 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3497 "&& reload_completed"
3500 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3502 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3504 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3505 (ltu:SI (reg:CCL1 33) (const_int 0))))
3506 (clobber (reg:CC 33))])]
3507 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3508 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3509 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3510 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3511 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3512 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3513 [(set_attr "op_type" "NN")])
3515 (define_insn_and_split "*adddi3_31"
3516 [(set (match_operand:DI 0 "register_operand" "=&d")
3517 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3518 (match_operand:DI 2 "general_operand" "do") ) )
3519 (clobber (reg:CC 33))]
3522 "&& reload_completed"
3524 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3525 (clobber (reg:CC 33))])
3528 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3530 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3532 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3534 (label_ref (match_dup 9))))
3536 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3537 (clobber (reg:CC 33))])
3539 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3540 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3541 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3542 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3543 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3544 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3545 operands[9] = gen_label_rtx ();"
3546 [(set_attr "op_type" "NN")])
3548 (define_expand "adddi3"
3550 [(set (match_operand:DI 0 "register_operand" "")
3551 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3552 (match_operand:DI 2 "general_operand" "")))
3553 (clobber (reg:CC 33))])]
3558 ; addsi3 instruction pattern(s).
3561 (define_insn "*addsi3_imm_cc"
3563 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3564 (match_operand:SI 2 "const_int_operand" "K"))
3566 (set (match_operand:SI 0 "register_operand" "=d")
3567 (plus:SI (match_dup 1) (match_dup 2)))]
3568 "s390_match_ccmode (insn, CCAmode)
3569 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3571 [(set_attr "op_type" "RI")])
3573 (define_insn "*addsi3_carry1_cc"
3575 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3576 (match_operand:SI 2 "general_operand" "d,R,T"))
3578 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3579 (plus:SI (match_dup 1) (match_dup 2)))]
3580 "s390_match_ccmode (insn, CCL1mode)"
3585 [(set_attr "op_type" "RR,RX,RXY")])
3587 (define_insn "*addsi3_carry1_cconly"
3589 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3590 (match_operand:SI 2 "general_operand" "d,R,T"))
3592 (clobber (match_scratch:SI 0 "=d,d,d"))]
3593 "s390_match_ccmode (insn, CCL1mode)"
3598 [(set_attr "op_type" "RR,RX,RXY")])
3600 (define_insn "*addsi3_carry2_cc"
3602 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3603 (match_operand:SI 2 "general_operand" "d,R,T"))
3605 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3606 (plus:SI (match_dup 1) (match_dup 2)))]
3607 "s390_match_ccmode (insn, CCL1mode)"
3612 [(set_attr "op_type" "RR,RX,RXY")])
3614 (define_insn "*addsi3_carry2_cconly"
3616 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3617 (match_operand:SI 2 "general_operand" "d,R,T"))
3619 (clobber (match_scratch:SI 0 "=d,d,d"))]
3620 "s390_match_ccmode (insn, CCL1mode)"
3625 [(set_attr "op_type" "RR,RX,RXY")])
3627 (define_insn "*addsi3_cc"
3629 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3630 (match_operand:SI 2 "general_operand" "d,R,T"))
3632 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3633 (plus:SI (match_dup 1) (match_dup 2)))]
3634 "s390_match_ccmode (insn, CCLmode)"
3639 [(set_attr "op_type" "RR,RX,RXY")])
3641 (define_insn "*addsi3_cconly"
3643 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3644 (match_operand:SI 2 "general_operand" "d,R,T"))
3646 (clobber (match_scratch:SI 0 "=d,d,d"))]
3647 "s390_match_ccmode (insn, CCLmode)"
3652 [(set_attr "op_type" "RR,RX,RXY")])
3654 (define_insn "*addsi3_cconly2"
3656 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3657 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3658 (clobber (match_scratch:SI 0 "=d,d,d"))]
3659 "s390_match_ccmode (insn, CCLmode)"
3664 [(set_attr "op_type" "RR,RX,RXY")])
3666 (define_insn "*addsi3_sign"
3667 [(set (match_operand:SI 0 "register_operand" "=d,d")
3668 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3669 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3670 (clobber (reg:CC 33))]
3675 [(set_attr "op_type" "RX,RXY")])
3677 (define_insn "addsi3"
3678 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3679 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3680 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3681 (clobber (reg:CC 33))]
3688 [(set_attr "op_type" "RR,RI,RX,RXY")])
3691 ; adddf3 instruction pattern(s).
3694 (define_expand "adddf3"
3696 [(set (match_operand:DF 0 "register_operand" "=f,f")
3697 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3698 (match_operand:DF 2 "general_operand" "f,R")))
3699 (clobber (reg:CC 33))])]
3703 (define_insn "*adddf3"
3704 [(set (match_operand:DF 0 "register_operand" "=f,f")
3705 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3706 (match_operand:DF 2 "general_operand" "f,R")))
3707 (clobber (reg:CC 33))]
3708 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3712 [(set_attr "op_type" "RRE,RXE")
3713 (set_attr "type" "fsimpd,fsimpd")])
3715 (define_insn "*adddf3_cc"
3717 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3718 (match_operand:DF 2 "general_operand" "f,R"))
3719 (match_operand:DF 3 "const0_operand" "")))
3720 (set (match_operand:DF 0 "register_operand" "=f,f")
3721 (plus:DF (match_dup 1) (match_dup 2)))]
3722 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3726 [(set_attr "op_type" "RRE,RXE")
3727 (set_attr "type" "fsimpd,fsimpd")])
3729 (define_insn "*adddf3_cconly"
3731 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3732 (match_operand:DF 2 "general_operand" "f,R"))
3733 (match_operand:DF 3 "const0_operand" "")))
3734 (clobber (match_scratch:DF 0 "=f,f"))]
3735 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3739 [(set_attr "op_type" "RRE,RXE")
3740 (set_attr "type" "fsimpd,fsimpd")])
3742 (define_insn "*adddf3_ibm"
3743 [(set (match_operand:DF 0 "register_operand" "=f,f")
3744 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3745 (match_operand:DF 2 "general_operand" "f,R")))
3746 (clobber (reg:CC 33))]
3747 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3751 [(set_attr "op_type" "RR,RX")
3752 (set_attr "type" "fsimpd,fsimpd")])
3755 ; addsf3 instruction pattern(s).
3758 (define_expand "addsf3"
3760 [(set (match_operand:SF 0 "register_operand" "=f,f")
3761 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3762 (match_operand:SF 2 "general_operand" "f,R")))
3763 (clobber (reg:CC 33))])]
3767 (define_insn "*addsf3"
3768 [(set (match_operand:SF 0 "register_operand" "=f,f")
3769 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3770 (match_operand:SF 2 "general_operand" "f,R")))
3771 (clobber (reg:CC 33))]
3772 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3776 [(set_attr "op_type" "RRE,RXE")
3777 (set_attr "type" "fsimps,fsimps")])
3779 (define_insn "*addsf3_cc"
3781 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3782 (match_operand:SF 2 "general_operand" "f,R"))
3783 (match_operand:SF 3 "const0_operand" "")))
3784 (set (match_operand:SF 0 "register_operand" "=f,f")
3785 (plus:SF (match_dup 1) (match_dup 2)))]
3786 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3790 [(set_attr "op_type" "RRE,RXE")
3791 (set_attr "type" "fsimps,fsimps")])
3793 (define_insn "*addsf3_cconly"
3795 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3796 (match_operand:SF 2 "general_operand" "f,R"))
3797 (match_operand:SF 3 "const0_operand" "")))
3798 (clobber (match_scratch:SF 0 "=f,f"))]
3799 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3803 [(set_attr "op_type" "RRE,RXE")
3804 (set_attr "type" "fsimps,fsimps")])
3806 (define_insn "*addsf3"
3807 [(set (match_operand:SF 0 "register_operand" "=f,f")
3808 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3809 (match_operand:SF 2 "general_operand" "f,R")))
3810 (clobber (reg:CC 33))]
3811 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3815 [(set_attr "op_type" "RR,RX")
3816 (set_attr "type" "fsimps,fsimps")])
3820 ;;- Subtract instructions.
3824 ; subdi3 instruction pattern(s).
3827 (define_insn "*subdi3_sign"
3828 [(set (match_operand:DI 0 "register_operand" "=d,d")
3829 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3830 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3831 (clobber (reg:CC 33))]
3836 [(set_attr "op_type" "RRE,RXY")])
3838 (define_insn "*subdi3_zero_cc"
3840 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3841 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3843 (set (match_operand:DI 0 "register_operand" "=d,d")
3844 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3845 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3849 [(set_attr "op_type" "RRE,RXY")])
3851 (define_insn "*subdi3_zero_cconly"
3853 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3854 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3856 (clobber (match_scratch:DI 0 "=d,d"))]
3857 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3861 [(set_attr "op_type" "RRE,RXY")])
3863 (define_insn "*subdi3_zero"
3864 [(set (match_operand:DI 0 "register_operand" "=d,d")
3865 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3866 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3867 (clobber (reg:CC 33))]
3872 [(set_attr "op_type" "RRE,RXY")])
3874 (define_insn "*subdi3_borrow_cc"
3876 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3877 (match_operand:DI 2 "general_operand" "d,m"))
3879 (set (match_operand:DI 0 "register_operand" "=d,d")
3880 (minus:DI (match_dup 1) (match_dup 2)))]
3881 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3885 [(set_attr "op_type" "RRE,RXY")])
3887 (define_insn "*subdi3_borrow_cconly"
3889 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3890 (match_operand:DI 2 "general_operand" "d,m"))
3892 (clobber (match_scratch:DI 0 "=d,d"))]
3893 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3897 [(set_attr "op_type" "RRE,RXY")])
3899 (define_insn "*subdi3_cc"
3901 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3902 (match_operand:DI 2 "general_operand" "d,m"))
3904 (set (match_operand:DI 0 "register_operand" "=d,d")
3905 (minus:DI (match_dup 1) (match_dup 2)))]
3906 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3910 [(set_attr "op_type" "RRE,RXY")])
3912 (define_insn "*subdi3_cconly"
3914 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3915 (match_operand:DI 2 "general_operand" "d,m"))
3917 (clobber (match_scratch:DI 0 "=d,d"))]
3918 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3922 [(set_attr "op_type" "RRE,RXY")])
3924 (define_insn "*subdi3_64"
3925 [(set (match_operand:DI 0 "register_operand" "=d,d")
3926 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3927 (match_operand:DI 2 "general_operand" "d,m") ) )
3928 (clobber (reg:CC 33))]
3933 [(set_attr "op_type" "RRE,RRE")])
3935 (define_insn_and_split "*subdi3_31z"
3936 [(set (match_operand:DI 0 "register_operand" "=&d")
3937 (minus:DI (match_operand:DI 1 "register_operand" "0")
3938 (match_operand:DI 2 "general_operand" "do") ) )
3939 (clobber (reg:CC 33))]
3940 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3942 "&& reload_completed"
3945 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3947 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3949 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3950 (gtu:SI (reg:CCL2 33) (const_int 0))))
3951 (clobber (reg:CC 33))])]
3952 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3953 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3954 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3955 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3956 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3957 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3958 [(set_attr "op_type" "NN")])
3960 (define_insn_and_split "*subdi3_31"
3961 [(set (match_operand:DI 0 "register_operand" "=&d")
3962 (minus:DI (match_operand:DI 1 "register_operand" "0")
3963 (match_operand:DI 2 "general_operand" "do") ) )
3964 (clobber (reg:CC 33))]
3967 "&& reload_completed"
3969 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3970 (clobber (reg:CC 33))])
3973 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3975 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3977 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3979 (label_ref (match_dup 9))))
3981 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3982 (clobber (reg:CC 33))])
3984 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3985 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3986 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3987 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3988 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3989 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3990 operands[9] = gen_label_rtx ();"
3991 [(set_attr "op_type" "NN")])
3993 (define_expand "subdi3"
3995 [(set (match_operand:DI 0 "register_operand" "")
3996 (minus:DI (match_operand:DI 1 "register_operand" "")
3997 (match_operand:DI 2 "general_operand" "")))
3998 (clobber (reg:CC 33))])]
4003 ; subsi3 instruction pattern(s).
4006 (define_insn "*subsi3_borrow_cc"
4008 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4009 (match_operand:SI 2 "general_operand" "d,R,T"))
4011 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4012 (minus:SI (match_dup 1) (match_dup 2)))]
4013 "s390_match_ccmode (insn, CCL2mode)"
4018 [(set_attr "op_type" "RR,RX,RXY")])
4020 (define_insn "*subsi3_borrow_cconly"
4022 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4023 (match_operand:SI 2 "general_operand" "d,R,T"))
4025 (clobber (match_scratch:SI 0 "=d,d,d"))]
4026 "s390_match_ccmode (insn, CCL2mode)"
4031 [(set_attr "op_type" "RR,RX,RXY")])
4033 (define_insn "*subsi3_cc"
4035 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4036 (match_operand:SI 2 "general_operand" "d,R,T"))
4038 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4039 (minus:SI (match_dup 1) (match_dup 2)))]
4040 "s390_match_ccmode (insn, CCLmode)"
4045 [(set_attr "op_type" "RR,RX,RXY")])
4047 (define_insn "*subsi3_cconly"
4049 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4050 (match_operand:SI 2 "general_operand" "d,R,T"))
4052 (clobber (match_scratch:SI 0 "=d,d,d"))]
4053 "s390_match_ccmode (insn, CCLmode)"
4058 [(set_attr "op_type" "RR,RX,RXY")])
4060 (define_insn "*subsi3_sign"
4061 [(set (match_operand:SI 0 "register_operand" "=d,d")
4062 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
4063 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4064 (clobber (reg:CC 33))]
4069 [(set_attr "op_type" "RX,RXY")])
4071 (define_insn "subsi3"
4072 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4073 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4074 (match_operand:SI 2 "general_operand" "d,R,T")))
4075 (clobber (reg:CC 33))]
4081 [(set_attr "op_type" "RR,RX,RXY")])
4085 ; subdf3 instruction pattern(s).
4088 (define_expand "subdf3"
4090 [(set (match_operand:DF 0 "register_operand" "=f,f")
4091 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4092 (match_operand:DF 2 "general_operand" "f,R")))
4093 (clobber (reg:CC 33))])]
4097 (define_insn "*subdf3"
4098 [(set (match_operand:DF 0 "register_operand" "=f,f")
4099 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4100 (match_operand:DF 2 "general_operand" "f,R")))
4101 (clobber (reg:CC 33))]
4102 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4106 [(set_attr "op_type" "RRE,RXE")
4107 (set_attr "type" "fsimpd,fsimpd")])
4109 (define_insn "*subdf3_cc"
4111 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4112 (match_operand:DF 2 "general_operand" "f,R"))
4113 (match_operand:DF 3 "const0_operand" "")))
4114 (set (match_operand:DF 0 "register_operand" "=f,f")
4115 (plus:DF (match_dup 1) (match_dup 2)))]
4116 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4120 [(set_attr "op_type" "RRE,RXE")
4121 (set_attr "type" "fsimpd,fsimpd")])
4123 (define_insn "*subdf3_cconly"
4125 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4126 (match_operand:DF 2 "general_operand" "f,R"))
4127 (match_operand:DF 3 "const0_operand" "")))
4128 (clobber (match_scratch:DF 0 "=f,f"))]
4129 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4133 [(set_attr "op_type" "RRE,RXE")
4134 (set_attr "type" "fsimpd,fsimpd")])
4136 (define_insn "*subdf3_ibm"
4137 [(set (match_operand:DF 0 "register_operand" "=f,f")
4138 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4139 (match_operand:DF 2 "general_operand" "f,R")))
4140 (clobber (reg:CC 33))]
4141 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4145 [(set_attr "op_type" "RR,RX")
4146 (set_attr "type" "fsimpd,fsimpd")])
4149 ; subsf3 instruction pattern(s).
4152 (define_expand "subsf3"
4154 [(set (match_operand:SF 0 "register_operand" "=f,f")
4155 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4156 (match_operand:SF 2 "general_operand" "f,R")))
4157 (clobber (reg:CC 33))])]
4161 (define_insn "*subsf3"
4162 [(set (match_operand:SF 0 "register_operand" "=f,f")
4163 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4164 (match_operand:SF 2 "general_operand" "f,R")))
4165 (clobber (reg:CC 33))]
4166 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4170 [(set_attr "op_type" "RRE,RXE")
4171 (set_attr "type" "fsimps,fsimps")])
4173 (define_insn "*subsf3_cc"
4175 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4176 (match_operand:SF 2 "general_operand" "f,R"))
4177 (match_operand:SF 3 "const0_operand" "")))
4178 (set (match_operand:SF 0 "register_operand" "=f,f")
4179 (minus:SF (match_dup 1) (match_dup 2)))]
4180 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4184 [(set_attr "op_type" "RRE,RXE")
4185 (set_attr "type" "fsimps,fsimps")])
4187 (define_insn "*subsf3_cconly"
4189 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4190 (match_operand:SF 2 "general_operand" "f,R"))
4191 (match_operand:SF 3 "const0_operand" "")))
4192 (clobber (match_scratch:SF 0 "=f,f"))]
4193 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4197 [(set_attr "op_type" "RRE,RXE")
4198 (set_attr "type" "fsimps,fsimps")])
4200 (define_insn "*subsf3_ibm"
4201 [(set (match_operand:SF 0 "register_operand" "=f,f")
4202 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4203 (match_operand:SF 2 "general_operand" "f,R")))
4204 (clobber (reg:CC 33))]
4205 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4209 [(set_attr "op_type" "RR,RX")
4210 (set_attr "type" "fsimps,fsimps")])
4214 ;;- Conditional add/subtract instructions.
4218 ; adddicc instruction pattern(s).
4221 (define_insn "*adddi3_alc_cc"
4224 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4225 (match_operand:DI 2 "general_operand" "d,m"))
4226 (match_operand:DI 3 "s390_alc_comparison" ""))
4228 (set (match_operand:DI 0 "register_operand" "=d,d")
4229 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4230 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4234 [(set_attr "op_type" "RRE,RXY")])
4236 (define_insn "*adddi3_alc"
4237 [(set (match_operand:DI 0 "register_operand" "=d,d")
4238 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4239 (match_operand:DI 2 "general_operand" "d,m"))
4240 (match_operand:DI 3 "s390_alc_comparison" "")))
4241 (clobber (reg:CC 33))]
4246 [(set_attr "op_type" "RRE,RXY")])
4248 (define_insn "*subdi3_slb_cc"
4251 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4252 (match_operand:DI 2 "general_operand" "d,m"))
4253 (match_operand:DI 3 "s390_slb_comparison" ""))
4255 (set (match_operand:DI 0 "register_operand" "=d,d")
4256 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4257 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4261 [(set_attr "op_type" "RRE,RXY")])
4263 (define_insn "*subdi3_slb"
4264 [(set (match_operand:DI 0 "register_operand" "=d,d")
4265 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4266 (match_operand:DI 2 "general_operand" "d,m"))
4267 (match_operand:DI 3 "s390_slb_comparison" "")))
4268 (clobber (reg:CC 33))]
4273 [(set_attr "op_type" "RRE,RXY")])
4276 ; addsicc instruction pattern(s).
4279 (define_insn "*addsi3_alc_cc"
4282 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4283 (match_operand:SI 2 "general_operand" "d,m"))
4284 (match_operand:SI 3 "s390_alc_comparison" ""))
4286 (set (match_operand:SI 0 "register_operand" "=d,d")
4287 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4288 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4292 [(set_attr "op_type" "RRE,RXY")])
4294 (define_insn "*addsi3_alc"
4295 [(set (match_operand:SI 0 "register_operand" "=d,d")
4296 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4297 (match_operand:SI 2 "general_operand" "d,m"))
4298 (match_operand:SI 3 "s390_alc_comparison" "")))
4299 (clobber (reg:CC 33))]
4304 [(set_attr "op_type" "RRE,RXY")])
4306 (define_insn "*subsi3_slb_cc"
4309 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4310 (match_operand:SI 2 "general_operand" "d,m"))
4311 (match_operand:SI 3 "s390_slb_comparison" ""))
4313 (set (match_operand:SI 0 "register_operand" "=d,d")
4314 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4315 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4319 [(set_attr "op_type" "RRE,RXY")])
4321 (define_insn "*subsi3_slb"
4322 [(set (match_operand:SI 0 "register_operand" "=d,d")
4323 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4324 (match_operand:SI 2 "general_operand" "d,m"))
4325 (match_operand:SI 3 "s390_slb_comparison" "")))
4326 (clobber (reg:CC 33))]
4331 [(set_attr "op_type" "RRE,RXY")])
4335 ;;- Multiply instructions.
4339 ; muldi3 instruction pattern(s).
4342 (define_insn "*muldi3_sign"
4343 [(set (match_operand:DI 0 "register_operand" "=d,d")
4344 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4345 (match_operand:DI 1 "register_operand" "0,0")))]
4350 [(set_attr "op_type" "RRE,RXY")
4351 (set_attr "type" "imul")])
4353 (define_insn "muldi3"
4354 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4355 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4356 (match_operand:DI 2 "general_operand" "d,K,m")))]
4362 [(set_attr "op_type" "RRE,RI,RXY")
4363 (set_attr "type" "imul")])
4366 ; mulsi3 instruction pattern(s).
4369 (define_insn "*mulsi3_sign"
4370 [(set (match_operand:SI 0 "register_operand" "=d")
4371 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4372 (match_operand:SI 1 "register_operand" "0")))]
4375 [(set_attr "op_type" "RX")
4376 (set_attr "type" "imul")])
4378 (define_insn "mulsi3"
4379 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4380 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4381 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4388 [(set_attr "op_type" "RRE,RI,RX,RXY")
4389 (set_attr "type" "imul")])
4392 ; mulsidi3 instruction pattern(s).
4395 (define_insn "mulsidi3"
4396 [(set (match_operand:DI 0 "register_operand" "=d,d")
4397 (mult:DI (sign_extend:DI
4398 (match_operand:SI 1 "register_operand" "%0,0"))
4400 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4405 [(set_attr "op_type" "RR,RX")
4406 (set_attr "type" "imul")])
4409 ; umulsidi3 instruction pattern(s).
4412 (define_insn "umulsidi3"
4413 [(set (match_operand:DI 0 "register_operand" "=d,d")
4414 (mult:DI (zero_extend:DI
4415 (match_operand:SI 1 "register_operand" "%0,0"))
4417 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4418 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4422 [(set_attr "op_type" "RRE,RXY")
4423 (set_attr "type" "imul")])
4426 ; muldf3 instruction pattern(s).
4429 (define_expand "muldf3"
4430 [(set (match_operand:DF 0 "register_operand" "=f,f")
4431 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4432 (match_operand:DF 2 "general_operand" "f,R")))]
4436 (define_insn "*muldf3"
4437 [(set (match_operand:DF 0 "register_operand" "=f,f")
4438 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4439 (match_operand:DF 2 "general_operand" "f,R")))]
4440 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4444 [(set_attr "op_type" "RRE,RXE")
4445 (set_attr "type" "fmuld")])
4447 (define_insn "*muldf3_ibm"
4448 [(set (match_operand:DF 0 "register_operand" "=f,f")
4449 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4450 (match_operand:DF 2 "general_operand" "f,R")))]
4451 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4455 [(set_attr "op_type" "RR,RX")
4456 (set_attr "type" "fmuld")])
4458 (define_insn "*fmadddf"
4459 [(set (match_operand:DF 0 "register_operand" "=f,f")
4460 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4461 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4462 (match_operand:DF 3 "register_operand" "0,0")))]
4463 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4467 [(set_attr "op_type" "RRE,RXE")
4468 (set_attr "type" "fmuld")])
4470 (define_insn "*fmsubdf"
4471 [(set (match_operand:DF 0 "register_operand" "=f,f")
4472 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4473 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4474 (match_operand:DF 3 "register_operand" "0,0")))]
4475 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4479 [(set_attr "op_type" "RRE,RXE")
4480 (set_attr "type" "fmuld")])
4483 ; mulsf3 instruction pattern(s).
4486 (define_expand "mulsf3"
4487 [(set (match_operand:SF 0 "register_operand" "=f,f")
4488 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4489 (match_operand:SF 2 "general_operand" "f,R")))]
4493 (define_insn "*mulsf3"
4494 [(set (match_operand:SF 0 "register_operand" "=f,f")
4495 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4496 (match_operand:SF 2 "general_operand" "f,R")))]
4497 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4501 [(set_attr "op_type" "RRE,RXE")
4502 (set_attr "type" "fmuls")])
4504 (define_insn "*mulsf3_ibm"
4505 [(set (match_operand:SF 0 "register_operand" "=f,f")
4506 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4507 (match_operand:SF 2 "general_operand" "f,R")))]
4508 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4512 [(set_attr "op_type" "RR,RX")
4513 (set_attr "type" "fmuls")])
4515 (define_insn "*fmaddsf"
4516 [(set (match_operand:SF 0 "register_operand" "=f,f")
4517 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4518 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4519 (match_operand:SF 3 "register_operand" "0,0")))]
4520 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4524 [(set_attr "op_type" "RRE,RXE")
4525 (set_attr "type" "fmuls")])
4527 (define_insn "*fmsubsf"
4528 [(set (match_operand:SF 0 "register_operand" "=f,f")
4529 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4530 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4531 (match_operand:SF 3 "register_operand" "0,0")))]
4532 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4536 [(set_attr "op_type" "RRE,RXE")
4537 (set_attr "type" "fmuls")])
4540 ;;- Divide and modulo instructions.
4544 ; divmoddi4 instruction pattern(s).
4547 (define_expand "divmoddi4"
4548 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4549 (div:DI (match_operand:DI 1 "register_operand" "")
4550 (match_operand:DI 2 "general_operand" "")))
4551 (set (match_operand:DI 3 "general_operand" "")
4552 (mod:DI (match_dup 1) (match_dup 2)))])
4553 (clobber (match_dup 4))]
4556 rtx insn, div_equal, mod_equal;
4558 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4559 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4561 operands[4] = gen_reg_rtx(TImode);
4562 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4564 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4566 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4568 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4570 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4575 (define_insn "divmodtidi3"
4576 [(set (match_operand:TI 0 "register_operand" "=d,d")
4579 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4580 (match_operand:DI 2 "general_operand" "d,m")))
4583 (mod:DI (match_dup 1)
4590 [(set_attr "op_type" "RRE,RXY")
4591 (set_attr "type" "idiv")])
4593 (define_insn "divmodtisi3"
4594 [(set (match_operand:TI 0 "register_operand" "=d,d")
4597 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4598 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4601 (mod:DI (match_dup 1)
4602 (sign_extend:DI (match_dup 2))))
4608 [(set_attr "op_type" "RRE,RXY")
4609 (set_attr "type" "idiv")])
4612 ; udivmoddi4 instruction pattern(s).
4615 (define_expand "udivmoddi4"
4616 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4617 (udiv:DI (match_operand:DI 1 "general_operand" "")
4618 (match_operand:DI 2 "nonimmediate_operand" "")))
4619 (set (match_operand:DI 3 "general_operand" "")
4620 (umod:DI (match_dup 1) (match_dup 2)))])
4621 (clobber (match_dup 4))]
4624 rtx insn, div_equal, mod_equal, equal;
4626 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4627 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4628 equal = gen_rtx_IOR (TImode,
4629 gen_rtx_ZERO_EXTEND (TImode, div_equal),
4630 gen_rtx_ASHIFT (TImode,
4631 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4634 operands[4] = gen_reg_rtx(TImode);
4635 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4636 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4637 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4638 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4640 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4642 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4644 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4646 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4648 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4653 (define_insn "udivmodtidi3"
4654 [(set (match_operand:TI 0 "register_operand" "=d,d")
4655 (ior:TI (zero_extend:TI
4657 (udiv:TI (match_operand:TI 1 "register_operand" "0,0")
4659 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4663 (umod:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))
4669 [(set_attr "op_type" "RRE,RXY")
4670 (set_attr "type" "idiv")])
4673 ; divmodsi4 instruction pattern(s).
4676 (define_expand "divmodsi4"
4677 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4678 (div:SI (match_operand:SI 1 "general_operand" "")
4679 (match_operand:SI 2 "nonimmediate_operand" "")))
4680 (set (match_operand:SI 3 "general_operand" "")
4681 (mod:SI (match_dup 1) (match_dup 2)))])
4682 (clobber (match_dup 4))]
4685 rtx insn, div_equal, mod_equal, equal;
4687 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4688 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4689 equal = gen_rtx_IOR (DImode,
4690 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4691 gen_rtx_ASHIFT (DImode,
4692 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4695 operands[4] = gen_reg_rtx(DImode);
4696 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4697 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4699 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4701 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4703 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4705 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4707 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4712 (define_insn "divmoddisi3"
4713 [(set (match_operand:DI 0 "register_operand" "=d,d")
4714 (ior:DI (zero_extend:DI
4716 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4718 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4722 (mod:DI (match_dup 1) (sign_extend:SI (match_dup 2)))))
4728 [(set_attr "op_type" "RR,RX")
4729 (set_attr "type" "idiv")])
4732 ; udivsi3 and umodsi3 instruction pattern(s).
4735 (define_expand "udivmodsi4"
4736 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4737 (udiv:SI (match_operand:SI 1 "general_operand" "")
4738 (match_operand:SI 2 "nonimmediate_operand" "")))
4739 (set (match_operand:SI 3 "general_operand" "")
4740 (umod:SI (match_dup 1) (match_dup 2)))])
4741 (clobber (match_dup 4))]
4742 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4744 rtx insn, div_equal, mod_equal, equal;
4746 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4747 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4748 equal = gen_rtx_IOR (DImode,
4749 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4750 gen_rtx_ASHIFT (DImode,
4751 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4754 operands[4] = gen_reg_rtx(DImode);
4755 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4756 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4757 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4758 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4760 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4762 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4764 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4766 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4768 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4773 (define_insn "udivmoddisi3"
4774 [(set (match_operand:DI 0 "register_operand" "=d,d")
4775 (ior:DI (zero_extend:DI
4777 (udiv:DI (match_operand:DI 1 "register_operand" "0,0")
4779 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4783 (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))
4785 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4789 [(set_attr "op_type" "RRE,RXY")
4790 (set_attr "type" "idiv")])
4792 (define_expand "udivsi3"
4793 [(set (match_operand:SI 0 "register_operand" "=d")
4794 (udiv:SI (match_operand:SI 1 "general_operand" "")
4795 (match_operand:SI 2 "general_operand" "")))
4796 (clobber (match_dup 3))]
4797 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4799 rtx insn, udiv_equal, umod_equal, equal;
4801 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4802 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4803 equal = gen_rtx_IOR (DImode,
4804 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4805 gen_rtx_ASHIFT (DImode,
4806 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4809 operands[3] = gen_reg_rtx (DImode);
4811 if (CONSTANT_P (operands[2]))
4813 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4815 rtx label1 = gen_label_rtx ();
4817 operands[1] = make_safe_from (operands[1], operands[0]);
4818 emit_move_insn (operands[0], const0_rtx);
4819 emit_insn (gen_cmpsi (operands[1], operands[2]));
4820 emit_jump_insn (gen_bltu (label1));
4821 emit_move_insn (operands[0], const1_rtx);
4822 emit_label (label1);
4826 operands[2] = force_reg (SImode, operands[2]);
4827 operands[2] = make_safe_from (operands[2], operands[0]);
4829 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4830 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4833 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4835 insn = emit_move_insn (operands[0],
4836 gen_lowpart (SImode, operands[3]));
4838 gen_rtx_EXPR_LIST (REG_EQUAL,
4839 udiv_equal, REG_NOTES (insn));
4844 rtx label1 = gen_label_rtx ();
4845 rtx label2 = gen_label_rtx ();
4846 rtx label3 = gen_label_rtx ();
4848 operands[1] = force_reg (SImode, operands[1]);
4849 operands[1] = make_safe_from (operands[1], operands[0]);
4850 operands[2] = force_reg (SImode, operands[2]);
4851 operands[2] = make_safe_from (operands[2], operands[0]);
4853 emit_move_insn (operands[0], const0_rtx);
4854 emit_insn (gen_cmpsi (operands[2], operands[1]));
4855 emit_jump_insn (gen_bgtu (label3));
4856 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4857 emit_jump_insn (gen_blt (label2));
4858 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4859 emit_jump_insn (gen_beq (label1));
4860 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4861 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4864 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4866 insn = emit_move_insn (operands[0],
4867 gen_lowpart (SImode, operands[3]));
4869 gen_rtx_EXPR_LIST (REG_EQUAL,
4870 udiv_equal, REG_NOTES (insn));
4872 emit_label (label1);
4873 emit_move_insn (operands[0], operands[1]);
4875 emit_label (label2);
4876 emit_move_insn (operands[0], const1_rtx);
4877 emit_label (label3);
4879 emit_move_insn (operands[0], operands[0]);
4883 (define_expand "umodsi3"
4884 [(set (match_operand:SI 0 "register_operand" "=d")
4885 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4886 (match_operand:SI 2 "nonimmediate_operand" "")))
4887 (clobber (match_dup 3))]
4888 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4890 rtx insn, udiv_equal, umod_equal, equal;
4892 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4893 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4894 equal = gen_rtx_IOR (DImode,
4895 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4896 gen_rtx_ASHIFT (DImode,
4897 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4900 operands[3] = gen_reg_rtx (DImode);
4902 if (CONSTANT_P (operands[2]))
4904 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4906 rtx label1 = gen_label_rtx ();
4908 operands[1] = make_safe_from (operands[1], operands[0]);
4909 emit_move_insn (operands[0], operands[1]);
4910 emit_insn (gen_cmpsi (operands[0], operands[2]));
4911 emit_jump_insn (gen_bltu (label1));
4912 emit_insn (gen_abssi2 (operands[0], operands[2]));
4913 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4914 emit_label (label1);
4918 operands[2] = force_reg (SImode, operands[2]);
4919 operands[2] = make_safe_from (operands[2], operands[0]);
4921 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4922 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4925 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4927 insn = emit_move_insn (operands[0],
4928 gen_highpart (SImode, operands[3]));
4930 gen_rtx_EXPR_LIST (REG_EQUAL,
4931 umod_equal, REG_NOTES (insn));
4936 rtx label1 = gen_label_rtx ();
4937 rtx label2 = gen_label_rtx ();
4938 rtx label3 = gen_label_rtx ();
4940 operands[1] = force_reg (SImode, operands[1]);
4941 operands[1] = make_safe_from (operands[1], operands[0]);
4942 operands[2] = force_reg (SImode, operands[2]);
4943 operands[2] = make_safe_from (operands[2], operands[0]);
4945 emit_move_insn(operands[0], operands[1]);
4946 emit_insn (gen_cmpsi (operands[2], operands[1]));
4947 emit_jump_insn (gen_bgtu (label3));
4948 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4949 emit_jump_insn (gen_blt (label2));
4950 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4951 emit_jump_insn (gen_beq (label1));
4952 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4953 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4956 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4958 insn = emit_move_insn (operands[0],
4959 gen_highpart (SImode, operands[3]));
4961 gen_rtx_EXPR_LIST (REG_EQUAL,
4962 umod_equal, REG_NOTES (insn));
4964 emit_label (label1);
4965 emit_move_insn (operands[0], const0_rtx);
4967 emit_label (label2);
4968 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4969 emit_label (label3);
4975 ; divdf3 instruction pattern(s).
4978 (define_expand "divdf3"
4979 [(set (match_operand:DF 0 "register_operand" "=f,f")
4980 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4981 (match_operand:DF 2 "general_operand" "f,R")))]
4985 (define_insn "*divdf3"
4986 [(set (match_operand:DF 0 "register_operand" "=f,f")
4987 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4988 (match_operand:DF 2 "general_operand" "f,R")))]
4989 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4993 [(set_attr "op_type" "RRE,RXE")
4994 (set_attr "type" "fdivd")])
4996 (define_insn "*divdf3_ibm"
4997 [(set (match_operand:DF 0 "register_operand" "=f,f")
4998 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4999 (match_operand:DF 2 "general_operand" "f,R")))]
5000 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5004 [(set_attr "op_type" "RR,RX")
5005 (set_attr "type" "fdivd")])
5008 ; divsf3 instruction pattern(s).
5011 (define_expand "divsf3"
5012 [(set (match_operand:SF 0 "register_operand" "=f,f")
5013 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5014 (match_operand:SF 2 "general_operand" "f,R")))]
5018 (define_insn "*divsf3"
5019 [(set (match_operand:SF 0 "register_operand" "=f,f")
5020 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5021 (match_operand:SF 2 "general_operand" "f,R")))]
5022 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5026 [(set_attr "op_type" "RRE,RXE")
5027 (set_attr "type" "fdivs")])
5029 (define_insn "*divsf3"
5030 [(set (match_operand:SF 0 "register_operand" "=f,f")
5031 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5032 (match_operand:SF 2 "general_operand" "f,R")))]
5033 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5037 [(set_attr "op_type" "RR,RX")
5038 (set_attr "type" "fdivs")])
5042 ;;- And instructions.
5046 ; anddi3 instruction pattern(s).
5049 (define_insn "*anddi3_cc"
5051 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5052 (match_operand:DI 2 "general_operand" "d,m"))
5054 (set (match_operand:DI 0 "register_operand" "=d,d")
5055 (and:DI (match_dup 1) (match_dup 2)))]
5056 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5060 [(set_attr "op_type" "RRE,RXY")])
5062 (define_insn "*anddi3_cconly"
5064 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5065 (match_operand:DI 2 "general_operand" "d,m"))
5067 (clobber (match_scratch:DI 0 "=d,d"))]
5068 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5072 [(set_attr "op_type" "RRE,RXY")])
5074 (define_insn "anddi3"
5075 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d,d,d")
5076 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o,0,0,0,0,0,0")
5077 (match_operand:DI 2 "general_operand"
5078 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m")))
5079 (clobber (reg:CC 33))]
5090 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY")])
5092 (define_insn "*anddi3_ss"
5093 [(set (match_operand:DI 0 "s_operand" "=Q")
5094 (and:DI (match_dup 0)
5095 (match_operand:DI 1 "s_imm_operand" "Q")))
5096 (clobber (reg:CC 33))]
5099 [(set_attr "op_type" "SS")])
5101 (define_insn "*anddi3_ss_inv"
5102 [(set (match_operand:DI 0 "s_operand" "=Q")
5103 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5105 (clobber (reg:CC 33))]
5108 [(set_attr "op_type" "SS")])
5111 ; andsi3 instruction pattern(s).
5114 (define_insn "*andsi3_cc"
5116 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5117 (match_operand:SI 2 "general_operand" "d,R,T"))
5119 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5120 (and:SI (match_dup 1) (match_dup 2)))]
5121 "s390_match_ccmode(insn, CCTmode)"
5126 [(set_attr "op_type" "RR,RX,RXY")])
5128 (define_insn "*andsi3_cconly"
5130 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5131 (match_operand:SI 2 "general_operand" "d,R,T"))
5133 (clobber (match_scratch:SI 0 "=d,d,d"))]
5134 "s390_match_ccmode(insn, CCTmode)"
5139 [(set_attr "op_type" "RR,RX,RXY")])
5141 (define_expand "andsi3"
5143 [(set (match_operand:SI 0 "register_operand" "")
5144 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
5145 (match_operand:SI 2 "general_operand" "")))
5146 (clobber (reg:CC 33))])]
5150 (define_insn "*andsi3_zarch"
5151 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d,d,d")
5152 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,o,0,0,0,0,0")
5153 (match_operand:SI 2 "general_operand" "M,M,N0HSF,N1HSF,d,R,T")))
5154 (clobber (reg:CC 33))]
5164 [(set_attr "op_type" "RRE,RXE,RI,RI,RR,RX,RXY")])
5166 (define_insn "*andsi3_esa"
5167 [(set (match_operand:SI 0 "register_operand" "=d,d")
5168 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5169 (match_operand:SI 2 "general_operand" "d,R")))
5170 (clobber (reg:CC 33))]
5175 [(set_attr "op_type" "RR,RX")])
5177 (define_insn "*andsi3_ss"
5178 [(set (match_operand:SI 0 "s_operand" "=Q")
5179 (and:SI (match_dup 0)
5180 (match_operand:SI 1 "s_imm_operand" "Q")))
5181 (clobber (reg:CC 33))]
5184 [(set_attr "op_type" "SS")])
5186 (define_insn "*andsi3_ss_inv"
5187 [(set (match_operand:SI 0 "s_operand" "=Q")
5188 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5190 (clobber (reg:CC 33))]
5193 [(set_attr "op_type" "SS")])
5196 ; andhi3 instruction pattern(s).
5199 (define_insn "*andhi3_ni"
5200 [(set (match_operand:HI 0 "register_operand" "=d,d")
5201 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5202 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5203 (clobber (reg:CC 33))]
5208 [(set_attr "op_type" "RR,RI")])
5210 (define_insn "andhi3"
5211 [(set (match_operand:HI 0 "register_operand" "=d")
5212 (and:HI (match_operand:HI 1 "register_operand" "%0")
5213 (match_operand:HI 2 "nonmemory_operand" "d")))
5214 (clobber (reg:CC 33))]
5217 [(set_attr "op_type" "RR")])
5219 (define_insn "*andhi3_ss"
5220 [(set (match_operand:HI 0 "s_operand" "=Q")
5221 (and:HI (match_dup 0)
5222 (match_operand:HI 1 "s_imm_operand" "Q")))
5223 (clobber (reg:CC 33))]
5226 [(set_attr "op_type" "SS")])
5228 (define_insn "*andhi3_ss_inv"
5229 [(set (match_operand:HI 0 "s_operand" "=Q")
5230 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5232 (clobber (reg:CC 33))]
5235 [(set_attr "op_type" "SS")])
5238 ; andqi3 instruction pattern(s).
5241 (define_insn "*andqi3_ni"
5242 [(set (match_operand:QI 0 "register_operand" "=d,d")
5243 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5244 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5245 (clobber (reg:CC 33))]
5250 [(set_attr "op_type" "RR,RI")])
5252 (define_insn "andqi3"
5253 [(set (match_operand:QI 0 "register_operand" "=d")
5254 (and:QI (match_operand:QI 1 "register_operand" "%0")
5255 (match_operand:QI 2 "nonmemory_operand" "d")))
5256 (clobber (reg:CC 33))]
5259 [(set_attr "op_type" "RR")])
5261 (define_insn "*andqi3_ss"
5262 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5263 (and:QI (match_dup 0)
5264 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5265 (clobber (reg:CC 33))]
5271 [(set_attr "op_type" "SI,SIY,SS")])
5273 (define_insn "*andqi3_ss_inv"
5274 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5275 (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5277 (clobber (reg:CC 33))]
5283 [(set_attr "op_type" "SI,SIY,SS")])
5287 ;;- Bit set (inclusive or) instructions.
5291 ; iordi3 instruction pattern(s).
5294 (define_insn "*iordi3_cc"
5296 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5297 (match_operand:DI 2 "general_operand" "d,m"))
5299 (set (match_operand:DI 0 "register_operand" "=d,d")
5300 (ior:DI (match_dup 1) (match_dup 2)))]
5301 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5305 [(set_attr "op_type" "RRE,RXY")])
5307 (define_insn "*iordi3_cconly"
5309 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5310 (match_operand:DI 2 "general_operand" "d,m"))
5312 (clobber (match_scratch:DI 0 "=d,d"))]
5313 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5317 [(set_attr "op_type" "RRE,RXY")])
5319 (define_insn "iordi3"
5320 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d")
5321 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,0,0,0,0")
5322 (match_operand:DI 2 "general_operand" "N0HD0,N1HD0,N2HD0,N3HD0,d,m")))
5323 (clobber (reg:CC 33))]
5332 [(set_attr "op_type" "RI,RI,RI,RI,RRE,RXY")])
5334 (define_insn "*iordi3_ss"
5335 [(set (match_operand:DI 0 "s_operand" "=Q")
5336 (ior:DI (match_dup 0)
5337 (match_operand:DI 1 "s_imm_operand" "Q")))
5338 (clobber (reg:CC 33))]
5341 [(set_attr "op_type" "SS")])
5343 (define_insn "*iordi3_ss_inv"
5344 [(set (match_operand:DI 0 "s_operand" "=Q")
5345 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5347 (clobber (reg:CC 33))]
5350 [(set_attr "op_type" "SS")])
5353 ; iorsi3 instruction pattern(s).
5356 (define_insn "*iorsi3_cc"
5358 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5359 (match_operand:SI 2 "general_operand" "d,R,T"))
5361 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5362 (ior:SI (match_dup 1) (match_dup 2)))]
5363 "s390_match_ccmode(insn, CCTmode)"
5368 [(set_attr "op_type" "RR,RX,RXY")])
5370 (define_insn "*iorsi3_cconly"
5372 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5373 (match_operand:SI 2 "general_operand" "d,R,T"))
5375 (clobber (match_scratch:SI 0 "=d,d,d"))]
5376 "s390_match_ccmode(insn, CCTmode)"
5381 [(set_attr "op_type" "RR,RX,RXY")])
5383 (define_expand "iorsi3"
5385 [(set (match_operand:SI 0 "register_operand" "")
5386 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
5387 (match_operand:SI 2 "general_operand" "")))
5388 (clobber (reg:CC 33))])]
5392 (define_insn "iorsi3_zarch"
5393 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
5394 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0,0")
5395 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,d,R,T")))
5396 (clobber (reg:CC 33))]
5404 [(set_attr "op_type" "RI,RI,RR,RX,RXY")])
5406 (define_insn "iorsi3_esa"
5407 [(set (match_operand:SI 0 "register_operand" "=d,d")
5408 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
5409 (match_operand:SI 2 "general_operand" "d,R")))
5410 (clobber (reg:CC 33))]
5415 [(set_attr "op_type" "RR,RX")])
5417 (define_insn "*iorsi3_ss"
5418 [(set (match_operand:SI 0 "s_operand" "=Q")
5419 (ior:SI (match_dup 0)
5420 (match_operand:SI 1 "s_imm_operand" "Q")))
5421 (clobber (reg:CC 33))]
5424 [(set_attr "op_type" "SS")])
5426 (define_insn "*iorsi3_ss_inv"
5427 [(set (match_operand:SI 0 "s_operand" "=Q")
5428 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5430 (clobber (reg:CC 33))]
5433 [(set_attr "op_type" "SS")])
5436 ; iorhi3 instruction pattern(s).
5439 (define_insn "*iorhi3_oi"
5440 [(set (match_operand:HI 0 "register_operand" "=d,d")
5441 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5442 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5443 (clobber (reg:CC 33))]
5448 [(set_attr "op_type" "RR,RI")])
5450 (define_insn "iorhi3"
5451 [(set (match_operand:HI 0 "register_operand" "=d")
5452 (ior:HI (match_operand:HI 1 "register_operand" "%0")
5453 (match_operand:HI 2 "nonmemory_operand" "d")))
5454 (clobber (reg:CC 33))]
5457 [(set_attr "op_type" "RR")])
5459 (define_insn "*iorhi3_ss"
5460 [(set (match_operand:HI 0 "s_operand" "=Q")
5461 (ior:HI (match_dup 0)
5462 (match_operand:HI 1 "s_imm_operand" "Q")))
5463 (clobber (reg:CC 33))]
5466 [(set_attr "op_type" "SS")])
5468 (define_insn "*iorhi3_ss_inv"
5469 [(set (match_operand:HI 0 "s_operand" "=Q")
5470 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5472 (clobber (reg:CC 33))]
5475 [(set_attr "op_type" "SS")])
5478 ; iorqi3 instruction pattern(s).
5481 (define_insn "*iorqi3_oi"
5482 [(set (match_operand:QI 0 "register_operand" "=d,d")
5483 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5484 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5485 (clobber (reg:CC 33))]
5490 [(set_attr "op_type" "RR,RI")])
5492 (define_insn "iorqi3"
5493 [(set (match_operand:QI 0 "register_operand" "=d")
5494 (ior:QI (match_operand:QI 1 "register_operand" "%0")
5495 (match_operand:QI 2 "nonmemory_operand" "d")))
5496 (clobber (reg:CC 33))]
5499 [(set_attr "op_type" "RR")])
5501 (define_insn "*iorqi3_ss"
5502 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5503 (ior:QI (match_dup 0)
5504 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5505 (clobber (reg:CC 33))]
5511 [(set_attr "op_type" "SI,SIY,SS")])
5513 (define_insn "*iorqi3_ss_inv"
5514 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5515 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5517 (clobber (reg:CC 33))]
5523 [(set_attr "op_type" "SI,SIY,SS")])
5527 ;;- Xor instructions.
5531 ; xordi3 instruction pattern(s).
5534 (define_insn "*xordi3_cc"
5536 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5537 (match_operand:DI 2 "general_operand" "d,m"))
5539 (set (match_operand:DI 0 "register_operand" "=d,d")
5540 (xor:DI (match_dup 1) (match_dup 2)))]
5541 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5545 [(set_attr "op_type" "RRE,RXY")])
5547 (define_insn "*xordi3_cconly"
5549 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5550 (match_operand:DI 2 "general_operand" "d,m"))
5552 (clobber (match_scratch:DI 0 "=d,d"))]
5553 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5557 [(set_attr "op_type" "RRE,RXY")])
5559 (define_insn "xordi3"
5560 [(set (match_operand:DI 0 "register_operand" "=d,d")
5561 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5562 (match_operand:DI 2 "general_operand" "d,m")))
5563 (clobber (reg:CC 33))]
5568 [(set_attr "op_type" "RRE,RXY")])
5570 (define_insn "*xordi3_ss"
5571 [(set (match_operand:DI 0 "s_operand" "=Q")
5572 (xor:DI (match_dup 0)
5573 (match_operand:DI 1 "s_imm_operand" "Q")))
5574 (clobber (reg:CC 33))]
5577 [(set_attr "op_type" "SS")])
5579 (define_insn "*xordi3_ss_inv"
5580 [(set (match_operand:DI 0 "s_operand" "=Q")
5581 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5583 (clobber (reg:CC 33))]
5586 [(set_attr "op_type" "SS")])
5589 ; xorsi3 instruction pattern(s).
5592 (define_insn "*xorsi3_cc"
5594 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5595 (match_operand:SI 2 "general_operand" "d,R,T"))
5597 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5598 (xor:SI (match_dup 1) (match_dup 2)))]
5599 "s390_match_ccmode(insn, CCTmode)"
5604 [(set_attr "op_type" "RR,RX,RXY")])
5606 (define_insn "*xorsi3_cconly"
5608 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5609 (match_operand:SI 2 "general_operand" "d,R,T"))
5611 (clobber (match_scratch:SI 0 "=d,d,d"))]
5612 "s390_match_ccmode(insn, CCTmode)"
5617 [(set_attr "op_type" "RR,RX,RXY")])
5619 (define_insn "xorsi3"
5620 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5621 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5622 (match_operand:SI 2 "general_operand" "d,R,T")))
5623 (clobber (reg:CC 33))]
5629 [(set_attr "op_type" "RR,RX,RXY")])
5631 (define_insn "*xorsi3_ss"
5632 [(set (match_operand:SI 0 "s_operand" "=Q")
5633 (xor:SI (match_dup 0)
5634 (match_operand:SI 1 "s_imm_operand" "Q")))
5635 (clobber (reg:CC 33))]
5638 [(set_attr "op_type" "SS")])
5640 (define_insn "*xorsi3_ss_inv"
5641 [(set (match_operand:SI 0 "s_operand" "=Q")
5642 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5644 (clobber (reg:CC 33))]
5647 [(set_attr "op_type" "SS")])
5650 ; xorhi3 instruction pattern(s).
5653 (define_insn "xorhi3"
5654 [(set (match_operand:HI 0 "register_operand" "=d")
5655 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5656 (match_operand:HI 2 "nonmemory_operand" "d")))
5657 (clobber (reg:CC 33))]
5660 [(set_attr "op_type" "RR")])
5662 (define_insn "*xorhi3_ss"
5663 [(set (match_operand:HI 0 "s_operand" "=Q")
5664 (xor:HI (match_dup 0)
5665 (match_operand:HI 1 "s_imm_operand" "Q")))
5666 (clobber (reg:CC 33))]
5669 [(set_attr "op_type" "SS")])
5671 (define_insn "*xorhi3_ss_inv"
5672 [(set (match_operand:HI 0 "s_operand" "=Q")
5673 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5675 (clobber (reg:CC 33))]
5678 [(set_attr "op_type" "SS")])
5681 ; xorqi3 instruction pattern(s).
5684 (define_insn "xorqi3"
5685 [(set (match_operand:QI 0 "register_operand" "=d")
5686 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5687 (match_operand:QI 2 "nonmemory_operand" "d")))
5688 (clobber (reg:CC 33))]
5691 [(set_attr "op_type" "RR")])
5693 (define_insn "*xorqi3_ss"
5694 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5695 (xor:QI (match_dup 0)
5696 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5697 (clobber (reg:CC 33))]
5703 [(set_attr "op_type" "SI,SIY,SS")])
5705 (define_insn "*xorqi3_ss_inv"
5706 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5707 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5709 (clobber (reg:CC 33))]
5715 [(set_attr "op_type" "SI,SIY,SS")])
5719 ;;- Negate instructions.
5723 ; negdi2 instruction pattern(s).
5726 (define_expand "negdi2"
5728 [(set (match_operand:DI 0 "register_operand" "=d")
5729 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5730 (clobber (reg:CC 33))])]
5734 (define_insn "*negdi2_64"
5735 [(set (match_operand:DI 0 "register_operand" "=d")
5736 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5737 (clobber (reg:CC 33))]
5740 [(set_attr "op_type" "RR")])
5742 (define_insn "*negdi2_31"
5743 [(set (match_operand:DI 0 "register_operand" "=d")
5744 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5745 (clobber (reg:CC 33))]
5749 xop[0] = gen_label_rtx ();
5750 output_asm_insn ("lcr\t%0,%1", operands);
5751 output_asm_insn ("lcr\t%N0,%N1", operands);
5752 output_asm_insn ("je\t%l0", xop);
5753 output_asm_insn ("bctr\t%0,0", operands);
5754 targetm.asm_out.internal_label (asm_out_file, "L",
5755 CODE_LABEL_NUMBER (xop[0]));
5758 [(set_attr "op_type" "NN")
5759 (set_attr "type" "other")
5760 (set_attr "length" "10")])
5763 ; negsi2 instruction pattern(s).
5766 (define_insn "negsi2"
5767 [(set (match_operand:SI 0 "register_operand" "=d")
5768 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5769 (clobber (reg:CC 33))]
5772 [(set_attr "op_type" "RR")])
5775 ; negdf2 instruction pattern(s).
5778 (define_expand "negdf2"
5780 [(set (match_operand:DF 0 "register_operand" "=f")
5781 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5782 (clobber (reg:CC 33))])]
5786 (define_insn "*negdf2"
5787 [(set (match_operand:DF 0 "register_operand" "=f")
5788 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5789 (clobber (reg:CC 33))]
5790 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5792 [(set_attr "op_type" "RRE")
5793 (set_attr "type" "fsimpd")])
5795 (define_insn "*negdf2_ibm"
5796 [(set (match_operand:DF 0 "register_operand" "=f")
5797 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5798 (clobber (reg:CC 33))]
5799 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5801 [(set_attr "op_type" "RR")
5802 (set_attr "type" "fsimpd")])
5805 ; negsf2 instruction pattern(s).
5808 (define_expand "negsf2"
5810 [(set (match_operand:SF 0 "register_operand" "=f")
5811 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5812 (clobber (reg:CC 33))])]
5816 (define_insn "*negsf2"
5817 [(set (match_operand:SF 0 "register_operand" "=f")
5818 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5819 (clobber (reg:CC 33))]
5820 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5822 [(set_attr "op_type" "RRE")
5823 (set_attr "type" "fsimps")])
5825 (define_insn "*negsf2"
5826 [(set (match_operand:SF 0 "register_operand" "=f")
5827 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5828 (clobber (reg:CC 33))]
5829 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5831 [(set_attr "op_type" "RR")
5832 (set_attr "type" "fsimps")])
5836 ;;- Absolute value instructions.
5840 ; absdi2 instruction pattern(s).
5843 (define_insn "absdi2"
5844 [(set (match_operand:DI 0 "register_operand" "=d")
5845 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5846 (clobber (reg:CC 33))]
5849 [(set_attr "op_type" "RRE")])
5852 ; abssi2 instruction pattern(s).
5855 (define_insn "abssi2"
5856 [(set (match_operand:SI 0 "register_operand" "=d")
5857 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5858 (clobber (reg:CC 33))]
5861 [(set_attr "op_type" "RR")])
5864 ; absdf2 instruction pattern(s).
5867 (define_expand "absdf2"
5869 [(set (match_operand:DF 0 "register_operand" "=f")
5870 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5871 (clobber (reg:CC 33))])]
5875 (define_insn "*absdf2"
5876 [(set (match_operand:DF 0 "register_operand" "=f")
5877 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5878 (clobber (reg:CC 33))]
5879 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5881 [(set_attr "op_type" "RRE")
5882 (set_attr "type" "fsimpd")])
5884 (define_insn "*absdf2_ibm"
5885 [(set (match_operand:DF 0 "register_operand" "=f")
5886 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5887 (clobber (reg:CC 33))]
5888 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5890 [(set_attr "op_type" "RR")
5891 (set_attr "type" "fsimpd")])
5894 ; abssf2 instruction pattern(s).
5897 (define_expand "abssf2"
5899 [(set (match_operand:SF 0 "register_operand" "=f")
5900 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5901 (clobber (reg:CC 33))])]
5905 (define_insn "*abssf2"
5906 [(set (match_operand:SF 0 "register_operand" "=f")
5907 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5908 (clobber (reg:CC 33))]
5909 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5911 [(set_attr "op_type" "RRE")
5912 (set_attr "type" "fsimps")])
5914 (define_insn "*abssf2_ibm"
5915 [(set (match_operand:SF 0 "register_operand" "=f")
5916 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5917 (clobber (reg:CC 33))]
5918 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5920 [(set_attr "op_type" "RR")
5921 (set_attr "type" "fsimps")])
5924 ;;- Negated absolute value instructions
5931 (define_insn "*negabssi2"
5932 [(set (match_operand:SI 0 "register_operand" "=d")
5933 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
5934 (clobber (reg:CC 33))]
5937 [(set_attr "op_type" "RR")])
5939 (define_insn "*negabsdi2"
5940 [(set (match_operand:DI 0 "register_operand" "=d")
5941 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
5942 (clobber (reg:CC 33))]
5945 [(set_attr "op_type" "RRE")])
5951 (define_insn "*negabssf2"
5952 [(set (match_operand:SF 0 "register_operand" "=f")
5953 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5954 (clobber (reg:CC 33))]
5955 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5957 [(set_attr "op_type" "RRE")
5958 (set_attr "type" "fsimps")])
5960 (define_insn "*negabsdf2"
5961 [(set (match_operand:DF 0 "register_operand" "=f")
5962 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5963 (clobber (reg:CC 33))]
5964 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5966 [(set_attr "op_type" "RRE")
5967 (set_attr "type" "fsimpd")])
5970 ;;- Square root instructions.
5974 ; sqrtdf2 instruction pattern(s).
5977 (define_insn "sqrtdf2"
5978 [(set (match_operand:DF 0 "register_operand" "=f,f")
5979 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
5980 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5984 [(set_attr "op_type" "RRE,RXE")])
5987 ; sqrtsf2 instruction pattern(s).
5990 (define_insn "sqrtsf2"
5991 [(set (match_operand:SF 0 "register_operand" "=f,f")
5992 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
5993 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5997 [(set_attr "op_type" "RRE,RXE")])
6000 ;;- One complement instructions.
6004 ; one_cmpldi2 instruction pattern(s).
6007 (define_expand "one_cmpldi2"
6009 [(set (match_operand:DI 0 "register_operand" "")
6010 (xor:DI (match_operand:DI 1 "register_operand" "")
6012 (clobber (reg:CC 33))])]
6017 ; one_cmplsi2 instruction pattern(s).
6020 (define_expand "one_cmplsi2"
6022 [(set (match_operand:SI 0 "register_operand" "")
6023 (xor:SI (match_operand:SI 1 "register_operand" "")
6025 (clobber (reg:CC 33))])]
6030 ; one_cmplhi2 instruction pattern(s).
6033 (define_expand "one_cmplhi2"
6035 [(set (match_operand:HI 0 "register_operand" "")
6036 (xor:HI (match_operand:HI 1 "register_operand" "")
6038 (clobber (reg:CC 33))])]
6043 ; one_cmplqi2 instruction pattern(s).
6046 (define_expand "one_cmplqi2"
6048 [(set (match_operand:QI 0 "register_operand" "")
6049 (xor:QI (match_operand:QI 1 "register_operand" "")
6051 (clobber (reg:CC 33))])]
6057 ;;- Rotate instructions.
6061 ; rotldi3 instruction pattern(s).
6064 (define_insn "rotldi3"
6065 [(set (match_operand:DI 0 "register_operand" "=d")
6066 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6067 (match_operand:SI 2 "shift_count_operand" "Y")))]
6070 [(set_attr "op_type" "RSE")
6071 (set_attr "atype" "reg")])
6074 ; rotlsi3 instruction pattern(s).
6077 (define_insn "rotlsi3"
6078 [(set (match_operand:SI 0 "register_operand" "=d")
6079 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6080 (match_operand:SI 2 "shift_count_operand" "Y")))]
6083 [(set_attr "op_type" "RSE")
6084 (set_attr "atype" "reg")])
6088 ;;- Arithmetic shift instructions.
6092 ; ashldi3 instruction pattern(s).
6095 (define_expand "ashldi3"
6096 [(set (match_operand:DI 0 "register_operand" "")
6097 (ashift:DI (match_operand:DI 1 "register_operand" "")
6098 (match_operand:SI 2 "shift_count_operand" "")))]
6102 (define_insn "*ashldi3_31"
6103 [(set (match_operand:DI 0 "register_operand" "=d")
6104 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6105 (match_operand:SI 2 "shift_count_operand" "Y")))]
6108 [(set_attr "op_type" "RS")
6109 (set_attr "atype" "reg")])
6111 (define_insn "*ashldi3_64"
6112 [(set (match_operand:DI 0 "register_operand" "=d")
6113 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6114 (match_operand:SI 2 "shift_count_operand" "Y")))]
6117 [(set_attr "op_type" "RSE")
6118 (set_attr "atype" "reg")])
6121 ; ashrdi3 instruction pattern(s).
6124 (define_expand "ashrdi3"
6126 [(set (match_operand:DI 0 "register_operand" "")
6127 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6128 (match_operand:SI 2 "shift_count_operand" "")))
6129 (clobber (reg:CC 33))])]
6133 (define_insn "*ashrdi3_cc_31"
6135 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6136 (match_operand:SI 2 "shift_count_operand" "Y"))
6138 (set (match_operand:DI 0 "register_operand" "=d")
6139 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6140 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6142 [(set_attr "op_type" "RS")
6143 (set_attr "atype" "reg")])
6145 (define_insn "*ashrdi3_cconly_31"
6147 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6148 (match_operand:SI 2 "shift_count_operand" "Y"))
6150 (clobber (match_scratch:DI 0 "=d"))]
6151 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6153 [(set_attr "op_type" "RS")
6154 (set_attr "atype" "reg")])
6156 (define_insn "*ashrdi3_31"
6157 [(set (match_operand:DI 0 "register_operand" "=d")
6158 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6159 (match_operand:SI 2 "shift_count_operand" "Y")))
6160 (clobber (reg:CC 33))]
6163 [(set_attr "op_type" "RS")
6164 (set_attr "atype" "reg")])
6166 (define_insn "*ashrdi3_cc_64"
6168 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6169 (match_operand:SI 2 "shift_count_operand" "Y"))
6171 (set (match_operand:DI 0 "register_operand" "=d")
6172 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6173 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6175 [(set_attr "op_type" "RSE")
6176 (set_attr "atype" "reg")])
6178 (define_insn "*ashrdi3_cconly_64"
6180 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6181 (match_operand:SI 2 "shift_count_operand" "Y"))
6183 (clobber (match_scratch:DI 0 "=d"))]
6184 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6186 [(set_attr "op_type" "RSE")
6187 (set_attr "atype" "reg")])
6189 (define_insn "*ashrdi3_64"
6190 [(set (match_operand:DI 0 "register_operand" "=d")
6191 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6192 (match_operand:SI 2 "shift_count_operand" "Y")))
6193 (clobber (reg:CC 33))]
6196 [(set_attr "op_type" "RSE")
6197 (set_attr "atype" "reg")])
6201 ; ashlsi3 instruction pattern(s).
6204 (define_insn "ashlsi3"
6205 [(set (match_operand:SI 0 "register_operand" "=d")
6206 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6207 (match_operand:SI 2 "shift_count_operand" "Y")))]
6210 [(set_attr "op_type" "RS")
6211 (set_attr "atype" "reg")])
6214 ; ashrsi3 instruction pattern(s).
6217 (define_insn "*ashrsi3_cc"
6219 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6220 (match_operand:SI 2 "shift_count_operand" "Y"))
6222 (set (match_operand:SI 0 "register_operand" "=d")
6223 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6224 "s390_match_ccmode(insn, CCSmode)"
6226 [(set_attr "op_type" "RS")
6227 (set_attr "atype" "reg")])
6230 (define_insn "*ashrsi3_cconly"
6232 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6233 (match_operand:SI 2 "shift_count_operand" "Y"))
6235 (clobber (match_scratch:SI 0 "=d"))]
6236 "s390_match_ccmode(insn, CCSmode)"
6238 [(set_attr "op_type" "RS")
6239 (set_attr "atype" "reg")])
6241 (define_insn "ashrsi3"
6242 [(set (match_operand:SI 0 "register_operand" "=d")
6243 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6244 (match_operand:SI 2 "shift_count_operand" "Y")))
6245 (clobber (reg:CC 33))]
6248 [(set_attr "op_type" "RS")
6249 (set_attr "atype" "reg")])
6253 ;;- logical shift instructions.
6257 ; lshrdi3 instruction pattern(s).
6260 (define_expand "lshrdi3"
6261 [(set (match_operand:DI 0 "register_operand" "")
6262 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6263 (match_operand:SI 2 "shift_count_operand" "")))]
6267 (define_insn "*lshrdi3_31"
6268 [(set (match_operand:DI 0 "register_operand" "=d")
6269 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6270 (match_operand:SI 2 "shift_count_operand" "Y")))]
6273 [(set_attr "op_type" "RS")
6274 (set_attr "atype" "reg")])
6276 (define_insn "*lshrdi3_64"
6277 [(set (match_operand:DI 0 "register_operand" "=d")
6278 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6279 (match_operand:SI 2 "shift_count_operand" "Y")))]
6282 [(set_attr "op_type" "RSE")
6283 (set_attr "atype" "reg")])
6286 ; lshrsi3 instruction pattern(s).
6289 (define_insn "lshrsi3"
6290 [(set (match_operand:SI 0 "register_operand" "=d")
6291 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6292 (match_operand:SI 2 "shift_count_operand" "Y")))]
6295 [(set_attr "op_type" "RS")
6296 (set_attr "atype" "reg")])
6300 ;; Branch instruction patterns.
6303 (define_expand "beq"
6304 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6306 (if_then_else (eq (reg:CCZ 33) (const_int 0))
6307 (label_ref (match_operand 0 "" ""))
6310 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6312 (define_expand "bne"
6313 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6315 (if_then_else (ne (reg:CCZ 33) (const_int 0))
6316 (label_ref (match_operand 0 "" ""))
6319 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6321 (define_expand "bgt"
6322 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6324 (if_then_else (gt (reg:CCS 33) (const_int 0))
6325 (label_ref (match_operand 0 "" ""))
6328 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6330 (define_expand "bgtu"
6331 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6333 (if_then_else (gtu (reg:CCU 33) (const_int 0))
6334 (label_ref (match_operand 0 "" ""))
6337 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6339 (define_expand "blt"
6340 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6342 (if_then_else (lt (reg:CCS 33) (const_int 0))
6343 (label_ref (match_operand 0 "" ""))
6346 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6348 (define_expand "bltu"
6349 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6351 (if_then_else (ltu (reg:CCU 33) (const_int 0))
6352 (label_ref (match_operand 0 "" ""))
6355 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6357 (define_expand "bge"
6358 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6360 (if_then_else (ge (reg:CCS 33) (const_int 0))
6361 (label_ref (match_operand 0 "" ""))
6364 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6366 (define_expand "bgeu"
6367 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6369 (if_then_else (geu (reg:CCU 33) (const_int 0))
6370 (label_ref (match_operand 0 "" ""))
6373 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6375 (define_expand "ble"
6376 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6378 (if_then_else (le (reg:CCS 33) (const_int 0))
6379 (label_ref (match_operand 0 "" ""))
6382 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6384 (define_expand "bleu"
6385 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6387 (if_then_else (leu (reg:CCU 33) (const_int 0))
6388 (label_ref (match_operand 0 "" ""))
6391 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6393 (define_expand "bunordered"
6394 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6396 (if_then_else (unordered (reg:CCS 33) (const_int 0))
6397 (label_ref (match_operand 0 "" ""))
6400 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6402 (define_expand "bordered"
6403 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6405 (if_then_else (ordered (reg:CCS 33) (const_int 0))
6406 (label_ref (match_operand 0 "" ""))
6409 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6411 (define_expand "buneq"
6412 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6414 (if_then_else (uneq (reg:CCS 33) (const_int 0))
6415 (label_ref (match_operand 0 "" ""))
6418 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6420 (define_expand "bungt"
6421 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6423 (if_then_else (ungt (reg:CCS 33) (const_int 0))
6424 (label_ref (match_operand 0 "" ""))
6427 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6429 (define_expand "bunlt"
6430 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6432 (if_then_else (unlt (reg:CCS 33) (const_int 0))
6433 (label_ref (match_operand 0 "" ""))
6436 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6438 (define_expand "bunge"
6439 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6441 (if_then_else (unge (reg:CCS 33) (const_int 0))
6442 (label_ref (match_operand 0 "" ""))
6445 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6447 (define_expand "bunle"
6448 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6450 (if_then_else (unle (reg:CCS 33) (const_int 0))
6451 (label_ref (match_operand 0 "" ""))
6454 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6456 (define_expand "bltgt"
6457 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6459 (if_then_else (ltgt (reg:CCS 33) (const_int 0))
6460 (label_ref (match_operand 0 "" ""))
6463 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6467 ;;- Conditional jump instructions.
6470 (define_insn "cjump"
6473 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6474 (label_ref (match_operand 0 "" ""))
6478 if (get_attr_length (insn) == 4)
6480 else if (TARGET_CPU_ZARCH)
6481 return "jg%C1\t%l0";
6485 [(set_attr "op_type" "RI")
6486 (set_attr "type" "branch")
6487 (set (attr "length")
6488 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6490 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6492 (eq (symbol_ref "flag_pic") (const_int 0))
6493 (const_int 6)] (const_int 8)))])
6495 (define_insn "*cjump_long"
6498 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6499 (match_operand 0 "address_operand" "U")
6503 if (get_attr_op_type (insn) == OP_TYPE_RR)
6508 [(set (attr "op_type")
6509 (if_then_else (match_operand 0 "register_operand" "")
6510 (const_string "RR") (const_string "RX")))
6511 (set_attr "type" "branch")
6512 (set_attr "atype" "agen")])
6516 ;;- Negated conditional jump instructions.
6519 (define_insn "icjump"
6522 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6524 (label_ref (match_operand 0 "" ""))))]
6527 if (get_attr_length (insn) == 4)
6529 else if (TARGET_CPU_ZARCH)
6530 return "jg%D1\t%l0";
6534 [(set_attr "op_type" "RI")
6535 (set_attr "type" "branch")
6536 (set (attr "length")
6537 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6539 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6541 (eq (symbol_ref "flag_pic") (const_int 0))
6542 (const_int 6)] (const_int 8)))])
6544 (define_insn "*icjump_long"
6547 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6549 (match_operand 0 "address_operand" "U")))]
6552 if (get_attr_op_type (insn) == OP_TYPE_RR)
6557 [(set (attr "op_type")
6558 (if_then_else (match_operand 0 "register_operand" "")
6559 (const_string "RR") (const_string "RX")))
6560 (set_attr "type" "branch")
6561 (set_attr "atype" "agen")])
6564 ;;- Trap instructions.
6568 [(trap_if (const_int 1) (const_int 0))]
6571 [(set_attr "op_type" "RX")
6572 (set_attr "type" "branch")])
6574 (define_expand "conditional_trap"
6575 [(set (match_dup 2) (match_dup 3))
6576 (trap_if (match_operator 0 "comparison_operator"
6577 [(match_dup 2) (const_int 0)])
6578 (match_operand:SI 1 "general_operand" ""))]
6581 enum machine_mode ccmode;
6583 if (operands[1] != const0_rtx) FAIL;
6585 ccmode = s390_select_ccmode (GET_CODE (operands[0]),
6586 s390_compare_op0, s390_compare_op1);
6587 operands[2] = gen_rtx_REG (ccmode, 33);
6588 operands[3] = gen_rtx_COMPARE (ccmode, s390_compare_op0, s390_compare_op1);
6591 (define_insn "*trap"
6592 [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6596 [(set_attr "op_type" "RI")
6597 (set_attr "type" "branch")])
6600 ;;- Loop instructions.
6602 ;; This is all complicated by the fact that since this is a jump insn
6603 ;; we must handle our own output reloads.
6605 (define_expand "doloop_end"
6606 [(use (match_operand 0 "" "")) ; loop pseudo
6607 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6608 (use (match_operand 2 "" "")) ; max iterations
6609 (use (match_operand 3 "" "")) ; loop level
6610 (use (match_operand 4 "" ""))] ; label
6613 if (GET_MODE (operands[0]) == SImode)
6614 emit_jump_insn (gen_doloop_si (operands[4], operands[0], operands[0]));
6615 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6616 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6623 (define_insn "doloop_si"
6626 (ne (match_operand:SI 1 "register_operand" "d,d")
6628 (label_ref (match_operand 0 "" ""))
6630 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6631 (plus:SI (match_dup 1) (const_int -1)))
6632 (clobber (match_scratch:SI 3 "=X,&d"))
6633 (clobber (reg:CC 33))]
6636 if (which_alternative != 0)
6638 else if (get_attr_length (insn) == 4)
6639 return "brct\t%1,%l0";
6640 else if (TARGET_CPU_ZARCH)
6641 return "ahi\t%1,-1\;jgne\t%l0";
6645 [(set_attr "op_type" "RI")
6646 (set_attr "type" "branch")
6647 (set (attr "length")
6648 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6650 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6652 (eq (symbol_ref "flag_pic") (const_int 0))
6653 (const_int 6)] (const_int 8)))])
6655 (define_insn "*doloop_si_long"
6658 (ne (match_operand:SI 1 "register_operand" "d,d")
6660 (match_operand 0 "address_operand" "U,U")
6662 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6663 (plus:SI (match_dup 1) (const_int -1)))
6664 (clobber (match_scratch:SI 3 "=X,&d"))
6665 (clobber (reg:CC 33))]
6668 if (get_attr_op_type (insn) == OP_TYPE_RR)
6669 return "bctr\t%1,%0";
6671 return "bct\t%1,%a0";
6673 [(set (attr "op_type")
6674 (if_then_else (match_operand 0 "register_operand" "")
6675 (const_string "RR") (const_string "RX")))
6676 (set_attr "type" "branch")
6677 (set_attr "atype" "agen")])
6681 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
6683 (match_operand 0 "" "")
6685 (set (match_operand:SI 2 "nonimmediate_operand" "")
6686 (plus:SI (match_dup 1) (const_int -1)))
6687 (clobber (match_scratch:SI 3 ""))
6688 (clobber (reg:CC 33))]
6690 && (! REG_P (operands[2])
6691 || ! rtx_equal_p (operands[1], operands[2]))"
6692 [(set (match_dup 3) (match_dup 1))
6693 (parallel [(set (reg:CCAN 33)
6694 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6696 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6697 (set (match_dup 2) (match_dup 3))
6698 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6703 (define_insn "doloop_di"
6706 (ne (match_operand:DI 1 "register_operand" "d,d")
6708 (label_ref (match_operand 0 "" ""))
6710 (set (match_operand:DI 2 "register_operand" "=1,?*m*r")
6711 (plus:DI (match_dup 1) (const_int -1)))
6712 (clobber (match_scratch:DI 3 "=X,&d"))
6713 (clobber (reg:CC 33))]
6716 if (which_alternative != 0)
6718 else if (get_attr_length (insn) == 4)
6719 return "brctg\t%1,%l0";
6721 return "aghi\t%1,-1\;jgne\t%l0";
6723 [(set_attr "op_type" "RI")
6724 (set_attr "type" "branch")
6725 (set (attr "length")
6726 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6727 (const_int 4) (const_int 10)))])
6731 (if_then_else (ne (match_operand:DI 1 "register_operand" "")
6733 (match_operand 0 "" "")
6735 (set (match_operand:DI 2 "nonimmediate_operand" "")
6736 (plus:DI (match_dup 1) (const_int -1)))
6737 (clobber (match_scratch:DI 3 ""))
6738 (clobber (reg:CC 33))]
6740 && (! REG_P (operands[2])
6741 || ! rtx_equal_p (operands[1], operands[2]))"
6742 [(set (match_dup 3) (match_dup 1))
6743 (parallel [(set (reg:CCAN 33)
6744 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6746 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6747 (set (match_dup 2) (match_dup 3))
6748 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6754 ;;- Unconditional jump instructions.
6758 ; jump instruction pattern(s).
6762 [(set (pc) (label_ref (match_operand 0 "" "")))]
6765 if (get_attr_length (insn) == 4)
6767 else if (TARGET_CPU_ZARCH)
6772 [(set_attr "op_type" "RI")
6773 (set_attr "type" "branch")
6774 (set (attr "length")
6775 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6777 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6779 (eq (symbol_ref "flag_pic") (const_int 0))
6780 (const_int 6)] (const_int 8)))])
6783 ; indirect-jump instruction pattern(s).
6786 (define_insn "indirect_jump"
6787 [(set (pc) (match_operand 0 "address_operand" "U"))]
6790 if (get_attr_op_type (insn) == OP_TYPE_RR)
6795 [(set (attr "op_type")
6796 (if_then_else (match_operand 0 "register_operand" "")
6797 (const_string "RR") (const_string "RX")))
6798 (set_attr "type" "branch")
6799 (set_attr "atype" "agen")])
6802 ; casesi instruction pattern(s).
6805 (define_insn "casesi_jump"
6806 [(set (pc) (match_operand 0 "address_operand" "U"))
6807 (use (label_ref (match_operand 1 "" "")))]
6810 if (get_attr_op_type (insn) == OP_TYPE_RR)
6815 [(set (attr "op_type")
6816 (if_then_else (match_operand 0 "register_operand" "")
6817 (const_string "RR") (const_string "RX")))
6818 (set_attr "type" "branch")
6819 (set_attr "atype" "agen")])
6821 (define_expand "casesi"
6822 [(match_operand:SI 0 "general_operand" "")
6823 (match_operand:SI 1 "general_operand" "")
6824 (match_operand:SI 2 "general_operand" "")
6825 (label_ref (match_operand 3 "" ""))
6826 (label_ref (match_operand 4 "" ""))]
6829 rtx index = gen_reg_rtx (SImode);
6830 rtx base = gen_reg_rtx (Pmode);
6831 rtx target = gen_reg_rtx (Pmode);
6833 emit_move_insn (index, operands[0]);
6834 emit_insn (gen_subsi3 (index, index, operands[1]));
6835 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6838 if (Pmode != SImode)
6839 index = convert_to_mode (Pmode, index, 1);
6840 if (GET_CODE (index) != REG)
6841 index = copy_to_mode_reg (Pmode, index);
6844 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6846 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
6848 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6850 index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
6851 emit_move_insn (target, index);
6854 target = gen_rtx_PLUS (Pmode, base, target);
6855 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6862 ;;- Jump to subroutine.
6867 ; untyped call instruction pattern(s).
6870 ;; Call subroutine returning any type.
6871 (define_expand "untyped_call"
6872 [(parallel [(call (match_operand 0 "" "")
6874 (match_operand 1 "" "")
6875 (match_operand 2 "" "")])]
6880 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6882 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6884 rtx set = XVECEXP (operands[2], 0, i);
6885 emit_move_insn (SET_DEST (set), SET_SRC (set));
6888 /* The optimizer does not know that the call sets the function value
6889 registers we stored in the result block. We avoid problems by
6890 claiming that all hard registers are used and clobbered at this
6892 emit_insn (gen_blockage ());
6897 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6898 ;; all of memory. This blocks insns from being moved across this point.
6900 (define_insn "blockage"
6901 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6904 [(set_attr "type" "none")
6905 (set_attr "length" "0")])
6910 ; call instruction pattern(s).
6913 (define_expand "call"
6914 [(call (match_operand 0 "" "")
6915 (match_operand 1 "" ""))
6916 (use (match_operand 2 "" ""))]
6919 bool plt_call = false;
6922 /* Direct function calls need special treatment. */
6923 if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
6925 rtx sym = XEXP (operands[0], 0);
6927 /* When calling a global routine in PIC mode, we must
6928 replace the symbol itself with the PLT stub. */
6929 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
6931 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
6932 sym = gen_rtx_CONST (Pmode, sym);
6936 /* Unless we can use the bras(l) insn, force the
6937 routine address into a register. */
6938 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
6941 sym = legitimize_pic_address (sym, 0);
6943 sym = force_reg (Pmode, sym);
6946 operands[0] = gen_rtx_MEM (QImode, sym);
6950 insn = emit_call_insn (gen_call_exp (operands[0], operands[1],
6951 gen_rtx_REG (Pmode, RETURN_REGNUM)));
6953 /* 31-bit PLT stubs use the GOT register implicitly. */
6954 if (!TARGET_64BIT && plt_call)
6955 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
6960 (define_expand "call_exp"
6961 [(parallel [(call (match_operand 0 "" "")
6962 (match_operand 1 "" ""))
6963 (clobber (match_operand 2 "" ""))])]
6967 (define_insn "*bras"
6968 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6969 (match_operand 1 "const_int_operand" "n"))
6970 (clobber (match_operand 2 "register_operand" "=r"))]
6971 "TARGET_SMALL_EXEC && GET_MODE (operands[2]) == Pmode"
6973 [(set_attr "op_type" "RI")
6974 (set_attr "type" "jsr")])
6976 (define_insn "*brasl"
6977 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6978 (match_operand 1 "const_int_operand" "n"))
6979 (clobber (match_operand 2 "register_operand" "=r"))]
6980 "TARGET_CPU_ZARCH && GET_MODE (operands[2]) == Pmode"
6982 [(set_attr "op_type" "RIL")
6983 (set_attr "type" "jsr")])
6985 (define_insn "*basr"
6986 [(call (mem:QI (match_operand 0 "address_operand" "U"))
6987 (match_operand 1 "const_int_operand" "n"))
6988 (clobber (match_operand 2 "register_operand" "=r"))]
6989 "GET_MODE (operands[2]) == Pmode"
6991 if (get_attr_op_type (insn) == OP_TYPE_RR)
6992 return "basr\t%2,%0";
6994 return "bas\t%2,%a0";
6996 [(set (attr "op_type")
6997 (if_then_else (match_operand 0 "register_operand" "")
6998 (const_string "RR") (const_string "RX")))
6999 (set_attr "type" "jsr")
7000 (set_attr "atype" "agen")])
7003 ; call_value instruction pattern(s).
7006 (define_expand "call_value"
7007 [(set (match_operand 0 "" "")
7008 (call (match_operand 1 "" "")
7009 (match_operand 2 "" "")))
7010 (use (match_operand 3 "" ""))]
7013 bool plt_call = false;
7016 /* Direct function calls need special treatment. */
7017 if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
7019 rtx sym = XEXP (operands[1], 0);
7021 /* When calling a global routine in PIC mode, we must
7022 replace the symbol itself with the PLT stub. */
7023 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
7025 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7026 sym = gen_rtx_CONST (Pmode, sym);
7030 /* Unless we can use the bras(l) insn, force the
7031 routine address into a register. */
7032 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7035 sym = legitimize_pic_address (sym, 0);
7037 sym = force_reg (Pmode, sym);
7040 operands[1] = gen_rtx_MEM (QImode, sym);
7044 insn = emit_call_insn (
7045 gen_call_value_exp (operands[0], operands[1], operands[2],
7046 gen_rtx_REG (Pmode, RETURN_REGNUM)));
7048 /* 31-bit PLT stubs use the GOT register implicitly. */
7049 if (!TARGET_64BIT && plt_call)
7050 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7055 (define_expand "call_value_exp"
7056 [(parallel [(set (match_operand 0 "" "")
7057 (call (match_operand 1 "" "")
7058 (match_operand 2 "" "")))
7059 (clobber (match_operand 3 "" ""))])]
7063 (define_insn "*bras_r"
7064 [(set (match_operand 0 "" "")
7065 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7066 (match_operand:SI 2 "const_int_operand" "n")))
7067 (clobber (match_operand 3 "register_operand" "=r"))]
7068 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7070 [(set_attr "op_type" "RI")
7071 (set_attr "type" "jsr")])
7073 (define_insn "*brasl_r"
7074 [(set (match_operand 0 "" "")
7075 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7076 (match_operand 2 "const_int_operand" "n")))
7077 (clobber (match_operand 3 "register_operand" "=r"))]
7078 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7080 [(set_attr "op_type" "RIL")
7081 (set_attr "type" "jsr")])
7083 (define_insn "*basr_r"
7084 [(set (match_operand 0 "" "")
7085 (call (mem:QI (match_operand 1 "address_operand" "U"))
7086 (match_operand 2 "const_int_operand" "n")))
7087 (clobber (match_operand 3 "register_operand" "=r"))]
7088 "GET_MODE (operands[3]) == Pmode"
7090 if (get_attr_op_type (insn) == OP_TYPE_RR)
7091 return "basr\t%3,%1";
7093 return "bas\t%3,%a1";
7095 [(set (attr "op_type")
7096 (if_then_else (match_operand 1 "register_operand" "")
7097 (const_string "RR") (const_string "RX")))
7098 (set_attr "type" "jsr")
7099 (set_attr "atype" "agen")])
7102 ;;- Thread-local storage support.
7105 (define_insn "get_tp_64"
7106 [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7107 (unspec:DI [(const_int 0)] UNSPEC_TP))]
7110 ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7112 [(set_attr "op_type" "NN,RS")
7113 (set_attr "atype" "reg,*")
7114 (set_attr "type" "o3,*")
7115 (set_attr "length" "14,*")])
7117 (define_insn "get_tp_31"
7118 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7119 (unspec:SI [(const_int 0)] UNSPEC_TP))]
7124 [(set_attr "op_type" "RRE,RS")])
7126 (define_insn "set_tp_64"
7127 [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7128 (clobber (match_scratch:SI 1 "=d,X"))]
7131 sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7133 [(set_attr "op_type" "NN,RS")
7134 (set_attr "atype" "reg,*")
7135 (set_attr "type" "o3,*")
7136 (set_attr "length" "14,*")])
7138 (define_insn "set_tp_31"
7139 [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7144 [(set_attr "op_type" "RRE,RS")])
7146 (define_insn "*tls_load_64"
7147 [(set (match_operand:DI 0 "register_operand" "=d")
7148 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7149 (match_operand:DI 2 "" "")]
7153 [(set_attr "op_type" "RXE")])
7155 (define_insn "*tls_load_31"
7156 [(set (match_operand:SI 0 "register_operand" "=d,d")
7157 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7158 (match_operand:SI 2 "" "")]
7164 [(set_attr "op_type" "RX,RXY")])
7166 (define_expand "call_value_tls"
7167 [(set (match_operand 0 "" "")
7168 (call (const_int 0) (const_int 0)))
7169 (use (match_operand 1 "" ""))]
7177 sym = s390_tls_get_offset ();
7178 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7179 sym = gen_rtx_CONST (Pmode, sym);
7181 /* Unless we can use the bras(l) insn, force the
7182 routine address into a register. */
7183 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7186 sym = legitimize_pic_address (sym, 0);
7188 sym = force_reg (Pmode, sym);
7191 sym = gen_rtx_MEM (QImode, sym);
7194 insn = emit_call_insn (
7195 gen_call_value_tls_exp (operands[0], sym, const0_rtx,
7196 gen_rtx_REG (Pmode, RETURN_REGNUM),
7199 /* The calling convention of __tls_get_offset uses the
7200 GOT register implicitly. */
7201 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7202 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), operands[0]);
7203 CONST_OR_PURE_CALL_P (insn) = 1;
7208 (define_expand "call_value_tls_exp"
7209 [(parallel [(set (match_operand 0 "" "")
7210 (call (match_operand 1 "" "")
7211 (match_operand 2 "" "")))
7212 (clobber (match_operand 3 "" ""))
7213 (use (match_operand 4 "" ""))])]
7217 (define_insn "*bras_tls"
7218 [(set (match_operand 0 "" "")
7219 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7220 (match_operand 2 "const_int_operand" "n")))
7221 (clobber (match_operand 3 "register_operand" "=r"))
7222 (use (match_operand 4 "" ""))]
7223 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7225 [(set_attr "op_type" "RI")
7226 (set_attr "type" "jsr")])
7228 (define_insn "*brasl_tls"
7229 [(set (match_operand 0 "" "")
7230 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7231 (match_operand 2 "const_int_operand" "n")))
7232 (clobber (match_operand 3 "register_operand" "=r"))
7233 (use (match_operand 4 "" ""))]
7234 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7236 [(set_attr "op_type" "RIL")
7237 (set_attr "type" "jsr")])
7239 (define_insn "*basr_tls"
7240 [(set (match_operand 0 "" "")
7241 (call (mem:QI (match_operand 1 "address_operand" "U"))
7242 (match_operand 2 "const_int_operand" "n")))
7243 (clobber (match_operand 3 "register_operand" "=r"))
7244 (use (match_operand 4 "" ""))]
7245 "GET_MODE (operands[3]) == Pmode"
7247 if (get_attr_op_type (insn) == OP_TYPE_RR)
7248 return "basr\t%3,%1%J4";
7250 return "bas\t%3,%a1%J4";
7252 [(set (attr "op_type")
7253 (if_then_else (match_operand 1 "register_operand" "")
7254 (const_string "RR") (const_string "RX")))
7255 (set_attr "type" "jsr")
7256 (set_attr "atype" "agen")])
7259 ;;- Miscellaneous instructions.
7263 ; allocate stack instruction pattern(s).
7266 (define_expand "allocate_stack"
7268 (plus (reg 15) (match_operand 1 "general_operand" "")))
7269 (set (match_operand 0 "general_operand" "")
7273 rtx stack = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
7274 rtx chain = gen_rtx_MEM (Pmode, stack);
7275 rtx temp = gen_reg_rtx (Pmode);
7277 emit_move_insn (temp, chain);
7280 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7282 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7284 emit_move_insn (chain, temp);
7286 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7292 ; setjmp instruction pattern.
7295 (define_expand "builtin_setjmp_receiver"
7296 [(match_operand 0 "" "")]
7299 s390_load_got (false);
7300 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7304 ;; These patterns say how to save and restore the stack pointer. We need not
7305 ;; save the stack pointer at function level since we are careful to
7306 ;; preserve the backchain. At block level, we have to restore the backchain
7307 ;; when we restore the stack pointer.
7309 ;; For nonlocal gotos, we must save both the stack pointer and its
7310 ;; backchain and restore both. Note that in the nonlocal case, the
7311 ;; save area is a memory location.
7313 (define_expand "save_stack_function"
7314 [(match_operand 0 "general_operand" "")
7315 (match_operand 1 "general_operand" "")]
7319 (define_expand "restore_stack_function"
7320 [(match_operand 0 "general_operand" "")
7321 (match_operand 1 "general_operand" "")]
7325 (define_expand "restore_stack_block"
7326 [(use (match_operand 0 "register_operand" ""))
7327 (set (match_dup 2) (match_dup 3))
7328 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7329 (set (match_dup 3) (match_dup 2))]
7332 operands[2] = gen_reg_rtx (Pmode);
7333 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7336 (define_expand "save_stack_nonlocal"
7337 [(match_operand 0 "memory_operand" "")
7338 (match_operand 1 "register_operand" "")]
7341 rtx temp = gen_reg_rtx (Pmode);
7343 /* Copy the backchain to the first word, sp to the second and the literal pool
7344 base to the third. */
7345 emit_move_insn (operand_subword (operands[0], 2, 0,
7346 TARGET_64BIT ? OImode : TImode),
7347 gen_rtx_REG (Pmode, BASE_REGISTER));
7348 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7349 emit_move_insn (operand_subword (operands[0], 0, 0,
7350 TARGET_64BIT ? OImode : TImode),
7352 emit_move_insn (operand_subword (operands[0], 1, 0,
7353 TARGET_64BIT ? OImode : TImode),
7358 (define_expand "restore_stack_nonlocal"
7359 [(match_operand 0 "register_operand" "")
7360 (match_operand 1 "memory_operand" "")]
7363 rtx temp = gen_reg_rtx (Pmode);
7364 rtx base = gen_rtx_REG (Pmode, BASE_REGISTER);
7366 /* Restore the backchain from the first word, sp from the second and the
7367 literal pool base from the third. */
7368 emit_move_insn (temp,
7369 operand_subword (operands[1], 0, 0,
7370 TARGET_64BIT ? OImode : TImode));
7371 emit_move_insn (operands[0],
7372 operand_subword (operands[1], 1, 0,
7373 TARGET_64BIT ? OImode : TImode));
7374 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7375 emit_move_insn (base,
7376 operand_subword (operands[1], 2, 0,
7377 TARGET_64BIT ? OImode : TImode));
7378 emit_insn (gen_rtx_USE (VOIDmode, base));
7385 ; nop instruction pattern(s).
7392 [(set_attr "op_type" "RR")])
7396 ; Special literal pool access instruction pattern(s).
7399 (define_insn "*pool_entry"
7400 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7401 UNSPECV_POOL_ENTRY)]
7404 enum machine_mode mode = GET_MODE (PATTERN (insn));
7405 unsigned int align = GET_MODE_BITSIZE (mode);
7406 s390_output_pool_entry (asm_out_file, operands[0], mode, align);
7409 [(set_attr "op_type" "NN")
7410 (set (attr "length")
7411 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7413 (define_insn "pool_start_31"
7414 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7417 [(set_attr "op_type" "NN")
7418 (set_attr "length" "2")])
7420 (define_insn "pool_end_31"
7421 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7424 [(set_attr "op_type" "NN")
7425 (set_attr "length" "2")])
7427 (define_insn "pool_start_64"
7428 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7430 ".section\t.rodata\;.align\t8"
7431 [(set_attr "op_type" "NN")
7432 (set_attr "length" "0")])
7434 (define_insn "pool_end_64"
7435 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7438 [(set_attr "op_type" "NN")
7439 (set_attr "length" "0")])
7441 (define_insn "main_base_31_small"
7442 [(set (match_operand 0 "register_operand" "=a")
7443 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7444 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7446 [(set_attr "op_type" "RR")
7447 (set_attr "type" "la")])
7449 (define_insn "main_base_31_large"
7450 [(set (match_operand 0 "register_operand" "=a")
7451 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7452 (set (pc) (label_ref (match_operand 2 "" "")))]
7453 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7455 [(set_attr "op_type" "RI")])
7457 (define_insn "main_base_64"
7458 [(set (match_operand 0 "register_operand" "=a")
7459 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7460 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7462 [(set_attr "op_type" "RIL")
7463 (set_attr "type" "larl")])
7465 (define_insn "main_pool"
7466 [(unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL)]
7469 [(set_attr "op_type" "NN")])
7471 (define_insn "reload_base_31"
7472 [(set (match_operand 0 "register_operand" "=a")
7473 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7474 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7475 "basr\t%0,0\;la\t%0,%1-.(%0)"
7476 [(set_attr "op_type" "NN")
7477 (set_attr "type" "la")
7478 (set_attr "length" "6")])
7480 (define_insn "reload_base_64"
7481 [(set (match_operand 0 "register_operand" "=a")
7482 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7483 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7485 [(set_attr "op_type" "RIL")
7486 (set_attr "type" "larl")])
7489 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7492 [(set_attr "op_type" "NN")
7493 (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7496 ;; Insns related to generating the function prologue and epilogue.
7500 (define_expand "prologue"
7501 [(use (const_int 0))]
7503 "s390_emit_prologue (); DONE;")
7505 (define_expand "epilogue"
7506 [(use (const_int 1))]
7508 "s390_emit_epilogue (); DONE;")
7510 (define_insn "*return"
7512 (use (match_operand 0 "register_operand" "a"))]
7513 "GET_MODE (operands[0]) == Pmode"
7515 [(set_attr "op_type" "RR")
7516 (set_attr "type" "jsr")
7517 (set_attr "atype" "agen")])
7520 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7521 ;; pointer. This is used for compatibility.
7523 (define_expand "ptr_extend"
7524 [(set (match_operand:DI 0 "register_operand" "=r")
7525 (match_operand:SI 1 "register_operand" "r"))]
7528 emit_insn (gen_anddi3 (operands[0],
7529 gen_lowpart (DImode, operands[1]),
7530 GEN_INT (0x7fffffff)));