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 && memory_operand (operands[1], VOIDmode))
1318 rtx tmp = gen_reg_rtx (SImode);
1319 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1320 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1321 operands[1] = gen_lowpart (HImode, tmp);
1325 (define_insn "*movhi"
1326 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1327 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1337 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1338 (set_attr "type" "lr,*,*,*,store,store,cs")])
1341 [(set (match_operand:HI 0 "register_operand" "")
1342 (mem:HI (match_operand 1 "address_operand" "")))]
1343 "GET_CODE (operands[1]) == SYMBOL_REF
1344 && CONSTANT_POOL_ADDRESS_P (operands[1])
1345 && get_pool_mode (operands[1]) == HImode
1346 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1347 [(set (match_dup 0) (match_dup 2))]
1348 "operands[2] = get_pool_constant (operands[1]);")
1351 ; movqi instruction pattern(s).
1354 (define_expand "movqi"
1355 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1356 (match_operand:QI 1 "general_operand" ""))]
1359 /* On z/Architecture, zero-extending from memory to register
1360 is just as fast as a QImode load. */
1361 if (TARGET_ZARCH && optimize && !no_new_pseudos
1362 && register_operand (operands[0], VOIDmode)
1363 && memory_operand (operands[1], VOIDmode))
1365 rtx tmp = gen_reg_rtx (word_mode);
1366 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1367 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1368 operands[1] = gen_lowpart (QImode, tmp);
1372 (define_insn "*movqi"
1373 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1374 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1386 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1387 (set_attr "type" "lr,*,*,*,store,store,store,store,cs")])
1390 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1391 (mem:QI (match_operand 1 "address_operand" "")))]
1392 "GET_CODE (operands[1]) == SYMBOL_REF
1393 && CONSTANT_POOL_ADDRESS_P (operands[1])
1394 && get_pool_mode (operands[1]) == QImode
1395 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1396 [(set (match_dup 0) (match_dup 2))]
1397 "operands[2] = get_pool_constant (operands[1]);")
1400 ; movstrictqi instruction pattern(s).
1403 (define_insn "*movstrictqi"
1404 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1405 (match_operand:QI 1 "memory_operand" "R,T"))]
1410 [(set_attr "op_type" "RX,RXY")])
1413 ; movstricthi instruction pattern(s).
1416 (define_insn "*movstricthi"
1417 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1418 (match_operand:HI 1 "s_imm_operand" "Q,S"))
1419 (clobber (reg:CC 33))]
1424 [(set_attr "op_type" "RS,RSY")])
1427 ; movstrictsi instruction pattern(s).
1430 (define_insn "movstrictsi"
1431 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d"))
1432 (match_operand:SI 1 "general_operand" "d,R,T"))]
1438 [(set_attr "op_type" "RR,RX,RXY")
1439 (set_attr "type" "lr,load,load")])
1442 ; movdf instruction pattern(s).
1445 (define_expand "movdf"
1446 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1447 (match_operand:DF 1 "general_operand" ""))]
1450 /* During and after reload, we need to force constants
1451 to the literal pool ourselves, if necessary. */
1452 if ((reload_in_progress || reload_completed)
1453 && CONSTANT_P (operands[1]))
1454 operands[1] = force_const_mem (DFmode, operands[1]);
1457 (define_insn "*movdf_64"
1458 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1459 (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1471 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1472 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,cs")])
1474 (define_insn "*movdf_31"
1475 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1476 (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1489 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,NN,NN,SS")
1490 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,cs")])
1493 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1494 (match_operand:DF 1 "general_operand" ""))]
1495 "!TARGET_64BIT && reload_completed
1496 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1497 [(set (match_dup 2) (match_dup 4))
1498 (set (match_dup 3) (match_dup 5))]
1500 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1501 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1502 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1503 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1507 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1508 (match_operand:DF 1 "general_operand" ""))]
1509 "!TARGET_64BIT && reload_completed
1510 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1511 [(set (match_dup 2) (match_dup 4))
1512 (set (match_dup 3) (match_dup 5))]
1514 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1515 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1516 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1517 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1521 [(set (match_operand:DF 0 "register_operand" "")
1522 (match_operand:DF 1 "memory_operand" ""))]
1523 "!TARGET_64BIT && reload_completed
1524 && !FP_REG_P (operands[0])
1525 && !s_operand (operands[1], VOIDmode)"
1526 [(set (match_dup 0) (match_dup 1))]
1528 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1529 s390_load_address (addr, XEXP (operands[1], 0));
1530 operands[1] = replace_equiv_address (operands[1], addr);
1533 (define_expand "reload_outdf"
1534 [(parallel [(match_operand:DF 0 "memory_operand" "")
1535 (match_operand:DF 1 "register_operand" "d")
1536 (match_operand:SI 2 "register_operand" "=&a")])]
1539 s390_load_address (operands[2], XEXP (operands[0], 0));
1540 operands[0] = replace_equiv_address (operands[0], operands[2]);
1541 emit_move_insn (operands[0], operands[1]);
1546 ; movsf instruction pattern(s).
1549 (define_expand "movsf"
1550 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1551 (match_operand:SF 1 "general_operand" ""))]
1554 /* During and after reload, we need to force constants
1555 to the literal pool ourselves, if necessary. */
1556 if ((reload_in_progress || reload_completed)
1557 && CONSTANT_P (operands[1]))
1558 operands[1] = force_const_mem (SFmode, operands[1]);
1561 (define_insn "*movsf"
1562 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1563 (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1577 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1578 (set_attr "type" "floads,floads,floads,fstores,fstores,lr,load,load,store,store,cs")])
1581 ; load_multiple pattern(s).
1584 (define_expand "load_multiple"
1585 [(match_par_dup 3 [(set (match_operand 0 "" "")
1586 (match_operand 1 "" ""))
1587 (use (match_operand 2 "" ""))])]
1590 enum machine_mode mode;
1596 /* Support only loading a constant number of fixed-point registers from
1597 memory and only bother with this if more than two */
1598 if (GET_CODE (operands[2]) != CONST_INT
1599 || INTVAL (operands[2]) < 2
1600 || INTVAL (operands[2]) > 16
1601 || GET_CODE (operands[1]) != MEM
1602 || GET_CODE (operands[0]) != REG
1603 || REGNO (operands[0]) >= 16)
1606 count = INTVAL (operands[2]);
1607 regno = REGNO (operands[0]);
1608 mode = GET_MODE (operands[0]);
1609 if (mode != SImode && mode != word_mode)
1612 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1615 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1617 from = XEXP (operands[1], 0);
1620 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1621 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1622 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1624 from = XEXP (XEXP (operands[1], 0), 0);
1625 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1630 if (from == frame_pointer_rtx || from == arg_pointer_rtx)
1635 from = force_reg (Pmode, XEXP (operands[1], 0));
1639 for (i = 0; i < count; i++)
1640 XVECEXP (operands[3], 0, i)
1641 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1642 change_address (operands[1], mode,
1643 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1646 (define_insn "*load_multiple_di"
1647 [(match_parallel 0 "load_multiple_operation"
1648 [(set (match_operand:DI 1 "register_operand" "=r")
1649 (match_operand:DI 2 "s_operand" "QS"))])]
1650 "word_mode == DImode"
1652 int words = XVECLEN (operands[0], 0);
1653 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1654 return "lmg\t%1,%0,%2";
1656 [(set_attr "op_type" "RSY")
1657 (set_attr "type" "lm")])
1659 (define_insn "*load_multiple_si"
1660 [(match_parallel 0 "load_multiple_operation"
1661 [(set (match_operand:SI 1 "register_operand" "=r,r")
1662 (match_operand:SI 2 "s_operand" "Q,S"))])]
1665 int words = XVECLEN (operands[0], 0);
1666 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1667 return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1669 [(set_attr "op_type" "RS,RSY")
1670 (set_attr "type" "lm")])
1673 ; store multiple pattern(s).
1676 (define_expand "store_multiple"
1677 [(match_par_dup 3 [(set (match_operand 0 "" "")
1678 (match_operand 1 "" ""))
1679 (use (match_operand 2 "" ""))])]
1682 enum machine_mode mode;
1688 /* Support only storing a constant number of fixed-point registers to
1689 memory and only bother with this if more than two. */
1690 if (GET_CODE (operands[2]) != CONST_INT
1691 || INTVAL (operands[2]) < 2
1692 || INTVAL (operands[2]) > 16
1693 || GET_CODE (operands[0]) != MEM
1694 || GET_CODE (operands[1]) != REG
1695 || REGNO (operands[1]) >= 16)
1698 count = INTVAL (operands[2]);
1699 regno = REGNO (operands[1]);
1700 mode = GET_MODE (operands[1]);
1701 if (mode != SImode && mode != word_mode)
1704 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1708 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1710 to = XEXP (operands[0], 0);
1713 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1714 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1715 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1717 to = XEXP (XEXP (operands[0], 0), 0);
1718 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1723 if (to == frame_pointer_rtx || to == arg_pointer_rtx)
1728 to = force_reg (Pmode, XEXP (operands[0], 0));
1732 for (i = 0; i < count; i++)
1733 XVECEXP (operands[3], 0, i)
1734 = gen_rtx_SET (VOIDmode,
1735 change_address (operands[0], mode,
1736 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1737 gen_rtx_REG (mode, regno + i));
1740 (define_insn "*store_multiple_di"
1741 [(match_parallel 0 "store_multiple_operation"
1742 [(set (match_operand:DI 1 "s_operand" "=QS")
1743 (match_operand:DI 2 "register_operand" "r"))])]
1744 "word_mode == DImode"
1746 int words = XVECLEN (operands[0], 0);
1747 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1748 return "stmg\t%2,%0,%1";
1750 [(set_attr "op_type" "RSY")
1751 (set_attr "type" "stm")])
1754 (define_insn "*store_multiple_si"
1755 [(match_parallel 0 "store_multiple_operation"
1756 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1757 (match_operand:SI 2 "register_operand" "r,r"))])]
1760 int words = XVECLEN (operands[0], 0);
1761 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1762 return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1764 [(set_attr "op_type" "RS,RSY")
1765 (set_attr "type" "stm")])
1768 ;; String instructions.
1772 ; movstrM instruction pattern(s).
1775 (define_expand "movstrdi"
1776 [(set (match_operand:BLK 0 "memory_operand" "")
1777 (match_operand:BLK 1 "memory_operand" ""))
1778 (use (match_operand:DI 2 "general_operand" ""))
1779 (match_operand 3 "" "")]
1781 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1783 (define_expand "movstrsi"
1784 [(set (match_operand:BLK 0 "memory_operand" "")
1785 (match_operand:BLK 1 "memory_operand" ""))
1786 (use (match_operand:SI 2 "general_operand" ""))
1787 (match_operand 3 "" "")]
1789 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1791 ; Move a block that is up to 256 bytes in length.
1792 ; The block length is taken as (operands[2] % 256) + 1.
1794 (define_expand "movstr_short"
1796 [(set (match_operand:BLK 0 "memory_operand" "")
1797 (match_operand:BLK 1 "memory_operand" ""))
1798 (use (match_operand 2 "nonmemory_operand" ""))
1799 (clobber (match_dup 3))])]
1801 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1803 (define_insn "*movstr_short"
1804 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1805 (match_operand:BLK 1 "memory_operand" "Q,Q"))
1806 (use (match_operand 2 "nonmemory_operand" "n,a"))
1807 (clobber (match_scratch 3 "=X,&a"))]
1808 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
1809 && GET_MODE (operands[3]) == Pmode"
1811 switch (which_alternative)
1814 return "mvc\t%O0(%b2+1,%R0),%1";
1817 output_asm_insn ("bras\t%3,.+10", operands);
1818 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
1819 return "ex\t%2,0(%3)";
1825 [(set_attr "op_type" "SS,NN")
1826 (set_attr "type" "cs,cs")
1827 (set_attr "atype" "*,agen")
1828 (set_attr "length" "*,14")])
1830 ; Move a block of arbitrary length.
1832 (define_expand "movstr_long"
1834 [(clobber (match_dup 2))
1835 (clobber (match_dup 3))
1836 (set (match_operand:BLK 0 "memory_operand" "")
1837 (match_operand:BLK 1 "memory_operand" ""))
1838 (use (match_operand 2 "general_operand" ""))
1840 (clobber (reg:CC 33))])]
1843 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1844 rtx reg0 = gen_reg_rtx (dword_mode);
1845 rtx reg1 = gen_reg_rtx (dword_mode);
1846 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1847 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
1848 rtx len0 = gen_lowpart (Pmode, reg0);
1849 rtx len1 = gen_lowpart (Pmode, reg1);
1851 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1852 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1853 emit_move_insn (len0, operands[2]);
1855 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
1856 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1857 emit_move_insn (len1, operands[2]);
1859 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1860 operands[1] = replace_equiv_address_nv (operands[1], addr1);
1865 (define_insn "*movstr_long_64"
1866 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1867 (clobber (match_operand:TI 1 "register_operand" "=d"))
1868 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1869 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
1872 (clobber (reg:CC 33))]
1874 "mvcle\t%0,%1,0\;jo\t.-4"
1875 [(set_attr "op_type" "NN")
1876 (set_attr "type" "vs")
1877 (set_attr "length" "8")])
1879 (define_insn "*movstr_long_31"
1880 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1881 (clobber (match_operand:DI 1 "register_operand" "=d"))
1882 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1883 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
1886 (clobber (reg:CC 33))]
1888 "mvcle\t%0,%1,0\;jo\t.-4"
1889 [(set_attr "op_type" "NN")
1890 (set_attr "type" "vs")
1891 (set_attr "length" "8")])
1894 ; clrstrM instruction pattern(s).
1897 (define_expand "clrstrdi"
1898 [(set (match_operand:BLK 0 "memory_operand" "")
1900 (use (match_operand:DI 1 "general_operand" ""))
1901 (match_operand 2 "" "")]
1903 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
1905 (define_expand "clrstrsi"
1906 [(set (match_operand:BLK 0 "memory_operand" "")
1908 (use (match_operand:SI 1 "general_operand" ""))
1909 (match_operand 2 "" "")]
1911 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
1913 ; Clear a block that is up to 256 bytes in length.
1914 ; The block length is taken as (operands[1] % 256) + 1.
1916 (define_expand "clrstr_short"
1918 [(set (match_operand:BLK 0 "memory_operand" "")
1920 (use (match_operand 1 "nonmemory_operand" ""))
1921 (clobber (match_dup 2))
1922 (clobber (reg:CC 33))])]
1924 "operands[2] = gen_rtx_SCRATCH (Pmode);")
1926 (define_insn "*clrstr_short"
1927 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1929 (use (match_operand 1 "nonmemory_operand" "n,a"))
1930 (clobber (match_scratch 2 "=X,&a"))
1931 (clobber (reg:CC 33))]
1932 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
1933 && GET_MODE (operands[2]) == Pmode"
1935 switch (which_alternative)
1938 return "xc\t%O0(%b1+1,%R0),%0";
1941 output_asm_insn ("bras\t%2,.+10", operands);
1942 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
1943 return "ex\t%1,0(%2)";
1949 [(set_attr "op_type" "SS,NN")
1950 (set_attr "type" "cs,cs")
1951 (set_attr "atype" "*,agen")
1952 (set_attr "length" "*,14")])
1954 ; Clear a block of arbitrary length.
1956 (define_expand "clrstr_long"
1958 [(clobber (match_dup 1))
1959 (set (match_operand:BLK 0 "memory_operand" "")
1961 (use (match_operand 1 "general_operand" ""))
1963 (clobber (reg:CC 33))])]
1966 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1967 rtx reg0 = gen_reg_rtx (dword_mode);
1968 rtx reg1 = gen_reg_rtx (dword_mode);
1969 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1970 rtx len0 = gen_lowpart (Pmode, reg0);
1972 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1973 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1974 emit_move_insn (len0, operands[1]);
1976 emit_move_insn (reg1, const0_rtx);
1978 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1983 (define_insn "*clrstr_long_64"
1984 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1985 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1988 (use (match_operand:TI 1 "register_operand" "d"))
1989 (clobber (reg:CC 33))]
1991 "mvcle\t%0,%1,0\;jo\t.-4"
1992 [(set_attr "op_type" "NN")
1993 (set_attr "type" "vs")
1994 (set_attr "length" "8")])
1996 (define_insn "*clrstr_long_31"
1997 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1998 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2001 (use (match_operand:DI 1 "register_operand" "d"))
2002 (clobber (reg:CC 33))]
2004 "mvcle\t%0,%1,0\;jo\t.-4"
2005 [(set_attr "op_type" "NN")
2006 (set_attr "type" "vs")
2007 (set_attr "length" "8")])
2010 ; cmpmemM instruction pattern(s).
2013 (define_expand "cmpmemdi"
2014 [(set (match_operand:DI 0 "register_operand" "")
2015 (compare:DI (match_operand:BLK 1 "memory_operand" "")
2016 (match_operand:BLK 2 "memory_operand" "") ) )
2017 (use (match_operand:DI 3 "general_operand" ""))
2018 (use (match_operand:DI 4 "" ""))]
2020 "s390_expand_cmpmem (operands[0], operands[1],
2021 operands[2], operands[3]); DONE;")
2023 (define_expand "cmpmemsi"
2024 [(set (match_operand:SI 0 "register_operand" "")
2025 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2026 (match_operand:BLK 2 "memory_operand" "") ) )
2027 (use (match_operand:SI 3 "general_operand" ""))
2028 (use (match_operand:SI 4 "" ""))]
2030 "s390_expand_cmpmem (operands[0], operands[1],
2031 operands[2], operands[3]); DONE;")
2033 ; Compare a block that is up to 256 bytes in length.
2034 ; The block length is taken as (operands[2] % 256) + 1.
2036 (define_expand "cmpmem_short"
2039 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2040 (match_operand:BLK 1 "memory_operand" "")))
2041 (use (match_operand 2 "nonmemory_operand" ""))
2042 (clobber (match_dup 3))])]
2044 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2046 (define_insn "*cmpmem_short"
2048 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2049 (match_operand:BLK 1 "memory_operand" "Q,Q")))
2050 (use (match_operand 2 "nonmemory_operand" "n,a"))
2051 (clobber (match_scratch 3 "=X,&a"))]
2052 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2053 && GET_MODE (operands[3]) == Pmode"
2055 switch (which_alternative)
2058 return "clc\t%O0(%b2+1,%R0),%1";
2061 output_asm_insn ("bras\t%3,.+10", operands);
2062 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2063 return "ex\t%2,0(%3)";
2069 [(set_attr "op_type" "SS,NN")
2070 (set_attr "type" "cs,cs")
2071 (set_attr "atype" "*,agen")
2072 (set_attr "length" "*,14")])
2074 ; Compare a block of arbitrary length.
2076 (define_expand "cmpmem_long"
2078 [(clobber (match_dup 2))
2079 (clobber (match_dup 3))
2081 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2082 (match_operand:BLK 1 "memory_operand" "")))
2083 (use (match_operand 2 "general_operand" ""))
2084 (use (match_dup 3))])]
2087 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2088 rtx reg0 = gen_reg_rtx (dword_mode);
2089 rtx reg1 = gen_reg_rtx (dword_mode);
2090 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2091 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2092 rtx len0 = gen_lowpart (Pmode, reg0);
2093 rtx len1 = gen_lowpart (Pmode, reg1);
2095 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2096 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2097 emit_move_insn (len0, operands[2]);
2099 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2100 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2101 emit_move_insn (len1, operands[2]);
2103 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2104 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2109 (define_insn "*cmpmem_long_64"
2110 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2111 (clobber (match_operand:TI 1 "register_operand" "=d"))
2113 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2114 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2116 (use (match_dup 3))]
2119 [(set_attr "op_type" "RR")
2120 (set_attr "type" "vs")])
2122 (define_insn "*cmpmem_long_31"
2123 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2124 (clobber (match_operand:DI 1 "register_operand" "=d"))
2126 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2127 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2129 (use (match_dup 3))]
2132 [(set_attr "op_type" "RR")
2133 (set_attr "type" "vs")])
2135 ; Convert condition code to integer in range (-1, 0, 1)
2137 (define_insn "cmpint_si"
2138 [(set (match_operand:SI 0 "register_operand" "=d")
2139 (compare:SI (reg:CCS 33) (const_int 0)))]
2142 output_asm_insn ("lhi\t%0,1", operands);
2143 output_asm_insn ("jh\t.+12", operands);
2144 output_asm_insn ("jl\t.+6", operands);
2145 output_asm_insn ("sr\t%0,%0", operands);
2146 return "lcr\t%0,%0";
2148 [(set_attr "op_type" "NN")
2149 (set_attr "length" "16")
2150 (set_attr "type" "other")])
2152 (define_insn "cmpint_di"
2153 [(set (match_operand:DI 0 "register_operand" "=d")
2154 (compare:DI (reg:CCS 33) (const_int 0)))]
2157 output_asm_insn ("lghi\t%0,1", operands);
2158 output_asm_insn ("jh\t.+12", operands);
2159 output_asm_insn ("jl\t.+6", operands);
2160 output_asm_insn ("sgr\t%0,%0", operands);
2161 return "lcgr\t%0,%0";
2163 [(set_attr "op_type" "NN")
2164 (set_attr "length" "22")
2165 (set_attr "type" "other")])
2169 ;;- Conversion instructions.
2172 (define_insn "*sethighqisi"
2173 [(set (match_operand:SI 0 "register_operand" "=d,d")
2174 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2175 (clobber (reg:CC 33))]
2180 [(set_attr "op_type" "RS,RSY")])
2182 (define_insn "*sethighhisi"
2183 [(set (match_operand:SI 0 "register_operand" "=d,d")
2184 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2185 (clobber (reg:CC 33))]
2190 [(set_attr "op_type" "RS,RSY")])
2192 (define_insn "*sethighqidi_64"
2193 [(set (match_operand:DI 0 "register_operand" "=d")
2194 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2195 (clobber (reg:CC 33))]
2198 [(set_attr "op_type" "RSY")])
2200 (define_insn "*sethighqidi_31"
2201 [(set (match_operand:DI 0 "register_operand" "=d,d")
2202 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2203 (clobber (reg:CC 33))]
2208 [(set_attr "op_type" "RS,RSY")])
2210 (define_insn_and_split "*extractqi"
2211 [(set (match_operand:SI 0 "register_operand" "=d")
2212 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2213 (match_operand 2 "const_int_operand" "n")
2215 (clobber (reg:CC 33))]
2217 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2219 "&& reload_completed"
2221 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2222 (clobber (reg:CC 33))])
2223 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2225 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2226 operands[1] = change_address (operands[1], QImode, 0);
2228 [(set_attr "atype" "agen")])
2230 (define_insn_and_split "*extracthi"
2231 [(set (match_operand:SI 0 "register_operand" "=d")
2232 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2233 (match_operand 2 "const_int_operand" "n")
2235 (clobber (reg:CC 33))]
2237 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2239 "&& reload_completed"
2241 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2242 (clobber (reg:CC 33))])
2243 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2245 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2246 operands[1] = change_address (operands[1], HImode, 0);
2248 [(set_attr "atype" "agen")])
2251 ; extendsidi2 instruction pattern(s).
2254 (define_expand "extendsidi2"
2255 [(set (match_operand:DI 0 "register_operand" "")
2256 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2262 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2263 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2264 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2265 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2271 (define_insn "*extendsidi2"
2272 [(set (match_operand:DI 0 "register_operand" "=d,d")
2273 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2278 [(set_attr "op_type" "RRE,RXY")])
2281 ; extendhidi2 instruction pattern(s).
2284 (define_expand "extendhidi2"
2285 [(set (match_operand:DI 0 "register_operand" "")
2286 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2292 rtx tmp = gen_reg_rtx (SImode);
2293 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2294 emit_insn (gen_extendsidi2 (operands[0], tmp));
2299 operands[1] = gen_lowpart (DImode, operands[1]);
2300 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2301 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2307 (define_insn "*extendhidi2"
2308 [(set (match_operand:DI 0 "register_operand" "=d")
2309 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2312 [(set_attr "op_type" "RXY")])
2315 ; extendqidi2 instruction pattern(s).
2318 (define_expand "extendqidi2"
2319 [(set (match_operand:DI 0 "register_operand" "")
2320 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2326 rtx tmp = gen_reg_rtx (SImode);
2327 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2328 emit_insn (gen_extendsidi2 (operands[0], tmp));
2333 operands[1] = gen_lowpart (DImode, operands[1]);
2334 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2335 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2341 (define_insn "*extendqidi2"
2342 [(set (match_operand:DI 0 "register_operand" "=d")
2343 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2344 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2346 [(set_attr "op_type" "RXY")])
2349 [(set (match_operand:DI 0 "register_operand" "")
2350 (sign_extend:DI (match_operand:QI 1 "s_operand" "")))]
2351 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT && !reload_completed"
2353 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2354 (clobber (reg:CC 33))])
2356 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2357 (clobber (reg:CC 33))])]
2361 ; extendhisi2 instruction pattern(s).
2364 (define_expand "extendhisi2"
2365 [(set (match_operand:SI 0 "register_operand" "")
2366 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2370 operands[1] = gen_lowpart (SImode, operands[1]);
2371 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2372 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2377 (define_insn "*extendhisi2"
2378 [(set (match_operand:SI 0 "register_operand" "=d,d")
2379 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2384 [(set_attr "op_type" "RX,RXY")])
2387 ; extendqisi2 instruction pattern(s).
2390 (define_expand "extendqisi2"
2391 [(set (match_operand:SI 0 "register_operand" "")
2392 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2396 operands[1] = gen_lowpart (SImode, operands[1]);
2397 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2398 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2403 (define_insn "*extendqisi2"
2404 [(set (match_operand:SI 0 "register_operand" "=d")
2405 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2406 "TARGET_LONG_DISPLACEMENT"
2408 [(set_attr "op_type" "RXY")])
2411 [(set (match_operand:SI 0 "register_operand" "")
2412 (sign_extend:SI (match_operand:QI 1 "s_operand" "")))]
2413 "!TARGET_LONG_DISPLACEMENT && !reload_completed"
2415 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2416 (clobber (reg:CC 33))])
2418 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2419 (clobber (reg:CC 33))])]
2423 ; extendqihi2 instruction pattern(s).
2428 ; zero_extendsidi2 instruction pattern(s).
2431 (define_expand "zero_extendsidi2"
2432 [(set (match_operand:DI 0 "register_operand" "")
2433 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2439 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2440 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2441 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2447 (define_insn "*zero_extendsidi2"
2448 [(set (match_operand:DI 0 "register_operand" "=d,d")
2449 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2454 [(set_attr "op_type" "RRE,RXY")])
2457 ; zero_extendhidi2 instruction pattern(s).
2460 (define_expand "zero_extendhidi2"
2461 [(set (match_operand:DI 0 "register_operand" "")
2462 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2468 rtx tmp = gen_reg_rtx (SImode);
2469 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2470 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2475 operands[1] = gen_lowpart (DImode, operands[1]);
2476 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2477 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2483 (define_insn "*zero_extendhidi2"
2484 [(set (match_operand:DI 0 "register_operand" "=d")
2485 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2488 [(set_attr "op_type" "RXY")])
2491 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2494 (define_insn "*llgt_sisi"
2495 [(set (match_operand:SI 0 "register_operand" "=d,d")
2496 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2497 (const_int 2147483647)))]
2502 [(set_attr "op_type" "RRE,RXE")])
2504 (define_insn_and_split "*llgt_sisi_split"
2505 [(set (match_operand:SI 0 "register_operand" "=d,d")
2506 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2507 (const_int 2147483647)))
2508 (clobber (reg:CC 33))]
2511 "&& reload_completed"
2513 (and:SI (match_dup 1)
2514 (const_int 2147483647)))]
2517 (define_insn "*llgt_didi"
2518 [(set (match_operand:DI 0 "register_operand" "=d,d")
2519 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2520 (const_int 2147483647)))]
2525 [(set_attr "op_type" "RRE,RXE")])
2527 (define_insn_and_split "*llgt_didi_split"
2528 [(set (match_operand:DI 0 "register_operand" "=d,d")
2529 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2530 (const_int 2147483647)))
2531 (clobber (reg:CC 33))]
2534 "&& reload_completed"
2536 (and:DI (match_dup 1)
2537 (const_int 2147483647)))]
2540 (define_insn "*llgt_sidi"
2541 [(set (match_operand:DI 0 "register_operand" "=d")
2542 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2543 (const_int 2147483647)))]
2546 [(set_attr "op_type" "RXE")])
2548 (define_insn_and_split "*llgt_sidi_split"
2549 [(set (match_operand:DI 0 "register_operand" "=d")
2550 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2551 (const_int 2147483647)))
2552 (clobber (reg:CC 33))]
2555 "&& reload_completed"
2557 (and:DI (subreg:DI (match_dup 1) 0)
2558 (const_int 2147483647)))]
2562 ; zero_extendqidi2 instruction pattern(s)
2565 (define_expand "zero_extendqidi2"
2566 [(set (match_operand:DI 0 "register_operand" "")
2567 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2573 rtx tmp = gen_reg_rtx (SImode);
2574 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2575 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2580 operands[1] = gen_lowpart (DImode, operands[1]);
2581 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2582 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2588 (define_insn "*zero_extendqidi2"
2589 [(set (match_operand:DI 0 "register_operand" "=d")
2590 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2593 [(set_attr "op_type" "RXY")])
2596 ; zero_extendhisi2 instruction pattern(s).
2599 (define_expand "zero_extendhisi2"
2600 [(set (match_operand:SI 0 "register_operand" "")
2601 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2605 operands[1] = gen_lowpart (SImode, operands[1]);
2606 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2611 (define_insn "*zero_extendhisi2_64"
2612 [(set (match_operand:SI 0 "register_operand" "=d")
2613 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2616 [(set_attr "op_type" "RXY")])
2618 (define_insn_and_split "*zero_extendhisi2_31"
2619 [(set (match_operand:SI 0 "register_operand" "=&d")
2620 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2621 (clobber (reg:CC 33))]
2624 "&& reload_completed"
2625 [(set (match_dup 0) (const_int 0))
2627 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2628 (clobber (reg:CC 33))])]
2629 "operands[2] = gen_lowpart (HImode, operands[0]);"
2630 [(set_attr "atype" "agen")])
2633 ; zero_extendqisi2 instruction pattern(s).
2636 (define_expand "zero_extendqisi2"
2637 [(set (match_operand:SI 0 "register_operand" "")
2638 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2642 operands[1] = gen_lowpart (SImode, operands[1]);
2643 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2648 (define_insn "*zero_extendqisi2_64"
2649 [(set (match_operand:SI 0 "register_operand" "=d")
2650 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2653 [(set_attr "op_type" "RXY")])
2655 (define_insn_and_split "*zero_extendqisi2_31"
2656 [(set (match_operand:SI 0 "register_operand" "=&d")
2657 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2660 "&& reload_completed"
2661 [(set (match_dup 0) (const_int 0))
2662 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2663 "operands[2] = gen_lowpart (QImode, operands[0]);"
2664 [(set_attr "atype" "agen")])
2667 ; zero_extendqihi2 instruction pattern(s).
2670 (define_expand "zero_extendqihi2"
2671 [(set (match_operand:HI 0 "register_operand" "")
2672 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2676 operands[1] = gen_lowpart (HImode, operands[1]);
2677 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2682 (define_insn "*zero_extendqihi2_64"
2683 [(set (match_operand:HI 0 "register_operand" "=d")
2684 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2687 [(set_attr "op_type" "RXY")])
2689 (define_insn_and_split "*zero_extendqihi2_31"
2690 [(set (match_operand:HI 0 "register_operand" "=&d")
2691 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2694 "&& reload_completed"
2695 [(set (match_dup 0) (const_int 0))
2696 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2697 "operands[2] = gen_lowpart (QImode, operands[0]);"
2698 [(set_attr "atype" "agen")])
2702 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2705 (define_expand "fixuns_truncdfdi2"
2706 [(set (match_operand:DI 0 "register_operand" "")
2707 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2708 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2710 rtx label1 = gen_label_rtx ();
2711 rtx label2 = gen_label_rtx ();
2712 rtx temp = gen_reg_rtx (DFmode);
2713 operands[1] = force_reg (DFmode, operands[1]);
2715 emit_insn (gen_cmpdf (operands[1],
2716 CONST_DOUBLE_FROM_REAL_VALUE (
2717 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2718 emit_jump_insn (gen_blt (label1));
2719 emit_insn (gen_subdf3 (temp, operands[1],
2720 CONST_DOUBLE_FROM_REAL_VALUE (
2721 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2722 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2725 emit_label (label1);
2726 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2727 emit_label (label2);
2731 (define_expand "fix_truncdfdi2"
2732 [(set (match_operand:DI 0 "register_operand" "")
2733 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2734 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2736 operands[1] = force_reg (DFmode, operands[1]);
2737 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2741 (define_insn "fix_truncdfdi2_ieee"
2742 [(set (match_operand:DI 0 "register_operand" "=d")
2743 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2744 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2745 (clobber (reg:CC 33))]
2746 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2748 [(set_attr "op_type" "RRE")
2749 (set_attr "type" "ftoi")])
2752 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2755 (define_expand "fixuns_truncdfsi2"
2756 [(set (match_operand:SI 0 "register_operand" "")
2757 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2758 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2760 rtx label1 = gen_label_rtx ();
2761 rtx label2 = gen_label_rtx ();
2762 rtx temp = gen_reg_rtx (DFmode);
2764 operands[1] = force_reg (DFmode,operands[1]);
2765 emit_insn (gen_cmpdf (operands[1],
2766 CONST_DOUBLE_FROM_REAL_VALUE (
2767 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2768 emit_jump_insn (gen_blt (label1));
2769 emit_insn (gen_subdf3 (temp, operands[1],
2770 CONST_DOUBLE_FROM_REAL_VALUE (
2771 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2772 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2775 emit_label (label1);
2776 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2777 emit_label (label2);
2781 (define_expand "fix_truncdfsi2"
2782 [(set (match_operand:SI 0 "register_operand" "")
2783 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2786 if (TARGET_IBM_FLOAT)
2788 /* This is the algorithm from POP chapter A.5.7.2. */
2790 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2791 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2792 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2794 operands[1] = force_reg (DFmode, operands[1]);
2795 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2796 two31r, two32, temp));
2800 operands[1] = force_reg (DFmode, operands[1]);
2801 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2807 (define_insn "fix_truncdfsi2_ieee"
2808 [(set (match_operand:SI 0 "register_operand" "=d")
2809 (fix:SI (match_operand:DF 1 "register_operand" "f")))
2810 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2811 (clobber (reg:CC 33))]
2812 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2814 [(set_attr "op_type" "RRE")
2815 (set_attr "type" "other" )])
2817 (define_insn "fix_truncdfsi2_ibm"
2818 [(set (match_operand:SI 0 "register_operand" "=d")
2819 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2820 (use (match_operand:DI 2 "immediate_operand" "m"))
2821 (use (match_operand:DI 3 "immediate_operand" "m"))
2822 (use (match_operand:BLK 4 "memory_operand" "m"))
2823 (clobber (reg:CC 33))]
2824 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2826 output_asm_insn ("sd\t%1,%2", operands);
2827 output_asm_insn ("aw\t%1,%3", operands);
2828 output_asm_insn ("std\t%1,%4", operands);
2829 output_asm_insn ("xi\t%N4,128", operands);
2832 [(set_attr "op_type" "NN")
2833 (set_attr "type" "ftoi")
2834 (set_attr "atype" "agen")
2835 (set_attr "length" "20")])
2838 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
2841 (define_expand "fixuns_truncsfdi2"
2842 [(set (match_operand:DI 0 "register_operand" "")
2843 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2844 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2846 rtx label1 = gen_label_rtx ();
2847 rtx label2 = gen_label_rtx ();
2848 rtx temp = gen_reg_rtx (SFmode);
2850 operands[1] = force_reg (SFmode, operands[1]);
2851 emit_insn (gen_cmpsf (operands[1],
2852 CONST_DOUBLE_FROM_REAL_VALUE (
2853 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
2854 emit_jump_insn (gen_blt (label1));
2856 emit_insn (gen_subsf3 (temp, operands[1],
2857 CONST_DOUBLE_FROM_REAL_VALUE (
2858 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
2859 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
2862 emit_label (label1);
2863 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2864 emit_label (label2);
2868 (define_expand "fix_truncsfdi2"
2869 [(set (match_operand:DI 0 "register_operand" "")
2870 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
2871 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2873 operands[1] = force_reg (SFmode, operands[1]);
2874 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2878 (define_insn "fix_truncsfdi2_ieee"
2879 [(set (match_operand:DI 0 "register_operand" "=d")
2880 (fix:DI (match_operand:SF 1 "register_operand" "f")))
2881 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2882 (clobber (reg:CC 33))]
2883 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2885 [(set_attr "op_type" "RRE")
2886 (set_attr "type" "ftoi")])
2889 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
2892 (define_expand "fixuns_truncsfsi2"
2893 [(set (match_operand:SI 0 "register_operand" "")
2894 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
2895 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2897 rtx label1 = gen_label_rtx ();
2898 rtx label2 = gen_label_rtx ();
2899 rtx temp = gen_reg_rtx (SFmode);
2901 operands[1] = force_reg (SFmode, operands[1]);
2902 emit_insn (gen_cmpsf (operands[1],
2903 CONST_DOUBLE_FROM_REAL_VALUE (
2904 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
2905 emit_jump_insn (gen_blt (label1));
2906 emit_insn (gen_subsf3 (temp, operands[1],
2907 CONST_DOUBLE_FROM_REAL_VALUE (
2908 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
2909 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
2912 emit_label (label1);
2913 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2914 emit_label (label2);
2918 (define_expand "fix_truncsfsi2"
2919 [(set (match_operand:SI 0 "register_operand" "")
2920 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
2923 if (TARGET_IBM_FLOAT)
2925 /* Convert to DFmode and then use the POP algorithm. */
2926 rtx temp = gen_reg_rtx (DFmode);
2927 emit_insn (gen_extendsfdf2 (temp, operands[1]));
2928 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
2932 operands[1] = force_reg (SFmode, operands[1]);
2933 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2939 (define_insn "fix_truncsfsi2_ieee"
2940 [(set (match_operand:SI 0 "register_operand" "=d")
2941 (fix:SI (match_operand:SF 1 "register_operand" "f")))
2942 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2943 (clobber (reg:CC 33))]
2944 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2946 [(set_attr "op_type" "RRE")
2947 (set_attr "type" "ftoi")])
2950 ; floatdidf2 instruction pattern(s).
2953 (define_insn "floatdidf2"
2954 [(set (match_operand:DF 0 "register_operand" "=f")
2955 (float:DF (match_operand:DI 1 "register_operand" "d")))
2956 (clobber (reg:CC 33))]
2957 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2959 [(set_attr "op_type" "RRE")
2960 (set_attr "type" "itof" )])
2963 ; floatdisf2 instruction pattern(s).
2966 (define_insn "floatdisf2"
2967 [(set (match_operand:SF 0 "register_operand" "=f")
2968 (float:SF (match_operand:DI 1 "register_operand" "d")))
2969 (clobber (reg:CC 33))]
2970 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2972 [(set_attr "op_type" "RRE")
2973 (set_attr "type" "itof" )])
2976 ; floatsidf2 instruction pattern(s).
2979 (define_expand "floatsidf2"
2981 [(set (match_operand:DF 0 "register_operand" "")
2982 (float:DF (match_operand:SI 1 "register_operand" "")))
2983 (clobber (reg:CC 33))])]
2986 if (TARGET_IBM_FLOAT)
2988 /* This is the algorithm from POP chapter A.5.7.1. */
2990 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2991 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
2993 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
2998 (define_insn "floatsidf2_ieee"
2999 [(set (match_operand:DF 0 "register_operand" "=f")
3000 (float:DF (match_operand:SI 1 "register_operand" "d")))
3001 (clobber (reg:CC 33))]
3002 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3004 [(set_attr "op_type" "RRE")
3005 (set_attr "type" "itof" )])
3007 (define_insn "floatsidf2_ibm"
3008 [(set (match_operand:DF 0 "register_operand" "=f")
3009 (float:DF (match_operand:SI 1 "register_operand" "d")))
3010 (use (match_operand:DI 2 "immediate_operand" "m"))
3011 (use (match_operand:BLK 3 "memory_operand" "m"))
3012 (clobber (reg:CC 33))]
3013 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3015 output_asm_insn ("st\t%1,%N3", operands);
3016 output_asm_insn ("xi\t%N3,128", operands);
3017 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3018 output_asm_insn ("ld\t%0,%3", operands);
3021 [(set_attr "op_type" "NN")
3022 (set_attr "type" "other" )
3023 (set_attr "atype" "agen")
3024 (set_attr "length" "20")])
3027 ; floatsisf2 instruction pattern(s).
3030 (define_expand "floatsisf2"
3032 [(set (match_operand:SF 0 "register_operand" "")
3033 (float:SF (match_operand:SI 1 "register_operand" "")))
3034 (clobber (reg:CC 33))])]
3037 if (TARGET_IBM_FLOAT)
3039 /* Use the POP algorithm to convert to DFmode and then truncate. */
3040 rtx temp = gen_reg_rtx (DFmode);
3041 emit_insn (gen_floatsidf2 (temp, operands[1]));
3042 emit_insn (gen_truncdfsf2 (operands[0], temp));
3047 (define_insn "floatsisf2_ieee"
3048 [(set (match_operand:SF 0 "register_operand" "=f")
3049 (float:SF (match_operand:SI 1 "register_operand" "d")))
3050 (clobber (reg:CC 33))]
3051 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3053 [(set_attr "op_type" "RRE")
3054 (set_attr "type" "itof" )])
3057 ; truncdfsf2 instruction pattern(s).
3060 (define_expand "truncdfsf2"
3061 [(set (match_operand:SF 0 "register_operand" "")
3062 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3066 (define_insn "truncdfsf2_ieee"
3067 [(set (match_operand:SF 0 "register_operand" "=f")
3068 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3069 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3071 [(set_attr "op_type" "RRE")])
3073 (define_insn "truncdfsf2_ibm"
3074 [(set (match_operand:SF 0 "register_operand" "=f,f")
3075 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3076 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3080 [(set_attr "op_type" "RR,RX")
3081 (set_attr "type" "floads,floads")])
3084 ; extendsfdf2 instruction pattern(s).
3087 (define_expand "extendsfdf2"
3088 [(set (match_operand:DF 0 "register_operand" "")
3089 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3092 if (TARGET_IBM_FLOAT)
3094 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3099 (define_insn "extendsfdf2_ieee"
3100 [(set (match_operand:DF 0 "register_operand" "=f,f")
3101 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3102 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3106 [(set_attr "op_type" "RRE,RXE")
3107 (set_attr "type" "floads,floads")])
3109 (define_insn "extendsfdf2_ibm"
3110 [(set (match_operand:DF 0 "register_operand" "=f,f")
3111 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3112 (clobber (reg:CC 33))]
3113 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3115 sdr\t%0,%0\;ler\t%0,%1
3116 sdr\t%0,%0\;le\t%0,%1"
3117 [(set_attr "op_type" "NN,NN")
3118 (set_attr "atype" "reg,agen")
3119 (set_attr "length" "4,6")
3120 (set_attr "type" "o2,o2")])
3124 ;; ARITHMETIC OPERATIONS
3126 ; arithmetic operations set the ConditionCode,
3127 ; because of unpredictable Bits in Register for Halfword and Byte
3128 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3131 ;;- Add instructions.
3135 ; adddi3 instruction pattern(s).
3138 (define_insn "*adddi3_sign"
3139 [(set (match_operand:DI 0 "register_operand" "=d,d")
3140 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3141 (match_operand:DI 1 "register_operand" "0,0")))
3142 (clobber (reg:CC 33))]
3147 [(set_attr "op_type" "RRE,RXY")])
3149 (define_insn "*adddi3_zero_cc"
3151 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3152 (match_operand:DI 1 "register_operand" "0,0"))
3154 (set (match_operand:DI 0 "register_operand" "=d,d")
3155 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3156 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3160 [(set_attr "op_type" "RRE,RXY")])
3162 (define_insn "*adddi3_zero_cconly"
3164 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3165 (match_operand:DI 1 "register_operand" "0,0"))
3167 (clobber (match_scratch:DI 0 "=d,d"))]
3168 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3172 [(set_attr "op_type" "RRE,RXY")])
3174 (define_insn "*adddi3_zero"
3175 [(set (match_operand:DI 0 "register_operand" "=d,d")
3176 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3177 (match_operand:DI 1 "register_operand" "0,0")))
3178 (clobber (reg:CC 33))]
3183 [(set_attr "op_type" "RRE,RXY")])
3185 (define_insn "*adddi3_imm_cc"
3187 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3188 (match_operand:DI 2 "const_int_operand" "K"))
3190 (set (match_operand:DI 0 "register_operand" "=d")
3191 (plus:DI (match_dup 1) (match_dup 2)))]
3193 && s390_match_ccmode (insn, CCAmode)
3194 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
3196 [(set_attr "op_type" "RI")])
3198 (define_insn "*adddi3_carry1_cc"
3200 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3201 (match_operand:DI 2 "general_operand" "d,m"))
3203 (set (match_operand:DI 0 "register_operand" "=d,d")
3204 (plus:DI (match_dup 1) (match_dup 2)))]
3205 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3209 [(set_attr "op_type" "RRE,RXY")])
3211 (define_insn "*adddi3_carry1_cconly"
3213 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3214 (match_operand:DI 2 "general_operand" "d,m"))
3216 (clobber (match_scratch:DI 0 "=d,d"))]
3217 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3221 [(set_attr "op_type" "RRE,RXY")])
3223 (define_insn "*adddi3_carry2_cc"
3225 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3226 (match_operand:DI 2 "general_operand" "d,m"))
3228 (set (match_operand:DI 0 "register_operand" "=d,d")
3229 (plus:DI (match_dup 1) (match_dup 2)))]
3230 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3234 [(set_attr "op_type" "RRE,RXY")])
3236 (define_insn "*adddi3_carry2_cconly"
3238 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3239 (match_operand:DI 2 "general_operand" "d,m"))
3241 (clobber (match_scratch:DI 0 "=d,d"))]
3242 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3246 [(set_attr "op_type" "RRE,RXY")])
3248 (define_insn "*adddi3_cc"
3250 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3251 (match_operand:DI 2 "general_operand" "d,m"))
3253 (set (match_operand:DI 0 "register_operand" "=d,d")
3254 (plus:DI (match_dup 1) (match_dup 2)))]
3255 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3259 [(set_attr "op_type" "RRE,RXY")])
3261 (define_insn "*adddi3_cconly"
3263 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3264 (match_operand:DI 2 "general_operand" "d,m"))
3266 (clobber (match_scratch:DI 0 "=d,d"))]
3267 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3271 [(set_attr "op_type" "RRE,RXY")])
3273 (define_insn "*adddi3_cconly2"
3275 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3276 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3277 (clobber (match_scratch:DI 0 "=d,d"))]
3278 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3282 [(set_attr "op_type" "RRE,RXY")])
3284 (define_insn "*adddi3_64"
3285 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3286 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3287 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3288 (clobber (reg:CC 33))]
3294 [(set_attr "op_type" "RRE,RI,RXY")])
3296 (define_insn_and_split "*adddi3_31z"
3297 [(set (match_operand:DI 0 "register_operand" "=&d")
3298 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3299 (match_operand:DI 2 "general_operand" "do") ) )
3300 (clobber (reg:CC 33))]
3301 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3303 "&& reload_completed"
3306 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3308 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3310 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3311 (ltu:SI (reg:CCL1 33) (const_int 0))))
3312 (clobber (reg:CC 33))])]
3313 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3314 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3315 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3316 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3317 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3318 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3319 [(set_attr "op_type" "NN")])
3321 (define_insn_and_split "*adddi3_31"
3322 [(set (match_operand:DI 0 "register_operand" "=&d")
3323 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3324 (match_operand:DI 2 "general_operand" "do") ) )
3325 (clobber (reg:CC 33))]
3328 "&& reload_completed"
3330 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3331 (clobber (reg:CC 33))])
3334 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3336 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3338 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3340 (label_ref (match_dup 9))))
3342 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3343 (clobber (reg:CC 33))])
3345 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3346 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3347 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3348 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3349 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3350 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3351 operands[9] = gen_label_rtx ();"
3352 [(set_attr "op_type" "NN")])
3354 (define_expand "adddi3"
3356 [(set (match_operand:DI 0 "register_operand" "")
3357 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3358 (match_operand:DI 2 "general_operand" "")))
3359 (clobber (reg:CC 33))])]
3363 (define_insn "*la_64"
3364 [(set (match_operand:DI 0 "register_operand" "=d,d")
3365 (match_operand:QI 1 "address_operand" "U,W"))]
3370 [(set_attr "op_type" "RX,RXY")
3371 (set_attr "type" "la")])
3375 [(set (match_operand:DI 0 "register_operand" "")
3376 (match_operand:QI 1 "address_operand" ""))
3377 (clobber (reg:CC 33))])]
3379 && strict_memory_address_p (VOIDmode, operands[1])
3380 && preferred_la_operand_p (operands[1])"
3381 [(set (match_dup 0) (match_dup 1))]
3385 [(set (match_operand:DI 0 "register_operand" "")
3386 (match_operand:DI 1 "register_operand" ""))
3389 (plus:DI (match_dup 0)
3390 (match_operand:DI 2 "nonmemory_operand" "")))
3391 (clobber (reg:CC 33))])]
3393 && !reg_overlap_mentioned_p (operands[0], operands[2])
3394 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (DImode, operands[1], operands[2]))
3395 && preferred_la_operand_p (gen_rtx_PLUS (DImode, operands[1], operands[2]))"
3396 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3399 (define_expand "reload_indi"
3400 [(parallel [(match_operand:DI 0 "register_operand" "=a")
3401 (match_operand:DI 1 "s390_plus_operand" "")
3402 (match_operand:DI 2 "register_operand" "=&a")])]
3405 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3411 ; addsi3 instruction pattern(s).
3414 (define_insn "*addsi3_imm_cc"
3416 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3417 (match_operand:SI 2 "const_int_operand" "K"))
3419 (set (match_operand:SI 0 "register_operand" "=d")
3420 (plus:SI (match_dup 1) (match_dup 2)))]
3421 "s390_match_ccmode (insn, CCAmode)
3422 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
3424 [(set_attr "op_type" "RI")])
3426 (define_insn "*addsi3_carry1_cc"
3428 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3429 (match_operand:SI 2 "general_operand" "d,R,T"))
3431 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3432 (plus:SI (match_dup 1) (match_dup 2)))]
3433 "s390_match_ccmode (insn, CCL1mode)"
3438 [(set_attr "op_type" "RR,RX,RXY")])
3440 (define_insn "*addsi3_carry1_cconly"
3442 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3443 (match_operand:SI 2 "general_operand" "d,R,T"))
3445 (clobber (match_scratch:SI 0 "=d,d,d"))]
3446 "s390_match_ccmode (insn, CCL1mode)"
3451 [(set_attr "op_type" "RR,RX,RXY")])
3453 (define_insn "*addsi3_carry2_cc"
3455 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3456 (match_operand:SI 2 "general_operand" "d,R,T"))
3458 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3459 (plus:SI (match_dup 1) (match_dup 2)))]
3460 "s390_match_ccmode (insn, CCL1mode)"
3465 [(set_attr "op_type" "RR,RX,RXY")])
3467 (define_insn "*addsi3_carry2_cconly"
3469 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3470 (match_operand:SI 2 "general_operand" "d,R,T"))
3472 (clobber (match_scratch:SI 0 "=d,d,d"))]
3473 "s390_match_ccmode (insn, CCL1mode)"
3478 [(set_attr "op_type" "RR,RX,RXY")])
3480 (define_insn "*addsi3_cc"
3482 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3483 (match_operand:SI 2 "general_operand" "d,R,T"))
3485 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3486 (plus:SI (match_dup 1) (match_dup 2)))]
3487 "s390_match_ccmode (insn, CCLmode)"
3492 [(set_attr "op_type" "RR,RX,RXY")])
3494 (define_insn "*addsi3_cconly"
3496 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3497 (match_operand:SI 2 "general_operand" "d,R,T"))
3499 (clobber (match_scratch:SI 0 "=d,d,d"))]
3500 "s390_match_ccmode (insn, CCLmode)"
3505 [(set_attr "op_type" "RR,RX,RXY")])
3507 (define_insn "*addsi3_cconly2"
3509 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3510 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3511 (clobber (match_scratch:SI 0 "=d,d,d"))]
3512 "s390_match_ccmode (insn, CCLmode)"
3517 [(set_attr "op_type" "RR,RX,RXY")])
3519 (define_insn "*addsi3_sign"
3520 [(set (match_operand:SI 0 "register_operand" "=d,d")
3521 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3522 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3523 (clobber (reg:CC 33))]
3528 [(set_attr "op_type" "RX,RXY")])
3530 (define_insn "addsi3"
3531 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3532 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3533 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3534 (clobber (reg:CC 33))]
3541 [(set_attr "op_type" "RR,RI,RX,RXY")])
3543 (define_insn "*la_31"
3544 [(set (match_operand:SI 0 "register_operand" "=d,d")
3545 (match_operand:QI 1 "address_operand" "U,W"))]
3546 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
3550 [(set_attr "op_type" "RX,RXY")
3551 (set_attr "type" "la")])
3555 [(set (match_operand:SI 0 "register_operand" "")
3556 (match_operand:QI 1 "address_operand" ""))
3557 (clobber (reg:CC 33))])]
3559 && strict_memory_address_p (VOIDmode, operands[1])
3560 && preferred_la_operand_p (operands[1])"
3561 [(set (match_dup 0) (match_dup 1))]
3565 [(set (match_operand:SI 0 "register_operand" "")
3566 (match_operand:SI 1 "register_operand" ""))
3569 (plus:SI (match_dup 0)
3570 (match_operand:SI 2 "nonmemory_operand" "")))
3571 (clobber (reg:CC 33))])]
3573 && !reg_overlap_mentioned_p (operands[0], operands[2])
3574 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
3575 && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
3576 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3579 (define_insn "*la_31_and"
3580 [(set (match_operand:SI 0 "register_operand" "=d,d")
3581 (and:SI (match_operand:QI 1 "address_operand" "U,W")
3582 (const_int 2147483647)))]
3587 [(set_attr "op_type" "RX,RXY")
3588 (set_attr "type" "la")])
3590 (define_insn_and_split "*la_31_and_cc"
3591 [(set (match_operand:SI 0 "register_operand" "=d")
3592 (and:SI (match_operand:QI 1 "address_operand" "p")
3593 (const_int 2147483647)))
3594 (clobber (reg:CC 33))]
3597 "&& reload_completed"
3599 (and:SI (match_dup 1) (const_int 2147483647)))]
3601 [(set_attr "op_type" "RX")
3602 (set_attr "type" "la")])
3604 (define_insn "force_la_31"
3605 [(set (match_operand:SI 0 "register_operand" "=d,d")
3606 (match_operand:QI 1 "address_operand" "U,W"))
3607 (use (const_int 0))]
3612 [(set_attr "op_type" "RX")
3613 (set_attr "type" "la")])
3615 (define_expand "reload_insi"
3616 [(parallel [(match_operand:SI 0 "register_operand" "=a")
3617 (match_operand:SI 1 "s390_plus_operand" "")
3618 (match_operand:SI 2 "register_operand" "=&a")])]
3621 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3627 ; adddf3 instruction pattern(s).
3630 (define_expand "adddf3"
3632 [(set (match_operand:DF 0 "register_operand" "=f,f")
3633 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3634 (match_operand:DF 2 "general_operand" "f,R")))
3635 (clobber (reg:CC 33))])]
3639 (define_insn "*adddf3"
3640 [(set (match_operand:DF 0 "register_operand" "=f,f")
3641 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3642 (match_operand:DF 2 "general_operand" "f,R")))
3643 (clobber (reg:CC 33))]
3644 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3648 [(set_attr "op_type" "RRE,RXE")
3649 (set_attr "type" "fsimpd,fsimpd")])
3651 (define_insn "*adddf3_cc"
3653 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3654 (match_operand:DF 2 "general_operand" "f,R"))
3655 (match_operand:DF 3 "const0_operand" "")))
3656 (set (match_operand:DF 0 "register_operand" "=f,f")
3657 (plus:DF (match_dup 1) (match_dup 2)))]
3658 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3662 [(set_attr "op_type" "RRE,RXE")
3663 (set_attr "type" "fsimpd,fsimpd")])
3665 (define_insn "*adddf3_cconly"
3667 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3668 (match_operand:DF 2 "general_operand" "f,R"))
3669 (match_operand:DF 3 "const0_operand" "")))
3670 (clobber (match_scratch:DF 0 "=f,f"))]
3671 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3675 [(set_attr "op_type" "RRE,RXE")
3676 (set_attr "type" "fsimpd,fsimpd")])
3678 (define_insn "*adddf3_ibm"
3679 [(set (match_operand:DF 0 "register_operand" "=f,f")
3680 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3681 (match_operand:DF 2 "general_operand" "f,R")))
3682 (clobber (reg:CC 33))]
3683 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3687 [(set_attr "op_type" "RR,RX")
3688 (set_attr "type" "fsimpd,fsimpd")])
3691 ; addsf3 instruction pattern(s).
3694 (define_expand "addsf3"
3696 [(set (match_operand:SF 0 "register_operand" "=f,f")
3697 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3698 (match_operand:SF 2 "general_operand" "f,R")))
3699 (clobber (reg:CC 33))])]
3703 (define_insn "*addsf3"
3704 [(set (match_operand:SF 0 "register_operand" "=f,f")
3705 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3706 (match_operand:SF 2 "general_operand" "f,R")))
3707 (clobber (reg:CC 33))]
3708 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3712 [(set_attr "op_type" "RRE,RXE")
3713 (set_attr "type" "fsimps,fsimps")])
3715 (define_insn "*addsf3_cc"
3717 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3718 (match_operand:SF 2 "general_operand" "f,R"))
3719 (match_operand:SF 3 "const0_operand" "")))
3720 (set (match_operand:SF 0 "register_operand" "=f,f")
3721 (plus:SF (match_dup 1) (match_dup 2)))]
3722 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3726 [(set_attr "op_type" "RRE,RXE")
3727 (set_attr "type" "fsimps,fsimps")])
3729 (define_insn "*addsf3_cconly"
3731 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3732 (match_operand:SF 2 "general_operand" "f,R"))
3733 (match_operand:SF 3 "const0_operand" "")))
3734 (clobber (match_scratch:SF 0 "=f,f"))]
3735 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3739 [(set_attr "op_type" "RRE,RXE")
3740 (set_attr "type" "fsimps,fsimps")])
3742 (define_insn "*addsf3"
3743 [(set (match_operand:SF 0 "register_operand" "=f,f")
3744 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3745 (match_operand:SF 2 "general_operand" "f,R")))
3746 (clobber (reg:CC 33))]
3747 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3751 [(set_attr "op_type" "RR,RX")
3752 (set_attr "type" "fsimps,fsimps")])
3756 ;;- Subtract instructions.
3760 ; subdi3 instruction pattern(s).
3763 (define_insn "*subdi3_sign"
3764 [(set (match_operand:DI 0 "register_operand" "=d,d")
3765 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3766 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3767 (clobber (reg:CC 33))]
3772 [(set_attr "op_type" "RRE,RXY")])
3774 (define_insn "*subdi3_zero_cc"
3776 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3777 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3779 (set (match_operand:DI 0 "register_operand" "=d,d")
3780 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3781 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3785 [(set_attr "op_type" "RRE,RXY")])
3787 (define_insn "*subdi3_zero_cconly"
3789 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3790 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3792 (clobber (match_scratch:DI 0 "=d,d"))]
3793 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3797 [(set_attr "op_type" "RRE,RXY")])
3799 (define_insn "*subdi3_zero"
3800 [(set (match_operand:DI 0 "register_operand" "=d,d")
3801 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3802 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3803 (clobber (reg:CC 33))]
3808 [(set_attr "op_type" "RRE,RXY")])
3810 (define_insn "*subdi3_borrow_cc"
3812 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3813 (match_operand:DI 2 "general_operand" "d,m"))
3815 (set (match_operand:DI 0 "register_operand" "=d,d")
3816 (minus:DI (match_dup 1) (match_dup 2)))]
3817 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3821 [(set_attr "op_type" "RRE,RXY")])
3823 (define_insn "*subdi3_borrow_cconly"
3825 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3826 (match_operand:DI 2 "general_operand" "d,m"))
3828 (clobber (match_scratch:DI 0 "=d,d"))]
3829 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3833 [(set_attr "op_type" "RRE,RXY")])
3835 (define_insn "*subdi3_cc"
3837 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3838 (match_operand:DI 2 "general_operand" "d,m"))
3840 (set (match_operand:DI 0 "register_operand" "=d,d")
3841 (minus:DI (match_dup 1) (match_dup 2)))]
3842 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3846 [(set_attr "op_type" "RRE,RXY")])
3848 (define_insn "*subdi3_cconly"
3850 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3851 (match_operand:DI 2 "general_operand" "d,m"))
3853 (clobber (match_scratch:DI 0 "=d,d"))]
3854 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3858 [(set_attr "op_type" "RRE,RXY")])
3860 (define_insn "*subdi3_64"
3861 [(set (match_operand:DI 0 "register_operand" "=d,d")
3862 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3863 (match_operand:DI 2 "general_operand" "d,m") ) )
3864 (clobber (reg:CC 33))]
3869 [(set_attr "op_type" "RRE,RRE")])
3871 (define_insn_and_split "*subdi3_31z"
3872 [(set (match_operand:DI 0 "register_operand" "=&d")
3873 (minus:DI (match_operand:DI 1 "register_operand" "0")
3874 (match_operand:DI 2 "general_operand" "do") ) )
3875 (clobber (reg:CC 33))]
3876 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3878 "&& reload_completed"
3881 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3883 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3885 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3886 (gtu:SI (reg:CCL2 33) (const_int 0))))
3887 (clobber (reg:CC 33))])]
3888 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3889 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3890 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3891 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3892 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3893 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3894 [(set_attr "op_type" "NN")])
3896 (define_insn_and_split "*subdi3_31"
3897 [(set (match_operand:DI 0 "register_operand" "=&d")
3898 (minus:DI (match_operand:DI 1 "register_operand" "0")
3899 (match_operand:DI 2 "general_operand" "do") ) )
3900 (clobber (reg:CC 33))]
3903 "&& reload_completed"
3905 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3906 (clobber (reg:CC 33))])
3909 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3911 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3913 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3915 (label_ref (match_dup 9))))
3917 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3918 (clobber (reg:CC 33))])
3920 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3921 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3922 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3923 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3924 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3925 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3926 operands[9] = gen_label_rtx ();"
3927 [(set_attr "op_type" "NN")])
3929 (define_expand "subdi3"
3931 [(set (match_operand:DI 0 "register_operand" "")
3932 (minus:DI (match_operand:DI 1 "register_operand" "")
3933 (match_operand:DI 2 "general_operand" "")))
3934 (clobber (reg:CC 33))])]
3939 ; subsi3 instruction pattern(s).
3942 (define_insn "*subsi3_borrow_cc"
3944 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3945 (match_operand:SI 2 "general_operand" "d,R,T"))
3947 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3948 (minus:SI (match_dup 1) (match_dup 2)))]
3949 "s390_match_ccmode (insn, CCL2mode)"
3954 [(set_attr "op_type" "RR,RX,RXY")])
3956 (define_insn "*subsi3_borrow_cconly"
3958 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3959 (match_operand:SI 2 "general_operand" "d,R,T"))
3961 (clobber (match_scratch:SI 0 "=d,d,d"))]
3962 "s390_match_ccmode (insn, CCL2mode)"
3967 [(set_attr "op_type" "RR,RX,RXY")])
3969 (define_insn "*subsi3_cc"
3971 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3972 (match_operand:SI 2 "general_operand" "d,R,T"))
3974 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3975 (minus:SI (match_dup 1) (match_dup 2)))]
3976 "s390_match_ccmode (insn, CCLmode)"
3981 [(set_attr "op_type" "RR,RX,RXY")])
3983 (define_insn "*subsi3_cconly"
3985 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3986 (match_operand:SI 2 "general_operand" "d,R,T"))
3988 (clobber (match_scratch:SI 0 "=d,d,d"))]
3989 "s390_match_ccmode (insn, CCLmode)"
3994 [(set_attr "op_type" "RR,RX,RXY")])
3996 (define_insn "*subsi3_sign"
3997 [(set (match_operand:SI 0 "register_operand" "=d,d")
3998 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3999 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4000 (clobber (reg:CC 33))]
4005 [(set_attr "op_type" "RX,RXY")])
4007 (define_insn "subsi3"
4008 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4009 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4010 (match_operand:SI 2 "general_operand" "d,R,T")))
4011 (clobber (reg:CC 33))]
4017 [(set_attr "op_type" "RR,RX,RXY")])
4021 ; subdf3 instruction pattern(s).
4024 (define_expand "subdf3"
4026 [(set (match_operand:DF 0 "register_operand" "=f,f")
4027 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4028 (match_operand:DF 2 "general_operand" "f,R")))
4029 (clobber (reg:CC 33))])]
4033 (define_insn "*subdf3"
4034 [(set (match_operand:DF 0 "register_operand" "=f,f")
4035 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4036 (match_operand:DF 2 "general_operand" "f,R")))
4037 (clobber (reg:CC 33))]
4038 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4042 [(set_attr "op_type" "RRE,RXE")
4043 (set_attr "type" "fsimpd,fsimpd")])
4045 (define_insn "*subdf3_cc"
4047 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4048 (match_operand:DF 2 "general_operand" "f,R"))
4049 (match_operand:DF 3 "const0_operand" "")))
4050 (set (match_operand:DF 0 "register_operand" "=f,f")
4051 (plus:DF (match_dup 1) (match_dup 2)))]
4052 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4056 [(set_attr "op_type" "RRE,RXE")
4057 (set_attr "type" "fsimpd,fsimpd")])
4059 (define_insn "*subdf3_cconly"
4061 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4062 (match_operand:DF 2 "general_operand" "f,R"))
4063 (match_operand:DF 3 "const0_operand" "")))
4064 (clobber (match_scratch:DF 0 "=f,f"))]
4065 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4069 [(set_attr "op_type" "RRE,RXE")
4070 (set_attr "type" "fsimpd,fsimpd")])
4072 (define_insn "*subdf3_ibm"
4073 [(set (match_operand:DF 0 "register_operand" "=f,f")
4074 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4075 (match_operand:DF 2 "general_operand" "f,R")))
4076 (clobber (reg:CC 33))]
4077 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4081 [(set_attr "op_type" "RR,RX")
4082 (set_attr "type" "fsimpd,fsimpd")])
4085 ; subsf3 instruction pattern(s).
4088 (define_expand "subsf3"
4090 [(set (match_operand:SF 0 "register_operand" "=f,f")
4091 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4092 (match_operand:SF 2 "general_operand" "f,R")))
4093 (clobber (reg:CC 33))])]
4097 (define_insn "*subsf3"
4098 [(set (match_operand:SF 0 "register_operand" "=f,f")
4099 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4100 (match_operand:SF 2 "general_operand" "f,R")))
4101 (clobber (reg:CC 33))]
4102 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4106 [(set_attr "op_type" "RRE,RXE")
4107 (set_attr "type" "fsimps,fsimps")])
4109 (define_insn "*subsf3_cc"
4111 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4112 (match_operand:SF 2 "general_operand" "f,R"))
4113 (match_operand:SF 3 "const0_operand" "")))
4114 (set (match_operand:SF 0 "register_operand" "=f,f")
4115 (minus:SF (match_dup 1) (match_dup 2)))]
4116 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4120 [(set_attr "op_type" "RRE,RXE")
4121 (set_attr "type" "fsimps,fsimps")])
4123 (define_insn "*subsf3_cconly"
4125 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4126 (match_operand:SF 2 "general_operand" "f,R"))
4127 (match_operand:SF 3 "const0_operand" "")))
4128 (clobber (match_scratch:SF 0 "=f,f"))]
4129 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4133 [(set_attr "op_type" "RRE,RXE")
4134 (set_attr "type" "fsimps,fsimps")])
4136 (define_insn "*subsf3_ibm"
4137 [(set (match_operand:SF 0 "register_operand" "=f,f")
4138 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4139 (match_operand:SF 2 "general_operand" "f,R")))
4140 (clobber (reg:CC 33))]
4141 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4145 [(set_attr "op_type" "RR,RX")
4146 (set_attr "type" "fsimps,fsimps")])
4150 ;;- Conditional add/subtract instructions.
4154 ; adddicc instruction pattern(s).
4157 (define_insn "*adddi3_alc_cc"
4160 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4161 (match_operand:DI 2 "general_operand" "d,m"))
4162 (match_operand:DI 3 "s390_alc_comparison" ""))
4164 (set (match_operand:DI 0 "register_operand" "=d,d")
4165 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4166 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4170 [(set_attr "op_type" "RRE,RXY")])
4172 (define_insn "*adddi3_alc"
4173 [(set (match_operand:DI 0 "register_operand" "=d,d")
4174 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4175 (match_operand:DI 2 "general_operand" "d,m"))
4176 (match_operand:DI 3 "s390_alc_comparison" "")))
4177 (clobber (reg:CC 33))]
4182 [(set_attr "op_type" "RRE,RXY")])
4184 (define_insn "*subdi3_slb_cc"
4187 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4188 (match_operand:DI 2 "general_operand" "d,m"))
4189 (match_operand:DI 3 "s390_slb_comparison" ""))
4191 (set (match_operand:DI 0 "register_operand" "=d,d")
4192 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4193 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4197 [(set_attr "op_type" "RRE,RXY")])
4199 (define_insn "*subdi3_slb"
4200 [(set (match_operand:DI 0 "register_operand" "=d,d")
4201 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4202 (match_operand:DI 2 "general_operand" "d,m"))
4203 (match_operand:DI 3 "s390_slb_comparison" "")))
4204 (clobber (reg:CC 33))]
4209 [(set_attr "op_type" "RRE,RXY")])
4212 ; addsicc instruction pattern(s).
4215 (define_insn "*addsi3_alc_cc"
4218 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4219 (match_operand:SI 2 "general_operand" "d,m"))
4220 (match_operand:SI 3 "s390_alc_comparison" ""))
4222 (set (match_operand:SI 0 "register_operand" "=d,d")
4223 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4224 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4228 [(set_attr "op_type" "RRE,RXY")])
4230 (define_insn "*addsi3_alc"
4231 [(set (match_operand:SI 0 "register_operand" "=d,d")
4232 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4233 (match_operand:SI 2 "general_operand" "d,m"))
4234 (match_operand:SI 3 "s390_alc_comparison" "")))
4235 (clobber (reg:CC 33))]
4240 [(set_attr "op_type" "RRE,RXY")])
4242 (define_insn "*subsi3_slb_cc"
4245 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4246 (match_operand:SI 2 "general_operand" "d,m"))
4247 (match_operand:SI 3 "s390_slb_comparison" ""))
4249 (set (match_operand:SI 0 "register_operand" "=d,d")
4250 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4251 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4255 [(set_attr "op_type" "RRE,RXY")])
4257 (define_insn "*subsi3_slb"
4258 [(set (match_operand:SI 0 "register_operand" "=d,d")
4259 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4260 (match_operand:SI 2 "general_operand" "d,m"))
4261 (match_operand:SI 3 "s390_slb_comparison" "")))
4262 (clobber (reg:CC 33))]
4267 [(set_attr "op_type" "RRE,RXY")])
4271 ;;- Multiply instructions.
4275 ; muldi3 instruction pattern(s).
4278 (define_insn "*muldi3_sign"
4279 [(set (match_operand:DI 0 "register_operand" "=d,d")
4280 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4281 (match_operand:DI 1 "register_operand" "0,0")))]
4286 [(set_attr "op_type" "RRE,RXY")
4287 (set_attr "type" "imul")])
4289 (define_insn "muldi3"
4290 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4291 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4292 (match_operand:DI 2 "general_operand" "d,K,m")))]
4298 [(set_attr "op_type" "RRE,RI,RXY")
4299 (set_attr "type" "imul")])
4302 ; mulsi3 instruction pattern(s).
4305 (define_insn "*mulsi3_sign"
4306 [(set (match_operand:SI 0 "register_operand" "=d")
4307 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4308 (match_operand:SI 1 "register_operand" "0")))]
4311 [(set_attr "op_type" "RX")
4312 (set_attr "type" "imul")])
4314 (define_insn "mulsi3"
4315 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4316 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4317 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4324 [(set_attr "op_type" "RRE,RI,RX,RXY")
4325 (set_attr "type" "imul")])
4328 ; mulsidi3 instruction pattern(s).
4331 (define_insn "mulsidi3"
4332 [(set (match_operand:DI 0 "register_operand" "=d,d")
4333 (mult:DI (sign_extend:DI
4334 (match_operand:SI 1 "register_operand" "%0,0"))
4336 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4341 [(set_attr "op_type" "RR,RX")
4342 (set_attr "type" "imul")])
4345 ; umulsidi3 instruction pattern(s).
4348 (define_insn "umulsidi3"
4349 [(set (match_operand:DI 0 "register_operand" "=d,d")
4350 (mult:DI (zero_extend:DI
4351 (match_operand:SI 1 "register_operand" "%0,0"))
4353 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4354 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4358 [(set_attr "op_type" "RRE,RXY")
4359 (set_attr "type" "imul")])
4362 ; muldf3 instruction pattern(s).
4365 (define_expand "muldf3"
4366 [(set (match_operand:DF 0 "register_operand" "=f,f")
4367 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4368 (match_operand:DF 2 "general_operand" "f,R")))]
4372 (define_insn "*muldf3"
4373 [(set (match_operand:DF 0 "register_operand" "=f,f")
4374 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4375 (match_operand:DF 2 "general_operand" "f,R")))]
4376 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4380 [(set_attr "op_type" "RRE,RXE")
4381 (set_attr "type" "fmuld")])
4383 (define_insn "*muldf3_ibm"
4384 [(set (match_operand:DF 0 "register_operand" "=f,f")
4385 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4386 (match_operand:DF 2 "general_operand" "f,R")))]
4387 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4391 [(set_attr "op_type" "RR,RX")
4392 (set_attr "type" "fmuld")])
4394 (define_insn "*fmadddf"
4395 [(set (match_operand:DF 0 "register_operand" "=f,f")
4396 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4397 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4398 (match_operand:DF 3 "register_operand" "0,0")))]
4399 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4403 [(set_attr "op_type" "RRE,RXE")
4404 (set_attr "type" "fmuld")])
4406 (define_insn "*fmsubdf"
4407 [(set (match_operand:DF 0 "register_operand" "=f,f")
4408 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4409 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4410 (match_operand:DF 3 "register_operand" "0,0")))]
4411 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4415 [(set_attr "op_type" "RRE,RXE")
4416 (set_attr "type" "fmuld")])
4419 ; mulsf3 instruction pattern(s).
4422 (define_expand "mulsf3"
4423 [(set (match_operand:SF 0 "register_operand" "=f,f")
4424 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4425 (match_operand:SF 2 "general_operand" "f,R")))]
4429 (define_insn "*mulsf3"
4430 [(set (match_operand:SF 0 "register_operand" "=f,f")
4431 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4432 (match_operand:SF 2 "general_operand" "f,R")))]
4433 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4437 [(set_attr "op_type" "RRE,RXE")
4438 (set_attr "type" "fmuls")])
4440 (define_insn "*mulsf3_ibm"
4441 [(set (match_operand:SF 0 "register_operand" "=f,f")
4442 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4443 (match_operand:SF 2 "general_operand" "f,R")))]
4444 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4448 [(set_attr "op_type" "RR,RX")
4449 (set_attr "type" "fmuls")])
4451 (define_insn "*fmaddsf"
4452 [(set (match_operand:SF 0 "register_operand" "=f,f")
4453 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4454 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4455 (match_operand:SF 3 "register_operand" "0,0")))]
4456 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4460 [(set_attr "op_type" "RRE,RXE")
4461 (set_attr "type" "fmuls")])
4463 (define_insn "*fmsubsf"
4464 [(set (match_operand:SF 0 "register_operand" "=f,f")
4465 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4466 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4467 (match_operand:SF 3 "register_operand" "0,0")))]
4468 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4472 [(set_attr "op_type" "RRE,RXE")
4473 (set_attr "type" "fmuls")])
4476 ;;- Divide and modulo instructions.
4480 ; divmoddi4 instruction pattern(s).
4483 (define_expand "divmoddi4"
4484 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4485 (div:DI (match_operand:DI 1 "register_operand" "")
4486 (match_operand:DI 2 "general_operand" "")))
4487 (set (match_operand:DI 3 "general_operand" "")
4488 (mod:DI (match_dup 1) (match_dup 2)))])
4489 (clobber (match_dup 4))]
4492 rtx insn, div_equal, mod_equal;
4494 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4495 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4497 operands[4] = gen_reg_rtx(TImode);
4498 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4500 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4502 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4504 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4506 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4511 (define_insn "divmodtidi3"
4512 [(set (match_operand:TI 0 "register_operand" "=d,d")
4515 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4516 (match_operand:DI 2 "general_operand" "d,m")))
4519 (mod:DI (match_dup 1)
4526 [(set_attr "op_type" "RRE,RXY")
4527 (set_attr "type" "idiv")])
4529 (define_insn "divmodtisi3"
4530 [(set (match_operand:TI 0 "register_operand" "=d,d")
4533 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4534 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4537 (mod:DI (match_dup 1)
4538 (sign_extend:DI (match_dup 2))))
4544 [(set_attr "op_type" "RRE,RXY")
4545 (set_attr "type" "idiv")])
4548 ; udivmoddi4 instruction pattern(s).
4551 (define_expand "udivmoddi4"
4552 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4553 (udiv:DI (match_operand:DI 1 "general_operand" "")
4554 (match_operand:DI 2 "nonimmediate_operand" "")))
4555 (set (match_operand:DI 3 "general_operand" "")
4556 (umod:DI (match_dup 1) (match_dup 2)))])
4557 (clobber (match_dup 4))]
4560 rtx insn, div_equal, mod_equal, equal;
4562 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4563 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4564 equal = gen_rtx_IOR (TImode,
4565 gen_rtx_ZERO_EXTEND (TImode, div_equal),
4566 gen_rtx_ASHIFT (TImode,
4567 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4570 operands[4] = gen_reg_rtx(TImode);
4571 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4572 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4573 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4574 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4576 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4578 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4580 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4582 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4584 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4589 (define_insn "udivmodtidi3"
4590 [(set (match_operand:TI 0 "register_operand" "=d,d")
4591 (ior:TI (zero_extend:TI
4593 (udiv:TI (match_operand:TI 1 "register_operand" "0,0")
4595 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4599 (umod:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))
4605 [(set_attr "op_type" "RRE,RXY")
4606 (set_attr "type" "idiv")])
4609 ; divmodsi4 instruction pattern(s).
4612 (define_expand "divmodsi4"
4613 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4614 (div:SI (match_operand:SI 1 "general_operand" "")
4615 (match_operand:SI 2 "nonimmediate_operand" "")))
4616 (set (match_operand:SI 3 "general_operand" "")
4617 (mod:SI (match_dup 1) (match_dup 2)))])
4618 (clobber (match_dup 4))]
4621 rtx insn, div_equal, mod_equal, equal;
4623 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4624 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4625 equal = gen_rtx_IOR (DImode,
4626 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4627 gen_rtx_ASHIFT (DImode,
4628 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4631 operands[4] = gen_reg_rtx(DImode);
4632 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4633 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4635 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4637 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4639 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4641 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4643 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4648 (define_insn "divmoddisi3"
4649 [(set (match_operand:DI 0 "register_operand" "=d,d")
4650 (ior:DI (zero_extend:DI
4652 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4654 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4658 (mod:DI (match_dup 1) (sign_extend:SI (match_dup 2)))))
4664 [(set_attr "op_type" "RR,RX")
4665 (set_attr "type" "idiv")])
4668 ; udivsi3 and umodsi3 instruction pattern(s).
4671 (define_expand "udivmodsi4"
4672 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4673 (udiv:SI (match_operand:SI 1 "general_operand" "")
4674 (match_operand:SI 2 "nonimmediate_operand" "")))
4675 (set (match_operand:SI 3 "general_operand" "")
4676 (umod:SI (match_dup 1) (match_dup 2)))])
4677 (clobber (match_dup 4))]
4678 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4680 rtx insn, div_equal, mod_equal, equal;
4682 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4683 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4684 equal = gen_rtx_IOR (DImode,
4685 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4686 gen_rtx_ASHIFT (DImode,
4687 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4690 operands[4] = gen_reg_rtx(DImode);
4691 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4692 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4693 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4694 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4696 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4698 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4700 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4702 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4704 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4709 (define_insn "udivmoddisi3"
4710 [(set (match_operand:DI 0 "register_operand" "=d,d")
4711 (ior:DI (zero_extend:DI
4713 (udiv:DI (match_operand:DI 1 "register_operand" "0,0")
4715 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4719 (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))
4721 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4725 [(set_attr "op_type" "RRE,RXY")
4726 (set_attr "type" "idiv")])
4728 (define_expand "udivsi3"
4729 [(set (match_operand:SI 0 "register_operand" "=d")
4730 (udiv:SI (match_operand:SI 1 "general_operand" "")
4731 (match_operand:SI 2 "general_operand" "")))
4732 (clobber (match_dup 3))]
4733 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4735 rtx insn, udiv_equal, umod_equal, equal;
4737 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4738 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4739 equal = gen_rtx_IOR (DImode,
4740 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4741 gen_rtx_ASHIFT (DImode,
4742 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4745 operands[3] = gen_reg_rtx (DImode);
4747 if (CONSTANT_P (operands[2]))
4749 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4751 rtx label1 = gen_label_rtx ();
4753 operands[1] = make_safe_from (operands[1], operands[0]);
4754 emit_move_insn (operands[0], const0_rtx);
4755 emit_insn (gen_cmpsi (operands[1], operands[2]));
4756 emit_jump_insn (gen_bltu (label1));
4757 emit_move_insn (operands[0], const1_rtx);
4758 emit_label (label1);
4762 operands[2] = force_reg (SImode, operands[2]);
4763 operands[2] = make_safe_from (operands[2], operands[0]);
4765 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4766 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4769 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4771 insn = emit_move_insn (operands[0],
4772 gen_lowpart (SImode, operands[3]));
4774 gen_rtx_EXPR_LIST (REG_EQUAL,
4775 udiv_equal, REG_NOTES (insn));
4780 rtx label1 = gen_label_rtx ();
4781 rtx label2 = gen_label_rtx ();
4782 rtx label3 = gen_label_rtx ();
4784 operands[1] = force_reg (SImode, operands[1]);
4785 operands[1] = make_safe_from (operands[1], operands[0]);
4786 operands[2] = force_reg (SImode, operands[2]);
4787 operands[2] = make_safe_from (operands[2], operands[0]);
4789 emit_move_insn (operands[0], const0_rtx);
4790 emit_insn (gen_cmpsi (operands[2], operands[1]));
4791 emit_jump_insn (gen_bgtu (label3));
4792 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4793 emit_jump_insn (gen_blt (label2));
4794 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4795 emit_jump_insn (gen_beq (label1));
4796 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4797 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4800 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4802 insn = emit_move_insn (operands[0],
4803 gen_lowpart (SImode, operands[3]));
4805 gen_rtx_EXPR_LIST (REG_EQUAL,
4806 udiv_equal, REG_NOTES (insn));
4808 emit_label (label1);
4809 emit_move_insn (operands[0], operands[1]);
4811 emit_label (label2);
4812 emit_move_insn (operands[0], const1_rtx);
4813 emit_label (label3);
4815 emit_move_insn (operands[0], operands[0]);
4819 (define_expand "umodsi3"
4820 [(set (match_operand:SI 0 "register_operand" "=d")
4821 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4822 (match_operand:SI 2 "nonimmediate_operand" "")))
4823 (clobber (match_dup 3))]
4824 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4826 rtx insn, udiv_equal, umod_equal, equal;
4828 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4829 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4830 equal = gen_rtx_IOR (DImode,
4831 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4832 gen_rtx_ASHIFT (DImode,
4833 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4836 operands[3] = gen_reg_rtx (DImode);
4838 if (CONSTANT_P (operands[2]))
4840 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4842 rtx label1 = gen_label_rtx ();
4844 operands[1] = make_safe_from (operands[1], operands[0]);
4845 emit_move_insn (operands[0], operands[1]);
4846 emit_insn (gen_cmpsi (operands[0], operands[2]));
4847 emit_jump_insn (gen_bltu (label1));
4848 emit_insn (gen_abssi2 (operands[0], operands[2]));
4849 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4850 emit_label (label1);
4854 operands[2] = force_reg (SImode, operands[2]);
4855 operands[2] = make_safe_from (operands[2], operands[0]);
4857 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4858 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4861 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4863 insn = emit_move_insn (operands[0],
4864 gen_highpart (SImode, operands[3]));
4866 gen_rtx_EXPR_LIST (REG_EQUAL,
4867 umod_equal, REG_NOTES (insn));
4872 rtx label1 = gen_label_rtx ();
4873 rtx label2 = gen_label_rtx ();
4874 rtx label3 = gen_label_rtx ();
4876 operands[1] = force_reg (SImode, operands[1]);
4877 operands[1] = make_safe_from (operands[1], operands[0]);
4878 operands[2] = force_reg (SImode, operands[2]);
4879 operands[2] = make_safe_from (operands[2], operands[0]);
4881 emit_move_insn(operands[0], operands[1]);
4882 emit_insn (gen_cmpsi (operands[2], operands[1]));
4883 emit_jump_insn (gen_bgtu (label3));
4884 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4885 emit_jump_insn (gen_blt (label2));
4886 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4887 emit_jump_insn (gen_beq (label1));
4888 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4889 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4892 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4894 insn = emit_move_insn (operands[0],
4895 gen_highpart (SImode, operands[3]));
4897 gen_rtx_EXPR_LIST (REG_EQUAL,
4898 umod_equal, REG_NOTES (insn));
4900 emit_label (label1);
4901 emit_move_insn (operands[0], const0_rtx);
4903 emit_label (label2);
4904 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4905 emit_label (label3);
4911 ; divdf3 instruction pattern(s).
4914 (define_expand "divdf3"
4915 [(set (match_operand:DF 0 "register_operand" "=f,f")
4916 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4917 (match_operand:DF 2 "general_operand" "f,R")))]
4921 (define_insn "*divdf3"
4922 [(set (match_operand:DF 0 "register_operand" "=f,f")
4923 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4924 (match_operand:DF 2 "general_operand" "f,R")))]
4925 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4929 [(set_attr "op_type" "RRE,RXE")
4930 (set_attr "type" "fdivd")])
4932 (define_insn "*divdf3_ibm"
4933 [(set (match_operand:DF 0 "register_operand" "=f,f")
4934 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4935 (match_operand:DF 2 "general_operand" "f,R")))]
4936 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4940 [(set_attr "op_type" "RR,RX")
4941 (set_attr "type" "fdivd")])
4944 ; divsf3 instruction pattern(s).
4947 (define_expand "divsf3"
4948 [(set (match_operand:SF 0 "register_operand" "=f,f")
4949 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4950 (match_operand:SF 2 "general_operand" "f,R")))]
4954 (define_insn "*divsf3"
4955 [(set (match_operand:SF 0 "register_operand" "=f,f")
4956 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4957 (match_operand:SF 2 "general_operand" "f,R")))]
4958 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4962 [(set_attr "op_type" "RRE,RXE")
4963 (set_attr "type" "fdivs")])
4965 (define_insn "*divsf3"
4966 [(set (match_operand:SF 0 "register_operand" "=f,f")
4967 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4968 (match_operand:SF 2 "general_operand" "f,R")))]
4969 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4973 [(set_attr "op_type" "RR,RX")
4974 (set_attr "type" "fdivs")])
4978 ;;- And instructions.
4982 ; anddi3 instruction pattern(s).
4985 (define_insn "*anddi3_cc"
4987 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4988 (match_operand:DI 2 "general_operand" "d,m"))
4990 (set (match_operand:DI 0 "register_operand" "=d,d")
4991 (and:DI (match_dup 1) (match_dup 2)))]
4992 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4996 [(set_attr "op_type" "RRE,RXY")])
4998 (define_insn "*anddi3_cconly"
5000 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5001 (match_operand:DI 2 "general_operand" "d,m"))
5003 (clobber (match_scratch:DI 0 "=d,d"))]
5004 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5008 [(set_attr "op_type" "RRE,RXY")])
5010 (define_insn "*anddi3_ni"
5011 [(set (match_operand:DI 0 "register_operand" "=d")
5012 (and:DI (match_operand:DI 1 "nonimmediate_operand" "0")
5013 (match_operand:DI 2 "immediate_operand" "n")))
5014 (clobber (reg:CC 33))]
5015 "TARGET_64BIT && s390_single_hi (operands[2], DImode, -1) >= 0"
5017 int part = s390_single_hi (operands[2], DImode, -1);
5018 operands[2] = GEN_INT (s390_extract_hi (operands[2], DImode, part));
5022 case 0: return "nihh\t%0,%x2";
5023 case 1: return "nihl\t%0,%x2";
5024 case 2: return "nilh\t%0,%x2";
5025 case 3: return "nill\t%0,%x2";
5029 [(set_attr "op_type" "RI")])
5031 (define_insn "anddi3"
5032 [(set (match_operand:DI 0 "register_operand" "=d,d")
5033 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5034 (match_operand:DI 2 "general_operand" "d,m")))
5035 (clobber (reg:CC 33))]
5040 [(set_attr "op_type" "RRE,RXY")])
5042 (define_insn "*anddi3_ss"
5043 [(set (match_operand:DI 0 "s_operand" "=Q")
5044 (and:DI (match_dup 0)
5045 (match_operand:DI 1 "s_imm_operand" "Q")))
5046 (clobber (reg:CC 33))]
5049 [(set_attr "op_type" "SS")])
5051 (define_insn "*anddi3_ss_inv"
5052 [(set (match_operand:DI 0 "s_operand" "=Q")
5053 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5055 (clobber (reg:CC 33))]
5058 [(set_attr "op_type" "SS")])
5061 ; andsi3 instruction pattern(s).
5064 (define_insn "*andsi3_cc"
5066 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5067 (match_operand:SI 2 "general_operand" "d,R,T"))
5069 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5070 (and:SI (match_dup 1) (match_dup 2)))]
5071 "s390_match_ccmode(insn, CCTmode)"
5076 [(set_attr "op_type" "RR,RX,RXY")])
5078 (define_insn "*andsi3_cconly"
5080 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5081 (match_operand:SI 2 "general_operand" "d,R,T"))
5083 (clobber (match_scratch:SI 0 "=d,d,d"))]
5084 "s390_match_ccmode(insn, CCTmode)"
5089 [(set_attr "op_type" "RR,RX,RXY")])
5091 (define_insn "*andsi3_ni"
5092 [(set (match_operand:SI 0 "register_operand" "=d")
5093 (and:SI (match_operand:SI 1 "nonimmediate_operand" "0")
5094 (match_operand:SI 2 "immediate_operand" "n")))
5095 (clobber (reg:CC 33))]
5096 "TARGET_ZARCH && s390_single_hi (operands[2], SImode, -1) >= 0"
5098 int part = s390_single_hi (operands[2], SImode, -1);
5099 operands[2] = GEN_INT (s390_extract_hi (operands[2], SImode, part));
5103 case 0: return "nilh\t%0,%x2";
5104 case 1: return "nill\t%0,%x2";
5108 [(set_attr "op_type" "RI")])
5110 (define_insn "andsi3"
5111 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5112 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5113 (match_operand:SI 2 "general_operand" "d,R,T")))
5114 (clobber (reg:CC 33))]
5120 [(set_attr "op_type" "RR,RX,RXY")])
5122 (define_insn "*andsi3_ss"
5123 [(set (match_operand:SI 0 "s_operand" "=Q")
5124 (and:SI (match_dup 0)
5125 (match_operand:SI 1 "s_imm_operand" "Q")))
5126 (clobber (reg:CC 33))]
5129 [(set_attr "op_type" "SS")])
5131 (define_insn "*andsi3_ss_inv"
5132 [(set (match_operand:SI 0 "s_operand" "=Q")
5133 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5135 (clobber (reg:CC 33))]
5138 [(set_attr "op_type" "SS")])
5141 ; andhi3 instruction pattern(s).
5144 (define_insn "*andhi3_ni"
5145 [(set (match_operand:HI 0 "register_operand" "=d,d")
5146 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5147 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5148 (clobber (reg:CC 33))]
5153 [(set_attr "op_type" "RR,RI")])
5155 (define_insn "andhi3"
5156 [(set (match_operand:HI 0 "register_operand" "=d")
5157 (and:HI (match_operand:HI 1 "register_operand" "%0")
5158 (match_operand:HI 2 "nonmemory_operand" "d")))
5159 (clobber (reg:CC 33))]
5162 [(set_attr "op_type" "RR")])
5164 (define_insn "*andhi3_ss"
5165 [(set (match_operand:HI 0 "s_operand" "=Q")
5166 (and:HI (match_dup 0)
5167 (match_operand:HI 1 "s_imm_operand" "Q")))
5168 (clobber (reg:CC 33))]
5171 [(set_attr "op_type" "SS")])
5173 (define_insn "*andhi3_ss_inv"
5174 [(set (match_operand:HI 0 "s_operand" "=Q")
5175 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5177 (clobber (reg:CC 33))]
5180 [(set_attr "op_type" "SS")])
5183 ; andqi3 instruction pattern(s).
5186 (define_insn "*andqi3_ni"
5187 [(set (match_operand:QI 0 "register_operand" "=d,d")
5188 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5189 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5190 (clobber (reg:CC 33))]
5195 [(set_attr "op_type" "RR,RI")])
5197 (define_insn "andqi3"
5198 [(set (match_operand:QI 0 "register_operand" "=d")
5199 (and:QI (match_operand:QI 1 "register_operand" "%0")
5200 (match_operand:QI 2 "nonmemory_operand" "d")))
5201 (clobber (reg:CC 33))]
5204 [(set_attr "op_type" "RR")])
5206 (define_insn "*andqi3_ss"
5207 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5208 (and:QI (match_dup 0)
5209 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5210 (clobber (reg:CC 33))]
5216 [(set_attr "op_type" "SI,SIY,SS")])
5218 (define_insn "*andqi3_ss_inv"
5219 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5220 (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5222 (clobber (reg:CC 33))]
5228 [(set_attr "op_type" "SI,SIY,SS")])
5232 ;;- Bit set (inclusive or) instructions.
5236 ; iordi3 instruction pattern(s).
5239 (define_insn "*iordi3_cc"
5241 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5242 (match_operand:DI 2 "general_operand" "d,m"))
5244 (set (match_operand:DI 0 "register_operand" "=d,d")
5245 (ior:DI (match_dup 1) (match_dup 2)))]
5246 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5250 [(set_attr "op_type" "RRE,RXY")])
5252 (define_insn "*iordi3_cconly"
5254 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5255 (match_operand:DI 2 "general_operand" "d,m"))
5257 (clobber (match_scratch:DI 0 "=d,d"))]
5258 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5262 [(set_attr "op_type" "RRE,RXY")])
5264 (define_insn "*iordi3_oi"
5265 [(set (match_operand:DI 0 "register_operand" "=d")
5266 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0")
5267 (match_operand:DI 2 "immediate_operand" "n")))
5268 (clobber (reg:CC 33))]
5269 "TARGET_64BIT && s390_single_hi (operands[2], DImode, 0) >= 0"
5271 int part = s390_single_hi (operands[2], DImode, 0);
5272 operands[2] = GEN_INT (s390_extract_hi (operands[2], DImode, part));
5276 case 0: return "oihh\t%0,%x2";
5277 case 1: return "oihl\t%0,%x2";
5278 case 2: return "oilh\t%0,%x2";
5279 case 3: return "oill\t%0,%x2";
5283 [(set_attr "op_type" "RI")])
5285 (define_insn "iordi3"
5286 [(set (match_operand:DI 0 "register_operand" "=d,d")
5287 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5288 (match_operand:DI 2 "general_operand" "d,m")))
5289 (clobber (reg:CC 33))]
5294 [(set_attr "op_type" "RRE,RXY")])
5296 (define_insn "*iordi3_ss"
5297 [(set (match_operand:DI 0 "s_operand" "=Q")
5298 (ior:DI (match_dup 0)
5299 (match_operand:DI 1 "s_imm_operand" "Q")))
5300 (clobber (reg:CC 33))]
5303 [(set_attr "op_type" "SS")])
5305 (define_insn "*iordi3_ss_inv"
5306 [(set (match_operand:DI 0 "s_operand" "=Q")
5307 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5309 (clobber (reg:CC 33))]
5312 [(set_attr "op_type" "SS")])
5315 ; iorsi3 instruction pattern(s).
5318 (define_insn "*iorsi3_cc"
5320 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5321 (match_operand:SI 2 "general_operand" "d,R,T"))
5323 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5324 (ior:SI (match_dup 1) (match_dup 2)))]
5325 "s390_match_ccmode(insn, CCTmode)"
5330 [(set_attr "op_type" "RR,RX,RXY")])
5332 (define_insn "*iorsi3_cconly"
5334 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5335 (match_operand:SI 2 "general_operand" "d,R,T"))
5337 (clobber (match_scratch:SI 0 "=d,d,d"))]
5338 "s390_match_ccmode(insn, CCTmode)"
5343 [(set_attr "op_type" "RR,RX,RXY")])
5345 (define_insn "*iorsi3_oi"
5346 [(set (match_operand:SI 0 "register_operand" "=d")
5347 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0")
5348 (match_operand:SI 2 "immediate_operand" "n")))
5349 (clobber (reg:CC 33))]
5350 "TARGET_ZARCH && s390_single_hi (operands[2], SImode, 0) >= 0"
5352 int part = s390_single_hi (operands[2], SImode, 0);
5353 operands[2] = GEN_INT (s390_extract_hi (operands[2], SImode, part));
5357 case 0: return "oilh\t%0,%x2";
5358 case 1: return "oill\t%0,%x2";
5362 [(set_attr "op_type" "RI")])
5364 (define_insn "iorsi3"
5365 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5366 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5367 (match_operand:SI 2 "general_operand" "d,R,T")))
5368 (clobber (reg:CC 33))]
5374 [(set_attr "op_type" "RR,RX,RXY")])
5376 (define_insn "*iorsi3_ss"
5377 [(set (match_operand:SI 0 "s_operand" "=Q")
5378 (ior:SI (match_dup 0)
5379 (match_operand:SI 1 "s_imm_operand" "Q")))
5380 (clobber (reg:CC 33))]
5383 [(set_attr "op_type" "SS")])
5385 (define_insn "*iorsi3_ss_inv"
5386 [(set (match_operand:SI 0 "s_operand" "=Q")
5387 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5389 (clobber (reg:CC 33))]
5392 [(set_attr "op_type" "SS")])
5395 ; iorhi3 instruction pattern(s).
5398 (define_insn "*iorhi3_oi"
5399 [(set (match_operand:HI 0 "register_operand" "=d,d")
5400 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5401 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5402 (clobber (reg:CC 33))]
5407 [(set_attr "op_type" "RR,RI")])
5409 (define_insn "iorhi3"
5410 [(set (match_operand:HI 0 "register_operand" "=d")
5411 (ior:HI (match_operand:HI 1 "register_operand" "%0")
5412 (match_operand:HI 2 "nonmemory_operand" "d")))
5413 (clobber (reg:CC 33))]
5416 [(set_attr "op_type" "RR")])
5418 (define_insn "*iorhi3_ss"
5419 [(set (match_operand:HI 0 "s_operand" "=Q")
5420 (ior:HI (match_dup 0)
5421 (match_operand:HI 1 "s_imm_operand" "Q")))
5422 (clobber (reg:CC 33))]
5425 [(set_attr "op_type" "SS")])
5427 (define_insn "*iorhi3_ss_inv"
5428 [(set (match_operand:HI 0 "s_operand" "=Q")
5429 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5431 (clobber (reg:CC 33))]
5434 [(set_attr "op_type" "SS")])
5437 ; iorqi3 instruction pattern(s).
5440 (define_insn "*iorqi3_oi"
5441 [(set (match_operand:QI 0 "register_operand" "=d,d")
5442 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5443 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5444 (clobber (reg:CC 33))]
5449 [(set_attr "op_type" "RR,RI")])
5451 (define_insn "iorqi3"
5452 [(set (match_operand:QI 0 "register_operand" "=d")
5453 (ior:QI (match_operand:QI 1 "register_operand" "%0")
5454 (match_operand:QI 2 "nonmemory_operand" "d")))
5455 (clobber (reg:CC 33))]
5458 [(set_attr "op_type" "RR")])
5460 (define_insn "*iorqi3_ss"
5461 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5462 (ior:QI (match_dup 0)
5463 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5464 (clobber (reg:CC 33))]
5470 [(set_attr "op_type" "SI,SIY,SS")])
5472 (define_insn "*iorqi3_ss_inv"
5473 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5474 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5476 (clobber (reg:CC 33))]
5482 [(set_attr "op_type" "SI,SIY,SS")])
5486 ;;- Xor instructions.
5490 ; xordi3 instruction pattern(s).
5493 (define_insn "*xordi3_cc"
5495 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5496 (match_operand:DI 2 "general_operand" "d,m"))
5498 (set (match_operand:DI 0 "register_operand" "=d,d")
5499 (xor:DI (match_dup 1) (match_dup 2)))]
5500 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5504 [(set_attr "op_type" "RRE,RXY")])
5506 (define_insn "*xordi3_cconly"
5508 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5509 (match_operand:DI 2 "general_operand" "d,m"))
5511 (clobber (match_scratch:DI 0 "=d,d"))]
5512 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5516 [(set_attr "op_type" "RRE,RXY")])
5518 (define_insn "xordi3"
5519 [(set (match_operand:DI 0 "register_operand" "=d,d")
5520 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5521 (match_operand:DI 2 "general_operand" "d,m")))
5522 (clobber (reg:CC 33))]
5527 [(set_attr "op_type" "RRE,RXY")])
5529 (define_insn "*xordi3_ss"
5530 [(set (match_operand:DI 0 "s_operand" "=Q")
5531 (xor:DI (match_dup 0)
5532 (match_operand:DI 1 "s_imm_operand" "Q")))
5533 (clobber (reg:CC 33))]
5536 [(set_attr "op_type" "SS")])
5538 (define_insn "*xordi3_ss_inv"
5539 [(set (match_operand:DI 0 "s_operand" "=Q")
5540 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5542 (clobber (reg:CC 33))]
5545 [(set_attr "op_type" "SS")])
5548 ; xorsi3 instruction pattern(s).
5551 (define_insn "*xorsi3_cc"
5553 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5554 (match_operand:SI 2 "general_operand" "d,R,T"))
5556 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5557 (xor:SI (match_dup 1) (match_dup 2)))]
5558 "s390_match_ccmode(insn, CCTmode)"
5563 [(set_attr "op_type" "RR,RX,RXY")])
5565 (define_insn "*xorsi3_cconly"
5567 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5568 (match_operand:SI 2 "general_operand" "d,R,T"))
5570 (clobber (match_scratch:SI 0 "=d,d,d"))]
5571 "s390_match_ccmode(insn, CCTmode)"
5576 [(set_attr "op_type" "RR,RX,RXY")])
5578 (define_insn "xorsi3"
5579 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5580 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5581 (match_operand:SI 2 "general_operand" "d,R,T")))
5582 (clobber (reg:CC 33))]
5588 [(set_attr "op_type" "RR,RX,RXY")])
5590 (define_insn "*xorsi3_ss"
5591 [(set (match_operand:SI 0 "s_operand" "=Q")
5592 (xor:SI (match_dup 0)
5593 (match_operand:SI 1 "s_imm_operand" "Q")))
5594 (clobber (reg:CC 33))]
5597 [(set_attr "op_type" "SS")])
5599 (define_insn "*xorsi3_ss_inv"
5600 [(set (match_operand:SI 0 "s_operand" "=Q")
5601 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5603 (clobber (reg:CC 33))]
5606 [(set_attr "op_type" "SS")])
5609 ; xorhi3 instruction pattern(s).
5612 (define_insn "xorhi3"
5613 [(set (match_operand:HI 0 "register_operand" "=d")
5614 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5615 (match_operand:HI 2 "nonmemory_operand" "d")))
5616 (clobber (reg:CC 33))]
5619 [(set_attr "op_type" "RR")])
5621 (define_insn "*xorhi3_ss"
5622 [(set (match_operand:HI 0 "s_operand" "=Q")
5623 (xor:HI (match_dup 0)
5624 (match_operand:HI 1 "s_imm_operand" "Q")))
5625 (clobber (reg:CC 33))]
5628 [(set_attr "op_type" "SS")])
5630 (define_insn "*xorhi3_ss_inv"
5631 [(set (match_operand:HI 0 "s_operand" "=Q")
5632 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5634 (clobber (reg:CC 33))]
5637 [(set_attr "op_type" "SS")])
5640 ; xorqi3 instruction pattern(s).
5643 (define_insn "xorqi3"
5644 [(set (match_operand:QI 0 "register_operand" "=d")
5645 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5646 (match_operand:QI 2 "nonmemory_operand" "d")))
5647 (clobber (reg:CC 33))]
5650 [(set_attr "op_type" "RR")])
5652 (define_insn "*xorqi3_ss"
5653 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5654 (xor:QI (match_dup 0)
5655 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5656 (clobber (reg:CC 33))]
5662 [(set_attr "op_type" "SI,SIY,SS")])
5664 (define_insn "*xorqi3_ss_inv"
5665 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5666 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5668 (clobber (reg:CC 33))]
5674 [(set_attr "op_type" "SI,SIY,SS")])
5678 ;;- Negate instructions.
5682 ; negdi2 instruction pattern(s).
5685 (define_expand "negdi2"
5687 [(set (match_operand:DI 0 "register_operand" "=d")
5688 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5689 (clobber (reg:CC 33))])]
5693 (define_insn "*negdi2_64"
5694 [(set (match_operand:DI 0 "register_operand" "=d")
5695 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5696 (clobber (reg:CC 33))]
5699 [(set_attr "op_type" "RR")])
5701 (define_insn "*negdi2_31"
5702 [(set (match_operand:DI 0 "register_operand" "=d")
5703 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5704 (clobber (reg:CC 33))]
5708 xop[0] = gen_label_rtx ();
5709 output_asm_insn ("lcr\t%0,%1", operands);
5710 output_asm_insn ("lcr\t%N0,%N1", operands);
5711 output_asm_insn ("je\t%l0", xop);
5712 output_asm_insn ("bctr\t%0,0", operands);
5713 targetm.asm_out.internal_label (asm_out_file, "L",
5714 CODE_LABEL_NUMBER (xop[0]));
5717 [(set_attr "op_type" "NN")
5718 (set_attr "type" "other")
5719 (set_attr "length" "10")])
5722 ; negsi2 instruction pattern(s).
5725 (define_insn "negsi2"
5726 [(set (match_operand:SI 0 "register_operand" "=d")
5727 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5728 (clobber (reg:CC 33))]
5731 [(set_attr "op_type" "RR")])
5734 ; negdf2 instruction pattern(s).
5737 (define_expand "negdf2"
5739 [(set (match_operand:DF 0 "register_operand" "=f")
5740 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5741 (clobber (reg:CC 33))])]
5745 (define_insn "*negdf2"
5746 [(set (match_operand:DF 0 "register_operand" "=f")
5747 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5748 (clobber (reg:CC 33))]
5749 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5751 [(set_attr "op_type" "RRE")
5752 (set_attr "type" "fsimpd")])
5754 (define_insn "*negdf2_ibm"
5755 [(set (match_operand:DF 0 "register_operand" "=f")
5756 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5757 (clobber (reg:CC 33))]
5758 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5760 [(set_attr "op_type" "RR")
5761 (set_attr "type" "fsimpd")])
5764 ; negsf2 instruction pattern(s).
5767 (define_expand "negsf2"
5769 [(set (match_operand:SF 0 "register_operand" "=f")
5770 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5771 (clobber (reg:CC 33))])]
5775 (define_insn "*negsf2"
5776 [(set (match_operand:SF 0 "register_operand" "=f")
5777 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5778 (clobber (reg:CC 33))]
5779 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5781 [(set_attr "op_type" "RRE")
5782 (set_attr "type" "fsimps")])
5784 (define_insn "*negsf2"
5785 [(set (match_operand:SF 0 "register_operand" "=f")
5786 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5787 (clobber (reg:CC 33))]
5788 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5790 [(set_attr "op_type" "RR")
5791 (set_attr "type" "fsimps")])
5795 ;;- Absolute value instructions.
5799 ; absdi2 instruction pattern(s).
5802 (define_insn "absdi2"
5803 [(set (match_operand:DI 0 "register_operand" "=d")
5804 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5805 (clobber (reg:CC 33))]
5808 [(set_attr "op_type" "RRE")])
5811 ; abssi2 instruction pattern(s).
5814 (define_insn "abssi2"
5815 [(set (match_operand:SI 0 "register_operand" "=d")
5816 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5817 (clobber (reg:CC 33))]
5820 [(set_attr "op_type" "RR")])
5823 ; absdf2 instruction pattern(s).
5826 (define_expand "absdf2"
5828 [(set (match_operand:DF 0 "register_operand" "=f")
5829 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5830 (clobber (reg:CC 33))])]
5834 (define_insn "*absdf2"
5835 [(set (match_operand:DF 0 "register_operand" "=f")
5836 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5837 (clobber (reg:CC 33))]
5838 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5840 [(set_attr "op_type" "RRE")
5841 (set_attr "type" "fsimpd")])
5843 (define_insn "*absdf2_ibm"
5844 [(set (match_operand:DF 0 "register_operand" "=f")
5845 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5846 (clobber (reg:CC 33))]
5847 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5849 [(set_attr "op_type" "RR")
5850 (set_attr "type" "fsimpd")])
5853 ; abssf2 instruction pattern(s).
5856 (define_expand "abssf2"
5858 [(set (match_operand:SF 0 "register_operand" "=f")
5859 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5860 (clobber (reg:CC 33))])]
5864 (define_insn "*abssf2"
5865 [(set (match_operand:SF 0 "register_operand" "=f")
5866 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5867 (clobber (reg:CC 33))]
5868 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5870 [(set_attr "op_type" "RRE")
5871 (set_attr "type" "fsimps")])
5873 (define_insn "*abssf2_ibm"
5874 [(set (match_operand:SF 0 "register_operand" "=f")
5875 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5876 (clobber (reg:CC 33))]
5877 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5879 [(set_attr "op_type" "RR")
5880 (set_attr "type" "fsimps")])
5883 ;;- Negated absolute value instructions
5890 (define_insn "*negabssi2"
5891 [(set (match_operand:SI 0 "register_operand" "=d")
5892 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
5893 (clobber (reg:CC 33))]
5896 [(set_attr "op_type" "RR")])
5898 (define_insn "*negabsdi2"
5899 [(set (match_operand:DI 0 "register_operand" "=d")
5900 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
5901 (clobber (reg:CC 33))]
5904 [(set_attr "op_type" "RRE")])
5910 (define_insn "*negabssf2"
5911 [(set (match_operand:SF 0 "register_operand" "=f")
5912 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5913 (clobber (reg:CC 33))]
5914 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5916 [(set_attr "op_type" "RRE")
5917 (set_attr "type" "fsimps")])
5919 (define_insn "*negabsdf2"
5920 [(set (match_operand:DF 0 "register_operand" "=f")
5921 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5922 (clobber (reg:CC 33))]
5923 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5925 [(set_attr "op_type" "RRE")
5926 (set_attr "type" "fsimpd")])
5929 ;;- Square root instructions.
5933 ; sqrtdf2 instruction pattern(s).
5936 (define_insn "sqrtdf2"
5937 [(set (match_operand:DF 0 "register_operand" "=f,f")
5938 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
5939 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5943 [(set_attr "op_type" "RRE,RXE")])
5946 ; sqrtsf2 instruction pattern(s).
5949 (define_insn "sqrtsf2"
5950 [(set (match_operand:SF 0 "register_operand" "=f,f")
5951 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
5952 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5956 [(set_attr "op_type" "RRE,RXE")])
5959 ;;- One complement instructions.
5963 ; one_cmpldi2 instruction pattern(s).
5966 (define_expand "one_cmpldi2"
5968 [(set (match_operand:DI 0 "register_operand" "")
5969 (xor:DI (match_operand:DI 1 "register_operand" "")
5971 (clobber (reg:CC 33))])]
5976 ; one_cmplsi2 instruction pattern(s).
5979 (define_expand "one_cmplsi2"
5981 [(set (match_operand:SI 0 "register_operand" "")
5982 (xor:SI (match_operand:SI 1 "register_operand" "")
5984 (clobber (reg:CC 33))])]
5989 ; one_cmplhi2 instruction pattern(s).
5992 (define_expand "one_cmplhi2"
5994 [(set (match_operand:HI 0 "register_operand" "")
5995 (xor:HI (match_operand:HI 1 "register_operand" "")
5997 (clobber (reg:CC 33))])]
6002 ; one_cmplqi2 instruction pattern(s).
6005 (define_expand "one_cmplqi2"
6007 [(set (match_operand:QI 0 "register_operand" "")
6008 (xor:QI (match_operand:QI 1 "register_operand" "")
6010 (clobber (reg:CC 33))])]
6016 ;;- Rotate instructions.
6020 ; rotldi3 instruction pattern(s).
6023 (define_insn "rotldi3"
6024 [(set (match_operand:DI 0 "register_operand" "=d")
6025 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6026 (match_operand:SI 2 "shift_count_operand" "Y")))]
6029 [(set_attr "op_type" "RSE")
6030 (set_attr "atype" "reg")])
6033 ; rotlsi3 instruction pattern(s).
6036 (define_insn "rotlsi3"
6037 [(set (match_operand:SI 0 "register_operand" "=d")
6038 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6039 (match_operand:SI 2 "shift_count_operand" "Y")))]
6042 [(set_attr "op_type" "RSE")
6043 (set_attr "atype" "reg")])
6047 ;;- Arithmetic shift instructions.
6051 ; ashldi3 instruction pattern(s).
6054 (define_expand "ashldi3"
6055 [(set (match_operand:DI 0 "register_operand" "")
6056 (ashift:DI (match_operand:DI 1 "register_operand" "")
6057 (match_operand:SI 2 "shift_count_operand" "")))]
6061 (define_insn "*ashldi3_31"
6062 [(set (match_operand:DI 0 "register_operand" "=d")
6063 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6064 (match_operand:SI 2 "shift_count_operand" "Y")))]
6067 [(set_attr "op_type" "RS")
6068 (set_attr "atype" "reg")])
6070 (define_insn "*ashldi3_64"
6071 [(set (match_operand:DI 0 "register_operand" "=d")
6072 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6073 (match_operand:SI 2 "shift_count_operand" "Y")))]
6076 [(set_attr "op_type" "RSE")
6077 (set_attr "atype" "reg")])
6080 ; ashrdi3 instruction pattern(s).
6083 (define_expand "ashrdi3"
6085 [(set (match_operand:DI 0 "register_operand" "")
6086 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6087 (match_operand:SI 2 "shift_count_operand" "")))
6088 (clobber (reg:CC 33))])]
6092 (define_insn "*ashrdi3_cc_31"
6094 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6095 (match_operand:SI 2 "shift_count_operand" "Y"))
6097 (set (match_operand:DI 0 "register_operand" "=d")
6098 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6099 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6101 [(set_attr "op_type" "RS")
6102 (set_attr "atype" "reg")])
6104 (define_insn "*ashrdi3_cconly_31"
6106 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6107 (match_operand:SI 2 "shift_count_operand" "Y"))
6109 (clobber (match_scratch:DI 0 "=d"))]
6110 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6112 [(set_attr "op_type" "RS")
6113 (set_attr "atype" "reg")])
6115 (define_insn "*ashrdi3_31"
6116 [(set (match_operand:DI 0 "register_operand" "=d")
6117 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6118 (match_operand:SI 2 "shift_count_operand" "Y")))
6119 (clobber (reg:CC 33))]
6122 [(set_attr "op_type" "RS")
6123 (set_attr "atype" "reg")])
6125 (define_insn "*ashrdi3_cc_64"
6127 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6128 (match_operand:SI 2 "shift_count_operand" "Y"))
6130 (set (match_operand:DI 0 "register_operand" "=d")
6131 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6132 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6134 [(set_attr "op_type" "RSE")
6135 (set_attr "atype" "reg")])
6137 (define_insn "*ashrdi3_cconly_64"
6139 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6140 (match_operand:SI 2 "shift_count_operand" "Y"))
6142 (clobber (match_scratch:DI 0 "=d"))]
6143 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6145 [(set_attr "op_type" "RSE")
6146 (set_attr "atype" "reg")])
6148 (define_insn "*ashrdi3_64"
6149 [(set (match_operand:DI 0 "register_operand" "=d")
6150 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6151 (match_operand:SI 2 "shift_count_operand" "Y")))
6152 (clobber (reg:CC 33))]
6155 [(set_attr "op_type" "RSE")
6156 (set_attr "atype" "reg")])
6160 ; ashlsi3 instruction pattern(s).
6163 (define_insn "ashlsi3"
6164 [(set (match_operand:SI 0 "register_operand" "=d")
6165 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6166 (match_operand:SI 2 "shift_count_operand" "Y")))]
6169 [(set_attr "op_type" "RS")
6170 (set_attr "atype" "reg")])
6173 ; ashrsi3 instruction pattern(s).
6176 (define_insn "*ashrsi3_cc"
6178 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6179 (match_operand:SI 2 "shift_count_operand" "Y"))
6181 (set (match_operand:SI 0 "register_operand" "=d")
6182 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6183 "s390_match_ccmode(insn, CCSmode)"
6185 [(set_attr "op_type" "RS")
6186 (set_attr "atype" "reg")])
6189 (define_insn "*ashrsi3_cconly"
6191 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6192 (match_operand:SI 2 "shift_count_operand" "Y"))
6194 (clobber (match_scratch:SI 0 "=d"))]
6195 "s390_match_ccmode(insn, CCSmode)"
6197 [(set_attr "op_type" "RS")
6198 (set_attr "atype" "reg")])
6200 (define_insn "ashrsi3"
6201 [(set (match_operand:SI 0 "register_operand" "=d")
6202 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6203 (match_operand:SI 2 "shift_count_operand" "Y")))
6204 (clobber (reg:CC 33))]
6207 [(set_attr "op_type" "RS")
6208 (set_attr "atype" "reg")])
6212 ;;- logical shift instructions.
6216 ; lshrdi3 instruction pattern(s).
6219 (define_expand "lshrdi3"
6220 [(set (match_operand:DI 0 "register_operand" "")
6221 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6222 (match_operand:SI 2 "shift_count_operand" "")))]
6226 (define_insn "*lshrdi3_31"
6227 [(set (match_operand:DI 0 "register_operand" "=d")
6228 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6229 (match_operand:SI 2 "shift_count_operand" "Y")))]
6232 [(set_attr "op_type" "RS")
6233 (set_attr "atype" "reg")])
6235 (define_insn "*lshrdi3_64"
6236 [(set (match_operand:DI 0 "register_operand" "=d")
6237 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6238 (match_operand:SI 2 "shift_count_operand" "Y")))]
6241 [(set_attr "op_type" "RSE")
6242 (set_attr "atype" "reg")])
6245 ; lshrsi3 instruction pattern(s).
6248 (define_insn "lshrsi3"
6249 [(set (match_operand:SI 0 "register_operand" "=d")
6250 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6251 (match_operand:SI 2 "shift_count_operand" "Y")))]
6254 [(set_attr "op_type" "RS")
6255 (set_attr "atype" "reg")])
6259 ;; Branch instruction patterns.
6262 (define_expand "beq"
6263 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6265 (if_then_else (eq (reg:CCZ 33) (const_int 0))
6266 (label_ref (match_operand 0 "" ""))
6269 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6271 (define_expand "bne"
6272 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6274 (if_then_else (ne (reg:CCZ 33) (const_int 0))
6275 (label_ref (match_operand 0 "" ""))
6278 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6280 (define_expand "bgt"
6281 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6283 (if_then_else (gt (reg:CCS 33) (const_int 0))
6284 (label_ref (match_operand 0 "" ""))
6287 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6289 (define_expand "bgtu"
6290 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6292 (if_then_else (gtu (reg:CCU 33) (const_int 0))
6293 (label_ref (match_operand 0 "" ""))
6296 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6298 (define_expand "blt"
6299 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6301 (if_then_else (lt (reg:CCS 33) (const_int 0))
6302 (label_ref (match_operand 0 "" ""))
6305 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6307 (define_expand "bltu"
6308 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6310 (if_then_else (ltu (reg:CCU 33) (const_int 0))
6311 (label_ref (match_operand 0 "" ""))
6314 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6316 (define_expand "bge"
6317 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6319 (if_then_else (ge (reg:CCS 33) (const_int 0))
6320 (label_ref (match_operand 0 "" ""))
6323 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6325 (define_expand "bgeu"
6326 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6328 (if_then_else (geu (reg:CCU 33) (const_int 0))
6329 (label_ref (match_operand 0 "" ""))
6332 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6334 (define_expand "ble"
6335 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6337 (if_then_else (le (reg:CCS 33) (const_int 0))
6338 (label_ref (match_operand 0 "" ""))
6341 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6343 (define_expand "bleu"
6344 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6346 (if_then_else (leu (reg:CCU 33) (const_int 0))
6347 (label_ref (match_operand 0 "" ""))
6350 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6352 (define_expand "bunordered"
6353 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6355 (if_then_else (unordered (reg:CCS 33) (const_int 0))
6356 (label_ref (match_operand 0 "" ""))
6359 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6361 (define_expand "bordered"
6362 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6364 (if_then_else (ordered (reg:CCS 33) (const_int 0))
6365 (label_ref (match_operand 0 "" ""))
6368 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6370 (define_expand "buneq"
6371 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6373 (if_then_else (uneq (reg:CCS 33) (const_int 0))
6374 (label_ref (match_operand 0 "" ""))
6377 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6379 (define_expand "bungt"
6380 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6382 (if_then_else (ungt (reg:CCS 33) (const_int 0))
6383 (label_ref (match_operand 0 "" ""))
6386 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6388 (define_expand "bunlt"
6389 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6391 (if_then_else (unlt (reg:CCS 33) (const_int 0))
6392 (label_ref (match_operand 0 "" ""))
6395 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6397 (define_expand "bunge"
6398 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6400 (if_then_else (unge (reg:CCS 33) (const_int 0))
6401 (label_ref (match_operand 0 "" ""))
6404 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6406 (define_expand "bunle"
6407 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6409 (if_then_else (unle (reg:CCS 33) (const_int 0))
6410 (label_ref (match_operand 0 "" ""))
6413 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6415 (define_expand "bltgt"
6416 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6418 (if_then_else (ltgt (reg:CCS 33) (const_int 0))
6419 (label_ref (match_operand 0 "" ""))
6422 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6426 ;;- Conditional jump instructions.
6429 (define_insn "cjump"
6432 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6433 (label_ref (match_operand 0 "" ""))
6437 if (get_attr_length (insn) == 4)
6439 else if (TARGET_CPU_ZARCH)
6440 return "jg%C1\t%l0";
6444 [(set_attr "op_type" "RI")
6445 (set_attr "type" "branch")
6446 (set (attr "length")
6447 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6449 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6451 (eq (symbol_ref "flag_pic") (const_int 0))
6452 (const_int 6)] (const_int 8)))])
6454 (define_insn "*cjump_long"
6457 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6458 (match_operand 0 "address_operand" "U")
6462 if (get_attr_op_type (insn) == OP_TYPE_RR)
6467 [(set (attr "op_type")
6468 (if_then_else (match_operand 0 "register_operand" "")
6469 (const_string "RR") (const_string "RX")))
6470 (set_attr "type" "branch")
6471 (set_attr "atype" "agen")])
6475 ;;- Negated conditional jump instructions.
6478 (define_insn "icjump"
6481 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6483 (label_ref (match_operand 0 "" ""))))]
6486 if (get_attr_length (insn) == 4)
6488 else if (TARGET_CPU_ZARCH)
6489 return "jg%D1\t%l0";
6493 [(set_attr "op_type" "RI")
6494 (set_attr "type" "branch")
6495 (set (attr "length")
6496 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6498 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6500 (eq (symbol_ref "flag_pic") (const_int 0))
6501 (const_int 6)] (const_int 8)))])
6503 (define_insn "*icjump_long"
6506 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6508 (match_operand 0 "address_operand" "U")))]
6511 if (get_attr_op_type (insn) == OP_TYPE_RR)
6516 [(set (attr "op_type")
6517 (if_then_else (match_operand 0 "register_operand" "")
6518 (const_string "RR") (const_string "RX")))
6519 (set_attr "type" "branch")
6520 (set_attr "atype" "agen")])
6523 ;;- Trap instructions.
6527 [(trap_if (const_int 1) (const_int 0))]
6530 [(set_attr "op_type" "RX")
6531 (set_attr "type" "branch")])
6533 (define_expand "conditional_trap"
6534 [(set (match_dup 2) (match_dup 3))
6535 (trap_if (match_operator 0 "comparison_operator"
6536 [(match_dup 2) (const_int 0)])
6537 (match_operand:SI 1 "general_operand" ""))]
6540 enum machine_mode ccmode;
6542 if (operands[1] != const0_rtx) FAIL;
6544 ccmode = s390_select_ccmode (GET_CODE (operands[0]),
6545 s390_compare_op0, s390_compare_op1);
6546 operands[2] = gen_rtx_REG (ccmode, 33);
6547 operands[3] = gen_rtx_COMPARE (ccmode, s390_compare_op0, s390_compare_op1);
6550 (define_insn "*trap"
6551 [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6555 [(set_attr "op_type" "RI")
6556 (set_attr "type" "branch")])
6559 ;;- Loop instructions.
6561 ;; This is all complicated by the fact that since this is a jump insn
6562 ;; we must handle our own output reloads.
6564 (define_expand "doloop_end"
6565 [(use (match_operand 0 "" "")) ; loop pseudo
6566 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6567 (use (match_operand 2 "" "")) ; max iterations
6568 (use (match_operand 3 "" "")) ; loop level
6569 (use (match_operand 4 "" ""))] ; label
6572 if (GET_MODE (operands[0]) == SImode)
6573 emit_jump_insn (gen_doloop_si (operands[4], operands[0], operands[0]));
6574 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6575 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6582 (define_insn "doloop_si"
6585 (ne (match_operand:SI 1 "register_operand" "d,d")
6587 (label_ref (match_operand 0 "" ""))
6589 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6590 (plus:SI (match_dup 1) (const_int -1)))
6591 (clobber (match_scratch:SI 3 "=X,&d"))
6592 (clobber (reg:CC 33))]
6595 if (which_alternative != 0)
6597 else if (get_attr_length (insn) == 4)
6598 return "brct\t%1,%l0";
6602 [(set_attr "op_type" "RI")
6603 (set_attr "type" "branch")
6604 (set (attr "length")
6605 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6607 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6609 (eq (symbol_ref "flag_pic") (const_int 0))
6610 (const_int 6)] (const_int 8)))])
6612 (define_insn "*doloop_si_long"
6615 (ne (match_operand:SI 1 "register_operand" "d,d")
6617 (match_operand 0 "address_operand" "U,U")
6619 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6620 (plus:SI (match_dup 1) (const_int -1)))
6621 (clobber (match_scratch:SI 3 "=X,&d"))
6622 (clobber (reg:CC 33))]
6625 if (get_attr_op_type (insn) == OP_TYPE_RR)
6626 return "bctr\t%1,%0";
6628 return "bct\t%1,%a0";
6630 [(set (attr "op_type")
6631 (if_then_else (match_operand 0 "register_operand" "")
6632 (const_string "RR") (const_string "RX")))
6633 (set_attr "type" "branch")
6634 (set_attr "atype" "agen")])
6638 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
6640 (match_operand 0 "" "")
6642 (set (match_operand:SI 2 "nonimmediate_operand" "")
6643 (plus:SI (match_dup 1) (const_int -1)))
6644 (clobber (match_scratch:SI 3 ""))
6645 (clobber (reg:CC 33))]
6647 && (! REG_P (operands[2])
6648 || ! rtx_equal_p (operands[1], operands[2]))"
6649 [(set (match_dup 3) (match_dup 1))
6650 (parallel [(set (reg:CCAN 33)
6651 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6653 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6654 (set (match_dup 2) (match_dup 3))
6655 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6660 (define_insn "doloop_di"
6663 (ne (match_operand:DI 1 "register_operand" "d,d")
6665 (label_ref (match_operand 0 "" ""))
6667 (set (match_operand:DI 2 "register_operand" "=1,?*m*r")
6668 (plus:DI (match_dup 1) (const_int -1)))
6669 (clobber (match_scratch:DI 3 "=X,&d"))
6670 (clobber (reg:CC 33))]
6673 if (which_alternative != 0)
6675 else if (get_attr_length (insn) == 4)
6676 return "brctg\t%1,%l0";
6680 [(set_attr "op_type" "RI")
6681 (set_attr "type" "branch")
6682 (set (attr "length")
6683 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6684 (const_int 4) (const_int 12)))])
6686 (define_insn "*doloop_di_long"
6689 (ne (match_operand:DI 1 "register_operand" "d,d")
6691 (match_operand 0 "address_operand" "U,U")
6693 (set (match_operand:DI 2 "register_operand" "=1,?*m*d")
6694 (plus:DI (match_dup 1) (const_int -1)))
6695 (clobber (match_scratch:DI 3 "=X,&d"))
6696 (clobber (reg:CC 33))]
6699 if (get_attr_op_type (insn) == OP_TYPE_RRE)
6700 return "bctgr\t%1,%0";
6702 return "bctg\t%1,%a0";
6704 [(set (attr "op_type")
6705 (if_then_else (match_operand 0 "register_operand" "")
6706 (const_string "RRE") (const_string "RXE")))
6707 (set_attr "type" "branch")
6708 (set_attr "atype" "agen")])
6712 (if_then_else (ne (match_operand:DI 1 "register_operand" "")
6714 (match_operand 0 "" "")
6716 (set (match_operand:DI 2 "nonimmediate_operand" "")
6717 (plus:DI (match_dup 1) (const_int -1)))
6718 (clobber (match_scratch:DI 3 ""))
6719 (clobber (reg:CC 33))]
6721 && (! REG_P (operands[2])
6722 || ! rtx_equal_p (operands[1], operands[2]))"
6723 [(set (match_dup 3) (match_dup 1))
6724 (parallel [(set (reg:CCAN 33)
6725 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6727 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6728 (set (match_dup 2) (match_dup 3))
6729 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6735 ;;- Unconditional jump instructions.
6739 ; jump instruction pattern(s).
6743 [(set (pc) (label_ref (match_operand 0 "" "")))]
6746 if (get_attr_length (insn) == 4)
6748 else if (TARGET_CPU_ZARCH)
6753 [(set_attr "op_type" "RI")
6754 (set_attr "type" "branch")
6755 (set (attr "length")
6756 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6758 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6760 (eq (symbol_ref "flag_pic") (const_int 0))
6761 (const_int 6)] (const_int 8)))])
6764 ; indirect-jump instruction pattern(s).
6767 (define_insn "indirect_jump"
6768 [(set (pc) (match_operand 0 "address_operand" "U"))]
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")])
6783 ; casesi instruction pattern(s).
6786 (define_insn "casesi_jump"
6787 [(set (pc) (match_operand 0 "address_operand" "U"))
6788 (use (label_ref (match_operand 1 "" "")))]
6791 if (get_attr_op_type (insn) == OP_TYPE_RR)
6796 [(set (attr "op_type")
6797 (if_then_else (match_operand 0 "register_operand" "")
6798 (const_string "RR") (const_string "RX")))
6799 (set_attr "type" "branch")
6800 (set_attr "atype" "agen")])
6802 (define_expand "casesi"
6803 [(match_operand:SI 0 "general_operand" "")
6804 (match_operand:SI 1 "general_operand" "")
6805 (match_operand:SI 2 "general_operand" "")
6806 (label_ref (match_operand 3 "" ""))
6807 (label_ref (match_operand 4 "" ""))]
6810 rtx index = gen_reg_rtx (SImode);
6811 rtx base = gen_reg_rtx (Pmode);
6812 rtx target = gen_reg_rtx (Pmode);
6814 emit_move_insn (index, operands[0]);
6815 emit_insn (gen_subsi3 (index, index, operands[1]));
6816 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6819 if (Pmode != SImode)
6820 index = convert_to_mode (Pmode, index, 1);
6821 if (GET_CODE (index) != REG)
6822 index = copy_to_mode_reg (Pmode, index);
6825 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6827 emit_insn (gen_ashlsi3 (index, index, GEN_INT (2)));
6829 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6831 index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
6832 emit_move_insn (target, index);
6835 target = gen_rtx_PLUS (Pmode, base, target);
6836 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6843 ;;- Jump to subroutine.
6848 ; untyped call instruction pattern(s).
6851 ;; Call subroutine returning any type.
6852 (define_expand "untyped_call"
6853 [(parallel [(call (match_operand 0 "" "")
6855 (match_operand 1 "" "")
6856 (match_operand 2 "" "")])]
6861 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6863 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6865 rtx set = XVECEXP (operands[2], 0, i);
6866 emit_move_insn (SET_DEST (set), SET_SRC (set));
6869 /* The optimizer does not know that the call sets the function value
6870 registers we stored in the result block. We avoid problems by
6871 claiming that all hard registers are used and clobbered at this
6873 emit_insn (gen_blockage ());
6878 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6879 ;; all of memory. This blocks insns from being moved across this point.
6881 (define_insn "blockage"
6882 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6885 [(set_attr "type" "none")
6886 (set_attr "length" "0")])
6891 ; call instruction pattern(s).
6894 (define_expand "call"
6895 [(call (match_operand 0 "" "")
6896 (match_operand 1 "" ""))
6897 (use (match_operand 2 "" ""))]
6900 bool plt_call = false;
6903 /* Direct function calls need special treatment. */
6904 if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
6906 rtx sym = XEXP (operands[0], 0);
6908 /* When calling a global routine in PIC mode, we must
6909 replace the symbol itself with the PLT stub. */
6910 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
6912 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
6913 sym = gen_rtx_CONST (Pmode, sym);
6917 /* Unless we can use the bras(l) insn, force the
6918 routine address into a register. */
6919 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
6922 sym = legitimize_pic_address (sym, 0);
6924 sym = force_reg (Pmode, sym);
6927 operands[0] = gen_rtx_MEM (QImode, sym);
6931 insn = emit_call_insn (gen_call_exp (operands[0], operands[1],
6932 gen_rtx_REG (Pmode, RETURN_REGNUM)));
6934 /* 31-bit PLT stubs use the GOT register implicitly. */
6935 if (!TARGET_64BIT && plt_call)
6936 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
6941 (define_expand "call_exp"
6942 [(parallel [(call (match_operand 0 "" "")
6943 (match_operand 1 "" ""))
6944 (clobber (match_operand 2 "" ""))])]
6948 (define_insn "*bras"
6949 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6950 (match_operand 1 "const_int_operand" "n"))
6951 (clobber (match_operand 2 "register_operand" "=r"))]
6952 "TARGET_SMALL_EXEC && GET_MODE (operands[2]) == Pmode"
6954 [(set_attr "op_type" "RI")
6955 (set_attr "type" "jsr")])
6957 (define_insn "*brasl"
6958 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6959 (match_operand 1 "const_int_operand" "n"))
6960 (clobber (match_operand 2 "register_operand" "=r"))]
6961 "TARGET_CPU_ZARCH && GET_MODE (operands[2]) == Pmode"
6963 [(set_attr "op_type" "RIL")
6964 (set_attr "type" "jsr")])
6966 (define_insn "*basr"
6967 [(call (mem:QI (match_operand 0 "address_operand" "U"))
6968 (match_operand 1 "const_int_operand" "n"))
6969 (clobber (match_operand 2 "register_operand" "=r"))]
6970 "GET_MODE (operands[2]) == Pmode"
6972 if (get_attr_op_type (insn) == OP_TYPE_RR)
6973 return "basr\t%2,%0";
6975 return "bas\t%2,%a0";
6977 [(set (attr "op_type")
6978 (if_then_else (match_operand 0 "register_operand" "")
6979 (const_string "RR") (const_string "RX")))
6980 (set_attr "type" "jsr")
6981 (set_attr "atype" "agen")])
6984 ; call_value instruction pattern(s).
6987 (define_expand "call_value"
6988 [(set (match_operand 0 "" "")
6989 (call (match_operand 1 "" "")
6990 (match_operand 2 "" "")))
6991 (use (match_operand 3 "" ""))]
6994 bool plt_call = false;
6997 /* Direct function calls need special treatment. */
6998 if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
7000 rtx sym = XEXP (operands[1], 0);
7002 /* When calling a global routine in PIC mode, we must
7003 replace the symbol itself with the PLT stub. */
7004 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
7006 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7007 sym = gen_rtx_CONST (Pmode, sym);
7011 /* Unless we can use the bras(l) insn, force the
7012 routine address into a register. */
7013 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7016 sym = legitimize_pic_address (sym, 0);
7018 sym = force_reg (Pmode, sym);
7021 operands[1] = gen_rtx_MEM (QImode, sym);
7025 insn = emit_call_insn (
7026 gen_call_value_exp (operands[0], operands[1], operands[2],
7027 gen_rtx_REG (Pmode, RETURN_REGNUM)));
7029 /* 31-bit PLT stubs use the GOT register implicitly. */
7030 if (!TARGET_64BIT && plt_call)
7031 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7036 (define_expand "call_value_exp"
7037 [(parallel [(set (match_operand 0 "" "")
7038 (call (match_operand 1 "" "")
7039 (match_operand 2 "" "")))
7040 (clobber (match_operand 3 "" ""))])]
7044 (define_insn "*bras_r"
7045 [(set (match_operand 0 "" "")
7046 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7047 (match_operand:SI 2 "const_int_operand" "n")))
7048 (clobber (match_operand 3 "register_operand" "=r"))]
7049 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7051 [(set_attr "op_type" "RI")
7052 (set_attr "type" "jsr")])
7054 (define_insn "*brasl_r"
7055 [(set (match_operand 0 "" "")
7056 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7057 (match_operand 2 "const_int_operand" "n")))
7058 (clobber (match_operand 3 "register_operand" "=r"))]
7059 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7061 [(set_attr "op_type" "RIL")
7062 (set_attr "type" "jsr")])
7064 (define_insn "*basr_r"
7065 [(set (match_operand 0 "" "")
7066 (call (mem:QI (match_operand 1 "address_operand" "U"))
7067 (match_operand 2 "const_int_operand" "n")))
7068 (clobber (match_operand 3 "register_operand" "=r"))]
7069 "GET_MODE (operands[3]) == Pmode"
7071 if (get_attr_op_type (insn) == OP_TYPE_RR)
7072 return "basr\t%3,%1";
7074 return "bas\t%3,%a1";
7076 [(set (attr "op_type")
7077 (if_then_else (match_operand 1 "register_operand" "")
7078 (const_string "RR") (const_string "RX")))
7079 (set_attr "type" "jsr")
7080 (set_attr "atype" "agen")])
7083 ;;- Thread-local storage support.
7086 (define_insn "get_tp_64"
7087 [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7088 (unspec:DI [(const_int 0)] UNSPEC_TP))]
7091 ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7093 [(set_attr "op_type" "NN,RS")
7094 (set_attr "atype" "reg,*")
7095 (set_attr "type" "o3,*")
7096 (set_attr "length" "14,*")])
7098 (define_insn "get_tp_31"
7099 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7100 (unspec:SI [(const_int 0)] UNSPEC_TP))]
7105 [(set_attr "op_type" "RRE,RS")])
7107 (define_insn "set_tp_64"
7108 [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7109 (clobber (match_scratch:SI 1 "=d,X"))]
7112 sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7114 [(set_attr "op_type" "NN,RS")
7115 (set_attr "atype" "reg,*")
7116 (set_attr "type" "o3,*")
7117 (set_attr "length" "14,*")])
7119 (define_insn "set_tp_31"
7120 [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7125 [(set_attr "op_type" "RRE,RS")])
7127 (define_insn "*tls_load_64"
7128 [(set (match_operand:DI 0 "register_operand" "=d")
7129 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7130 (match_operand:DI 2 "" "")]
7134 [(set_attr "op_type" "RXE")])
7136 (define_insn "*tls_load_31"
7137 [(set (match_operand:SI 0 "register_operand" "=d,d")
7138 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7139 (match_operand:SI 2 "" "")]
7145 [(set_attr "op_type" "RX,RXY")])
7147 (define_expand "call_value_tls"
7148 [(set (match_operand 0 "" "")
7149 (call (const_int 0) (const_int 0)))
7150 (use (match_operand 1 "" ""))]
7158 sym = s390_tls_get_offset ();
7159 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7160 sym = gen_rtx_CONST (Pmode, sym);
7162 /* Unless we can use the bras(l) insn, force the
7163 routine address into a register. */
7164 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7167 sym = legitimize_pic_address (sym, 0);
7169 sym = force_reg (Pmode, sym);
7172 sym = gen_rtx_MEM (QImode, sym);
7175 insn = emit_call_insn (
7176 gen_call_value_tls_exp (operands[0], sym, const0_rtx,
7177 gen_rtx_REG (Pmode, RETURN_REGNUM),
7180 /* The calling convention of __tls_get_offset uses the
7181 GOT register implicitly. */
7182 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7183 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), operands[0]);
7184 CONST_OR_PURE_CALL_P (insn) = 1;
7189 (define_expand "call_value_tls_exp"
7190 [(parallel [(set (match_operand 0 "" "")
7191 (call (match_operand 1 "" "")
7192 (match_operand 2 "" "")))
7193 (clobber (match_operand 3 "" ""))
7194 (use (match_operand 4 "" ""))])]
7198 (define_insn "*bras_tls"
7199 [(set (match_operand 0 "" "")
7200 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7201 (match_operand 2 "const_int_operand" "n")))
7202 (clobber (match_operand 3 "register_operand" "=r"))
7203 (use (match_operand 4 "" ""))]
7204 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7206 [(set_attr "op_type" "RI")
7207 (set_attr "type" "jsr")])
7209 (define_insn "*brasl_tls"
7210 [(set (match_operand 0 "" "")
7211 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7212 (match_operand 2 "const_int_operand" "n")))
7213 (clobber (match_operand 3 "register_operand" "=r"))
7214 (use (match_operand 4 "" ""))]
7215 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7217 [(set_attr "op_type" "RIL")
7218 (set_attr "type" "jsr")])
7220 (define_insn "*basr_tls"
7221 [(set (match_operand 0 "" "")
7222 (call (mem:QI (match_operand 1 "address_operand" "U"))
7223 (match_operand 2 "const_int_operand" "n")))
7224 (clobber (match_operand 3 "register_operand" "=r"))
7225 (use (match_operand 4 "" ""))]
7226 "GET_MODE (operands[3]) == Pmode"
7228 if (get_attr_op_type (insn) == OP_TYPE_RR)
7229 return "basr\t%3,%1%J4";
7231 return "bas\t%3,%a1%J4";
7233 [(set (attr "op_type")
7234 (if_then_else (match_operand 1 "register_operand" "")
7235 (const_string "RR") (const_string "RX")))
7236 (set_attr "type" "jsr")
7237 (set_attr "atype" "agen")])
7240 ;;- Miscellaneous instructions.
7244 ; allocate stack instruction pattern(s).
7247 (define_expand "allocate_stack"
7249 (plus (reg 15) (match_operand 1 "general_operand" "")))
7250 (set (match_operand 0 "general_operand" "")
7254 rtx stack = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
7255 rtx chain = gen_rtx (MEM, Pmode, stack);
7256 rtx temp = gen_reg_rtx (Pmode);
7258 emit_move_insn (temp, chain);
7261 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7263 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7265 emit_move_insn (chain, temp);
7267 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7273 ; setjmp instruction pattern.
7276 (define_expand "builtin_setjmp_receiver"
7277 [(match_operand 0 "" "")]
7280 s390_load_got (false);
7281 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7285 ;; These patterns say how to save and restore the stack pointer. We need not
7286 ;; save the stack pointer at function level since we are careful to
7287 ;; preserve the backchain. At block level, we have to restore the backchain
7288 ;; when we restore the stack pointer.
7290 ;; For nonlocal gotos, we must save both the stack pointer and its
7291 ;; backchain and restore both. Note that in the nonlocal case, the
7292 ;; save area is a memory location.
7294 (define_expand "save_stack_function"
7295 [(match_operand 0 "general_operand" "")
7296 (match_operand 1 "general_operand" "")]
7300 (define_expand "restore_stack_function"
7301 [(match_operand 0 "general_operand" "")
7302 (match_operand 1 "general_operand" "")]
7306 (define_expand "restore_stack_block"
7307 [(use (match_operand 0 "register_operand" ""))
7308 (set (match_dup 2) (match_dup 3))
7309 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7310 (set (match_dup 3) (match_dup 2))]
7313 operands[2] = gen_reg_rtx (Pmode);
7314 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7317 (define_expand "save_stack_nonlocal"
7318 [(match_operand 0 "memory_operand" "")
7319 (match_operand 1 "register_operand" "")]
7322 rtx temp = gen_reg_rtx (Pmode);
7324 /* Copy the backchain to the first word, sp to the second and the literal pool
7325 base to the third. */
7326 emit_move_insn (operand_subword (operands[0], 2, 0,
7327 TARGET_64BIT ? OImode : TImode),
7328 gen_rtx_REG (Pmode, BASE_REGISTER));
7329 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7330 emit_move_insn (operand_subword (operands[0], 0, 0,
7331 TARGET_64BIT ? OImode : TImode),
7333 emit_move_insn (operand_subword (operands[0], 1, 0,
7334 TARGET_64BIT ? OImode : TImode),
7339 (define_expand "restore_stack_nonlocal"
7340 [(match_operand 0 "register_operand" "")
7341 (match_operand 1 "memory_operand" "")]
7344 rtx temp = gen_reg_rtx (Pmode);
7345 rtx base = gen_rtx_REG (Pmode, BASE_REGISTER);
7347 /* Restore the backchain from the first word, sp from the second and the
7348 literal pool base from the third. */
7349 emit_move_insn (temp,
7350 operand_subword (operands[1], 0, 0,
7351 TARGET_64BIT ? OImode : TImode));
7352 emit_move_insn (operands[0],
7353 operand_subword (operands[1], 1, 0,
7354 TARGET_64BIT ? OImode : TImode));
7355 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7356 emit_move_insn (base,
7357 operand_subword (operands[1], 2, 0,
7358 TARGET_64BIT ? OImode : TImode));
7359 emit_insn (gen_rtx_USE (VOIDmode, base));
7366 ; nop instruction pattern(s).
7373 [(set_attr "op_type" "RR")])
7377 ; Special literal pool access instruction pattern(s).
7380 (define_insn "*pool_entry"
7381 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7382 UNSPECV_POOL_ENTRY)]
7385 enum machine_mode mode = GET_MODE (PATTERN (insn));
7386 unsigned int align = GET_MODE_BITSIZE (mode);
7387 s390_output_pool_entry (asm_out_file, operands[0], mode, align);
7390 [(set_attr "op_type" "NN")
7391 (set (attr "length")
7392 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7394 (define_insn "pool_start_31"
7395 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7398 [(set_attr "op_type" "NN")
7399 (set_attr "length" "2")])
7401 (define_insn "pool_end_31"
7402 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7405 [(set_attr "op_type" "NN")
7406 (set_attr "length" "2")])
7408 (define_insn "pool_start_64"
7409 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7411 ".section\t.rodata\;.align\t8"
7412 [(set_attr "op_type" "NN")
7413 (set_attr "length" "0")])
7415 (define_insn "pool_end_64"
7416 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7419 [(set_attr "op_type" "NN")
7420 (set_attr "length" "0")])
7422 (define_insn "main_base_31_small"
7423 [(set (match_operand 0 "register_operand" "=a")
7424 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7425 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7427 [(set_attr "op_type" "RR")
7428 (set_attr "type" "la")])
7430 (define_insn "main_base_31_large"
7431 [(set (match_operand 0 "register_operand" "=a")
7432 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7433 (set (pc) (label_ref (match_operand 2 "" "")))]
7434 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7436 [(set_attr "op_type" "RI")])
7438 (define_insn "main_base_64"
7439 [(set (match_operand 0 "register_operand" "=a")
7440 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7441 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7443 [(set_attr "op_type" "RIL")
7444 (set_attr "type" "larl")])
7446 (define_insn "main_pool"
7447 [(unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL)]
7450 [(set_attr "op_type" "NN")])
7452 (define_insn "reload_base_31"
7453 [(set (match_operand 0 "register_operand" "=a")
7454 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7455 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7456 "basr\t%0,0\;la\t%0,%1-.(%0)"
7457 [(set_attr "op_type" "NN")
7458 (set_attr "type" "la")
7459 (set_attr "length" "6")])
7461 (define_insn "reload_base_64"
7462 [(set (match_operand 0 "register_operand" "=a")
7463 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7464 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7466 [(set_attr "op_type" "RIL")
7467 (set_attr "type" "larl")])
7470 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7473 [(set_attr "op_type" "NN")
7474 (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7477 ;; Insns related to generating the function prologue and epilogue.
7481 (define_expand "prologue"
7482 [(use (const_int 0))]
7484 "s390_emit_prologue (); DONE;")
7486 (define_expand "epilogue"
7487 [(use (const_int 1))]
7489 "s390_emit_epilogue (); DONE;")
7491 (define_insn "*return"
7493 (use (match_operand 0 "register_operand" "a"))]
7494 "GET_MODE (operands[0]) == Pmode"
7496 [(set_attr "op_type" "RR")
7497 (set_attr "type" "jsr")
7498 (set_attr "atype" "agen")])
7501 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7502 ;; pointer. This is used for compatability.
7504 (define_expand "ptr_extend"
7505 [(set (match_operand:DI 0 "register_operand" "=r")
7506 (match_operand:SI 1 "register_operand" "r"))]
7509 emit_insn (gen_anddi3 (operands[0],
7510 gen_lowpart (DImode, operands[1]),
7511 GEN_INT (0x7fffffff)));