1 ;;- Machine description for GNU compiler -- S/390 / zSeries version.
2 ;; Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3 ;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and
4 ;; Ulrich Weigand (uweigand@de.ibm.com).
5 ;; This file is part of GNU CC.
7 ;; GNU CC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; GNU CC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU CC; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
20 ;; Boston, MA 02111-1307, USA.
23 ;; Special constraints for s/390 machine description:
25 ;; a -- Any address register from 1 to 15.
26 ;; d -- Any register from 0 to 15.
27 ;; I -- An 8-bit constant (0..255).
28 ;; J -- A 12-bit constant (0..4095).
29 ;; K -- A 16-bit constant (-32768..32767).
30 ;; Q -- A memory reference without index-register.
31 ;; S -- Valid operand for the LARL instruction.
33 ;; Special formats used for outputting 390 instructions.
35 ;; %b -- Print a constant byte integer. xy
36 ;; %h -- Print a signed 16-bit. wxyz
37 ;; %N -- Print next register (second word of a DImode reg) or next word.
38 ;; %M -- Print next register (second word of a TImode reg) or next word.
39 ;; %O -- Print the offset of a memory reference (PLUS (REG) (CONST_INT)).
40 ;; %R -- Print the register of a memory reference (PLUS (REG) (CONST_INT)).
42 ;; We have a special constraint for pattern matching.
44 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
48 ;; Define an insn type attribute. This is used in function unit delay
51 (define_attr "type" "none,integer,load,lr,la,lm,stm,cs,vs,store,imul,lmul,fmul,idiv,ldiv,fdiv,branch,jsr,other,o2,o3"
52 (const_string "integer"))
54 ;; Insn are devide in two classes:
55 ;; mem: Insn accessing memory
56 ;; reg: Insn operands all in registers
58 (define_attr "atype" "reg,mem"
61 ;; Generic pipeline function unit.
63 (define_function_unit "integer" 1 0
64 (eq_attr "type" "none") 0 0)
66 (define_function_unit "integer" 1 0
67 (eq_attr "type" "integer") 1 1)
69 (define_function_unit "integer" 1 0
70 (eq_attr "type" "load") 1 1)
72 (define_function_unit "integer" 1 0
73 (eq_attr "type" "la") 1 1)
75 (define_function_unit "integer" 1 0
76 (eq_attr "type" "lr") 1 1)
78 (define_function_unit "integer" 1 0
79 (eq_attr "type" "store") 1 1)
81 (define_function_unit "integer" 1 0
82 (eq_attr "type" "lm") 2 2)
84 (define_function_unit "integer" 1 0
85 (eq_attr "type" "stm") 2 2)
87 (define_function_unit "integer" 1 0
88 (eq_attr "type" "cs") 5 5)
90 (define_function_unit "integer" 1 0
91 (eq_attr "type" "vs") 30 30)
93 (define_function_unit "integer" 1 0
94 (eq_attr "type" "jsr") 5 5)
96 (define_function_unit "integer" 1 0
97 (eq_attr "type" "imul") 7 7)
99 (define_function_unit "integer" 1 0
100 (eq_attr "type" "fmul") 6 6)
102 (define_function_unit "integer" 1 0
103 (eq_attr "type" "idiv") 33 33)
105 (define_function_unit "integer" 1 0
106 (eq_attr "type" "fdiv") 33 33)
108 (define_function_unit "integer" 1 0
109 (eq_attr "type" "o2") 2 2)
111 (define_function_unit "integer" 1 0
112 (eq_attr "type" "o3") 3 3)
114 (define_function_unit "integer" 1 0
115 (eq_attr "type" "other") 5 5)
117 ;; Operand type. Used to default length attribute values
119 (define_attr "op_type"
120 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE"
125 (define_attr "length" ""
126 (cond [ (eq_attr "op_type" "E") (const_int 2)
127 (eq_attr "op_type" "RR") (const_int 2)
128 (eq_attr "op_type" "RX") (const_int 4)
129 (eq_attr "op_type" "RI") (const_int 4)
130 (eq_attr "op_type" "RRE") (const_int 4)
131 (eq_attr "op_type" "RS") (const_int 4)
132 (eq_attr "op_type" "RSI") (const_int 4)
133 (eq_attr "op_type" "RX") (const_int 4)
134 (eq_attr "op_type" "S") (const_int 4)
135 (eq_attr "op_type" "SI") (const_int 4)
136 (eq_attr "op_type" "SS") (const_int 6)
137 (eq_attr "op_type" "SSE") (const_int 6)
138 (eq_attr "op_type" "RXE") (const_int 6)
139 (eq_attr "op_type" "RSE") (const_int 6)
140 (eq_attr "op_type" "RIL") (const_int 6)]
143 ;; Define attributes for `asm' insns.
145 (define_asm_attributes [(set_attr "type" "other")
146 (set_attr "op_type" "NN")])
152 ; CCL: Zero Nonzero Zero Nonzero (AL, ALR, SL, SLR, N, NC, NI, NR, O, OC, OI, OR, X, XC, XI, XR)
153 ; CCA: Zero <Zero >Zero Overflow (A, AR, AH, AHI, S, SR, SH, SHI, LTR, LCR, LNR, LPR, SLA, SLDA, SLA, SRDA)
154 ; CCU: Equal ULess UGreater -- (CL, CLR, CLI, CLM)
155 ; CCS: Equal SLess SGreater -- (C, CR, CH, CHI, ICM)
156 ; CCT: Zero Mixed Mixed Ones (TM, TMH, TML)
159 ; CCZ1 -> CCA/CCU/CCS/CCT
162 ; String: CLC, CLCL, CLCLE, CLST, CUSE, MVCL, MVCLE, MVPG, MVST, SRST
163 ; Clobber: CKSM, CFC, CS, CDS, CUUTF, CUTFU, PLO, SPM, STCK, STCKE, TS, TRT, TRE, UPT
167 ;;- Compare instructions.
170 (define_expand "cmpdi"
172 (compare:CC (match_operand:DI 0 "register_operand" "")
173 (match_operand:DI 1 "general_operand" "")))]
177 s390_compare_op0 = operands[0];
178 s390_compare_op1 = operands[1];
182 (define_expand "cmpsi"
184 (compare:CC (match_operand:SI 0 "register_operand" "")
185 (match_operand:SI 1 "general_operand" "")))]
189 s390_compare_op0 = operands[0];
190 s390_compare_op1 = operands[1];
194 (define_expand "cmpdf"
196 (compare:CC (match_operand:DF 0 "register_operand" "")
197 (match_operand:DF 1 "general_operand" "")))]
201 s390_compare_op0 = operands[0];
202 s390_compare_op1 = operands[1];
206 (define_expand "cmpsf"
208 (compare:CC (match_operand:SF 0 "register_operand" "")
209 (match_operand:SF 1 "general_operand" "")))]
213 s390_compare_op0 = operands[0];
214 s390_compare_op1 = operands[1];
219 ; Test-under-Mask (zero_extract) instructions
221 (define_insn "*tmdi_ext"
223 (compare (zero_extract:DI (match_operand:DI 0 "register_operand" "d")
224 (match_operand:DI 1 "const_int_operand" "n")
225 (match_operand:DI 2 "const_int_operand" "n"))
227 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
228 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
229 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 64
230 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
231 == INTVAL (operands[2]) >> 4"
234 int part = INTVAL (operands[2]) >> 4;
235 int block = (1 << INTVAL (operands[1])) - 1;
236 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
238 operands[2] = GEN_INT (block << shift);
242 case 0: return \"tmhh\\t%0,%x2\";
243 case 1: return \"tmhl\\t%0,%x2\";
244 case 2: return \"tmlh\\t%0,%x2\";
245 case 3: return \"tmll\\t%0,%x2\";
249 [(set_attr "op_type" "RI")])
251 (define_insn "*tmsi_ext"
253 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
254 (match_operand:SI 1 "const_int_operand" "n")
255 (match_operand:SI 2 "const_int_operand" "n"))
257 "s390_match_ccmode(insn, CCTmode)
258 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
259 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
260 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
261 == INTVAL (operands[2]) >> 4"
264 int part = INTVAL (operands[2]) >> 4;
265 int block = (1 << INTVAL (operands[1])) - 1;
266 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
268 operands[2] = GEN_INT (block << shift);
272 case 0: return \"tmh\\t%0,%x2\";
273 case 1: return \"tml\\t%0,%x2\";
277 [(set_attr "op_type" "RI")])
279 (define_insn "*tmqi_ext"
281 (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q")
282 (match_operand:SI 1 "const_int_operand" "n")
283 (match_operand:SI 2 "const_int_operand" "n"))
285 "s390_match_ccmode(insn, CCTmode)
286 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
287 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
290 int block = (1 << INTVAL (operands[1])) - 1;
291 int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
293 operands[2] = GEN_INT (block << shift);
294 return \"tm\\t%0,%b2\";
296 [(set_attr "op_type" "SI")
297 (set_attr "atype" "mem")])
299 ; Test-under-Mask instructions
301 (define_insn "*tmdi_mem"
303 (compare (and:DI (match_operand:DI 0 "memory_operand" "Q")
304 (match_operand:DI 1 "immediate_operand" "n"))
305 (match_operand:DI 2 "immediate_operand" "n")))]
307 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
308 && s390_single_qi (operands[1], DImode, 0) >= 0"
311 int part = s390_single_qi (operands[1], DImode, 0);
312 operands[1] = GEN_INT (s390_extract_qi (operands[1], DImode, part));
314 operands[0] = gen_rtx_MEM (QImode,
315 plus_constant (XEXP (operands[0], 0), part));
316 return \"tm\\t%0,%b1\";
318 [(set_attr "op_type" "SI")
319 (set_attr "atype" "mem")])
321 (define_insn "*tmsi_mem"
323 (compare (and:SI (match_operand:SI 0 "memory_operand" "Q")
324 (match_operand:SI 1 "immediate_operand" "n"))
325 (match_operand:SI 2 "immediate_operand" "n")))]
326 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
327 && s390_single_qi (operands[1], SImode, 0) >= 0"
330 int part = s390_single_qi (operands[1], SImode, 0);
331 operands[1] = GEN_INT (s390_extract_qi (operands[1], SImode, part));
333 operands[0] = gen_rtx_MEM (QImode,
334 plus_constant (XEXP (operands[0], 0), part));
335 return \"tm\\t%0,%b1\";
337 [(set_attr "op_type" "SI")
338 (set_attr "atype" "mem")])
340 (define_insn "*tmhi_mem"
342 (compare (and:SI (subreg:SI (match_operand:HI 0 "memory_operand" "Q") 0)
343 (match_operand:SI 1 "immediate_operand" "n"))
344 (match_operand:SI 2 "immediate_operand" "n")))]
345 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
346 && s390_single_qi (operands[1], HImode, 0) >= 0"
349 int part = s390_single_qi (operands[1], HImode, 0);
350 operands[1] = GEN_INT (s390_extract_qi (operands[1], HImode, part));
352 operands[0] = gen_rtx_MEM (QImode,
353 plus_constant (XEXP (operands[0], 0), part));
354 return \"tm\\t%0,%b1\";
356 [(set_attr "op_type" "SI")
357 (set_attr "atype" "mem")])
359 (define_insn "*tmqi_mem"
361 (compare (and:SI (subreg:SI (match_operand:QI 0 "memory_operand" "Q") 0)
362 (match_operand:SI 1 "immediate_operand" "n"))
363 (match_operand:SI 2 "immediate_operand" "n")))]
364 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))"
366 [(set_attr "op_type" "SI")
367 (set_attr "atype" "mem")])
369 (define_insn "*tmdi_reg"
371 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d")
372 (match_operand:DI 1 "immediate_operand" "n"))
373 (match_operand:DI 2 "immediate_operand" "n")))]
375 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
376 && s390_single_hi (operands[1], DImode, 0) >= 0"
379 int part = s390_single_hi (operands[1], DImode, 0);
380 operands[1] = GEN_INT (s390_extract_hi (operands[1], DImode, part));
384 case 0: return \"tmhh\\t%0,%x1\";
385 case 1: return \"tmhl\\t%0,%x1\";
386 case 2: return \"tmlh\\t%0,%x1\";
387 case 3: return \"tmll\\t%0,%x1\";
391 [(set_attr "op_type" "RI")])
393 (define_insn "*tmsi_reg"
395 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d")
396 (match_operand:SI 1 "immediate_operand" "n"))
397 (match_operand:SI 2 "immediate_operand" "n")))]
398 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
399 && s390_single_hi (operands[1], SImode, 0) >= 0"
402 int part = s390_single_hi (operands[1], SImode, 0);
403 operands[1] = GEN_INT (s390_extract_hi (operands[1], SImode, part));
407 case 0: return \"tmh\\t%0,%x1\";
408 case 1: return \"tml\\t%0,%x1\";
412 [(set_attr "op_type" "RI")])
414 (define_insn "*tmhi_full"
416 (compare (match_operand:HI 0 "register_operand" "d")
417 (match_operand:HI 1 "immediate_operand" "n")))]
418 "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
420 [(set_attr "op_type" "RX")])
422 (define_insn "*tmqi_full"
424 (compare (match_operand:QI 0 "register_operand" "d")
425 (match_operand:QI 1 "immediate_operand" "n")))]
426 "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
428 [(set_attr "op_type" "RI")])
431 ; Load-and-Test instructions
433 (define_insn "*tstdi_sign"
435 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
436 (const_int 32)) (const_int 32))
437 (match_operand:DI 1 "const0_operand" "")))
438 (set (match_operand:DI 2 "register_operand" "=d")
439 (sign_extend:DI (match_dup 0)))]
440 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
442 [(set_attr "op_type" "RRE")])
444 (define_insn "*tstdi"
446 (compare (match_operand:DI 0 "register_operand" "d")
447 (match_operand:DI 1 "const0_operand" "")))
448 (set (match_operand:DI 2 "register_operand" "=d")
450 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
452 [(set_attr "op_type" "RRE")])
454 (define_insn "*tstdi_cconly"
456 (compare (match_operand:DI 0 "register_operand" "d")
457 (match_operand:DI 1 "const0_operand" "")))]
458 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
460 [(set_attr "op_type" "RRE")])
462 (define_insn "*tstdi_cconly_31"
464 (compare (match_operand:DI 0 "register_operand" "d")
465 (match_operand:DI 1 "const0_operand" "")))]
466 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
468 [(set_attr "op_type" "RS")])
470 (define_insn "*tstsi"
472 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q")
473 (match_operand:SI 1 "const0_operand" "")))
474 (set (match_operand:SI 2 "register_operand" "=d,d")
476 "s390_match_ccmode(insn, CCSmode)"
480 [(set_attr "op_type" "RR,RS")
481 (set_attr "atype" "reg,mem")])
483 (define_insn "*tstsi_cconly"
485 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q")
486 (match_operand:SI 1 "const0_operand" "")))
487 (clobber (match_scratch:SI 2 "=X,d"))]
488 "s390_match_ccmode(insn, CCSmode)"
492 [(set_attr "op_type" "RR,RS")
493 (set_attr "atype" "reg,mem")])
495 (define_insn "*tstsi_cconly2"
497 (compare (match_operand:SI 0 "register_operand" "d")
498 (match_operand:SI 1 "const0_operand" "")))]
499 "s390_match_ccmode(insn, CCSmode)"
501 [(set_attr "op_type" "RR")])
503 (define_insn "*tsthi"
505 (compare (match_operand:HI 0 "s_operand" "Q")
506 (match_operand:HI 1 "const0_operand" "")))
507 (set (match_operand:HI 2 "register_operand" "=d")
509 "s390_match_ccmode(insn, CCSmode)"
511 [(set_attr "op_type" "RS")
512 (set_attr "atype" "mem")])
514 (define_insn "*tsthi_cconly"
516 (compare (match_operand:HI 0 "s_operand" "Q")
517 (match_operand:HI 1 "const0_operand" "")))
518 (clobber (match_scratch:HI 2 "=d"))]
519 "s390_match_ccmode(insn, CCSmode)"
521 [(set_attr "op_type" "RS")
522 (set_attr "atype" "mem")])
524 (define_insn "*tstqi"
526 (compare (match_operand:QI 0 "s_operand" "Q")
527 (match_operand:QI 1 "const0_operand" "")))
528 (set (match_operand:QI 2 "register_operand" "=d")
530 "s390_match_ccmode(insn, CCSmode)"
532 [(set_attr "op_type" "RS")
533 (set_attr "atype" "mem")])
535 (define_insn "*tstqi_cconly"
537 (compare (match_operand:QI 0 "s_operand" "Q")
538 (match_operand:QI 1 "const0_operand" "")))
539 (clobber (match_scratch:QI 2 "=d"))]
540 "s390_match_ccmode(insn, CCSmode)"
542 [(set_attr "op_type" "RS")
543 (set_attr "atype" "mem")])
546 ; Compare (signed) instructions
548 (define_insn "*cmpdi_ccs_sign"
550 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
551 (match_operand:DI 0 "register_operand" "d,d")))]
552 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
556 [(set_attr "op_type" "RRE,RXE")
557 (set_attr "atype" "reg,mem")])
559 (define_insn "*cmpdi_ccs"
561 (compare (match_operand:DI 0 "register_operand" "d,d,d")
562 (match_operand:DI 1 "general_operand" "d,K,m")))]
563 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
568 [(set_attr "op_type" "RRE,RI,RXE")
569 (set_attr "atype" "reg,reg,mem")])
571 (define_insn "*cmpsi_ccs_sign"
573 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "m"))
574 (match_operand:SI 0 "register_operand" "d")))]
575 "s390_match_ccmode(insn, CCSRmode)"
577 [(set_attr "op_type" "RX")
578 (set_attr "atype" "mem")])
580 (define_insn "*cmpsi_ccs"
582 (compare (match_operand:SI 0 "register_operand" "d,d,d")
583 (match_operand:SI 1 "general_operand" "d,K,m")))]
584 "s390_match_ccmode(insn, CCSmode)"
589 [(set_attr "op_type" "RR,RI,RX")
590 (set_attr "atype" "reg,reg,mem")])
593 ; Compare (unsigned) instructions
595 (define_insn "*cmpdi_ccu_zero"
597 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
598 (match_operand:DI 0 "register_operand" "d,d")))]
599 "s390_match_ccmode(insn, CCURmode) && TARGET_64BIT"
603 [(set_attr "op_type" "RRE,RXE")
604 (set_attr "atype" "reg,mem")])
606 (define_insn "*cmpdi_ccu"
608 (compare (match_operand:DI 0 "register_operand" "d,d")
609 (match_operand:DI 1 "general_operand" "d,m")))]
610 "s390_match_ccmode(insn, CCUmode) && TARGET_64BIT"
614 [(set_attr "op_type" "RRE,RXE")
615 (set_attr "atype" "reg,mem")])
617 (define_insn "*cmpsi_ccu"
619 (compare (match_operand:SI 0 "register_operand" "d,d")
620 (match_operand:SI 1 "general_operand" "d,m")))]
621 "s390_match_ccmode(insn, CCUmode)"
625 [(set_attr "op_type" "RR,RX")
626 (set_attr "atype" "reg,mem")])
628 (define_insn "*cmphi_ccu"
630 (compare (match_operand:HI 0 "register_operand" "d")
631 (match_operand:HI 1 "s_imm_operand" "Q")))]
632 "s390_match_ccmode(insn, CCUmode)"
634 [(set_attr "op_type" "RS")
635 (set_attr "atype" "mem")])
637 (define_insn "*cmpqi_ccu"
639 (compare (match_operand:QI 0 "register_operand" "d")
640 (match_operand:QI 1 "s_imm_operand" "Q")))]
641 "s390_match_ccmode(insn, CCUmode)"
643 [(set_attr "op_type" "RS")
644 (set_attr "atype" "mem")])
648 (compare (match_operand:QI 0 "memory_operand" "Q")
649 (match_operand:QI 1 "immediate_operand" "n")))]
650 "s390_match_ccmode (insn, CCUmode)"
652 [(set_attr "op_type" "SI")
653 (set_attr "atype" "mem")])
655 (define_insn "*cmpdi_ccu_mem"
657 (compare (match_operand:DI 0 "s_operand" "Q")
658 (match_operand:DI 1 "s_imm_operand" "Q")))]
659 "s390_match_ccmode(insn, CCUmode)"
660 "clc\\t%O0(8,%R0),%1"
661 [(set_attr "op_type" "SS")
662 (set_attr "atype" "mem")])
664 (define_insn "*cmpsi_ccu_mem"
666 (compare (match_operand:SI 0 "s_operand" "Q")
667 (match_operand:SI 1 "s_imm_operand" "Q")))]
668 "s390_match_ccmode(insn, CCUmode)"
669 "clc\\t%O0(4,%R0),%1"
670 [(set_attr "op_type" "SS")
671 (set_attr "atype" "mem")])
673 (define_insn "*cmphi_ccu_mem"
675 (compare (match_operand:HI 0 "s_operand" "Q")
676 (match_operand:HI 1 "s_imm_operand" "Q")))]
677 "s390_match_ccmode(insn, CCUmode)"
678 "clc\\t%O0(2,%R0),%1"
679 [(set_attr "op_type" "SS")
680 (set_attr "atype" "mem")])
682 (define_insn "*cmpqi_ccu_mem"
684 (compare (match_operand:QI 0 "s_operand" "Q")
685 (match_operand:QI 1 "s_imm_operand" "Q")))]
686 "s390_match_ccmode(insn, CCUmode)"
687 "clc\\t%O0(1,%R0),%1"
688 [(set_attr "op_type" "SS")
689 (set_attr "atype" "mem")])
694 (define_insn "*cmpdf_ccs_0"
696 (compare (match_operand:DF 0 "register_operand" "f")
697 (match_operand:DF 1 "const0_operand" "")))]
698 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
700 [(set_attr "op_type" "RRE")])
702 (define_insn "*cmpdf_ccs_0_ibm"
704 (compare (match_operand:DF 0 "register_operand" "f")
705 (match_operand:DF 1 "const0_operand" "")))]
706 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
708 [(set_attr "op_type" "RR")])
710 (define_insn "*cmpdf_ccs"
712 (compare (match_operand:DF 0 "register_operand" "f,f")
713 (match_operand:DF 1 "general_operand" "f,m")))]
714 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
718 [(set_attr "op_type" "RRE,RXE")
719 (set_attr "atype" "reg,mem")])
721 (define_insn "*cmpdf_ccs_ibm"
723 (compare (match_operand:DF 0 "register_operand" "f,f")
724 (match_operand:DF 1 "general_operand" "f,m")))]
725 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
729 [(set_attr "op_type" "RR,RX")
730 (set_attr "atype" "reg,mem")])
735 (define_insn "*cmpsf_ccs_0"
737 (compare (match_operand:SF 0 "register_operand" "f")
738 (match_operand:SF 1 "const0_operand" "")))]
739 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
741 [(set_attr "op_type" "RRE")])
743 (define_insn "*cmpsf_ccs_0_ibm"
745 (compare (match_operand:SF 0 "register_operand" "f")
746 (match_operand:SF 1 "const0_operand" "")))]
747 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
749 [(set_attr "op_type" "RR")])
751 (define_insn "*cmpsf_ccs"
753 (compare (match_operand:SF 0 "register_operand" "f,f")
754 (match_operand:SF 1 "general_operand" "f,m")))]
755 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
759 [(set_attr "op_type" "RRE,RXE")
760 (set_attr "atype" "reg,mem")])
762 (define_insn "*cmpsf_ccs"
764 (compare (match_operand:SF 0 "register_operand" "f,f")
765 (match_operand:SF 1 "general_operand" "f,m")))]
766 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
770 [(set_attr "op_type" "RR,RX")
771 (set_attr "atype" "reg,mem")])
775 ;;- Move instructions.
779 ; movti instruction pattern(s).
783 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,Q,d,m,Q")
784 (match_operand:TI 1 "general_operand" "Q,d,dKm,d,Q"))]
791 mvc\\t%O0(16,%R0),%1"
792 [(set_attr "op_type" "RSE,RSE,NN,NN,SS")
793 (set_attr "atype" "mem")])
796 [(set (match_operand:TI 0 "nonimmediate_operand" "")
797 (match_operand:TI 1 "general_operand" ""))]
798 "TARGET_64BIT && reload_completed
799 && !s_operand (operands[0], VOIDmode)
800 && !s_operand (operands[1], VOIDmode)
801 && (register_operand (operands[0], VOIDmode)
802 || register_operand (operands[1], VOIDmode))
803 && (!register_operand (operands[0], VOIDmode)
804 || !reg_overlap_mentioned_p (operand_subword (operands[0], 0, 0, TImode),
806 || !reg_overlap_mentioned_p (operand_subword (operands[0], 1, 0, TImode),
808 [(set (match_dup 2) (match_dup 4))
809 (set (match_dup 3) (match_dup 5))]
812 if (!register_operand (operands[0], VOIDmode)
813 || !reg_overlap_mentioned_p (operand_subword (operands[0], 0, 0, TImode),
816 operands[2] = operand_subword (operands[0], 0, 0, TImode);
817 operands[3] = operand_subword (operands[0], 1, 0, TImode);
818 operands[4] = operand_subword (operands[1], 0, 0, TImode);
819 operands[5] = operand_subword (operands[1], 1, 0, TImode);
823 operands[2] = operand_subword (operands[0], 1, 0, TImode);
824 operands[3] = operand_subword (operands[0], 0, 0, TImode);
825 operands[4] = operand_subword (operands[1], 1, 0, TImode);
826 operands[5] = operand_subword (operands[1], 0, 0, TImode);
831 [(set (match_operand:TI 0 "register_operand" "")
832 (match_operand:TI 1 "memory_operand" ""))]
833 "TARGET_64BIT && reload_completed
834 && !s_operand (operands[1], VOIDmode)"
835 [(set (match_dup 2) (match_dup 3))
836 (set (match_dup 0) (mem:TI (match_dup 2)))]
837 "operands[2] = operand_subword (operands[0], 1, 0, TImode);
838 operands[3] = legitimize_la_operand (XEXP (operands[1], 0));")
841 ; movdi instruction pattern(s).
844 ;; If generating PIC code and operands[1] is a symbolic CONST, emit a
845 ;; move to get the address of the symbolic object from the GOT.
847 (define_expand "movdi"
848 [(set (match_operand:DI 0 "general_operand" "")
849 (match_operand:DI 1 "general_operand" ""))]
853 /* Handle PIC symbolic constants. */
854 if (TARGET_64BIT && flag_pic && SYMBOLIC_CONST (operands[1]))
855 emit_pic_move (operands, DImode);
857 /* During and after reload, we need to force constants
858 to the literal pool ourselves, if necessary. */
859 if ((reload_in_progress || reload_completed)
860 && CONSTANT_P (operands[1])
861 && (!legitimate_reload_constant_p (operands[1])
862 || fp_operand (operands[0], VOIDmode)))
863 operands[1] = force_const_mem (DImode, operands[1]);
866 (define_insn "*movdi_lhi"
867 [(set (match_operand:DI 0 "register_operand" "=d")
868 (match_operand:DI 1 "immediate_operand" "K"))]
870 && GET_CODE (operands[1]) == CONST_INT
871 && CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K')
872 && !fp_operand (operands[0], VOIDmode)"
874 [(set_attr "op_type" "RI")
875 (set_attr "atype" "reg")])
877 (define_insn "*movdi_lli"
878 [(set (match_operand:DI 0 "register_operand" "=d")
879 (match_operand:DI 1 "immediate_operand" "n"))]
880 "TARGET_64BIT && s390_single_hi (operands[1], DImode, 0) >= 0
881 && !fp_operand (operands[0], VOIDmode)"
884 int part = s390_single_hi (operands[1], DImode, 0);
885 operands[1] = GEN_INT (s390_extract_hi (operands[1], DImode, part));
889 case 0: return \"llihh\\t%0,%x1\";
890 case 1: return \"llihl\\t%0,%x1\";
891 case 2: return \"llilh\\t%0,%x1\";
892 case 3: return \"llill\\t%0,%x1\";
896 [(set_attr "op_type" "RI")
897 (set_attr "atype" "reg")])
899 (define_insn "*movdi_larl"
900 [(set (match_operand:DI 0 "register_operand" "=d")
901 (match_operand:DI 1 "larl_operand" "X"))]
903 && !fp_operand (operands[0], VOIDmode)"
905 [(set_attr "op_type" "RIL")
906 (set_attr "atype" "reg")
907 (set_attr "type" "la")])
909 (define_insn "*movdi_64"
910 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,m,!*f,!*f,!m,Q")
911 (match_operand:DI 1 "general_operand" "d,m,d,*f,m,*f,Q"))]
921 [(set_attr "op_type" "RR,RXE,RXE,RR,RX,RX,SS")
922 (set_attr "atype" "reg,mem,mem,reg,mem,mem,mem")])
924 (define_insn "*movdi_31"
925 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,m,!*f,!*f,!m,Q")
926 (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,m,*f,Q"))]
937 [(set_attr "op_type" "RS,RS,NN,NN,RR,RX,RX,SS")
938 (set_attr "atype" "mem,mem,*,*,reg,mem,mem,mem")])
941 [(set (match_operand:DI 0 "nonimmediate_operand" "")
942 (match_operand:DI 1 "general_operand" ""))]
943 "!TARGET_64BIT && reload_completed
944 && !fp_operand (operands[0], VOIDmode)
945 && !fp_operand (operands[1], VOIDmode)
946 && !s_operand (operands[0], VOIDmode)
947 && !s_operand (operands[1], VOIDmode)
948 && (register_operand (operands[0], VOIDmode)
949 || register_operand (operands[1], VOIDmode))
950 && (!register_operand (operands[0], VOIDmode)
951 || !reg_overlap_mentioned_p (operand_subword (operands[0], 0, 0, DImode),
953 || !reg_overlap_mentioned_p (operand_subword (operands[0], 1, 0, DImode),
955 [(set (match_dup 2) (match_dup 4))
956 (set (match_dup 3) (match_dup 5))]
959 if (!register_operand (operands[0], VOIDmode)
960 || !reg_overlap_mentioned_p (operand_subword (operands[0], 0, 0, DImode),
963 operands[2] = operand_subword (operands[0], 0, 0, DImode);
964 operands[3] = operand_subword (operands[0], 1, 0, DImode);
965 operands[4] = operand_subword (operands[1], 0, 0, DImode);
966 operands[5] = operand_subword (operands[1], 1, 0, DImode);
970 operands[2] = operand_subword (operands[0], 1, 0, DImode);
971 operands[3] = operand_subword (operands[0], 0, 0, DImode);
972 operands[4] = operand_subword (operands[1], 1, 0, DImode);
973 operands[5] = operand_subword (operands[1], 0, 0, DImode);
978 [(set (match_operand:DI 0 "register_operand" "")
979 (match_operand:DI 1 "memory_operand" ""))]
980 "!TARGET_64BIT && reload_completed
981 && !fp_operand (operands[0], VOIDmode)
982 && !fp_operand (operands[1], VOIDmode)
983 && !s_operand (operands[1], VOIDmode)"
984 [(set (match_dup 2) (match_dup 3))
985 (set (match_dup 0) (mem:DI (match_dup 2)))]
986 "operands[2] = operand_subword (operands[0], 1, 0, DImode);
987 operands[3] = legitimize_la_operand (XEXP (operands[1], 0));")
990 ; movsi instruction pattern(s).
993 ;; If generating PIC code and operands[1] is a symbolic CONST, emit a
994 ;; move to get the address of the symbolic object from the GOT.
996 (define_expand "movsi"
997 [(set (match_operand:SI 0 "general_operand" "")
998 (match_operand:SI 1 "general_operand" ""))]
1002 /* Handle PIC symbolic constants. */
1003 if (!TARGET_64BIT && flag_pic && SYMBOLIC_CONST (operands[1]))
1004 emit_pic_move (operands, SImode);
1006 /* expr.c tries to load an effective address using
1007 force_reg. This fails because we don't have a
1008 generic load_address pattern. Convert the move
1009 to a proper arithmetic operation instead, unless
1010 it is guaranteed to be OK. */
1011 if (GET_CODE (operands[1]) == PLUS
1012 && !legitimate_la_operand_p (operands[1]))
1014 operands[1] = force_operand (operands[1], operands[0]);
1015 if (operands[1] == operands[0])
1019 /* During and after reload, we need to force constants
1020 to the literal pool ourselves, if necessary. */
1021 if ((reload_in_progress || reload_completed)
1022 && CONSTANT_P (operands[1])
1023 && (!legitimate_reload_constant_p (operands[1])
1024 || fp_operand (operands[0], VOIDmode)))
1025 operands[1] = force_const_mem (SImode, operands[1]);
1028 (define_insn "*movsi_lhi"
1029 [(set (match_operand:SI 0 "register_operand" "=d")
1030 (match_operand:SI 1 "immediate_operand" "K"))]
1031 "GET_CODE (operands[1]) == CONST_INT
1032 && CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K')
1033 && !fp_operand (operands[0], VOIDmode)"
1035 [(set_attr "op_type" "RI")])
1037 (define_insn "*movsi_lli"
1038 [(set (match_operand:SI 0 "register_operand" "=d")
1039 (match_operand:SI 1 "immediate_operand" "n"))]
1040 "TARGET_64BIT && s390_single_hi (operands[1], SImode, 0) >= 0
1041 && !fp_operand (operands[0], VOIDmode)"
1044 int part = s390_single_hi (operands[1], SImode, 0);
1045 operands[1] = GEN_INT (s390_extract_hi (operands[1], SImode, part));
1049 case 0: return \"llilh\\t%0,%x1\";
1050 case 1: return \"llill\\t%0,%x1\";
1054 [(set_attr "op_type" "RI")])
1056 (define_insn "*movsi"
1057 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,m,!*f,!*f,!m,Q")
1058 (match_operand:SI 1 "general_operand" "d,m,d,*f,m,*f,Q"))]
1067 mvc\\t%O0(4,%R0),%1"
1068 [(set_attr "op_type" "RR,RX,RX,RR,RX,RX,SS")
1069 (set_attr "atype" "reg,mem,mem,reg,mem,mem,mem")])
1073 ; movhi instruction pattern(s).
1076 (define_insn "movhi"
1077 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,m,Q")
1078 (match_operand:HI 1 "general_operand" "d,n,m,d,Q"))]
1085 mvc\\t%O0(2,%R0),%1"
1086 [(set_attr "op_type" "RR,RI,RX,RX,SS")
1087 (set_attr "atype" "reg,reg,mem,mem,mem")])
1091 ; movqi instruction pattern(s).
1094 (define_insn "movqi_64"
1095 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,m,Q,Q")
1096 (match_operand:QI 1 "general_operand" "d,n,m,d,n,Q"))]
1104 mvc\\t%O0(1,%R0),%1"
1105 [(set_attr "op_type" "RR,RI,RXE,RX,SI,SS")
1106 (set_attr "atype" "reg,reg,mem,mem,mem,mem")])
1109 (define_insn "movqi"
1110 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,m,Q,Q")
1111 (match_operand:QI 1 "general_operand" "d,n,m,d,n,Q"))]
1119 mvc\\t%O0(1,%R0),%1"
1120 [(set_attr "op_type" "RR,RI,RX,RX,SI,SS")
1121 (set_attr "atype" "reg,reg,mem,mem,mem,mem")])
1125 ; movstrictqi instruction pattern(s).
1128 (define_insn "*movstrictqi"
1129 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
1130 (match_operand:QI 1 "memory_operand" "m"))]
1133 [(set_attr "op_type" "RX")
1134 (set_attr "atype" "mem")])
1137 ; movstricthi instruction pattern(s).
1140 (define_insn "*movstricthi"
1141 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
1142 (match_operand:HI 1 "s_imm_operand" "Q"))
1143 (clobber (reg:CC 33))]
1146 [(set_attr "op_type" "RS")
1147 (set_attr "atype" "mem")])
1151 ; movstrictsi instruction pattern(s).
1154 (define_insn "movstrictsi"
1155 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d"))
1156 (match_operand:SI 1 "general_operand" "d,m"))]
1161 [(set_attr "op_type" "RR,RS")
1162 (set_attr "atype" "reg,mem")])
1166 ; movdf instruction pattern(s).
1169 (define_expand "movdf"
1170 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1171 (match_operand:DF 1 "general_operand" ""))]
1175 /* During and after reload, we need to force constants
1176 to the literal pool ourselves, if necessary. */
1177 if ((reload_in_progress || reload_completed)
1178 && CONSTANT_P (operands[1]))
1179 operands[1] = force_const_mem (DFmode, operands[1]);
1182 (define_insn "*movdf_64"
1183 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,m,d,d,m,Q")
1184 (match_operand:DF 1 "general_operand" "f,m,f,d,m,d,Q"))]
1193 mvc\\t%O0(8,%R0),%1"
1194 [(set_attr "op_type" "RR,RX,RX,RR,RXE,RXE,SS")
1195 (set_attr "atype" "reg,mem,mem,reg,mem,mem,mem")])
1197 (define_insn "*movdf_31"
1198 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,m,d,Q,d,m,Q")
1199 (match_operand:DF 1 "general_operand" "f,m,f,Q,d,dKm,d,Q"))]
1209 mvc\\t%O0(8,%R0),%1"
1210 [(set_attr "op_type" "RR,RX,RX,RS,RS,NN,NN,SS")
1211 (set_attr "atype" "reg,mem,mem,mem,mem,*,*,mem")])
1214 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1215 (match_operand:DF 1 "general_operand" ""))]
1216 "!TARGET_64BIT && reload_completed
1217 && !fp_operand (operands[0], VOIDmode)
1218 && !fp_operand (operands[1], VOIDmode)
1219 && !s_operand (operands[0], VOIDmode)
1220 && !s_operand (operands[1], VOIDmode)
1221 && (register_operand (operands[0], VOIDmode)
1222 || register_operand (operands[1], VOIDmode))
1223 && (!register_operand (operands[0], VOIDmode)
1224 || !reg_overlap_mentioned_p (operand_subword (operands[0], 0, 0, DFmode),
1226 || !reg_overlap_mentioned_p (operand_subword (operands[0], 1, 0, DFmode),
1228 [(set (match_dup 2) (match_dup 4))
1229 (set (match_dup 3) (match_dup 5))]
1232 if (!register_operand (operands[0], VOIDmode)
1233 || !reg_overlap_mentioned_p (operand_subword (operands[0], 0, 0, DFmode),
1236 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1237 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1238 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1239 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1243 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1244 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1245 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1246 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1251 [(set (match_operand:DF 0 "register_operand" "")
1252 (match_operand:DF 1 "memory_operand" ""))]
1253 "!TARGET_64BIT && reload_completed
1254 && !fp_operand (operands[0], VOIDmode)
1255 && !fp_operand (operands[1], VOIDmode)
1256 && !s_operand (operands[1], VOIDmode)"
1257 [(set (match_dup 2) (match_dup 3))
1258 (set (match_dup 0) (mem:DI (match_dup 2)))]
1259 "operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1260 operands[3] = legitimize_la_operand (XEXP (operands[1], 0));")
1263 ; movsf instruction pattern(s).
1266 (define_expand "movsf"
1267 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1268 (match_operand:SF 1 "general_operand" ""))]
1272 /* During and after reload, we need to force constants
1273 to the literal pool ourselves, if necessary. */
1274 if ((reload_in_progress || reload_completed)
1275 && CONSTANT_P (operands[1]))
1276 operands[1] = force_const_mem (SFmode, operands[1]);
1279 (define_insn "*movsf"
1280 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,m,d,d,m,Q")
1281 (match_operand:SF 1 "general_operand" "f,m,f,d,m,d,Q"))]
1290 mvc\\t%O0(4,%R0),%1"
1291 [(set_attr "op_type" "RR,RX,RX,RR,RX,RX,SS")
1292 (set_attr "atype" "reg,mem,mem,reg,mem,mem,mem")])
1295 ; load_multiple pattern(s).
1298 (define_expand "load_multiple"
1299 [(match_par_dup 3 [(set (match_operand 0 "" "")
1300 (match_operand 1 "" ""))
1301 (use (match_operand 2 "" ""))])]
1310 /* Support only loading a constant number of fixed-point registers from
1311 memory and only bother with this if more than two */
1312 if (GET_CODE (operands[2]) != CONST_INT
1313 || INTVAL (operands[2]) < 2
1314 || INTVAL (operands[2]) > 16
1315 || GET_CODE (operands[1]) != MEM
1316 || GET_CODE (operands[0]) != REG
1317 || REGNO (operands[0]) >= 16)
1320 count = INTVAL (operands[2]);
1321 regno = REGNO (operands[0]);
1323 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1326 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1328 from = XEXP (operands[1], 0);
1331 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1332 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1333 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1335 from = XEXP (XEXP (operands[1], 0), 0);
1336 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1341 if (from == frame_pointer_rtx || from == arg_pointer_rtx)
1346 from = force_reg (Pmode, XEXP (operands[1], 0));
1350 for (i = 0; i < count; i++)
1351 XVECEXP (operands[3], 0, i)
1352 = gen_rtx_SET (VOIDmode, gen_rtx_REG (Pmode, regno + i),
1353 change_address (operands[1], Pmode,
1354 plus_constant (from,
1355 off + i * UNITS_PER_WORD)));
1358 (define_insn "*load_multiple_di"
1359 [(match_parallel 0 "load_multiple_operation"
1360 [(set (match_operand:DI 1 "register_operand" "=r")
1361 (match_operand:DI 2 "s_operand" "Q"))])]
1365 int words = XVECLEN (operands[0], 0);
1367 if (XVECLEN (operands[0], 0) == 1)
1368 return \"lg\\t%1,0(%2)\";
1370 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1371 return \"lmg\\t%1,%0,%2\";
1373 [(set_attr "op_type" "RXE")
1374 (set_attr "atype" "mem")
1375 (set_attr "type" "lm")])
1377 (define_insn "*load_multiple_si"
1378 [(match_parallel 0 "load_multiple_operation"
1379 [(set (match_operand:SI 1 "register_operand" "=r")
1380 (match_operand:SI 2 "s_operand" "Q"))])]
1384 int words = XVECLEN (operands[0], 0);
1386 if (XVECLEN (operands[0], 0) == 1)
1387 return \"l\\t%1,0(%2)\";
1389 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1390 return \"lm\\t%1,%0,%2\";
1392 [(set_attr "op_type" "RXE")
1393 (set_attr "atype" "mem")
1394 (set_attr "type" "lm")])
1397 ; store multiple pattern(s).
1400 (define_expand "store_multiple"
1401 [(match_par_dup 3 [(set (match_operand 0 "" "")
1402 (match_operand 1 "" ""))
1403 (use (match_operand 2 "" ""))])]
1412 /* Support only storing a constant number of fixed-point registers to
1413 memory and only bother with this if more than two. */
1414 if (GET_CODE (operands[2]) != CONST_INT
1415 || INTVAL (operands[2]) < 2
1416 || INTVAL (operands[2]) > 16
1417 || GET_CODE (operands[0]) != MEM
1418 || GET_CODE (operands[1]) != REG
1419 || REGNO (operands[1]) >= 16)
1422 count = INTVAL (operands[2]);
1423 regno = REGNO (operands[1]);
1425 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1429 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1431 to = XEXP (operands[0], 0);
1434 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1435 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1436 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1438 to = XEXP (XEXP (operands[0], 0), 0);
1439 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1444 if (to == frame_pointer_rtx || to == arg_pointer_rtx)
1449 to = force_reg (Pmode, XEXP (operands[0], 0));
1453 for (i = 0; i < count; i++)
1454 XVECEXP (operands[3], 0, i)
1455 = gen_rtx_SET (VOIDmode,
1456 change_address (operands[0], Pmode,
1458 off + i * UNITS_PER_WORD)),
1459 gen_rtx_REG (Pmode, regno + i));
1462 (define_insn "*store_multiple_di"
1463 [(match_parallel 0 "store_multiple_operation"
1464 [(set (match_operand:DI 1 "s_operand" "=Q")
1465 (match_operand:DI 2 "register_operand" "r"))])]
1469 int words = XVECLEN (operands[0], 0);
1471 if (XVECLEN (operands[0], 0) == 1)
1472 return \"stg\\t%1,0(%2)\";
1474 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1475 return \"stmg\\t%2,%0,%1\";
1477 [(set_attr "op_type" "RXE")
1478 (set_attr "atype" "mem")
1479 (set_attr "type" "stm")])
1482 (define_insn "*store_multiple_si"
1483 [(match_parallel 0 "store_multiple_operation"
1484 [(set (match_operand:SI 1 "s_operand" "=Q")
1485 (match_operand:SI 2 "register_operand" "r"))])]
1489 int words = XVECLEN (operands[0], 0);
1491 if (XVECLEN (operands[0], 0) == 1)
1492 return \"st\\t%1,0(%2)\";
1494 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1495 return \"stm\\t%2,%0,%1\";
1497 [(set_attr "op_type" "RXE")
1498 (set_attr "atype" "mem")
1499 (set_attr "type" "stm")])
1502 ;; String instructions.
1506 ; movstrdi instruction pattern(s).
1509 (define_expand "movstrdi"
1510 [(set (match_operand:BLK 0 "general_operand" "")
1511 (match_operand:BLK 1 "general_operand" ""))
1512 (use (match_operand:DI 2 "general_operand" ""))
1513 (match_operand 3 "" "")]
1519 addr0 = force_operand (XEXP (operands[0], 0), NULL_RTX);
1520 addr1 = force_operand (XEXP (operands[1], 0), NULL_RTX);
1522 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 256)
1524 operands[0] = change_address (operands[0], VOIDmode, addr0);
1525 operands[1] = change_address (operands[1], VOIDmode, addr1);
1526 operands[2] = GEN_INT (INTVAL (operands[2]) - 1);
1528 emit_insn (gen_movstrdi_short (operands[0], operands[1], operands[2]));
1535 /* implementation suggested by Richard Henderson <rth@cygnus.com> */
1536 rtx reg0 = gen_reg_rtx (TImode);
1537 rtx reg1 = gen_reg_rtx (TImode);
1538 rtx len = operands[2];
1540 if (! CONSTANT_P (len))
1541 len = force_reg (DImode, len);
1543 /* Load up the address+length pairs. */
1545 emit_move_insn (gen_highpart (DImode, reg0), addr0);
1546 emit_move_insn (gen_lowpart (DImode, reg0), len);
1548 emit_move_insn (gen_highpart (DImode, reg1), addr1);
1549 emit_move_insn (gen_lowpart (DImode, reg1), len);
1552 emit_insn (gen_movstrdi_64 (reg0, reg1, reg0, reg1));
1557 rtx label1 = gen_label_rtx ();
1558 rtx label2 = gen_label_rtx ();
1559 rtx reg0, reg1, len, blocks;
1561 reg0 = gen_reg_rtx (DImode);
1562 reg1 = gen_reg_rtx (DImode);
1563 len = gen_reg_rtx (DImode);
1564 blocks = gen_reg_rtx (DImode);
1566 emit_move_insn (len, operands[2]);
1567 emit_insn (gen_cmpdi (len, const0_rtx));
1568 emit_jump_insn (gen_beq (label1));
1569 emit_move_insn (reg0, addr0);
1570 emit_move_insn (reg1, addr1);
1571 emit_insn (gen_adddi3 (len, len, constm1_rtx));
1572 emit_insn (gen_ashrdi3 (blocks, len, GEN_INT (8)));
1573 emit_insn (gen_cmpdi (blocks, const0_rtx));
1574 emit_jump_insn (gen_beq (label2));
1575 emit_insn (gen_movstrdi_long (reg0, reg1, reg0, reg1, blocks, blocks));
1576 emit_label (label2);
1577 operands[0] = change_address (operands[0], VOIDmode, reg0);
1578 operands[1] = change_address (operands[1], VOIDmode, reg1);
1579 emit_insn (gen_movstrdi_short (operands[0], operands[1], len));
1580 emit_label (label1);
1587 ; movstrsi instruction pattern(s).
1590 (define_expand "movstrsi"
1591 [(set (match_operand:BLK 0 "general_operand" "")
1592 (match_operand:BLK 1 "general_operand" ""))
1593 (use (match_operand:SI 2 "general_operand" ""))
1594 (match_operand 3 "" "")]
1598 rtx addr0 = force_operand (XEXP (operands[0], 0), NULL_RTX);
1599 rtx addr1 = force_operand (XEXP (operands[1], 0), NULL_RTX);
1601 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 256)
1603 operands[0] = change_address (operands[0], VOIDmode, addr0);
1604 operands[1] = change_address (operands[1], VOIDmode, addr1);
1605 operands[2] = GEN_INT (INTVAL (operands[2]) - 1);
1607 emit_insn (gen_movstrsi_short (operands[0], operands[1], operands[2]));
1614 /* implementation suggested by Richard Henderson <rth@cygnus.com> */
1615 rtx reg0 = gen_reg_rtx (DImode);
1616 rtx reg1 = gen_reg_rtx (DImode);
1617 rtx len = operands[2];
1620 if (! CONSTANT_P (len))
1621 len = force_reg (SImode, len);
1623 /* Load up the address+length pairs. */
1625 emit_move_insn (gen_highpart (SImode, reg0), addr0);
1626 emit_move_insn (gen_lowpart (SImode, reg0), len);
1628 emit_move_insn (gen_highpart (SImode, reg1), addr1);
1629 emit_move_insn (gen_lowpart (SImode, reg1), len);
1632 emit_insn (gen_movstrsi_31 (reg0, reg1, reg0, reg1));
1637 rtx label1 = gen_label_rtx ();
1638 rtx label2 = gen_label_rtx ();
1639 rtx reg0, reg1, len, blocks;
1641 reg0 = gen_reg_rtx (SImode);
1642 reg1 = gen_reg_rtx (SImode);
1643 len = gen_reg_rtx (SImode);
1644 blocks = gen_reg_rtx (SImode);
1646 emit_move_insn (len, operands[2]);
1647 emit_insn (gen_cmpsi (len, const0_rtx));
1648 emit_jump_insn (gen_beq (label1));
1649 emit_move_insn (reg0, addr0);
1650 emit_move_insn (reg1, addr1);
1651 emit_insn (gen_addsi3 (len, len, constm1_rtx));
1652 emit_insn (gen_ashrsi3 (blocks, len, GEN_INT (8)));
1653 emit_insn (gen_cmpsi (blocks, const0_rtx));
1654 emit_jump_insn (gen_beq (label2));
1655 emit_insn (gen_movstrsi_long (reg0, reg1, reg0, reg1, blocks, blocks));
1656 emit_label (label2);
1657 operands[0] = change_address (operands[0], VOIDmode, reg0);
1658 operands[1] = change_address (operands[1], VOIDmode, reg1);
1659 emit_insn (gen_movstrsi_short (operands[0], operands[1], len));
1660 emit_label (label1);
1666 ; Move a block that is up to 256 bytes in length.
1667 ; The block length is taken as (operands[2] % 256) + 1.
1669 (define_insn "movstrdi_short"
1670 [(set (match_operand:BLK 0 "s_operand" "=Q,Q")
1671 (match_operand:BLK 1 "s_operand" "Q,Q"))
1672 (use (match_operand:DI 2 "nonmemory_operand" "n,a"))
1673 (clobber (match_scratch:DI 3 "=X,&a"))]
1677 switch (which_alternative)
1680 return \"mvc\\t%O0(%b2+1,%R0),%1\";
1683 output_asm_insn (\"bras\\t%3,.+10\", operands);
1684 output_asm_insn (\"mvc\\t%O0(1,%R0),%1\", operands);
1685 return \"ex\\t%2,0(%3)\";
1691 [(set_attr "op_type" "SS,NN")
1692 (set_attr "atype" "mem,mem")
1693 (set_attr "length" "*,14")])
1695 (define_insn "movstrsi_short"
1696 [(set (match_operand:BLK 0 "s_operand" "=Q,Q")
1697 (match_operand:BLK 1 "s_operand" "Q,Q"))
1698 (use (match_operand:SI 2 "nonmemory_operand" "n,a"))
1699 (clobber (match_scratch:SI 3 "=X,&a"))]
1703 switch (which_alternative)
1706 return \"mvc\\t%O0(%b2+1,%R0),%1\";
1709 output_asm_insn (\"bras\\t%3,.+10\", operands);
1710 output_asm_insn (\"mvc\\t%O0(1,%R0),%1\", operands);
1711 return \"ex\\t%2,0(%3)\";
1717 [(set_attr "op_type" "SS,NN")
1718 (set_attr "atype" "mem,mem")
1719 (set_attr "length" "*,14")])
1721 ; Move a block that is a multiple of 256 bytes in length
1723 (define_insn "movstrdi_long"
1724 [(set (match_operand:DI 4 "register_operand" "=d")
1726 (set (match_operand:DI 0 "register_operand" "=a")
1727 (plus:DI (match_operand:DI 2 "register_operand" "0")
1728 (ashift:DI (match_operand:DI 5 "register_operand" "4")
1730 (set (match_operand:DI 1 "register_operand" "=a")
1731 (plus:DI (match_operand:DI 3 "register_operand" "1")
1732 (ashift:DI (match_dup 5) (const_int 8))))
1733 (set (mem:BLK (match_dup 2))
1734 (mem:BLK (match_dup 3)))
1735 (use (match_dup 5))]
1739 output_asm_insn (\"mvc\\t0(256,%0),0(%1)\", operands);
1740 output_asm_insn (\"la\\t%0,256(%0)\", operands);
1741 output_asm_insn (\"la\\t%1,256(%1)\", operands);
1742 return \"brct\\t%4,.-14\";
1744 [(set_attr "op_type" "NN")
1745 (set_attr "atype" "mem")
1746 (set_attr "length" "18")])
1748 (define_insn "movstrsi_long"
1749 [(set (match_operand:SI 4 "register_operand" "=d")
1751 (set (match_operand:SI 0 "register_operand" "=a")
1752 (plus:SI (match_operand:SI 2 "register_operand" "0")
1753 (ashift:SI (match_operand:SI 5 "register_operand" "4")
1755 (set (match_operand:SI 1 "register_operand" "=a")
1756 (plus:SI (match_operand:SI 3 "register_operand" "1")
1757 (ashift:SI (match_dup 5) (const_int 8))))
1758 (set (mem:BLK (match_dup 2))
1759 (mem:BLK (match_dup 3)))
1760 (use (match_dup 5))]
1764 output_asm_insn (\"mvc\\t0(256,%0),0(%1)\", operands);
1765 output_asm_insn (\"la\\t%0,256(%0)\", operands);
1766 output_asm_insn (\"la\\t%1,256(%1)\", operands);
1767 return \"brct\\t%4,.-14\";
1769 [(set_attr "op_type" "NN")
1770 (set_attr "atype" "mem")
1771 (set_attr "length" "18")])
1773 ; Move a block that is larger than 255 bytes in length.
1775 (define_insn "movstrdi_64"
1776 [(set (match_operand:TI 0 "register_operand" "=d")
1777 (ashift:TI (plus:TI (match_operand:TI 2 "register_operand" "0")
1778 (lshiftrt:TI (match_dup 2) (const_int 64)))
1780 (set (match_operand:TI 1 "register_operand" "=d")
1781 (ashift:TI (plus:TI (match_operand:TI 3 "register_operand" "1")
1782 (lshiftrt:TI (match_dup 3) (const_int 64)))
1784 (set (mem:BLK (subreg:DI (match_dup 2) 0))
1785 (mem:BLK (subreg:DI (match_dup 3) 0)))
1786 (clobber (reg:CC 33))]
1788 "mvcle\\t%0,%1,0\;jo\\t.-4"
1789 [(set_attr "op_type" "NN")
1790 (set_attr "atype" "mem")
1791 (set_attr "length" "8")])
1793 (define_insn "movstrsi_31"
1794 [(set (match_operand:DI 0 "register_operand" "=d")
1795 (ashift:DI (plus:DI (match_operand:DI 2 "register_operand" "0")
1796 (lshiftrt:DI (match_dup 2) (const_int 32)))
1798 (set (match_operand:DI 1 "register_operand" "=d")
1799 (ashift:DI (plus:DI (match_operand:DI 3 "register_operand" "1")
1800 (lshiftrt:DI (match_dup 3) (const_int 32)))
1802 (set (mem:BLK (subreg:SI (match_dup 2) 0))
1803 (mem:BLK (subreg:SI (match_dup 3) 0)))
1804 (clobber (reg:CC 33))]
1806 "mvcle\\t%0,%1,0\;jo\\t.-4"
1807 [(set_attr "op_type" "NN")
1808 (set_attr "atype" "mem")
1809 (set_attr "length" "8")])
1812 ; clrstrdi instruction pattern(s).
1815 (define_expand "clrstrdi"
1816 [(set (match_operand:BLK 0 "general_operand" "")
1818 (use (match_operand:DI 1 "general_operand" ""))
1819 (match_operand 2 "" "")]
1823 rtx addr = force_operand (XEXP (operands[0], 0), NULL_RTX);
1825 operands[0] = change_address (operands[0], VOIDmode, addr);
1827 if (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) < 256)
1829 emit_insn (gen_clrstrsico (operands[0], operands[1]));
1834 rtx reg0 = gen_reg_rtx (TImode);
1835 rtx reg1 = gen_reg_rtx (TImode);
1836 rtx len = operands[1];
1838 if (! CONSTANT_P (len))
1839 len = force_reg (DImode, len);
1841 /* Load up the address+length pairs. */
1843 emit_move_insn (gen_highpart (DImode, reg0), addr);
1844 emit_move_insn (gen_lowpart (DImode, reg0), len);
1846 emit_move_insn (gen_lowpart (DImode, reg1), const0_rtx);
1849 emit_insn (gen_clrstrsi_64 (reg0, reg1, reg0));
1855 ; clrstrsi instruction pattern(s).
1858 (define_expand "clrstrsi"
1859 [(set (match_operand:BLK 0 "general_operand" "")
1861 (use (match_operand:SI 1 "general_operand" ""))
1862 (match_operand 2 "" "")]
1866 rtx addr = force_operand (XEXP (operands[0], 0), NULL_RTX);
1868 operands[0] = change_address (operands[0], VOIDmode, addr);
1870 if (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) < 256)
1872 emit_insn (gen_clrstrsico (operands[0], operands[1]));
1877 rtx reg0 = gen_reg_rtx (DImode);
1878 rtx reg1 = gen_reg_rtx (DImode);
1879 rtx len = operands[1];
1881 if (! CONSTANT_P (len))
1882 len = force_reg (SImode, len);
1884 /* Load up the address+length pairs. */
1886 emit_move_insn (gen_highpart (SImode, reg0), addr);
1887 emit_move_insn (gen_lowpart (SImode, reg0), len);
1889 emit_move_insn (gen_lowpart (SImode, reg1), const0_rtx);
1892 emit_insn (gen_clrstrsi_31 (reg0, reg1, reg0));
1897 ; Clear memory with length less than 256 bytes
1899 (define_insn "clrstrsico"
1900 [(set (match_operand:BLK 0 "s_operand" "=Q")
1902 (use (match_operand 1 "immediate_operand" "I"))
1903 (clobber (reg:CC 33))]
1905 "xc\\t%O0(%1,%R0),%0"
1906 [(set_attr "op_type" "RS")
1907 (set_attr "type" "cs")
1908 (set_attr "atype" "mem")])
1910 ; Clear memory with length greater 256 bytes or lenght not constant
1912 (define_insn "clrstrsi_64"
1913 [(set (match_operand:TI 0 "register_operand" "=d")
1914 (ashift:TI (plus:TI (match_operand:TI 2 "register_operand" "0")
1915 (lshiftrt:TI (match_dup 2) (const_int 64)))
1917 (set (mem:BLK (subreg:DI (match_dup 2) 0))
1919 (use (match_operand:TI 1 "register_operand" "d"))
1920 (clobber (reg:CC 33))]
1922 "mvcle\\t%0,%1,0\;jo\\t.-4"
1923 [(set_attr "op_type" "NN")
1924 (set_attr "atype" "mem")
1925 (set_attr "type" "vs")
1926 (set_attr "length" "8")])
1928 (define_insn "clrstrsi_31"
1929 [(set (match_operand:DI 0 "register_operand" "=d")
1930 (ashift:DI (plus:DI (match_operand:DI 2 "register_operand" "0")
1931 (lshiftrt:DI (match_dup 2) (const_int 32)))
1933 (set (mem:BLK (subreg:SI (match_dup 2) 0))
1935 (use (match_operand:DI 1 "register_operand" "d"))
1936 (clobber (reg:CC 33))]
1938 "mvcle\\t%0,%1,0\;jo\\t.-4"
1939 [(set_attr "op_type" "NN")
1940 (set_attr "atype" "mem")
1941 (set_attr "type" "vs")
1942 (set_attr "length" "8")])
1945 ; cmpstrdi instruction pattern(s).
1948 (define_expand "cmpstrdi"
1949 [(set (match_operand:DI 0 "register_operand" "")
1950 (compare:DI (match_operand:BLK 1 "general_operand" "")
1951 (match_operand:BLK 2 "general_operand" "") ) )
1952 (use (match_operand:DI 3 "general_operand" ""))
1953 (use (match_operand:DI 4 "" ""))]
1959 /* for pre/post increment */
1960 operands[1] = protect_from_queue (operands[1], 0);
1961 operands[2] = protect_from_queue (operands[2], 0);
1962 operands[3] = protect_from_queue (operands[3], 0);
1964 addr0 = force_operand (XEXP (operands[1], 0), NULL_RTX);
1965 addr1 = force_operand (XEXP (operands[2], 0), NULL_RTX);
1967 if (GET_CODE (operands[3]) == CONST_INT && INTVAL (operands[3]) < 256)
1969 if (INTVAL (operands[3]) == 0) {
1970 emit_move_insn (operands[0], operands[3]);
1974 operands[1] = change_address (operands[1], VOIDmode, addr0);
1975 operands[2] = change_address (operands[2], VOIDmode, addr1);
1977 emit_insn (gen_cmpstr_const (operands[1], operands[2], operands[3]));
1978 emit_insn (gen_cmpint_di (operands[0]));
1983 /* implementation suggested by Richard Henderson <rth@cygnus.com> */
1984 rtx reg0 = gen_reg_rtx (TImode);
1985 rtx reg1 = gen_reg_rtx (TImode);
1986 rtx len = operands[3];
1988 if (! CONSTANT_P (len))
1989 len = force_reg (DImode, len);
1991 /* Load up the address+length pairs. */
1992 emit_move_insn (gen_highpart (DImode, reg0), addr0);
1993 emit_move_insn (gen_lowpart (DImode, reg0), len);
1995 emit_move_insn (gen_highpart (DImode, reg1), addr1);
1996 emit_move_insn (gen_lowpart (DImode, reg1), len);
1999 emit_insn (gen_cmpstr_64 (reg0, reg1, reg0, reg1));
2000 emit_insn (gen_cmpint_di (operands[0]));
2006 ; cmpstrsi instruction pattern(s).
2009 (define_expand "cmpstrsi"
2010 [(set (match_operand:SI 0 "register_operand" "")
2011 (compare:SI (match_operand:BLK 1 "general_operand" "")
2012 (match_operand:BLK 2 "general_operand" "") ) )
2013 (use (match_operand:SI 3 "general_operand" ""))
2014 (use (match_operand:SI 4 "" ""))]
2020 /* for pre/post increment */
2021 operands[1] = protect_from_queue (operands[1], 0);
2022 operands[2] = protect_from_queue (operands[2], 0);
2023 operands[3] = protect_from_queue (operands[3], 0);
2025 addr0 = force_operand (XEXP (operands[1], 0), NULL_RTX);
2026 addr1 = force_operand (XEXP (operands[2], 0), NULL_RTX);
2028 if (GET_CODE (operands[3]) == CONST_INT && INTVAL (operands[3]) < 256)
2030 if (INTVAL (operands[3]) == 0) {
2031 emit_move_insn (operands[0], operands[3]);
2035 operands[1] = change_address (operands[1], VOIDmode, addr0);
2036 operands[2] = change_address (operands[2], VOIDmode, addr1);
2038 emit_insn (gen_cmpstr_const (operands[1], operands[2], operands[3]));
2039 emit_insn (gen_cmpint_si (operands[0]));
2044 /* implementation suggested by Richard Henderson <rth@cygnus.com> */
2046 rtx len = operands[3];
2050 reg0 = gen_reg_rtx (TImode);
2051 reg1 = gen_reg_rtx (TImode);
2055 reg0 = gen_reg_rtx (DImode);
2056 reg1 = gen_reg_rtx (DImode);
2059 if (! CONSTANT_P (len))
2060 len = force_reg (Pmode, len);
2062 /* Load up the address+length pairs. */
2063 emit_move_insn (gen_highpart (Pmode, reg0), addr0);
2064 emit_move_insn (gen_lowpart (Pmode, reg0), len);
2066 emit_move_insn (gen_highpart (Pmode, reg1), addr1);
2067 emit_move_insn (gen_lowpart (Pmode, reg1), len);
2071 emit_insn (gen_cmpstr_64 (reg0, reg1, reg0, reg1));
2073 emit_insn (gen_cmpstr_31 (reg0, reg1, reg0, reg1));
2075 emit_insn (gen_cmpint_si (operands[0]));
2080 ; Compare a block that is less than 256 bytes in length.
2082 (define_insn "cmpstr_const"
2084 (compare:CCS (match_operand:BLK 0 "s_operand" "Q")
2085 (match_operand:BLK 1 "s_operand" "Q")))
2086 (use (match_operand 2 "immediate_operand" "I"))]
2087 "(unsigned) INTVAL (operands[2]) < 256"
2088 "clc\\t%O0(%c2,%R0),%1"
2089 [(set_attr "op_type" "SS")
2090 (set_attr "atype" "mem")
2091 (set_attr "type" "cs")])
2093 ; Compare a block that is larger than 255 bytes in length.
2095 (define_insn "cmpstr_64"
2096 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2097 (clobber (match_operand:TI 1 "register_operand" "=d"))
2099 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2100 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2102 (use (match_dup 3))]
2105 [(set_attr "op_type" "RR")
2106 (set_attr "atype" "mem")
2107 (set_attr "type" "vs")])
2109 (define_insn "cmpstr_31"
2110 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2111 (clobber (match_operand:DI 1 "register_operand" "=d"))
2113 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2114 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2116 (use (match_dup 3))]
2119 [(set_attr "op_type" "RR")
2120 (set_attr "atype" "mem")
2121 (set_attr "type" "vs")])
2123 ; Convert condition code to integer in range (-1, 0, 1)
2125 (define_insn "cmpint_si"
2126 [(set (match_operand:SI 0 "register_operand" "=d")
2127 (compare:SI (reg:CCS 33) (const_int 0)))]
2131 output_asm_insn (\"lhi\\t%0,1\", operands);
2132 output_asm_insn (\"jh\\t.+12\", operands);
2133 output_asm_insn (\"jl\\t.+6\", operands);
2134 output_asm_insn (\"sr\\t%0,%0\", operands);
2135 return \"lcr\\t%0,%0\";
2137 [(set_attr "op_type" "NN")
2138 (set_attr "length" "16")
2139 (set_attr "atype" "reg")
2140 (set_attr "type" "other")])
2142 (define_insn "cmpint_di"
2143 [(set (match_operand:DI 0 "register_operand" "=d")
2144 (compare:DI (reg:CCS 33) (const_int 0)))]
2148 output_asm_insn (\"lghi\\t%0,1\", operands);
2149 output_asm_insn (\"jh\\t.+12\", operands);
2150 output_asm_insn (\"jl\\t.+6\", operands);
2151 output_asm_insn (\"sgr\\t%0,%0\", operands);
2152 return \"lcgr\\t%0,%0\";
2154 [(set_attr "op_type" "NN")
2155 (set_attr "length" "22")
2156 (set_attr "atype" "reg")
2157 (set_attr "type" "other")])
2161 ;;- Conversion instructions.
2164 (define_insn "*sethighqisi"
2165 [(set (match_operand:SI 0 "register_operand" "=d")
2166 (unspec:SI [(match_operand:QI 1 "s_operand" "Q")] 10))
2167 (clobber (reg:CC 33))]
2170 [(set_attr "op_type" "RS")
2171 (set_attr "atype" "mem")])
2173 (define_insn "*sethighhisi"
2174 [(set (match_operand:SI 0 "register_operand" "=d")
2175 (unspec:SI [(match_operand:HI 1 "s_operand" "Q")] 10))
2176 (clobber (reg:CC 33))]
2179 [(set_attr "op_type" "RS")
2180 (set_attr "atype" "mem")])
2182 (define_insn "*sethighqidi_64"
2183 [(set (match_operand:DI 0 "register_operand" "=d")
2184 (unspec:DI [(match_operand:QI 1 "s_operand" "Q")] 10))
2185 (clobber (reg:CC 33))]
2188 [(set_attr "op_type" "RSE")
2189 (set_attr "atype" "mem")])
2191 (define_insn "*sethighqidi_31"
2192 [(set (match_operand:DI 0 "register_operand" "=d")
2193 (unspec:DI [(match_operand:QI 1 "s_operand" "Q")] 10))
2194 (clobber (reg:CC 33))]
2197 [(set_attr "op_type" "RS")
2198 (set_attr "atype" "mem")])
2201 [(set (match_operand:SI 0 "register_operand" "")
2202 (zero_extract:SI (match_operand:QI 1 "s_operand" "")
2203 (match_operand 2 "const_int_operand" "")
2205 "!TARGET_64BIT && !reload_completed
2206 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2208 [(set (match_dup 0) (unspec:SI [(match_dup 1)] 10))
2209 (clobber (reg:CC 33))])
2210 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2213 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2214 operands[1] = change_address (operands[1], QImode, 0);
2218 [(set (match_operand:SI 0 "register_operand" "")
2219 (zero_extract:SI (match_operand:QI 1 "s_operand" "")
2220 (match_operand 2 "const_int_operand" "")
2222 "!TARGET_64BIT && !reload_completed
2223 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2225 [(set (match_dup 0) (unspec:SI [(match_dup 1)] 10))
2226 (clobber (reg:CC 33))])
2227 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2230 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2231 operands[1] = change_address (operands[1], HImode, 0);
2235 ; extendsidi2 instruction pattern(s).
2238 (define_expand "extendsidi2"
2239 [(set (match_operand:DI 0 "register_operand" "")
2240 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2246 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2247 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2248 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2249 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2255 (define_insn "*extendsidi2"
2256 [(set (match_operand:DI 0 "register_operand" "=d,d")
2257 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2262 [(set_attr "op_type" "RRE,RXE")
2263 (set_attr "atype" "reg,mem")])
2266 ; extendhidi2 instruction pattern(s).
2269 (define_expand "extendhidi2"
2270 [(set (match_operand:DI 0 "register_operand" "")
2271 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2277 rtx tmp = gen_reg_rtx (SImode);
2278 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2279 emit_insn (gen_extendsidi2 (operands[0], tmp));
2284 operands[1] = gen_lowpart (DImode, operands[1]);
2285 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2286 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2292 (define_insn "*extendhidi2"
2293 [(set (match_operand:DI 0 "register_operand" "=d")
2294 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2297 [(set_attr "op_type" "RXE")
2298 (set_attr "atype" "mem")])
2301 ; extendqidi2 instruction pattern(s).
2304 (define_expand "extendqidi2"
2305 [(set (match_operand:DI 0 "register_operand" "")
2306 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2312 rtx tmp = gen_reg_rtx (SImode);
2313 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2314 emit_insn (gen_extendsidi2 (operands[0], tmp));
2319 operands[1] = gen_lowpart (DImode, operands[1]);
2320 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2321 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2328 [(set (match_operand:DI 0 "register_operand" "")
2329 (sign_extend:DI (match_operand:QI 1 "s_operand" "")))]
2330 "TARGET_64BIT && !reload_completed"
2332 [(set (match_dup 0) (unspec:DI [(match_dup 1)] 10))
2333 (clobber (reg:CC 33))])
2335 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2336 (clobber (reg:CC 33))])]
2340 ; extendhisi2 instruction pattern(s).
2343 (define_expand "extendhisi2"
2344 [(set (match_operand:SI 0 "register_operand" "")
2345 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2349 operands[1] = gen_lowpart (SImode, operands[1]);
2350 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2351 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2356 (define_insn "*extendhisi2"
2357 [(set (match_operand:SI 0 "register_operand" "=d")
2358 (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2361 [(set_attr "op_type" "RX")
2362 (set_attr "atype" "mem")])
2365 ; extendqisi2 instruction pattern(s).
2368 (define_expand "extendqisi2"
2369 [(set (match_operand:SI 0 "register_operand" "")
2370 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2374 operands[1] = gen_lowpart (SImode, operands[1]);
2375 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2376 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2382 [(set (match_operand:SI 0 "register_operand" "")
2383 (sign_extend:SI (match_operand:QI 1 "s_operand" "")))]
2386 [(set (match_dup 0) (unspec:SI [(match_dup 1)] 10))
2387 (clobber (reg:CC 33))])
2389 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2390 (clobber (reg:CC 33))])]
2394 ; extendqihi2 instruction pattern(s).
2399 ; zero_extendsidi2 instruction pattern(s).
2402 (define_expand "zero_extendsidi2"
2403 [(set (match_operand:DI 0 "register_operand" "")
2404 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2410 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2411 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2412 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2418 (define_insn "*zero_extendsidi2"
2419 [(set (match_operand:DI 0 "register_operand" "=d,d")
2420 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2425 [(set_attr "op_type" "RRE,RXE")
2426 (set_attr "atype" "reg,mem")])
2429 ; zero_extendhidi2 instruction pattern(s).
2432 (define_expand "zero_extendhidi2"
2433 [(set (match_operand:DI 0 "register_operand" "")
2434 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2440 rtx tmp = gen_reg_rtx (SImode);
2441 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2442 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2447 operands[1] = gen_lowpart (DImode, operands[1]);
2448 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2449 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2455 (define_insn "*zero_extendhidi2"
2456 [(set (match_operand:DI 0 "register_operand" "=d")
2457 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2460 [(set_attr "op_type" "RXE")
2461 (set_attr "atype" "mem")])
2464 ; zero_extendqidi2 instruction pattern(s)
2467 (define_expand "zero_extendqidi2"
2468 [(set (match_operand:DI 0 "register_operand" "")
2469 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2475 rtx tmp = gen_reg_rtx (SImode);
2476 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2477 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2482 operands[1] = gen_lowpart (DImode, operands[1]);
2483 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2484 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2490 (define_insn "*zero_extendqidi2"
2491 [(set (match_operand:DI 0 "register_operand" "=d")
2492 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2495 [(set_attr "op_type" "RXE")
2496 (set_attr "atype" "mem")])
2499 ; zero_extendhisi2 instruction pattern(s).
2502 (define_expand "zero_extendhisi2"
2503 [(set (match_operand:SI 0 "register_operand" "")
2504 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2508 operands[1] = gen_lowpart (SImode, operands[1]);
2509 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2514 (define_insn "*zero_extendhisi2_64"
2515 [(set (match_operand:SI 0 "register_operand" "=d")
2516 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2519 [(set_attr "op_type" "RXE")
2520 (set_attr "atype" "mem")])
2523 ; zero_extendqisi2 instruction pattern(s).
2526 (define_expand "zero_extendqisi2"
2527 [(set (match_operand:SI 0 "register_operand" "")
2528 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2532 operands[1] = gen_lowpart (SImode, operands[1]);
2533 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2538 (define_insn "*zero_extendqisi2_64"
2539 [(set (match_operand:SI 0 "register_operand" "=d")
2540 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2543 [(set_attr "op_type" "RXE")
2544 (set_attr "atype" "mem")])
2547 ; zero_extendqihi2 instruction pattern(s).
2550 (define_expand "zero_extendqihi2"
2551 [(set (match_operand:HI 0 "register_operand" "")
2552 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2556 operands[1] = gen_lowpart (HImode, operands[1]);
2557 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2562 (define_insn "*zero_extendqihi2_64"
2563 [(set (match_operand:HI 0 "register_operand" "=d")
2564 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))
2565 (clobber (reg:CC 33))]
2568 [(set_attr "op_type" "RXE")
2569 (set_attr "atype" "mem")])
2572 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2575 (define_expand "fixuns_truncdfdi2"
2576 [(set (match_operand:DI 0 "register_operand" "")
2577 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2578 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2581 rtx label1 = gen_label_rtx ();
2582 rtx label2 = gen_label_rtx ();
2583 rtx temp = gen_reg_rtx (DFmode);
2584 operands[1] = force_reg (DFmode, operands[1]);
2586 emit_insn (gen_cmpdf (operands[1],
2587 CONST_DOUBLE_FROM_REAL_VALUE (
2588 REAL_VALUE_ATOF (\"9223372036854775808.0\", DFmode), DFmode)));
2589 emit_jump_insn (gen_blt (label1));
2590 emit_insn (gen_subdf3 (temp, operands[1],
2591 CONST_DOUBLE_FROM_REAL_VALUE (
2592 REAL_VALUE_ATOF (\"18446744073709551616.0\", DFmode), DFmode)));
2593 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2596 emit_label (label1);
2597 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2598 emit_label (label2);
2602 (define_expand "fix_truncdfdi2"
2603 [(set (match_operand:DI 0 "register_operand" "")
2604 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2605 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2608 operands[1] = force_reg (DFmode, operands[1]);
2609 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2613 (define_insn "fix_truncdfdi2_ieee"
2614 [(set (match_operand:DI 0 "register_operand" "=d")
2615 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2616 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] 1)
2617 (clobber (reg:CC 33))]
2618 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2620 [(set_attr "op_type" "RRE")
2621 (set_attr "type" "other")])
2624 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2627 (define_expand "fixuns_truncdfsi2"
2628 [(set (match_operand:SI 0 "register_operand" "")
2629 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2630 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2633 rtx label1 = gen_label_rtx ();
2634 rtx label2 = gen_label_rtx ();
2635 rtx temp = gen_reg_rtx (DFmode);
2637 operands[1] = force_reg (DFmode,operands[1]);
2638 emit_insn (gen_cmpdf (operands[1],
2639 CONST_DOUBLE_FROM_REAL_VALUE (
2640 REAL_VALUE_ATOF (\"2147483648.0\", DFmode), DFmode)));
2641 emit_jump_insn (gen_blt (label1));
2642 emit_insn (gen_subdf3 (temp, operands[1],
2643 CONST_DOUBLE_FROM_REAL_VALUE (
2644 REAL_VALUE_ATOF (\"4294967296.0\", DFmode), DFmode)));
2645 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2648 emit_label (label1);
2649 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2650 emit_label (label2);
2654 (define_expand "fix_truncdfsi2"
2655 [(set (match_operand:SI 0 "register_operand" "")
2656 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2660 if (TARGET_IBM_FLOAT)
2662 /* This is the algorithm from POP chapter A.5.7.2. */
2664 rtx temp = assign_stack_local (BLKmode, 2 * UNITS_PER_WORD, BITS_PER_WORD);
2665 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2666 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2668 operands[1] = force_reg (DFmode, operands[1]);
2669 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2670 two31r, two32, temp));
2674 operands[1] = force_reg (DFmode, operands[1]);
2675 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2681 (define_insn "fix_truncdfsi2_ieee"
2682 [(set (match_operand:SI 0 "register_operand" "=d")
2683 (fix:SI (match_operand:DF 1 "register_operand" "f")))
2684 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] 1)
2685 (clobber (reg:CC 33))]
2686 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2688 [(set_attr "op_type" "RRE")
2689 (set_attr "type" "other" )])
2691 (define_insn "fix_truncdfsi2_ibm"
2692 [(set (match_operand:SI 0 "register_operand" "=d")
2693 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2694 (use (match_operand:DI 2 "immediate_operand" "m"))
2695 (use (match_operand:DI 3 "immediate_operand" "m"))
2696 (use (match_operand:BLK 4 "memory_operand" "m"))
2697 (clobber (reg:CC 33))]
2698 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2701 output_asm_insn (\"sd\\t%1,%2\", operands);
2702 output_asm_insn (\"aw\\t%1,%3\", operands);
2703 output_asm_insn (\"std\\t%1,%4\", operands);
2704 output_asm_insn (\"xi\\t%N4,128\", operands);
2705 return \"l\\t%0,%N4\";
2707 [(set_attr "op_type" "NN")
2708 (set_attr "type" "other")
2709 (set_attr "length" "20")])
2712 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
2715 (define_expand "fixuns_truncsfdi2"
2716 [(set (match_operand:DI 0 "register_operand" "")
2717 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2718 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2721 rtx label1 = gen_label_rtx ();
2722 rtx label2 = gen_label_rtx ();
2723 rtx temp = gen_reg_rtx (SFmode);
2725 operands[1] = force_reg (SFmode, operands[1]);
2726 emit_insn (gen_cmpsf (operands[1],
2727 CONST_DOUBLE_FROM_REAL_VALUE (
2728 REAL_VALUE_ATOF (\"9223372036854775808.0\", SFmode), SFmode)));
2729 emit_jump_insn (gen_blt (label1));
2731 emit_insn (gen_subsf3 (temp, operands[1],
2732 CONST_DOUBLE_FROM_REAL_VALUE (
2733 REAL_VALUE_ATOF (\"18446744073709551616.0\", SFmode), SFmode)));
2734 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
2737 emit_label (label1);
2738 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2739 emit_label (label2);
2743 (define_expand "fix_truncsfdi2"
2744 [(set (match_operand:DI 0 "register_operand" "")
2745 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
2746 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2749 operands[1] = force_reg (SFmode, operands[1]);
2750 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2754 (define_insn "fix_truncsfdi2_ieee"
2755 [(set (match_operand:DI 0 "register_operand" "=d")
2756 (fix:DI (match_operand:SF 1 "register_operand" "f")))
2757 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] 1)
2758 (clobber (reg:CC 33))]
2759 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2761 [(set_attr "op_type" "RRE")
2762 (set_attr "type" "other")])
2765 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
2768 (define_expand "fixuns_truncsfsi2"
2769 [(set (match_operand:SI 0 "register_operand" "")
2770 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
2771 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2774 rtx label1 = gen_label_rtx ();
2775 rtx label2 = gen_label_rtx ();
2776 rtx temp = gen_reg_rtx (SFmode);
2778 operands[1] = force_reg (SFmode, operands[1]);
2779 emit_insn (gen_cmpsf (operands[1],
2780 CONST_DOUBLE_FROM_REAL_VALUE (
2781 REAL_VALUE_ATOF (\"2147483648.0\", SFmode), SFmode)));
2782 emit_jump_insn (gen_blt (label1));
2783 emit_insn (gen_subsf3 (temp, operands[1],
2784 CONST_DOUBLE_FROM_REAL_VALUE (
2785 REAL_VALUE_ATOF (\"4294967296.0\", SFmode), SFmode)));
2786 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
2789 emit_label (label1);
2790 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2791 emit_label (label2);
2795 (define_expand "fix_truncsfsi2"
2796 [(set (match_operand:SI 0 "register_operand" "")
2797 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
2801 if (TARGET_IBM_FLOAT)
2803 /* Convert to DFmode and then use the POP algorithm. */
2804 rtx temp = gen_reg_rtx (DFmode);
2805 emit_insn (gen_extendsfdf2 (temp, operands[1]));
2806 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
2810 operands[1] = force_reg (SFmode, operands[1]);
2811 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2817 (define_insn "fix_truncsfsi2_ieee"
2818 [(set (match_operand:SI 0 "register_operand" "=d")
2819 (fix:SI (match_operand:SF 1 "register_operand" "f")))
2820 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] 1)
2821 (clobber (reg:CC 33))]
2822 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2824 [(set_attr "op_type" "RRE")
2825 (set_attr "type" "other")])
2828 ; floatdidf2 instruction pattern(s).
2831 (define_insn "floatdidf2"
2832 [(set (match_operand:DF 0 "register_operand" "=f")
2833 (float:DF (match_operand:DI 1 "register_operand" "d")))
2834 (clobber (reg:CC 33))]
2835 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2837 [(set_attr "op_type" "RRE")
2838 (set_attr "type" "other" )])
2841 ; floatdisf2 instruction pattern(s).
2844 (define_insn "floatdisf2"
2845 [(set (match_operand:SF 0 "register_operand" "=f")
2846 (float:SF (match_operand:DI 1 "register_operand" "d")))
2847 (clobber (reg:CC 33))]
2848 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2850 [(set_attr "op_type" "RRE")
2851 (set_attr "type" "other" )])
2854 ; floatsidf2 instruction pattern(s).
2857 (define_expand "floatsidf2"
2859 [(set (match_operand:DF 0 "register_operand" "")
2860 (float:DF (match_operand:SI 1 "register_operand" "")))
2861 (clobber (reg:CC 33))])]
2865 if (TARGET_IBM_FLOAT)
2867 /* This is the algorithm from POP chapter A.5.7.1. */
2869 rtx temp = assign_stack_local (BLKmode, 2 * UNITS_PER_WORD, BITS_PER_WORD);
2870 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
2872 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
2877 (define_insn "floatsidf2_ieee"
2878 [(set (match_operand:DF 0 "register_operand" "=f")
2879 (float:DF (match_operand:SI 1 "register_operand" "d")))
2880 (clobber (reg:CC 33))]
2881 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2883 [(set_attr "op_type" "RRE")
2884 (set_attr "type" "other" )])
2886 (define_insn "floatsidf2_ibm"
2887 [(set (match_operand:DF 0 "register_operand" "=f")
2888 (float:DF (match_operand:SI 1 "register_operand" "d")))
2889 (use (match_operand:DI 2 "immediate_operand" "m"))
2890 (use (match_operand:BLK 3 "memory_operand" "m"))
2891 (clobber (reg:CC 33))]
2892 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2895 output_asm_insn (\"st\\t%1,%N3\", operands);
2896 output_asm_insn (\"xi\\t%N3,128\", operands);
2897 output_asm_insn (\"mvc\\t%O3(4,%R3),%2\", operands);
2898 output_asm_insn (\"ld\\t%0,%3\", operands);
2899 return \"sd\\t%0,%2\";
2901 [(set_attr "op_type" "NN")
2902 (set_attr "type" "other" )
2903 (set_attr "length" "20")])
2906 ; floatsisf2 instruction pattern(s).
2909 (define_expand "floatsisf2"
2911 [(set (match_operand:SF 0 "register_operand" "")
2912 (float:SF (match_operand:SI 1 "register_operand" "")))
2913 (clobber (reg:CC 33))])]
2917 if (TARGET_IBM_FLOAT)
2919 /* Use the POP algorithm to convert to DFmode and then truncate. */
2920 rtx temp = gen_reg_rtx (DFmode);
2921 emit_insn (gen_floatsidf2 (temp, operands[1]));
2922 emit_insn (gen_truncdfsf2 (operands[0], temp));
2927 (define_insn "floatsisf2_ieee"
2928 [(set (match_operand:SF 0 "register_operand" "=f")
2929 (float:SF (match_operand:SI 1 "register_operand" "d")))
2930 (clobber (reg:CC 33))]
2931 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2933 [(set_attr "op_type" "RRE")
2934 (set_attr "type" "other" )])
2937 ; truncdfsf2 instruction pattern(s).
2940 (define_expand "truncdfsf2"
2941 [(set (match_operand:SF 0 "register_operand" "")
2942 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
2946 (define_insn "truncdfsf2_ieee"
2947 [(set (match_operand:SF 0 "register_operand" "=f")
2948 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
2949 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2951 [(set_attr "op_type" "RRE")])
2953 (define_insn "truncdfsf2_ibm"
2954 [(set (match_operand:SF 0 "register_operand" "=f,f")
2955 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,m")))]
2956 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2960 [(set_attr "op_type" "RR,RX")
2961 (set_attr "atype" "reg,mem")])
2964 ; extendsfdf2 instruction pattern(s).
2967 (define_expand "extendsfdf2"
2968 [(set (match_operand:DF 0 "register_operand" "")
2969 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
2973 if (TARGET_IBM_FLOAT)
2975 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
2980 (define_insn "extendsfdf2_ieee"
2981 [(set (match_operand:DF 0 "register_operand" "=f,f")
2982 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m")))]
2983 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2987 [(set_attr "op_type" "RRE,RXE")])
2989 (define_insn "extendsfdf2_ibm"
2990 [(set (match_operand:DF 0 "register_operand" "=f,f")
2991 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m")))
2992 (clobber (reg:CC 33))]
2993 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2995 sdr\\t%0,%0\;ler\\t%0,%1
2996 sdr\\t%0,%0\;le\\t%0,%1"
2997 [(set_attr "op_type" "RRE,RXE")
2998 (set_attr "atype" "reg,mem")
2999 (set_attr "type" "o2,o2")])
3003 ;; ARITHMETRIC OPERATIONS
3005 ; arithmetric operations set the ConditionCode,
3006 ; because of unpredictable Bits in Register for Halfword and Byte
3007 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3010 ;;- Add instructions.
3014 ; adddi3 instruction pattern(s).
3017 (define_insn "addaddr_esame"
3018 [(set (match_operand:DI 0 "register_operand" "=a,a")
3019 (plus:DI (match_operand:DI 1 "register_operand" "%a,a")
3020 (match_operand:DI 2 "nonmemory_operand" "J,a")))]
3021 "TARGET_64BIT && (((REGNO (operands[1]) == STACK_POINTER_REGNUM ) ||
3022 (REGNO (operands[1]) == BASE_REGISTER)) &&
3023 (GET_CODE (operands[2]) == REG ||
3024 CONST_OK_FOR_LETTER_P (INTVAL (operands[2]),'J')))"
3028 [(set_attr "op_type" "RX")
3029 (set_attr "atype" "mem")
3030 (set_attr "type" "la")])
3032 (define_insn "*adddi3_sign"
3033 [(set (match_operand:DI 0 "register_operand" "=d,d")
3034 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3035 (match_operand:DI 1 "register_operand" "0,0")))
3036 (clobber (reg:CC 33))]
3041 [(set_attr "op_type" "RRE,RXE")
3042 (set_attr "atype" "reg,mem")])
3044 (define_insn "*adddi3_zero_cc"
3046 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3047 (match_operand:DI 1 "register_operand" "0,0"))
3049 (set (match_operand:DI 0 "register_operand" "=d,d")
3050 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3051 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3055 [(set_attr "op_type" "RRE,RXE")
3056 (set_attr "atype" "reg,mem")])
3058 (define_insn "*adddi3_zero_cconly"
3060 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3061 (match_operand:DI 1 "register_operand" "0,0"))
3063 (clobber (match_scratch:DI 0 "=d,d"))]
3064 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3068 [(set_attr "op_type" "RRE,RXE")
3069 (set_attr "atype" "reg,mem")])
3071 (define_insn "*adddi3_zero"
3072 [(set (match_operand:DI 0 "register_operand" "=d,d")
3073 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3074 (match_operand:DI 1 "register_operand" "0,0")))
3075 (clobber (reg:CC 33))]
3080 [(set_attr "op_type" "RRE,RXE")
3081 (set_attr "atype" "reg,mem")])
3083 (define_insn "*adddi3_imm_cc"
3085 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3086 (match_operand:DI 2 "const_int_operand" "K"))
3088 (set (match_operand:DI 0 "register_operand" "=d")
3089 (plus:DI (match_dup 1) (match_dup 2)))]
3091 && s390_match_ccmode (insn, CCAmode)
3092 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
3094 [(set_attr "op_type" "RI")
3095 (set_attr "atype" "reg")])
3097 (define_insn "*adddi3_cc"
3099 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3100 (match_operand:DI 2 "general_operand" "d,m"))
3102 (set (match_operand:DI 0 "register_operand" "=d,d")
3103 (plus:DI (match_dup 1) (match_dup 2)))]
3104 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3108 [(set_attr "op_type" "RRE,RXE")
3109 (set_attr "atype" "reg,mem")])
3111 (define_insn "*adddi3_cconly"
3113 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3114 (match_operand:DI 2 "general_operand" "d,m"))
3116 (clobber (match_scratch:DI 0 "=d,d"))]
3117 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3121 [(set_attr "op_type" "RRE,RXE")
3122 (set_attr "atype" "reg,mem")])
3124 (define_insn "*adddi3_cconly2"
3126 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3127 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3128 (clobber (match_scratch:DI 0 "=d,d"))]
3129 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3133 [(set_attr "op_type" "RRE,RXE")
3134 (set_attr "atype" "reg,mem")])
3136 (define_insn "*adddi3_64"
3137 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3138 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3139 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3140 (clobber (reg:CC 33))]
3146 [(set_attr "op_type" "RRE,RI,RXE")
3147 (set_attr "atype" "reg,reg,mem")])
3149 (define_insn_and_split "*adddi3_31"
3150 [(set (match_operand:DI 0 "register_operand" "=&d")
3151 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3152 (match_operand:DI 2 "general_operand" "dm") ) )
3153 (clobber (reg:CC 33))]
3156 "&& reload_completed"
3158 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3159 (clobber (reg:CC 33))])
3162 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3164 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3166 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3168 (label_ref (match_dup 9))))
3170 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3171 (clobber (reg:CC 33))])
3173 "operands[3] = operand_subword (operands[0], 0, 1, DImode);
3174 operands[4] = operand_subword (operands[1], 0, 1, DImode);
3175 operands[5] = operand_subword (operands[2], 0, 1, DImode);
3176 operands[6] = operand_subword (operands[0], 1, 1, DImode);
3177 operands[7] = operand_subword (operands[1], 1, 1, DImode);
3178 operands[8] = operand_subword (operands[2], 1, 1, DImode);
3179 operands[9] = gen_label_rtx ();"
3180 [(set_attr "op_type" "NN")
3181 (set_attr "type" "o3")])
3183 (define_expand "adddi3"
3185 [(set (match_operand:DI 0 "register_operand" "")
3186 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3187 (match_operand:DI 2 "general_operand" "")))
3188 (clobber (reg:CC 33))])]
3192 (define_insn "*la_64"
3193 [(set (match_operand:DI 0 "register_operand" "=d")
3194 (match_operand:QI 1 "address_operand" "p"))]
3197 [(set_attr "op_type" "RX")
3198 (set_attr "atype" "mem")
3199 (set_attr "type" "la")])
3201 (define_expand "reload_indi"
3202 [(parallel [(match_operand:DI 0 "register_operand" "=a")
3203 (match_operand:DI 1 "s390_plus_operand" "")
3204 (match_operand:DI 2 "register_operand" "=&a")])]
3208 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3214 ; addsi3 instruction pattern(s).
3217 (define_insn "*la_ccclobber"
3218 [(set (match_operand:SI 0 "register_operand" "=d")
3219 (match_operand:QI 1 "address_operand" "p"))
3220 (clobber (reg:CC 33))]
3221 "legitimate_la_operand_p (operands[1])"
3223 [(set_attr "op_type" "RX")
3224 (set_attr "atype" "mem")
3225 (set_attr "type" "la")])
3227 (define_insn "*addsi3_imm_cc"
3229 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3230 (match_operand:SI 2 "const_int_operand" "K"))
3232 (set (match_operand:SI 0 "register_operand" "=d")
3233 (plus:SI (match_dup 1) (match_dup 2)))]
3234 "s390_match_ccmode (insn, CCAmode)
3235 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
3237 [(set_attr "op_type" "RI")
3238 (set_attr "atype" "reg")])
3240 (define_insn "*addsi3_carry1_cc"
3242 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
3243 (match_operand:SI 2 "general_operand" "d,m"))
3245 (set (match_operand:SI 0 "register_operand" "=d,d")
3246 (plus:SI (match_dup 1) (match_dup 2)))]
3247 "s390_match_ccmode (insn, CCL1mode)"
3251 [(set_attr "op_type" "RR,RX")
3252 (set_attr "atype" "reg,mem")])
3254 (define_insn "*addsi3_carry1_cconly"
3256 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
3257 (match_operand:SI 2 "general_operand" "d,m"))
3259 (clobber (match_scratch:SI 0 "=d,d"))]
3260 "s390_match_ccmode (insn, CCL1mode)"
3264 [(set_attr "op_type" "RR,RX")
3265 (set_attr "atype" "reg,mem")])
3267 (define_insn "*addsi3_carry2_cc"
3269 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
3270 (match_operand:SI 2 "general_operand" "d,m"))
3272 (set (match_operand:SI 0 "register_operand" "=d,d")
3273 (plus:SI (match_dup 1) (match_dup 2)))]
3274 "s390_match_ccmode (insn, CCL1mode)"
3278 [(set_attr "op_type" "RR,RX")
3279 (set_attr "atype" "reg,mem")])
3281 (define_insn "*addsi3_carry2_cconly"
3283 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
3284 (match_operand:SI 2 "general_operand" "d,m"))
3286 (clobber (match_scratch:SI 0 "=d,d"))]
3287 "s390_match_ccmode (insn, CCL1mode)"
3291 [(set_attr "op_type" "RR,RX")
3292 (set_attr "atype" "reg,mem")])
3294 (define_insn "*addsi3_cc"
3296 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
3297 (match_operand:SI 2 "general_operand" "d,m"))
3299 (set (match_operand:SI 0 "register_operand" "=d,d")
3300 (plus:SI (match_dup 1) (match_dup 2)))]
3301 "s390_match_ccmode (insn, CCLmode)"
3305 [(set_attr "op_type" "RR,RX")
3306 (set_attr "atype" "reg,mem")])
3308 (define_insn "*addsi3_cconly"
3310 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
3311 (match_operand:SI 2 "general_operand" "d,m"))
3313 (clobber (match_scratch:SI 0 "=d,d"))]
3314 "s390_match_ccmode (insn, CCLmode)"
3318 [(set_attr "op_type" "RR,RX")
3319 (set_attr "atype" "reg,mem")])
3321 (define_insn "*addsi3_cconly2"
3323 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0")
3324 (neg:SI (match_operand:SI 2 "general_operand" "d,m"))))
3325 (clobber (match_scratch:SI 0 "=d,d"))]
3326 "s390_match_ccmode(insn, CCLmode)"
3330 [(set_attr "op_type" "RR,RX")
3331 (set_attr "atype" "reg,mem")])
3333 (define_insn "*addsi3_sign"
3334 [(set (match_operand:SI 0 "register_operand" "=d")
3335 (plus:SI (match_operand:SI 1 "register_operand" "0")
3336 (sign_extend:SI (match_operand:HI 2 "memory_operand" "m"))))
3337 (clobber (reg:CC 33))]
3340 [(set_attr "op_type" "RX")
3341 (set_attr "atype" "mem")])
3343 (define_insn "*addsi3_sub"
3344 [(set (match_operand:SI 0 "register_operand" "=d")
3345 (plus:SI (match_operand:SI 1 "register_operand" "0")
3346 (subreg:SI (match_operand:HI 2 "memory_operand" "m") 0)))
3347 (clobber (reg:CC 33))]
3350 [(set_attr "op_type" "RX")
3351 (set_attr "atype" "mem")])
3353 (define_insn "addsi3"
3354 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
3355 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3356 (match_operand:SI 2 "general_operand" "d,K,m")))
3357 (clobber (reg:CC 33))]
3363 [(set_attr "op_type" "RR,RI,RX")
3364 (set_attr "atype" "reg,reg,mem")])
3366 (define_insn "*la_31"
3367 [(set (match_operand:SI 0 "register_operand" "=d")
3368 (match_operand:QI 1 "address_operand" "p"))]
3369 "legitimate_la_operand_p (operands[1])"
3371 [(set_attr "op_type" "RX")
3372 (set_attr "atype" "mem")
3373 (set_attr "type" "la")])
3375 (define_expand "reload_insi"
3376 [(parallel [(match_operand:SI 0 "register_operand" "=a")
3377 (match_operand:SI 1 "s390_plus_operand" "")
3378 (match_operand:SI 2 "register_operand" "=&a")])]
3382 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3388 ; adddf3 instruction pattern(s).
3391 (define_expand "adddf3"
3393 [(set (match_operand:DF 0 "register_operand" "=f,f")
3394 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3395 (match_operand:DF 2 "general_operand" "f,m")))
3396 (clobber (reg:CC 33))])]
3400 (define_insn "*adddf3"
3401 [(set (match_operand:DF 0 "register_operand" "=f,f")
3402 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3403 (match_operand:DF 2 "general_operand" "f,m")))
3404 (clobber (reg:CC 33))]
3405 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3409 [(set_attr "op_type" "RRE,RXE")
3410 (set_attr "atype" "reg,mem")])
3412 (define_insn "*adddf3_ibm"
3413 [(set (match_operand:DF 0 "register_operand" "=f,f")
3414 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3415 (match_operand:DF 2 "general_operand" "f,m")))
3416 (clobber (reg:CC 33))]
3417 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3421 [(set_attr "op_type" "RR,RX")
3422 (set_attr "atype" "reg,mem")])
3425 ; addsf3 instruction pattern(s).
3428 (define_expand "addsf3"
3430 [(set (match_operand:SF 0 "register_operand" "=f,f")
3431 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3432 (match_operand:SF 2 "general_operand" "f,m")))
3433 (clobber (reg:CC 33))])]
3437 (define_insn "*addsf3"
3438 [(set (match_operand:SF 0 "register_operand" "=f,f")
3439 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3440 (match_operand:SF 2 "general_operand" "f,m")))
3441 (clobber (reg:CC 33))]
3442 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3446 [(set_attr "op_type" "RRE,RXE")
3447 (set_attr "atype" "reg,mem")])
3449 (define_insn "*addsf3"
3450 [(set (match_operand:SF 0 "register_operand" "=f,f")
3451 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3452 (match_operand:SF 2 "general_operand" "f,m")))
3453 (clobber (reg:CC 33))]
3454 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3458 [(set_attr "op_type" "RR,RX")
3459 (set_attr "atype" "reg,mem")])
3463 ;;- Subtract instructions.
3467 ; subdi3 instruction pattern(s).
3470 (define_insn "*subdi3_sign"
3471 [(set (match_operand:DI 0 "register_operand" "=d,d")
3472 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3473 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3474 (clobber (reg:CC 33))]
3479 [(set_attr "op_type" "RRE,RXE")
3480 (set_attr "atype" "reg,mem")])
3482 (define_insn "*subdi3_zero_cc"
3484 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3485 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3487 (set (match_operand:DI 0 "register_operand" "=d,d")
3488 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3489 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3493 [(set_attr "op_type" "RRE,RXE")
3494 (set_attr "atype" "reg,mem")])
3496 (define_insn "*subdi3_zero_cconly"
3498 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3499 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3501 (clobber (match_scratch:DI 0 "=d,d"))]
3502 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3506 [(set_attr "op_type" "RRE,RXE")
3507 (set_attr "atype" "reg,mem")])
3509 (define_insn "*subdi3_zero"
3510 [(set (match_operand:DI 0 "register_operand" "=d,d")
3511 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3512 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3513 (clobber (reg:CC 33))]
3518 [(set_attr "op_type" "RRE,RXE")
3519 (set_attr "atype" "reg,mem")])
3521 (define_insn "*subdi3_cc"
3523 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3524 (match_operand:DI 2 "general_operand" "d,m"))
3526 (set (match_operand:DI 0 "register_operand" "=d,d")
3527 (minus:DI (match_dup 1) (match_dup 2)))]
3528 "s390_match_ccmode (insn, CCLmode)"
3532 [(set_attr "op_type" "RRE,RXE")
3533 (set_attr "atype" "reg,mem")])
3535 (define_insn "*subdi3_cconly"
3537 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3538 (match_operand:DI 2 "general_operand" "d,m"))
3540 (clobber (match_scratch:DI 0 "=d,d"))]
3541 "s390_match_ccmode (insn, CCLmode)"
3545 [(set_attr "op_type" "RRE,RXE")
3546 (set_attr "atype" "reg,mem")])
3548 (define_insn "*subdi3_64"
3549 [(set (match_operand:DI 0 "register_operand" "=d,d")
3550 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3551 (match_operand:DI 2 "general_operand" "d,m") ) )
3552 (clobber (reg:CC 33))]
3557 [(set_attr "op_type" "RRE,RRE")
3558 (set_attr "atype" "reg,mem")])
3560 (define_insn_and_split "*subdi3_31"
3561 [(set (match_operand:DI 0 "register_operand" "=&d")
3562 (minus:DI (match_operand:DI 1 "register_operand" "0")
3563 (match_operand:DI 2 "general_operand" "dm") ) )
3564 (clobber (reg:CC 33))]
3567 "&& reload_completed"
3569 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3570 (clobber (reg:CC 33))])
3573 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3575 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3577 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3579 (label_ref (match_dup 9))))
3581 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3582 (clobber (reg:CC 33))])
3584 "operands[3] = operand_subword (operands[0], 0, 1, DImode);
3585 operands[4] = operand_subword (operands[1], 0, 1, DImode);
3586 operands[5] = operand_subword (operands[2], 0, 1, DImode);
3587 operands[6] = operand_subword (operands[0], 1, 1, DImode);
3588 operands[7] = operand_subword (operands[1], 1, 1, DImode);
3589 operands[8] = operand_subword (operands[2], 1, 1, DImode);
3590 operands[9] = gen_label_rtx ();"
3591 [(set_attr "op_type" "NN")
3592 (set_attr "type" "o3")])
3594 (define_expand "subdi3"
3596 [(set (match_operand:DI 0 "register_operand" "")
3597 (minus:DI (match_operand:DI 1 "register_operand" "")
3598 (match_operand:DI 2 "general_operand" "")))
3599 (clobber (reg:CC 33))])]
3604 ; subsi3 instruction pattern(s).
3607 (define_insn "*subsi3_borrow_cc"
3609 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3610 (match_operand:SI 2 "general_operand" "d,m"))
3612 (set (match_operand:SI 0 "register_operand" "=d,d")
3613 (minus:SI (match_dup 1) (match_dup 2)))]
3614 "s390_match_ccmode(insn, CCL2mode)"
3618 [(set_attr "op_type" "RR,RX")
3619 (set_attr "atype" "reg,mem")])
3621 (define_insn "*subsi3_borrow_cconly"
3623 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3624 (match_operand:SI 2 "general_operand" "d,m"))
3626 (clobber (match_scratch:SI 0 "=d,d"))]
3627 "s390_match_ccmode(insn, CCL2mode)"
3631 [(set_attr "op_type" "RR,RX")
3632 (set_attr "atype" "reg,mem")])
3634 (define_insn "*subsi3_cc"
3636 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3637 (match_operand:SI 2 "general_operand" "d,m"))
3639 (set (match_operand:SI 0 "register_operand" "=d,d")
3640 (minus:SI (match_dup 1) (match_dup 2)))]
3641 "s390_match_ccmode(insn, CCLmode)"
3645 [(set_attr "op_type" "RR,RX")
3646 (set_attr "atype" "reg,mem")])
3648 (define_insn "*subsi3_cconly"
3650 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3651 (match_operand:SI 2 "general_operand" "d,m"))
3653 (clobber (match_scratch:SI 0 "=d,d"))]
3654 "s390_match_ccmode(insn, CCLmode)"
3658 [(set_attr "op_type" "RR,RX")
3659 (set_attr "atype" "reg,mem")])
3661 (define_insn "*subsi3_sign"
3662 [(set (match_operand:SI 0 "register_operand" "=d")
3663 (minus:SI (match_operand:SI 1 "register_operand" "0")
3664 (sign_extend:SI (match_operand:HI 2 "memory_operand" "m"))))
3665 (clobber (reg:CC 33))]
3668 [(set_attr "op_type" "RX")
3669 (set_attr "atype" "mem")])
3671 (define_insn "*subsi3_sub"
3672 [(set (match_operand:SI 0 "register_operand" "=d")
3673 (minus:SI (match_operand:SI 1 "register_operand" "0")
3674 (subreg:SI (match_operand:HI 2 "memory_operand" "m") 0)))
3675 (clobber (reg:CC 33))]
3678 [(set_attr "op_type" "RX")
3679 (set_attr "atype" "mem")])
3681 (define_insn "subsi3"
3682 [(set (match_operand:SI 0 "register_operand" "=d,d")
3683 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3684 (match_operand:SI 2 "general_operand" "d,m")))
3685 (clobber (reg:CC 33))]
3690 [(set_attr "op_type" "RR,RX")
3691 (set_attr "atype" "reg,mem")])
3695 ; subdf3 instruction pattern(s).
3698 (define_expand "subdf3"
3700 [(set (match_operand:DF 0 "register_operand" "=f,f")
3701 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3702 (match_operand:DF 2 "general_operand" "f,m")))
3703 (clobber (reg:CC 33))])]
3707 (define_insn "*subdf3"
3708 [(set (match_operand:DF 0 "register_operand" "=f,f")
3709 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3710 (match_operand:DF 2 "general_operand" "f,m")))
3711 (clobber (reg:CC 33))]
3712 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3716 [(set_attr "op_type" "RRE,RXE")
3717 (set_attr "atype" "reg,mem")])
3719 (define_insn "*subdf3_ibm"
3720 [(set (match_operand:DF 0 "register_operand" "=f,f")
3721 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3722 (match_operand:DF 2 "general_operand" "f,m")))
3723 (clobber (reg:CC 33))]
3724 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3728 [(set_attr "op_type" "RR,RX")
3729 (set_attr "atype" "reg,mem")])
3732 ; subsf3 instruction pattern(s).
3735 (define_expand "subsf3"
3737 [(set (match_operand:SF 0 "register_operand" "=f,f")
3738 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
3739 (match_operand:SF 2 "general_operand" "f,m")))
3740 (clobber (reg:CC 33))])]
3744 (define_insn "*subsf3"
3745 [(set (match_operand:SF 0 "register_operand" "=f,f")
3746 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
3747 (match_operand:SF 2 "general_operand" "f,m")))
3748 (clobber (reg:CC 33))]
3749 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3753 [(set_attr "op_type" "RRE,RXE")
3754 (set_attr "atype" "reg,mem")])
3756 (define_insn "*subsf3_ibm"
3757 [(set (match_operand:SF 0 "register_operand" "=f,f")
3758 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
3759 (match_operand:SF 2 "general_operand" "f,m")))
3760 (clobber (reg:CC 33))]
3761 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3765 [(set_attr "op_type" "RR,RX")
3766 (set_attr "atype" "reg,mem")])
3770 ;;- Multiply instructions.
3774 ; muldi3 instruction pattern(s).
3777 (define_insn "*muldi3_sign"
3778 [(set (match_operand:DI 0 "register_operand" "=d,d")
3779 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
3780 (match_operand:DI 1 "register_operand" "0,0")))]
3785 [(set_attr "op_type" "RRE,RXE")
3786 (set_attr "atype" "reg,mem")
3787 (set_attr "type" "imul")])
3790 (define_insn "muldi3"
3791 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3792 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3793 (match_operand:DI 2 "general_operand" "d,K,m")))]
3799 [(set_attr "op_type" "RRE,RI,RXE")
3800 (set_attr "atype" "reg,reg,mem")
3801 (set_attr "type" "imul")])
3804 ; mulsi3 instruction pattern(s).
3807 (define_insn "mulsi3"
3808 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
3809 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3810 (match_operand:SI 2 "general_operand" "d,K,m")))]
3816 [(set_attr "op_type" "RRE,RI,RX")
3817 (set_attr "atype" "reg,reg,mem")
3818 (set_attr "type" "imul")])
3821 ; mulsidi3 instruction pattern(s).
3824 (define_expand "mulsidi3"
3825 [(set (match_operand:DI 0 "register_operand" "")
3826 (mult:DI (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" ""))
3827 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" ""))))]
3833 emit_insn (gen_zero_extendsidi2 (operands[0], operands[1]));
3834 insn = emit_insn (gen_mulsi_6432 (operands[0], operands[0], operands[2]));
3837 gen_rtx_EXPR_LIST (REG_EQUAL,
3838 gen_rtx_MULT (DImode,
3839 gen_rtx_SIGN_EXTEND (DImode, operands[1]),
3840 gen_rtx_SIGN_EXTEND (DImode, operands[2])),
3845 (define_insn "mulsi_6432"
3846 [(set (match_operand:DI 0 "register_operand" "=d,d")
3847 (mult:DI (sign_extend:DI
3848 (truncate:SI (match_operand:DI 1 "register_operand" "0,0")))
3850 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
3855 [(set_attr "op_type" "RR,RX")
3856 (set_attr "atype" "reg,mem")
3857 (set_attr "type" "imul")])
3860 ; muldf3 instruction pattern(s).
3863 (define_expand "muldf3"
3865 [(set (match_operand:DF 0 "register_operand" "=f,f")
3866 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3867 (match_operand:DF 2 "general_operand" "f,m")))
3868 (clobber (reg:CC 33))])]
3872 (define_insn "*muldf3"
3873 [(set (match_operand:DF 0 "register_operand" "=f,f")
3874 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3875 (match_operand:DF 2 "general_operand" "f,m")))
3876 (clobber (reg:CC 33))]
3877 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3881 [(set_attr "op_type" "RRE,RXE")
3882 (set_attr "type" "fmul")
3883 (set_attr "atype" "reg,mem")])
3885 (define_insn "*muldf3_ibm"
3886 [(set (match_operand:DF 0 "register_operand" "=f,f")
3887 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3888 (match_operand:DF 2 "general_operand" "f,m")))
3889 (clobber (reg:CC 33))]
3890 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3894 [(set_attr "op_type" "RR,RX")
3895 (set_attr "type" "fmul")
3896 (set_attr "atype" "reg,mem")])
3899 ; mulsf3 instruction pattern(s).
3902 (define_expand "mulsf3"
3904 [(set (match_operand:SF 0 "register_operand" "=f,f")
3905 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3906 (match_operand:SF 2 "general_operand" "f,m")))
3907 (clobber (reg:CC 33))])]
3911 (define_insn "*mulsf3"
3912 [(set (match_operand:SF 0 "register_operand" "=f,f")
3913 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3914 (match_operand:SF 2 "general_operand" "f,m")))
3915 (clobber (reg:CC 33))]
3916 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3920 [(set_attr "op_type" "RRE,RXE")
3921 (set_attr "type" "fmul")
3922 (set_attr "atype" "reg,mem")])
3924 (define_insn "*mulsf3_ibm"
3925 [(set (match_operand:SF 0 "register_operand" "=f,f")
3926 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3927 (match_operand:SF 2 "general_operand" "f,m")))
3928 (clobber (reg:CC 33))]
3929 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3933 [(set_attr "op_type" "RR,RX")
3934 (set_attr "type" "fmul")
3935 (set_attr "atype" "reg,mem")])
3939 ;;- Divide and modulo instructions.
3943 ; divmoddi4 instruction pattern(s).
3946 (define_expand "divmoddi4"
3947 [(parallel [(set (match_operand:DI 0 "general_operand" "")
3948 (div:DI (match_operand:DI 1 "general_operand" "")
3949 (match_operand:DI 2 "general_operand" "")))
3950 (set (match_operand:DI 3 "general_operand" "")
3951 (mod:DI (match_dup 1) (match_dup 2)))])
3952 (clobber (match_dup 4))]
3956 rtx insn, div_equal, mod_equal, equal;
3958 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
3959 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
3960 equal = gen_rtx_IOR (TImode,
3961 gen_rtx_ZERO_EXTEND (TImode, div_equal),
3962 gen_rtx_ASHIFT (TImode,
3963 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
3966 operands[4] = gen_reg_rtx(TImode);
3967 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
3968 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
3969 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
3970 insn = emit_insn (gen_divmodtidi3 (operands[4], operands[4], operands[2]));
3972 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
3974 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
3976 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
3978 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
3980 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
3985 (define_insn "divmodtidi3"
3986 [(set (match_operand:TI 0 "register_operand" "=d,d")
3989 (div:DI (truncate:DI (match_operand:TI 1 "register_operand" "0,0"))
3990 (match_operand:DI 2 "general_operand" "d,m")))
3993 (mod:DI (truncate:DI (match_dup 1))
4000 [(set_attr "op_type" "RRE,RXE")
4001 (set_attr "type" "idiv")
4002 (set_attr "atype" "reg,mem")])
4004 (define_insn "divmodtisi3"
4005 [(set (match_operand:TI 0 "register_operand" "=d,d")
4008 (div:DI (truncate:DI (match_operand:TI 1 "register_operand" "0,0"))
4009 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4012 (mod:DI (truncate:DI (match_dup 1))
4013 (sign_extend:DI (match_dup 2))))
4019 [(set_attr "op_type" "RRE,RXE")
4020 (set_attr "type" "idiv")
4021 (set_attr "atype" "reg,mem")])
4024 ; udivmoddi4 instruction pattern(s).
4027 (define_expand "udivmoddi4"
4028 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4029 (udiv:DI (match_operand:DI 1 "general_operand" "")
4030 (match_operand:DI 2 "nonimmediate_operand" "")))
4031 (set (match_operand:DI 3 "general_operand" "")
4032 (umod:DI (match_dup 1) (match_dup 2)))])
4033 (clobber (match_dup 4))]
4037 rtx insn, div_equal, mod_equal, equal;
4039 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4040 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4041 equal = gen_rtx_IOR (TImode,
4042 gen_rtx_ZERO_EXTEND (TImode, div_equal),
4043 gen_rtx_ASHIFT (TImode,
4044 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4047 operands[4] = gen_reg_rtx(TImode);
4048 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4049 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4050 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4051 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4053 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4055 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4057 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4059 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4061 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4066 (define_insn "udivmodtidi3"
4067 [(set (match_operand:TI 0 "register_operand" "=d,d")
4068 (ior:TI (zero_extend:TI
4070 (udiv:TI (match_operand:TI 1 "register_operand" "0,0")
4072 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4076 (umod:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))
4082 [(set_attr "op_type" "RRE,RXE")
4083 (set_attr "type" "idiv")
4084 (set_attr "atype" "reg,mem")])
4087 ; divmodsi4 instruction pattern(s).
4090 (define_expand "divmodsi4"
4091 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4092 (div:SI (match_operand:SI 1 "general_operand" "")
4093 (match_operand:SI 2 "nonimmediate_operand" "")))
4094 (set (match_operand:SI 3 "general_operand" "")
4095 (mod:SI (match_dup 1) (match_dup 2)))])
4096 (clobber (match_dup 4))]
4100 rtx insn, div_equal, mod_equal, equal;
4102 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4103 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4104 equal = gen_rtx_IOR (DImode,
4105 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4106 gen_rtx_ASHIFT (DImode,
4107 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4110 operands[4] = gen_reg_rtx(DImode);
4111 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4112 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4114 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4116 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4118 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4120 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4122 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4127 (define_insn "divmoddisi3"
4128 [(set (match_operand:DI 0 "register_operand" "=d,d")
4129 (ior:DI (zero_extend:DI
4131 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4133 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4137 (mod:DI (match_dup 1) (sign_extend:SI (match_dup 2)))))
4143 [(set_attr "op_type" "RR,RX")
4144 (set_attr "type" "idiv")
4145 (set_attr "atype" "reg,mem")])
4148 ; udivsi3 and umodsi3 instruction pattern(s).
4152 (define_expand "udivsi3"
4153 [(set (match_operand:SI 0 "register_operand" "=d")
4154 (udiv:SI (match_operand:SI 1 "general_operand" "")
4155 (match_operand:SI 2 "general_operand" "")))
4156 (clobber (match_dup 3))]
4160 rtx insn, udiv_equal, umod_equal, equal;
4162 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4163 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4164 equal = gen_rtx_IOR (DImode,
4165 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4166 gen_rtx_ASHIFT (DImode,
4167 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4170 operands[3] = gen_reg_rtx (DImode);
4172 if (CONSTANT_P (operands[2]))
4174 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4176 rtx label1 = gen_label_rtx ();
4178 operands[1] = make_safe_from (operands[1], operands[0]);
4179 emit_move_insn (operands[0], const0_rtx);
4180 emit_insn (gen_cmpsi (operands[1], operands[2]));
4181 emit_jump_insn (gen_bltu (label1));
4182 emit_move_insn (operands[0], const1_rtx);
4183 emit_label (label1);
4187 operands[2] = force_reg (SImode, operands[2]);
4188 operands[2] = make_safe_from (operands[2], operands[0]);
4190 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4191 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4194 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4196 insn = emit_move_insn (operands[0],
4197 gen_lowpart (SImode, operands[3]));
4199 gen_rtx_EXPR_LIST (REG_EQUAL,
4200 udiv_equal, REG_NOTES (insn));
4205 rtx label1 = gen_label_rtx ();
4206 rtx label2 = gen_label_rtx ();
4207 rtx label3 = gen_label_rtx ();
4209 operands[1] = force_reg (SImode, operands[1]);
4210 operands[1] = make_safe_from (operands[1], operands[0]);
4211 operands[2] = force_reg (SImode, operands[2]);
4212 operands[2] = make_safe_from (operands[2], operands[0]);
4214 emit_move_insn (operands[0], const0_rtx);
4215 emit_insn (gen_cmpsi (operands[2], operands[1]));
4216 emit_jump_insn (gen_bgtu (label3));
4217 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4218 emit_jump_insn (gen_blt (label2));
4219 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4220 emit_jump_insn (gen_beq (label1));
4221 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4222 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4225 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4227 insn = emit_move_insn (operands[0],
4228 gen_lowpart (SImode, operands[3]));
4230 gen_rtx_EXPR_LIST (REG_EQUAL,
4231 udiv_equal, REG_NOTES (insn));
4233 emit_label (label1);
4234 emit_move_insn (operands[0], operands[1]);
4236 emit_label (label2);
4237 emit_move_insn (operands[0], const1_rtx);
4238 emit_label (label3);
4240 emit_move_insn (operands[0], operands[0]);
4244 (define_expand "umodsi3"
4245 [(set (match_operand:SI 0 "register_operand" "=d")
4246 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4247 (match_operand:SI 2 "nonimmediate_operand" "")))
4248 (clobber (match_dup 3))]
4252 rtx insn, udiv_equal, umod_equal, equal;
4254 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4255 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4256 equal = gen_rtx_IOR (DImode,
4257 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4258 gen_rtx_ASHIFT (DImode,
4259 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4262 operands[3] = gen_reg_rtx (DImode);
4264 if (CONSTANT_P (operands[2]))
4266 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4268 rtx label1 = gen_label_rtx ();
4270 operands[1] = make_safe_from (operands[1], operands[0]);
4271 emit_move_insn (operands[0], operands[1]);
4272 emit_insn (gen_cmpsi (operands[0], operands[2]));
4273 emit_jump_insn (gen_bltu (label1));
4274 emit_insn (gen_abssi2 (operands[0], operands[2]));
4275 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4276 emit_label (label1);
4280 operands[2] = force_reg (SImode, operands[2]);
4281 operands[2] = make_safe_from (operands[2], operands[0]);
4283 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4284 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4287 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4289 insn = emit_move_insn (operands[0],
4290 gen_highpart (SImode, operands[3]));
4292 gen_rtx_EXPR_LIST (REG_EQUAL,
4293 umod_equal, REG_NOTES (insn));
4298 rtx label1 = gen_label_rtx ();
4299 rtx label2 = gen_label_rtx ();
4300 rtx label3 = gen_label_rtx ();
4302 operands[1] = force_reg (SImode, operands[1]);
4303 operands[1] = make_safe_from (operands[1], operands[0]);
4304 operands[2] = force_reg (SImode, operands[2]);
4305 operands[2] = make_safe_from (operands[2], operands[0]);
4307 emit_move_insn(operands[0], operands[1]);
4308 emit_insn (gen_cmpsi (operands[2], operands[1]));
4309 emit_jump_insn (gen_bgtu (label3));
4310 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4311 emit_jump_insn (gen_blt (label2));
4312 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4313 emit_jump_insn (gen_beq (label1));
4314 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4315 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4318 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4320 insn = emit_move_insn (operands[0],
4321 gen_highpart (SImode, operands[3]));
4323 gen_rtx_EXPR_LIST (REG_EQUAL,
4324 umod_equal, REG_NOTES (insn));
4326 emit_label (label1);
4327 emit_move_insn (operands[0], const0_rtx);
4329 emit_label (label2);
4330 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4331 emit_label (label3);
4337 ; divdf3 instruction pattern(s).
4340 (define_expand "divdf3"
4342 [(set (match_operand:DF 0 "register_operand" "=f,f")
4343 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4344 (match_operand:DF 2 "general_operand" "f,m")))
4345 (clobber (reg:CC 33))])]
4349 (define_insn "*divdf3"
4350 [(set (match_operand:DF 0 "register_operand" "=f,f")
4351 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4352 (match_operand:DF 2 "general_operand" "f,m")))
4353 (clobber (reg:CC 33))]
4354 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4358 [(set_attr "op_type" "RRE,RXE")
4359 (set_attr "type" "fdiv")
4360 (set_attr "atype" "reg,mem")])
4362 (define_insn "*divdf3_ibm"
4363 [(set (match_operand:DF 0 "register_operand" "=f,f")
4364 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4365 (match_operand:DF 2 "general_operand" "f,m")))
4366 (clobber (reg:CC 33))]
4367 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4371 [(set_attr "op_type" "RR,RX")
4372 (set_attr "type" "fdiv")
4373 (set_attr "atype" "reg,mem")])
4376 ; divsf3 instruction pattern(s).
4379 (define_expand "divsf3"
4381 [(set (match_operand:SF 0 "register_operand" "=f,f")
4382 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4383 (match_operand:SF 2 "general_operand" "f,m")))
4384 (clobber (reg:CC 33))])]
4388 (define_insn "*divsf3"
4389 [(set (match_operand:SF 0 "register_operand" "=f,f")
4390 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4391 (match_operand:SF 2 "general_operand" "f,m")))
4392 (clobber (reg:CC 33))]
4393 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4397 [(set_attr "op_type" "RRE,RXE")
4398 (set_attr "type" "fdiv")
4399 (set_attr "atype" "reg,mem")])
4401 (define_insn "*divsf3"
4402 [(set (match_operand:SF 0 "register_operand" "=f,f")
4403 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4404 (match_operand:SF 2 "general_operand" "f,m")))
4405 (clobber (reg:CC 33))]
4406 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4410 [(set_attr "op_type" "RR,RX")
4411 (set_attr "type" "fdiv")
4412 (set_attr "atype" "reg,mem")])
4416 ;;- And instructions.
4420 ; anddi3 instruction pattern(s).
4423 (define_insn "*anddi3_cc"
4425 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4426 (match_operand:DI 2 "general_operand" "d,m"))
4428 (set (match_operand:DI 0 "register_operand" "=d,d")
4429 (and:DI (match_dup 1) (match_dup 2)))]
4430 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4434 [(set_attr "op_type" "RRE,RXE")
4435 (set_attr "atype" "reg,mem")])
4437 (define_insn "*anddi3_cconly"
4439 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4440 (match_operand:DI 2 "general_operand" "d,m"))
4442 (clobber (match_scratch:DI 0 "=d,d"))]
4443 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4447 [(set_attr "op_type" "RRE,RXE")
4448 (set_attr "atype" "reg,mem")])
4450 (define_insn "*anddi3_ni"
4451 [(set (match_operand:DI 0 "register_operand" "=d")
4452 (and:DI (match_operand:DI 1 "nonimmediate_operand" "0")
4453 (match_operand:DI 2 "immediate_operand" "n")))
4454 (clobber (reg:CC 33))]
4455 "TARGET_64BIT && s390_single_hi (operands[2], DImode, -1) >= 0"
4458 int part = s390_single_hi (operands[2], DImode, -1);
4459 operands[2] = GEN_INT (s390_extract_hi (operands[2], DImode, part));
4463 case 0: return \"nihh\\t%0,%x2\";
4464 case 1: return \"nihl\\t%0,%x2\";
4465 case 2: return \"nilh\\t%0,%x2\";
4466 case 3: return \"nill\\t%0,%x2\";
4470 [(set_attr "op_type" "RI")
4471 (set_attr "atype" "reg")])
4473 (define_insn "anddi3"
4474 [(set (match_operand:DI 0 "register_operand" "=d,d")
4475 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4476 (match_operand:DI 2 "general_operand" "d,m")))
4477 (clobber (reg:CC 33))]
4482 [(set_attr "op_type" "RRE,RXE")
4483 (set_attr "atype" "reg,mem")])
4485 (define_insn "*anddi3_ss"
4486 [(set (match_operand:DI 0 "s_operand" "=Q")
4487 (and:DI (match_dup 0)
4488 (match_operand:DI 1 "s_imm_operand" "Q")))
4489 (clobber (reg:CC 33))]
4491 "nc\\t%O0(8,%R0),%1"
4492 [(set_attr "op_type" "SS")
4493 (set_attr "atype" "mem")])
4495 (define_insn "*anddi3_ss_inv"
4496 [(set (match_operand:DI 0 "s_operand" "=Q")
4497 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
4499 (clobber (reg:CC 33))]
4501 "nc\\t%O0(8,%R0),%1"
4502 [(set_attr "op_type" "SS")
4503 (set_attr "atype" "mem")])
4506 ; andsi3 instruction pattern(s).
4509 (define_insn "*andsi3_cc"
4511 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4512 (match_operand:SI 2 "general_operand" "d,m"))
4514 (set (match_operand:SI 0 "register_operand" "=d,d")
4515 (and:SI (match_dup 1) (match_dup 2)))]
4516 "s390_match_ccmode(insn, CCTmode)"
4520 [(set_attr "op_type" "RR,RX")
4521 (set_attr "atype" "reg,mem")])
4523 (define_insn "*andsi3_cconly"
4525 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4526 (match_operand:SI 2 "general_operand" "d,m"))
4528 (clobber (match_scratch:SI 0 "=d,d"))]
4529 "s390_match_ccmode(insn, CCTmode)"
4533 [(set_attr "op_type" "RR,RX")
4534 (set_attr "atype" "reg,mem")])
4536 (define_insn "*andsi3_ni"
4537 [(set (match_operand:SI 0 "register_operand" "=d")
4538 (and:SI (match_operand:SI 1 "nonimmediate_operand" "0")
4539 (match_operand:SI 2 "immediate_operand" "n")))
4540 (clobber (reg:CC 33))]
4541 "TARGET_64BIT && s390_single_hi (operands[2], SImode, -1) >= 0"
4544 int part = s390_single_hi (operands[2], SImode, -1);
4545 operands[2] = GEN_INT (s390_extract_hi (operands[2], SImode, part));
4549 case 0: return \"nilh\\t%0,%x2\";
4550 case 1: return \"nill\\t%0,%x2\";
4554 [(set_attr "op_type" "RI")
4555 (set_attr "atype" "reg")])
4557 (define_insn "andsi3"
4558 [(set (match_operand:SI 0 "register_operand" "=d,d")
4559 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4560 (match_operand:SI 2 "general_operand" "d,m")))
4561 (clobber (reg:CC 33))]
4566 [(set_attr "op_type" "RR,RX")
4567 (set_attr "atype" "reg,mem")])
4569 (define_insn "*andsi3_ss"
4570 [(set (match_operand:SI 0 "s_operand" "=Q")
4571 (and:SI (match_dup 0)
4572 (match_operand:SI 1 "s_imm_operand" "Q")))
4573 (clobber (reg:CC 33))]
4575 "nc\\t%O0(4,%R0),%1"
4576 [(set_attr "op_type" "SS")
4577 (set_attr "atype" "mem")])
4579 (define_insn "*andsi3_ss_inv"
4580 [(set (match_operand:SI 0 "s_operand" "=Q")
4581 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
4583 (clobber (reg:CC 33))]
4585 "nc\\t%O0(4,%R0),%1"
4586 [(set_attr "op_type" "SS")
4587 (set_attr "atype" "mem")])
4590 ; andhi3 instruction pattern(s).
4593 (define_insn "*andhi3_ni"
4594 [(set (match_operand:HI 0 "register_operand" "=d,d")
4595 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
4596 (match_operand:HI 2 "nonmemory_operand" "d,n")))
4597 (clobber (reg:CC 33))]
4602 [(set_attr "op_type" "RR,RI")
4603 (set_attr "atype" "reg")])
4605 (define_insn "andhi3"
4606 [(set (match_operand:HI 0 "register_operand" "=d")
4607 (and:HI (match_operand:HI 1 "register_operand" "%0")
4608 (match_operand:HI 2 "nonmemory_operand" "d")))
4609 (clobber (reg:CC 33))]
4612 [(set_attr "op_type" "RR")
4613 (set_attr "atype" "reg")])
4615 (define_insn "*andhi3_ss"
4616 [(set (match_operand:HI 0 "s_operand" "=Q")
4617 (and:HI (match_dup 0)
4618 (match_operand:HI 1 "s_imm_operand" "Q")))
4619 (clobber (reg:CC 33))]
4621 "nc\\t%O0(2,%R0),%1"
4622 [(set_attr "op_type" "SS")
4623 (set_attr "atype" "mem")])
4625 (define_insn "*andhi3_ss_inv"
4626 [(set (match_operand:HI 0 "s_operand" "=Q")
4627 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
4629 (clobber (reg:CC 33))]
4631 "nc\\t%O0(2,%R0),%1"
4632 [(set_attr "op_type" "SS")
4633 (set_attr "atype" "mem")])
4636 ; andqi3 instruction pattern(s).
4639 (define_insn "*andqi3_ni"
4640 [(set (match_operand:QI 0 "register_operand" "=d,d")
4641 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
4642 (match_operand:QI 2 "nonmemory_operand" "d,n")))
4643 (clobber (reg:CC 33))]
4648 [(set_attr "op_type" "RR,RI")
4649 (set_attr "atype" "reg")])
4651 (define_insn "andqi3"
4652 [(set (match_operand:QI 0 "register_operand" "=d")
4653 (and:QI (match_operand:QI 1 "register_operand" "%0")
4654 (match_operand:QI 2 "nonmemory_operand" "d")))
4655 (clobber (reg:CC 33))]
4658 [(set_attr "op_type" "RR")
4659 (set_attr "atype" "reg")])
4661 (define_insn "*andqi3_ss"
4662 [(set (match_operand:QI 0 "s_operand" "=Q,Q")
4663 (and:QI (match_dup 0)
4664 (match_operand:QI 1 "s_imm_operand" "n,Q")))
4665 (clobber (reg:CC 33))]
4670 [(set_attr "op_type" "SI,SS")
4671 (set_attr "atype" "mem")])
4673 (define_insn "*andqi3_ss_inv"
4674 [(set (match_operand:QI 0 "s_operand" "=Q,Q")
4675 (and:QI (match_operand:QI 1 "s_imm_operand" "n,Q")
4677 (clobber (reg:CC 33))]
4682 [(set_attr "op_type" "SI,SS")
4683 (set_attr "atype" "mem")])
4687 ;;- Bit set (inclusive or) instructions.
4691 ; iordi3 instruction pattern(s).
4694 (define_insn "*iordi3_cc"
4696 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4697 (match_operand:DI 2 "general_operand" "d,m"))
4699 (set (match_operand:DI 0 "register_operand" "=d,d")
4700 (ior:DI (match_dup 1) (match_dup 2)))]
4701 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4705 [(set_attr "op_type" "RRE,RXE")
4706 (set_attr "atype" "reg,mem")])
4708 (define_insn "*iordi3_cconly"
4710 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4711 (match_operand:DI 2 "general_operand" "d,m"))
4713 (clobber (match_scratch:DI 0 "=d,d"))]
4714 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4718 [(set_attr "op_type" "RRE,RXE")
4719 (set_attr "atype" "reg,mem")])
4721 (define_insn "*iordi3_oi"
4722 [(set (match_operand:DI 0 "register_operand" "=d")
4723 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
4724 (match_operand:DI 2 "immediate_operand" "n")))
4725 (clobber (reg:CC 33))]
4726 "TARGET_64BIT && s390_single_hi (operands[2], DImode, 0) >= 0"
4729 int part = s390_single_hi (operands[2], DImode, 0);
4730 operands[2] = GEN_INT (s390_extract_hi (operands[2], DImode, part));
4734 case 0: return \"oihh\\t%0,%x2\";
4735 case 1: return \"oihl\\t%0,%x2\";
4736 case 2: return \"oilh\\t%0,%x2\";
4737 case 3: return \"oill\\t%0,%x2\";
4741 [(set_attr "op_type" "RI")
4742 (set_attr "atype" "reg")])
4744 (define_insn "iordi3"
4745 [(set (match_operand:DI 0 "register_operand" "=d,d")
4746 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4747 (match_operand:DI 2 "general_operand" "d,m")))
4748 (clobber (reg:CC 33))]
4753 [(set_attr "op_type" "RRE,RXE")
4754 (set_attr "atype" "reg,mem")])
4756 (define_insn "*iordi3_ss"
4757 [(set (match_operand:DI 0 "s_operand" "=Q")
4758 (ior:DI (match_dup 0)
4759 (match_operand:DI 1 "s_imm_operand" "Q")))
4760 (clobber (reg:CC 33))]
4762 "oc\\t%O0(8,%R0),%1"
4763 [(set_attr "op_type" "SS")
4764 (set_attr "atype" "mem")])
4766 (define_insn "*iordi3_ss_inv"
4767 [(set (match_operand:DI 0 "s_operand" "=Q")
4768 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
4770 (clobber (reg:CC 33))]
4772 "oc\\t%O0(8,%R0),%1"
4773 [(set_attr "op_type" "SS")
4774 (set_attr "atype" "mem")])
4777 ; iorsi3 instruction pattern(s).
4780 (define_insn "*iorsi3_cc"
4782 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4783 (match_operand:SI 2 "general_operand" "d,m"))
4785 (set (match_operand:SI 0 "register_operand" "=d,d")
4786 (ior:SI (match_dup 1) (match_dup 2)))]
4787 "s390_match_ccmode(insn, CCTmode)"
4791 [(set_attr "op_type" "RR,RX")
4792 (set_attr "atype" "reg,mem")])
4794 (define_insn "*iorsi3_cconly"
4796 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4797 (match_operand:SI 2 "general_operand" "d,m"))
4799 (clobber (match_scratch:SI 0 "=d,d"))]
4800 "s390_match_ccmode(insn, CCTmode)"
4804 [(set_attr "op_type" "RR,RX")
4805 (set_attr "atype" "reg,mem")])
4807 (define_insn "*iorsi3_oi"
4808 [(set (match_operand:SI 0 "register_operand" "=d")
4809 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
4810 (match_operand:SI 2 "immediate_operand" "n")))
4811 (clobber (reg:CC 33))]
4812 "TARGET_64BIT && s390_single_hi (operands[2], SImode, 0) >= 0"
4815 int part = s390_single_hi (operands[2], SImode, 0);
4816 operands[2] = GEN_INT (s390_extract_hi (operands[2], SImode, part));
4820 case 0: return \"oilh\\t%0,%x2\";
4821 case 1: return \"oill\\t%0,%x2\";
4825 [(set_attr "op_type" "RI")
4826 (set_attr "atype" "reg")])
4828 (define_insn "iorsi3"
4829 [(set (match_operand:SI 0 "register_operand" "=d,d")
4830 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4831 (match_operand:SI 2 "general_operand" "d,m")))
4832 (clobber (reg:CC 33))]
4837 [(set_attr "op_type" "RR,RX")
4838 (set_attr "atype" "reg,mem")])
4840 (define_insn "*iorsi3_ss"
4841 [(set (match_operand:SI 0 "s_operand" "=Q")
4842 (ior:SI (match_dup 0)
4843 (match_operand:SI 1 "s_imm_operand" "Q")))
4844 (clobber (reg:CC 33))]
4846 "oc\\t%O0(4,%R0),%1"
4847 [(set_attr "op_type" "SS")
4848 (set_attr "atype" "mem")])
4850 (define_insn "*iorsi3_ss_inv"
4851 [(set (match_operand:SI 0 "s_operand" "=Q")
4852 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
4854 (clobber (reg:CC 33))]
4856 "oc\\t%O0(4,%R0),%1"
4857 [(set_attr "op_type" "SS")
4858 (set_attr "atype" "mem")])
4861 ; iorhi3 instruction pattern(s).
4864 (define_insn "*iorhi3_oi"
4865 [(set (match_operand:HI 0 "register_operand" "=d,d")
4866 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
4867 (match_operand:HI 2 "nonmemory_operand" "d,n")))
4868 (clobber (reg:CC 33))]
4873 [(set_attr "op_type" "RR,RI")
4874 (set_attr "atype" "reg")])
4876 (define_insn "iorhi3"
4877 [(set (match_operand:HI 0 "register_operand" "=d")
4878 (ior:HI (match_operand:HI 1 "register_operand" "%0")
4879 (match_operand:HI 2 "nonmemory_operand" "d")))
4880 (clobber (reg:CC 33))]
4883 [(set_attr "op_type" "RR")
4884 (set_attr "atype" "reg")])
4886 (define_insn "*iorhi3_ss"
4887 [(set (match_operand:HI 0 "s_operand" "=Q")
4888 (ior:HI (match_dup 0)
4889 (match_operand:HI 1 "s_imm_operand" "Q")))
4890 (clobber (reg:CC 33))]
4892 "oc\\t%O0(2,%R0),%1"
4893 [(set_attr "op_type" "SS")
4894 (set_attr "atype" "mem")])
4896 (define_insn "*iorhi3_ss_inv"
4897 [(set (match_operand:HI 0 "s_operand" "=Q")
4898 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
4900 (clobber (reg:CC 33))]
4902 "oc\\t%O0(2,%R0),%1"
4903 [(set_attr "op_type" "SS")
4904 (set_attr "atype" "mem")])
4907 ; iorqi3 instruction pattern(s).
4910 (define_insn "*iorqi3_oi"
4911 [(set (match_operand:QI 0 "register_operand" "=d,d")
4912 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
4913 (match_operand:QI 2 "nonmemory_operand" "d,n")))
4914 (clobber (reg:CC 33))]
4919 [(set_attr "op_type" "RR,RI")
4920 (set_attr "atype" "reg")])
4922 (define_insn "iorqi3"
4923 [(set (match_operand:QI 0 "register_operand" "=d")
4924 (ior:QI (match_operand:QI 1 "register_operand" "%0")
4925 (match_operand:QI 2 "nonmemory_operand" "d")))
4926 (clobber (reg:CC 33))]
4929 [(set_attr "op_type" "RR")
4930 (set_attr "atype" "reg")])
4932 (define_insn "*iorqi3_ss"
4933 [(set (match_operand:QI 0 "s_operand" "=Q,Q")
4934 (ior:QI (match_dup 0)
4935 (match_operand:QI 1 "s_imm_operand" "n,Q")))
4936 (clobber (reg:CC 33))]
4941 [(set_attr "op_type" "SI,SS")
4942 (set_attr "atype" "reg,mem")])
4944 (define_insn "*iorqi3_ss_inv"
4945 [(set (match_operand:QI 0 "s_operand" "=Q,Q")
4946 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,Q")
4948 (clobber (reg:CC 33))]
4953 [(set_attr "op_type" "SI,SS")
4954 (set_attr "atype" "reg,mem")])
4958 ;;- Xor instructions.
4962 ; xordi3 instruction pattern(s).
4965 (define_insn "*xordi3_cc"
4967 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4968 (match_operand:DI 2 "general_operand" "d,m"))
4970 (set (match_operand:DI 0 "register_operand" "=d,d")
4971 (xor:DI (match_dup 1) (match_dup 2)))]
4972 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4976 [(set_attr "op_type" "RRE,RXE")
4977 (set_attr "atype" "reg,mem")])
4979 (define_insn "*xordi3_cconly"
4981 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4982 (match_operand:DI 2 "general_operand" "d,m"))
4984 (clobber (match_scratch:DI 0 "=d,d"))]
4985 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4989 [(set_attr "op_type" "RRE,RXE")
4990 (set_attr "atype" "reg,mem")])
4992 (define_insn "xordi3"
4993 [(set (match_operand:DI 0 "register_operand" "=d,d")
4994 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4995 (match_operand:DI 2 "general_operand" "d,m")))
4996 (clobber (reg:CC 33))]
5001 [(set_attr "op_type" "RRE,RXE")
5002 (set_attr "atype" "reg,mem")])
5004 (define_insn "*xordi3_ss"
5005 [(set (match_operand:DI 0 "s_operand" "=Q")
5006 (xor:DI (match_dup 0)
5007 (match_operand:DI 1 "s_imm_operand" "Q")))
5008 (clobber (reg:CC 33))]
5010 "xc\\t%O0(8,%R0),%1"
5011 [(set_attr "op_type" "SS")
5012 (set_attr "atype" "mem")])
5014 (define_insn "*xordi3_ss_inv"
5015 [(set (match_operand:DI 0 "s_operand" "=Q")
5016 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5018 (clobber (reg:CC 33))]
5020 "xc\\t%O0(8,%R0),%1"
5021 [(set_attr "op_type" "SS")
5022 (set_attr "atype" "mem")])
5025 ; xorsi3 instruction pattern(s).
5028 (define_insn "*xorsi3_cc"
5030 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5031 (match_operand:SI 2 "general_operand" "d,m"))
5033 (set (match_operand:SI 0 "register_operand" "=d,d")
5034 (xor:SI (match_dup 1) (match_dup 2)))]
5035 "s390_match_ccmode(insn, CCTmode)"
5039 [(set_attr "op_type" "RR,RX")
5040 (set_attr "atype" "reg,mem")])
5042 (define_insn "*xorsi3_cconly"
5044 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5045 (match_operand:SI 2 "general_operand" "d,m"))
5047 (clobber (match_scratch:SI 0 "=d,d"))]
5048 "s390_match_ccmode(insn, CCTmode)"
5052 [(set_attr "op_type" "RR,RX")
5053 (set_attr "atype" "reg,mem")])
5055 (define_insn "xorsi3"
5056 [(set (match_operand:SI 0 "register_operand" "=d,d")
5057 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5058 (match_operand:SI 2 "general_operand" "d,m")))
5059 (clobber (reg:CC 33))]
5064 [(set_attr "op_type" "RR,RX")
5065 (set_attr "atype" "reg,mem")])
5067 (define_insn "*xorsi3_ss"
5068 [(set (match_operand:SI 0 "s_operand" "=Q")
5069 (xor:SI (match_dup 0)
5070 (match_operand:SI 1 "s_imm_operand" "Q")))
5071 (clobber (reg:CC 33))]
5073 "xc\\t%O0(4,%R0),%1"
5074 [(set_attr "op_type" "SS")
5075 (set_attr "atype" "mem")])
5077 (define_insn "*xorsi3_ss_inv"
5078 [(set (match_operand:SI 0 "s_operand" "=Q")
5079 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5081 (clobber (reg:CC 33))]
5083 "xc\\t%O0(4,%R0),%1"
5084 [(set_attr "op_type" "SS")
5085 (set_attr "atype" "mem")])
5088 ; xorhi3 instruction pattern(s).
5091 (define_insn "xorhi3"
5092 [(set (match_operand:HI 0 "register_operand" "=d")
5093 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5094 (match_operand:HI 2 "nonmemory_operand" "d")))
5095 (clobber (reg:CC 33))]
5098 [(set_attr "op_type" "RR")
5099 (set_attr "atype" "reg")])
5101 (define_insn "*xorhi3_ss"
5102 [(set (match_operand:HI 0 "s_operand" "=Q")
5103 (xor:HI (match_dup 0)
5104 (match_operand:HI 1 "s_imm_operand" "Q")))
5105 (clobber (reg:CC 33))]
5107 "xc\\t%O0(2,%R0),%1"
5108 [(set_attr "op_type" "SS")
5109 (set_attr "atype" "mem")])
5111 (define_insn "*xorhi3_ss_inv"
5112 [(set (match_operand:HI 0 "s_operand" "=Q")
5113 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5115 (clobber (reg:CC 33))]
5117 "xc\\t%O0(2,%R0),%1"
5118 [(set_attr "op_type" "SS")
5119 (set_attr "atype" "mem")])
5122 ; xorqi3 instruction pattern(s).
5125 (define_insn "xorqi3"
5126 [(set (match_operand:QI 0 "register_operand" "=d")
5127 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5128 (match_operand:QI 2 "nonmemory_operand" "d")))
5129 (clobber (reg:CC 33))]
5132 [(set_attr "op_type" "RR")
5133 (set_attr "atype" "reg")])
5135 (define_insn "*xorqi3_ss"
5136 [(set (match_operand:QI 0 "s_operand" "=Q,Q")
5137 (xor:QI (match_dup 0)
5138 (match_operand:QI 1 "s_imm_operand" "n,Q")))
5139 (clobber (reg:CC 33))]
5144 [(set_attr "op_type" "SI,SS")
5145 (set_attr "atype" "mem")])
5147 (define_insn "*xorqi3_ss_inv"
5148 [(set (match_operand:QI 0 "s_operand" "=Q,Q")
5149 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,Q")
5151 (clobber (reg:CC 33))]
5156 [(set_attr "op_type" "SI,SS")
5157 (set_attr "atype" "mem")])
5161 ;;- Negate instructions.
5165 ; negdi2 instruction pattern(s).
5168 (define_expand "negdi2"
5170 [(set (match_operand:DI 0 "register_operand" "=d")
5171 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5172 (clobber (reg:CC 33))])]
5176 (define_insn "*negdi2_64"
5177 [(set (match_operand:DI 0 "register_operand" "=d")
5178 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5179 (clobber (reg:CC 33))]
5182 [(set_attr "op_type" "RR")])
5184 (define_insn "*negdi2_31"
5185 [(set (match_operand:DI 0 "register_operand" "=d")
5186 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5187 (clobber (reg:CC 33))]
5192 xop[0] = gen_label_rtx ();
5193 output_asm_insn (\"lcr\\t%0,%1\", operands);
5194 output_asm_insn (\"lcr\\t%N0,%N1\", operands);
5195 output_asm_insn (\"je\\t%l0\", xop);
5196 output_asm_insn (\"bctr\\t%0,0\", operands);
5197 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
5198 CODE_LABEL_NUMBER (xop[0]));
5201 [(set_attr "op_type" "NN")
5202 (set_attr "type" "other")
5203 (set_attr "length" "10")])
5206 ; negsi2 instruction pattern(s).
5209 (define_insn "negsi2"
5210 [(set (match_operand:SI 0 "register_operand" "=d")
5211 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5212 (clobber (reg:CC 33))]
5215 [(set_attr "op_type" "RR")])
5218 ; negdf2 instruction pattern(s).
5221 (define_expand "negdf2"
5223 [(set (match_operand:DF 0 "register_operand" "=f")
5224 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5225 (clobber (reg:CC 33))])]
5229 (define_insn "*negdf2"
5230 [(set (match_operand:DF 0 "register_operand" "=f")
5231 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5232 (clobber (reg:CC 33))]
5233 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5235 [(set_attr "op_type" "RRE")])
5237 (define_insn "*negdf2_ibm"
5238 [(set (match_operand:DF 0 "register_operand" "=f")
5239 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5240 (clobber (reg:CC 33))]
5241 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5243 [(set_attr "op_type" "RR")])
5246 ; negsf2 instruction pattern(s).
5249 (define_expand "negsf2"
5251 [(set (match_operand:SF 0 "register_operand" "=f")
5252 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5253 (clobber (reg:CC 33))])]
5257 (define_insn "*negsf2"
5258 [(set (match_operand:SF 0 "register_operand" "=f")
5259 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5260 (clobber (reg:CC 33))]
5261 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5263 [(set_attr "op_type" "RRE")])
5265 (define_insn "*negsf2"
5266 [(set (match_operand:SF 0 "register_operand" "=f")
5267 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5268 (clobber (reg:CC 33))]
5269 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5271 [(set_attr "op_type" "RR")])
5275 ;;- Absolute value instructions.
5279 ; absdi2 instruction pattern(s).
5282 (define_insn "absdi2"
5283 [(set (match_operand:DI 0 "register_operand" "=d")
5284 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5285 (clobber (reg:CC 33))]
5288 [(set_attr "op_type" "RRE")])
5291 ; abssi2 instruction pattern(s).
5294 (define_insn "abssi2"
5295 [(set (match_operand:SI 0 "register_operand" "=d")
5296 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5297 (clobber (reg:CC 33))]
5300 [(set_attr "op_type" "RR")])
5303 ; absdf2 instruction pattern(s).
5306 (define_expand "absdf2"
5308 [(set (match_operand:DF 0 "register_operand" "=f")
5309 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5310 (clobber (reg:CC 33))])]
5314 (define_insn "*absdf2"
5315 [(set (match_operand:DF 0 "register_operand" "=f")
5316 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5317 (clobber (reg:CC 33))]
5318 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5320 [(set_attr "op_type" "RRE")])
5322 (define_insn "*absdf2_ibm"
5323 [(set (match_operand:DF 0 "register_operand" "=f")
5324 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5325 (clobber (reg:CC 33))]
5326 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5328 [(set_attr "op_type" "RR")])
5331 ; abssf2 instruction pattern(s).
5334 (define_expand "abssf2"
5336 [(set (match_operand:SF 0 "register_operand" "=f")
5337 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5338 (clobber (reg:CC 33))])]
5342 (define_insn "*abssf2"
5343 [(set (match_operand:SF 0 "register_operand" "=f")
5344 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5345 (clobber (reg:CC 33))]
5346 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5348 [(set_attr "op_type" "RRE")])
5350 (define_insn "*abssf2_ibm"
5351 [(set (match_operand:SF 0 "register_operand" "=f")
5352 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5353 (clobber (reg:CC 33))]
5354 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5356 [(set_attr "op_type" "RR")])
5359 ;;- Square root instructions.
5363 ; sqrtdf2 instruction pattern(s).
5366 (define_insn "sqrtdf2"
5367 [(set (match_operand:DF 0 "register_operand" "=f,f")
5368 (sqrt:DF (match_operand:DF 1 "general_operand" "f,m")))]
5369 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5373 [(set_attr "op_type" "RRE,RSE")])
5376 ; sqrtsf2 instruction pattern(s).
5379 (define_insn "sqrtsf2"
5380 [(set (match_operand:SF 0 "register_operand" "=f,f")
5381 (sqrt:SF (match_operand:SF 1 "general_operand" "f,m")))]
5382 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5386 [(set_attr "op_type" "RRE,RSE")])
5389 ;;- One complement instructions.
5393 ; one_cmpldi2 instruction pattern(s).
5396 (define_expand "one_cmpldi2"
5398 [(set (match_operand:DI 0 "register_operand" "")
5399 (xor:DI (match_operand:DI 1 "register_operand" "")
5401 (clobber (reg:CC 33))])]
5406 ; one_cmplsi2 instruction pattern(s).
5409 (define_expand "one_cmplsi2"
5411 [(set (match_operand:SI 0 "register_operand" "")
5412 (xor:SI (match_operand:SI 1 "register_operand" "")
5414 (clobber (reg:CC 33))])]
5419 ; one_cmplhi2 instruction pattern(s).
5422 (define_expand "one_cmplhi2"
5424 [(set (match_operand:HI 0 "register_operand" "")
5425 (xor:HI (match_operand:HI 1 "register_operand" "")
5427 (clobber (reg:CC 33))])]
5432 ; one_cmplqi2 instruction pattern(s).
5435 (define_expand "one_cmplqi2"
5437 [(set (match_operand:QI 0 "register_operand" "")
5438 (xor:QI (match_operand:QI 1 "register_operand" "")
5440 (clobber (reg:CC 33))])]
5446 ;;- Rotate instructions.
5450 ; rotldi3 instruction pattern(s).
5453 (define_insn "rotldi3"
5454 [(set (match_operand:DI 0 "register_operand" "=d,d")
5455 (rotate:DI (match_operand:DI 1 "register_operand" "d,d")
5456 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5461 [(set_attr "op_type" "RSE")])
5464 ; rotlsi3 instruction pattern(s).
5467 (define_insn "rotlsi3"
5468 [(set (match_operand:SI 0 "register_operand" "=d,d")
5469 (rotate:SI (match_operand:SI 1 "register_operand" "d,d")
5470 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5475 [(set_attr "op_type" "RSE")])
5479 ;;- Arithmetic shift instructions.
5483 ; ashldi3 instruction pattern(s).
5486 (define_expand "ashldi3"
5487 [(set (match_operand:DI 0 "register_operand" "")
5488 (ashift:DI (match_operand:DI 1 "register_operand" "")
5489 (match_operand:SI 2 "nonmemory_operand" "")))]
5493 (define_insn "*ashldi3_31"
5494 [(set (match_operand:DI 0 "register_operand" "=d,d")
5495 (ashift:DI (match_operand:DI 1 "register_operand" "0,0")
5496 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5501 [(set_attr "op_type" "RS")])
5503 (define_insn "*ashldi3_64"
5504 [(set (match_operand:DI 0 "register_operand" "=d,d")
5505 (ashift:DI (match_operand:DI 1 "register_operand" "d,d")
5506 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5511 [(set_attr "op_type" "RSE")])
5514 ; ashrdi3 instruction pattern(s).
5517 (define_expand "ashrdi3"
5519 [(set (match_operand:DI 0 "register_operand" "")
5520 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
5521 (match_operand:SI 2 "nonmemory_operand" "")))
5522 (clobber (reg:CC 33))])]
5526 (define_insn "*ashrdi3_cc_31"
5528 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
5529 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5531 (set (match_operand:DI 0 "register_operand" "=d,d")
5532 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
5533 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
5537 [(set_attr "op_type" "RS")])
5539 (define_insn "*ashrdi3_cconly_31"
5541 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
5542 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5544 (clobber (match_scratch:DI 0 "=d,d"))]
5545 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
5549 [(set_attr "op_type" "RS")])
5551 (define_insn "*ashrdi3_31"
5552 [(set (match_operand:DI 0 "register_operand" "=d,d")
5553 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
5554 (match_operand:SI 2 "nonmemory_operand" "J,a")))
5555 (clobber (reg:CC 33))]
5560 [(set_attr "op_type" "RS")])
5562 (define_insn "*ashrdi3_cc_64"
5564 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
5565 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5567 (set (match_operand:DI 0 "register_operand" "=d,d")
5568 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
5569 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
5573 [(set_attr "op_type" "RSE")])
5575 (define_insn "*ashrdi3_cconly_64"
5577 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
5578 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5580 (clobber (match_scratch:DI 0 "=d,d"))]
5581 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
5585 [(set_attr "op_type" "RSE")])
5587 (define_insn "*ashrdi3_64"
5588 [(set (match_operand:DI 0 "register_operand" "=d,d")
5589 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
5590 (match_operand:SI 2 "nonmemory_operand" "J,a")))
5591 (clobber (reg:CC 33))]
5596 [(set_attr "op_type" "RSE")])
5599 ; ashlsi3 instruction pattern(s).
5602 (define_insn "ashlsi3"
5603 [(set (match_operand:SI 0 "register_operand" "=d,d")
5604 (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
5605 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5610 [(set_attr "op_type" "RS")])
5613 ; ashrsi3 instruction pattern(s).
5616 (define_insn "*ashrsi3_cc"
5618 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
5619 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5621 (set (match_operand:SI 0 "register_operand" "=d,d")
5622 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5623 "s390_match_ccmode(insn, CCSmode)"
5627 [(set_attr "op_type" "RS")])
5629 (define_insn "*ashrsi3_cconly"
5631 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
5632 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5634 (clobber (match_scratch:SI 0 "=d,d"))]
5635 "s390_match_ccmode(insn, CCSmode)"
5639 [(set_attr "op_type" "RS")])
5641 (define_insn "ashrsi3"
5642 [(set (match_operand:SI 0 "register_operand" "=d,d")
5643 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
5644 (match_operand:SI 2 "nonmemory_operand" "J,a")))
5645 (clobber (reg:CC 33))]
5650 [(set_attr "op_type" "RS")])
5654 ;;- logical shift instructions.
5658 ; lshrdi3 instruction pattern(s).
5661 (define_expand "lshrdi3"
5662 [(set (match_operand:DI 0 "register_operand" "")
5663 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5664 (match_operand:SI 2 "nonmemory_operand" "")))]
5668 (define_insn "*lshrdi3_31"
5669 [(set (match_operand:DI 0 "register_operand" "=d,d")
5670 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
5671 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5676 [(set_attr "op_type" "RS,RS")])
5678 (define_insn "*lshrdi3_64"
5679 [(set (match_operand:DI 0 "register_operand" "=d,d")
5680 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
5681 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5686 [(set_attr "op_type" "RS,RS")])
5689 ; lshrsi3 instruction pattern(s).
5692 (define_insn "lshrsi3"
5693 [(set (match_operand:SI 0 "register_operand" "=d,d")
5694 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
5695 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5700 [(set_attr "op_type" "RS")])
5704 ;; Branch instruction patterns.
5707 (define_expand "beq"
5708 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
5710 (if_then_else (eq (reg:CCZ 33) (const_int 0))
5711 (label_ref (match_operand 0 "" ""))
5714 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5716 (define_expand "bne"
5717 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
5719 (if_then_else (ne (reg:CCZ 33) (const_int 0))
5720 (label_ref (match_operand 0 "" ""))
5723 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5725 (define_expand "bgt"
5726 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5728 (if_then_else (gt (reg:CCS 33) (const_int 0))
5729 (label_ref (match_operand 0 "" ""))
5732 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5734 (define_expand "bgtu"
5735 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
5737 (if_then_else (gtu (reg:CCU 33) (const_int 0))
5738 (label_ref (match_operand 0 "" ""))
5741 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5743 (define_expand "blt"
5744 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5746 (if_then_else (lt (reg:CCS 33) (const_int 0))
5747 (label_ref (match_operand 0 "" ""))
5750 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5752 (define_expand "bltu"
5753 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
5755 (if_then_else (ltu (reg:CCU 33) (const_int 0))
5756 (label_ref (match_operand 0 "" ""))
5759 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5761 (define_expand "bge"
5762 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5764 (if_then_else (ge (reg:CCS 33) (const_int 0))
5765 (label_ref (match_operand 0 "" ""))
5768 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5770 (define_expand "bgeu"
5771 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
5773 (if_then_else (geu (reg:CCU 33) (const_int 0))
5774 (label_ref (match_operand 0 "" ""))
5777 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5779 (define_expand "ble"
5780 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5782 (if_then_else (le (reg:CCS 33) (const_int 0))
5783 (label_ref (match_operand 0 "" ""))
5786 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5788 (define_expand "bleu"
5789 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
5791 (if_then_else (leu (reg:CCU 33) (const_int 0))
5792 (label_ref (match_operand 0 "" ""))
5795 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5797 (define_expand "bunordered"
5798 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5800 (if_then_else (unordered (reg:CCS 33) (const_int 0))
5801 (label_ref (match_operand 0 "" ""))
5804 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5806 (define_expand "bordered"
5807 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5809 (if_then_else (ordered (reg:CCS 33) (const_int 0))
5810 (label_ref (match_operand 0 "" ""))
5813 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5815 (define_expand "buneq"
5816 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5818 (if_then_else (uneq (reg:CCS 33) (const_int 0))
5819 (label_ref (match_operand 0 "" ""))
5822 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5824 (define_expand "bungt"
5825 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5827 (if_then_else (ungt (reg:CCS 33) (const_int 0))
5828 (label_ref (match_operand 0 "" ""))
5831 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5833 (define_expand "bunlt"
5834 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5836 (if_then_else (unlt (reg:CCS 33) (const_int 0))
5837 (label_ref (match_operand 0 "" ""))
5840 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5842 (define_expand "bunge"
5843 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5845 (if_then_else (unge (reg:CCS 33) (const_int 0))
5846 (label_ref (match_operand 0 "" ""))
5849 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5851 (define_expand "bunle"
5852 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5854 (if_then_else (unle (reg:CCS 33) (const_int 0))
5855 (label_ref (match_operand 0 "" ""))
5858 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5860 (define_expand "bltgt"
5861 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
5863 (if_then_else (ltgt (reg:CCS 33) (const_int 0))
5864 (label_ref (match_operand 0 "" ""))
5867 "{ operands[1] = s390_compare_op0; operands[2] = s390_compare_op1; }")
5871 ;;- Conditional jump instructions.
5874 (define_insn "cjump"
5877 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
5878 (label_ref (match_operand 0 "" ""))
5883 if (get_attr_length (insn) == 4)
5884 return \"j%C1\\t%l0\";
5885 else if (TARGET_64BIT)
5886 return \"jg%C1\\t%l0\";
5890 [(set_attr "op_type" "RI")
5891 (set (attr "length")
5892 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
5894 (ne (symbol_ref "TARGET_64BIT") (const_int 0))
5896 (ne (symbol_ref "s390_pool_overflow") (const_int 0))
5897 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
5898 (const_int 12) (const_int 14))
5899 (eq (symbol_ref "flag_pic") (const_int 0))
5900 (const_int 6)] (const_int 8)))])
5902 (define_insn "*cjump_long"
5905 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
5906 (match_operand 0 "address_operand" "p")
5911 if (get_attr_op_type (insn) == OP_TYPE_RR)
5912 return \"b%C1r\\t%0\";
5914 return \"b%C1\\t%a0\";
5916 [(set (attr "op_type")
5917 (if_then_else (match_operand 0 "register_operand" "")
5918 (const_string "RR") (const_string "RX")))
5919 (set_attr "atype" "mem")])
5923 ;;- Negated conditional jump instructions.
5926 (define_insn "icjump"
5929 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
5931 (label_ref (match_operand 0 "" ""))))]
5935 if (get_attr_length (insn) == 4)
5936 return \"j%D1\\t%l0\";
5937 else if (TARGET_64BIT)
5938 return \"jg%D1\\t%l0\";
5942 [(set_attr "op_type" "RI")
5943 (set (attr "length")
5944 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
5946 (ne (symbol_ref "TARGET_64BIT") (const_int 0))
5948 (ne (symbol_ref "s390_pool_overflow") (const_int 0))
5949 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
5950 (const_int 12) (const_int 14))
5951 (eq (symbol_ref "flag_pic") (const_int 0))
5952 (const_int 6)] (const_int 8)))])
5954 (define_insn "*icjump_long"
5957 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
5959 (match_operand 0 "address_operand" "p")))]
5963 if (get_attr_op_type (insn) == OP_TYPE_RR)
5964 return \"b%D1r\\t%0\";
5966 return \"b%D1\\t%a0\";
5968 [(set (attr "op_type")
5969 (if_then_else (match_operand 0 "register_operand" "")
5970 (const_string "RR") (const_string "RX")))
5971 (set_attr "atype" "mem")])
5975 ;;- Loop instructions.
5977 ;; This is all complicated by the fact that since this is a jump insn
5978 ;; we must handle our own output reloads.
5980 (define_expand "doloop_end"
5981 [(use (match_operand 0 "" "")) ; loop pseudo
5982 (use (match_operand 1 "" "")) ; iterations; zero if unknown
5983 (use (match_operand 2 "" "")) ; max iterations
5984 (use (match_operand 3 "" "")) ; loop level
5985 (use (match_operand 4 "" ""))] ; label
5989 if (GET_MODE (operands[0]) == SImode)
5990 emit_jump_insn (gen_doloop_si (operands[4], operands[0], operands[0]));
5991 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
5992 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
5999 (define_insn "doloop_si"
6002 (ne (match_operand:SI 1 "register_operand" "d,d")
6004 (label_ref (match_operand 0 "" ""))
6006 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6007 (plus:SI (match_dup 1) (const_int -1)))
6008 (clobber (match_scratch:SI 3 "=X,&d"))
6009 (clobber (reg:CC 33))]
6013 if (which_alternative != 0)
6015 else if (get_attr_length (insn) == 4)
6016 return \"brct\\t%1,%l0\";
6020 [(set_attr "op_type" "RI")
6021 (set (attr "length")
6022 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6024 (ne (symbol_ref "TARGET_64BIT") (const_int 0))
6026 (ne (symbol_ref "s390_pool_overflow") (const_int 0))
6027 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6028 (const_int 12) (const_int 14))
6029 (eq (symbol_ref "flag_pic") (const_int 0))
6030 (const_int 6)] (const_int 8)))])
6032 (define_insn "*doloop_si_long"
6035 (ne (match_operand:SI 1 "register_operand" "d,d")
6037 (match_operand 0 "address_operand" "p,p")
6039 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6040 (plus:SI (match_dup 1) (const_int -1)))
6041 (clobber (match_scratch:SI 3 "=X,&d"))
6042 (clobber (reg:CC 33))]
6046 if (get_attr_op_type (insn) == OP_TYPE_RR)
6047 return \"bctr\\t%0\";
6049 return \"bct\\t%a0\";
6051 [(set (attr "op_type")
6052 (if_then_else (match_operand 0 "register_operand" "")
6053 (const_string "RR") (const_string "RX")))
6054 (set_attr "atype" "mem")])
6058 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
6060 (match_operand 0 "" "")
6062 (set (match_operand:SI 2 "nonimmediate_operand" "")
6063 (plus:SI (match_dup 1) (const_int -1)))
6064 (clobber (match_scratch:SI 3 ""))
6065 (clobber (reg:CC 33))]
6067 && (! REG_P (operands[2])
6068 || ! rtx_equal_p (operands[1], operands[2]))"
6069 [(set (match_dup 3) (match_dup 1))
6070 (parallel [(set (reg:CCAN 33)
6071 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6073 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6074 (set (match_dup 2) (match_dup 3))
6075 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6080 (define_insn "doloop_di"
6083 (ne (match_operand:DI 1 "register_operand" "d,d")
6085 (label_ref (match_operand 0 "" ""))
6087 (set (match_operand:DI 2 "register_operand" "=1,?*m*r")
6088 (plus:DI (match_dup 1) (const_int -1)))
6089 (clobber (match_scratch:DI 3 "=X,&d"))
6090 (clobber (reg:CC 33))]
6094 if (which_alternative != 0)
6096 else if (get_attr_length (insn) == 4)
6097 return \"brctg\\t%1,%l0\";
6101 [(set_attr "op_type" "RI")
6102 (set (attr "length")
6103 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6104 (const_int 4) (const_int 12)))])
6106 (define_insn "*doloop_di_long"
6109 (ne (match_operand:DI 1 "register_operand" "d,d")
6111 (match_operand 0 "address_operand" "p,p")
6113 (set (match_operand:DI 2 "register_operand" "=1,?*m*d")
6114 (plus:DI (match_dup 1) (const_int -1)))
6115 (clobber (match_scratch:DI 3 "=X,&d"))
6116 (clobber (reg:CC 33))]
6120 if (get_attr_op_type (insn) == OP_TYPE_RRE)
6121 return \"bctgr\\t%0\";
6123 return \"bctg\\t%a0\";
6125 [(set (attr "op_type")
6126 (if_then_else (match_operand 0 "register_operand" "")
6127 (const_string "RRE") (const_string "RXE")))
6128 (set_attr "atype" "mem")])
6132 (if_then_else (ne (match_operand:DI 1 "register_operand" "")
6134 (match_operand 0 "" "")
6136 (set (match_operand:DI 2 "nonimmediate_operand" "")
6137 (plus:DI (match_dup 1) (const_int -1)))
6138 (clobber (match_scratch:DI 3 ""))
6139 (clobber (reg:CC 33))]
6141 && (! REG_P (operands[2])
6142 || ! rtx_equal_p (operands[1], operands[2]))"
6143 [(set (match_dup 3) (match_dup 1))
6144 (parallel [(set (reg:CCAN 33)
6145 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6147 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6148 (set (match_dup 2) (match_dup 3))
6149 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6155 ;;- Unconditional jump instructions.
6159 ; jump instruction pattern(s).
6163 [(set (pc) (label_ref (match_operand 0 "" "")))]
6167 if (get_attr_length (insn) == 4)
6169 else if (TARGET_64BIT)
6170 return \"jg\\t%l0\";
6174 [(set_attr "op_type" "RI")
6175 (set (attr "length")
6176 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6178 (ne (symbol_ref "TARGET_64BIT") (const_int 0))
6180 (eq (symbol_ref "flag_pic") (const_int 0))
6181 (const_int 6)] (const_int 8)))])
6184 ; indirect-jump instruction pattern(s).
6187 (define_insn "indirect_jump"
6188 [(set (pc) (match_operand 0 "address_operand" "p"))]
6192 if (get_attr_op_type (insn) == OP_TYPE_RR)
6197 [(set (attr "op_type")
6198 (if_then_else (match_operand 0 "register_operand" "")
6199 (const_string "RR") (const_string "RX")))
6200 (set_attr "atype" "mem")])
6203 ; casesi instruction pattern(s).
6206 (define_insn "casesi_jump"
6207 [(set (pc) (match_operand 0 "address_operand" "p"))
6208 (use (label_ref (match_operand 1 "" "")))]
6212 if (get_attr_op_type (insn) == OP_TYPE_RR)
6217 [(set (attr "op_type")
6218 (if_then_else (match_operand 0 "register_operand" "")
6219 (const_string "RR") (const_string "RX")))
6220 (set_attr "atype" "mem")])
6222 (define_expand "casesi"
6223 [(match_operand:SI 0 "general_operand" "")
6224 (match_operand:SI 1 "general_operand" "")
6225 (match_operand:SI 2 "general_operand" "")
6226 (label_ref (match_operand 3 "" ""))
6227 (label_ref (match_operand 4 "" ""))]
6231 rtx index = gen_reg_rtx (SImode);
6232 rtx base = gen_reg_rtx (Pmode);
6233 rtx target = gen_reg_rtx (Pmode);
6235 emit_move_insn (index, operands[0]);
6236 emit_insn (gen_subsi3 (index, index, operands[1]));
6237 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6240 if (Pmode != SImode)
6241 index = convert_to_mode (Pmode, index, 1);
6242 if (GET_CODE (index) != REG)
6243 index = copy_to_mode_reg (Pmode, index);
6246 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6248 emit_insn (gen_ashlsi3 (index, index, GEN_INT (2)));
6250 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6252 index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
6253 emit_move_insn (target, index);
6256 target = gen_rtx_PLUS (Pmode, base, target);
6257 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6264 ;;- Jump to subroutine.
6269 ; untyped call instruction pattern(s).
6272 ;; Call subroutine returning any type.
6273 (define_expand "untyped_call"
6274 [(parallel [(call (match_operand 0 "" "")
6276 (match_operand 1 "" "")
6277 (match_operand 2 "" "")])]
6283 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6285 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6287 rtx set = XVECEXP (operands[2], 0, i);
6288 emit_move_insn (SET_DEST (set), SET_SRC (set));
6291 /* The optimizer does not know that the call sets the function value
6292 registers we stored in the result block. We avoid problems by
6293 claiming that all hard registers are used and clobbered at this
6295 emit_insn (gen_blockage ());
6300 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6301 ;; all of memory. This blocks insns from being moved across this point.
6303 (define_insn "blockage"
6304 [(unspec_volatile [(const_int 0)] 0)]
6307 [(set_attr "type" "none")])
6312 ; call instruction pattern(s).
6315 (define_expand "call"
6316 [(call (match_operand 0 "" "")
6317 (match_operand 1 "" ""))
6318 (use (match_operand 2 "" ""))]
6325 /* Direct function calls need special treatment. */
6326 if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
6328 rtx sym = XEXP (operands[0], 0);
6330 /* When calling a global routine in PIC mode, we must
6331 replace the symbol itself with the PLT stub. */
6332 if (flag_pic && !SYMBOL_REF_FLAG (sym))
6334 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), 113);
6335 sym = gen_rtx_CONST (Pmode, sym);
6340 /* Unless we can use the bras(l) insn, force the
6341 routine address into a register. */
6342 if (!TARGET_SMALL_EXEC && !TARGET_64BIT)
6344 rtx target = gen_reg_rtx (Pmode);
6345 emit_move_insn (target, sym);
6349 operands[0] = gen_rtx_MEM (QImode, sym);
6353 insn = emit_call_insn (gen_call_exp (operands[0], operands[1],
6354 gen_rtx_REG (Pmode, RETURN_REGNUM)));
6356 /* In 31-bit, we must load the GOT register even if the
6357 compiler doesn't know about it, because the PLT glue
6358 code uses it. In 64-bit, this is not necessary. */
6359 if (plt_call && !TARGET_64BIT)
6360 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
6365 (define_expand "call_exp"
6366 [(parallel [(call (match_operand 0 "" "")
6367 (match_operand 1 "" ""))
6368 (clobber (match_operand 2 "" ""))])]
6372 (define_insn "brasl"
6373 [(call (mem:QI (match_operand:DI 0 "bras_sym_operand" "X"))
6374 (match_operand:SI 1 "const_int_operand" "n"))
6375 (clobber (match_operand:DI 2 "register_operand" "=r"))]
6378 [(set_attr "op_type" "RIL")
6379 (set_attr "type" "jsr")])
6382 [(call (mem:QI (match_operand:SI 0 "bras_sym_operand" "X"))
6383 (match_operand:SI 1 "const_int_operand" "n"))
6384 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6387 [(set_attr "op_type" "RI")
6388 (set_attr "type" "jsr")])
6390 (define_insn "basr_64"
6391 [(call (mem:QI (match_operand:DI 0 "register_operand" "a"))
6392 (match_operand:SI 1 "const_int_operand" "n"))
6393 (clobber (match_operand:DI 2 "register_operand" "=r"))]
6396 [(set_attr "op_type" "RR")
6397 (set_attr "type" "jsr")
6398 (set_attr "atype" "mem")])
6400 (define_insn "basr_31"
6401 [(call (mem:QI (match_operand:SI 0 "register_operand" "a"))
6402 (match_operand:SI 1 "const_int_operand" "n"))
6403 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6406 [(set_attr "op_type" "RR")
6407 (set_attr "type" "jsr")
6408 (set_attr "atype" "mem")])
6410 (define_insn "bas_64"
6411 [(call (mem:QI (match_operand:QI 0 "address_operand" "p"))
6412 (match_operand:SI 1 "const_int_operand" "n"))
6413 (clobber (match_operand:DI 2 "register_operand" "=r"))]
6416 [(set_attr "op_type" "RX")
6417 (set_attr "type" "jsr")
6418 (set_attr "atype" "mem")])
6420 (define_insn "bas_31"
6421 [(call (mem:QI (match_operand:QI 0 "address_operand" "p"))
6422 (match_operand:SI 1 "const_int_operand" "n"))
6423 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6426 [(set_attr "op_type" "RX")
6427 (set_attr "type" "jsr")
6428 (set_attr "atype" "mem")])
6432 ; call_value instruction pattern(s).
6435 (define_expand "call_value"
6436 [(set (match_operand 0 "" "")
6437 (call (match_operand 1 "" "")
6438 (match_operand 2 "" "")))
6439 (use (match_operand 3 "" ""))]
6446 /* Direct function calls need special treatment. */
6447 if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
6449 rtx sym = XEXP (operands[1], 0);
6451 /* When calling a global routine in PIC mode, we must
6452 replace the symbol itself with the PLT stub. */
6453 if (flag_pic && !SYMBOL_REF_FLAG (sym))
6455 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), 113);
6456 sym = gen_rtx_CONST (Pmode, sym);
6461 /* Unless we can use the bras(l) insn, force the
6462 routine address into a register. */
6463 if (!TARGET_SMALL_EXEC && !TARGET_64BIT)
6465 rtx target = gen_reg_rtx (Pmode);
6466 emit_move_insn (target, sym);
6470 operands[1] = gen_rtx_MEM (QImode, sym);
6474 insn = emit_call_insn (
6475 gen_call_value_exp (operands[0], operands[1], operands[2],
6476 gen_rtx_REG (Pmode, RETURN_REGNUM)));
6478 /* In 31-bit, we must load the GOT register even if the
6479 compiler doesn't know about it, because the PLT glue
6480 code uses it. In 64-bit, this is not necessary. */
6481 if (plt_call && !TARGET_64BIT)
6482 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
6487 (define_expand "call_value_exp"
6488 [(parallel [(set (match_operand 0 "" "")
6489 (call (match_operand 1 "" "")
6490 (match_operand 2 "" "")))
6491 (clobber (match_operand 3 "" ""))])]
6495 (define_insn "brasl_r"
6496 [(set (match_operand 0 "register_operand" "=df")
6497 (call (mem:QI (match_operand:DI 1 "bras_sym_operand" "X"))
6498 (match_operand:SI 2 "const_int_operand" "n")))
6499 (clobber (match_operand:DI 3 "register_operand" "=r"))]
6502 [(set_attr "op_type" "RIL")
6503 (set_attr "type" "jsr")])
6505 (define_insn "bras_r"
6506 [(set (match_operand 0 "register_operand" "=df")
6507 (call (mem:QI (match_operand:SI 1 "bras_sym_operand" "X"))
6508 (match_operand:SI 2 "const_int_operand" "n")))
6509 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6512 [(set_attr "op_type" "RI")
6513 (set_attr "type" "jsr")])
6515 (define_insn "basr_r_64"
6516 [(set (match_operand 0 "register_operand" "=df")
6517 (call (mem:QI (match_operand:DI 1 "register_operand" "a"))
6518 (match_operand:SI 2 "const_int_operand" "n")))
6519 (clobber (match_operand:DI 3 "register_operand" "=r"))]
6522 [(set_attr "op_type" "RR")
6523 (set_attr "type" "jsr")])
6525 (define_insn "basr_r_31"
6526 [(set (match_operand 0 "register_operand" "=df")
6527 (call (mem:QI (match_operand:SI 1 "register_operand" "a"))
6528 (match_operand:SI 2 "const_int_operand" "n")))
6529 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6532 [(set_attr "op_type" "RR")
6533 (set_attr "type" "jsr")
6534 (set_attr "atype" "mem")])
6536 (define_insn "bas_r_64"
6537 [(set (match_operand 0 "register_operand" "=df")
6538 (call (mem:QI (match_operand:QI 1 "address_operand" "p"))
6539 (match_operand:SI 2 "const_int_operand" "n")))
6540 (clobber (match_operand:DI 3 "register_operand" "=r"))]
6543 [(set_attr "op_type" "RX")
6544 (set_attr "type" "jsr")
6545 (set_attr "atype" "mem")])
6547 (define_insn "bas_r_31"
6548 [(set (match_operand 0 "register_operand" "=df")
6549 (call (mem:QI (match_operand:QI 1 "address_operand" "p"))
6550 (match_operand:SI 2 "const_int_operand" "n")))
6551 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6554 [(set_attr "op_type" "RX")
6555 (set_attr "type" "jsr")
6556 (set_attr "atype" "mem")])
6560 ;;- Miscellaneous instructions.
6564 ; allocate stack instruction pattern(s).
6567 (define_expand "allocate_stack"
6569 (plus (reg 15) (match_operand 1 "general_operand" "")))
6570 (set (match_operand 0 "general_operand" "")
6575 rtx stack = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
6576 rtx chain = gen_rtx (MEM, Pmode, stack);
6577 rtx temp = gen_reg_rtx (Pmode);
6579 emit_move_insn (temp, chain);
6582 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
6584 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
6586 emit_move_insn (chain, temp);
6588 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
6594 ; setjmp/longjmp instruction pattern(s).
6597 (define_expand "builtin_setjmp_setup"
6598 [(unspec [(match_operand 0 "register_operand" "a")] 1)]
6602 rtx base = gen_rtx_MEM (Pmode, plus_constant (operands[0], 4 * GET_MODE_SIZE (Pmode)));
6603 rtx basereg = gen_rtx_REG (Pmode, BASE_REGISTER);
6605 emit_move_insn (base, basereg);
6609 (define_expand "builtin_setjmp_receiver"
6610 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] 2)]
6614 rtx gotreg = gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM);
6615 rtx got = gen_rtx_SYMBOL_REF (Pmode, \"_GLOBAL_OFFSET_TABLE_\");
6616 SYMBOL_REF_FLAG (got) = 1;
6618 emit_move_insn (gotreg, got);
6619 emit_insn (gen_rtx_USE (VOIDmode, gotreg));
6623 (define_expand "builtin_longjmp"
6624 [(unspec_volatile [(match_operand 0 "register_operand" "r")] 3)]
6628 /* The elements of the buffer are, in order: */
6629 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
6630 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], GET_MODE_SIZE (Pmode)));
6631 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 2 * GET_MODE_SIZE (Pmode)));
6632 rtx base = gen_rtx_MEM (Pmode, plus_constant (operands[0], 4 * GET_MODE_SIZE (Pmode)));
6633 rtx basereg = gen_rtx_REG (Pmode, BASE_REGISTER);
6634 rtx jmp = gen_rtx_REG (Pmode, 14);
6636 emit_move_insn (jmp, lab);
6637 emit_move_insn (basereg, base);
6638 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
6639 emit_move_insn (hard_frame_pointer_rtx, fp);
6641 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
6642 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
6643 emit_insn (gen_rtx_USE (VOIDmode, basereg));
6644 emit_indirect_jump (jmp);
6649 ;; These patterns say how to save and restore the stack pointer. We need not
6650 ;; save the stack pointer at function level since we are careful to
6651 ;; preserve the backchain. At block level, we have to restore the backchain
6652 ;; when we restore the stack pointer.
6654 ;; For nonlocal gotos, we must save both the stack pointer and its
6655 ;; backchain and restore both. Note that in the nonlocal case, the
6656 ;; save area is a memory location.
6658 (define_expand "save_stack_function"
6659 [(match_operand 0 "general_operand" "")
6660 (match_operand 1 "general_operand" "")]
6664 (define_expand "restore_stack_function"
6665 [(match_operand 0 "general_operand" "")
6666 (match_operand 1 "general_operand" "")]
6670 (define_expand "restore_stack_block"
6671 [(use (match_operand 0 "register_operand" ""))
6672 (set (match_dup 2) (match_dup 3))
6673 (set (match_dup 0) (match_operand 1 "register_operand" ""))
6674 (set (match_dup 3) (match_dup 2))]
6678 operands[2] = gen_reg_rtx (Pmode);
6679 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
6682 (define_expand "save_stack_nonlocal"
6683 [(match_operand 0 "memory_operand" "")
6684 (match_operand 1 "register_operand" "")]
6688 rtx temp = gen_reg_rtx (Pmode);
6690 /* Copy the backchain to the first word, sp to the second. */
6691 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
6692 emit_move_insn (operand_subword (operands[0], 0, 0,
6693 TARGET_64BIT ? TImode : DImode),
6695 emit_move_insn (operand_subword (operands[0], 1, 0,
6696 TARGET_64BIT ? TImode : DImode),
6701 (define_expand "restore_stack_nonlocal"
6702 [(match_operand 0 "register_operand" "")
6703 (match_operand 1 "memory_operand" "")]
6707 rtx temp = gen_reg_rtx (Pmode);
6709 /* Restore the backchain from the first word, sp from the second. */
6710 emit_move_insn (temp,
6711 operand_subword (operands[1], 0, 0,
6712 TARGET_64BIT ? TImode : DImode));
6713 emit_move_insn (operands[0],
6714 operand_subword (operands[1], 1, 0,
6715 TARGET_64BIT ? TImode : DImode));
6716 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
6722 ; nop instruction pattern(s).
6729 [(set_attr "op_type" "RR")])
6733 ; Special literal pool access instruction pattern(s).
6736 (define_insn "consttable_qi"
6737 [(unspec_volatile [(match_operand:QI 0 "consttable_operand" "X")] 200)]
6741 assemble_integer (operands[0], 1, BITS_PER_UNIT, 1);
6744 [(set_attr "op_type" "NN")
6745 (set_attr "length" "1")])
6747 (define_insn "consttable_hi"
6748 [(unspec_volatile [(match_operand:HI 0 "consttable_operand" "X")] 201)]
6752 assemble_integer (operands[0], 2, 2*BITS_PER_UNIT, 1);
6755 [(set_attr "op_type" "NN")
6756 (set_attr "length" "2")])
6758 (define_insn "consttable_si"
6759 [(unspec_volatile [(match_operand:SI 0 "consttable_operand" "X")] 202)]
6763 if (!TARGET_64BIT && flag_pic && SYMBOLIC_CONST (operands[0]))
6764 return \".long\\t%0\";
6766 assemble_integer (operands[0], 4, 4*BITS_PER_UNIT, 1);
6769 [(set_attr "op_type" "NN")
6770 (set_attr "length" "4")])
6772 (define_insn "consttable_di"
6773 [(unspec_volatile [(match_operand:DI 0 "consttable_operand" "X")] 203)]
6777 assemble_integer (operands[0], 8, 8*BITS_PER_UNIT, 1);
6780 [(set_attr "op_type" "NN")
6781 (set_attr "length" "8")])
6783 (define_insn "consttable_sf"
6784 [(unspec_volatile [(match_operand:SF 0 "consttable_operand" "X")] 204)]
6790 if (GET_CODE (operands[0]) != CONST_DOUBLE)
6793 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[0]);
6794 assemble_real (r, SFmode, 4*BITS_PER_UNIT);
6797 [(set_attr "op_type" "NN")
6798 (set_attr "length" "4")])
6800 (define_insn "consttable_df"
6801 [(unspec_volatile [(match_operand:DF 0 "consttable_operand" "X")] 205)]
6807 if (GET_CODE (operands[0]) != CONST_DOUBLE)
6810 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[0]);
6811 assemble_real (r, DFmode, 8*BITS_PER_UNIT);
6814 [(set_attr "op_type" "NN")
6815 (set_attr "length" "8")])
6817 (define_insn "pool_start_31"
6818 [(unspec_volatile [(const_int 0)] 206)]
6821 [(set_attr "op_type" "NN")
6822 (set_attr "length" "2")])
6824 (define_insn "pool_end_31"
6825 [(unspec_volatile [(const_int 0)] 207)]
6828 [(set_attr "op_type" "NN")
6829 (set_attr "length" "2")])
6831 (define_insn "pool_start_64"
6832 [(unspec_volatile [(const_int 0)] 206)]
6834 ".section\\t.rodata\;.align\\t8"
6835 [(set_attr "op_type" "NN")
6836 (set_attr "length" "0")])
6838 (define_insn "pool_end_64"
6839 [(unspec_volatile [(const_int 0)] 207)]
6842 [(set_attr "op_type" "NN")
6843 (set_attr "length" "0")])
6845 (define_insn "reload_base"
6846 [(set (match_operand:SI 0 "register_operand" "=a")
6847 (unspec:SI [(label_ref (match_operand 1 "" ""))] 210))]
6849 "basr\\t%0,0\;la\\t%0,%1-.(%0)"
6850 [(set_attr "op_type" "NN")
6851 (set_attr "type" "la")
6852 (set_attr "length" "6")])
6854 (define_insn "reload_base2"
6855 [(set (match_operand:SI 0 "register_operand" "=a")
6856 (unspec:SI [(label_ref (match_operand 1 "" ""))] 211))]
6859 [(set_attr "op_type" "NN")
6860 (set_attr "type" "la")
6861 (set_attr "length" "4")])
6865 ;; Insns related to generating the function prologue and epilogue.
6869 (define_expand "prologue"
6870 [(use (const_int 0))]
6874 s390_emit_prologue ();
6878 (define_expand "epilogue"
6879 [(use (const_int 1))]
6883 s390_emit_epilogue ();
6888 (define_insn "*return_si"
6890 (use (match_operand:SI 0 "register_operand" "a"))]
6893 [(set_attr "op_type" "RR")
6894 (set_attr "type" "jsr")
6895 (set_attr "atype" "mem")])
6897 (define_insn "*return_di"
6899 (use (match_operand:DI 0 "register_operand" "a"))]
6902 [(set_attr "op_type" "RR")
6903 (set_attr "type" "jsr")
6904 (set_attr "atype" "mem")])
6908 [(set (reg 13) (pc))
6909 (unspec_volatile [(const_int 0)] 200)]
6913 s390_output_constant_pool (asm_out_file);
6916 [(set_attr "op_type" "NN")
6917 (set_attr "type" "integer")])
6921 ;; Peephole optimization patterns.
6925 [(set (match_operand:SI 0 "memory_operand" "m")
6926 (match_operand:SI 1 "register_operand" "d"))
6933 [(set (match_operand:SI 0 "memory_operand" "m")
6934 (match_operand:SI 1 "register_operand" "d"))
6941 [(set (match_operand:SI 0 "register_operand" "")
6942 (match_operand:SI 1 "register_operand" ""))
6945 (plus:SI (match_dup 0)
6946 (match_operand:SI 2 "immediate_operand" "")))
6947 (clobber (reg:CC 33))])]
6948 "(REGNO (operands[0]) == STACK_POINTER_REGNUM ||
6949 REGNO (operands[1]) == STACK_POINTER_REGNUM ||
6950 REGNO (operands[0]) == BASE_REGISTER ||
6951 REGNO (operands[1]) == BASE_REGISTER) &&
6952 INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 4096"
6956 ; peepholes for fast char instructions
6960 ; [(set (match_operand:QI 0 "register_operand" "d")
6961 ; (match_operand:QI 1 "s_operand" "Q"))
6962 ; (set (match_operand:SI 2 "register_operand" "0")
6963 ; (zero_extend:SI (match_dup 0)))]
6964 ; "REGNO(operands[0]) == REGNO(operands[2])"
6965 ; "icm\\t%0,8,%1\;srl\\t%0,24")
6968 ; [(set (match_operand:QI 0 "register_operand" "d")
6969 ; (match_operand:QI 1 "s_operand" "Q"))
6970 ; (set (match_operand:SI 2 "register_operand" "0")
6971 ; (sign_extend:SI (match_dup 0)))]
6972 ; "REGNO(operands[0]) == REGNO(operands[2])"
6973 ; "icm\\t%0,8,%1\;sra\\t%0,24")
6976 [(set (match_operand:QI 0 "register_operand" "d")
6977 (match_operand:QI 1 "immediate_operand" "J"))
6978 (set (match_operand:SI 2 "register_operand" "0" )
6979 (sign_extend:SI (match_dup 0) ) )]
6980 "REGNO(operands[0]) == REGNO(operands[2])"
6984 ; peepholes for fast short instructions
6988 ; [(set (match_operand:HI 0 "register_operand" "d")
6989 ; (match_operand:HI 1 "s_operand" "Q"))
6990 ; (set (match_operand:SI 2 "register_operand" "0" )
6991 ; (zero_extend:SI (match_dup 0)))]
6992 ; "REGNO(operands[0]) == REGNO(operands[2])"
6993 ; "icm\\t%0,12,%1\;srl\\t%0,16")
6996 [(set (match_operand:HI 0 "register_operand" "d")
6997 (match_operand:HI 1 "memory_operand" "m"))
6998 (set (match_operand:SI 2 "register_operand" "0" )
6999 (sign_extend:SI (match_dup 0)))]
7000 "REGNO(operands[0]) == REGNO(operands[2])"
7004 [(set (match_operand:HI 0 "register_operand" "d")
7005 (match_operand:HI 1 "immediate_operand" "K"))
7006 (set (match_operand:SI 2 "register_operand" "0" )
7007 (sign_extend:SI (match_dup 0) ) )]
7008 "REGNO(operands[0]) == REGNO(operands[2])"
7012 ; peepholes for divide instructions
7016 [(set (match_operand:DI 0 "register_operand" "d")
7017 (match_operand:DI 1 "memory_operand" "m"))
7019 (lshiftrt:DI (match_dup 0)
7020 (match_operand:SI 2 "immediate_operand" "J")))
7022 (div:SI (match_dup 0)
7023 (match_operand:SI 3 "nonimmediate_operand" "g")))
7029 output_asm_insn (\"l\\t%0,%1\", operands);
7030 output_asm_insn (\"srdl\\t%0,%b2\", operands);
7032 if (REG_P (operands[3]))
7033 output_asm_insn (\"dr\\t%0,%3\", operands);
7035 output_asm_insn (\"d\\t%0,%3\", operands);
7037 return \"st\\t%N0,%N1\";
7041 [(set (match_operand:DI 0 "register_operand" "d")
7042 (match_operand:DI 1 "memory_operand" "m"))
7044 (lshiftrt:DI (match_dup 0)
7045 (match_operand:SI 2 "immediate_operand" "J")))
7047 (mod:SI (match_dup 0)
7048 (match_operand:SI 3 "nonimmediate_operand" "g")))
7054 output_asm_insn (\"l\\t%0,%1\", operands);
7055 output_asm_insn (\"srdl\\t%0,%b2\", operands);
7057 if (REG_P (operands[3]))
7058 output_asm_insn (\"dr\\t%0,%3\", operands);
7060 output_asm_insn (\"d\\t%0,%3\", operands);
7062 return \"st\\t%0,%1\";