1 ;;- Machine description for GNU compiler -- S/390 / zSeries version.
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
3 ;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and
4 ;; Ulrich Weigand (uweigand@de.ibm.com).
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it under
9 ;; the terms of the GNU General Public License as published by the Free
10 ;; Software Foundation; either version 2, or (at your option) any later
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to the Free
20 ;; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 ;; Special constraints for s/390 machine description:
26 ;; a -- Any address register from 1 to 15.
27 ;; d -- Any register from 0 to 15.
28 ;; I -- An 8-bit constant (0..255).
29 ;; J -- A 12-bit constant (0..4095).
30 ;; K -- A 16-bit constant (-32768..32767).
31 ;; Q -- A memory reference without index-register.
32 ;; S -- Valid operand for the LARL instruction.
34 ;; Special formats used for outputting 390 instructions.
36 ;; %b -- Print a constant byte integer. xy
37 ;; %h -- Print a signed 16-bit. wxyz
38 ;; %N -- Print next register (second word of a DImode reg) or next word.
39 ;; %M -- Print next register (second word of a TImode reg) or next word.
40 ;; %O -- Print the offset of a memory reference (PLUS (REG) (CONST_INT)).
41 ;; %R -- Print the register of a memory reference (PLUS (REG) (CONST_INT)).
43 ;; We have a special constraint for pattern matching.
45 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
57 ; GOT/PLT and lt-relative accesses
58 (UNSPEC_LTREL_OFFSET 100)
59 (UNSPEC_LTREL_BASE 101)
67 (UNSPEC_RELOAD_BASE 210)
68 (UNSPEC_MAIN_BASE 211)
70 ; TLS relocation specifiers
75 (UNSPEC_GOTNTPOFF 504)
76 (UNSPEC_INDNTPOFF 505)
80 (UNSPEC_TLSLDM_NTPOFF 511)
85 ;; UNSPEC_VOLATILE usage
94 (UNSPECV_POOL_START 201)
95 (UNSPECV_POOL_END 202)
96 (UNSPECV_POOL_ENTRY 203)
97 (UNSPECV_MAIN_POOL 300)
104 ;; Processor type. This attribute must exactly match the processor_type
105 ;; enumeration in s390.h.
107 (define_attr "cpu" "g5,g6,z900,z990"
108 (const (symbol_ref "s390_tune")))
110 ;; Define an insn type attribute. This is used in function unit delay
113 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
114 cs,vs,store,imul,idiv,
115 branch,jsr,fsimpd,fsimps,
116 floadd,floads,fstored, fstores,
117 fmuld,fmuls,fdivd,fdivs,
118 ftoi,itof,fsqrtd,fsqrts,
120 (const_string "integer"))
122 ;; Operand type. Used to default length attribute values
124 (define_attr "op_type"
125 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
128 ;; Insn are devide in two classes:
129 ;; agen: Insn using agen
130 ;; reg: Insn not using agen
132 (define_attr "atype" "agen,reg"
133 (cond [ (eq_attr "op_type" "E") (const_string "reg")
134 (eq_attr "op_type" "RR") (const_string "reg")
135 (eq_attr "op_type" "RX") (const_string "agen")
136 (eq_attr "op_type" "RI") (const_string "reg")
137 (eq_attr "op_type" "RRE") (const_string "reg")
138 (eq_attr "op_type" "RS") (const_string "agen")
139 (eq_attr "op_type" "RSI") (const_string "agen")
140 (eq_attr "op_type" "S") (const_string "agen")
141 (eq_attr "op_type" "SI") (const_string "agen")
142 (eq_attr "op_type" "SS") (const_string "agen")
143 (eq_attr "op_type" "SSE") (const_string "agen")
144 (eq_attr "op_type" "RXE") (const_string "agen")
145 (eq_attr "op_type" "RSE") (const_string "agen")
146 (eq_attr "op_type" "RIL") (const_string "agen")
147 (eq_attr "op_type" "RXY") (const_string "agen")
148 (eq_attr "op_type" "RSY") (const_string "agen")
149 (eq_attr "op_type" "SIY") (const_string "agen")]
150 (const_string "reg")))
152 ;; Generic pipeline function unit.
154 (define_function_unit "integer" 1 0
155 (eq_attr "type" "none") 0 0)
157 (define_function_unit "integer" 1 0
158 (eq_attr "type" "integer") 1 1)
160 (define_function_unit "integer" 1 0
161 (eq_attr "type" "fsimpd") 1 1)
163 (define_function_unit "integer" 1 0
164 (eq_attr "type" "fsimps") 1 1)
166 (define_function_unit "integer" 1 0
167 (eq_attr "type" "load") 1 1)
169 (define_function_unit "integer" 1 0
170 (eq_attr "type" "floadd") 1 1)
172 (define_function_unit "integer" 1 0
173 (eq_attr "type" "floads") 1 1)
175 (define_function_unit "integer" 1 0
176 (eq_attr "type" "la") 1 1)
178 (define_function_unit "integer" 1 0
179 (eq_attr "type" "larl") 1 1)
181 (define_function_unit "integer" 1 0
182 (eq_attr "type" "lr") 1 1)
184 (define_function_unit "integer" 1 0
185 (eq_attr "type" "branch") 1 1)
187 (define_function_unit "integer" 1 0
188 (eq_attr "type" "store") 1 1)
190 (define_function_unit "integer" 1 0
191 (eq_attr "type" "fstored") 1 1)
193 (define_function_unit "integer" 1 0
194 (eq_attr "type" "fstores") 1 1)
196 (define_function_unit "integer" 1 0
197 (eq_attr "type" "lm") 2 2)
199 (define_function_unit "integer" 1 0
200 (eq_attr "type" "stm") 2 2)
202 (define_function_unit "integer" 1 0
203 (eq_attr "type" "cs") 5 5)
205 (define_function_unit "integer" 1 0
206 (eq_attr "type" "vs") 30 30)
208 (define_function_unit "integer" 1 0
209 (eq_attr "type" "jsr") 5 5)
211 (define_function_unit "integer" 1 0
212 (eq_attr "type" "imul") 7 7)
214 (define_function_unit "integer" 1 0
215 (eq_attr "type" "fmuld") 6 6)
217 (define_function_unit "integer" 1 0
218 (eq_attr "type" "fmuls") 6 6)
220 (define_function_unit "integer" 1 0
221 (eq_attr "type" "idiv") 33 33)
223 (define_function_unit "integer" 1 0
224 (eq_attr "type" "fdivd") 33 33)
226 (define_function_unit "integer" 1 0
227 (eq_attr "type" "fdivs") 33 33)
229 (define_function_unit "integer" 1 0
230 (eq_attr "type" "fsqrtd") 30 30)
232 (define_function_unit "integer" 1 0
233 (eq_attr "type" "fsqrts") 30 30)
235 (define_function_unit "integer" 1 0
236 (eq_attr "type" "ftoi") 2 2)
238 (define_function_unit "integer" 1 0
239 (eq_attr "type" "itof") 2 2)
241 (define_function_unit "integer" 1 0
242 (eq_attr "type" "o2") 2 2)
244 (define_function_unit "integer" 1 0
245 (eq_attr "type" "o3") 3 3)
247 (define_function_unit "integer" 1 0
248 (eq_attr "type" "other") 5 5)
250 ;; Pipeline description for z900
257 (define_attr "length" ""
258 (cond [ (eq_attr "op_type" "E") (const_int 2)
259 (eq_attr "op_type" "RR") (const_int 2)
260 (eq_attr "op_type" "RX") (const_int 4)
261 (eq_attr "op_type" "RI") (const_int 4)
262 (eq_attr "op_type" "RRE") (const_int 4)
263 (eq_attr "op_type" "RS") (const_int 4)
264 (eq_attr "op_type" "RSI") (const_int 4)
265 (eq_attr "op_type" "S") (const_int 4)
266 (eq_attr "op_type" "SI") (const_int 4)
267 (eq_attr "op_type" "SS") (const_int 6)
268 (eq_attr "op_type" "SSE") (const_int 6)
269 (eq_attr "op_type" "RXE") (const_int 6)
270 (eq_attr "op_type" "RSE") (const_int 6)
271 (eq_attr "op_type" "RIL") (const_int 6)
272 (eq_attr "op_type" "RXY") (const_int 6)
273 (eq_attr "op_type" "RSY") (const_int 6)
274 (eq_attr "op_type" "SIY") (const_int 6)]
277 ;; Define attributes for `asm' insns.
279 (define_asm_attributes [(set_attr "type" "other")
280 (set_attr "op_type" "NN")])
286 ; CCL: Zero Nonzero Zero Nonzero (AL, ALR, SL, SLR, N, NC, NI, NR, O, OC, OI, OR, X, XC, XI, XR)
287 ; CCA: Zero <Zero >Zero Overflow (A, AR, AH, AHI, S, SR, SH, SHI, LTR, LCR, LNR, LPR, SLA, SLDA, SLA, SRDA)
288 ; CCU: Equal ULess UGreater -- (CL, CLR, CLI, CLM)
289 ; CCS: Equal SLess SGreater -- (C, CR, CH, CHI, ICM)
290 ; CCT: Zero Mixed Mixed Ones (TM, TMH, TML)
293 ; CCZ1 -> CCA/CCU/CCS/CCT
296 ; String: CLC, CLCL, CLCLE, CLST, CUSE, MVCL, MVCLE, MVPG, MVST, SRST
297 ; Clobber: CKSM, CFC, CS, CDS, CUUTF, CUTFU, PLO, SPM, STCK, STCKE, TS, TRT, TRE, UPT
301 ;;- Compare instructions.
304 (define_expand "cmpdi"
306 (compare:CC (match_operand:DI 0 "register_operand" "")
307 (match_operand:DI 1 "general_operand" "")))]
310 s390_compare_op0 = operands[0];
311 s390_compare_op1 = operands[1];
315 (define_expand "cmpsi"
317 (compare:CC (match_operand:SI 0 "register_operand" "")
318 (match_operand:SI 1 "general_operand" "")))]
321 s390_compare_op0 = operands[0];
322 s390_compare_op1 = operands[1];
326 (define_expand "cmpdf"
328 (compare:CC (match_operand:DF 0 "register_operand" "")
329 (match_operand:DF 1 "general_operand" "")))]
332 s390_compare_op0 = operands[0];
333 s390_compare_op1 = operands[1];
337 (define_expand "cmpsf"
339 (compare:CC (match_operand:SF 0 "register_operand" "")
340 (match_operand:SF 1 "general_operand" "")))]
343 s390_compare_op0 = operands[0];
344 s390_compare_op1 = operands[1];
349 ; Test-under-Mask (zero_extract) instructions
351 (define_insn "*tmdi_ext"
353 (compare (zero_extract:DI (match_operand:DI 0 "register_operand" "d")
354 (match_operand:DI 1 "const_int_operand" "n")
355 (match_operand:DI 2 "const_int_operand" "n"))
357 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
358 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
359 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 64
360 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
361 == INTVAL (operands[2]) >> 4"
363 int part = INTVAL (operands[2]) >> 4;
364 int block = (1 << INTVAL (operands[1])) - 1;
365 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
367 operands[2] = GEN_INT (block << shift);
371 case 0: return "tmhh\t%0,%x2";
372 case 1: return "tmhl\t%0,%x2";
373 case 2: return "tmlh\t%0,%x2";
374 case 3: return "tmll\t%0,%x2";
378 [(set_attr "op_type" "RI")])
380 (define_insn "*tmsi_ext"
382 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
383 (match_operand:SI 1 "const_int_operand" "n")
384 (match_operand:SI 2 "const_int_operand" "n"))
386 "s390_match_ccmode(insn, CCTmode)
387 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
388 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
389 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
390 == INTVAL (operands[2]) >> 4"
392 int part = INTVAL (operands[2]) >> 4;
393 int block = (1 << INTVAL (operands[1])) - 1;
394 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
396 operands[2] = GEN_INT (block << shift);
400 case 0: return "tmh\t%0,%x2";
401 case 1: return "tml\t%0,%x2";
405 [(set_attr "op_type" "RI")])
407 (define_insn "*tmqi_ext"
409 (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,S")
410 (match_operand:SI 1 "const_int_operand" "n,n")
411 (match_operand:SI 2 "const_int_operand" "n,n"))
413 "s390_match_ccmode(insn, CCTmode)
414 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
415 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
417 int block = (1 << INTVAL (operands[1])) - 1;
418 int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
420 operands[2] = GEN_INT (block << shift);
421 return which_alternative == 0 ? "tm\t%0,%b2" : "tmy\t%0,%b2";
423 [(set_attr "op_type" "SI,SIY")])
425 ; Test-under-Mask instructions
427 (define_insn "*tmdi_mem"
429 (compare (and:DI (match_operand:DI 0 "memory_operand" "Q,S")
430 (match_operand:DI 1 "immediate_operand" "n,n"))
431 (match_operand:DI 2 "immediate_operand" "n,n")))]
432 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
433 && s390_single_qi (operands[1], DImode, 0) >= 0"
435 int part = s390_single_qi (operands[1], DImode, 0);
436 operands[1] = GEN_INT (s390_extract_qi (operands[1], DImode, part));
438 operands[0] = gen_rtx_MEM (QImode,
439 plus_constant (XEXP (operands[0], 0), part));
440 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
442 [(set_attr "op_type" "SI,SIY")])
444 (define_insn "*tmsi_mem"
446 (compare (and:SI (match_operand:SI 0 "memory_operand" "Q,S")
447 (match_operand:SI 1 "immediate_operand" "n,n"))
448 (match_operand:SI 2 "immediate_operand" "n,n")))]
449 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
450 && s390_single_qi (operands[1], SImode, 0) >= 0"
452 int part = s390_single_qi (operands[1], SImode, 0);
453 operands[1] = GEN_INT (s390_extract_qi (operands[1], SImode, part));
455 operands[0] = gen_rtx_MEM (QImode,
456 plus_constant (XEXP (operands[0], 0), part));
457 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
459 [(set_attr "op_type" "SI")])
461 (define_insn "*tmhi_mem"
463 (compare (and:SI (subreg:SI (match_operand:HI 0 "memory_operand" "Q,S") 0)
464 (match_operand:SI 1 "immediate_operand" "n,n"))
465 (match_operand:SI 2 "immediate_operand" "n,n")))]
466 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
467 && s390_single_qi (operands[1], HImode, 0) >= 0"
469 int part = s390_single_qi (operands[1], HImode, 0);
470 operands[1] = GEN_INT (s390_extract_qi (operands[1], HImode, part));
472 operands[0] = gen_rtx_MEM (QImode,
473 plus_constant (XEXP (operands[0], 0), part));
474 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
476 [(set_attr "op_type" "SI")])
478 (define_insn "*tmqi_mem"
480 (compare (and:SI (subreg:SI (match_operand:QI 0 "memory_operand" "Q,S") 0)
481 (match_operand:SI 1 "immediate_operand" "n,n"))
482 (match_operand:SI 2 "immediate_operand" "n,n")))]
483 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))"
487 [(set_attr "op_type" "SI,SIY")])
489 (define_insn "*tmdi_reg"
491 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d")
492 (match_operand:DI 1 "immediate_operand" "n"))
493 (match_operand:DI 2 "immediate_operand" "n")))]
495 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
496 && s390_single_hi (operands[1], DImode, 0) >= 0"
498 int part = s390_single_hi (operands[1], DImode, 0);
499 operands[1] = GEN_INT (s390_extract_hi (operands[1], DImode, part));
503 case 0: return "tmhh\t%0,%x1";
504 case 1: return "tmhl\t%0,%x1";
505 case 2: return "tmlh\t%0,%x1";
506 case 3: return "tmll\t%0,%x1";
510 [(set_attr "op_type" "RI")])
512 (define_insn "*tmsi_reg"
514 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d")
515 (match_operand:SI 1 "immediate_operand" "n"))
516 (match_operand:SI 2 "immediate_operand" "n")))]
517 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
518 && s390_single_hi (operands[1], SImode, 0) >= 0"
520 int part = s390_single_hi (operands[1], SImode, 0);
521 operands[1] = GEN_INT (s390_extract_hi (operands[1], SImode, part));
525 case 0: return "tmh\t%0,%x1";
526 case 1: return "tml\t%0,%x1";
530 [(set_attr "op_type" "RI")])
532 (define_insn "*tmhi_full"
534 (compare (match_operand:HI 0 "register_operand" "d")
535 (match_operand:HI 1 "immediate_operand" "n")))]
536 "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
538 [(set_attr "op_type" "RX")])
540 (define_insn "*tmqi_full"
542 (compare (match_operand:QI 0 "register_operand" "d")
543 (match_operand:QI 1 "immediate_operand" "n")))]
544 "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
546 [(set_attr "op_type" "RI")])
549 ; Load-and-Test instructions
551 (define_insn "*tstdi_sign"
553 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
554 (const_int 32)) (const_int 32))
555 (match_operand:DI 1 "const0_operand" "")))
556 (set (match_operand:DI 2 "register_operand" "=d")
557 (sign_extend:DI (match_dup 0)))]
558 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
560 [(set_attr "op_type" "RRE")])
562 (define_insn "*tstdi"
564 (compare (match_operand:DI 0 "register_operand" "d")
565 (match_operand:DI 1 "const0_operand" "")))
566 (set (match_operand:DI 2 "register_operand" "=d")
568 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
570 [(set_attr "op_type" "RRE")])
572 (define_insn "*tstdi_cconly"
574 (compare (match_operand:DI 0 "register_operand" "d")
575 (match_operand:DI 1 "const0_operand" "")))]
576 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
578 [(set_attr "op_type" "RRE")])
580 (define_insn "*tstdi_cconly_31"
582 (compare (match_operand:DI 0 "register_operand" "d")
583 (match_operand:DI 1 "const0_operand" "")))]
584 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
586 [(set_attr "op_type" "RS")
587 (set_attr "atype" "reg")])
590 (define_insn "*tstsi"
592 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
593 (match_operand:SI 1 "const0_operand" "")))
594 (set (match_operand:SI 2 "register_operand" "=d,d,d")
596 "s390_match_ccmode(insn, CCSmode)"
601 [(set_attr "op_type" "RR,RS,RSY")])
603 (define_insn "*tstsi_cconly"
605 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
606 (match_operand:SI 1 "const0_operand" "")))
607 (clobber (match_scratch:SI 2 "=X,d,d"))]
608 "s390_match_ccmode(insn, CCSmode)"
613 [(set_attr "op_type" "RR,RS,RSY")])
615 (define_insn "*tstsi_cconly2"
617 (compare (match_operand:SI 0 "register_operand" "d")
618 (match_operand:SI 1 "const0_operand" "")))]
619 "s390_match_ccmode(insn, CCSmode)"
621 [(set_attr "op_type" "RR")])
623 (define_insn "*tsthiCCT"
625 (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d")
626 (match_operand:HI 1 "const0_operand" "")))
627 (set (match_operand:HI 2 "register_operand" "=d,d,0")
629 "s390_match_ccmode(insn, CCTmode)"
634 [(set_attr "op_type" "RS,RSY,RI")])
636 (define_insn "*tsthiCCT_cconly"
638 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
639 (match_operand:HI 1 "const0_operand" "")))
640 (clobber (match_scratch:HI 2 "=d,d,X"))]
641 "s390_match_ccmode(insn, CCTmode)"
646 [(set_attr "op_type" "RS,RSY,RI")])
648 (define_insn "*tsthi"
650 (compare (match_operand:HI 0 "s_operand" "Q,S")
651 (match_operand:HI 1 "const0_operand" "")))
652 (set (match_operand:HI 2 "register_operand" "=d,d")
654 "s390_match_ccmode(insn, CCSmode)"
658 [(set_attr "op_type" "RS,RSY")])
660 (define_insn "*tsthi_cconly"
662 (compare (match_operand:HI 0 "s_operand" "Q,S")
663 (match_operand:HI 1 "const0_operand" "")))
664 (clobber (match_scratch:HI 2 "=d,d"))]
665 "s390_match_ccmode(insn, CCSmode)"
669 [(set_attr "op_type" "RS,RSY")])
671 (define_insn "*tstqiCCT"
673 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
674 (match_operand:QI 1 "const0_operand" "")))
675 (set (match_operand:QI 2 "register_operand" "=d,d,0")
677 "s390_match_ccmode(insn, CCTmode)"
682 [(set_attr "op_type" "RS,RSY,RI")])
684 (define_insn "*tstqiCCT_cconly"
686 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
687 (match_operand:QI 1 "const0_operand" "")))]
688 "s390_match_ccmode(insn, CCTmode)"
693 [(set_attr "op_type" "SI,SIY,RI")])
695 (define_insn "*tstqi"
697 (compare (match_operand:QI 0 "s_operand" "Q,S")
698 (match_operand:QI 1 "const0_operand" "")))
699 (set (match_operand:QI 2 "register_operand" "=d,d")
701 "s390_match_ccmode(insn, CCSmode)"
705 [(set_attr "op_type" "RS,RSY")])
707 (define_insn "*tstqi_cconly"
709 (compare (match_operand:QI 0 "s_operand" "Q,S")
710 (match_operand:QI 1 "const0_operand" "")))
711 (clobber (match_scratch:QI 2 "=d,d"))]
712 "s390_match_ccmode(insn, CCSmode)"
716 [(set_attr "op_type" "RS,RSY")])
719 ; Compare (signed) instructions
721 (define_insn "*cmpdi_ccs_sign"
723 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
724 (match_operand:DI 0 "register_operand" "d,d")))]
725 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
729 [(set_attr "op_type" "RRE,RXY")])
731 (define_insn "*cmpdi_ccs"
733 (compare (match_operand:DI 0 "register_operand" "d,d,d")
734 (match_operand:DI 1 "general_operand" "d,K,m")))]
735 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
740 [(set_attr "op_type" "RRE,RI,RXY")])
742 (define_insn "*cmpsi_ccs_sign"
744 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
745 (match_operand:SI 0 "register_operand" "d,d")))]
746 "s390_match_ccmode(insn, CCSRmode)"
750 [(set_attr "op_type" "RX,RXY")])
752 (define_insn "*cmpsi_ccs"
754 (compare (match_operand:SI 0 "register_operand" "d,d,d,d")
755 (match_operand:SI 1 "general_operand" "d,K,R,T")))]
756 "s390_match_ccmode(insn, CCSmode)"
762 [(set_attr "op_type" "RR,RI,RX,RXY")])
765 ; Compare (unsigned) instructions
767 (define_insn "*cmpdi_ccu_zero"
769 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
770 (match_operand:DI 0 "register_operand" "d,d")))]
771 "s390_match_ccmode(insn, CCURmode) && TARGET_64BIT"
775 [(set_attr "op_type" "RRE,RXY")])
777 (define_insn "*cmpdi_ccu"
779 (compare (match_operand:DI 0 "register_operand" "d,d")
780 (match_operand:DI 1 "general_operand" "d,m")))]
781 "s390_match_ccmode(insn, CCUmode) && TARGET_64BIT"
785 [(set_attr "op_type" "RRE,RXY")])
787 (define_insn "*cmpsi_ccu"
789 (compare (match_operand:SI 0 "register_operand" "d,d,d")
790 (match_operand:SI 1 "general_operand" "d,R,T")))]
791 "s390_match_ccmode(insn, CCUmode)"
796 [(set_attr "op_type" "RR,RX,RXY")])
798 (define_insn "*cmphi_ccu"
800 (compare (match_operand:HI 0 "register_operand" "d,d")
801 (match_operand:HI 1 "s_imm_operand" "Q,S")))]
802 "s390_match_ccmode(insn, CCUmode)"
806 [(set_attr "op_type" "RS,RSY")])
808 (define_insn "*cmpqi_ccu"
810 (compare (match_operand:QI 0 "register_operand" "d,d")
811 (match_operand:QI 1 "s_imm_operand" "Q,S")))]
812 "s390_match_ccmode(insn, CCUmode)"
816 [(set_attr "op_type" "RS,RSY")])
820 (compare (match_operand:QI 0 "memory_operand" "Q,S")
821 (match_operand:QI 1 "immediate_operand" "n,n")))]
822 "s390_match_ccmode (insn, CCUmode)"
826 [(set_attr "op_type" "SI,SIY")])
828 (define_insn "*cmpdi_ccu_mem"
830 (compare (match_operand:DI 0 "s_operand" "Q")
831 (match_operand:DI 1 "s_imm_operand" "Q")))]
832 "s390_match_ccmode(insn, CCUmode)"
834 [(set_attr "op_type" "SS")])
836 (define_insn "*cmpsi_ccu_mem"
838 (compare (match_operand:SI 0 "s_operand" "Q")
839 (match_operand:SI 1 "s_imm_operand" "Q")))]
840 "s390_match_ccmode(insn, CCUmode)"
842 [(set_attr "op_type" "SS")])
844 (define_insn "*cmphi_ccu_mem"
846 (compare (match_operand:HI 0 "s_operand" "Q")
847 (match_operand:HI 1 "s_imm_operand" "Q")))]
848 "s390_match_ccmode(insn, CCUmode)"
850 [(set_attr "op_type" "SS")])
852 (define_insn "*cmpqi_ccu_mem"
854 (compare (match_operand:QI 0 "s_operand" "Q")
855 (match_operand:QI 1 "s_imm_operand" "Q")))]
856 "s390_match_ccmode(insn, CCUmode)"
858 [(set_attr "op_type" "SS")])
863 (define_insn "*cmpdf_ccs_0"
865 (compare (match_operand:DF 0 "register_operand" "f")
866 (match_operand:DF 1 "const0_operand" "")))]
867 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
869 [(set_attr "op_type" "RRE")
870 (set_attr "type" "fsimpd")])
872 (define_insn "*cmpdf_ccs_0_ibm"
874 (compare (match_operand:DF 0 "register_operand" "f")
875 (match_operand:DF 1 "const0_operand" "")))]
876 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
878 [(set_attr "op_type" "RR")
879 (set_attr "type" "fsimpd")])
881 (define_insn "*cmpdf_ccs"
883 (compare (match_operand:DF 0 "register_operand" "f,f")
884 (match_operand:DF 1 "general_operand" "f,R")))]
885 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
889 [(set_attr "op_type" "RRE,RXE")
890 (set_attr "type" "fsimpd")])
892 (define_insn "*cmpdf_ccs_ibm"
894 (compare (match_operand:DF 0 "register_operand" "f,f")
895 (match_operand:DF 1 "general_operand" "f,R")))]
896 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
900 [(set_attr "op_type" "RR,RX")
901 (set_attr "type" "fsimpd")])
906 (define_insn "*cmpsf_ccs_0"
908 (compare (match_operand:SF 0 "register_operand" "f")
909 (match_operand:SF 1 "const0_operand" "")))]
910 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
912 [(set_attr "op_type" "RRE")
913 (set_attr "type" "fsimps")])
915 (define_insn "*cmpsf_ccs_0_ibm"
917 (compare (match_operand:SF 0 "register_operand" "f")
918 (match_operand:SF 1 "const0_operand" "")))]
919 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
921 [(set_attr "op_type" "RR")
922 (set_attr "type" "fsimps")])
924 (define_insn "*cmpsf_ccs"
926 (compare (match_operand:SF 0 "register_operand" "f,f")
927 (match_operand:SF 1 "general_operand" "f,R")))]
928 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
932 [(set_attr "op_type" "RRE,RXE")
933 (set_attr "type" "fsimps")])
935 (define_insn "*cmpsf_ccs"
937 (compare (match_operand:SF 0 "register_operand" "f,f")
938 (match_operand:SF 1 "general_operand" "f,R")))]
939 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
943 [(set_attr "op_type" "RR,RX")
944 (set_attr "type" "fsimps")])
948 ;;- Move instructions.
952 ; movti instruction pattern(s).
956 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
957 (match_operand:TI 1 "general_operand" "QS,d,dKm,d,Q"))]
965 [(set_attr "op_type" "RSY,RSY,NN,NN,SS")
966 (set_attr "type" "lm,stm,*,*,cs")])
969 [(set (match_operand:TI 0 "nonimmediate_operand" "")
970 (match_operand:TI 1 "general_operand" ""))]
971 "TARGET_64BIT && reload_completed
972 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
973 [(set (match_dup 2) (match_dup 4))
974 (set (match_dup 3) (match_dup 5))]
976 operands[2] = operand_subword (operands[0], 0, 0, TImode);
977 operands[3] = operand_subword (operands[0], 1, 0, TImode);
978 operands[4] = operand_subword (operands[1], 0, 0, TImode);
979 operands[5] = operand_subword (operands[1], 1, 0, TImode);
983 [(set (match_operand:TI 0 "nonimmediate_operand" "")
984 (match_operand:TI 1 "general_operand" ""))]
985 "TARGET_64BIT && reload_completed
986 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
987 [(set (match_dup 2) (match_dup 4))
988 (set (match_dup 3) (match_dup 5))]
990 operands[2] = operand_subword (operands[0], 1, 0, TImode);
991 operands[3] = operand_subword (operands[0], 0, 0, TImode);
992 operands[4] = operand_subword (operands[1], 1, 0, TImode);
993 operands[5] = operand_subword (operands[1], 0, 0, TImode);
997 [(set (match_operand:TI 0 "register_operand" "")
998 (match_operand:TI 1 "memory_operand" ""))]
999 "TARGET_64BIT && reload_completed
1000 && !s_operand (operands[1], VOIDmode)"
1001 [(set (match_dup 0) (match_dup 1))]
1003 rtx addr = operand_subword (operands[0], 1, 0, TImode);
1004 s390_load_address (addr, XEXP (operands[1], 0));
1005 operands[1] = replace_equiv_address (operands[1], addr);
1008 (define_expand "reload_outti"
1009 [(parallel [(match_operand:TI 0 "memory_operand" "")
1010 (match_operand:TI 1 "register_operand" "d")
1011 (match_operand:DI 2 "register_operand" "=&a")])]
1014 s390_load_address (operands[2], XEXP (operands[0], 0));
1015 operands[0] = replace_equiv_address (operands[0], operands[2]);
1016 emit_move_insn (operands[0], operands[1]);
1021 ; movdi instruction pattern(s).
1024 (define_expand "movdi"
1025 [(set (match_operand:DI 0 "general_operand" "")
1026 (match_operand:DI 1 "general_operand" ""))]
1029 /* Handle symbolic constants. */
1030 if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1031 emit_symbolic_move (operands);
1033 /* During and after reload, we need to force constants
1034 to the literal pool ourselves, if necessary. */
1035 if ((reload_in_progress || reload_completed)
1036 && CONSTANT_P (operands[1])
1037 && (!legitimate_reload_constant_p (operands[1])
1038 || FP_REG_P (operands[0])))
1039 operands[1] = force_const_mem (DImode, operands[1]);
1042 (define_insn "*movdi_lhi"
1043 [(set (match_operand:DI 0 "register_operand" "=d")
1044 (match_operand:DI 1 "immediate_operand" "K"))]
1046 && GET_CODE (operands[1]) == CONST_INT
1047 && CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K')
1048 && !FP_REG_P (operands[0])"
1050 [(set_attr "op_type" "RI")])
1052 (define_insn "*movdi_lli"
1053 [(set (match_operand:DI 0 "register_operand" "=d")
1054 (match_operand:DI 1 "immediate_operand" "n"))]
1055 "TARGET_64BIT && s390_single_hi (operands[1], DImode, 0) >= 0
1056 && !FP_REG_P (operands[0])"
1058 int part = s390_single_hi (operands[1], DImode, 0);
1059 operands[1] = GEN_INT (s390_extract_hi (operands[1], DImode, part));
1063 case 0: return "llihh\t%0,%x1";
1064 case 1: return "llihl\t%0,%x1";
1065 case 2: return "llilh\t%0,%x1";
1066 case 3: return "llill\t%0,%x1";
1070 [(set_attr "op_type" "RI")])
1072 (define_insn "*movdi_lay"
1073 [(set (match_operand:DI 0 "register_operand" "=d")
1074 (match_operand:DI 1 "address_operand" "p"))]
1076 && TARGET_LONG_DISPLACEMENT
1077 && GET_CODE (operands[1]) == CONST_INT
1078 && !FP_REG_P (operands[0])"
1080 [(set_attr "op_type" "RXY")
1081 (set_attr "type" "la")])
1083 (define_insn "*movdi_larl"
1084 [(set (match_operand:DI 0 "register_operand" "=d")
1085 (match_operand:DI 1 "larl_operand" "X"))]
1087 && !FP_REG_P (operands[0])"
1089 [(set_attr "op_type" "RIL")
1090 (set_attr "type" "larl")])
1092 (define_insn "*movdi_64"
1093 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,m,!*f,!*f,!*f,!R,!T,?Q")
1094 (match_operand:DI 1 "general_operand" "d,m,d,*f,R,T,*f,*f,?Q"))]
1106 [(set_attr "op_type" "RRE,RXY,RXY,RR,RX,RXY,RX,RXY,SS")
1107 (set_attr "type" "lr,load,store,floadd,floadd,floadd,fstored,fstored,cs")])
1109 (define_insn "*movdi_31"
1110 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,o,!*f,!*f,!*f,!R,!T,Q")
1111 (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,R,T,*f,*f,Q"))]
1124 [(set_attr "op_type" "RS,RS,NN,NN,RR,RX,RXY,RX,RXY,SS")
1125 (set_attr "type" "lm,stm,*,*,floadd,floadd,floadd,fstored,fstored,cs")])
1128 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1129 (match_operand:DI 1 "general_operand" ""))]
1130 "!TARGET_64BIT && reload_completed
1131 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1132 [(set (match_dup 2) (match_dup 4))
1133 (set (match_dup 3) (match_dup 5))]
1135 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1136 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1137 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1138 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1142 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1143 (match_operand:DI 1 "general_operand" ""))]
1144 "!TARGET_64BIT && reload_completed
1145 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1146 [(set (match_dup 2) (match_dup 4))
1147 (set (match_dup 3) (match_dup 5))]
1149 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1150 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1151 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1152 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1156 [(set (match_operand:DI 0 "register_operand" "")
1157 (match_operand:DI 1 "memory_operand" ""))]
1158 "!TARGET_64BIT && reload_completed
1159 && !FP_REG_P (operands[0])
1160 && !s_operand (operands[1], VOIDmode)"
1161 [(set (match_dup 0) (match_dup 1))]
1163 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1164 s390_load_address (addr, XEXP (operands[1], 0));
1165 operands[1] = replace_equiv_address (operands[1], addr);
1168 (define_expand "reload_outdi"
1169 [(parallel [(match_operand:DI 0 "memory_operand" "")
1170 (match_operand:DI 1 "register_operand" "d")
1171 (match_operand:SI 2 "register_operand" "=&a")])]
1174 s390_load_address (operands[2], XEXP (operands[0], 0));
1175 operands[0] = replace_equiv_address (operands[0], operands[2]);
1176 emit_move_insn (operands[0], operands[1]);
1181 [(set (match_operand:DI 0 "register_operand" "")
1182 (mem:DI (match_operand 1 "address_operand" "")))]
1184 && !FP_REG_P (operands[0])
1185 && GET_CODE (operands[1]) == SYMBOL_REF
1186 && CONSTANT_POOL_ADDRESS_P (operands[1])
1187 && get_pool_mode (operands[1]) == DImode
1188 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1189 [(set (match_dup 0) (match_dup 2))]
1190 "operands[2] = get_pool_constant (operands[1]);")
1193 ; movsi instruction pattern(s).
1196 (define_expand "movsi"
1197 [(set (match_operand:SI 0 "general_operand" "")
1198 (match_operand:SI 1 "general_operand" ""))]
1201 /* Handle symbolic constants. */
1202 if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1203 emit_symbolic_move (operands);
1205 /* expr.c tries to load an effective address using
1206 force_reg. This fails because we don't have a
1207 generic load_address pattern. Convert the move
1208 to a proper arithmetic operation instead, unless
1209 it is guaranteed to be OK. */
1210 if (GET_CODE (operands[1]) == PLUS
1211 && !legitimate_la_operand_p (operands[1]))
1213 operands[1] = force_operand (operands[1], operands[0]);
1214 if (operands[1] == operands[0])
1218 /* During and after reload, we need to force constants
1219 to the literal pool ourselves, if necessary. */
1220 if ((reload_in_progress || reload_completed)
1221 && CONSTANT_P (operands[1])
1222 && (!legitimate_reload_constant_p (operands[1])
1223 || FP_REG_P (operands[0])))
1224 operands[1] = force_const_mem (SImode, operands[1]);
1227 (define_insn "*movsi_lhi"
1228 [(set (match_operand:SI 0 "register_operand" "=d")
1229 (match_operand:SI 1 "immediate_operand" "K"))]
1230 "GET_CODE (operands[1]) == CONST_INT
1231 && CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K')
1232 && !FP_REG_P (operands[0])"
1234 [(set_attr "op_type" "RI")])
1236 (define_insn "*movsi_lli"
1237 [(set (match_operand:SI 0 "register_operand" "=d")
1238 (match_operand:SI 1 "immediate_operand" "n"))]
1239 "TARGET_ZARCH && s390_single_hi (operands[1], SImode, 0) >= 0
1240 && !FP_REG_P (operands[0])"
1242 int part = s390_single_hi (operands[1], SImode, 0);
1243 operands[1] = GEN_INT (s390_extract_hi (operands[1], SImode, part));
1247 case 0: return "llilh\t%0,%x1";
1248 case 1: return "llill\t%0,%x1";
1252 [(set_attr "op_type" "RI")])
1254 (define_insn "*movsi_lay"
1255 [(set (match_operand:SI 0 "register_operand" "=d")
1256 (match_operand:SI 1 "address_operand" "p"))]
1257 "TARGET_LONG_DISPLACEMENT
1258 && GET_CODE (operands[1]) == CONST_INT
1259 && !FP_REG_P (operands[0])"
1261 [(set_attr "op_type" "RXY")
1262 (set_attr "type" "la")])
1264 (define_insn "*movsi_larl"
1265 [(set (match_operand:SI 0 "register_operand" "=d")
1266 (match_operand:SI 1 "larl_operand" "X"))]
1267 "!TARGET_64BIT && TARGET_CPU_ZARCH
1268 && !FP_REG_P (operands[0])"
1270 [(set_attr "op_type" "RIL")
1271 (set_attr "type" "larl")])
1273 (define_insn "*movsi"
1274 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,T,!*f,!*f,!*f,!R,!T,?Q")
1275 (match_operand:SI 1 "general_operand" "d,R,T,d,d,*f,R,T,*f,*f,?Q"))]
1289 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1290 (set_attr "type" "lr,load,load,store,store,floads,floads,floads,fstores,fstores,cs")])
1293 [(set (match_operand:SI 0 "register_operand" "")
1294 (mem:SI (match_operand 1 "address_operand" "")))]
1295 "!FP_REG_P (operands[0])
1296 && GET_CODE (operands[1]) == SYMBOL_REF
1297 && CONSTANT_POOL_ADDRESS_P (operands[1])
1298 && get_pool_mode (operands[1]) == SImode
1299 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1300 [(set (match_dup 0) (match_dup 2))]
1301 "operands[2] = get_pool_constant (operands[1]);")
1304 ; movhi instruction pattern(s).
1307 (define_expand "movhi"
1308 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1309 (match_operand:HI 1 "general_operand" ""))]
1312 /* Make it explicit that loading a register from memory
1313 always sign-extends (at least) to SImode. */
1314 if (optimize && !no_new_pseudos
1315 && register_operand (operands[0], VOIDmode)
1316 && GET_CODE (operands[1]) == MEM
1317 && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
1319 rtx tmp = gen_reg_rtx (SImode);
1320 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1321 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1322 operands[1] = gen_lowpart (HImode, tmp);
1326 (define_insn "*movhi"
1327 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1328 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1338 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1339 (set_attr "type" "lr,*,*,*,store,store,cs")])
1342 [(set (match_operand:HI 0 "register_operand" "")
1343 (mem:HI (match_operand 1 "address_operand" "")))]
1344 "GET_CODE (operands[1]) == SYMBOL_REF
1345 && CONSTANT_POOL_ADDRESS_P (operands[1])
1346 && get_pool_mode (operands[1]) == HImode
1347 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1348 [(set (match_dup 0) (match_dup 2))]
1349 "operands[2] = get_pool_constant (operands[1]);")
1352 ; movqi instruction pattern(s).
1355 (define_expand "movqi"
1356 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1357 (match_operand:QI 1 "general_operand" ""))]
1360 /* On z/Architecture, zero-extending from memory to register
1361 is just as fast as a QImode load. */
1362 if (TARGET_ZARCH && optimize && !no_new_pseudos
1363 && register_operand (operands[0], VOIDmode)
1364 && GET_CODE (operands[1]) == MEM
1365 && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
1367 rtx tmp = gen_reg_rtx (word_mode);
1368 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1369 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1370 operands[1] = gen_lowpart (QImode, tmp);
1374 (define_insn "*movqi"
1375 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1376 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1388 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1389 (set_attr "type" "lr,*,*,*,store,store,store,store,cs")])
1392 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1393 (mem:QI (match_operand 1 "address_operand" "")))]
1394 "GET_CODE (operands[1]) == SYMBOL_REF
1395 && CONSTANT_POOL_ADDRESS_P (operands[1])
1396 && get_pool_mode (operands[1]) == QImode
1397 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1398 [(set (match_dup 0) (match_dup 2))]
1399 "operands[2] = get_pool_constant (operands[1]);")
1402 ; movstrictqi instruction pattern(s).
1405 (define_insn "*movstrictqi"
1406 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1407 (match_operand:QI 1 "memory_operand" "R,T"))]
1412 [(set_attr "op_type" "RX,RXY")])
1415 ; movstricthi instruction pattern(s).
1418 (define_insn "*movstricthi"
1419 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1420 (match_operand:HI 1 "s_imm_operand" "Q,S"))
1421 (clobber (reg:CC 33))]
1426 [(set_attr "op_type" "RS,RSY")])
1429 ; movstrictsi instruction pattern(s).
1432 (define_insn "movstrictsi"
1433 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d"))
1434 (match_operand:SI 1 "general_operand" "d,R,T"))]
1440 [(set_attr "op_type" "RR,RX,RXY")
1441 (set_attr "type" "lr,load,load")])
1444 ; movdf instruction pattern(s).
1447 (define_expand "movdf"
1448 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1449 (match_operand:DF 1 "general_operand" ""))]
1452 /* During and after reload, we need to force constants
1453 to the literal pool ourselves, if necessary. */
1454 if ((reload_in_progress || reload_completed)
1455 && CONSTANT_P (operands[1]))
1456 operands[1] = force_const_mem (DFmode, operands[1]);
1459 (define_insn "*movdf_64"
1460 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1461 (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1473 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1474 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,cs")])
1476 (define_insn "*movdf_31"
1477 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1478 (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1491 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,NN,NN,SS")
1492 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,cs")])
1495 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1496 (match_operand:DF 1 "general_operand" ""))]
1497 "!TARGET_64BIT && reload_completed
1498 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1499 [(set (match_dup 2) (match_dup 4))
1500 (set (match_dup 3) (match_dup 5))]
1502 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1503 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1504 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1505 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1509 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1510 (match_operand:DF 1 "general_operand" ""))]
1511 "!TARGET_64BIT && reload_completed
1512 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1513 [(set (match_dup 2) (match_dup 4))
1514 (set (match_dup 3) (match_dup 5))]
1516 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1517 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1518 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1519 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1523 [(set (match_operand:DF 0 "register_operand" "")
1524 (match_operand:DF 1 "memory_operand" ""))]
1525 "!TARGET_64BIT && reload_completed
1526 && !FP_REG_P (operands[0])
1527 && !s_operand (operands[1], VOIDmode)"
1528 [(set (match_dup 0) (match_dup 1))]
1530 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1531 s390_load_address (addr, XEXP (operands[1], 0));
1532 operands[1] = replace_equiv_address (operands[1], addr);
1535 (define_expand "reload_outdf"
1536 [(parallel [(match_operand:DF 0 "memory_operand" "")
1537 (match_operand:DF 1 "register_operand" "d")
1538 (match_operand:SI 2 "register_operand" "=&a")])]
1541 s390_load_address (operands[2], XEXP (operands[0], 0));
1542 operands[0] = replace_equiv_address (operands[0], operands[2]);
1543 emit_move_insn (operands[0], operands[1]);
1548 ; movsf instruction pattern(s).
1551 (define_expand "movsf"
1552 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1553 (match_operand:SF 1 "general_operand" ""))]
1556 /* During and after reload, we need to force constants
1557 to the literal pool ourselves, if necessary. */
1558 if ((reload_in_progress || reload_completed)
1559 && CONSTANT_P (operands[1]))
1560 operands[1] = force_const_mem (SFmode, operands[1]);
1563 (define_insn "*movsf"
1564 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1565 (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1579 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1580 (set_attr "type" "floads,floads,floads,fstores,fstores,lr,load,load,store,store,cs")])
1583 ; load_multiple pattern(s).
1586 (define_expand "load_multiple"
1587 [(match_par_dup 3 [(set (match_operand 0 "" "")
1588 (match_operand 1 "" ""))
1589 (use (match_operand 2 "" ""))])]
1592 enum machine_mode mode;
1598 /* Support only loading a constant number of fixed-point registers from
1599 memory and only bother with this if more than two */
1600 if (GET_CODE (operands[2]) != CONST_INT
1601 || INTVAL (operands[2]) < 2
1602 || INTVAL (operands[2]) > 16
1603 || GET_CODE (operands[1]) != MEM
1604 || GET_CODE (operands[0]) != REG
1605 || REGNO (operands[0]) >= 16)
1608 count = INTVAL (operands[2]);
1609 regno = REGNO (operands[0]);
1610 mode = GET_MODE (operands[0]);
1611 if (mode != SImode && mode != word_mode)
1614 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1617 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1619 from = XEXP (operands[1], 0);
1622 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1623 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1624 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1626 from = XEXP (XEXP (operands[1], 0), 0);
1627 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1632 if (from == frame_pointer_rtx || from == arg_pointer_rtx)
1637 from = force_reg (Pmode, XEXP (operands[1], 0));
1641 for (i = 0; i < count; i++)
1642 XVECEXP (operands[3], 0, i)
1643 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1644 change_address (operands[1], mode,
1645 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1648 (define_insn "*load_multiple_di"
1649 [(match_parallel 0 "load_multiple_operation"
1650 [(set (match_operand:DI 1 "register_operand" "=r")
1651 (match_operand:DI 2 "s_operand" "QS"))])]
1652 "word_mode == DImode"
1654 int words = XVECLEN (operands[0], 0);
1655 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1656 return "lmg\t%1,%0,%2";
1658 [(set_attr "op_type" "RSY")
1659 (set_attr "type" "lm")])
1661 (define_insn "*load_multiple_si"
1662 [(match_parallel 0 "load_multiple_operation"
1663 [(set (match_operand:SI 1 "register_operand" "=r,r")
1664 (match_operand:SI 2 "s_operand" "Q,S"))])]
1667 int words = XVECLEN (operands[0], 0);
1668 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1669 return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1671 [(set_attr "op_type" "RS,RSY")
1672 (set_attr "type" "lm")])
1675 ; store multiple pattern(s).
1678 (define_expand "store_multiple"
1679 [(match_par_dup 3 [(set (match_operand 0 "" "")
1680 (match_operand 1 "" ""))
1681 (use (match_operand 2 "" ""))])]
1684 enum machine_mode mode;
1690 /* Support only storing a constant number of fixed-point registers to
1691 memory and only bother with this if more than two. */
1692 if (GET_CODE (operands[2]) != CONST_INT
1693 || INTVAL (operands[2]) < 2
1694 || INTVAL (operands[2]) > 16
1695 || GET_CODE (operands[0]) != MEM
1696 || GET_CODE (operands[1]) != REG
1697 || REGNO (operands[1]) >= 16)
1700 count = INTVAL (operands[2]);
1701 regno = REGNO (operands[1]);
1702 mode = GET_MODE (operands[1]);
1703 if (mode != SImode && mode != word_mode)
1706 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1710 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1712 to = XEXP (operands[0], 0);
1715 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1716 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1717 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1719 to = XEXP (XEXP (operands[0], 0), 0);
1720 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1725 if (to == frame_pointer_rtx || to == arg_pointer_rtx)
1730 to = force_reg (Pmode, XEXP (operands[0], 0));
1734 for (i = 0; i < count; i++)
1735 XVECEXP (operands[3], 0, i)
1736 = gen_rtx_SET (VOIDmode,
1737 change_address (operands[0], mode,
1738 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1739 gen_rtx_REG (mode, regno + i));
1742 (define_insn "*store_multiple_di"
1743 [(match_parallel 0 "store_multiple_operation"
1744 [(set (match_operand:DI 1 "s_operand" "=QS")
1745 (match_operand:DI 2 "register_operand" "r"))])]
1746 "word_mode == DImode"
1748 int words = XVECLEN (operands[0], 0);
1749 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1750 return "stmg\t%2,%0,%1";
1752 [(set_attr "op_type" "RSY")
1753 (set_attr "type" "stm")])
1756 (define_insn "*store_multiple_si"
1757 [(match_parallel 0 "store_multiple_operation"
1758 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1759 (match_operand:SI 2 "register_operand" "r,r"))])]
1762 int words = XVECLEN (operands[0], 0);
1763 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1764 return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1766 [(set_attr "op_type" "RS,RSY")
1767 (set_attr "type" "stm")])
1770 ;; String instructions.
1774 ; movstrM instruction pattern(s).
1777 (define_expand "movstrdi"
1778 [(set (match_operand:BLK 0 "memory_operand" "")
1779 (match_operand:BLK 1 "memory_operand" ""))
1780 (use (match_operand:DI 2 "general_operand" ""))
1781 (match_operand 3 "" "")]
1783 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1785 (define_expand "movstrsi"
1786 [(set (match_operand:BLK 0 "memory_operand" "")
1787 (match_operand:BLK 1 "memory_operand" ""))
1788 (use (match_operand:SI 2 "general_operand" ""))
1789 (match_operand 3 "" "")]
1791 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1793 ; Move a block that is up to 256 bytes in length.
1794 ; The block length is taken as (operands[2] % 256) + 1.
1796 (define_expand "movstr_short"
1798 [(set (match_operand:BLK 0 "memory_operand" "")
1799 (match_operand:BLK 1 "memory_operand" ""))
1800 (use (match_operand 2 "nonmemory_operand" ""))
1801 (clobber (match_dup 3))])]
1803 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1805 (define_insn "*movstr_short"
1806 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1807 (match_operand:BLK 1 "memory_operand" "Q,Q"))
1808 (use (match_operand 2 "nonmemory_operand" "n,a"))
1809 (clobber (match_scratch 3 "=X,&a"))]
1810 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
1811 && GET_MODE (operands[3]) == Pmode"
1813 switch (which_alternative)
1816 return "mvc\t%O0(%b2+1,%R0),%1";
1819 output_asm_insn ("bras\t%3,.+10", operands);
1820 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
1821 return "ex\t%2,0(%3)";
1827 [(set_attr "op_type" "SS,NN")
1828 (set_attr "type" "cs,cs")
1829 (set_attr "atype" "*,agen")
1830 (set_attr "length" "*,14")])
1832 ; Move a block of arbitrary length.
1834 (define_expand "movstr_long"
1836 [(clobber (match_dup 2))
1837 (clobber (match_dup 3))
1838 (set (match_operand:BLK 0 "memory_operand" "")
1839 (match_operand:BLK 1 "memory_operand" ""))
1840 (use (match_operand 2 "general_operand" ""))
1842 (clobber (reg:CC 33))])]
1845 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1846 rtx reg0 = gen_reg_rtx (dword_mode);
1847 rtx reg1 = gen_reg_rtx (dword_mode);
1848 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1849 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
1850 rtx len0 = gen_lowpart (Pmode, reg0);
1851 rtx len1 = gen_lowpart (Pmode, reg1);
1853 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1854 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1855 emit_move_insn (len0, operands[2]);
1857 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
1858 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1859 emit_move_insn (len1, operands[2]);
1861 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1862 operands[1] = replace_equiv_address_nv (operands[1], addr1);
1867 (define_insn "*movstr_long_64"
1868 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1869 (clobber (match_operand:TI 1 "register_operand" "=d"))
1870 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1871 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
1874 (clobber (reg:CC 33))]
1876 "mvcle\t%0,%1,0\;jo\t.-4"
1877 [(set_attr "op_type" "NN")
1878 (set_attr "type" "vs")
1879 (set_attr "length" "8")])
1881 (define_insn "*movstr_long_31"
1882 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1883 (clobber (match_operand:DI 1 "register_operand" "=d"))
1884 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1885 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
1888 (clobber (reg:CC 33))]
1890 "mvcle\t%0,%1,0\;jo\t.-4"
1891 [(set_attr "op_type" "NN")
1892 (set_attr "type" "vs")
1893 (set_attr "length" "8")])
1896 ; clrstrM instruction pattern(s).
1899 (define_expand "clrstrdi"
1900 [(set (match_operand:BLK 0 "memory_operand" "")
1902 (use (match_operand:DI 1 "general_operand" ""))
1903 (match_operand 2 "" "")]
1905 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
1907 (define_expand "clrstrsi"
1908 [(set (match_operand:BLK 0 "memory_operand" "")
1910 (use (match_operand:SI 1 "general_operand" ""))
1911 (match_operand 2 "" "")]
1913 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
1915 ; Clear a block that is up to 256 bytes in length.
1916 ; The block length is taken as (operands[1] % 256) + 1.
1918 (define_expand "clrstr_short"
1920 [(set (match_operand:BLK 0 "memory_operand" "")
1922 (use (match_operand 1 "nonmemory_operand" ""))
1923 (clobber (match_dup 2))
1924 (clobber (reg:CC 33))])]
1926 "operands[2] = gen_rtx_SCRATCH (Pmode);")
1928 (define_insn "*clrstr_short"
1929 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1931 (use (match_operand 1 "nonmemory_operand" "n,a"))
1932 (clobber (match_scratch 2 "=X,&a"))
1933 (clobber (reg:CC 33))]
1934 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
1935 && GET_MODE (operands[2]) == Pmode"
1937 switch (which_alternative)
1940 return "xc\t%O0(%b1+1,%R0),%0";
1943 output_asm_insn ("bras\t%2,.+10", operands);
1944 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
1945 return "ex\t%1,0(%2)";
1951 [(set_attr "op_type" "SS,NN")
1952 (set_attr "type" "cs,cs")
1953 (set_attr "atype" "*,agen")
1954 (set_attr "length" "*,14")])
1956 ; Clear a block of arbitrary length.
1958 (define_expand "clrstr_long"
1960 [(clobber (match_dup 1))
1961 (set (match_operand:BLK 0 "memory_operand" "")
1963 (use (match_operand 1 "general_operand" ""))
1965 (clobber (reg:CC 33))])]
1968 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1969 rtx reg0 = gen_reg_rtx (dword_mode);
1970 rtx reg1 = gen_reg_rtx (dword_mode);
1971 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1972 rtx len0 = gen_lowpart (Pmode, reg0);
1974 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1975 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1976 emit_move_insn (len0, operands[1]);
1978 emit_move_insn (reg1, const0_rtx);
1980 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1985 (define_insn "*clrstr_long_64"
1986 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1987 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1990 (use (match_operand:TI 1 "register_operand" "d"))
1991 (clobber (reg:CC 33))]
1993 "mvcle\t%0,%1,0\;jo\t.-4"
1994 [(set_attr "op_type" "NN")
1995 (set_attr "type" "vs")
1996 (set_attr "length" "8")])
1998 (define_insn "*clrstr_long_31"
1999 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2000 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2003 (use (match_operand:DI 1 "register_operand" "d"))
2004 (clobber (reg:CC 33))]
2006 "mvcle\t%0,%1,0\;jo\t.-4"
2007 [(set_attr "op_type" "NN")
2008 (set_attr "type" "vs")
2009 (set_attr "length" "8")])
2012 ; cmpmemM instruction pattern(s).
2015 (define_expand "cmpmemdi"
2016 [(set (match_operand:DI 0 "register_operand" "")
2017 (compare:DI (match_operand:BLK 1 "memory_operand" "")
2018 (match_operand:BLK 2 "memory_operand" "") ) )
2019 (use (match_operand:DI 3 "general_operand" ""))
2020 (use (match_operand:DI 4 "" ""))]
2022 "s390_expand_cmpmem (operands[0], operands[1],
2023 operands[2], operands[3]); DONE;")
2025 (define_expand "cmpmemsi"
2026 [(set (match_operand:SI 0 "register_operand" "")
2027 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2028 (match_operand:BLK 2 "memory_operand" "") ) )
2029 (use (match_operand:SI 3 "general_operand" ""))
2030 (use (match_operand:SI 4 "" ""))]
2032 "s390_expand_cmpmem (operands[0], operands[1],
2033 operands[2], operands[3]); DONE;")
2035 ; Compare a block that is up to 256 bytes in length.
2036 ; The block length is taken as (operands[2] % 256) + 1.
2038 (define_expand "cmpmem_short"
2041 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2042 (match_operand:BLK 1 "memory_operand" "")))
2043 (use (match_operand 2 "nonmemory_operand" ""))
2044 (clobber (match_dup 3))])]
2046 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2048 (define_insn "*cmpmem_short"
2050 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2051 (match_operand:BLK 1 "memory_operand" "Q,Q")))
2052 (use (match_operand 2 "nonmemory_operand" "n,a"))
2053 (clobber (match_scratch 3 "=X,&a"))]
2054 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2055 && GET_MODE (operands[3]) == Pmode"
2057 switch (which_alternative)
2060 return "clc\t%O0(%b2+1,%R0),%1";
2063 output_asm_insn ("bras\t%3,.+10", operands);
2064 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2065 return "ex\t%2,0(%3)";
2071 [(set_attr "op_type" "SS,NN")
2072 (set_attr "type" "cs,cs")
2073 (set_attr "atype" "*,agen")
2074 (set_attr "length" "*,14")])
2076 ; Compare a block of arbitrary length.
2078 (define_expand "cmpmem_long"
2080 [(clobber (match_dup 2))
2081 (clobber (match_dup 3))
2083 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2084 (match_operand:BLK 1 "memory_operand" "")))
2085 (use (match_operand 2 "general_operand" ""))
2086 (use (match_dup 3))])]
2089 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2090 rtx reg0 = gen_reg_rtx (dword_mode);
2091 rtx reg1 = gen_reg_rtx (dword_mode);
2092 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2093 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2094 rtx len0 = gen_lowpart (Pmode, reg0);
2095 rtx len1 = gen_lowpart (Pmode, reg1);
2097 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2098 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2099 emit_move_insn (len0, operands[2]);
2101 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2102 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2103 emit_move_insn (len1, operands[2]);
2105 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2106 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2111 (define_insn "*cmpmem_long_64"
2112 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2113 (clobber (match_operand:TI 1 "register_operand" "=d"))
2115 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2116 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2118 (use (match_dup 3))]
2121 [(set_attr "op_type" "RR")
2122 (set_attr "type" "vs")])
2124 (define_insn "*cmpmem_long_31"
2125 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2126 (clobber (match_operand:DI 1 "register_operand" "=d"))
2128 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2129 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2131 (use (match_dup 3))]
2134 [(set_attr "op_type" "RR")
2135 (set_attr "type" "vs")])
2137 ; Convert condition code to integer in range (-1, 0, 1)
2139 (define_insn "cmpint_si"
2140 [(set (match_operand:SI 0 "register_operand" "=d")
2141 (compare:SI (reg:CCS 33) (const_int 0)))]
2144 output_asm_insn ("lhi\t%0,1", operands);
2145 output_asm_insn ("jh\t.+12", operands);
2146 output_asm_insn ("jl\t.+6", operands);
2147 output_asm_insn ("sr\t%0,%0", operands);
2148 return "lcr\t%0,%0";
2150 [(set_attr "op_type" "NN")
2151 (set_attr "length" "16")
2152 (set_attr "type" "other")])
2154 (define_insn "cmpint_di"
2155 [(set (match_operand:DI 0 "register_operand" "=d")
2156 (compare:DI (reg:CCS 33) (const_int 0)))]
2159 output_asm_insn ("lghi\t%0,1", operands);
2160 output_asm_insn ("jh\t.+16", operands);
2161 output_asm_insn ("jl\t.+8", operands);
2162 output_asm_insn ("sgr\t%0,%0", operands);
2163 return "lcgr\t%0,%0";
2165 [(set_attr "op_type" "NN")
2166 (set_attr "length" "20")
2167 (set_attr "type" "other")])
2171 ;;- Conversion instructions.
2174 (define_insn "*sethighqisi"
2175 [(set (match_operand:SI 0 "register_operand" "=d,d")
2176 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2177 (clobber (reg:CC 33))]
2182 [(set_attr "op_type" "RS,RSY")])
2184 (define_insn "*sethighhisi"
2185 [(set (match_operand:SI 0 "register_operand" "=d,d")
2186 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2187 (clobber (reg:CC 33))]
2192 [(set_attr "op_type" "RS,RSY")])
2194 (define_insn "*sethighqidi_64"
2195 [(set (match_operand:DI 0 "register_operand" "=d")
2196 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2197 (clobber (reg:CC 33))]
2200 [(set_attr "op_type" "RSY")])
2202 (define_insn "*sethighqidi_31"
2203 [(set (match_operand:DI 0 "register_operand" "=d,d")
2204 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2205 (clobber (reg:CC 33))]
2210 [(set_attr "op_type" "RS,RSY")])
2212 (define_insn_and_split "*extractqi"
2213 [(set (match_operand:SI 0 "register_operand" "=d")
2214 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2215 (match_operand 2 "const_int_operand" "n")
2217 (clobber (reg:CC 33))]
2219 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2221 "&& reload_completed"
2223 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2224 (clobber (reg:CC 33))])
2225 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2227 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2228 operands[1] = change_address (operands[1], QImode, 0);
2230 [(set_attr "atype" "agen")])
2232 (define_insn_and_split "*extracthi"
2233 [(set (match_operand:SI 0 "register_operand" "=d")
2234 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2235 (match_operand 2 "const_int_operand" "n")
2237 (clobber (reg:CC 33))]
2239 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2241 "&& reload_completed"
2243 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2244 (clobber (reg:CC 33))])
2245 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2247 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2248 operands[1] = change_address (operands[1], HImode, 0);
2250 [(set_attr "atype" "agen")])
2253 ; extendsidi2 instruction pattern(s).
2256 (define_expand "extendsidi2"
2257 [(set (match_operand:DI 0 "register_operand" "")
2258 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2264 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2265 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2266 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2267 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2273 (define_insn "*extendsidi2"
2274 [(set (match_operand:DI 0 "register_operand" "=d,d")
2275 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2280 [(set_attr "op_type" "RRE,RXY")])
2283 ; extendhidi2 instruction pattern(s).
2286 (define_expand "extendhidi2"
2287 [(set (match_operand:DI 0 "register_operand" "")
2288 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2294 rtx tmp = gen_reg_rtx (SImode);
2295 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2296 emit_insn (gen_extendsidi2 (operands[0], tmp));
2301 operands[1] = gen_lowpart (DImode, operands[1]);
2302 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2303 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2309 (define_insn "*extendhidi2"
2310 [(set (match_operand:DI 0 "register_operand" "=d")
2311 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2314 [(set_attr "op_type" "RXY")])
2317 ; extendqidi2 instruction pattern(s).
2320 (define_expand "extendqidi2"
2321 [(set (match_operand:DI 0 "register_operand" "")
2322 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2328 rtx tmp = gen_reg_rtx (SImode);
2329 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2330 emit_insn (gen_extendsidi2 (operands[0], tmp));
2335 operands[1] = gen_lowpart (DImode, operands[1]);
2336 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2337 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2343 (define_insn "*extendqidi2"
2344 [(set (match_operand:DI 0 "register_operand" "=d")
2345 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2346 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2348 [(set_attr "op_type" "RXY")])
2351 [(set (match_operand:DI 0 "register_operand" "")
2352 (sign_extend:DI (match_operand:QI 1 "s_operand" "")))]
2353 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT && !reload_completed"
2355 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2356 (clobber (reg:CC 33))])
2358 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2359 (clobber (reg:CC 33))])]
2363 ; extendhisi2 instruction pattern(s).
2366 (define_expand "extendhisi2"
2367 [(set (match_operand:SI 0 "register_operand" "")
2368 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2372 operands[1] = gen_lowpart (SImode, operands[1]);
2373 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2374 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2379 (define_insn "*extendhisi2"
2380 [(set (match_operand:SI 0 "register_operand" "=d,d")
2381 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2386 [(set_attr "op_type" "RX,RXY")])
2389 ; extendqisi2 instruction pattern(s).
2392 (define_expand "extendqisi2"
2393 [(set (match_operand:SI 0 "register_operand" "")
2394 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2398 operands[1] = gen_lowpart (SImode, operands[1]);
2399 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2400 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2405 (define_insn "*extendqisi2"
2406 [(set (match_operand:SI 0 "register_operand" "=d")
2407 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2408 "TARGET_LONG_DISPLACEMENT"
2410 [(set_attr "op_type" "RXY")])
2413 [(set (match_operand:SI 0 "register_operand" "")
2414 (sign_extend:SI (match_operand:QI 1 "s_operand" "")))]
2415 "!TARGET_LONG_DISPLACEMENT && !reload_completed"
2417 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2418 (clobber (reg:CC 33))])
2420 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2421 (clobber (reg:CC 33))])]
2425 ; extendqihi2 instruction pattern(s).
2430 ; zero_extendsidi2 instruction pattern(s).
2433 (define_expand "zero_extendsidi2"
2434 [(set (match_operand:DI 0 "register_operand" "")
2435 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2441 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2442 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2443 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2449 (define_insn "*zero_extendsidi2"
2450 [(set (match_operand:DI 0 "register_operand" "=d,d")
2451 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2456 [(set_attr "op_type" "RRE,RXY")])
2459 ; zero_extendhidi2 instruction pattern(s).
2462 (define_expand "zero_extendhidi2"
2463 [(set (match_operand:DI 0 "register_operand" "")
2464 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2470 rtx tmp = gen_reg_rtx (SImode);
2471 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2472 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2477 operands[1] = gen_lowpart (DImode, operands[1]);
2478 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2479 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2485 (define_insn "*zero_extendhidi2"
2486 [(set (match_operand:DI 0 "register_operand" "=d")
2487 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2490 [(set_attr "op_type" "RXY")])
2493 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2496 (define_insn "*llgt_sisi"
2497 [(set (match_operand:SI 0 "register_operand" "=d,d")
2498 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2499 (const_int 2147483647)))]
2504 [(set_attr "op_type" "RRE,RXE")])
2506 (define_insn_and_split "*llgt_sisi_split"
2507 [(set (match_operand:SI 0 "register_operand" "=d,d")
2508 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2509 (const_int 2147483647)))
2510 (clobber (reg:CC 33))]
2513 "&& reload_completed"
2515 (and:SI (match_dup 1)
2516 (const_int 2147483647)))]
2519 (define_insn "*llgt_didi"
2520 [(set (match_operand:DI 0 "register_operand" "=d,d")
2521 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2522 (const_int 2147483647)))]
2527 [(set_attr "op_type" "RRE,RXE")])
2529 (define_insn_and_split "*llgt_didi_split"
2530 [(set (match_operand:DI 0 "register_operand" "=d,d")
2531 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2532 (const_int 2147483647)))
2533 (clobber (reg:CC 33))]
2536 "&& reload_completed"
2538 (and:DI (match_dup 1)
2539 (const_int 2147483647)))]
2542 (define_insn "*llgt_sidi"
2543 [(set (match_operand:DI 0 "register_operand" "=d")
2544 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2545 (const_int 2147483647)))]
2548 [(set_attr "op_type" "RXE")])
2550 (define_insn_and_split "*llgt_sidi_split"
2551 [(set (match_operand:DI 0 "register_operand" "=d")
2552 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2553 (const_int 2147483647)))
2554 (clobber (reg:CC 33))]
2557 "&& reload_completed"
2559 (and:DI (subreg:DI (match_dup 1) 0)
2560 (const_int 2147483647)))]
2564 ; zero_extendqidi2 instruction pattern(s)
2567 (define_expand "zero_extendqidi2"
2568 [(set (match_operand:DI 0 "register_operand" "")
2569 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2575 rtx tmp = gen_reg_rtx (SImode);
2576 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2577 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2582 operands[1] = gen_lowpart (DImode, operands[1]);
2583 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2584 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2590 (define_insn "*zero_extendqidi2"
2591 [(set (match_operand:DI 0 "register_operand" "=d")
2592 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2595 [(set_attr "op_type" "RXY")])
2598 ; zero_extendhisi2 instruction pattern(s).
2601 (define_expand "zero_extendhisi2"
2602 [(set (match_operand:SI 0 "register_operand" "")
2603 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2607 operands[1] = gen_lowpart (SImode, operands[1]);
2608 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2613 (define_insn "*zero_extendhisi2_64"
2614 [(set (match_operand:SI 0 "register_operand" "=d")
2615 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2618 [(set_attr "op_type" "RXY")])
2620 (define_insn_and_split "*zero_extendhisi2_31"
2621 [(set (match_operand:SI 0 "register_operand" "=&d")
2622 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2623 (clobber (reg:CC 33))]
2626 "&& reload_completed"
2627 [(set (match_dup 0) (const_int 0))
2629 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2630 (clobber (reg:CC 33))])]
2631 "operands[2] = gen_lowpart (HImode, operands[0]);"
2632 [(set_attr "atype" "agen")])
2635 ; zero_extendqisi2 instruction pattern(s).
2638 (define_expand "zero_extendqisi2"
2639 [(set (match_operand:SI 0 "register_operand" "")
2640 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2644 operands[1] = gen_lowpart (SImode, operands[1]);
2645 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2650 (define_insn "*zero_extendqisi2_64"
2651 [(set (match_operand:SI 0 "register_operand" "=d")
2652 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2655 [(set_attr "op_type" "RXY")])
2657 (define_insn_and_split "*zero_extendqisi2_31"
2658 [(set (match_operand:SI 0 "register_operand" "=&d")
2659 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2662 "&& reload_completed"
2663 [(set (match_dup 0) (const_int 0))
2664 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2665 "operands[2] = gen_lowpart (QImode, operands[0]);"
2666 [(set_attr "atype" "agen")])
2669 ; zero_extendqihi2 instruction pattern(s).
2672 (define_expand "zero_extendqihi2"
2673 [(set (match_operand:HI 0 "register_operand" "")
2674 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2678 operands[1] = gen_lowpart (HImode, operands[1]);
2679 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2684 (define_insn "*zero_extendqihi2_64"
2685 [(set (match_operand:HI 0 "register_operand" "=d")
2686 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2689 [(set_attr "op_type" "RXY")])
2691 (define_insn_and_split "*zero_extendqihi2_31"
2692 [(set (match_operand:HI 0 "register_operand" "=&d")
2693 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2696 "&& reload_completed"
2697 [(set (match_dup 0) (const_int 0))
2698 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2699 "operands[2] = gen_lowpart (QImode, operands[0]);"
2700 [(set_attr "atype" "agen")])
2704 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2707 (define_expand "fixuns_truncdfdi2"
2708 [(set (match_operand:DI 0 "register_operand" "")
2709 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2710 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2712 rtx label1 = gen_label_rtx ();
2713 rtx label2 = gen_label_rtx ();
2714 rtx temp = gen_reg_rtx (DFmode);
2715 operands[1] = force_reg (DFmode, operands[1]);
2717 emit_insn (gen_cmpdf (operands[1],
2718 CONST_DOUBLE_FROM_REAL_VALUE (
2719 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2720 emit_jump_insn (gen_blt (label1));
2721 emit_insn (gen_subdf3 (temp, operands[1],
2722 CONST_DOUBLE_FROM_REAL_VALUE (
2723 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2724 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2727 emit_label (label1);
2728 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2729 emit_label (label2);
2733 (define_expand "fix_truncdfdi2"
2734 [(set (match_operand:DI 0 "register_operand" "")
2735 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2736 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2738 operands[1] = force_reg (DFmode, operands[1]);
2739 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2743 (define_insn "fix_truncdfdi2_ieee"
2744 [(set (match_operand:DI 0 "register_operand" "=d")
2745 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2746 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2747 (clobber (reg:CC 33))]
2748 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2750 [(set_attr "op_type" "RRE")
2751 (set_attr "type" "ftoi")])
2754 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2757 (define_expand "fixuns_truncdfsi2"
2758 [(set (match_operand:SI 0 "register_operand" "")
2759 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2760 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2762 rtx label1 = gen_label_rtx ();
2763 rtx label2 = gen_label_rtx ();
2764 rtx temp = gen_reg_rtx (DFmode);
2766 operands[1] = force_reg (DFmode,operands[1]);
2767 emit_insn (gen_cmpdf (operands[1],
2768 CONST_DOUBLE_FROM_REAL_VALUE (
2769 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2770 emit_jump_insn (gen_blt (label1));
2771 emit_insn (gen_subdf3 (temp, operands[1],
2772 CONST_DOUBLE_FROM_REAL_VALUE (
2773 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2774 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2777 emit_label (label1);
2778 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2779 emit_label (label2);
2783 (define_expand "fix_truncdfsi2"
2784 [(set (match_operand:SI 0 "register_operand" "")
2785 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2788 if (TARGET_IBM_FLOAT)
2790 /* This is the algorithm from POP chapter A.5.7.2. */
2792 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2793 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2794 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2796 operands[1] = force_reg (DFmode, operands[1]);
2797 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2798 two31r, two32, temp));
2802 operands[1] = force_reg (DFmode, operands[1]);
2803 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2809 (define_insn "fix_truncdfsi2_ieee"
2810 [(set (match_operand:SI 0 "register_operand" "=d")
2811 (fix:SI (match_operand:DF 1 "register_operand" "f")))
2812 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2813 (clobber (reg:CC 33))]
2814 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2816 [(set_attr "op_type" "RRE")
2817 (set_attr "type" "other" )])
2819 (define_insn "fix_truncdfsi2_ibm"
2820 [(set (match_operand:SI 0 "register_operand" "=d")
2821 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2822 (use (match_operand:DI 2 "immediate_operand" "m"))
2823 (use (match_operand:DI 3 "immediate_operand" "m"))
2824 (use (match_operand:BLK 4 "memory_operand" "m"))
2825 (clobber (reg:CC 33))]
2826 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2828 output_asm_insn ("sd\t%1,%2", operands);
2829 output_asm_insn ("aw\t%1,%3", operands);
2830 output_asm_insn ("std\t%1,%4", operands);
2831 output_asm_insn ("xi\t%N4,128", operands);
2834 [(set_attr "op_type" "NN")
2835 (set_attr "type" "ftoi")
2836 (set_attr "atype" "agen")
2837 (set_attr "length" "20")])
2840 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
2843 (define_expand "fixuns_truncsfdi2"
2844 [(set (match_operand:DI 0 "register_operand" "")
2845 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2846 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2848 rtx label1 = gen_label_rtx ();
2849 rtx label2 = gen_label_rtx ();
2850 rtx temp = gen_reg_rtx (SFmode);
2852 operands[1] = force_reg (SFmode, operands[1]);
2853 emit_insn (gen_cmpsf (operands[1],
2854 CONST_DOUBLE_FROM_REAL_VALUE (
2855 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
2856 emit_jump_insn (gen_blt (label1));
2858 emit_insn (gen_subsf3 (temp, operands[1],
2859 CONST_DOUBLE_FROM_REAL_VALUE (
2860 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
2861 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
2864 emit_label (label1);
2865 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2866 emit_label (label2);
2870 (define_expand "fix_truncsfdi2"
2871 [(set (match_operand:DI 0 "register_operand" "")
2872 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
2873 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2875 operands[1] = force_reg (SFmode, operands[1]);
2876 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2880 (define_insn "fix_truncsfdi2_ieee"
2881 [(set (match_operand:DI 0 "register_operand" "=d")
2882 (fix:DI (match_operand:SF 1 "register_operand" "f")))
2883 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2884 (clobber (reg:CC 33))]
2885 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2887 [(set_attr "op_type" "RRE")
2888 (set_attr "type" "ftoi")])
2891 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
2894 (define_expand "fixuns_truncsfsi2"
2895 [(set (match_operand:SI 0 "register_operand" "")
2896 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
2897 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2899 rtx label1 = gen_label_rtx ();
2900 rtx label2 = gen_label_rtx ();
2901 rtx temp = gen_reg_rtx (SFmode);
2903 operands[1] = force_reg (SFmode, operands[1]);
2904 emit_insn (gen_cmpsf (operands[1],
2905 CONST_DOUBLE_FROM_REAL_VALUE (
2906 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
2907 emit_jump_insn (gen_blt (label1));
2908 emit_insn (gen_subsf3 (temp, operands[1],
2909 CONST_DOUBLE_FROM_REAL_VALUE (
2910 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
2911 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
2914 emit_label (label1);
2915 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2916 emit_label (label2);
2920 (define_expand "fix_truncsfsi2"
2921 [(set (match_operand:SI 0 "register_operand" "")
2922 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
2925 if (TARGET_IBM_FLOAT)
2927 /* Convert to DFmode and then use the POP algorithm. */
2928 rtx temp = gen_reg_rtx (DFmode);
2929 emit_insn (gen_extendsfdf2 (temp, operands[1]));
2930 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
2934 operands[1] = force_reg (SFmode, operands[1]);
2935 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2941 (define_insn "fix_truncsfsi2_ieee"
2942 [(set (match_operand:SI 0 "register_operand" "=d")
2943 (fix:SI (match_operand:SF 1 "register_operand" "f")))
2944 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2945 (clobber (reg:CC 33))]
2946 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2948 [(set_attr "op_type" "RRE")
2949 (set_attr "type" "ftoi")])
2952 ; floatdidf2 instruction pattern(s).
2955 (define_insn "floatdidf2"
2956 [(set (match_operand:DF 0 "register_operand" "=f")
2957 (float:DF (match_operand:DI 1 "register_operand" "d")))
2958 (clobber (reg:CC 33))]
2959 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2961 [(set_attr "op_type" "RRE")
2962 (set_attr "type" "itof" )])
2965 ; floatdisf2 instruction pattern(s).
2968 (define_insn "floatdisf2"
2969 [(set (match_operand:SF 0 "register_operand" "=f")
2970 (float:SF (match_operand:DI 1 "register_operand" "d")))
2971 (clobber (reg:CC 33))]
2972 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2974 [(set_attr "op_type" "RRE")
2975 (set_attr "type" "itof" )])
2978 ; floatsidf2 instruction pattern(s).
2981 (define_expand "floatsidf2"
2983 [(set (match_operand:DF 0 "register_operand" "")
2984 (float:DF (match_operand:SI 1 "register_operand" "")))
2985 (clobber (reg:CC 33))])]
2988 if (TARGET_IBM_FLOAT)
2990 /* This is the algorithm from POP chapter A.5.7.1. */
2992 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2993 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
2995 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
3000 (define_insn "floatsidf2_ieee"
3001 [(set (match_operand:DF 0 "register_operand" "=f")
3002 (float:DF (match_operand:SI 1 "register_operand" "d")))
3003 (clobber (reg:CC 33))]
3004 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3006 [(set_attr "op_type" "RRE")
3007 (set_attr "type" "itof" )])
3009 (define_insn "floatsidf2_ibm"
3010 [(set (match_operand:DF 0 "register_operand" "=f")
3011 (float:DF (match_operand:SI 1 "register_operand" "d")))
3012 (use (match_operand:DI 2 "immediate_operand" "m"))
3013 (use (match_operand:BLK 3 "memory_operand" "m"))
3014 (clobber (reg:CC 33))]
3015 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3017 output_asm_insn ("st\t%1,%N3", operands);
3018 output_asm_insn ("xi\t%N3,128", operands);
3019 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3020 output_asm_insn ("ld\t%0,%3", operands);
3023 [(set_attr "op_type" "NN")
3024 (set_attr "type" "other" )
3025 (set_attr "atype" "agen")
3026 (set_attr "length" "20")])
3029 ; floatsisf2 instruction pattern(s).
3032 (define_expand "floatsisf2"
3034 [(set (match_operand:SF 0 "register_operand" "")
3035 (float:SF (match_operand:SI 1 "register_operand" "")))
3036 (clobber (reg:CC 33))])]
3039 if (TARGET_IBM_FLOAT)
3041 /* Use the POP algorithm to convert to DFmode and then truncate. */
3042 rtx temp = gen_reg_rtx (DFmode);
3043 emit_insn (gen_floatsidf2 (temp, operands[1]));
3044 emit_insn (gen_truncdfsf2 (operands[0], temp));
3049 (define_insn "floatsisf2_ieee"
3050 [(set (match_operand:SF 0 "register_operand" "=f")
3051 (float:SF (match_operand:SI 1 "register_operand" "d")))
3052 (clobber (reg:CC 33))]
3053 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3055 [(set_attr "op_type" "RRE")
3056 (set_attr "type" "itof" )])
3059 ; truncdfsf2 instruction pattern(s).
3062 (define_expand "truncdfsf2"
3063 [(set (match_operand:SF 0 "register_operand" "")
3064 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3068 (define_insn "truncdfsf2_ieee"
3069 [(set (match_operand:SF 0 "register_operand" "=f")
3070 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3071 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3073 [(set_attr "op_type" "RRE")])
3075 (define_insn "truncdfsf2_ibm"
3076 [(set (match_operand:SF 0 "register_operand" "=f,f")
3077 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3078 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3082 [(set_attr "op_type" "RR,RX")
3083 (set_attr "type" "floads,floads")])
3086 ; extendsfdf2 instruction pattern(s).
3089 (define_expand "extendsfdf2"
3090 [(set (match_operand:DF 0 "register_operand" "")
3091 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3094 if (TARGET_IBM_FLOAT)
3096 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3101 (define_insn "extendsfdf2_ieee"
3102 [(set (match_operand:DF 0 "register_operand" "=f,f")
3103 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3104 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3108 [(set_attr "op_type" "RRE,RXE")
3109 (set_attr "type" "floads,floads")])
3111 (define_insn "extendsfdf2_ibm"
3112 [(set (match_operand:DF 0 "register_operand" "=f,f")
3113 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3114 (clobber (reg:CC 33))]
3115 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3117 sdr\t%0,%0\;ler\t%0,%1
3118 sdr\t%0,%0\;le\t%0,%1"
3119 [(set_attr "op_type" "NN,NN")
3120 (set_attr "atype" "reg,agen")
3121 (set_attr "length" "4,6")
3122 (set_attr "type" "o2,o2")])
3126 ;; ARITHMETIC OPERATIONS
3128 ; arithmetic operations set the ConditionCode,
3129 ; because of unpredictable Bits in Register for Halfword and Byte
3130 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3133 ;;- Add instructions.
3137 ; adddi3 instruction pattern(s).
3140 (define_insn "*adddi3_sign"
3141 [(set (match_operand:DI 0 "register_operand" "=d,d")
3142 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3143 (match_operand:DI 1 "register_operand" "0,0")))
3144 (clobber (reg:CC 33))]
3149 [(set_attr "op_type" "RRE,RXY")])
3151 (define_insn "*adddi3_zero_cc"
3153 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3154 (match_operand:DI 1 "register_operand" "0,0"))
3156 (set (match_operand:DI 0 "register_operand" "=d,d")
3157 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3158 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3162 [(set_attr "op_type" "RRE,RXY")])
3164 (define_insn "*adddi3_zero_cconly"
3166 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3167 (match_operand:DI 1 "register_operand" "0,0"))
3169 (clobber (match_scratch:DI 0 "=d,d"))]
3170 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3174 [(set_attr "op_type" "RRE,RXY")])
3176 (define_insn "*adddi3_zero"
3177 [(set (match_operand:DI 0 "register_operand" "=d,d")
3178 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3179 (match_operand:DI 1 "register_operand" "0,0")))
3180 (clobber (reg:CC 33))]
3185 [(set_attr "op_type" "RRE,RXY")])
3187 (define_insn "*adddi3_imm_cc"
3189 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3190 (match_operand:DI 2 "const_int_operand" "K"))
3192 (set (match_operand:DI 0 "register_operand" "=d")
3193 (plus:DI (match_dup 1) (match_dup 2)))]
3195 && s390_match_ccmode (insn, CCAmode)
3196 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
3198 [(set_attr "op_type" "RI")])
3200 (define_insn "*adddi3_carry1_cc"
3202 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3203 (match_operand:DI 2 "general_operand" "d,m"))
3205 (set (match_operand:DI 0 "register_operand" "=d,d")
3206 (plus:DI (match_dup 1) (match_dup 2)))]
3207 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3211 [(set_attr "op_type" "RRE,RXY")])
3213 (define_insn "*adddi3_carry1_cconly"
3215 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3216 (match_operand:DI 2 "general_operand" "d,m"))
3218 (clobber (match_scratch:DI 0 "=d,d"))]
3219 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3223 [(set_attr "op_type" "RRE,RXY")])
3225 (define_insn "*adddi3_carry2_cc"
3227 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3228 (match_operand:DI 2 "general_operand" "d,m"))
3230 (set (match_operand:DI 0 "register_operand" "=d,d")
3231 (plus:DI (match_dup 1) (match_dup 2)))]
3232 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3236 [(set_attr "op_type" "RRE,RXY")])
3238 (define_insn "*adddi3_carry2_cconly"
3240 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3241 (match_operand:DI 2 "general_operand" "d,m"))
3243 (clobber (match_scratch:DI 0 "=d,d"))]
3244 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3248 [(set_attr "op_type" "RRE,RXY")])
3250 (define_insn "*adddi3_cc"
3252 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3253 (match_operand:DI 2 "general_operand" "d,m"))
3255 (set (match_operand:DI 0 "register_operand" "=d,d")
3256 (plus:DI (match_dup 1) (match_dup 2)))]
3257 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3261 [(set_attr "op_type" "RRE,RXY")])
3263 (define_insn "*adddi3_cconly"
3265 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3266 (match_operand:DI 2 "general_operand" "d,m"))
3268 (clobber (match_scratch:DI 0 "=d,d"))]
3269 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3273 [(set_attr "op_type" "RRE,RXY")])
3275 (define_insn "*adddi3_cconly2"
3277 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3278 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3279 (clobber (match_scratch:DI 0 "=d,d"))]
3280 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3284 [(set_attr "op_type" "RRE,RXY")])
3286 (define_insn "*adddi3_64"
3287 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3288 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3289 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3290 (clobber (reg:CC 33))]
3296 [(set_attr "op_type" "RRE,RI,RXY")])
3298 (define_insn_and_split "*adddi3_31z"
3299 [(set (match_operand:DI 0 "register_operand" "=&d")
3300 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3301 (match_operand:DI 2 "general_operand" "do") ) )
3302 (clobber (reg:CC 33))]
3303 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3305 "&& reload_completed"
3308 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3310 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3312 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3313 (ltu:SI (reg:CCL1 33) (const_int 0))))
3314 (clobber (reg:CC 33))])]
3315 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3316 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3317 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3318 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3319 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3320 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3321 [(set_attr "op_type" "NN")])
3323 (define_insn_and_split "*adddi3_31"
3324 [(set (match_operand:DI 0 "register_operand" "=&d")
3325 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3326 (match_operand:DI 2 "general_operand" "do") ) )
3327 (clobber (reg:CC 33))]
3330 "&& reload_completed"
3332 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3333 (clobber (reg:CC 33))])
3336 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3338 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3340 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3342 (label_ref (match_dup 9))))
3344 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3345 (clobber (reg:CC 33))])
3347 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3348 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3349 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3350 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3351 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3352 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3353 operands[9] = gen_label_rtx ();"
3354 [(set_attr "op_type" "NN")])
3356 (define_expand "adddi3"
3358 [(set (match_operand:DI 0 "register_operand" "")
3359 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3360 (match_operand:DI 2 "general_operand" "")))
3361 (clobber (reg:CC 33))])]
3365 (define_insn "*la_64"
3366 [(set (match_operand:DI 0 "register_operand" "=d,d")
3367 (match_operand:QI 1 "address_operand" "U,W"))]
3372 [(set_attr "op_type" "RX,RXY")
3373 (set_attr "type" "la")])
3377 [(set (match_operand:DI 0 "register_operand" "")
3378 (match_operand:QI 1 "address_operand" ""))
3379 (clobber (reg:CC 33))])]
3381 && strict_memory_address_p (VOIDmode, operands[1])
3382 && preferred_la_operand_p (operands[1])"
3383 [(set (match_dup 0) (match_dup 1))]
3387 [(set (match_operand:DI 0 "register_operand" "")
3388 (match_operand:DI 1 "register_operand" ""))
3391 (plus:DI (match_dup 0)
3392 (match_operand:DI 2 "nonmemory_operand" "")))
3393 (clobber (reg:CC 33))])]
3395 && !reg_overlap_mentioned_p (operands[0], operands[2])
3396 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (DImode, operands[1], operands[2]))
3397 && preferred_la_operand_p (gen_rtx_PLUS (DImode, operands[1], operands[2]))"
3398 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3401 (define_expand "reload_indi"
3402 [(parallel [(match_operand:DI 0 "register_operand" "=a")
3403 (match_operand:DI 1 "s390_plus_operand" "")
3404 (match_operand:DI 2 "register_operand" "=&a")])]
3407 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3413 ; addsi3 instruction pattern(s).
3416 (define_insn "*addsi3_imm_cc"
3418 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3419 (match_operand:SI 2 "const_int_operand" "K"))
3421 (set (match_operand:SI 0 "register_operand" "=d")
3422 (plus:SI (match_dup 1) (match_dup 2)))]
3423 "s390_match_ccmode (insn, CCAmode)
3424 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
3426 [(set_attr "op_type" "RI")])
3428 (define_insn "*addsi3_carry1_cc"
3430 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3431 (match_operand:SI 2 "general_operand" "d,R,T"))
3433 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3434 (plus:SI (match_dup 1) (match_dup 2)))]
3435 "s390_match_ccmode (insn, CCL1mode)"
3440 [(set_attr "op_type" "RR,RX,RXY")])
3442 (define_insn "*addsi3_carry1_cconly"
3444 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3445 (match_operand:SI 2 "general_operand" "d,R,T"))
3447 (clobber (match_scratch:SI 0 "=d,d,d"))]
3448 "s390_match_ccmode (insn, CCL1mode)"
3453 [(set_attr "op_type" "RR,RX,RXY")])
3455 (define_insn "*addsi3_carry2_cc"
3457 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3458 (match_operand:SI 2 "general_operand" "d,R,T"))
3460 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3461 (plus:SI (match_dup 1) (match_dup 2)))]
3462 "s390_match_ccmode (insn, CCL1mode)"
3467 [(set_attr "op_type" "RR,RX,RXY")])
3469 (define_insn "*addsi3_carry2_cconly"
3471 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3472 (match_operand:SI 2 "general_operand" "d,R,T"))
3474 (clobber (match_scratch:SI 0 "=d,d,d"))]
3475 "s390_match_ccmode (insn, CCL1mode)"
3480 [(set_attr "op_type" "RR,RX,RXY")])
3482 (define_insn "*addsi3_cc"
3484 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3485 (match_operand:SI 2 "general_operand" "d,R,T"))
3487 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3488 (plus:SI (match_dup 1) (match_dup 2)))]
3489 "s390_match_ccmode (insn, CCLmode)"
3494 [(set_attr "op_type" "RR,RX,RXY")])
3496 (define_insn "*addsi3_cconly"
3498 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3499 (match_operand:SI 2 "general_operand" "d,R,T"))
3501 (clobber (match_scratch:SI 0 "=d,d,d"))]
3502 "s390_match_ccmode (insn, CCLmode)"
3507 [(set_attr "op_type" "RR,RX,RXY")])
3509 (define_insn "*addsi3_cconly2"
3511 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3512 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3513 (clobber (match_scratch:SI 0 "=d,d,d"))]
3514 "s390_match_ccmode (insn, CCLmode)"
3519 [(set_attr "op_type" "RR,RX,RXY")])
3521 (define_insn "*addsi3_sign"
3522 [(set (match_operand:SI 0 "register_operand" "=d,d")
3523 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3524 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3525 (clobber (reg:CC 33))]
3530 [(set_attr "op_type" "RX,RXY")])
3532 (define_insn "addsi3"
3533 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3534 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3535 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3536 (clobber (reg:CC 33))]
3543 [(set_attr "op_type" "RR,RI,RX,RXY")])
3545 (define_insn "*la_31"
3546 [(set (match_operand:SI 0 "register_operand" "=d,d")
3547 (match_operand:QI 1 "address_operand" "U,W"))]
3548 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
3552 [(set_attr "op_type" "RX,RXY")
3553 (set_attr "type" "la")])
3557 [(set (match_operand:SI 0 "register_operand" "")
3558 (match_operand:QI 1 "address_operand" ""))
3559 (clobber (reg:CC 33))])]
3561 && strict_memory_address_p (VOIDmode, operands[1])
3562 && preferred_la_operand_p (operands[1])"
3563 [(set (match_dup 0) (match_dup 1))]
3567 [(set (match_operand:SI 0 "register_operand" "")
3568 (match_operand:SI 1 "register_operand" ""))
3571 (plus:SI (match_dup 0)
3572 (match_operand:SI 2 "nonmemory_operand" "")))
3573 (clobber (reg:CC 33))])]
3575 && !reg_overlap_mentioned_p (operands[0], operands[2])
3576 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
3577 && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
3578 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3581 (define_insn "*la_31_and"
3582 [(set (match_operand:SI 0 "register_operand" "=d,d")
3583 (and:SI (match_operand:QI 1 "address_operand" "U,W")
3584 (const_int 2147483647)))]
3589 [(set_attr "op_type" "RX,RXY")
3590 (set_attr "type" "la")])
3592 (define_insn_and_split "*la_31_and_cc"
3593 [(set (match_operand:SI 0 "register_operand" "=d")
3594 (and:SI (match_operand:QI 1 "address_operand" "p")
3595 (const_int 2147483647)))
3596 (clobber (reg:CC 33))]
3599 "&& reload_completed"
3601 (and:SI (match_dup 1) (const_int 2147483647)))]
3603 [(set_attr "op_type" "RX")
3604 (set_attr "type" "la")])
3606 (define_insn "force_la_31"
3607 [(set (match_operand:SI 0 "register_operand" "=d,d")
3608 (match_operand:QI 1 "address_operand" "U,W"))
3609 (use (const_int 0))]
3614 [(set_attr "op_type" "RX")
3615 (set_attr "type" "la")])
3617 (define_expand "reload_insi"
3618 [(parallel [(match_operand:SI 0 "register_operand" "=a")
3619 (match_operand:SI 1 "s390_plus_operand" "")
3620 (match_operand:SI 2 "register_operand" "=&a")])]
3623 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3629 ; adddf3 instruction pattern(s).
3632 (define_expand "adddf3"
3634 [(set (match_operand:DF 0 "register_operand" "=f,f")
3635 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3636 (match_operand:DF 2 "general_operand" "f,R")))
3637 (clobber (reg:CC 33))])]
3641 (define_insn "*adddf3"
3642 [(set (match_operand:DF 0 "register_operand" "=f,f")
3643 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3644 (match_operand:DF 2 "general_operand" "f,R")))
3645 (clobber (reg:CC 33))]
3646 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3650 [(set_attr "op_type" "RRE,RXE")
3651 (set_attr "type" "fsimpd,fsimpd")])
3653 (define_insn "*adddf3_cc"
3655 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3656 (match_operand:DF 2 "general_operand" "f,R"))
3657 (match_operand:DF 3 "const0_operand" "")))
3658 (set (match_operand:DF 0 "register_operand" "=f,f")
3659 (plus:DF (match_dup 1) (match_dup 2)))]
3660 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3664 [(set_attr "op_type" "RRE,RXE")
3665 (set_attr "type" "fsimpd,fsimpd")])
3667 (define_insn "*adddf3_cconly"
3669 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3670 (match_operand:DF 2 "general_operand" "f,R"))
3671 (match_operand:DF 3 "const0_operand" "")))
3672 (clobber (match_scratch:DF 0 "=f,f"))]
3673 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3677 [(set_attr "op_type" "RRE,RXE")
3678 (set_attr "type" "fsimpd,fsimpd")])
3680 (define_insn "*adddf3_ibm"
3681 [(set (match_operand:DF 0 "register_operand" "=f,f")
3682 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3683 (match_operand:DF 2 "general_operand" "f,R")))
3684 (clobber (reg:CC 33))]
3685 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3689 [(set_attr "op_type" "RR,RX")
3690 (set_attr "type" "fsimpd,fsimpd")])
3693 ; addsf3 instruction pattern(s).
3696 (define_expand "addsf3"
3698 [(set (match_operand:SF 0 "register_operand" "=f,f")
3699 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3700 (match_operand:SF 2 "general_operand" "f,R")))
3701 (clobber (reg:CC 33))])]
3705 (define_insn "*addsf3"
3706 [(set (match_operand:SF 0 "register_operand" "=f,f")
3707 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3708 (match_operand:SF 2 "general_operand" "f,R")))
3709 (clobber (reg:CC 33))]
3710 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3714 [(set_attr "op_type" "RRE,RXE")
3715 (set_attr "type" "fsimps,fsimps")])
3717 (define_insn "*addsf3_cc"
3719 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3720 (match_operand:SF 2 "general_operand" "f,R"))
3721 (match_operand:SF 3 "const0_operand" "")))
3722 (set (match_operand:SF 0 "register_operand" "=f,f")
3723 (plus:SF (match_dup 1) (match_dup 2)))]
3724 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3728 [(set_attr "op_type" "RRE,RXE")
3729 (set_attr "type" "fsimps,fsimps")])
3731 (define_insn "*addsf3_cconly"
3733 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3734 (match_operand:SF 2 "general_operand" "f,R"))
3735 (match_operand:SF 3 "const0_operand" "")))
3736 (clobber (match_scratch:SF 0 "=f,f"))]
3737 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3741 [(set_attr "op_type" "RRE,RXE")
3742 (set_attr "type" "fsimps,fsimps")])
3744 (define_insn "*addsf3"
3745 [(set (match_operand:SF 0 "register_operand" "=f,f")
3746 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3747 (match_operand:SF 2 "general_operand" "f,R")))
3748 (clobber (reg:CC 33))]
3749 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3753 [(set_attr "op_type" "RR,RX")
3754 (set_attr "type" "fsimps,fsimps")])
3758 ;;- Subtract instructions.
3762 ; subdi3 instruction pattern(s).
3765 (define_insn "*subdi3_sign"
3766 [(set (match_operand:DI 0 "register_operand" "=d,d")
3767 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3768 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3769 (clobber (reg:CC 33))]
3774 [(set_attr "op_type" "RRE,RXY")])
3776 (define_insn "*subdi3_zero_cc"
3778 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3779 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3781 (set (match_operand:DI 0 "register_operand" "=d,d")
3782 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3783 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3787 [(set_attr "op_type" "RRE,RXY")])
3789 (define_insn "*subdi3_zero_cconly"
3791 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3792 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3794 (clobber (match_scratch:DI 0 "=d,d"))]
3795 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3799 [(set_attr "op_type" "RRE,RXY")])
3801 (define_insn "*subdi3_zero"
3802 [(set (match_operand:DI 0 "register_operand" "=d,d")
3803 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3804 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3805 (clobber (reg:CC 33))]
3810 [(set_attr "op_type" "RRE,RXY")])
3812 (define_insn "*subdi3_borrow_cc"
3814 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3815 (match_operand:DI 2 "general_operand" "d,m"))
3817 (set (match_operand:DI 0 "register_operand" "=d,d")
3818 (minus:DI (match_dup 1) (match_dup 2)))]
3819 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3823 [(set_attr "op_type" "RRE,RXY")])
3825 (define_insn "*subdi3_borrow_cconly"
3827 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3828 (match_operand:DI 2 "general_operand" "d,m"))
3830 (clobber (match_scratch:DI 0 "=d,d"))]
3831 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3835 [(set_attr "op_type" "RRE,RXY")])
3837 (define_insn "*subdi3_cc"
3839 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3840 (match_operand:DI 2 "general_operand" "d,m"))
3842 (set (match_operand:DI 0 "register_operand" "=d,d")
3843 (minus:DI (match_dup 1) (match_dup 2)))]
3844 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3848 [(set_attr "op_type" "RRE,RXY")])
3850 (define_insn "*subdi3_cconly"
3852 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3853 (match_operand:DI 2 "general_operand" "d,m"))
3855 (clobber (match_scratch:DI 0 "=d,d"))]
3856 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3860 [(set_attr "op_type" "RRE,RXY")])
3862 (define_insn "*subdi3_64"
3863 [(set (match_operand:DI 0 "register_operand" "=d,d")
3864 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3865 (match_operand:DI 2 "general_operand" "d,m") ) )
3866 (clobber (reg:CC 33))]
3871 [(set_attr "op_type" "RRE,RRE")])
3873 (define_insn_and_split "*subdi3_31z"
3874 [(set (match_operand:DI 0 "register_operand" "=&d")
3875 (minus:DI (match_operand:DI 1 "register_operand" "0")
3876 (match_operand:DI 2 "general_operand" "do") ) )
3877 (clobber (reg:CC 33))]
3878 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3880 "&& reload_completed"
3883 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3885 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3887 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3888 (gtu:SI (reg:CCL2 33) (const_int 0))))
3889 (clobber (reg:CC 33))])]
3890 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3891 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3892 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3893 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3894 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3895 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3896 [(set_attr "op_type" "NN")])
3898 (define_insn_and_split "*subdi3_31"
3899 [(set (match_operand:DI 0 "register_operand" "=&d")
3900 (minus:DI (match_operand:DI 1 "register_operand" "0")
3901 (match_operand:DI 2 "general_operand" "do") ) )
3902 (clobber (reg:CC 33))]
3905 "&& reload_completed"
3907 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3908 (clobber (reg:CC 33))])
3911 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3913 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3915 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3917 (label_ref (match_dup 9))))
3919 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3920 (clobber (reg:CC 33))])
3922 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3923 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3924 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3925 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3926 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3927 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3928 operands[9] = gen_label_rtx ();"
3929 [(set_attr "op_type" "NN")])
3931 (define_expand "subdi3"
3933 [(set (match_operand:DI 0 "register_operand" "")
3934 (minus:DI (match_operand:DI 1 "register_operand" "")
3935 (match_operand:DI 2 "general_operand" "")))
3936 (clobber (reg:CC 33))])]
3941 ; subsi3 instruction pattern(s).
3944 (define_insn "*subsi3_borrow_cc"
3946 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3947 (match_operand:SI 2 "general_operand" "d,R,T"))
3949 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3950 (minus:SI (match_dup 1) (match_dup 2)))]
3951 "s390_match_ccmode (insn, CCL2mode)"
3956 [(set_attr "op_type" "RR,RX,RXY")])
3958 (define_insn "*subsi3_borrow_cconly"
3960 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3961 (match_operand:SI 2 "general_operand" "d,R,T"))
3963 (clobber (match_scratch:SI 0 "=d,d,d"))]
3964 "s390_match_ccmode (insn, CCL2mode)"
3969 [(set_attr "op_type" "RR,RX,RXY")])
3971 (define_insn "*subsi3_cc"
3973 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3974 (match_operand:SI 2 "general_operand" "d,R,T"))
3976 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3977 (minus:SI (match_dup 1) (match_dup 2)))]
3978 "s390_match_ccmode (insn, CCLmode)"
3983 [(set_attr "op_type" "RR,RX,RXY")])
3985 (define_insn "*subsi3_cconly"
3987 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3988 (match_operand:SI 2 "general_operand" "d,R,T"))
3990 (clobber (match_scratch:SI 0 "=d,d,d"))]
3991 "s390_match_ccmode (insn, CCLmode)"
3996 [(set_attr "op_type" "RR,RX,RXY")])
3998 (define_insn "*subsi3_sign"
3999 [(set (match_operand:SI 0 "register_operand" "=d,d")
4000 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
4001 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4002 (clobber (reg:CC 33))]
4007 [(set_attr "op_type" "RX,RXY")])
4009 (define_insn "subsi3"
4010 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4011 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4012 (match_operand:SI 2 "general_operand" "d,R,T")))
4013 (clobber (reg:CC 33))]
4019 [(set_attr "op_type" "RR,RX,RXY")])
4023 ; subdf3 instruction pattern(s).
4026 (define_expand "subdf3"
4028 [(set (match_operand:DF 0 "register_operand" "=f,f")
4029 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4030 (match_operand:DF 2 "general_operand" "f,R")))
4031 (clobber (reg:CC 33))])]
4035 (define_insn "*subdf3"
4036 [(set (match_operand:DF 0 "register_operand" "=f,f")
4037 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4038 (match_operand:DF 2 "general_operand" "f,R")))
4039 (clobber (reg:CC 33))]
4040 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4044 [(set_attr "op_type" "RRE,RXE")
4045 (set_attr "type" "fsimpd,fsimpd")])
4047 (define_insn "*subdf3_cc"
4049 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4050 (match_operand:DF 2 "general_operand" "f,R"))
4051 (match_operand:DF 3 "const0_operand" "")))
4052 (set (match_operand:DF 0 "register_operand" "=f,f")
4053 (plus:DF (match_dup 1) (match_dup 2)))]
4054 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4058 [(set_attr "op_type" "RRE,RXE")
4059 (set_attr "type" "fsimpd,fsimpd")])
4061 (define_insn "*subdf3_cconly"
4063 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4064 (match_operand:DF 2 "general_operand" "f,R"))
4065 (match_operand:DF 3 "const0_operand" "")))
4066 (clobber (match_scratch:DF 0 "=f,f"))]
4067 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4071 [(set_attr "op_type" "RRE,RXE")
4072 (set_attr "type" "fsimpd,fsimpd")])
4074 (define_insn "*subdf3_ibm"
4075 [(set (match_operand:DF 0 "register_operand" "=f,f")
4076 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4077 (match_operand:DF 2 "general_operand" "f,R")))
4078 (clobber (reg:CC 33))]
4079 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4083 [(set_attr "op_type" "RR,RX")
4084 (set_attr "type" "fsimpd,fsimpd")])
4087 ; subsf3 instruction pattern(s).
4090 (define_expand "subsf3"
4092 [(set (match_operand:SF 0 "register_operand" "=f,f")
4093 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4094 (match_operand:SF 2 "general_operand" "f,R")))
4095 (clobber (reg:CC 33))])]
4099 (define_insn "*subsf3"
4100 [(set (match_operand:SF 0 "register_operand" "=f,f")
4101 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4102 (match_operand:SF 2 "general_operand" "f,R")))
4103 (clobber (reg:CC 33))]
4104 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4108 [(set_attr "op_type" "RRE,RXE")
4109 (set_attr "type" "fsimps,fsimps")])
4111 (define_insn "*subsf3_cc"
4113 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4114 (match_operand:SF 2 "general_operand" "f,R"))
4115 (match_operand:SF 3 "const0_operand" "")))
4116 (set (match_operand:SF 0 "register_operand" "=f,f")
4117 (minus:SF (match_dup 1) (match_dup 2)))]
4118 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4122 [(set_attr "op_type" "RRE,RXE")
4123 (set_attr "type" "fsimps,fsimps")])
4125 (define_insn "*subsf3_cconly"
4127 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4128 (match_operand:SF 2 "general_operand" "f,R"))
4129 (match_operand:SF 3 "const0_operand" "")))
4130 (clobber (match_scratch:SF 0 "=f,f"))]
4131 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4135 [(set_attr "op_type" "RRE,RXE")
4136 (set_attr "type" "fsimps,fsimps")])
4138 (define_insn "*subsf3_ibm"
4139 [(set (match_operand:SF 0 "register_operand" "=f,f")
4140 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4141 (match_operand:SF 2 "general_operand" "f,R")))
4142 (clobber (reg:CC 33))]
4143 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4147 [(set_attr "op_type" "RR,RX")
4148 (set_attr "type" "fsimps,fsimps")])
4152 ;;- Conditional add/subtract instructions.
4156 ; adddicc instruction pattern(s).
4159 (define_insn "*adddi3_alc_cc"
4162 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4163 (match_operand:DI 2 "general_operand" "d,m"))
4164 (match_operand:DI 3 "s390_alc_comparison" ""))
4166 (set (match_operand:DI 0 "register_operand" "=d,d")
4167 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4168 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4172 [(set_attr "op_type" "RRE,RXY")])
4174 (define_insn "*adddi3_alc"
4175 [(set (match_operand:DI 0 "register_operand" "=d,d")
4176 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4177 (match_operand:DI 2 "general_operand" "d,m"))
4178 (match_operand:DI 3 "s390_alc_comparison" "")))
4179 (clobber (reg:CC 33))]
4184 [(set_attr "op_type" "RRE,RXY")])
4186 (define_insn "*subdi3_slb_cc"
4189 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4190 (match_operand:DI 2 "general_operand" "d,m"))
4191 (match_operand:DI 3 "s390_slb_comparison" ""))
4193 (set (match_operand:DI 0 "register_operand" "=d,d")
4194 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4195 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4199 [(set_attr "op_type" "RRE,RXY")])
4201 (define_insn "*subdi3_slb"
4202 [(set (match_operand:DI 0 "register_operand" "=d,d")
4203 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4204 (match_operand:DI 2 "general_operand" "d,m"))
4205 (match_operand:DI 3 "s390_slb_comparison" "")))
4206 (clobber (reg:CC 33))]
4211 [(set_attr "op_type" "RRE,RXY")])
4214 ; addsicc instruction pattern(s).
4217 (define_insn "*addsi3_alc_cc"
4220 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4221 (match_operand:SI 2 "general_operand" "d,m"))
4222 (match_operand:SI 3 "s390_alc_comparison" ""))
4224 (set (match_operand:SI 0 "register_operand" "=d,d")
4225 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4226 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4230 [(set_attr "op_type" "RRE,RXY")])
4232 (define_insn "*addsi3_alc"
4233 [(set (match_operand:SI 0 "register_operand" "=d,d")
4234 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4235 (match_operand:SI 2 "general_operand" "d,m"))
4236 (match_operand:SI 3 "s390_alc_comparison" "")))
4237 (clobber (reg:CC 33))]
4242 [(set_attr "op_type" "RRE,RXY")])
4244 (define_insn "*subsi3_slb_cc"
4247 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4248 (match_operand:SI 2 "general_operand" "d,m"))
4249 (match_operand:SI 3 "s390_slb_comparison" ""))
4251 (set (match_operand:SI 0 "register_operand" "=d,d")
4252 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4253 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4257 [(set_attr "op_type" "RRE,RXY")])
4259 (define_insn "*subsi3_slb"
4260 [(set (match_operand:SI 0 "register_operand" "=d,d")
4261 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4262 (match_operand:SI 2 "general_operand" "d,m"))
4263 (match_operand:SI 3 "s390_slb_comparison" "")))
4264 (clobber (reg:CC 33))]
4269 [(set_attr "op_type" "RRE,RXY")])
4273 ;;- Multiply instructions.
4277 ; muldi3 instruction pattern(s).
4280 (define_insn "*muldi3_sign"
4281 [(set (match_operand:DI 0 "register_operand" "=d,d")
4282 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4283 (match_operand:DI 1 "register_operand" "0,0")))]
4288 [(set_attr "op_type" "RRE,RXY")
4289 (set_attr "type" "imul")])
4291 (define_insn "muldi3"
4292 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4293 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4294 (match_operand:DI 2 "general_operand" "d,K,m")))]
4300 [(set_attr "op_type" "RRE,RI,RXY")
4301 (set_attr "type" "imul")])
4304 ; mulsi3 instruction pattern(s).
4307 (define_insn "*mulsi3_sign"
4308 [(set (match_operand:SI 0 "register_operand" "=d")
4309 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4310 (match_operand:SI 1 "register_operand" "0")))]
4313 [(set_attr "op_type" "RX")
4314 (set_attr "type" "imul")])
4316 (define_insn "mulsi3"
4317 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4318 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4319 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4326 [(set_attr "op_type" "RRE,RI,RX,RXY")
4327 (set_attr "type" "imul")])
4330 ; mulsidi3 instruction pattern(s).
4333 (define_insn "mulsidi3"
4334 [(set (match_operand:DI 0 "register_operand" "=d,d")
4335 (mult:DI (sign_extend:DI
4336 (match_operand:SI 1 "register_operand" "%0,0"))
4338 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4343 [(set_attr "op_type" "RR,RX")
4344 (set_attr "type" "imul")])
4347 ; umulsidi3 instruction pattern(s).
4350 (define_insn "umulsidi3"
4351 [(set (match_operand:DI 0 "register_operand" "=d,d")
4352 (mult:DI (zero_extend:DI
4353 (match_operand:SI 1 "register_operand" "%0,0"))
4355 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4356 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4360 [(set_attr "op_type" "RRE,RXY")
4361 (set_attr "type" "imul")])
4364 ; muldf3 instruction pattern(s).
4367 (define_expand "muldf3"
4368 [(set (match_operand:DF 0 "register_operand" "=f,f")
4369 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4370 (match_operand:DF 2 "general_operand" "f,R")))]
4374 (define_insn "*muldf3"
4375 [(set (match_operand:DF 0 "register_operand" "=f,f")
4376 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4377 (match_operand:DF 2 "general_operand" "f,R")))]
4378 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4382 [(set_attr "op_type" "RRE,RXE")
4383 (set_attr "type" "fmuld")])
4385 (define_insn "*muldf3_ibm"
4386 [(set (match_operand:DF 0 "register_operand" "=f,f")
4387 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4388 (match_operand:DF 2 "general_operand" "f,R")))]
4389 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4393 [(set_attr "op_type" "RR,RX")
4394 (set_attr "type" "fmuld")])
4396 (define_insn "*fmadddf"
4397 [(set (match_operand:DF 0 "register_operand" "=f,f")
4398 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4399 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4400 (match_operand:DF 3 "register_operand" "0,0")))]
4401 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4405 [(set_attr "op_type" "RRE,RXE")
4406 (set_attr "type" "fmuld")])
4408 (define_insn "*fmsubdf"
4409 [(set (match_operand:DF 0 "register_operand" "=f,f")
4410 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4411 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4412 (match_operand:DF 3 "register_operand" "0,0")))]
4413 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4417 [(set_attr "op_type" "RRE,RXE")
4418 (set_attr "type" "fmuld")])
4421 ; mulsf3 instruction pattern(s).
4424 (define_expand "mulsf3"
4425 [(set (match_operand:SF 0 "register_operand" "=f,f")
4426 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4427 (match_operand:SF 2 "general_operand" "f,R")))]
4431 (define_insn "*mulsf3"
4432 [(set (match_operand:SF 0 "register_operand" "=f,f")
4433 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4434 (match_operand:SF 2 "general_operand" "f,R")))]
4435 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4439 [(set_attr "op_type" "RRE,RXE")
4440 (set_attr "type" "fmuls")])
4442 (define_insn "*mulsf3_ibm"
4443 [(set (match_operand:SF 0 "register_operand" "=f,f")
4444 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4445 (match_operand:SF 2 "general_operand" "f,R")))]
4446 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4450 [(set_attr "op_type" "RR,RX")
4451 (set_attr "type" "fmuls")])
4453 (define_insn "*fmaddsf"
4454 [(set (match_operand:SF 0 "register_operand" "=f,f")
4455 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4456 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4457 (match_operand:SF 3 "register_operand" "0,0")))]
4458 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4462 [(set_attr "op_type" "RRE,RXE")
4463 (set_attr "type" "fmuls")])
4465 (define_insn "*fmsubsf"
4466 [(set (match_operand:SF 0 "register_operand" "=f,f")
4467 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4468 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4469 (match_operand:SF 3 "register_operand" "0,0")))]
4470 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4474 [(set_attr "op_type" "RRE,RXE")
4475 (set_attr "type" "fmuls")])
4478 ;;- Divide and modulo instructions.
4482 ; divmoddi4 instruction pattern(s).
4485 (define_expand "divmoddi4"
4486 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4487 (div:DI (match_operand:DI 1 "register_operand" "")
4488 (match_operand:DI 2 "general_operand" "")))
4489 (set (match_operand:DI 3 "general_operand" "")
4490 (mod:DI (match_dup 1) (match_dup 2)))])
4491 (clobber (match_dup 4))]
4494 rtx insn, div_equal, mod_equal;
4496 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4497 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4499 operands[4] = gen_reg_rtx(TImode);
4500 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4502 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4504 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4506 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4508 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4513 (define_insn "divmodtidi3"
4514 [(set (match_operand:TI 0 "register_operand" "=d,d")
4517 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4518 (match_operand:DI 2 "general_operand" "d,m")))
4521 (mod:DI (match_dup 1)
4528 [(set_attr "op_type" "RRE,RXY")
4529 (set_attr "type" "idiv")])
4531 (define_insn "divmodtisi3"
4532 [(set (match_operand:TI 0 "register_operand" "=d,d")
4535 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4536 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4539 (mod:DI (match_dup 1)
4540 (sign_extend:DI (match_dup 2))))
4546 [(set_attr "op_type" "RRE,RXY")
4547 (set_attr "type" "idiv")])
4550 ; udivmoddi4 instruction pattern(s).
4553 (define_expand "udivmoddi4"
4554 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4555 (udiv:DI (match_operand:DI 1 "general_operand" "")
4556 (match_operand:DI 2 "nonimmediate_operand" "")))
4557 (set (match_operand:DI 3 "general_operand" "")
4558 (umod:DI (match_dup 1) (match_dup 2)))])
4559 (clobber (match_dup 4))]
4562 rtx insn, div_equal, mod_equal, equal;
4564 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4565 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4566 equal = gen_rtx_IOR (TImode,
4567 gen_rtx_ZERO_EXTEND (TImode, div_equal),
4568 gen_rtx_ASHIFT (TImode,
4569 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4572 operands[4] = gen_reg_rtx(TImode);
4573 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4574 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4575 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4576 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4578 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4580 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4582 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4584 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4586 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4591 (define_insn "udivmodtidi3"
4592 [(set (match_operand:TI 0 "register_operand" "=d,d")
4593 (ior:TI (zero_extend:TI
4595 (udiv:TI (match_operand:TI 1 "register_operand" "0,0")
4597 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4601 (umod:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))
4607 [(set_attr "op_type" "RRE,RXY")
4608 (set_attr "type" "idiv")])
4611 ; divmodsi4 instruction pattern(s).
4614 (define_expand "divmodsi4"
4615 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4616 (div:SI (match_operand:SI 1 "general_operand" "")
4617 (match_operand:SI 2 "nonimmediate_operand" "")))
4618 (set (match_operand:SI 3 "general_operand" "")
4619 (mod:SI (match_dup 1) (match_dup 2)))])
4620 (clobber (match_dup 4))]
4623 rtx insn, div_equal, mod_equal, equal;
4625 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4626 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4627 equal = gen_rtx_IOR (DImode,
4628 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4629 gen_rtx_ASHIFT (DImode,
4630 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4633 operands[4] = gen_reg_rtx(DImode);
4634 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4635 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4637 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4639 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4641 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4643 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4645 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4650 (define_insn "divmoddisi3"
4651 [(set (match_operand:DI 0 "register_operand" "=d,d")
4652 (ior:DI (zero_extend:DI
4654 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4656 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4660 (mod:DI (match_dup 1) (sign_extend:SI (match_dup 2)))))
4666 [(set_attr "op_type" "RR,RX")
4667 (set_attr "type" "idiv")])
4670 ; udivsi3 and umodsi3 instruction pattern(s).
4673 (define_expand "udivmodsi4"
4674 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4675 (udiv:SI (match_operand:SI 1 "general_operand" "")
4676 (match_operand:SI 2 "nonimmediate_operand" "")))
4677 (set (match_operand:SI 3 "general_operand" "")
4678 (umod:SI (match_dup 1) (match_dup 2)))])
4679 (clobber (match_dup 4))]
4680 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4682 rtx insn, div_equal, mod_equal, equal;
4684 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4685 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4686 equal = gen_rtx_IOR (DImode,
4687 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4688 gen_rtx_ASHIFT (DImode,
4689 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4692 operands[4] = gen_reg_rtx(DImode);
4693 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4694 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4695 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4696 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4698 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4700 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4702 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4704 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4706 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4711 (define_insn "udivmoddisi3"
4712 [(set (match_operand:DI 0 "register_operand" "=d,d")
4713 (ior:DI (zero_extend:DI
4715 (udiv:DI (match_operand:DI 1 "register_operand" "0,0")
4717 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4721 (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))
4723 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4727 [(set_attr "op_type" "RRE,RXY")
4728 (set_attr "type" "idiv")])
4730 (define_expand "udivsi3"
4731 [(set (match_operand:SI 0 "register_operand" "=d")
4732 (udiv:SI (match_operand:SI 1 "general_operand" "")
4733 (match_operand:SI 2 "general_operand" "")))
4734 (clobber (match_dup 3))]
4735 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4737 rtx insn, udiv_equal, umod_equal, equal;
4739 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4740 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4741 equal = gen_rtx_IOR (DImode,
4742 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4743 gen_rtx_ASHIFT (DImode,
4744 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4747 operands[3] = gen_reg_rtx (DImode);
4749 if (CONSTANT_P (operands[2]))
4751 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4753 rtx label1 = gen_label_rtx ();
4755 operands[1] = make_safe_from (operands[1], operands[0]);
4756 emit_move_insn (operands[0], const0_rtx);
4757 emit_insn (gen_cmpsi (operands[1], operands[2]));
4758 emit_jump_insn (gen_bltu (label1));
4759 emit_move_insn (operands[0], const1_rtx);
4760 emit_label (label1);
4764 operands[2] = force_reg (SImode, operands[2]);
4765 operands[2] = make_safe_from (operands[2], operands[0]);
4767 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4768 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4771 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4773 insn = emit_move_insn (operands[0],
4774 gen_lowpart (SImode, operands[3]));
4776 gen_rtx_EXPR_LIST (REG_EQUAL,
4777 udiv_equal, REG_NOTES (insn));
4782 rtx label1 = gen_label_rtx ();
4783 rtx label2 = gen_label_rtx ();
4784 rtx label3 = gen_label_rtx ();
4786 operands[1] = force_reg (SImode, operands[1]);
4787 operands[1] = make_safe_from (operands[1], operands[0]);
4788 operands[2] = force_reg (SImode, operands[2]);
4789 operands[2] = make_safe_from (operands[2], operands[0]);
4791 emit_move_insn (operands[0], const0_rtx);
4792 emit_insn (gen_cmpsi (operands[2], operands[1]));
4793 emit_jump_insn (gen_bgtu (label3));
4794 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4795 emit_jump_insn (gen_blt (label2));
4796 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4797 emit_jump_insn (gen_beq (label1));
4798 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4799 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4802 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4804 insn = emit_move_insn (operands[0],
4805 gen_lowpart (SImode, operands[3]));
4807 gen_rtx_EXPR_LIST (REG_EQUAL,
4808 udiv_equal, REG_NOTES (insn));
4810 emit_label (label1);
4811 emit_move_insn (operands[0], operands[1]);
4813 emit_label (label2);
4814 emit_move_insn (operands[0], const1_rtx);
4815 emit_label (label3);
4817 emit_move_insn (operands[0], operands[0]);
4821 (define_expand "umodsi3"
4822 [(set (match_operand:SI 0 "register_operand" "=d")
4823 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4824 (match_operand:SI 2 "nonimmediate_operand" "")))
4825 (clobber (match_dup 3))]
4826 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4828 rtx insn, udiv_equal, umod_equal, equal;
4830 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4831 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4832 equal = gen_rtx_IOR (DImode,
4833 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4834 gen_rtx_ASHIFT (DImode,
4835 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4838 operands[3] = gen_reg_rtx (DImode);
4840 if (CONSTANT_P (operands[2]))
4842 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4844 rtx label1 = gen_label_rtx ();
4846 operands[1] = make_safe_from (operands[1], operands[0]);
4847 emit_move_insn (operands[0], operands[1]);
4848 emit_insn (gen_cmpsi (operands[0], operands[2]));
4849 emit_jump_insn (gen_bltu (label1));
4850 emit_insn (gen_abssi2 (operands[0], operands[2]));
4851 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4852 emit_label (label1);
4856 operands[2] = force_reg (SImode, operands[2]);
4857 operands[2] = make_safe_from (operands[2], operands[0]);
4859 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4860 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4863 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4865 insn = emit_move_insn (operands[0],
4866 gen_highpart (SImode, operands[3]));
4868 gen_rtx_EXPR_LIST (REG_EQUAL,
4869 umod_equal, REG_NOTES (insn));
4874 rtx label1 = gen_label_rtx ();
4875 rtx label2 = gen_label_rtx ();
4876 rtx label3 = gen_label_rtx ();
4878 operands[1] = force_reg (SImode, operands[1]);
4879 operands[1] = make_safe_from (operands[1], operands[0]);
4880 operands[2] = force_reg (SImode, operands[2]);
4881 operands[2] = make_safe_from (operands[2], operands[0]);
4883 emit_move_insn(operands[0], operands[1]);
4884 emit_insn (gen_cmpsi (operands[2], operands[1]));
4885 emit_jump_insn (gen_bgtu (label3));
4886 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4887 emit_jump_insn (gen_blt (label2));
4888 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4889 emit_jump_insn (gen_beq (label1));
4890 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4891 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4894 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4896 insn = emit_move_insn (operands[0],
4897 gen_highpart (SImode, operands[3]));
4899 gen_rtx_EXPR_LIST (REG_EQUAL,
4900 umod_equal, REG_NOTES (insn));
4902 emit_label (label1);
4903 emit_move_insn (operands[0], const0_rtx);
4905 emit_label (label2);
4906 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4907 emit_label (label3);
4913 ; divdf3 instruction pattern(s).
4916 (define_expand "divdf3"
4917 [(set (match_operand:DF 0 "register_operand" "=f,f")
4918 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4919 (match_operand:DF 2 "general_operand" "f,R")))]
4923 (define_insn "*divdf3"
4924 [(set (match_operand:DF 0 "register_operand" "=f,f")
4925 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4926 (match_operand:DF 2 "general_operand" "f,R")))]
4927 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4931 [(set_attr "op_type" "RRE,RXE")
4932 (set_attr "type" "fdivd")])
4934 (define_insn "*divdf3_ibm"
4935 [(set (match_operand:DF 0 "register_operand" "=f,f")
4936 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4937 (match_operand:DF 2 "general_operand" "f,R")))]
4938 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4942 [(set_attr "op_type" "RR,RX")
4943 (set_attr "type" "fdivd")])
4946 ; divsf3 instruction pattern(s).
4949 (define_expand "divsf3"
4950 [(set (match_operand:SF 0 "register_operand" "=f,f")
4951 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4952 (match_operand:SF 2 "general_operand" "f,R")))]
4956 (define_insn "*divsf3"
4957 [(set (match_operand:SF 0 "register_operand" "=f,f")
4958 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4959 (match_operand:SF 2 "general_operand" "f,R")))]
4960 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4964 [(set_attr "op_type" "RRE,RXE")
4965 (set_attr "type" "fdivs")])
4967 (define_insn "*divsf3"
4968 [(set (match_operand:SF 0 "register_operand" "=f,f")
4969 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4970 (match_operand:SF 2 "general_operand" "f,R")))]
4971 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4975 [(set_attr "op_type" "RR,RX")
4976 (set_attr "type" "fdivs")])
4980 ;;- And instructions.
4984 ; anddi3 instruction pattern(s).
4987 (define_insn "*anddi3_cc"
4989 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4990 (match_operand:DI 2 "general_operand" "d,m"))
4992 (set (match_operand:DI 0 "register_operand" "=d,d")
4993 (and:DI (match_dup 1) (match_dup 2)))]
4994 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4998 [(set_attr "op_type" "RRE,RXY")])
5000 (define_insn "*anddi3_cconly"
5002 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5003 (match_operand:DI 2 "general_operand" "d,m"))
5005 (clobber (match_scratch:DI 0 "=d,d"))]
5006 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5010 [(set_attr "op_type" "RRE,RXY")])
5012 (define_insn "*anddi3_ni"
5013 [(set (match_operand:DI 0 "register_operand" "=d")
5014 (and:DI (match_operand:DI 1 "nonimmediate_operand" "0")
5015 (match_operand:DI 2 "immediate_operand" "n")))
5016 (clobber (reg:CC 33))]
5017 "TARGET_64BIT && s390_single_hi (operands[2], DImode, -1) >= 0"
5019 int part = s390_single_hi (operands[2], DImode, -1);
5020 operands[2] = GEN_INT (s390_extract_hi (operands[2], DImode, part));
5024 case 0: return "nihh\t%0,%x2";
5025 case 1: return "nihl\t%0,%x2";
5026 case 2: return "nilh\t%0,%x2";
5027 case 3: return "nill\t%0,%x2";
5031 [(set_attr "op_type" "RI")])
5033 (define_insn "anddi3"
5034 [(set (match_operand:DI 0 "register_operand" "=d,d")
5035 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5036 (match_operand:DI 2 "general_operand" "d,m")))
5037 (clobber (reg:CC 33))]
5042 [(set_attr "op_type" "RRE,RXY")])
5044 (define_insn "*anddi3_ss"
5045 [(set (match_operand:DI 0 "s_operand" "=Q")
5046 (and:DI (match_dup 0)
5047 (match_operand:DI 1 "s_imm_operand" "Q")))
5048 (clobber (reg:CC 33))]
5051 [(set_attr "op_type" "SS")])
5053 (define_insn "*anddi3_ss_inv"
5054 [(set (match_operand:DI 0 "s_operand" "=Q")
5055 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5057 (clobber (reg:CC 33))]
5060 [(set_attr "op_type" "SS")])
5063 ; andsi3 instruction pattern(s).
5066 (define_insn "*andsi3_cc"
5068 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5069 (match_operand:SI 2 "general_operand" "d,R,T"))
5071 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5072 (and:SI (match_dup 1) (match_dup 2)))]
5073 "s390_match_ccmode(insn, CCTmode)"
5078 [(set_attr "op_type" "RR,RX,RXY")])
5080 (define_insn "*andsi3_cconly"
5082 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5083 (match_operand:SI 2 "general_operand" "d,R,T"))
5085 (clobber (match_scratch:SI 0 "=d,d,d"))]
5086 "s390_match_ccmode(insn, CCTmode)"
5091 [(set_attr "op_type" "RR,RX,RXY")])
5093 (define_insn "*andsi3_ni"
5094 [(set (match_operand:SI 0 "register_operand" "=d")
5095 (and:SI (match_operand:SI 1 "nonimmediate_operand" "0")
5096 (match_operand:SI 2 "immediate_operand" "n")))
5097 (clobber (reg:CC 33))]
5098 "TARGET_ZARCH && s390_single_hi (operands[2], SImode, -1) >= 0"
5100 int part = s390_single_hi (operands[2], SImode, -1);
5101 operands[2] = GEN_INT (s390_extract_hi (operands[2], SImode, part));
5105 case 0: return "nilh\t%0,%x2";
5106 case 1: return "nill\t%0,%x2";
5110 [(set_attr "op_type" "RI")])
5112 (define_insn "andsi3"
5113 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5114 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5115 (match_operand:SI 2 "general_operand" "d,R,T")))
5116 (clobber (reg:CC 33))]
5122 [(set_attr "op_type" "RR,RX,RXY")])
5124 (define_insn "*andsi3_ss"
5125 [(set (match_operand:SI 0 "s_operand" "=Q")
5126 (and:SI (match_dup 0)
5127 (match_operand:SI 1 "s_imm_operand" "Q")))
5128 (clobber (reg:CC 33))]
5131 [(set_attr "op_type" "SS")])
5133 (define_insn "*andsi3_ss_inv"
5134 [(set (match_operand:SI 0 "s_operand" "=Q")
5135 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5137 (clobber (reg:CC 33))]
5140 [(set_attr "op_type" "SS")])
5143 ; andhi3 instruction pattern(s).
5146 (define_insn "*andhi3_ni"
5147 [(set (match_operand:HI 0 "register_operand" "=d,d")
5148 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5149 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5150 (clobber (reg:CC 33))]
5155 [(set_attr "op_type" "RR,RI")])
5157 (define_insn "andhi3"
5158 [(set (match_operand:HI 0 "register_operand" "=d")
5159 (and:HI (match_operand:HI 1 "register_operand" "%0")
5160 (match_operand:HI 2 "nonmemory_operand" "d")))
5161 (clobber (reg:CC 33))]
5164 [(set_attr "op_type" "RR")])
5166 (define_insn "*andhi3_ss"
5167 [(set (match_operand:HI 0 "s_operand" "=Q")
5168 (and:HI (match_dup 0)
5169 (match_operand:HI 1 "s_imm_operand" "Q")))
5170 (clobber (reg:CC 33))]
5173 [(set_attr "op_type" "SS")])
5175 (define_insn "*andhi3_ss_inv"
5176 [(set (match_operand:HI 0 "s_operand" "=Q")
5177 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5179 (clobber (reg:CC 33))]
5182 [(set_attr "op_type" "SS")])
5185 ; andqi3 instruction pattern(s).
5188 (define_insn "*andqi3_ni"
5189 [(set (match_operand:QI 0 "register_operand" "=d,d")
5190 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5191 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5192 (clobber (reg:CC 33))]
5197 [(set_attr "op_type" "RR,RI")])
5199 (define_insn "andqi3"
5200 [(set (match_operand:QI 0 "register_operand" "=d")
5201 (and:QI (match_operand:QI 1 "register_operand" "%0")
5202 (match_operand:QI 2 "nonmemory_operand" "d")))
5203 (clobber (reg:CC 33))]
5206 [(set_attr "op_type" "RR")])
5208 (define_insn "*andqi3_ss"
5209 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5210 (and:QI (match_dup 0)
5211 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5212 (clobber (reg:CC 33))]
5218 [(set_attr "op_type" "SI,SIY,SS")])
5220 (define_insn "*andqi3_ss_inv"
5221 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5222 (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5224 (clobber (reg:CC 33))]
5230 [(set_attr "op_type" "SI,SIY,SS")])
5234 ;;- Bit set (inclusive or) instructions.
5238 ; iordi3 instruction pattern(s).
5241 (define_insn "*iordi3_cc"
5243 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5244 (match_operand:DI 2 "general_operand" "d,m"))
5246 (set (match_operand:DI 0 "register_operand" "=d,d")
5247 (ior:DI (match_dup 1) (match_dup 2)))]
5248 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5252 [(set_attr "op_type" "RRE,RXY")])
5254 (define_insn "*iordi3_cconly"
5256 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5257 (match_operand:DI 2 "general_operand" "d,m"))
5259 (clobber (match_scratch:DI 0 "=d,d"))]
5260 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5264 [(set_attr "op_type" "RRE,RXY")])
5266 (define_insn "*iordi3_oi"
5267 [(set (match_operand:DI 0 "register_operand" "=d")
5268 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0")
5269 (match_operand:DI 2 "immediate_operand" "n")))
5270 (clobber (reg:CC 33))]
5271 "TARGET_64BIT && s390_single_hi (operands[2], DImode, 0) >= 0"
5273 int part = s390_single_hi (operands[2], DImode, 0);
5274 operands[2] = GEN_INT (s390_extract_hi (operands[2], DImode, part));
5278 case 0: return "oihh\t%0,%x2";
5279 case 1: return "oihl\t%0,%x2";
5280 case 2: return "oilh\t%0,%x2";
5281 case 3: return "oill\t%0,%x2";
5285 [(set_attr "op_type" "RI")])
5287 (define_insn "iordi3"
5288 [(set (match_operand:DI 0 "register_operand" "=d,d")
5289 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5290 (match_operand:DI 2 "general_operand" "d,m")))
5291 (clobber (reg:CC 33))]
5296 [(set_attr "op_type" "RRE,RXY")])
5298 (define_insn "*iordi3_ss"
5299 [(set (match_operand:DI 0 "s_operand" "=Q")
5300 (ior:DI (match_dup 0)
5301 (match_operand:DI 1 "s_imm_operand" "Q")))
5302 (clobber (reg:CC 33))]
5305 [(set_attr "op_type" "SS")])
5307 (define_insn "*iordi3_ss_inv"
5308 [(set (match_operand:DI 0 "s_operand" "=Q")
5309 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5311 (clobber (reg:CC 33))]
5314 [(set_attr "op_type" "SS")])
5317 ; iorsi3 instruction pattern(s).
5320 (define_insn "*iorsi3_cc"
5322 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5323 (match_operand:SI 2 "general_operand" "d,R,T"))
5325 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5326 (ior:SI (match_dup 1) (match_dup 2)))]
5327 "s390_match_ccmode(insn, CCTmode)"
5332 [(set_attr "op_type" "RR,RX,RXY")])
5334 (define_insn "*iorsi3_cconly"
5336 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5337 (match_operand:SI 2 "general_operand" "d,R,T"))
5339 (clobber (match_scratch:SI 0 "=d,d,d"))]
5340 "s390_match_ccmode(insn, CCTmode)"
5345 [(set_attr "op_type" "RR,RX,RXY")])
5347 (define_insn "*iorsi3_oi"
5348 [(set (match_operand:SI 0 "register_operand" "=d")
5349 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0")
5350 (match_operand:SI 2 "immediate_operand" "n")))
5351 (clobber (reg:CC 33))]
5352 "TARGET_ZARCH && s390_single_hi (operands[2], SImode, 0) >= 0"
5354 int part = s390_single_hi (operands[2], SImode, 0);
5355 operands[2] = GEN_INT (s390_extract_hi (operands[2], SImode, part));
5359 case 0: return "oilh\t%0,%x2";
5360 case 1: return "oill\t%0,%x2";
5364 [(set_attr "op_type" "RI")])
5366 (define_insn "iorsi3"
5367 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5368 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5369 (match_operand:SI 2 "general_operand" "d,R,T")))
5370 (clobber (reg:CC 33))]
5376 [(set_attr "op_type" "RR,RX,RXY")])
5378 (define_insn "*iorsi3_ss"
5379 [(set (match_operand:SI 0 "s_operand" "=Q")
5380 (ior:SI (match_dup 0)
5381 (match_operand:SI 1 "s_imm_operand" "Q")))
5382 (clobber (reg:CC 33))]
5385 [(set_attr "op_type" "SS")])
5387 (define_insn "*iorsi3_ss_inv"
5388 [(set (match_operand:SI 0 "s_operand" "=Q")
5389 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5391 (clobber (reg:CC 33))]
5394 [(set_attr "op_type" "SS")])
5397 ; iorhi3 instruction pattern(s).
5400 (define_insn "*iorhi3_oi"
5401 [(set (match_operand:HI 0 "register_operand" "=d,d")
5402 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5403 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5404 (clobber (reg:CC 33))]
5409 [(set_attr "op_type" "RR,RI")])
5411 (define_insn "iorhi3"
5412 [(set (match_operand:HI 0 "register_operand" "=d")
5413 (ior:HI (match_operand:HI 1 "register_operand" "%0")
5414 (match_operand:HI 2 "nonmemory_operand" "d")))
5415 (clobber (reg:CC 33))]
5418 [(set_attr "op_type" "RR")])
5420 (define_insn "*iorhi3_ss"
5421 [(set (match_operand:HI 0 "s_operand" "=Q")
5422 (ior:HI (match_dup 0)
5423 (match_operand:HI 1 "s_imm_operand" "Q")))
5424 (clobber (reg:CC 33))]
5427 [(set_attr "op_type" "SS")])
5429 (define_insn "*iorhi3_ss_inv"
5430 [(set (match_operand:HI 0 "s_operand" "=Q")
5431 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5433 (clobber (reg:CC 33))]
5436 [(set_attr "op_type" "SS")])
5439 ; iorqi3 instruction pattern(s).
5442 (define_insn "*iorqi3_oi"
5443 [(set (match_operand:QI 0 "register_operand" "=d,d")
5444 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5445 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5446 (clobber (reg:CC 33))]
5451 [(set_attr "op_type" "RR,RI")])
5453 (define_insn "iorqi3"
5454 [(set (match_operand:QI 0 "register_operand" "=d")
5455 (ior:QI (match_operand:QI 1 "register_operand" "%0")
5456 (match_operand:QI 2 "nonmemory_operand" "d")))
5457 (clobber (reg:CC 33))]
5460 [(set_attr "op_type" "RR")])
5462 (define_insn "*iorqi3_ss"
5463 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5464 (ior:QI (match_dup 0)
5465 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5466 (clobber (reg:CC 33))]
5472 [(set_attr "op_type" "SI,SIY,SS")])
5474 (define_insn "*iorqi3_ss_inv"
5475 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5476 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5478 (clobber (reg:CC 33))]
5484 [(set_attr "op_type" "SI,SIY,SS")])
5488 ;;- Xor instructions.
5492 ; xordi3 instruction pattern(s).
5495 (define_insn "*xordi3_cc"
5497 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5498 (match_operand:DI 2 "general_operand" "d,m"))
5500 (set (match_operand:DI 0 "register_operand" "=d,d")
5501 (xor:DI (match_dup 1) (match_dup 2)))]
5502 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5506 [(set_attr "op_type" "RRE,RXY")])
5508 (define_insn "*xordi3_cconly"
5510 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5511 (match_operand:DI 2 "general_operand" "d,m"))
5513 (clobber (match_scratch:DI 0 "=d,d"))]
5514 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5518 [(set_attr "op_type" "RRE,RXY")])
5520 (define_insn "xordi3"
5521 [(set (match_operand:DI 0 "register_operand" "=d,d")
5522 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5523 (match_operand:DI 2 "general_operand" "d,m")))
5524 (clobber (reg:CC 33))]
5529 [(set_attr "op_type" "RRE,RXY")])
5531 (define_insn "*xordi3_ss"
5532 [(set (match_operand:DI 0 "s_operand" "=Q")
5533 (xor:DI (match_dup 0)
5534 (match_operand:DI 1 "s_imm_operand" "Q")))
5535 (clobber (reg:CC 33))]
5538 [(set_attr "op_type" "SS")])
5540 (define_insn "*xordi3_ss_inv"
5541 [(set (match_operand:DI 0 "s_operand" "=Q")
5542 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5544 (clobber (reg:CC 33))]
5547 [(set_attr "op_type" "SS")])
5550 ; xorsi3 instruction pattern(s).
5553 (define_insn "*xorsi3_cc"
5555 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5556 (match_operand:SI 2 "general_operand" "d,R,T"))
5558 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5559 (xor:SI (match_dup 1) (match_dup 2)))]
5560 "s390_match_ccmode(insn, CCTmode)"
5565 [(set_attr "op_type" "RR,RX,RXY")])
5567 (define_insn "*xorsi3_cconly"
5569 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5570 (match_operand:SI 2 "general_operand" "d,R,T"))
5572 (clobber (match_scratch:SI 0 "=d,d,d"))]
5573 "s390_match_ccmode(insn, CCTmode)"
5578 [(set_attr "op_type" "RR,RX,RXY")])
5580 (define_insn "xorsi3"
5581 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5582 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5583 (match_operand:SI 2 "general_operand" "d,R,T")))
5584 (clobber (reg:CC 33))]
5590 [(set_attr "op_type" "RR,RX,RXY")])
5592 (define_insn "*xorsi3_ss"
5593 [(set (match_operand:SI 0 "s_operand" "=Q")
5594 (xor:SI (match_dup 0)
5595 (match_operand:SI 1 "s_imm_operand" "Q")))
5596 (clobber (reg:CC 33))]
5599 [(set_attr "op_type" "SS")])
5601 (define_insn "*xorsi3_ss_inv"
5602 [(set (match_operand:SI 0 "s_operand" "=Q")
5603 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5605 (clobber (reg:CC 33))]
5608 [(set_attr "op_type" "SS")])
5611 ; xorhi3 instruction pattern(s).
5614 (define_insn "xorhi3"
5615 [(set (match_operand:HI 0 "register_operand" "=d")
5616 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5617 (match_operand:HI 2 "nonmemory_operand" "d")))
5618 (clobber (reg:CC 33))]
5621 [(set_attr "op_type" "RR")])
5623 (define_insn "*xorhi3_ss"
5624 [(set (match_operand:HI 0 "s_operand" "=Q")
5625 (xor:HI (match_dup 0)
5626 (match_operand:HI 1 "s_imm_operand" "Q")))
5627 (clobber (reg:CC 33))]
5630 [(set_attr "op_type" "SS")])
5632 (define_insn "*xorhi3_ss_inv"
5633 [(set (match_operand:HI 0 "s_operand" "=Q")
5634 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5636 (clobber (reg:CC 33))]
5639 [(set_attr "op_type" "SS")])
5642 ; xorqi3 instruction pattern(s).
5645 (define_insn "xorqi3"
5646 [(set (match_operand:QI 0 "register_operand" "=d")
5647 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5648 (match_operand:QI 2 "nonmemory_operand" "d")))
5649 (clobber (reg:CC 33))]
5652 [(set_attr "op_type" "RR")])
5654 (define_insn "*xorqi3_ss"
5655 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5656 (xor:QI (match_dup 0)
5657 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5658 (clobber (reg:CC 33))]
5664 [(set_attr "op_type" "SI,SIY,SS")])
5666 (define_insn "*xorqi3_ss_inv"
5667 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5668 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5670 (clobber (reg:CC 33))]
5676 [(set_attr "op_type" "SI,SIY,SS")])
5680 ;;- Negate instructions.
5684 ; negdi2 instruction pattern(s).
5687 (define_expand "negdi2"
5689 [(set (match_operand:DI 0 "register_operand" "=d")
5690 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5691 (clobber (reg:CC 33))])]
5695 (define_insn "*negdi2_64"
5696 [(set (match_operand:DI 0 "register_operand" "=d")
5697 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5698 (clobber (reg:CC 33))]
5701 [(set_attr "op_type" "RR")])
5703 (define_insn "*negdi2_31"
5704 [(set (match_operand:DI 0 "register_operand" "=d")
5705 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5706 (clobber (reg:CC 33))]
5710 xop[0] = gen_label_rtx ();
5711 output_asm_insn ("lcr\t%0,%1", operands);
5712 output_asm_insn ("lcr\t%N0,%N1", operands);
5713 output_asm_insn ("je\t%l0", xop);
5714 output_asm_insn ("bctr\t%0,0", operands);
5715 targetm.asm_out.internal_label (asm_out_file, "L",
5716 CODE_LABEL_NUMBER (xop[0]));
5719 [(set_attr "op_type" "NN")
5720 (set_attr "type" "other")
5721 (set_attr "length" "10")])
5724 ; negsi2 instruction pattern(s).
5727 (define_insn "negsi2"
5728 [(set (match_operand:SI 0 "register_operand" "=d")
5729 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5730 (clobber (reg:CC 33))]
5733 [(set_attr "op_type" "RR")])
5736 ; negdf2 instruction pattern(s).
5739 (define_expand "negdf2"
5741 [(set (match_operand:DF 0 "register_operand" "=f")
5742 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5743 (clobber (reg:CC 33))])]
5747 (define_insn "*negdf2"
5748 [(set (match_operand:DF 0 "register_operand" "=f")
5749 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5750 (clobber (reg:CC 33))]
5751 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5753 [(set_attr "op_type" "RRE")
5754 (set_attr "type" "fsimpd")])
5756 (define_insn "*negdf2_ibm"
5757 [(set (match_operand:DF 0 "register_operand" "=f")
5758 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5759 (clobber (reg:CC 33))]
5760 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5762 [(set_attr "op_type" "RR")
5763 (set_attr "type" "fsimpd")])
5766 ; negsf2 instruction pattern(s).
5769 (define_expand "negsf2"
5771 [(set (match_operand:SF 0 "register_operand" "=f")
5772 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5773 (clobber (reg:CC 33))])]
5777 (define_insn "*negsf2"
5778 [(set (match_operand:SF 0 "register_operand" "=f")
5779 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5780 (clobber (reg:CC 33))]
5781 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5783 [(set_attr "op_type" "RRE")
5784 (set_attr "type" "fsimps")])
5786 (define_insn "*negsf2"
5787 [(set (match_operand:SF 0 "register_operand" "=f")
5788 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5789 (clobber (reg:CC 33))]
5790 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5792 [(set_attr "op_type" "RR")
5793 (set_attr "type" "fsimps")])
5797 ;;- Absolute value instructions.
5801 ; absdi2 instruction pattern(s).
5804 (define_insn "absdi2"
5805 [(set (match_operand:DI 0 "register_operand" "=d")
5806 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5807 (clobber (reg:CC 33))]
5810 [(set_attr "op_type" "RRE")])
5813 ; abssi2 instruction pattern(s).
5816 (define_insn "abssi2"
5817 [(set (match_operand:SI 0 "register_operand" "=d")
5818 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5819 (clobber (reg:CC 33))]
5822 [(set_attr "op_type" "RR")])
5825 ; absdf2 instruction pattern(s).
5828 (define_expand "absdf2"
5830 [(set (match_operand:DF 0 "register_operand" "=f")
5831 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5832 (clobber (reg:CC 33))])]
5836 (define_insn "*absdf2"
5837 [(set (match_operand:DF 0 "register_operand" "=f")
5838 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5839 (clobber (reg:CC 33))]
5840 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5842 [(set_attr "op_type" "RRE")
5843 (set_attr "type" "fsimpd")])
5845 (define_insn "*absdf2_ibm"
5846 [(set (match_operand:DF 0 "register_operand" "=f")
5847 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5848 (clobber (reg:CC 33))]
5849 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5851 [(set_attr "op_type" "RR")
5852 (set_attr "type" "fsimpd")])
5855 ; abssf2 instruction pattern(s).
5858 (define_expand "abssf2"
5860 [(set (match_operand:SF 0 "register_operand" "=f")
5861 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5862 (clobber (reg:CC 33))])]
5866 (define_insn "*abssf2"
5867 [(set (match_operand:SF 0 "register_operand" "=f")
5868 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5869 (clobber (reg:CC 33))]
5870 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5872 [(set_attr "op_type" "RRE")
5873 (set_attr "type" "fsimps")])
5875 (define_insn "*abssf2_ibm"
5876 [(set (match_operand:SF 0 "register_operand" "=f")
5877 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5878 (clobber (reg:CC 33))]
5879 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5881 [(set_attr "op_type" "RR")
5882 (set_attr "type" "fsimps")])
5885 ;;- Negated absolute value instructions
5892 (define_insn "*negabssi2"
5893 [(set (match_operand:SI 0 "register_operand" "=d")
5894 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
5895 (clobber (reg:CC 33))]
5898 [(set_attr "op_type" "RR")])
5900 (define_insn "*negabsdi2"
5901 [(set (match_operand:DI 0 "register_operand" "=d")
5902 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
5903 (clobber (reg:CC 33))]
5906 [(set_attr "op_type" "RRE")])
5912 (define_insn "*negabssf2"
5913 [(set (match_operand:SF 0 "register_operand" "=f")
5914 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5915 (clobber (reg:CC 33))]
5916 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5918 [(set_attr "op_type" "RRE")
5919 (set_attr "type" "fsimps")])
5921 (define_insn "*negabsdf2"
5922 [(set (match_operand:DF 0 "register_operand" "=f")
5923 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5924 (clobber (reg:CC 33))]
5925 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5927 [(set_attr "op_type" "RRE")
5928 (set_attr "type" "fsimpd")])
5931 ;;- Square root instructions.
5935 ; sqrtdf2 instruction pattern(s).
5938 (define_insn "sqrtdf2"
5939 [(set (match_operand:DF 0 "register_operand" "=f,f")
5940 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
5941 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5945 [(set_attr "op_type" "RRE,RXE")])
5948 ; sqrtsf2 instruction pattern(s).
5951 (define_insn "sqrtsf2"
5952 [(set (match_operand:SF 0 "register_operand" "=f,f")
5953 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
5954 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5958 [(set_attr "op_type" "RRE,RXE")])
5961 ;;- One complement instructions.
5965 ; one_cmpldi2 instruction pattern(s).
5968 (define_expand "one_cmpldi2"
5970 [(set (match_operand:DI 0 "register_operand" "")
5971 (xor:DI (match_operand:DI 1 "register_operand" "")
5973 (clobber (reg:CC 33))])]
5978 ; one_cmplsi2 instruction pattern(s).
5981 (define_expand "one_cmplsi2"
5983 [(set (match_operand:SI 0 "register_operand" "")
5984 (xor:SI (match_operand:SI 1 "register_operand" "")
5986 (clobber (reg:CC 33))])]
5991 ; one_cmplhi2 instruction pattern(s).
5994 (define_expand "one_cmplhi2"
5996 [(set (match_operand:HI 0 "register_operand" "")
5997 (xor:HI (match_operand:HI 1 "register_operand" "")
5999 (clobber (reg:CC 33))])]
6004 ; one_cmplqi2 instruction pattern(s).
6007 (define_expand "one_cmplqi2"
6009 [(set (match_operand:QI 0 "register_operand" "")
6010 (xor:QI (match_operand:QI 1 "register_operand" "")
6012 (clobber (reg:CC 33))])]
6018 ;;- Rotate instructions.
6022 ; rotldi3 instruction pattern(s).
6025 (define_insn "rotldi3"
6026 [(set (match_operand:DI 0 "register_operand" "=d")
6027 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6028 (match_operand:SI 2 "shift_count_operand" "Y")))]
6031 [(set_attr "op_type" "RSE")
6032 (set_attr "atype" "reg")])
6035 ; rotlsi3 instruction pattern(s).
6038 (define_insn "rotlsi3"
6039 [(set (match_operand:SI 0 "register_operand" "=d")
6040 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6041 (match_operand:SI 2 "shift_count_operand" "Y")))]
6044 [(set_attr "op_type" "RSE")
6045 (set_attr "atype" "reg")])
6049 ;;- Arithmetic shift instructions.
6053 ; ashldi3 instruction pattern(s).
6056 (define_expand "ashldi3"
6057 [(set (match_operand:DI 0 "register_operand" "")
6058 (ashift:DI (match_operand:DI 1 "register_operand" "")
6059 (match_operand:SI 2 "shift_count_operand" "")))]
6063 (define_insn "*ashldi3_31"
6064 [(set (match_operand:DI 0 "register_operand" "=d")
6065 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6066 (match_operand:SI 2 "shift_count_operand" "Y")))]
6069 [(set_attr "op_type" "RS")
6070 (set_attr "atype" "reg")])
6072 (define_insn "*ashldi3_64"
6073 [(set (match_operand:DI 0 "register_operand" "=d")
6074 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6075 (match_operand:SI 2 "shift_count_operand" "Y")))]
6078 [(set_attr "op_type" "RSE")
6079 (set_attr "atype" "reg")])
6082 ; ashrdi3 instruction pattern(s).
6085 (define_expand "ashrdi3"
6087 [(set (match_operand:DI 0 "register_operand" "")
6088 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6089 (match_operand:SI 2 "shift_count_operand" "")))
6090 (clobber (reg:CC 33))])]
6094 (define_insn "*ashrdi3_cc_31"
6096 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6097 (match_operand:SI 2 "shift_count_operand" "Y"))
6099 (set (match_operand:DI 0 "register_operand" "=d")
6100 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6101 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6103 [(set_attr "op_type" "RS")
6104 (set_attr "atype" "reg")])
6106 (define_insn "*ashrdi3_cconly_31"
6108 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6109 (match_operand:SI 2 "shift_count_operand" "Y"))
6111 (clobber (match_scratch:DI 0 "=d"))]
6112 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6114 [(set_attr "op_type" "RS")
6115 (set_attr "atype" "reg")])
6117 (define_insn "*ashrdi3_31"
6118 [(set (match_operand:DI 0 "register_operand" "=d")
6119 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6120 (match_operand:SI 2 "shift_count_operand" "Y")))
6121 (clobber (reg:CC 33))]
6124 [(set_attr "op_type" "RS")
6125 (set_attr "atype" "reg")])
6127 (define_insn "*ashrdi3_cc_64"
6129 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6130 (match_operand:SI 2 "shift_count_operand" "Y"))
6132 (set (match_operand:DI 0 "register_operand" "=d")
6133 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6134 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6136 [(set_attr "op_type" "RSE")
6137 (set_attr "atype" "reg")])
6139 (define_insn "*ashrdi3_cconly_64"
6141 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6142 (match_operand:SI 2 "shift_count_operand" "Y"))
6144 (clobber (match_scratch:DI 0 "=d"))]
6145 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6147 [(set_attr "op_type" "RSE")
6148 (set_attr "atype" "reg")])
6150 (define_insn "*ashrdi3_64"
6151 [(set (match_operand:DI 0 "register_operand" "=d")
6152 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6153 (match_operand:SI 2 "shift_count_operand" "Y")))
6154 (clobber (reg:CC 33))]
6157 [(set_attr "op_type" "RSE")
6158 (set_attr "atype" "reg")])
6162 ; ashlsi3 instruction pattern(s).
6165 (define_insn "ashlsi3"
6166 [(set (match_operand:SI 0 "register_operand" "=d")
6167 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6168 (match_operand:SI 2 "shift_count_operand" "Y")))]
6171 [(set_attr "op_type" "RS")
6172 (set_attr "atype" "reg")])
6175 ; ashrsi3 instruction pattern(s).
6178 (define_insn "*ashrsi3_cc"
6180 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6181 (match_operand:SI 2 "shift_count_operand" "Y"))
6183 (set (match_operand:SI 0 "register_operand" "=d")
6184 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6185 "s390_match_ccmode(insn, CCSmode)"
6187 [(set_attr "op_type" "RS")
6188 (set_attr "atype" "reg")])
6191 (define_insn "*ashrsi3_cconly"
6193 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6194 (match_operand:SI 2 "shift_count_operand" "Y"))
6196 (clobber (match_scratch:SI 0 "=d"))]
6197 "s390_match_ccmode(insn, CCSmode)"
6199 [(set_attr "op_type" "RS")
6200 (set_attr "atype" "reg")])
6202 (define_insn "ashrsi3"
6203 [(set (match_operand:SI 0 "register_operand" "=d")
6204 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6205 (match_operand:SI 2 "shift_count_operand" "Y")))
6206 (clobber (reg:CC 33))]
6209 [(set_attr "op_type" "RS")
6210 (set_attr "atype" "reg")])
6214 ;;- logical shift instructions.
6218 ; lshrdi3 instruction pattern(s).
6221 (define_expand "lshrdi3"
6222 [(set (match_operand:DI 0 "register_operand" "")
6223 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6224 (match_operand:SI 2 "shift_count_operand" "")))]
6228 (define_insn "*lshrdi3_31"
6229 [(set (match_operand:DI 0 "register_operand" "=d")
6230 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6231 (match_operand:SI 2 "shift_count_operand" "Y")))]
6234 [(set_attr "op_type" "RS")
6235 (set_attr "atype" "reg")])
6237 (define_insn "*lshrdi3_64"
6238 [(set (match_operand:DI 0 "register_operand" "=d")
6239 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6240 (match_operand:SI 2 "shift_count_operand" "Y")))]
6243 [(set_attr "op_type" "RSE")
6244 (set_attr "atype" "reg")])
6247 ; lshrsi3 instruction pattern(s).
6250 (define_insn "lshrsi3"
6251 [(set (match_operand:SI 0 "register_operand" "=d")
6252 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6253 (match_operand:SI 2 "shift_count_operand" "Y")))]
6256 [(set_attr "op_type" "RS")
6257 (set_attr "atype" "reg")])
6261 ;; Branch instruction patterns.
6264 (define_expand "beq"
6265 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6267 (if_then_else (eq (reg:CCZ 33) (const_int 0))
6268 (label_ref (match_operand 0 "" ""))
6271 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6273 (define_expand "bne"
6274 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6276 (if_then_else (ne (reg:CCZ 33) (const_int 0))
6277 (label_ref (match_operand 0 "" ""))
6280 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6282 (define_expand "bgt"
6283 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6285 (if_then_else (gt (reg:CCS 33) (const_int 0))
6286 (label_ref (match_operand 0 "" ""))
6289 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6291 (define_expand "bgtu"
6292 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6294 (if_then_else (gtu (reg:CCU 33) (const_int 0))
6295 (label_ref (match_operand 0 "" ""))
6298 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6300 (define_expand "blt"
6301 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6303 (if_then_else (lt (reg:CCS 33) (const_int 0))
6304 (label_ref (match_operand 0 "" ""))
6307 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6309 (define_expand "bltu"
6310 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6312 (if_then_else (ltu (reg:CCU 33) (const_int 0))
6313 (label_ref (match_operand 0 "" ""))
6316 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6318 (define_expand "bge"
6319 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6321 (if_then_else (ge (reg:CCS 33) (const_int 0))
6322 (label_ref (match_operand 0 "" ""))
6325 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6327 (define_expand "bgeu"
6328 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6330 (if_then_else (geu (reg:CCU 33) (const_int 0))
6331 (label_ref (match_operand 0 "" ""))
6334 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6336 (define_expand "ble"
6337 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6339 (if_then_else (le (reg:CCS 33) (const_int 0))
6340 (label_ref (match_operand 0 "" ""))
6343 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6345 (define_expand "bleu"
6346 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6348 (if_then_else (leu (reg:CCU 33) (const_int 0))
6349 (label_ref (match_operand 0 "" ""))
6352 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6354 (define_expand "bunordered"
6355 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6357 (if_then_else (unordered (reg:CCS 33) (const_int 0))
6358 (label_ref (match_operand 0 "" ""))
6361 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6363 (define_expand "bordered"
6364 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6366 (if_then_else (ordered (reg:CCS 33) (const_int 0))
6367 (label_ref (match_operand 0 "" ""))
6370 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6372 (define_expand "buneq"
6373 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6375 (if_then_else (uneq (reg:CCS 33) (const_int 0))
6376 (label_ref (match_operand 0 "" ""))
6379 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6381 (define_expand "bungt"
6382 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6384 (if_then_else (ungt (reg:CCS 33) (const_int 0))
6385 (label_ref (match_operand 0 "" ""))
6388 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6390 (define_expand "bunlt"
6391 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6393 (if_then_else (unlt (reg:CCS 33) (const_int 0))
6394 (label_ref (match_operand 0 "" ""))
6397 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6399 (define_expand "bunge"
6400 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6402 (if_then_else (unge (reg:CCS 33) (const_int 0))
6403 (label_ref (match_operand 0 "" ""))
6406 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6408 (define_expand "bunle"
6409 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6411 (if_then_else (unle (reg:CCS 33) (const_int 0))
6412 (label_ref (match_operand 0 "" ""))
6415 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6417 (define_expand "bltgt"
6418 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6420 (if_then_else (ltgt (reg:CCS 33) (const_int 0))
6421 (label_ref (match_operand 0 "" ""))
6424 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6428 ;;- Conditional jump instructions.
6431 (define_insn "cjump"
6434 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6435 (label_ref (match_operand 0 "" ""))
6439 if (get_attr_length (insn) == 4)
6441 else if (TARGET_CPU_ZARCH)
6442 return "jg%C1\t%l0";
6446 [(set_attr "op_type" "RI")
6447 (set_attr "type" "branch")
6448 (set (attr "length")
6449 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6451 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6453 (eq (symbol_ref "flag_pic") (const_int 0))
6454 (const_int 6)] (const_int 8)))])
6456 (define_insn "*cjump_long"
6459 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6460 (match_operand 0 "address_operand" "U")
6464 if (get_attr_op_type (insn) == OP_TYPE_RR)
6469 [(set (attr "op_type")
6470 (if_then_else (match_operand 0 "register_operand" "")
6471 (const_string "RR") (const_string "RX")))
6472 (set_attr "type" "branch")
6473 (set_attr "atype" "agen")])
6477 ;;- Negated conditional jump instructions.
6480 (define_insn "icjump"
6483 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6485 (label_ref (match_operand 0 "" ""))))]
6488 if (get_attr_length (insn) == 4)
6490 else if (TARGET_CPU_ZARCH)
6491 return "jg%D1\t%l0";
6495 [(set_attr "op_type" "RI")
6496 (set_attr "type" "branch")
6497 (set (attr "length")
6498 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6500 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6502 (eq (symbol_ref "flag_pic") (const_int 0))
6503 (const_int 6)] (const_int 8)))])
6505 (define_insn "*icjump_long"
6508 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6510 (match_operand 0 "address_operand" "U")))]
6513 if (get_attr_op_type (insn) == OP_TYPE_RR)
6518 [(set (attr "op_type")
6519 (if_then_else (match_operand 0 "register_operand" "")
6520 (const_string "RR") (const_string "RX")))
6521 (set_attr "type" "branch")
6522 (set_attr "atype" "agen")])
6525 ;;- Trap instructions.
6529 [(trap_if (const_int 1) (const_int 0))]
6532 [(set_attr "op_type" "RX")
6533 (set_attr "type" "branch")])
6535 (define_expand "conditional_trap"
6536 [(set (match_dup 2) (match_dup 3))
6537 (trap_if (match_operator 0 "comparison_operator"
6538 [(match_dup 2) (const_int 0)])
6539 (match_operand:SI 1 "general_operand" ""))]
6542 enum machine_mode ccmode;
6544 if (operands[1] != const0_rtx) FAIL;
6546 ccmode = s390_select_ccmode (GET_CODE (operands[0]),
6547 s390_compare_op0, s390_compare_op1);
6548 operands[2] = gen_rtx_REG (ccmode, 33);
6549 operands[3] = gen_rtx_COMPARE (ccmode, s390_compare_op0, s390_compare_op1);
6552 (define_insn "*trap"
6553 [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6557 [(set_attr "op_type" "RI")
6558 (set_attr "type" "branch")])
6561 ;;- Loop instructions.
6563 ;; This is all complicated by the fact that since this is a jump insn
6564 ;; we must handle our own output reloads.
6566 (define_expand "doloop_end"
6567 [(use (match_operand 0 "" "")) ; loop pseudo
6568 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6569 (use (match_operand 2 "" "")) ; max iterations
6570 (use (match_operand 3 "" "")) ; loop level
6571 (use (match_operand 4 "" ""))] ; label
6574 if (GET_MODE (operands[0]) == SImode)
6575 emit_jump_insn (gen_doloop_si (operands[4], operands[0], operands[0]));
6576 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6577 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6584 (define_insn "doloop_si"
6587 (ne (match_operand:SI 1 "register_operand" "d,d")
6589 (label_ref (match_operand 0 "" ""))
6591 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6592 (plus:SI (match_dup 1) (const_int -1)))
6593 (clobber (match_scratch:SI 3 "=X,&d"))
6594 (clobber (reg:CC 33))]
6597 if (which_alternative != 0)
6599 else if (get_attr_length (insn) == 4)
6600 return "brct\t%1,%l0";
6601 else if (TARGET_CPU_ZARCH)
6602 return "ahi\t%1,-1\;jgne\t%l0";
6606 [(set_attr "op_type" "RI")
6607 (set_attr "type" "branch")
6608 (set (attr "length")
6609 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6611 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6613 (eq (symbol_ref "flag_pic") (const_int 0))
6614 (const_int 6)] (const_int 8)))])
6616 (define_insn "*doloop_si_long"
6619 (ne (match_operand:SI 1 "register_operand" "d,d")
6621 (match_operand 0 "address_operand" "U,U")
6623 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6624 (plus:SI (match_dup 1) (const_int -1)))
6625 (clobber (match_scratch:SI 3 "=X,&d"))
6626 (clobber (reg:CC 33))]
6629 if (get_attr_op_type (insn) == OP_TYPE_RR)
6630 return "bctr\t%1,%0";
6632 return "bct\t%1,%a0";
6634 [(set (attr "op_type")
6635 (if_then_else (match_operand 0 "register_operand" "")
6636 (const_string "RR") (const_string "RX")))
6637 (set_attr "type" "branch")
6638 (set_attr "atype" "agen")])
6642 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
6644 (match_operand 0 "" "")
6646 (set (match_operand:SI 2 "nonimmediate_operand" "")
6647 (plus:SI (match_dup 1) (const_int -1)))
6648 (clobber (match_scratch:SI 3 ""))
6649 (clobber (reg:CC 33))]
6651 && (! REG_P (operands[2])
6652 || ! rtx_equal_p (operands[1], operands[2]))"
6653 [(set (match_dup 3) (match_dup 1))
6654 (parallel [(set (reg:CCAN 33)
6655 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6657 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6658 (set (match_dup 2) (match_dup 3))
6659 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6664 (define_insn "doloop_di"
6667 (ne (match_operand:DI 1 "register_operand" "d,d")
6669 (label_ref (match_operand 0 "" ""))
6671 (set (match_operand:DI 2 "register_operand" "=1,?*m*r")
6672 (plus:DI (match_dup 1) (const_int -1)))
6673 (clobber (match_scratch:DI 3 "=X,&d"))
6674 (clobber (reg:CC 33))]
6677 if (which_alternative != 0)
6679 else if (get_attr_length (insn) == 4)
6680 return "brctg\t%1,%l0";
6682 return "aghi\t%1,-1\;jgne\t%l0";
6684 [(set_attr "op_type" "RI")
6685 (set_attr "type" "branch")
6686 (set (attr "length")
6687 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6688 (const_int 4) (const_int 10)))])
6692 (if_then_else (ne (match_operand:DI 1 "register_operand" "")
6694 (match_operand 0 "" "")
6696 (set (match_operand:DI 2 "nonimmediate_operand" "")
6697 (plus:DI (match_dup 1) (const_int -1)))
6698 (clobber (match_scratch:DI 3 ""))
6699 (clobber (reg:CC 33))]
6701 && (! REG_P (operands[2])
6702 || ! rtx_equal_p (operands[1], operands[2]))"
6703 [(set (match_dup 3) (match_dup 1))
6704 (parallel [(set (reg:CCAN 33)
6705 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6707 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6708 (set (match_dup 2) (match_dup 3))
6709 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6715 ;;- Unconditional jump instructions.
6719 ; jump instruction pattern(s).
6723 [(set (pc) (label_ref (match_operand 0 "" "")))]
6726 if (get_attr_length (insn) == 4)
6728 else if (TARGET_CPU_ZARCH)
6733 [(set_attr "op_type" "RI")
6734 (set_attr "type" "branch")
6735 (set (attr "length")
6736 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6738 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6740 (eq (symbol_ref "flag_pic") (const_int 0))
6741 (const_int 6)] (const_int 8)))])
6744 ; indirect-jump instruction pattern(s).
6747 (define_insn "indirect_jump"
6748 [(set (pc) (match_operand 0 "address_operand" "U"))]
6751 if (get_attr_op_type (insn) == OP_TYPE_RR)
6756 [(set (attr "op_type")
6757 (if_then_else (match_operand 0 "register_operand" "")
6758 (const_string "RR") (const_string "RX")))
6759 (set_attr "type" "branch")
6760 (set_attr "atype" "agen")])
6763 ; casesi instruction pattern(s).
6766 (define_insn "casesi_jump"
6767 [(set (pc) (match_operand 0 "address_operand" "U"))
6768 (use (label_ref (match_operand 1 "" "")))]
6771 if (get_attr_op_type (insn) == OP_TYPE_RR)
6776 [(set (attr "op_type")
6777 (if_then_else (match_operand 0 "register_operand" "")
6778 (const_string "RR") (const_string "RX")))
6779 (set_attr "type" "branch")
6780 (set_attr "atype" "agen")])
6782 (define_expand "casesi"
6783 [(match_operand:SI 0 "general_operand" "")
6784 (match_operand:SI 1 "general_operand" "")
6785 (match_operand:SI 2 "general_operand" "")
6786 (label_ref (match_operand 3 "" ""))
6787 (label_ref (match_operand 4 "" ""))]
6790 rtx index = gen_reg_rtx (SImode);
6791 rtx base = gen_reg_rtx (Pmode);
6792 rtx target = gen_reg_rtx (Pmode);
6794 emit_move_insn (index, operands[0]);
6795 emit_insn (gen_subsi3 (index, index, operands[1]));
6796 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6799 if (Pmode != SImode)
6800 index = convert_to_mode (Pmode, index, 1);
6801 if (GET_CODE (index) != REG)
6802 index = copy_to_mode_reg (Pmode, index);
6805 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6807 emit_insn (gen_ashlsi3 (index, index, GEN_INT (2)));
6809 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6811 index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
6812 emit_move_insn (target, index);
6815 target = gen_rtx_PLUS (Pmode, base, target);
6816 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6823 ;;- Jump to subroutine.
6828 ; untyped call instruction pattern(s).
6831 ;; Call subroutine returning any type.
6832 (define_expand "untyped_call"
6833 [(parallel [(call (match_operand 0 "" "")
6835 (match_operand 1 "" "")
6836 (match_operand 2 "" "")])]
6841 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6843 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6845 rtx set = XVECEXP (operands[2], 0, i);
6846 emit_move_insn (SET_DEST (set), SET_SRC (set));
6849 /* The optimizer does not know that the call sets the function value
6850 registers we stored in the result block. We avoid problems by
6851 claiming that all hard registers are used and clobbered at this
6853 emit_insn (gen_blockage ());
6858 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6859 ;; all of memory. This blocks insns from being moved across this point.
6861 (define_insn "blockage"
6862 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6865 [(set_attr "type" "none")
6866 (set_attr "length" "0")])
6871 ; call instruction pattern(s).
6874 (define_expand "call"
6875 [(call (match_operand 0 "" "")
6876 (match_operand 1 "" ""))
6877 (use (match_operand 2 "" ""))]
6880 bool plt_call = false;
6883 /* Direct function calls need special treatment. */
6884 if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
6886 rtx sym = XEXP (operands[0], 0);
6888 /* When calling a global routine in PIC mode, we must
6889 replace the symbol itself with the PLT stub. */
6890 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
6892 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
6893 sym = gen_rtx_CONST (Pmode, sym);
6897 /* Unless we can use the bras(l) insn, force the
6898 routine address into a register. */
6899 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
6902 sym = legitimize_pic_address (sym, 0);
6904 sym = force_reg (Pmode, sym);
6907 operands[0] = gen_rtx_MEM (QImode, sym);
6911 insn = emit_call_insn (gen_call_exp (operands[0], operands[1],
6912 gen_rtx_REG (Pmode, RETURN_REGNUM)));
6914 /* 31-bit PLT stubs use the GOT register implicitly. */
6915 if (!TARGET_64BIT && plt_call)
6916 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
6921 (define_expand "call_exp"
6922 [(parallel [(call (match_operand 0 "" "")
6923 (match_operand 1 "" ""))
6924 (clobber (match_operand 2 "" ""))])]
6928 (define_insn "*bras"
6929 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6930 (match_operand 1 "const_int_operand" "n"))
6931 (clobber (match_operand 2 "register_operand" "=r"))]
6932 "TARGET_SMALL_EXEC && GET_MODE (operands[2]) == Pmode"
6934 [(set_attr "op_type" "RI")
6935 (set_attr "type" "jsr")])
6937 (define_insn "*brasl"
6938 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6939 (match_operand 1 "const_int_operand" "n"))
6940 (clobber (match_operand 2 "register_operand" "=r"))]
6941 "TARGET_CPU_ZARCH && GET_MODE (operands[2]) == Pmode"
6943 [(set_attr "op_type" "RIL")
6944 (set_attr "type" "jsr")])
6946 (define_insn "*basr"
6947 [(call (mem:QI (match_operand 0 "address_operand" "U"))
6948 (match_operand 1 "const_int_operand" "n"))
6949 (clobber (match_operand 2 "register_operand" "=r"))]
6950 "GET_MODE (operands[2]) == Pmode"
6952 if (get_attr_op_type (insn) == OP_TYPE_RR)
6953 return "basr\t%2,%0";
6955 return "bas\t%2,%a0";
6957 [(set (attr "op_type")
6958 (if_then_else (match_operand 0 "register_operand" "")
6959 (const_string "RR") (const_string "RX")))
6960 (set_attr "type" "jsr")
6961 (set_attr "atype" "agen")])
6964 ; call_value instruction pattern(s).
6967 (define_expand "call_value"
6968 [(set (match_operand 0 "" "")
6969 (call (match_operand 1 "" "")
6970 (match_operand 2 "" "")))
6971 (use (match_operand 3 "" ""))]
6974 bool plt_call = false;
6977 /* Direct function calls need special treatment. */
6978 if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
6980 rtx sym = XEXP (operands[1], 0);
6982 /* When calling a global routine in PIC mode, we must
6983 replace the symbol itself with the PLT stub. */
6984 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
6986 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
6987 sym = gen_rtx_CONST (Pmode, sym);
6991 /* Unless we can use the bras(l) insn, force the
6992 routine address into a register. */
6993 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
6996 sym = legitimize_pic_address (sym, 0);
6998 sym = force_reg (Pmode, sym);
7001 operands[1] = gen_rtx_MEM (QImode, sym);
7005 insn = emit_call_insn (
7006 gen_call_value_exp (operands[0], operands[1], operands[2],
7007 gen_rtx_REG (Pmode, RETURN_REGNUM)));
7009 /* 31-bit PLT stubs use the GOT register implicitly. */
7010 if (!TARGET_64BIT && plt_call)
7011 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7016 (define_expand "call_value_exp"
7017 [(parallel [(set (match_operand 0 "" "")
7018 (call (match_operand 1 "" "")
7019 (match_operand 2 "" "")))
7020 (clobber (match_operand 3 "" ""))])]
7024 (define_insn "*bras_r"
7025 [(set (match_operand 0 "" "")
7026 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7027 (match_operand:SI 2 "const_int_operand" "n")))
7028 (clobber (match_operand 3 "register_operand" "=r"))]
7029 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7031 [(set_attr "op_type" "RI")
7032 (set_attr "type" "jsr")])
7034 (define_insn "*brasl_r"
7035 [(set (match_operand 0 "" "")
7036 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7037 (match_operand 2 "const_int_operand" "n")))
7038 (clobber (match_operand 3 "register_operand" "=r"))]
7039 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7041 [(set_attr "op_type" "RIL")
7042 (set_attr "type" "jsr")])
7044 (define_insn "*basr_r"
7045 [(set (match_operand 0 "" "")
7046 (call (mem:QI (match_operand 1 "address_operand" "U"))
7047 (match_operand 2 "const_int_operand" "n")))
7048 (clobber (match_operand 3 "register_operand" "=r"))]
7049 "GET_MODE (operands[3]) == Pmode"
7051 if (get_attr_op_type (insn) == OP_TYPE_RR)
7052 return "basr\t%3,%1";
7054 return "bas\t%3,%a1";
7056 [(set (attr "op_type")
7057 (if_then_else (match_operand 1 "register_operand" "")
7058 (const_string "RR") (const_string "RX")))
7059 (set_attr "type" "jsr")
7060 (set_attr "atype" "agen")])
7063 ;;- Thread-local storage support.
7066 (define_insn "get_tp_64"
7067 [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7068 (unspec:DI [(const_int 0)] UNSPEC_TP))]
7071 ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7073 [(set_attr "op_type" "NN,RS")
7074 (set_attr "atype" "reg,*")
7075 (set_attr "type" "o3,*")
7076 (set_attr "length" "14,*")])
7078 (define_insn "get_tp_31"
7079 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7080 (unspec:SI [(const_int 0)] UNSPEC_TP))]
7085 [(set_attr "op_type" "RRE,RS")])
7087 (define_insn "set_tp_64"
7088 [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7089 (clobber (match_scratch:SI 1 "=d,X"))]
7092 sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7094 [(set_attr "op_type" "NN,RS")
7095 (set_attr "atype" "reg,*")
7096 (set_attr "type" "o3,*")
7097 (set_attr "length" "14,*")])
7099 (define_insn "set_tp_31"
7100 [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7105 [(set_attr "op_type" "RRE,RS")])
7107 (define_insn "*tls_load_64"
7108 [(set (match_operand:DI 0 "register_operand" "=d")
7109 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7110 (match_operand:DI 2 "" "")]
7114 [(set_attr "op_type" "RXE")])
7116 (define_insn "*tls_load_31"
7117 [(set (match_operand:SI 0 "register_operand" "=d,d")
7118 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7119 (match_operand:SI 2 "" "")]
7125 [(set_attr "op_type" "RX,RXY")])
7127 (define_expand "call_value_tls"
7128 [(set (match_operand 0 "" "")
7129 (call (const_int 0) (const_int 0)))
7130 (use (match_operand 1 "" ""))]
7138 sym = s390_tls_get_offset ();
7139 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7140 sym = gen_rtx_CONST (Pmode, sym);
7142 /* Unless we can use the bras(l) insn, force the
7143 routine address into a register. */
7144 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7147 sym = legitimize_pic_address (sym, 0);
7149 sym = force_reg (Pmode, sym);
7152 sym = gen_rtx_MEM (QImode, sym);
7155 insn = emit_call_insn (
7156 gen_call_value_tls_exp (operands[0], sym, const0_rtx,
7157 gen_rtx_REG (Pmode, RETURN_REGNUM),
7160 /* The calling convention of __tls_get_offset uses the
7161 GOT register implicitly. */
7162 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7163 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), operands[0]);
7164 CONST_OR_PURE_CALL_P (insn) = 1;
7169 (define_expand "call_value_tls_exp"
7170 [(parallel [(set (match_operand 0 "" "")
7171 (call (match_operand 1 "" "")
7172 (match_operand 2 "" "")))
7173 (clobber (match_operand 3 "" ""))
7174 (use (match_operand 4 "" ""))])]
7178 (define_insn "*bras_tls"
7179 [(set (match_operand 0 "" "")
7180 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7181 (match_operand 2 "const_int_operand" "n")))
7182 (clobber (match_operand 3 "register_operand" "=r"))
7183 (use (match_operand 4 "" ""))]
7184 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7186 [(set_attr "op_type" "RI")
7187 (set_attr "type" "jsr")])
7189 (define_insn "*brasl_tls"
7190 [(set (match_operand 0 "" "")
7191 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7192 (match_operand 2 "const_int_operand" "n")))
7193 (clobber (match_operand 3 "register_operand" "=r"))
7194 (use (match_operand 4 "" ""))]
7195 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7197 [(set_attr "op_type" "RIL")
7198 (set_attr "type" "jsr")])
7200 (define_insn "*basr_tls"
7201 [(set (match_operand 0 "" "")
7202 (call (mem:QI (match_operand 1 "address_operand" "U"))
7203 (match_operand 2 "const_int_operand" "n")))
7204 (clobber (match_operand 3 "register_operand" "=r"))
7205 (use (match_operand 4 "" ""))]
7206 "GET_MODE (operands[3]) == Pmode"
7208 if (get_attr_op_type (insn) == OP_TYPE_RR)
7209 return "basr\t%3,%1%J4";
7211 return "bas\t%3,%a1%J4";
7213 [(set (attr "op_type")
7214 (if_then_else (match_operand 1 "register_operand" "")
7215 (const_string "RR") (const_string "RX")))
7216 (set_attr "type" "jsr")
7217 (set_attr "atype" "agen")])
7220 ;;- Miscellaneous instructions.
7224 ; allocate stack instruction pattern(s).
7227 (define_expand "allocate_stack"
7229 (plus (reg 15) (match_operand 1 "general_operand" "")))
7230 (set (match_operand 0 "general_operand" "")
7234 rtx stack = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
7235 rtx chain = gen_rtx (MEM, Pmode, stack);
7236 rtx temp = gen_reg_rtx (Pmode);
7238 emit_move_insn (temp, chain);
7241 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7243 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7245 emit_move_insn (chain, temp);
7247 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7253 ; setjmp instruction pattern.
7256 (define_expand "builtin_setjmp_receiver"
7257 [(match_operand 0 "" "")]
7260 s390_load_got (false);
7261 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7265 ;; These patterns say how to save and restore the stack pointer. We need not
7266 ;; save the stack pointer at function level since we are careful to
7267 ;; preserve the backchain. At block level, we have to restore the backchain
7268 ;; when we restore the stack pointer.
7270 ;; For nonlocal gotos, we must save both the stack pointer and its
7271 ;; backchain and restore both. Note that in the nonlocal case, the
7272 ;; save area is a memory location.
7274 (define_expand "save_stack_function"
7275 [(match_operand 0 "general_operand" "")
7276 (match_operand 1 "general_operand" "")]
7280 (define_expand "restore_stack_function"
7281 [(match_operand 0 "general_operand" "")
7282 (match_operand 1 "general_operand" "")]
7286 (define_expand "restore_stack_block"
7287 [(use (match_operand 0 "register_operand" ""))
7288 (set (match_dup 2) (match_dup 3))
7289 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7290 (set (match_dup 3) (match_dup 2))]
7293 operands[2] = gen_reg_rtx (Pmode);
7294 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7297 (define_expand "save_stack_nonlocal"
7298 [(match_operand 0 "memory_operand" "")
7299 (match_operand 1 "register_operand" "")]
7302 rtx temp = gen_reg_rtx (Pmode);
7304 /* Copy the backchain to the first word, sp to the second and the literal pool
7305 base to the third. */
7306 emit_move_insn (operand_subword (operands[0], 2, 0,
7307 TARGET_64BIT ? OImode : TImode),
7308 gen_rtx_REG (Pmode, BASE_REGISTER));
7309 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7310 emit_move_insn (operand_subword (operands[0], 0, 0,
7311 TARGET_64BIT ? OImode : TImode),
7313 emit_move_insn (operand_subword (operands[0], 1, 0,
7314 TARGET_64BIT ? OImode : TImode),
7319 (define_expand "restore_stack_nonlocal"
7320 [(match_operand 0 "register_operand" "")
7321 (match_operand 1 "memory_operand" "")]
7324 rtx temp = gen_reg_rtx (Pmode);
7325 rtx base = gen_rtx_REG (Pmode, BASE_REGISTER);
7327 /* Restore the backchain from the first word, sp from the second and the
7328 literal pool base from the third. */
7329 emit_move_insn (temp,
7330 operand_subword (operands[1], 0, 0,
7331 TARGET_64BIT ? OImode : TImode));
7332 emit_move_insn (operands[0],
7333 operand_subword (operands[1], 1, 0,
7334 TARGET_64BIT ? OImode : TImode));
7335 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7336 emit_move_insn (base,
7337 operand_subword (operands[1], 2, 0,
7338 TARGET_64BIT ? OImode : TImode));
7339 emit_insn (gen_rtx_USE (VOIDmode, base));
7346 ; nop instruction pattern(s).
7353 [(set_attr "op_type" "RR")])
7357 ; Special literal pool access instruction pattern(s).
7360 (define_insn "*pool_entry"
7361 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7362 UNSPECV_POOL_ENTRY)]
7365 enum machine_mode mode = GET_MODE (PATTERN (insn));
7366 unsigned int align = GET_MODE_BITSIZE (mode);
7367 s390_output_pool_entry (asm_out_file, operands[0], mode, align);
7370 [(set_attr "op_type" "NN")
7371 (set (attr "length")
7372 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7374 (define_insn "pool_start_31"
7375 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7378 [(set_attr "op_type" "NN")
7379 (set_attr "length" "2")])
7381 (define_insn "pool_end_31"
7382 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7385 [(set_attr "op_type" "NN")
7386 (set_attr "length" "2")])
7388 (define_insn "pool_start_64"
7389 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7391 ".section\t.rodata\;.align\t8"
7392 [(set_attr "op_type" "NN")
7393 (set_attr "length" "0")])
7395 (define_insn "pool_end_64"
7396 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7399 [(set_attr "op_type" "NN")
7400 (set_attr "length" "0")])
7402 (define_insn "main_base_31_small"
7403 [(set (match_operand 0 "register_operand" "=a")
7404 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7405 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7407 [(set_attr "op_type" "RR")
7408 (set_attr "type" "la")])
7410 (define_insn "main_base_31_large"
7411 [(set (match_operand 0 "register_operand" "=a")
7412 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7413 (set (pc) (label_ref (match_operand 2 "" "")))]
7414 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7416 [(set_attr "op_type" "RI")])
7418 (define_insn "main_base_64"
7419 [(set (match_operand 0 "register_operand" "=a")
7420 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7421 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7423 [(set_attr "op_type" "RIL")
7424 (set_attr "type" "larl")])
7426 (define_insn "main_pool"
7427 [(unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL)]
7430 [(set_attr "op_type" "NN")])
7432 (define_insn "reload_base_31"
7433 [(set (match_operand 0 "register_operand" "=a")
7434 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7435 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7436 "basr\t%0,0\;la\t%0,%1-.(%0)"
7437 [(set_attr "op_type" "NN")
7438 (set_attr "type" "la")
7439 (set_attr "length" "6")])
7441 (define_insn "reload_base_64"
7442 [(set (match_operand 0 "register_operand" "=a")
7443 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7444 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7446 [(set_attr "op_type" "RIL")
7447 (set_attr "type" "larl")])
7450 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7453 [(set_attr "op_type" "NN")
7454 (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7457 ;; Insns related to generating the function prologue and epilogue.
7461 (define_expand "prologue"
7462 [(use (const_int 0))]
7464 "s390_emit_prologue (); DONE;")
7466 (define_expand "epilogue"
7467 [(use (const_int 1))]
7469 "s390_emit_epilogue (); DONE;")
7471 (define_insn "*return"
7473 (use (match_operand 0 "register_operand" "a"))]
7474 "GET_MODE (operands[0]) == Pmode"
7476 [(set_attr "op_type" "RR")
7477 (set_attr "type" "jsr")
7478 (set_attr "atype" "agen")])
7481 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7482 ;; pointer. This is used for compatability.
7484 (define_expand "ptr_extend"
7485 [(set (match_operand:DI 0 "register_operand" "=r")
7486 (match_operand:SI 1 "register_operand" "r"))]
7489 emit_insn (gen_anddi3 (operands[0],
7490 gen_lowpart (DImode, operands[1]),
7491 GEN_INT (0x7fffffff)));