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 64-bit, zero-extending from memory to register
1360 is just as fast as a QImode load. */
1361 if (TARGET_64BIT && optimize && !no_new_pseudos
1362 && register_operand (operands[0], VOIDmode)
1363 && memory_operand (operands[1], VOIDmode))
1365 rtx tmp = gen_reg_rtx (DImode);
1366 rtx ext = gen_rtx_ZERO_EXTEND (DImode, 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 "" ""))])]
1595 /* Support only loading a constant number of fixed-point registers from
1596 memory and only bother with this if more than two */
1597 if (GET_CODE (operands[2]) != CONST_INT
1598 || INTVAL (operands[2]) < 2
1599 || INTVAL (operands[2]) > 16
1600 || GET_CODE (operands[1]) != MEM
1601 || GET_CODE (operands[0]) != REG
1602 || REGNO (operands[0]) >= 16)
1605 count = INTVAL (operands[2]);
1606 regno = REGNO (operands[0]);
1608 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1611 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1613 from = XEXP (operands[1], 0);
1616 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1617 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1618 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1620 from = XEXP (XEXP (operands[1], 0), 0);
1621 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1626 if (from == frame_pointer_rtx || from == arg_pointer_rtx)
1631 from = force_reg (Pmode, XEXP (operands[1], 0));
1635 for (i = 0; i < count; i++)
1636 XVECEXP (operands[3], 0, i)
1637 = gen_rtx_SET (VOIDmode, gen_rtx_REG (Pmode, regno + i),
1638 change_address (operands[1], Pmode,
1639 plus_constant (from,
1640 off + i * UNITS_PER_WORD)));
1643 (define_insn "*load_multiple_di"
1644 [(match_parallel 0 "load_multiple_operation"
1645 [(set (match_operand:DI 1 "register_operand" "=r")
1646 (match_operand:DI 2 "s_operand" "QS"))])]
1649 int words = XVECLEN (operands[0], 0);
1650 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1651 return "lmg\t%1,%0,%2";
1653 [(set_attr "op_type" "RSY")
1654 (set_attr "type" "lm")])
1656 (define_insn "*load_multiple_si"
1657 [(match_parallel 0 "load_multiple_operation"
1658 [(set (match_operand:SI 1 "register_operand" "=r,r")
1659 (match_operand:SI 2 "s_operand" "Q,S"))])]
1662 int words = XVECLEN (operands[0], 0);
1663 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1664 return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1666 [(set_attr "op_type" "RS,RSY")
1667 (set_attr "type" "lm")])
1670 ; store multiple pattern(s).
1673 (define_expand "store_multiple"
1674 [(match_par_dup 3 [(set (match_operand 0 "" "")
1675 (match_operand 1 "" ""))
1676 (use (match_operand 2 "" ""))])]
1684 /* Support only storing a constant number of fixed-point registers to
1685 memory and only bother with this if more than two. */
1686 if (GET_CODE (operands[2]) != CONST_INT
1687 || INTVAL (operands[2]) < 2
1688 || INTVAL (operands[2]) > 16
1689 || GET_CODE (operands[0]) != MEM
1690 || GET_CODE (operands[1]) != REG
1691 || REGNO (operands[1]) >= 16)
1694 count = INTVAL (operands[2]);
1695 regno = REGNO (operands[1]);
1697 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1701 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1703 to = XEXP (operands[0], 0);
1706 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1707 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1708 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1710 to = XEXP (XEXP (operands[0], 0), 0);
1711 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1716 if (to == frame_pointer_rtx || to == arg_pointer_rtx)
1721 to = force_reg (Pmode, XEXP (operands[0], 0));
1725 for (i = 0; i < count; i++)
1726 XVECEXP (operands[3], 0, i)
1727 = gen_rtx_SET (VOIDmode,
1728 change_address (operands[0], Pmode,
1730 off + i * UNITS_PER_WORD)),
1731 gen_rtx_REG (Pmode, regno + i));
1734 (define_insn "*store_multiple_di"
1735 [(match_parallel 0 "store_multiple_operation"
1736 [(set (match_operand:DI 1 "s_operand" "=QS")
1737 (match_operand:DI 2 "register_operand" "r"))])]
1740 int words = XVECLEN (operands[0], 0);
1741 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1742 return "stmg\t%2,%0,%1";
1744 [(set_attr "op_type" "RSY")
1745 (set_attr "type" "stm")])
1748 (define_insn "*store_multiple_si"
1749 [(match_parallel 0 "store_multiple_operation"
1750 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1751 (match_operand:SI 2 "register_operand" "r,r"))])]
1754 int words = XVECLEN (operands[0], 0);
1755 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1756 return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1758 [(set_attr "op_type" "RS,RSY")
1759 (set_attr "type" "stm")])
1762 ;; String instructions.
1766 ; movstrM instruction pattern(s).
1769 (define_expand "movstrdi"
1770 [(set (match_operand:BLK 0 "memory_operand" "")
1771 (match_operand:BLK 1 "memory_operand" ""))
1772 (use (match_operand:DI 2 "general_operand" ""))
1773 (match_operand 3 "" "")]
1775 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1777 (define_expand "movstrsi"
1778 [(set (match_operand:BLK 0 "memory_operand" "")
1779 (match_operand:BLK 1 "memory_operand" ""))
1780 (use (match_operand:SI 2 "general_operand" ""))
1781 (match_operand 3 "" "")]
1783 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1785 ; Move a block that is up to 256 bytes in length.
1786 ; The block length is taken as (operands[2] % 256) + 1.
1788 (define_expand "movstr_short"
1790 [(set (match_operand:BLK 0 "memory_operand" "")
1791 (match_operand:BLK 1 "memory_operand" ""))
1792 (use (match_operand 2 "nonmemory_operand" ""))
1793 (clobber (match_dup 3))])]
1795 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1797 (define_insn "*movstr_short"
1798 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1799 (match_operand:BLK 1 "memory_operand" "Q,Q"))
1800 (use (match_operand 2 "nonmemory_operand" "n,a"))
1801 (clobber (match_scratch 3 "=X,&a"))]
1802 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
1803 && GET_MODE (operands[3]) == Pmode"
1805 switch (which_alternative)
1808 return "mvc\t%O0(%b2+1,%R0),%1";
1811 output_asm_insn ("bras\t%3,.+10", operands);
1812 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
1813 return "ex\t%2,0(%3)";
1819 [(set_attr "op_type" "SS,NN")
1820 (set_attr "type" "cs,cs")
1821 (set_attr "atype" "*,agen")
1822 (set_attr "length" "*,14")])
1824 ; Move a block of arbitrary length.
1826 (define_expand "movstr_long"
1828 [(clobber (match_dup 2))
1829 (clobber (match_dup 3))
1830 (set (match_operand:BLK 0 "memory_operand" "")
1831 (match_operand:BLK 1 "memory_operand" ""))
1832 (use (match_operand 2 "general_operand" ""))
1834 (clobber (reg:CC 33))])]
1837 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1838 rtx reg0 = gen_reg_rtx (dword_mode);
1839 rtx reg1 = gen_reg_rtx (dword_mode);
1840 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1841 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
1842 rtx len0 = gen_lowpart (Pmode, reg0);
1843 rtx len1 = gen_lowpart (Pmode, reg1);
1845 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1846 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1847 emit_move_insn (len0, operands[2]);
1849 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
1850 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1851 emit_move_insn (len1, operands[2]);
1853 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1854 operands[1] = replace_equiv_address_nv (operands[1], addr1);
1859 (define_insn "*movstr_long_64"
1860 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1861 (clobber (match_operand:TI 1 "register_operand" "=d"))
1862 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1863 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
1866 (clobber (reg:CC 33))]
1868 "mvcle\t%0,%1,0\;jo\t.-4"
1869 [(set_attr "op_type" "NN")
1870 (set_attr "type" "vs")
1871 (set_attr "length" "8")])
1873 (define_insn "*movstr_long_31"
1874 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1875 (clobber (match_operand:DI 1 "register_operand" "=d"))
1876 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1877 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
1880 (clobber (reg:CC 33))]
1882 "mvcle\t%0,%1,0\;jo\t.-4"
1883 [(set_attr "op_type" "NN")
1884 (set_attr "type" "vs")
1885 (set_attr "length" "8")])
1888 ; clrstrM instruction pattern(s).
1891 (define_expand "clrstrdi"
1892 [(set (match_operand:BLK 0 "memory_operand" "")
1894 (use (match_operand:DI 1 "general_operand" ""))
1895 (match_operand 2 "" "")]
1897 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
1899 (define_expand "clrstrsi"
1900 [(set (match_operand:BLK 0 "memory_operand" "")
1902 (use (match_operand:SI 1 "general_operand" ""))
1903 (match_operand 2 "" "")]
1905 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
1907 ; Clear a block that is up to 256 bytes in length.
1908 ; The block length is taken as (operands[1] % 256) + 1.
1910 (define_expand "clrstr_short"
1912 [(set (match_operand:BLK 0 "memory_operand" "")
1914 (use (match_operand 1 "nonmemory_operand" ""))
1915 (clobber (match_dup 2))
1916 (clobber (reg:CC 33))])]
1918 "operands[2] = gen_rtx_SCRATCH (Pmode);")
1920 (define_insn "*clrstr_short"
1921 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1923 (use (match_operand 1 "nonmemory_operand" "n,a"))
1924 (clobber (match_scratch 2 "=X,&a"))
1925 (clobber (reg:CC 33))]
1926 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
1927 && GET_MODE (operands[2]) == Pmode"
1929 switch (which_alternative)
1932 return "xc\t%O0(%b1+1,%R0),%0";
1935 output_asm_insn ("bras\t%2,.+10", operands);
1936 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
1937 return "ex\t%1,0(%2)";
1943 [(set_attr "op_type" "SS,NN")
1944 (set_attr "type" "cs,cs")
1945 (set_attr "atype" "*,agen")
1946 (set_attr "length" "*,14")])
1948 ; Clear a block of arbitrary length.
1950 (define_expand "clrstr_long"
1952 [(clobber (match_dup 1))
1953 (set (match_operand:BLK 0 "memory_operand" "")
1955 (use (match_operand 1 "general_operand" ""))
1957 (clobber (reg:CC 33))])]
1960 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1961 rtx reg0 = gen_reg_rtx (dword_mode);
1962 rtx reg1 = gen_reg_rtx (dword_mode);
1963 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1964 rtx len0 = gen_lowpart (Pmode, reg0);
1966 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1967 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1968 emit_move_insn (len0, operands[1]);
1970 emit_move_insn (reg1, const0_rtx);
1972 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1977 (define_insn "*clrstr_long_64"
1978 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1979 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1982 (use (match_operand:TI 1 "register_operand" "d"))
1983 (clobber (reg:CC 33))]
1985 "mvcle\t%0,%1,0\;jo\t.-4"
1986 [(set_attr "op_type" "NN")
1987 (set_attr "type" "vs")
1988 (set_attr "length" "8")])
1990 (define_insn "*clrstr_long_31"
1991 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1992 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1995 (use (match_operand:DI 1 "register_operand" "d"))
1996 (clobber (reg:CC 33))]
1998 "mvcle\t%0,%1,0\;jo\t.-4"
1999 [(set_attr "op_type" "NN")
2000 (set_attr "type" "vs")
2001 (set_attr "length" "8")])
2004 ; cmpmemM instruction pattern(s).
2007 (define_expand "cmpmemdi"
2008 [(set (match_operand:DI 0 "register_operand" "")
2009 (compare:DI (match_operand:BLK 1 "memory_operand" "")
2010 (match_operand:BLK 2 "memory_operand" "") ) )
2011 (use (match_operand:DI 3 "general_operand" ""))
2012 (use (match_operand:DI 4 "" ""))]
2014 "s390_expand_cmpmem (operands[0], operands[1],
2015 operands[2], operands[3]); DONE;")
2017 (define_expand "cmpmemsi"
2018 [(set (match_operand:SI 0 "register_operand" "")
2019 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2020 (match_operand:BLK 2 "memory_operand" "") ) )
2021 (use (match_operand:SI 3 "general_operand" ""))
2022 (use (match_operand:SI 4 "" ""))]
2024 "s390_expand_cmpmem (operands[0], operands[1],
2025 operands[2], operands[3]); DONE;")
2027 ; Compare a block that is up to 256 bytes in length.
2028 ; The block length is taken as (operands[2] % 256) + 1.
2030 (define_expand "cmpmem_short"
2033 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2034 (match_operand:BLK 1 "memory_operand" "")))
2035 (use (match_operand 2 "nonmemory_operand" ""))
2036 (clobber (match_dup 3))])]
2038 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2040 (define_insn "*cmpmem_short"
2042 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2043 (match_operand:BLK 1 "memory_operand" "Q,Q")))
2044 (use (match_operand 2 "nonmemory_operand" "n,a"))
2045 (clobber (match_scratch 3 "=X,&a"))]
2046 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2047 && GET_MODE (operands[3]) == Pmode"
2049 switch (which_alternative)
2052 return "clc\t%O0(%b2+1,%R0),%1";
2055 output_asm_insn ("bras\t%3,.+10", operands);
2056 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2057 return "ex\t%2,0(%3)";
2063 [(set_attr "op_type" "SS,NN")
2064 (set_attr "type" "cs,cs")
2065 (set_attr "atype" "*,agen")
2066 (set_attr "length" "*,14")])
2068 ; Compare a block of arbitrary length.
2070 (define_expand "cmpmem_long"
2072 [(clobber (match_dup 2))
2073 (clobber (match_dup 3))
2075 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2076 (match_operand:BLK 1 "memory_operand" "")))
2077 (use (match_operand 2 "general_operand" ""))
2078 (use (match_dup 3))])]
2081 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2082 rtx reg0 = gen_reg_rtx (dword_mode);
2083 rtx reg1 = gen_reg_rtx (dword_mode);
2084 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2085 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2086 rtx len0 = gen_lowpart (Pmode, reg0);
2087 rtx len1 = gen_lowpart (Pmode, reg1);
2089 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2090 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2091 emit_move_insn (len0, operands[2]);
2093 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2094 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2095 emit_move_insn (len1, operands[2]);
2097 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2098 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2103 (define_insn "*cmpmem_long_64"
2104 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2105 (clobber (match_operand:TI 1 "register_operand" "=d"))
2107 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2108 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2110 (use (match_dup 3))]
2113 [(set_attr "op_type" "RR")
2114 (set_attr "type" "vs")])
2116 (define_insn "*cmpmem_long_31"
2117 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2118 (clobber (match_operand:DI 1 "register_operand" "=d"))
2120 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2121 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2123 (use (match_dup 3))]
2126 [(set_attr "op_type" "RR")
2127 (set_attr "type" "vs")])
2129 ; Convert condition code to integer in range (-1, 0, 1)
2131 (define_insn "cmpint_si"
2132 [(set (match_operand:SI 0 "register_operand" "=d")
2133 (compare:SI (reg:CCS 33) (const_int 0)))]
2136 output_asm_insn ("lhi\t%0,1", operands);
2137 output_asm_insn ("jh\t.+12", operands);
2138 output_asm_insn ("jl\t.+6", operands);
2139 output_asm_insn ("sr\t%0,%0", operands);
2140 return "lcr\t%0,%0";
2142 [(set_attr "op_type" "NN")
2143 (set_attr "length" "16")
2144 (set_attr "type" "other")])
2146 (define_insn "cmpint_di"
2147 [(set (match_operand:DI 0 "register_operand" "=d")
2148 (compare:DI (reg:CCS 33) (const_int 0)))]
2151 output_asm_insn ("lghi\t%0,1", operands);
2152 output_asm_insn ("jh\t.+12", operands);
2153 output_asm_insn ("jl\t.+6", operands);
2154 output_asm_insn ("sgr\t%0,%0", operands);
2155 return "lcgr\t%0,%0";
2157 [(set_attr "op_type" "NN")
2158 (set_attr "length" "22")
2159 (set_attr "type" "other")])
2163 ;;- Conversion instructions.
2166 (define_insn "*sethighqisi"
2167 [(set (match_operand:SI 0 "register_operand" "=d,d")
2168 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2169 (clobber (reg:CC 33))]
2174 [(set_attr "op_type" "RS,RSY")])
2176 (define_insn "*sethighhisi"
2177 [(set (match_operand:SI 0 "register_operand" "=d,d")
2178 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2179 (clobber (reg:CC 33))]
2184 [(set_attr "op_type" "RS,RSY")])
2186 (define_insn "*sethighqidi_64"
2187 [(set (match_operand:DI 0 "register_operand" "=d")
2188 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2189 (clobber (reg:CC 33))]
2192 [(set_attr "op_type" "RSY")])
2194 (define_insn "*sethighqidi_31"
2195 [(set (match_operand:DI 0 "register_operand" "=d,d")
2196 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2197 (clobber (reg:CC 33))]
2202 [(set_attr "op_type" "RS,RSY")])
2204 (define_insn_and_split "*extractqi"
2205 [(set (match_operand:SI 0 "register_operand" "=d")
2206 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2207 (match_operand 2 "const_int_operand" "n")
2209 (clobber (reg:CC 33))]
2211 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2213 "&& reload_completed"
2215 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2216 (clobber (reg:CC 33))])
2217 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2219 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2220 operands[1] = change_address (operands[1], QImode, 0);
2222 [(set_attr "atype" "agen")])
2224 (define_insn_and_split "*extracthi"
2225 [(set (match_operand:SI 0 "register_operand" "=d")
2226 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2227 (match_operand 2 "const_int_operand" "n")
2229 (clobber (reg:CC 33))]
2231 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2233 "&& reload_completed"
2235 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2236 (clobber (reg:CC 33))])
2237 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2239 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2240 operands[1] = change_address (operands[1], HImode, 0);
2242 [(set_attr "atype" "agen")])
2245 ; extendsidi2 instruction pattern(s).
2248 (define_expand "extendsidi2"
2249 [(set (match_operand:DI 0 "register_operand" "")
2250 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2256 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2257 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2258 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2259 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2265 (define_insn "*extendsidi2"
2266 [(set (match_operand:DI 0 "register_operand" "=d,d")
2267 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2272 [(set_attr "op_type" "RRE,RXY")])
2275 ; extendhidi2 instruction pattern(s).
2278 (define_expand "extendhidi2"
2279 [(set (match_operand:DI 0 "register_operand" "")
2280 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2286 rtx tmp = gen_reg_rtx (SImode);
2287 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2288 emit_insn (gen_extendsidi2 (operands[0], tmp));
2293 operands[1] = gen_lowpart (DImode, operands[1]);
2294 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2295 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2301 (define_insn "*extendhidi2"
2302 [(set (match_operand:DI 0 "register_operand" "=d")
2303 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2306 [(set_attr "op_type" "RXY")])
2309 ; extendqidi2 instruction pattern(s).
2312 (define_expand "extendqidi2"
2313 [(set (match_operand:DI 0 "register_operand" "")
2314 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2320 rtx tmp = gen_reg_rtx (SImode);
2321 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2322 emit_insn (gen_extendsidi2 (operands[0], tmp));
2327 operands[1] = gen_lowpart (DImode, operands[1]);
2328 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2329 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2335 (define_insn "*extendqidi2"
2336 [(set (match_operand:DI 0 "register_operand" "=d")
2337 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2338 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2340 [(set_attr "op_type" "RXY")])
2343 [(set (match_operand:DI 0 "register_operand" "")
2344 (sign_extend:DI (match_operand:QI 1 "s_operand" "")))]
2345 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT && !reload_completed"
2347 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2348 (clobber (reg:CC 33))])
2350 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2351 (clobber (reg:CC 33))])]
2355 ; extendhisi2 instruction pattern(s).
2358 (define_expand "extendhisi2"
2359 [(set (match_operand:SI 0 "register_operand" "")
2360 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2364 operands[1] = gen_lowpart (SImode, operands[1]);
2365 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2366 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2371 (define_insn "*extendhisi2"
2372 [(set (match_operand:SI 0 "register_operand" "=d,d")
2373 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2378 [(set_attr "op_type" "RX,RXY")])
2381 ; extendqisi2 instruction pattern(s).
2384 (define_expand "extendqisi2"
2385 [(set (match_operand:SI 0 "register_operand" "")
2386 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2390 operands[1] = gen_lowpart (SImode, operands[1]);
2391 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2392 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2397 (define_insn "*extendqisi2"
2398 [(set (match_operand:SI 0 "register_operand" "=d")
2399 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2400 "TARGET_LONG_DISPLACEMENT"
2402 [(set_attr "op_type" "RXY")])
2405 [(set (match_operand:SI 0 "register_operand" "")
2406 (sign_extend:SI (match_operand:QI 1 "s_operand" "")))]
2407 "!TARGET_LONG_DISPLACEMENT && !reload_completed"
2409 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2410 (clobber (reg:CC 33))])
2412 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2413 (clobber (reg:CC 33))])]
2417 ; extendqihi2 instruction pattern(s).
2422 ; zero_extendsidi2 instruction pattern(s).
2425 (define_expand "zero_extendsidi2"
2426 [(set (match_operand:DI 0 "register_operand" "")
2427 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2433 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2434 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2435 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2441 (define_insn "*zero_extendsidi2"
2442 [(set (match_operand:DI 0 "register_operand" "=d,d")
2443 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2448 [(set_attr "op_type" "RRE,RXY")])
2451 ; zero_extendhidi2 instruction pattern(s).
2454 (define_expand "zero_extendhidi2"
2455 [(set (match_operand:DI 0 "register_operand" "")
2456 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2462 rtx tmp = gen_reg_rtx (SImode);
2463 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2464 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2469 operands[1] = gen_lowpart (DImode, operands[1]);
2470 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2471 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2477 (define_insn "*zero_extendhidi2"
2478 [(set (match_operand:DI 0 "register_operand" "=d")
2479 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2482 [(set_attr "op_type" "RXY")])
2485 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2488 (define_insn "*llgt_sisi"
2489 [(set (match_operand:SI 0 "register_operand" "=d,d")
2490 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2491 (const_int 2147483647)))]
2496 [(set_attr "op_type" "RRE,RXE")])
2498 (define_insn_and_split "*llgt_sisi_split"
2499 [(set (match_operand:SI 0 "register_operand" "=d,d")
2500 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2501 (const_int 2147483647)))
2502 (clobber (reg:CC 33))]
2505 "&& reload_completed"
2507 (and:SI (match_dup 1)
2508 (const_int 2147483647)))]
2511 (define_insn "*llgt_didi"
2512 [(set (match_operand:DI 0 "register_operand" "=d,d")
2513 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2514 (const_int 2147483647)))]
2519 [(set_attr "op_type" "RRE,RXE")])
2521 (define_insn_and_split "*llgt_didi_split"
2522 [(set (match_operand:DI 0 "register_operand" "=d,d")
2523 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2524 (const_int 2147483647)))
2525 (clobber (reg:CC 33))]
2528 "&& reload_completed"
2530 (and:DI (match_dup 1)
2531 (const_int 2147483647)))]
2534 (define_insn "*llgt_sidi"
2535 [(set (match_operand:DI 0 "register_operand" "=d")
2536 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2537 (const_int 2147483647)))]
2540 [(set_attr "op_type" "RXE")])
2542 (define_insn_and_split "*llgt_sidi_split"
2543 [(set (match_operand:DI 0 "register_operand" "=d")
2544 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2545 (const_int 2147483647)))
2546 (clobber (reg:CC 33))]
2549 "&& reload_completed"
2551 (and:DI (subreg:DI (match_dup 1) 0)
2552 (const_int 2147483647)))]
2556 ; zero_extendqidi2 instruction pattern(s)
2559 (define_expand "zero_extendqidi2"
2560 [(set (match_operand:DI 0 "register_operand" "")
2561 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2567 rtx tmp = gen_reg_rtx (SImode);
2568 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2569 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2574 operands[1] = gen_lowpart (DImode, operands[1]);
2575 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2576 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2582 (define_insn "*zero_extendqidi2"
2583 [(set (match_operand:DI 0 "register_operand" "=d")
2584 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2587 [(set_attr "op_type" "RXY")])
2590 ; zero_extendhisi2 instruction pattern(s).
2593 (define_expand "zero_extendhisi2"
2594 [(set (match_operand:SI 0 "register_operand" "")
2595 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2599 operands[1] = gen_lowpart (SImode, operands[1]);
2600 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2605 (define_insn "*zero_extendhisi2_64"
2606 [(set (match_operand:SI 0 "register_operand" "=d")
2607 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2610 [(set_attr "op_type" "RXY")])
2612 (define_insn_and_split "*zero_extendhisi2_31"
2613 [(set (match_operand:SI 0 "register_operand" "=&d")
2614 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2615 (clobber (reg:CC 33))]
2618 "&& reload_completed"
2619 [(set (match_dup 0) (const_int 0))
2621 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2622 (clobber (reg:CC 33))])]
2623 "operands[2] = gen_lowpart (HImode, operands[0]);"
2624 [(set_attr "atype" "agen")])
2627 ; zero_extendqisi2 instruction pattern(s).
2630 (define_expand "zero_extendqisi2"
2631 [(set (match_operand:SI 0 "register_operand" "")
2632 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2636 operands[1] = gen_lowpart (SImode, operands[1]);
2637 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2642 (define_insn "*zero_extendqisi2_64"
2643 [(set (match_operand:SI 0 "register_operand" "=d")
2644 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2647 [(set_attr "op_type" "RXY")])
2649 (define_insn_and_split "*zero_extendqisi2_31"
2650 [(set (match_operand:SI 0 "register_operand" "=&d")
2651 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2654 "&& reload_completed"
2655 [(set (match_dup 0) (const_int 0))
2656 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2657 "operands[2] = gen_lowpart (QImode, operands[0]);"
2658 [(set_attr "atype" "agen")])
2661 ; zero_extendqihi2 instruction pattern(s).
2664 (define_expand "zero_extendqihi2"
2665 [(set (match_operand:HI 0 "register_operand" "")
2666 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2670 operands[1] = gen_lowpart (HImode, operands[1]);
2671 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2676 (define_insn "*zero_extendqihi2_64"
2677 [(set (match_operand:HI 0 "register_operand" "=d")
2678 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2681 [(set_attr "op_type" "RXY")])
2683 (define_insn_and_split "*zero_extendqihi2_31"
2684 [(set (match_operand:HI 0 "register_operand" "=&d")
2685 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2688 "&& reload_completed"
2689 [(set (match_dup 0) (const_int 0))
2690 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2691 "operands[2] = gen_lowpart (QImode, operands[0]);"
2692 [(set_attr "atype" "agen")])
2696 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2699 (define_expand "fixuns_truncdfdi2"
2700 [(set (match_operand:DI 0 "register_operand" "")
2701 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2702 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2704 rtx label1 = gen_label_rtx ();
2705 rtx label2 = gen_label_rtx ();
2706 rtx temp = gen_reg_rtx (DFmode);
2707 operands[1] = force_reg (DFmode, operands[1]);
2709 emit_insn (gen_cmpdf (operands[1],
2710 CONST_DOUBLE_FROM_REAL_VALUE (
2711 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2712 emit_jump_insn (gen_blt (label1));
2713 emit_insn (gen_subdf3 (temp, operands[1],
2714 CONST_DOUBLE_FROM_REAL_VALUE (
2715 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2716 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2719 emit_label (label1);
2720 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2721 emit_label (label2);
2725 (define_expand "fix_truncdfdi2"
2726 [(set (match_operand:DI 0 "register_operand" "")
2727 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2728 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2730 operands[1] = force_reg (DFmode, operands[1]);
2731 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2735 (define_insn "fix_truncdfdi2_ieee"
2736 [(set (match_operand:DI 0 "register_operand" "=d")
2737 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2738 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2739 (clobber (reg:CC 33))]
2740 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2742 [(set_attr "op_type" "RRE")
2743 (set_attr "type" "ftoi")])
2746 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2749 (define_expand "fixuns_truncdfsi2"
2750 [(set (match_operand:SI 0 "register_operand" "")
2751 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2752 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2754 rtx label1 = gen_label_rtx ();
2755 rtx label2 = gen_label_rtx ();
2756 rtx temp = gen_reg_rtx (DFmode);
2758 operands[1] = force_reg (DFmode,operands[1]);
2759 emit_insn (gen_cmpdf (operands[1],
2760 CONST_DOUBLE_FROM_REAL_VALUE (
2761 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2762 emit_jump_insn (gen_blt (label1));
2763 emit_insn (gen_subdf3 (temp, operands[1],
2764 CONST_DOUBLE_FROM_REAL_VALUE (
2765 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2766 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2769 emit_label (label1);
2770 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2771 emit_label (label2);
2775 (define_expand "fix_truncdfsi2"
2776 [(set (match_operand:SI 0 "register_operand" "")
2777 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2780 if (TARGET_IBM_FLOAT)
2782 /* This is the algorithm from POP chapter A.5.7.2. */
2784 rtx temp = assign_stack_local (BLKmode, 2 * UNITS_PER_WORD, BITS_PER_WORD);
2785 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2786 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2788 operands[1] = force_reg (DFmode, operands[1]);
2789 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2790 two31r, two32, temp));
2794 operands[1] = force_reg (DFmode, operands[1]);
2795 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2801 (define_insn "fix_truncdfsi2_ieee"
2802 [(set (match_operand:SI 0 "register_operand" "=d")
2803 (fix:SI (match_operand:DF 1 "register_operand" "f")))
2804 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2805 (clobber (reg:CC 33))]
2806 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2808 [(set_attr "op_type" "RRE")
2809 (set_attr "type" "other" )])
2811 (define_insn "fix_truncdfsi2_ibm"
2812 [(set (match_operand:SI 0 "register_operand" "=d")
2813 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2814 (use (match_operand:DI 2 "immediate_operand" "m"))
2815 (use (match_operand:DI 3 "immediate_operand" "m"))
2816 (use (match_operand:BLK 4 "memory_operand" "m"))
2817 (clobber (reg:CC 33))]
2818 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2820 output_asm_insn ("sd\t%1,%2", operands);
2821 output_asm_insn ("aw\t%1,%3", operands);
2822 output_asm_insn ("std\t%1,%4", operands);
2823 output_asm_insn ("xi\t%N4,128", operands);
2826 [(set_attr "op_type" "NN")
2827 (set_attr "type" "ftoi")
2828 (set_attr "atype" "agen")
2829 (set_attr "length" "20")])
2832 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
2835 (define_expand "fixuns_truncsfdi2"
2836 [(set (match_operand:DI 0 "register_operand" "")
2837 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2838 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2840 rtx label1 = gen_label_rtx ();
2841 rtx label2 = gen_label_rtx ();
2842 rtx temp = gen_reg_rtx (SFmode);
2844 operands[1] = force_reg (SFmode, operands[1]);
2845 emit_insn (gen_cmpsf (operands[1],
2846 CONST_DOUBLE_FROM_REAL_VALUE (
2847 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
2848 emit_jump_insn (gen_blt (label1));
2850 emit_insn (gen_subsf3 (temp, operands[1],
2851 CONST_DOUBLE_FROM_REAL_VALUE (
2852 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
2853 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
2856 emit_label (label1);
2857 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2858 emit_label (label2);
2862 (define_expand "fix_truncsfdi2"
2863 [(set (match_operand:DI 0 "register_operand" "")
2864 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
2865 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2867 operands[1] = force_reg (SFmode, operands[1]);
2868 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2872 (define_insn "fix_truncsfdi2_ieee"
2873 [(set (match_operand:DI 0 "register_operand" "=d")
2874 (fix:DI (match_operand:SF 1 "register_operand" "f")))
2875 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2876 (clobber (reg:CC 33))]
2877 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2879 [(set_attr "op_type" "RRE")
2880 (set_attr "type" "ftoi")])
2883 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
2886 (define_expand "fixuns_truncsfsi2"
2887 [(set (match_operand:SI 0 "register_operand" "")
2888 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
2889 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2891 rtx label1 = gen_label_rtx ();
2892 rtx label2 = gen_label_rtx ();
2893 rtx temp = gen_reg_rtx (SFmode);
2895 operands[1] = force_reg (SFmode, operands[1]);
2896 emit_insn (gen_cmpsf (operands[1],
2897 CONST_DOUBLE_FROM_REAL_VALUE (
2898 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
2899 emit_jump_insn (gen_blt (label1));
2900 emit_insn (gen_subsf3 (temp, operands[1],
2901 CONST_DOUBLE_FROM_REAL_VALUE (
2902 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
2903 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
2906 emit_label (label1);
2907 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2908 emit_label (label2);
2912 (define_expand "fix_truncsfsi2"
2913 [(set (match_operand:SI 0 "register_operand" "")
2914 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
2917 if (TARGET_IBM_FLOAT)
2919 /* Convert to DFmode and then use the POP algorithm. */
2920 rtx temp = gen_reg_rtx (DFmode);
2921 emit_insn (gen_extendsfdf2 (temp, operands[1]));
2922 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
2926 operands[1] = force_reg (SFmode, operands[1]);
2927 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2933 (define_insn "fix_truncsfsi2_ieee"
2934 [(set (match_operand:SI 0 "register_operand" "=d")
2935 (fix:SI (match_operand:SF 1 "register_operand" "f")))
2936 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2937 (clobber (reg:CC 33))]
2938 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2940 [(set_attr "op_type" "RRE")
2941 (set_attr "type" "ftoi")])
2944 ; floatdidf2 instruction pattern(s).
2947 (define_insn "floatdidf2"
2948 [(set (match_operand:DF 0 "register_operand" "=f")
2949 (float:DF (match_operand:DI 1 "register_operand" "d")))
2950 (clobber (reg:CC 33))]
2951 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2953 [(set_attr "op_type" "RRE")
2954 (set_attr "type" "itof" )])
2957 ; floatdisf2 instruction pattern(s).
2960 (define_insn "floatdisf2"
2961 [(set (match_operand:SF 0 "register_operand" "=f")
2962 (float:SF (match_operand:DI 1 "register_operand" "d")))
2963 (clobber (reg:CC 33))]
2964 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2966 [(set_attr "op_type" "RRE")
2967 (set_attr "type" "itof" )])
2970 ; floatsidf2 instruction pattern(s).
2973 (define_expand "floatsidf2"
2975 [(set (match_operand:DF 0 "register_operand" "")
2976 (float:DF (match_operand:SI 1 "register_operand" "")))
2977 (clobber (reg:CC 33))])]
2980 if (TARGET_IBM_FLOAT)
2982 /* This is the algorithm from POP chapter A.5.7.1. */
2984 rtx temp = assign_stack_local (BLKmode, 2 * UNITS_PER_WORD, BITS_PER_WORD);
2985 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
2987 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
2992 (define_insn "floatsidf2_ieee"
2993 [(set (match_operand:DF 0 "register_operand" "=f")
2994 (float:DF (match_operand:SI 1 "register_operand" "d")))
2995 (clobber (reg:CC 33))]
2996 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2998 [(set_attr "op_type" "RRE")
2999 (set_attr "type" "itof" )])
3001 (define_insn "floatsidf2_ibm"
3002 [(set (match_operand:DF 0 "register_operand" "=f")
3003 (float:DF (match_operand:SI 1 "register_operand" "d")))
3004 (use (match_operand:DI 2 "immediate_operand" "m"))
3005 (use (match_operand:BLK 3 "memory_operand" "m"))
3006 (clobber (reg:CC 33))]
3007 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3009 output_asm_insn ("st\t%1,%N3", operands);
3010 output_asm_insn ("xi\t%N3,128", operands);
3011 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3012 output_asm_insn ("ld\t%0,%3", operands);
3015 [(set_attr "op_type" "NN")
3016 (set_attr "type" "other" )
3017 (set_attr "atype" "agen")
3018 (set_attr "length" "20")])
3021 ; floatsisf2 instruction pattern(s).
3024 (define_expand "floatsisf2"
3026 [(set (match_operand:SF 0 "register_operand" "")
3027 (float:SF (match_operand:SI 1 "register_operand" "")))
3028 (clobber (reg:CC 33))])]
3031 if (TARGET_IBM_FLOAT)
3033 /* Use the POP algorithm to convert to DFmode and then truncate. */
3034 rtx temp = gen_reg_rtx (DFmode);
3035 emit_insn (gen_floatsidf2 (temp, operands[1]));
3036 emit_insn (gen_truncdfsf2 (operands[0], temp));
3041 (define_insn "floatsisf2_ieee"
3042 [(set (match_operand:SF 0 "register_operand" "=f")
3043 (float:SF (match_operand:SI 1 "register_operand" "d")))
3044 (clobber (reg:CC 33))]
3045 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3047 [(set_attr "op_type" "RRE")
3048 (set_attr "type" "itof" )])
3051 ; truncdfsf2 instruction pattern(s).
3054 (define_expand "truncdfsf2"
3055 [(set (match_operand:SF 0 "register_operand" "")
3056 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3060 (define_insn "truncdfsf2_ieee"
3061 [(set (match_operand:SF 0 "register_operand" "=f")
3062 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3063 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3065 [(set_attr "op_type" "RRE")])
3067 (define_insn "truncdfsf2_ibm"
3068 [(set (match_operand:SF 0 "register_operand" "=f,f")
3069 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3070 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3074 [(set_attr "op_type" "RR,RX")
3075 (set_attr "type" "floads,floads")])
3078 ; extendsfdf2 instruction pattern(s).
3081 (define_expand "extendsfdf2"
3082 [(set (match_operand:DF 0 "register_operand" "")
3083 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3086 if (TARGET_IBM_FLOAT)
3088 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3093 (define_insn "extendsfdf2_ieee"
3094 [(set (match_operand:DF 0 "register_operand" "=f,f")
3095 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3096 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3100 [(set_attr "op_type" "RRE,RXE")
3101 (set_attr "type" "floads,floads")])
3103 (define_insn "extendsfdf2_ibm"
3104 [(set (match_operand:DF 0 "register_operand" "=f,f")
3105 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3106 (clobber (reg:CC 33))]
3107 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3109 sdr\t%0,%0\;ler\t%0,%1
3110 sdr\t%0,%0\;le\t%0,%1"
3111 [(set_attr "op_type" "NN,NN")
3112 (set_attr "atype" "reg,agen")
3113 (set_attr "length" "4,6")
3114 (set_attr "type" "o2,o2")])
3118 ;; ARITHMETIC OPERATIONS
3120 ; arithmetic operations set the ConditionCode,
3121 ; because of unpredictable Bits in Register for Halfword and Byte
3122 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3125 ;;- Add instructions.
3129 ; adddi3 instruction pattern(s).
3132 (define_insn "*adddi3_sign"
3133 [(set (match_operand:DI 0 "register_operand" "=d,d")
3134 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3135 (match_operand:DI 1 "register_operand" "0,0")))
3136 (clobber (reg:CC 33))]
3141 [(set_attr "op_type" "RRE,RXY")])
3143 (define_insn "*adddi3_zero_cc"
3145 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3146 (match_operand:DI 1 "register_operand" "0,0"))
3148 (set (match_operand:DI 0 "register_operand" "=d,d")
3149 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3150 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3154 [(set_attr "op_type" "RRE,RXY")])
3156 (define_insn "*adddi3_zero_cconly"
3158 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3159 (match_operand:DI 1 "register_operand" "0,0"))
3161 (clobber (match_scratch:DI 0 "=d,d"))]
3162 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3166 [(set_attr "op_type" "RRE,RXY")])
3168 (define_insn "*adddi3_zero"
3169 [(set (match_operand:DI 0 "register_operand" "=d,d")
3170 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3171 (match_operand:DI 1 "register_operand" "0,0")))
3172 (clobber (reg:CC 33))]
3177 [(set_attr "op_type" "RRE,RXY")])
3179 (define_insn "*adddi3_imm_cc"
3181 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3182 (match_operand:DI 2 "const_int_operand" "K"))
3184 (set (match_operand:DI 0 "register_operand" "=d")
3185 (plus:DI (match_dup 1) (match_dup 2)))]
3187 && s390_match_ccmode (insn, CCAmode)
3188 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
3190 [(set_attr "op_type" "RI")])
3192 (define_insn "*adddi3_carry1_cc"
3194 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3195 (match_operand:DI 2 "general_operand" "d,m"))
3197 (set (match_operand:DI 0 "register_operand" "=d,d")
3198 (plus:DI (match_dup 1) (match_dup 2)))]
3199 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3203 [(set_attr "op_type" "RRE,RXY")])
3205 (define_insn "*adddi3_carry1_cconly"
3207 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3208 (match_operand:DI 2 "general_operand" "d,m"))
3210 (clobber (match_scratch:DI 0 "=d,d"))]
3211 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3215 [(set_attr "op_type" "RRE,RXY")])
3217 (define_insn "*adddi3_carry2_cc"
3219 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3220 (match_operand:DI 2 "general_operand" "d,m"))
3222 (set (match_operand:DI 0 "register_operand" "=d,d")
3223 (plus:DI (match_dup 1) (match_dup 2)))]
3224 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3228 [(set_attr "op_type" "RRE,RXY")])
3230 (define_insn "*adddi3_carry2_cconly"
3232 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3233 (match_operand:DI 2 "general_operand" "d,m"))
3235 (clobber (match_scratch:DI 0 "=d,d"))]
3236 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3240 [(set_attr "op_type" "RRE,RXY")])
3242 (define_insn "*adddi3_cc"
3244 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3245 (match_operand:DI 2 "general_operand" "d,m"))
3247 (set (match_operand:DI 0 "register_operand" "=d,d")
3248 (plus:DI (match_dup 1) (match_dup 2)))]
3249 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3253 [(set_attr "op_type" "RRE,RXY")])
3255 (define_insn "*adddi3_cconly"
3257 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3258 (match_operand:DI 2 "general_operand" "d,m"))
3260 (clobber (match_scratch:DI 0 "=d,d"))]
3261 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3265 [(set_attr "op_type" "RRE,RXY")])
3267 (define_insn "*adddi3_cconly2"
3269 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3270 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3271 (clobber (match_scratch:DI 0 "=d,d"))]
3272 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3276 [(set_attr "op_type" "RRE,RXY")])
3278 (define_insn "*adddi3_64"
3279 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3280 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3281 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3282 (clobber (reg:CC 33))]
3288 [(set_attr "op_type" "RRE,RI,RXY")])
3290 (define_insn_and_split "*adddi3_31z"
3291 [(set (match_operand:DI 0 "register_operand" "=&d")
3292 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3293 (match_operand:DI 2 "general_operand" "do") ) )
3294 (clobber (reg:CC 33))]
3295 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3297 "&& reload_completed"
3300 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3302 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3304 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3305 (ltu:SI (reg:CCL1 33) (const_int 0))))
3306 (clobber (reg:CC 33))])]
3307 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3308 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3309 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3310 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3311 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3312 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3313 [(set_attr "op_type" "NN")])
3315 (define_insn_and_split "*adddi3_31"
3316 [(set (match_operand:DI 0 "register_operand" "=&d")
3317 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3318 (match_operand:DI 2 "general_operand" "do") ) )
3319 (clobber (reg:CC 33))]
3322 "&& reload_completed"
3324 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3325 (clobber (reg:CC 33))])
3328 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3330 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3332 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3334 (label_ref (match_dup 9))))
3336 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3337 (clobber (reg:CC 33))])
3339 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3340 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3341 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3342 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3343 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3344 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3345 operands[9] = gen_label_rtx ();"
3346 [(set_attr "op_type" "NN")])
3348 (define_expand "adddi3"
3350 [(set (match_operand:DI 0 "register_operand" "")
3351 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3352 (match_operand:DI 2 "general_operand" "")))
3353 (clobber (reg:CC 33))])]
3357 (define_insn "*la_64"
3358 [(set (match_operand:DI 0 "register_operand" "=d,d")
3359 (match_operand:QI 1 "address_operand" "U,W"))]
3364 [(set_attr "op_type" "RX,RXY")
3365 (set_attr "type" "la")])
3369 [(set (match_operand:DI 0 "register_operand" "")
3370 (match_operand:QI 1 "address_operand" ""))
3371 (clobber (reg:CC 33))])]
3373 && strict_memory_address_p (VOIDmode, operands[1])
3374 && preferred_la_operand_p (operands[1])"
3375 [(set (match_dup 0) (match_dup 1))]
3379 [(set (match_operand:DI 0 "register_operand" "")
3380 (match_operand:DI 1 "register_operand" ""))
3383 (plus:DI (match_dup 0)
3384 (match_operand:DI 2 "nonmemory_operand" "")))
3385 (clobber (reg:CC 33))])]
3387 && !reg_overlap_mentioned_p (operands[0], operands[2])
3388 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (DImode, operands[1], operands[2]))
3389 && preferred_la_operand_p (gen_rtx_PLUS (DImode, operands[1], operands[2]))"
3390 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3393 (define_expand "reload_indi"
3394 [(parallel [(match_operand:DI 0 "register_operand" "=a")
3395 (match_operand:DI 1 "s390_plus_operand" "")
3396 (match_operand:DI 2 "register_operand" "=&a")])]
3399 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3405 ; addsi3 instruction pattern(s).
3408 (define_insn "*addsi3_imm_cc"
3410 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3411 (match_operand:SI 2 "const_int_operand" "K"))
3413 (set (match_operand:SI 0 "register_operand" "=d")
3414 (plus:SI (match_dup 1) (match_dup 2)))]
3415 "s390_match_ccmode (insn, CCAmode)
3416 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
3418 [(set_attr "op_type" "RI")])
3420 (define_insn "*addsi3_carry1_cc"
3422 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3423 (match_operand:SI 2 "general_operand" "d,R,T"))
3425 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3426 (plus:SI (match_dup 1) (match_dup 2)))]
3427 "s390_match_ccmode (insn, CCL1mode)"
3432 [(set_attr "op_type" "RR,RX,RXY")])
3434 (define_insn "*addsi3_carry1_cconly"
3436 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3437 (match_operand:SI 2 "general_operand" "d,R,T"))
3439 (clobber (match_scratch:SI 0 "=d,d,d"))]
3440 "s390_match_ccmode (insn, CCL1mode)"
3445 [(set_attr "op_type" "RR,RX,RXY")])
3447 (define_insn "*addsi3_carry2_cc"
3449 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3450 (match_operand:SI 2 "general_operand" "d,R,T"))
3452 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3453 (plus:SI (match_dup 1) (match_dup 2)))]
3454 "s390_match_ccmode (insn, CCL1mode)"
3459 [(set_attr "op_type" "RR,RX,RXY")])
3461 (define_insn "*addsi3_carry2_cconly"
3463 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3464 (match_operand:SI 2 "general_operand" "d,R,T"))
3466 (clobber (match_scratch:SI 0 "=d,d,d"))]
3467 "s390_match_ccmode (insn, CCL1mode)"
3472 [(set_attr "op_type" "RR,RX,RXY")])
3474 (define_insn "*addsi3_cc"
3476 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3477 (match_operand:SI 2 "general_operand" "d,R,T"))
3479 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3480 (plus:SI (match_dup 1) (match_dup 2)))]
3481 "s390_match_ccmode (insn, CCLmode)"
3486 [(set_attr "op_type" "RR,RX,RXY")])
3488 (define_insn "*addsi3_cconly"
3490 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3491 (match_operand:SI 2 "general_operand" "d,R,T"))
3493 (clobber (match_scratch:SI 0 "=d,d,d"))]
3494 "s390_match_ccmode (insn, CCLmode)"
3499 [(set_attr "op_type" "RR,RX,RXY")])
3501 (define_insn "*addsi3_cconly2"
3503 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3504 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3505 (clobber (match_scratch:SI 0 "=d,d,d"))]
3506 "s390_match_ccmode (insn, CCLmode)"
3511 [(set_attr "op_type" "RR,RX,RXY")])
3513 (define_insn "*addsi3_sign"
3514 [(set (match_operand:SI 0 "register_operand" "=d,d")
3515 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3516 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3517 (clobber (reg:CC 33))]
3522 [(set_attr "op_type" "RX,RXY")])
3524 (define_insn "addsi3"
3525 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3526 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3527 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3528 (clobber (reg:CC 33))]
3535 [(set_attr "op_type" "RR,RI,RX,RXY")])
3537 (define_insn "*la_31"
3538 [(set (match_operand:SI 0 "register_operand" "=d,d")
3539 (match_operand:QI 1 "address_operand" "U,W"))]
3540 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
3544 [(set_attr "op_type" "RX,RXY")
3545 (set_attr "type" "la")])
3549 [(set (match_operand:SI 0 "register_operand" "")
3550 (match_operand:QI 1 "address_operand" ""))
3551 (clobber (reg:CC 33))])]
3553 && strict_memory_address_p (VOIDmode, operands[1])
3554 && preferred_la_operand_p (operands[1])"
3555 [(set (match_dup 0) (match_dup 1))]
3559 [(set (match_operand:SI 0 "register_operand" "")
3560 (match_operand:SI 1 "register_operand" ""))
3563 (plus:SI (match_dup 0)
3564 (match_operand:SI 2 "nonmemory_operand" "")))
3565 (clobber (reg:CC 33))])]
3567 && !reg_overlap_mentioned_p (operands[0], operands[2])
3568 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
3569 && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
3570 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3573 (define_insn "*la_31_and"
3574 [(set (match_operand:SI 0 "register_operand" "=d,d")
3575 (and:SI (match_operand:QI 1 "address_operand" "U,W")
3576 (const_int 2147483647)))]
3581 [(set_attr "op_type" "RX,RXY")
3582 (set_attr "type" "la")])
3584 (define_insn_and_split "*la_31_and_cc"
3585 [(set (match_operand:SI 0 "register_operand" "=d")
3586 (and:SI (match_operand:QI 1 "address_operand" "p")
3587 (const_int 2147483647)))
3588 (clobber (reg:CC 33))]
3591 "&& reload_completed"
3593 (and:SI (match_dup 1) (const_int 2147483647)))]
3595 [(set_attr "op_type" "RX")
3596 (set_attr "type" "la")])
3598 (define_insn "force_la_31"
3599 [(set (match_operand:SI 0 "register_operand" "=d,d")
3600 (match_operand:QI 1 "address_operand" "U,W"))
3601 (use (const_int 0))]
3606 [(set_attr "op_type" "RX")
3607 (set_attr "type" "la")])
3609 (define_expand "reload_insi"
3610 [(parallel [(match_operand:SI 0 "register_operand" "=a")
3611 (match_operand:SI 1 "s390_plus_operand" "")
3612 (match_operand:SI 2 "register_operand" "=&a")])]
3615 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3621 ; adddf3 instruction pattern(s).
3624 (define_expand "adddf3"
3626 [(set (match_operand:DF 0 "register_operand" "=f,f")
3627 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3628 (match_operand:DF 2 "general_operand" "f,R")))
3629 (clobber (reg:CC 33))])]
3633 (define_insn "*adddf3"
3634 [(set (match_operand:DF 0 "register_operand" "=f,f")
3635 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3636 (match_operand:DF 2 "general_operand" "f,R")))
3637 (clobber (reg:CC 33))]
3638 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3642 [(set_attr "op_type" "RRE,RXE")
3643 (set_attr "type" "fsimpd,fsimpd")])
3645 (define_insn "*adddf3_cc"
3647 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3648 (match_operand:DF 2 "general_operand" "f,R"))
3649 (match_operand:DF 3 "const0_operand" "")))
3650 (set (match_operand:DF 0 "register_operand" "=f,f")
3651 (plus:DF (match_dup 1) (match_dup 2)))]
3652 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3656 [(set_attr "op_type" "RRE,RXE")
3657 (set_attr "type" "fsimpd,fsimpd")])
3659 (define_insn "*adddf3_cconly"
3661 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3662 (match_operand:DF 2 "general_operand" "f,R"))
3663 (match_operand:DF 3 "const0_operand" "")))
3664 (clobber (match_scratch:DF 0 "=f,f"))]
3665 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3669 [(set_attr "op_type" "RRE,RXE")
3670 (set_attr "type" "fsimpd,fsimpd")])
3672 (define_insn "*adddf3_ibm"
3673 [(set (match_operand:DF 0 "register_operand" "=f,f")
3674 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3675 (match_operand:DF 2 "general_operand" "f,R")))
3676 (clobber (reg:CC 33))]
3677 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3681 [(set_attr "op_type" "RR,RX")
3682 (set_attr "type" "fsimpd,fsimpd")])
3685 ; addsf3 instruction pattern(s).
3688 (define_expand "addsf3"
3690 [(set (match_operand:SF 0 "register_operand" "=f,f")
3691 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3692 (match_operand:SF 2 "general_operand" "f,R")))
3693 (clobber (reg:CC 33))])]
3697 (define_insn "*addsf3"
3698 [(set (match_operand:SF 0 "register_operand" "=f,f")
3699 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3700 (match_operand:SF 2 "general_operand" "f,R")))
3701 (clobber (reg:CC 33))]
3702 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3706 [(set_attr "op_type" "RRE,RXE")
3707 (set_attr "type" "fsimps,fsimps")])
3709 (define_insn "*addsf3_cc"
3711 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3712 (match_operand:SF 2 "general_operand" "f,R"))
3713 (match_operand:SF 3 "const0_operand" "")))
3714 (set (match_operand:SF 0 "register_operand" "=f,f")
3715 (plus:SF (match_dup 1) (match_dup 2)))]
3716 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3720 [(set_attr "op_type" "RRE,RXE")
3721 (set_attr "type" "fsimps,fsimps")])
3723 (define_insn "*addsf3_cconly"
3725 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3726 (match_operand:SF 2 "general_operand" "f,R"))
3727 (match_operand:SF 3 "const0_operand" "")))
3728 (clobber (match_scratch:SF 0 "=f,f"))]
3729 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3733 [(set_attr "op_type" "RRE,RXE")
3734 (set_attr "type" "fsimps,fsimps")])
3736 (define_insn "*addsf3"
3737 [(set (match_operand:SF 0 "register_operand" "=f,f")
3738 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3739 (match_operand:SF 2 "general_operand" "f,R")))
3740 (clobber (reg:CC 33))]
3741 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3745 [(set_attr "op_type" "RR,RX")
3746 (set_attr "type" "fsimps,fsimps")])
3750 ;;- Subtract instructions.
3754 ; subdi3 instruction pattern(s).
3757 (define_insn "*subdi3_sign"
3758 [(set (match_operand:DI 0 "register_operand" "=d,d")
3759 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3760 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3761 (clobber (reg:CC 33))]
3766 [(set_attr "op_type" "RRE,RXY")])
3768 (define_insn "*subdi3_zero_cc"
3770 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3771 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3773 (set (match_operand:DI 0 "register_operand" "=d,d")
3774 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3775 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3779 [(set_attr "op_type" "RRE,RXY")])
3781 (define_insn "*subdi3_zero_cconly"
3783 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3784 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3786 (clobber (match_scratch:DI 0 "=d,d"))]
3787 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3791 [(set_attr "op_type" "RRE,RXY")])
3793 (define_insn "*subdi3_zero"
3794 [(set (match_operand:DI 0 "register_operand" "=d,d")
3795 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3796 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3797 (clobber (reg:CC 33))]
3802 [(set_attr "op_type" "RRE,RXY")])
3804 (define_insn "*subdi3_borrow_cc"
3806 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3807 (match_operand:DI 2 "general_operand" "d,m"))
3809 (set (match_operand:DI 0 "register_operand" "=d,d")
3810 (minus:DI (match_dup 1) (match_dup 2)))]
3811 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3815 [(set_attr "op_type" "RRE,RXY")])
3817 (define_insn "*subdi3_borrow_cconly"
3819 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3820 (match_operand:DI 2 "general_operand" "d,m"))
3822 (clobber (match_scratch:DI 0 "=d,d"))]
3823 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3827 [(set_attr "op_type" "RRE,RXY")])
3829 (define_insn "*subdi3_cc"
3831 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3832 (match_operand:DI 2 "general_operand" "d,m"))
3834 (set (match_operand:DI 0 "register_operand" "=d,d")
3835 (minus:DI (match_dup 1) (match_dup 2)))]
3836 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3840 [(set_attr "op_type" "RRE,RXY")])
3842 (define_insn "*subdi3_cconly"
3844 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3845 (match_operand:DI 2 "general_operand" "d,m"))
3847 (clobber (match_scratch:DI 0 "=d,d"))]
3848 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3852 [(set_attr "op_type" "RRE,RXY")])
3854 (define_insn "*subdi3_64"
3855 [(set (match_operand:DI 0 "register_operand" "=d,d")
3856 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3857 (match_operand:DI 2 "general_operand" "d,m") ) )
3858 (clobber (reg:CC 33))]
3863 [(set_attr "op_type" "RRE,RRE")])
3865 (define_insn_and_split "*subdi3_31z"
3866 [(set (match_operand:DI 0 "register_operand" "=&d")
3867 (minus:DI (match_operand:DI 1 "register_operand" "0")
3868 (match_operand:DI 2 "general_operand" "do") ) )
3869 (clobber (reg:CC 33))]
3870 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3872 "&& reload_completed"
3875 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3877 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3879 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3880 (gtu:SI (reg:CCL2 33) (const_int 0))))
3881 (clobber (reg:CC 33))])]
3882 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3883 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3884 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3885 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3886 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3887 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3888 [(set_attr "op_type" "NN")])
3890 (define_insn_and_split "*subdi3_31"
3891 [(set (match_operand:DI 0 "register_operand" "=&d")
3892 (minus:DI (match_operand:DI 1 "register_operand" "0")
3893 (match_operand:DI 2 "general_operand" "do") ) )
3894 (clobber (reg:CC 33))]
3897 "&& reload_completed"
3899 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3900 (clobber (reg:CC 33))])
3903 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3905 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3907 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3909 (label_ref (match_dup 9))))
3911 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3912 (clobber (reg:CC 33))])
3914 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3915 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3916 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3917 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3918 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3919 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3920 operands[9] = gen_label_rtx ();"
3921 [(set_attr "op_type" "NN")])
3923 (define_expand "subdi3"
3925 [(set (match_operand:DI 0 "register_operand" "")
3926 (minus:DI (match_operand:DI 1 "register_operand" "")
3927 (match_operand:DI 2 "general_operand" "")))
3928 (clobber (reg:CC 33))])]
3933 ; subsi3 instruction pattern(s).
3936 (define_insn "*subsi3_borrow_cc"
3938 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3939 (match_operand:SI 2 "general_operand" "d,R,T"))
3941 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3942 (minus:SI (match_dup 1) (match_dup 2)))]
3943 "s390_match_ccmode (insn, CCL2mode)"
3948 [(set_attr "op_type" "RR,RX,RXY")])
3950 (define_insn "*subsi3_borrow_cconly"
3952 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3953 (match_operand:SI 2 "general_operand" "d,R,T"))
3955 (clobber (match_scratch:SI 0 "=d,d,d"))]
3956 "s390_match_ccmode (insn, CCL2mode)"
3961 [(set_attr "op_type" "RR,RX,RXY")])
3963 (define_insn "*subsi3_cc"
3965 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3966 (match_operand:SI 2 "general_operand" "d,R,T"))
3968 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3969 (minus:SI (match_dup 1) (match_dup 2)))]
3970 "s390_match_ccmode (insn, CCLmode)"
3975 [(set_attr "op_type" "RR,RX,RXY")])
3977 (define_insn "*subsi3_cconly"
3979 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3980 (match_operand:SI 2 "general_operand" "d,R,T"))
3982 (clobber (match_scratch:SI 0 "=d,d,d"))]
3983 "s390_match_ccmode (insn, CCLmode)"
3988 [(set_attr "op_type" "RR,RX,RXY")])
3990 (define_insn "*subsi3_sign"
3991 [(set (match_operand:SI 0 "register_operand" "=d,d")
3992 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3993 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3994 (clobber (reg:CC 33))]
3999 [(set_attr "op_type" "RX,RXY")])
4001 (define_insn "subsi3"
4002 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4003 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4004 (match_operand:SI 2 "general_operand" "d,R,T")))
4005 (clobber (reg:CC 33))]
4011 [(set_attr "op_type" "RR,RX,RXY")])
4015 ; subdf3 instruction pattern(s).
4018 (define_expand "subdf3"
4020 [(set (match_operand:DF 0 "register_operand" "=f,f")
4021 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4022 (match_operand:DF 2 "general_operand" "f,R")))
4023 (clobber (reg:CC 33))])]
4027 (define_insn "*subdf3"
4028 [(set (match_operand:DF 0 "register_operand" "=f,f")
4029 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4030 (match_operand:DF 2 "general_operand" "f,R")))
4031 (clobber (reg:CC 33))]
4032 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4036 [(set_attr "op_type" "RRE,RXE")
4037 (set_attr "type" "fsimpd,fsimpd")])
4039 (define_insn "*subdf3_cc"
4041 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4042 (match_operand:DF 2 "general_operand" "f,R"))
4043 (match_operand:DF 3 "const0_operand" "")))
4044 (set (match_operand:DF 0 "register_operand" "=f,f")
4045 (plus:DF (match_dup 1) (match_dup 2)))]
4046 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4050 [(set_attr "op_type" "RRE,RXE")
4051 (set_attr "type" "fsimpd,fsimpd")])
4053 (define_insn "*subdf3_cconly"
4055 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4056 (match_operand:DF 2 "general_operand" "f,R"))
4057 (match_operand:DF 3 "const0_operand" "")))
4058 (clobber (match_scratch:DF 0 "=f,f"))]
4059 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4063 [(set_attr "op_type" "RRE,RXE")
4064 (set_attr "type" "fsimpd,fsimpd")])
4066 (define_insn "*subdf3_ibm"
4067 [(set (match_operand:DF 0 "register_operand" "=f,f")
4068 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4069 (match_operand:DF 2 "general_operand" "f,R")))
4070 (clobber (reg:CC 33))]
4071 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4075 [(set_attr "op_type" "RR,RX")
4076 (set_attr "type" "fsimpd,fsimpd")])
4079 ; subsf3 instruction pattern(s).
4082 (define_expand "subsf3"
4084 [(set (match_operand:SF 0 "register_operand" "=f,f")
4085 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4086 (match_operand:SF 2 "general_operand" "f,R")))
4087 (clobber (reg:CC 33))])]
4091 (define_insn "*subsf3"
4092 [(set (match_operand:SF 0 "register_operand" "=f,f")
4093 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4094 (match_operand:SF 2 "general_operand" "f,R")))
4095 (clobber (reg:CC 33))]
4096 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4100 [(set_attr "op_type" "RRE,RXE")
4101 (set_attr "type" "fsimps,fsimps")])
4103 (define_insn "*subsf3_cc"
4105 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4106 (match_operand:SF 2 "general_operand" "f,R"))
4107 (match_operand:SF 3 "const0_operand" "")))
4108 (set (match_operand:SF 0 "register_operand" "=f,f")
4109 (minus:SF (match_dup 1) (match_dup 2)))]
4110 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4114 [(set_attr "op_type" "RRE,RXE")
4115 (set_attr "type" "fsimps,fsimps")])
4117 (define_insn "*subsf3_cconly"
4119 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4120 (match_operand:SF 2 "general_operand" "f,R"))
4121 (match_operand:SF 3 "const0_operand" "")))
4122 (clobber (match_scratch:SF 0 "=f,f"))]
4123 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4127 [(set_attr "op_type" "RRE,RXE")
4128 (set_attr "type" "fsimps,fsimps")])
4130 (define_insn "*subsf3_ibm"
4131 [(set (match_operand:SF 0 "register_operand" "=f,f")
4132 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4133 (match_operand:SF 2 "general_operand" "f,R")))
4134 (clobber (reg:CC 33))]
4135 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4139 [(set_attr "op_type" "RR,RX")
4140 (set_attr "type" "fsimps,fsimps")])
4144 ;;- Conditional add/subtract instructions.
4148 ; adddicc instruction pattern(s).
4151 (define_insn "*adddi3_alc_cc"
4154 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4155 (match_operand:DI 2 "general_operand" "d,m"))
4156 (match_operand:DI 3 "s390_alc_comparison" ""))
4158 (set (match_operand:DI 0 "register_operand" "=d,d")
4159 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4160 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4164 [(set_attr "op_type" "RRE,RXY")])
4166 (define_insn "*adddi3_alc"
4167 [(set (match_operand:DI 0 "register_operand" "=d,d")
4168 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4169 (match_operand:DI 2 "general_operand" "d,m"))
4170 (match_operand:DI 3 "s390_alc_comparison" "")))
4171 (clobber (reg:CC 33))]
4176 [(set_attr "op_type" "RRE,RXY")])
4178 (define_insn "*subdi3_slb_cc"
4181 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4182 (match_operand:DI 2 "general_operand" "d,m"))
4183 (match_operand:DI 3 "s390_slb_comparison" ""))
4185 (set (match_operand:DI 0 "register_operand" "=d,d")
4186 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4187 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4191 [(set_attr "op_type" "RRE,RXY")])
4193 (define_insn "*subdi3_slb"
4194 [(set (match_operand:DI 0 "register_operand" "=d,d")
4195 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4196 (match_operand:DI 2 "general_operand" "d,m"))
4197 (match_operand:DI 3 "s390_slb_comparison" "")))
4198 (clobber (reg:CC 33))]
4203 [(set_attr "op_type" "RRE,RXY")])
4206 ; addsicc instruction pattern(s).
4209 (define_insn "*addsi3_alc_cc"
4212 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4213 (match_operand:SI 2 "general_operand" "d,m"))
4214 (match_operand:SI 3 "s390_alc_comparison" ""))
4216 (set (match_operand:SI 0 "register_operand" "=d,d")
4217 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4218 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4222 [(set_attr "op_type" "RRE,RXY")])
4224 (define_insn "*addsi3_alc"
4225 [(set (match_operand:SI 0 "register_operand" "=d,d")
4226 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4227 (match_operand:SI 2 "general_operand" "d,m"))
4228 (match_operand:SI 3 "s390_alc_comparison" "")))
4229 (clobber (reg:CC 33))]
4234 [(set_attr "op_type" "RRE,RXY")])
4236 (define_insn "*subsi3_slb_cc"
4239 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4240 (match_operand:SI 2 "general_operand" "d,m"))
4241 (match_operand:SI 3 "s390_slb_comparison" ""))
4243 (set (match_operand:SI 0 "register_operand" "=d,d")
4244 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4245 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4249 [(set_attr "op_type" "RRE,RXY")])
4251 (define_insn "*subsi3_slb"
4252 [(set (match_operand:SI 0 "register_operand" "=d,d")
4253 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4254 (match_operand:SI 2 "general_operand" "d,m"))
4255 (match_operand:SI 3 "s390_slb_comparison" "")))
4256 (clobber (reg:CC 33))]
4261 [(set_attr "op_type" "RRE,RXY")])
4265 ;;- Multiply instructions.
4269 ; muldi3 instruction pattern(s).
4272 (define_insn "*muldi3_sign"
4273 [(set (match_operand:DI 0 "register_operand" "=d,d")
4274 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4275 (match_operand:DI 1 "register_operand" "0,0")))]
4280 [(set_attr "op_type" "RRE,RXY")
4281 (set_attr "type" "imul")])
4283 (define_insn "muldi3"
4284 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4285 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4286 (match_operand:DI 2 "general_operand" "d,K,m")))]
4292 [(set_attr "op_type" "RRE,RI,RXY")
4293 (set_attr "type" "imul")])
4296 ; mulsi3 instruction pattern(s).
4299 (define_insn "*mulsi3_sign"
4300 [(set (match_operand:SI 0 "register_operand" "=d")
4301 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4302 (match_operand:SI 1 "register_operand" "0")))]
4305 [(set_attr "op_type" "RX")
4306 (set_attr "type" "imul")])
4308 (define_insn "mulsi3"
4309 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4310 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4311 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4318 [(set_attr "op_type" "RRE,RI,RX,RXY")
4319 (set_attr "type" "imul")])
4322 ; mulsidi3 instruction pattern(s).
4325 (define_insn "mulsidi3"
4326 [(set (match_operand:DI 0 "register_operand" "=d,d")
4327 (mult:DI (sign_extend:DI
4328 (match_operand:SI 1 "register_operand" "%0,0"))
4330 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4335 [(set_attr "op_type" "RR,RX")
4336 (set_attr "type" "imul")])
4339 ; umulsidi3 instruction pattern(s).
4342 (define_insn "umulsidi3"
4343 [(set (match_operand:DI 0 "register_operand" "=d,d")
4344 (mult:DI (zero_extend:DI
4345 (match_operand:SI 1 "register_operand" "%0,0"))
4347 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4348 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4352 [(set_attr "op_type" "RRE,RXY")
4353 (set_attr "type" "imul")])
4356 ; muldf3 instruction pattern(s).
4359 (define_expand "muldf3"
4360 [(set (match_operand:DF 0 "register_operand" "=f,f")
4361 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4362 (match_operand:DF 2 "general_operand" "f,R")))]
4366 (define_insn "*muldf3"
4367 [(set (match_operand:DF 0 "register_operand" "=f,f")
4368 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4369 (match_operand:DF 2 "general_operand" "f,R")))]
4370 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4374 [(set_attr "op_type" "RRE,RXE")
4375 (set_attr "type" "fmuld")])
4377 (define_insn "*muldf3_ibm"
4378 [(set (match_operand:DF 0 "register_operand" "=f,f")
4379 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4380 (match_operand:DF 2 "general_operand" "f,R")))]
4381 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4385 [(set_attr "op_type" "RR,RX")
4386 (set_attr "type" "fmuld")])
4388 (define_insn "*fmadddf"
4389 [(set (match_operand:DF 0 "register_operand" "=f,f")
4390 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4391 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4392 (match_operand:DF 3 "register_operand" "0,0")))]
4393 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4397 [(set_attr "op_type" "RRE,RXE")
4398 (set_attr "type" "fmuld")])
4400 (define_insn "*fmsubdf"
4401 [(set (match_operand:DF 0 "register_operand" "=f,f")
4402 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4403 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4404 (match_operand:DF 3 "register_operand" "0,0")))]
4405 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4409 [(set_attr "op_type" "RRE,RXE")
4410 (set_attr "type" "fmuld")])
4413 ; mulsf3 instruction pattern(s).
4416 (define_expand "mulsf3"
4417 [(set (match_operand:SF 0 "register_operand" "=f,f")
4418 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4419 (match_operand:SF 2 "general_operand" "f,R")))]
4423 (define_insn "*mulsf3"
4424 [(set (match_operand:SF 0 "register_operand" "=f,f")
4425 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4426 (match_operand:SF 2 "general_operand" "f,R")))]
4427 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4431 [(set_attr "op_type" "RRE,RXE")
4432 (set_attr "type" "fmuls")])
4434 (define_insn "*mulsf3_ibm"
4435 [(set (match_operand:SF 0 "register_operand" "=f,f")
4436 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4437 (match_operand:SF 2 "general_operand" "f,R")))]
4438 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4442 [(set_attr "op_type" "RR,RX")
4443 (set_attr "type" "fmuls")])
4445 (define_insn "*fmaddsf"
4446 [(set (match_operand:SF 0 "register_operand" "=f,f")
4447 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4448 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4449 (match_operand:SF 3 "register_operand" "0,0")))]
4450 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4454 [(set_attr "op_type" "RRE,RXE")
4455 (set_attr "type" "fmuls")])
4457 (define_insn "*fmsubsf"
4458 [(set (match_operand:SF 0 "register_operand" "=f,f")
4459 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4460 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4461 (match_operand:SF 3 "register_operand" "0,0")))]
4462 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4466 [(set_attr "op_type" "RRE,RXE")
4467 (set_attr "type" "fmuls")])
4470 ;;- Divide and modulo instructions.
4474 ; divmoddi4 instruction pattern(s).
4477 (define_expand "divmoddi4"
4478 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4479 (div:DI (match_operand:DI 1 "register_operand" "")
4480 (match_operand:DI 2 "general_operand" "")))
4481 (set (match_operand:DI 3 "general_operand" "")
4482 (mod:DI (match_dup 1) (match_dup 2)))])
4483 (clobber (match_dup 4))]
4486 rtx insn, div_equal, mod_equal;
4488 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4489 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4491 operands[4] = gen_reg_rtx(TImode);
4492 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4494 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4496 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4498 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4500 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4505 (define_insn "divmodtidi3"
4506 [(set (match_operand:TI 0 "register_operand" "=d,d")
4509 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4510 (match_operand:DI 2 "general_operand" "d,m")))
4513 (mod:DI (match_dup 1)
4520 [(set_attr "op_type" "RRE,RXY")
4521 (set_attr "type" "idiv")])
4523 (define_insn "divmodtisi3"
4524 [(set (match_operand:TI 0 "register_operand" "=d,d")
4527 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4528 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4531 (mod:DI (match_dup 1)
4532 (sign_extend:DI (match_dup 2))))
4538 [(set_attr "op_type" "RRE,RXY")
4539 (set_attr "type" "idiv")])
4542 ; udivmoddi4 instruction pattern(s).
4545 (define_expand "udivmoddi4"
4546 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4547 (udiv:DI (match_operand:DI 1 "general_operand" "")
4548 (match_operand:DI 2 "nonimmediate_operand" "")))
4549 (set (match_operand:DI 3 "general_operand" "")
4550 (umod:DI (match_dup 1) (match_dup 2)))])
4551 (clobber (match_dup 4))]
4554 rtx insn, div_equal, mod_equal, equal;
4556 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4557 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4558 equal = gen_rtx_IOR (TImode,
4559 gen_rtx_ZERO_EXTEND (TImode, div_equal),
4560 gen_rtx_ASHIFT (TImode,
4561 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4564 operands[4] = gen_reg_rtx(TImode);
4565 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4566 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4567 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4568 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4570 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4572 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4574 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4576 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4578 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4583 (define_insn "udivmodtidi3"
4584 [(set (match_operand:TI 0 "register_operand" "=d,d")
4585 (ior:TI (zero_extend:TI
4587 (udiv:TI (match_operand:TI 1 "register_operand" "0,0")
4589 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4593 (umod:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))
4599 [(set_attr "op_type" "RRE,RXY")
4600 (set_attr "type" "idiv")])
4603 ; divmodsi4 instruction pattern(s).
4606 (define_expand "divmodsi4"
4607 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4608 (div:SI (match_operand:SI 1 "general_operand" "")
4609 (match_operand:SI 2 "nonimmediate_operand" "")))
4610 (set (match_operand:SI 3 "general_operand" "")
4611 (mod:SI (match_dup 1) (match_dup 2)))])
4612 (clobber (match_dup 4))]
4615 rtx insn, div_equal, mod_equal, equal;
4617 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4618 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4619 equal = gen_rtx_IOR (DImode,
4620 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4621 gen_rtx_ASHIFT (DImode,
4622 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4625 operands[4] = gen_reg_rtx(DImode);
4626 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4627 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4629 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4631 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4633 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4635 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4637 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4642 (define_insn "divmoddisi3"
4643 [(set (match_operand:DI 0 "register_operand" "=d,d")
4644 (ior:DI (zero_extend:DI
4646 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4648 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4652 (mod:DI (match_dup 1) (sign_extend:SI (match_dup 2)))))
4658 [(set_attr "op_type" "RR,RX")
4659 (set_attr "type" "idiv")])
4662 ; udivsi3 and umodsi3 instruction pattern(s).
4665 (define_expand "udivmodsi4"
4666 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4667 (udiv:SI (match_operand:SI 1 "general_operand" "")
4668 (match_operand:SI 2 "nonimmediate_operand" "")))
4669 (set (match_operand:SI 3 "general_operand" "")
4670 (umod:SI (match_dup 1) (match_dup 2)))])
4671 (clobber (match_dup 4))]
4672 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4674 rtx insn, div_equal, mod_equal, equal;
4676 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4677 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4678 equal = gen_rtx_IOR (DImode,
4679 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4680 gen_rtx_ASHIFT (DImode,
4681 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4684 operands[4] = gen_reg_rtx(DImode);
4685 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4686 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4687 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4688 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4690 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4692 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4694 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4696 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4698 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4703 (define_insn "udivmoddisi3"
4704 [(set (match_operand:DI 0 "register_operand" "=d,d")
4705 (ior:DI (zero_extend:DI
4707 (udiv:DI (match_operand:DI 1 "register_operand" "0,0")
4709 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4713 (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))
4715 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4719 [(set_attr "op_type" "RRE,RXY")
4720 (set_attr "type" "idiv")])
4722 (define_expand "udivsi3"
4723 [(set (match_operand:SI 0 "register_operand" "=d")
4724 (udiv:SI (match_operand:SI 1 "general_operand" "")
4725 (match_operand:SI 2 "general_operand" "")))
4726 (clobber (match_dup 3))]
4727 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4729 rtx insn, udiv_equal, umod_equal, equal;
4731 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4732 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4733 equal = gen_rtx_IOR (DImode,
4734 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4735 gen_rtx_ASHIFT (DImode,
4736 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4739 operands[3] = gen_reg_rtx (DImode);
4741 if (CONSTANT_P (operands[2]))
4743 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4745 rtx label1 = gen_label_rtx ();
4747 operands[1] = make_safe_from (operands[1], operands[0]);
4748 emit_move_insn (operands[0], const0_rtx);
4749 emit_insn (gen_cmpsi (operands[1], operands[2]));
4750 emit_jump_insn (gen_bltu (label1));
4751 emit_move_insn (operands[0], const1_rtx);
4752 emit_label (label1);
4756 operands[2] = force_reg (SImode, operands[2]);
4757 operands[2] = make_safe_from (operands[2], operands[0]);
4759 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4760 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4763 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4765 insn = emit_move_insn (operands[0],
4766 gen_lowpart (SImode, operands[3]));
4768 gen_rtx_EXPR_LIST (REG_EQUAL,
4769 udiv_equal, REG_NOTES (insn));
4774 rtx label1 = gen_label_rtx ();
4775 rtx label2 = gen_label_rtx ();
4776 rtx label3 = gen_label_rtx ();
4778 operands[1] = force_reg (SImode, operands[1]);
4779 operands[1] = make_safe_from (operands[1], operands[0]);
4780 operands[2] = force_reg (SImode, operands[2]);
4781 operands[2] = make_safe_from (operands[2], operands[0]);
4783 emit_move_insn (operands[0], const0_rtx);
4784 emit_insn (gen_cmpsi (operands[2], operands[1]));
4785 emit_jump_insn (gen_bgtu (label3));
4786 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4787 emit_jump_insn (gen_blt (label2));
4788 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4789 emit_jump_insn (gen_beq (label1));
4790 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4791 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4794 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4796 insn = emit_move_insn (operands[0],
4797 gen_lowpart (SImode, operands[3]));
4799 gen_rtx_EXPR_LIST (REG_EQUAL,
4800 udiv_equal, REG_NOTES (insn));
4802 emit_label (label1);
4803 emit_move_insn (operands[0], operands[1]);
4805 emit_label (label2);
4806 emit_move_insn (operands[0], const1_rtx);
4807 emit_label (label3);
4809 emit_move_insn (operands[0], operands[0]);
4813 (define_expand "umodsi3"
4814 [(set (match_operand:SI 0 "register_operand" "=d")
4815 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4816 (match_operand:SI 2 "nonimmediate_operand" "")))
4817 (clobber (match_dup 3))]
4818 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4820 rtx insn, udiv_equal, umod_equal, equal;
4822 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4823 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4824 equal = gen_rtx_IOR (DImode,
4825 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4826 gen_rtx_ASHIFT (DImode,
4827 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4830 operands[3] = gen_reg_rtx (DImode);
4832 if (CONSTANT_P (operands[2]))
4834 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4836 rtx label1 = gen_label_rtx ();
4838 operands[1] = make_safe_from (operands[1], operands[0]);
4839 emit_move_insn (operands[0], operands[1]);
4840 emit_insn (gen_cmpsi (operands[0], operands[2]));
4841 emit_jump_insn (gen_bltu (label1));
4842 emit_insn (gen_abssi2 (operands[0], operands[2]));
4843 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4844 emit_label (label1);
4848 operands[2] = force_reg (SImode, operands[2]);
4849 operands[2] = make_safe_from (operands[2], operands[0]);
4851 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4852 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4855 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4857 insn = emit_move_insn (operands[0],
4858 gen_highpart (SImode, operands[3]));
4860 gen_rtx_EXPR_LIST (REG_EQUAL,
4861 umod_equal, REG_NOTES (insn));
4866 rtx label1 = gen_label_rtx ();
4867 rtx label2 = gen_label_rtx ();
4868 rtx label3 = gen_label_rtx ();
4870 operands[1] = force_reg (SImode, operands[1]);
4871 operands[1] = make_safe_from (operands[1], operands[0]);
4872 operands[2] = force_reg (SImode, operands[2]);
4873 operands[2] = make_safe_from (operands[2], operands[0]);
4875 emit_move_insn(operands[0], operands[1]);
4876 emit_insn (gen_cmpsi (operands[2], operands[1]));
4877 emit_jump_insn (gen_bgtu (label3));
4878 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4879 emit_jump_insn (gen_blt (label2));
4880 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4881 emit_jump_insn (gen_beq (label1));
4882 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4883 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4886 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4888 insn = emit_move_insn (operands[0],
4889 gen_highpart (SImode, operands[3]));
4891 gen_rtx_EXPR_LIST (REG_EQUAL,
4892 umod_equal, REG_NOTES (insn));
4894 emit_label (label1);
4895 emit_move_insn (operands[0], const0_rtx);
4897 emit_label (label2);
4898 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4899 emit_label (label3);
4905 ; divdf3 instruction pattern(s).
4908 (define_expand "divdf3"
4909 [(set (match_operand:DF 0 "register_operand" "=f,f")
4910 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4911 (match_operand:DF 2 "general_operand" "f,R")))]
4915 (define_insn "*divdf3"
4916 [(set (match_operand:DF 0 "register_operand" "=f,f")
4917 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4918 (match_operand:DF 2 "general_operand" "f,R")))]
4919 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4923 [(set_attr "op_type" "RRE,RXE")
4924 (set_attr "type" "fdivd")])
4926 (define_insn "*divdf3_ibm"
4927 [(set (match_operand:DF 0 "register_operand" "=f,f")
4928 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4929 (match_operand:DF 2 "general_operand" "f,R")))]
4930 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4934 [(set_attr "op_type" "RR,RX")
4935 (set_attr "type" "fdivd")])
4938 ; divsf3 instruction pattern(s).
4941 (define_expand "divsf3"
4942 [(set (match_operand:SF 0 "register_operand" "=f,f")
4943 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4944 (match_operand:SF 2 "general_operand" "f,R")))]
4948 (define_insn "*divsf3"
4949 [(set (match_operand:SF 0 "register_operand" "=f,f")
4950 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4951 (match_operand:SF 2 "general_operand" "f,R")))]
4952 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4956 [(set_attr "op_type" "RRE,RXE")
4957 (set_attr "type" "fdivs")])
4959 (define_insn "*divsf3"
4960 [(set (match_operand:SF 0 "register_operand" "=f,f")
4961 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4962 (match_operand:SF 2 "general_operand" "f,R")))]
4963 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4967 [(set_attr "op_type" "RR,RX")
4968 (set_attr "type" "fdivs")])
4972 ;;- And instructions.
4976 ; anddi3 instruction pattern(s).
4979 (define_insn "*anddi3_cc"
4981 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4982 (match_operand:DI 2 "general_operand" "d,m"))
4984 (set (match_operand:DI 0 "register_operand" "=d,d")
4985 (and:DI (match_dup 1) (match_dup 2)))]
4986 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4990 [(set_attr "op_type" "RRE,RXY")])
4992 (define_insn "*anddi3_cconly"
4994 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4995 (match_operand:DI 2 "general_operand" "d,m"))
4997 (clobber (match_scratch:DI 0 "=d,d"))]
4998 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5002 [(set_attr "op_type" "RRE,RXY")])
5004 (define_insn "*anddi3_ni"
5005 [(set (match_operand:DI 0 "register_operand" "=d")
5006 (and:DI (match_operand:DI 1 "nonimmediate_operand" "0")
5007 (match_operand:DI 2 "immediate_operand" "n")))
5008 (clobber (reg:CC 33))]
5009 "TARGET_64BIT && s390_single_hi (operands[2], DImode, -1) >= 0"
5011 int part = s390_single_hi (operands[2], DImode, -1);
5012 operands[2] = GEN_INT (s390_extract_hi (operands[2], DImode, part));
5016 case 0: return "nihh\t%0,%x2";
5017 case 1: return "nihl\t%0,%x2";
5018 case 2: return "nilh\t%0,%x2";
5019 case 3: return "nill\t%0,%x2";
5023 [(set_attr "op_type" "RI")])
5025 (define_insn "anddi3"
5026 [(set (match_operand:DI 0 "register_operand" "=d,d")
5027 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5028 (match_operand:DI 2 "general_operand" "d,m")))
5029 (clobber (reg:CC 33))]
5034 [(set_attr "op_type" "RRE,RXY")])
5036 (define_insn "*anddi3_ss"
5037 [(set (match_operand:DI 0 "s_operand" "=Q")
5038 (and:DI (match_dup 0)
5039 (match_operand:DI 1 "s_imm_operand" "Q")))
5040 (clobber (reg:CC 33))]
5043 [(set_attr "op_type" "SS")])
5045 (define_insn "*anddi3_ss_inv"
5046 [(set (match_operand:DI 0 "s_operand" "=Q")
5047 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5049 (clobber (reg:CC 33))]
5052 [(set_attr "op_type" "SS")])
5055 ; andsi3 instruction pattern(s).
5058 (define_insn "*andsi3_cc"
5060 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5061 (match_operand:SI 2 "general_operand" "d,R,T"))
5063 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5064 (and:SI (match_dup 1) (match_dup 2)))]
5065 "s390_match_ccmode(insn, CCTmode)"
5070 [(set_attr "op_type" "RR,RX,RXY")])
5072 (define_insn "*andsi3_cconly"
5074 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5075 (match_operand:SI 2 "general_operand" "d,R,T"))
5077 (clobber (match_scratch:SI 0 "=d,d,d"))]
5078 "s390_match_ccmode(insn, CCTmode)"
5083 [(set_attr "op_type" "RR,RX,RXY")])
5085 (define_insn "*andsi3_ni"
5086 [(set (match_operand:SI 0 "register_operand" "=d")
5087 (and:SI (match_operand:SI 1 "nonimmediate_operand" "0")
5088 (match_operand:SI 2 "immediate_operand" "n")))
5089 (clobber (reg:CC 33))]
5090 "TARGET_ZARCH && s390_single_hi (operands[2], SImode, -1) >= 0"
5092 int part = s390_single_hi (operands[2], SImode, -1);
5093 operands[2] = GEN_INT (s390_extract_hi (operands[2], SImode, part));
5097 case 0: return "nilh\t%0,%x2";
5098 case 1: return "nill\t%0,%x2";
5102 [(set_attr "op_type" "RI")])
5104 (define_insn "andsi3"
5105 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5106 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5107 (match_operand:SI 2 "general_operand" "d,R,T")))
5108 (clobber (reg:CC 33))]
5114 [(set_attr "op_type" "RR,RX,RXY")])
5116 (define_insn "*andsi3_ss"
5117 [(set (match_operand:SI 0 "s_operand" "=Q")
5118 (and:SI (match_dup 0)
5119 (match_operand:SI 1 "s_imm_operand" "Q")))
5120 (clobber (reg:CC 33))]
5123 [(set_attr "op_type" "SS")])
5125 (define_insn "*andsi3_ss_inv"
5126 [(set (match_operand:SI 0 "s_operand" "=Q")
5127 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5129 (clobber (reg:CC 33))]
5132 [(set_attr "op_type" "SS")])
5135 ; andhi3 instruction pattern(s).
5138 (define_insn "*andhi3_ni"
5139 [(set (match_operand:HI 0 "register_operand" "=d,d")
5140 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5141 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5142 (clobber (reg:CC 33))]
5147 [(set_attr "op_type" "RR,RI")])
5149 (define_insn "andhi3"
5150 [(set (match_operand:HI 0 "register_operand" "=d")
5151 (and:HI (match_operand:HI 1 "register_operand" "%0")
5152 (match_operand:HI 2 "nonmemory_operand" "d")))
5153 (clobber (reg:CC 33))]
5156 [(set_attr "op_type" "RR")])
5158 (define_insn "*andhi3_ss"
5159 [(set (match_operand:HI 0 "s_operand" "=Q")
5160 (and:HI (match_dup 0)
5161 (match_operand:HI 1 "s_imm_operand" "Q")))
5162 (clobber (reg:CC 33))]
5165 [(set_attr "op_type" "SS")])
5167 (define_insn "*andhi3_ss_inv"
5168 [(set (match_operand:HI 0 "s_operand" "=Q")
5169 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5171 (clobber (reg:CC 33))]
5174 [(set_attr "op_type" "SS")])
5177 ; andqi3 instruction pattern(s).
5180 (define_insn "*andqi3_ni"
5181 [(set (match_operand:QI 0 "register_operand" "=d,d")
5182 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5183 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5184 (clobber (reg:CC 33))]
5189 [(set_attr "op_type" "RR,RI")])
5191 (define_insn "andqi3"
5192 [(set (match_operand:QI 0 "register_operand" "=d")
5193 (and:QI (match_operand:QI 1 "register_operand" "%0")
5194 (match_operand:QI 2 "nonmemory_operand" "d")))
5195 (clobber (reg:CC 33))]
5198 [(set_attr "op_type" "RR")])
5200 (define_insn "*andqi3_ss"
5201 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5202 (and:QI (match_dup 0)
5203 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5204 (clobber (reg:CC 33))]
5210 [(set_attr "op_type" "SI,SIY,SS")])
5212 (define_insn "*andqi3_ss_inv"
5213 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5214 (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5216 (clobber (reg:CC 33))]
5222 [(set_attr "op_type" "SI,SIY,SS")])
5226 ;;- Bit set (inclusive or) instructions.
5230 ; iordi3 instruction pattern(s).
5233 (define_insn "*iordi3_cc"
5235 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5236 (match_operand:DI 2 "general_operand" "d,m"))
5238 (set (match_operand:DI 0 "register_operand" "=d,d")
5239 (ior:DI (match_dup 1) (match_dup 2)))]
5240 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5244 [(set_attr "op_type" "RRE,RXY")])
5246 (define_insn "*iordi3_cconly"
5248 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5249 (match_operand:DI 2 "general_operand" "d,m"))
5251 (clobber (match_scratch:DI 0 "=d,d"))]
5252 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5256 [(set_attr "op_type" "RRE,RXY")])
5258 (define_insn "*iordi3_oi"
5259 [(set (match_operand:DI 0 "register_operand" "=d")
5260 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0")
5261 (match_operand:DI 2 "immediate_operand" "n")))
5262 (clobber (reg:CC 33))]
5263 "TARGET_64BIT && s390_single_hi (operands[2], DImode, 0) >= 0"
5265 int part = s390_single_hi (operands[2], DImode, 0);
5266 operands[2] = GEN_INT (s390_extract_hi (operands[2], DImode, part));
5270 case 0: return "oihh\t%0,%x2";
5271 case 1: return "oihl\t%0,%x2";
5272 case 2: return "oilh\t%0,%x2";
5273 case 3: return "oill\t%0,%x2";
5277 [(set_attr "op_type" "RI")])
5279 (define_insn "iordi3"
5280 [(set (match_operand:DI 0 "register_operand" "=d,d")
5281 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5282 (match_operand:DI 2 "general_operand" "d,m")))
5283 (clobber (reg:CC 33))]
5288 [(set_attr "op_type" "RRE,RXY")])
5290 (define_insn "*iordi3_ss"
5291 [(set (match_operand:DI 0 "s_operand" "=Q")
5292 (ior:DI (match_dup 0)
5293 (match_operand:DI 1 "s_imm_operand" "Q")))
5294 (clobber (reg:CC 33))]
5297 [(set_attr "op_type" "SS")])
5299 (define_insn "*iordi3_ss_inv"
5300 [(set (match_operand:DI 0 "s_operand" "=Q")
5301 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5303 (clobber (reg:CC 33))]
5306 [(set_attr "op_type" "SS")])
5309 ; iorsi3 instruction pattern(s).
5312 (define_insn "*iorsi3_cc"
5314 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5315 (match_operand:SI 2 "general_operand" "d,R,T"))
5317 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5318 (ior:SI (match_dup 1) (match_dup 2)))]
5319 "s390_match_ccmode(insn, CCTmode)"
5324 [(set_attr "op_type" "RR,RX,RXY")])
5326 (define_insn "*iorsi3_cconly"
5328 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5329 (match_operand:SI 2 "general_operand" "d,R,T"))
5331 (clobber (match_scratch:SI 0 "=d,d,d"))]
5332 "s390_match_ccmode(insn, CCTmode)"
5337 [(set_attr "op_type" "RR,RX,RXY")])
5339 (define_insn "*iorsi3_oi"
5340 [(set (match_operand:SI 0 "register_operand" "=d")
5341 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0")
5342 (match_operand:SI 2 "immediate_operand" "n")))
5343 (clobber (reg:CC 33))]
5344 "TARGET_ZARCH && s390_single_hi (operands[2], SImode, 0) >= 0"
5346 int part = s390_single_hi (operands[2], SImode, 0);
5347 operands[2] = GEN_INT (s390_extract_hi (operands[2], SImode, part));
5351 case 0: return "oilh\t%0,%x2";
5352 case 1: return "oill\t%0,%x2";
5356 [(set_attr "op_type" "RI")])
5358 (define_insn "iorsi3"
5359 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5360 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5361 (match_operand:SI 2 "general_operand" "d,R,T")))
5362 (clobber (reg:CC 33))]
5368 [(set_attr "op_type" "RR,RX,RXY")])
5370 (define_insn "*iorsi3_ss"
5371 [(set (match_operand:SI 0 "s_operand" "=Q")
5372 (ior:SI (match_dup 0)
5373 (match_operand:SI 1 "s_imm_operand" "Q")))
5374 (clobber (reg:CC 33))]
5377 [(set_attr "op_type" "SS")])
5379 (define_insn "*iorsi3_ss_inv"
5380 [(set (match_operand:SI 0 "s_operand" "=Q")
5381 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5383 (clobber (reg:CC 33))]
5386 [(set_attr "op_type" "SS")])
5389 ; iorhi3 instruction pattern(s).
5392 (define_insn "*iorhi3_oi"
5393 [(set (match_operand:HI 0 "register_operand" "=d,d")
5394 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5395 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5396 (clobber (reg:CC 33))]
5401 [(set_attr "op_type" "RR,RI")])
5403 (define_insn "iorhi3"
5404 [(set (match_operand:HI 0 "register_operand" "=d")
5405 (ior:HI (match_operand:HI 1 "register_operand" "%0")
5406 (match_operand:HI 2 "nonmemory_operand" "d")))
5407 (clobber (reg:CC 33))]
5410 [(set_attr "op_type" "RR")])
5412 (define_insn "*iorhi3_ss"
5413 [(set (match_operand:HI 0 "s_operand" "=Q")
5414 (ior:HI (match_dup 0)
5415 (match_operand:HI 1 "s_imm_operand" "Q")))
5416 (clobber (reg:CC 33))]
5419 [(set_attr "op_type" "SS")])
5421 (define_insn "*iorhi3_ss_inv"
5422 [(set (match_operand:HI 0 "s_operand" "=Q")
5423 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5425 (clobber (reg:CC 33))]
5428 [(set_attr "op_type" "SS")])
5431 ; iorqi3 instruction pattern(s).
5434 (define_insn "*iorqi3_oi"
5435 [(set (match_operand:QI 0 "register_operand" "=d,d")
5436 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5437 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5438 (clobber (reg:CC 33))]
5443 [(set_attr "op_type" "RR,RI")])
5445 (define_insn "iorqi3"
5446 [(set (match_operand:QI 0 "register_operand" "=d")
5447 (ior:QI (match_operand:QI 1 "register_operand" "%0")
5448 (match_operand:QI 2 "nonmemory_operand" "d")))
5449 (clobber (reg:CC 33))]
5452 [(set_attr "op_type" "RR")])
5454 (define_insn "*iorqi3_ss"
5455 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5456 (ior:QI (match_dup 0)
5457 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5458 (clobber (reg:CC 33))]
5464 [(set_attr "op_type" "SI,SIY,SS")])
5466 (define_insn "*iorqi3_ss_inv"
5467 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5468 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5470 (clobber (reg:CC 33))]
5476 [(set_attr "op_type" "SI,SIY,SS")])
5480 ;;- Xor instructions.
5484 ; xordi3 instruction pattern(s).
5487 (define_insn "*xordi3_cc"
5489 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5490 (match_operand:DI 2 "general_operand" "d,m"))
5492 (set (match_operand:DI 0 "register_operand" "=d,d")
5493 (xor:DI (match_dup 1) (match_dup 2)))]
5494 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5498 [(set_attr "op_type" "RRE,RXY")])
5500 (define_insn "*xordi3_cconly"
5502 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5503 (match_operand:DI 2 "general_operand" "d,m"))
5505 (clobber (match_scratch:DI 0 "=d,d"))]
5506 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5510 [(set_attr "op_type" "RRE,RXY")])
5512 (define_insn "xordi3"
5513 [(set (match_operand:DI 0 "register_operand" "=d,d")
5514 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5515 (match_operand:DI 2 "general_operand" "d,m")))
5516 (clobber (reg:CC 33))]
5521 [(set_attr "op_type" "RRE,RXY")])
5523 (define_insn "*xordi3_ss"
5524 [(set (match_operand:DI 0 "s_operand" "=Q")
5525 (xor:DI (match_dup 0)
5526 (match_operand:DI 1 "s_imm_operand" "Q")))
5527 (clobber (reg:CC 33))]
5530 [(set_attr "op_type" "SS")])
5532 (define_insn "*xordi3_ss_inv"
5533 [(set (match_operand:DI 0 "s_operand" "=Q")
5534 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5536 (clobber (reg:CC 33))]
5539 [(set_attr "op_type" "SS")])
5542 ; xorsi3 instruction pattern(s).
5545 (define_insn "*xorsi3_cc"
5547 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5548 (match_operand:SI 2 "general_operand" "d,R,T"))
5550 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5551 (xor:SI (match_dup 1) (match_dup 2)))]
5552 "s390_match_ccmode(insn, CCTmode)"
5557 [(set_attr "op_type" "RR,RX,RXY")])
5559 (define_insn "*xorsi3_cconly"
5561 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5562 (match_operand:SI 2 "general_operand" "d,R,T"))
5564 (clobber (match_scratch:SI 0 "=d,d,d"))]
5565 "s390_match_ccmode(insn, CCTmode)"
5570 [(set_attr "op_type" "RR,RX,RXY")])
5572 (define_insn "xorsi3"
5573 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5574 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5575 (match_operand:SI 2 "general_operand" "d,R,T")))
5576 (clobber (reg:CC 33))]
5582 [(set_attr "op_type" "RR,RX,RXY")])
5584 (define_insn "*xorsi3_ss"
5585 [(set (match_operand:SI 0 "s_operand" "=Q")
5586 (xor:SI (match_dup 0)
5587 (match_operand:SI 1 "s_imm_operand" "Q")))
5588 (clobber (reg:CC 33))]
5591 [(set_attr "op_type" "SS")])
5593 (define_insn "*xorsi3_ss_inv"
5594 [(set (match_operand:SI 0 "s_operand" "=Q")
5595 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5597 (clobber (reg:CC 33))]
5600 [(set_attr "op_type" "SS")])
5603 ; xorhi3 instruction pattern(s).
5606 (define_insn "xorhi3"
5607 [(set (match_operand:HI 0 "register_operand" "=d")
5608 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5609 (match_operand:HI 2 "nonmemory_operand" "d")))
5610 (clobber (reg:CC 33))]
5613 [(set_attr "op_type" "RR")])
5615 (define_insn "*xorhi3_ss"
5616 [(set (match_operand:HI 0 "s_operand" "=Q")
5617 (xor:HI (match_dup 0)
5618 (match_operand:HI 1 "s_imm_operand" "Q")))
5619 (clobber (reg:CC 33))]
5622 [(set_attr "op_type" "SS")])
5624 (define_insn "*xorhi3_ss_inv"
5625 [(set (match_operand:HI 0 "s_operand" "=Q")
5626 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5628 (clobber (reg:CC 33))]
5631 [(set_attr "op_type" "SS")])
5634 ; xorqi3 instruction pattern(s).
5637 (define_insn "xorqi3"
5638 [(set (match_operand:QI 0 "register_operand" "=d")
5639 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5640 (match_operand:QI 2 "nonmemory_operand" "d")))
5641 (clobber (reg:CC 33))]
5644 [(set_attr "op_type" "RR")])
5646 (define_insn "*xorqi3_ss"
5647 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5648 (xor:QI (match_dup 0)
5649 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5650 (clobber (reg:CC 33))]
5656 [(set_attr "op_type" "SI,SIY,SS")])
5658 (define_insn "*xorqi3_ss_inv"
5659 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5660 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5662 (clobber (reg:CC 33))]
5668 [(set_attr "op_type" "SI,SIY,SS")])
5672 ;;- Negate instructions.
5676 ; negdi2 instruction pattern(s).
5679 (define_expand "negdi2"
5681 [(set (match_operand:DI 0 "register_operand" "=d")
5682 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5683 (clobber (reg:CC 33))])]
5687 (define_insn "*negdi2_64"
5688 [(set (match_operand:DI 0 "register_operand" "=d")
5689 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5690 (clobber (reg:CC 33))]
5693 [(set_attr "op_type" "RR")])
5695 (define_insn "*negdi2_31"
5696 [(set (match_operand:DI 0 "register_operand" "=d")
5697 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5698 (clobber (reg:CC 33))]
5702 xop[0] = gen_label_rtx ();
5703 output_asm_insn ("lcr\t%0,%1", operands);
5704 output_asm_insn ("lcr\t%N0,%N1", operands);
5705 output_asm_insn ("je\t%l0", xop);
5706 output_asm_insn ("bctr\t%0,0", operands);
5707 targetm.asm_out.internal_label (asm_out_file, "L",
5708 CODE_LABEL_NUMBER (xop[0]));
5711 [(set_attr "op_type" "NN")
5712 (set_attr "type" "other")
5713 (set_attr "length" "10")])
5716 ; negsi2 instruction pattern(s).
5719 (define_insn "negsi2"
5720 [(set (match_operand:SI 0 "register_operand" "=d")
5721 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5722 (clobber (reg:CC 33))]
5725 [(set_attr "op_type" "RR")])
5728 ; negdf2 instruction pattern(s).
5731 (define_expand "negdf2"
5733 [(set (match_operand:DF 0 "register_operand" "=f")
5734 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5735 (clobber (reg:CC 33))])]
5739 (define_insn "*negdf2"
5740 [(set (match_operand:DF 0 "register_operand" "=f")
5741 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5742 (clobber (reg:CC 33))]
5743 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5745 [(set_attr "op_type" "RRE")
5746 (set_attr "type" "fsimpd")])
5748 (define_insn "*negdf2_ibm"
5749 [(set (match_operand:DF 0 "register_operand" "=f")
5750 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5751 (clobber (reg:CC 33))]
5752 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5754 [(set_attr "op_type" "RR")
5755 (set_attr "type" "fsimpd")])
5758 ; negsf2 instruction pattern(s).
5761 (define_expand "negsf2"
5763 [(set (match_operand:SF 0 "register_operand" "=f")
5764 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5765 (clobber (reg:CC 33))])]
5769 (define_insn "*negsf2"
5770 [(set (match_operand:SF 0 "register_operand" "=f")
5771 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5772 (clobber (reg:CC 33))]
5773 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5775 [(set_attr "op_type" "RRE")
5776 (set_attr "type" "fsimps")])
5778 (define_insn "*negsf2"
5779 [(set (match_operand:SF 0 "register_operand" "=f")
5780 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5781 (clobber (reg:CC 33))]
5782 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5784 [(set_attr "op_type" "RR")
5785 (set_attr "type" "fsimps")])
5789 ;;- Absolute value instructions.
5793 ; absdi2 instruction pattern(s).
5796 (define_insn "absdi2"
5797 [(set (match_operand:DI 0 "register_operand" "=d")
5798 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5799 (clobber (reg:CC 33))]
5802 [(set_attr "op_type" "RRE")])
5805 ; abssi2 instruction pattern(s).
5808 (define_insn "abssi2"
5809 [(set (match_operand:SI 0 "register_operand" "=d")
5810 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5811 (clobber (reg:CC 33))]
5814 [(set_attr "op_type" "RR")])
5817 ; absdf2 instruction pattern(s).
5820 (define_expand "absdf2"
5822 [(set (match_operand:DF 0 "register_operand" "=f")
5823 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5824 (clobber (reg:CC 33))])]
5828 (define_insn "*absdf2"
5829 [(set (match_operand:DF 0 "register_operand" "=f")
5830 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5831 (clobber (reg:CC 33))]
5832 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5834 [(set_attr "op_type" "RRE")
5835 (set_attr "type" "fsimpd")])
5837 (define_insn "*absdf2_ibm"
5838 [(set (match_operand:DF 0 "register_operand" "=f")
5839 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5840 (clobber (reg:CC 33))]
5841 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5843 [(set_attr "op_type" "RR")
5844 (set_attr "type" "fsimpd")])
5847 ; abssf2 instruction pattern(s).
5850 (define_expand "abssf2"
5852 [(set (match_operand:SF 0 "register_operand" "=f")
5853 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5854 (clobber (reg:CC 33))])]
5858 (define_insn "*abssf2"
5859 [(set (match_operand:SF 0 "register_operand" "=f")
5860 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5861 (clobber (reg:CC 33))]
5862 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5864 [(set_attr "op_type" "RRE")
5865 (set_attr "type" "fsimps")])
5867 (define_insn "*abssf2_ibm"
5868 [(set (match_operand:SF 0 "register_operand" "=f")
5869 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5870 (clobber (reg:CC 33))]
5871 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5873 [(set_attr "op_type" "RR")
5874 (set_attr "type" "fsimps")])
5877 ;;- Negated absolute value instructions
5884 (define_insn "*negabssi2"
5885 [(set (match_operand:SI 0 "register_operand" "=d")
5886 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
5887 (clobber (reg:CC 33))]
5890 [(set_attr "op_type" "RR")])
5892 (define_insn "*negabsdi2"
5893 [(set (match_operand:DI 0 "register_operand" "=d")
5894 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
5895 (clobber (reg:CC 33))]
5898 [(set_attr "op_type" "RRE")])
5904 (define_insn "*negabssf2"
5905 [(set (match_operand:SF 0 "register_operand" "=f")
5906 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5907 (clobber (reg:CC 33))]
5908 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5910 [(set_attr "op_type" "RRE")
5911 (set_attr "type" "fsimps")])
5913 (define_insn "*negabsdf2"
5914 [(set (match_operand:DF 0 "register_operand" "=f")
5915 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5916 (clobber (reg:CC 33))]
5917 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5919 [(set_attr "op_type" "RRE")
5920 (set_attr "type" "fsimpd")])
5923 ;;- Square root instructions.
5927 ; sqrtdf2 instruction pattern(s).
5930 (define_insn "sqrtdf2"
5931 [(set (match_operand:DF 0 "register_operand" "=f,f")
5932 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
5933 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5937 [(set_attr "op_type" "RRE,RXE")])
5940 ; sqrtsf2 instruction pattern(s).
5943 (define_insn "sqrtsf2"
5944 [(set (match_operand:SF 0 "register_operand" "=f,f")
5945 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
5946 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5950 [(set_attr "op_type" "RRE,RXE")])
5953 ;;- One complement instructions.
5957 ; one_cmpldi2 instruction pattern(s).
5960 (define_expand "one_cmpldi2"
5962 [(set (match_operand:DI 0 "register_operand" "")
5963 (xor:DI (match_operand:DI 1 "register_operand" "")
5965 (clobber (reg:CC 33))])]
5970 ; one_cmplsi2 instruction pattern(s).
5973 (define_expand "one_cmplsi2"
5975 [(set (match_operand:SI 0 "register_operand" "")
5976 (xor:SI (match_operand:SI 1 "register_operand" "")
5978 (clobber (reg:CC 33))])]
5983 ; one_cmplhi2 instruction pattern(s).
5986 (define_expand "one_cmplhi2"
5988 [(set (match_operand:HI 0 "register_operand" "")
5989 (xor:HI (match_operand:HI 1 "register_operand" "")
5991 (clobber (reg:CC 33))])]
5996 ; one_cmplqi2 instruction pattern(s).
5999 (define_expand "one_cmplqi2"
6001 [(set (match_operand:QI 0 "register_operand" "")
6002 (xor:QI (match_operand:QI 1 "register_operand" "")
6004 (clobber (reg:CC 33))])]
6010 ;;- Rotate instructions.
6014 ; rotldi3 instruction pattern(s).
6017 (define_insn "rotldi3"
6018 [(set (match_operand:DI 0 "register_operand" "=d")
6019 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6020 (match_operand:SI 2 "shift_count_operand" "Y")))]
6023 [(set_attr "op_type" "RSE")
6024 (set_attr "atype" "reg")])
6027 ; rotlsi3 instruction pattern(s).
6030 (define_insn "rotlsi3"
6031 [(set (match_operand:SI 0 "register_operand" "=d")
6032 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6033 (match_operand:SI 2 "shift_count_operand" "Y")))]
6036 [(set_attr "op_type" "RSE")
6037 (set_attr "atype" "reg")])
6041 ;;- Arithmetic shift instructions.
6045 ; ashldi3 instruction pattern(s).
6048 (define_expand "ashldi3"
6049 [(set (match_operand:DI 0 "register_operand" "")
6050 (ashift:DI (match_operand:DI 1 "register_operand" "")
6051 (match_operand:SI 2 "shift_count_operand" "")))]
6055 (define_insn "*ashldi3_31"
6056 [(set (match_operand:DI 0 "register_operand" "=d")
6057 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6058 (match_operand:SI 2 "shift_count_operand" "Y")))]
6061 [(set_attr "op_type" "RS")
6062 (set_attr "atype" "reg")])
6064 (define_insn "*ashldi3_64"
6065 [(set (match_operand:DI 0 "register_operand" "=d")
6066 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6067 (match_operand:SI 2 "shift_count_operand" "Y")))]
6070 [(set_attr "op_type" "RSE")
6071 (set_attr "atype" "reg")])
6074 ; ashrdi3 instruction pattern(s).
6077 (define_expand "ashrdi3"
6079 [(set (match_operand:DI 0 "register_operand" "")
6080 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6081 (match_operand:SI 2 "shift_count_operand" "")))
6082 (clobber (reg:CC 33))])]
6086 (define_insn "*ashrdi3_cc_31"
6088 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6089 (match_operand:SI 2 "shift_count_operand" "Y"))
6091 (set (match_operand:DI 0 "register_operand" "=d")
6092 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6093 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6095 [(set_attr "op_type" "RS")
6096 (set_attr "atype" "reg")])
6098 (define_insn "*ashrdi3_cconly_31"
6100 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6101 (match_operand:SI 2 "shift_count_operand" "Y"))
6103 (clobber (match_scratch:DI 0 "=d"))]
6104 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6106 [(set_attr "op_type" "RS")
6107 (set_attr "atype" "reg")])
6109 (define_insn "*ashrdi3_31"
6110 [(set (match_operand:DI 0 "register_operand" "=d")
6111 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6112 (match_operand:SI 2 "shift_count_operand" "Y")))
6113 (clobber (reg:CC 33))]
6116 [(set_attr "op_type" "RS")
6117 (set_attr "atype" "reg")])
6119 (define_insn "*ashrdi3_cc_64"
6121 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6122 (match_operand:SI 2 "shift_count_operand" "Y"))
6124 (set (match_operand:DI 0 "register_operand" "=d")
6125 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6126 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6128 [(set_attr "op_type" "RSE")
6129 (set_attr "atype" "reg")])
6131 (define_insn "*ashrdi3_cconly_64"
6133 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6134 (match_operand:SI 2 "shift_count_operand" "Y"))
6136 (clobber (match_scratch:DI 0 "=d"))]
6137 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6139 [(set_attr "op_type" "RSE")
6140 (set_attr "atype" "reg")])
6142 (define_insn "*ashrdi3_64"
6143 [(set (match_operand:DI 0 "register_operand" "=d")
6144 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6145 (match_operand:SI 2 "shift_count_operand" "Y")))
6146 (clobber (reg:CC 33))]
6149 [(set_attr "op_type" "RSE")
6150 (set_attr "atype" "reg")])
6154 ; ashlsi3 instruction pattern(s).
6157 (define_insn "ashlsi3"
6158 [(set (match_operand:SI 0 "register_operand" "=d")
6159 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6160 (match_operand:SI 2 "shift_count_operand" "Y")))]
6163 [(set_attr "op_type" "RS")
6164 (set_attr "atype" "reg")])
6167 ; ashrsi3 instruction pattern(s).
6170 (define_insn "*ashrsi3_cc"
6172 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6173 (match_operand:SI 2 "shift_count_operand" "Y"))
6175 (set (match_operand:SI 0 "register_operand" "=d")
6176 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6177 "s390_match_ccmode(insn, CCSmode)"
6179 [(set_attr "op_type" "RS")
6180 (set_attr "atype" "reg")])
6183 (define_insn "*ashrsi3_cconly"
6185 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6186 (match_operand:SI 2 "shift_count_operand" "Y"))
6188 (clobber (match_scratch:SI 0 "=d"))]
6189 "s390_match_ccmode(insn, CCSmode)"
6191 [(set_attr "op_type" "RS")
6192 (set_attr "atype" "reg")])
6194 (define_insn "ashrsi3"
6195 [(set (match_operand:SI 0 "register_operand" "=d")
6196 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6197 (match_operand:SI 2 "shift_count_operand" "Y")))
6198 (clobber (reg:CC 33))]
6201 [(set_attr "op_type" "RS")
6202 (set_attr "atype" "reg")])
6206 ;;- logical shift instructions.
6210 ; lshrdi3 instruction pattern(s).
6213 (define_expand "lshrdi3"
6214 [(set (match_operand:DI 0 "register_operand" "")
6215 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6216 (match_operand:SI 2 "shift_count_operand" "")))]
6220 (define_insn "*lshrdi3_31"
6221 [(set (match_operand:DI 0 "register_operand" "=d")
6222 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6223 (match_operand:SI 2 "shift_count_operand" "Y")))]
6226 [(set_attr "op_type" "RS")
6227 (set_attr "atype" "reg")])
6229 (define_insn "*lshrdi3_64"
6230 [(set (match_operand:DI 0 "register_operand" "=d")
6231 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6232 (match_operand:SI 2 "shift_count_operand" "Y")))]
6235 [(set_attr "op_type" "RSE")
6236 (set_attr "atype" "reg")])
6239 ; lshrsi3 instruction pattern(s).
6242 (define_insn "lshrsi3"
6243 [(set (match_operand:SI 0 "register_operand" "=d")
6244 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6245 (match_operand:SI 2 "shift_count_operand" "Y")))]
6248 [(set_attr "op_type" "RS")
6249 (set_attr "atype" "reg")])
6253 ;; Branch instruction patterns.
6256 (define_expand "beq"
6257 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6259 (if_then_else (eq (reg:CCZ 33) (const_int 0))
6260 (label_ref (match_operand 0 "" ""))
6263 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6265 (define_expand "bne"
6266 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6268 (if_then_else (ne (reg:CCZ 33) (const_int 0))
6269 (label_ref (match_operand 0 "" ""))
6272 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6274 (define_expand "bgt"
6275 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6277 (if_then_else (gt (reg:CCS 33) (const_int 0))
6278 (label_ref (match_operand 0 "" ""))
6281 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6283 (define_expand "bgtu"
6284 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6286 (if_then_else (gtu (reg:CCU 33) (const_int 0))
6287 (label_ref (match_operand 0 "" ""))
6290 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6292 (define_expand "blt"
6293 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6295 (if_then_else (lt (reg:CCS 33) (const_int 0))
6296 (label_ref (match_operand 0 "" ""))
6299 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6301 (define_expand "bltu"
6302 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6304 (if_then_else (ltu (reg:CCU 33) (const_int 0))
6305 (label_ref (match_operand 0 "" ""))
6308 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6310 (define_expand "bge"
6311 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6313 (if_then_else (ge (reg:CCS 33) (const_int 0))
6314 (label_ref (match_operand 0 "" ""))
6317 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6319 (define_expand "bgeu"
6320 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6322 (if_then_else (geu (reg:CCU 33) (const_int 0))
6323 (label_ref (match_operand 0 "" ""))
6326 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6328 (define_expand "ble"
6329 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6331 (if_then_else (le (reg:CCS 33) (const_int 0))
6332 (label_ref (match_operand 0 "" ""))
6335 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6337 (define_expand "bleu"
6338 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6340 (if_then_else (leu (reg:CCU 33) (const_int 0))
6341 (label_ref (match_operand 0 "" ""))
6344 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6346 (define_expand "bunordered"
6347 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6349 (if_then_else (unordered (reg:CCS 33) (const_int 0))
6350 (label_ref (match_operand 0 "" ""))
6353 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6355 (define_expand "bordered"
6356 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6358 (if_then_else (ordered (reg:CCS 33) (const_int 0))
6359 (label_ref (match_operand 0 "" ""))
6362 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6364 (define_expand "buneq"
6365 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6367 (if_then_else (uneq (reg:CCS 33) (const_int 0))
6368 (label_ref (match_operand 0 "" ""))
6371 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6373 (define_expand "bungt"
6374 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6376 (if_then_else (ungt (reg:CCS 33) (const_int 0))
6377 (label_ref (match_operand 0 "" ""))
6380 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6382 (define_expand "bunlt"
6383 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6385 (if_then_else (unlt (reg:CCS 33) (const_int 0))
6386 (label_ref (match_operand 0 "" ""))
6389 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6391 (define_expand "bunge"
6392 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6394 (if_then_else (unge (reg:CCS 33) (const_int 0))
6395 (label_ref (match_operand 0 "" ""))
6398 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6400 (define_expand "bunle"
6401 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6403 (if_then_else (unle (reg:CCS 33) (const_int 0))
6404 (label_ref (match_operand 0 "" ""))
6407 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6409 (define_expand "bltgt"
6410 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6412 (if_then_else (ltgt (reg:CCS 33) (const_int 0))
6413 (label_ref (match_operand 0 "" ""))
6416 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6420 ;;- Conditional jump instructions.
6423 (define_insn "cjump"
6426 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6427 (label_ref (match_operand 0 "" ""))
6431 if (get_attr_length (insn) == 4)
6433 else if (TARGET_CPU_ZARCH)
6434 return "jg%C1\t%l0";
6438 [(set_attr "op_type" "RI")
6439 (set_attr "type" "branch")
6440 (set (attr "length")
6441 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6443 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6445 (eq (symbol_ref "flag_pic") (const_int 0))
6446 (const_int 6)] (const_int 8)))])
6448 (define_insn "*cjump_long"
6451 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6452 (match_operand 0 "address_operand" "U")
6456 if (get_attr_op_type (insn) == OP_TYPE_RR)
6461 [(set (attr "op_type")
6462 (if_then_else (match_operand 0 "register_operand" "")
6463 (const_string "RR") (const_string "RX")))
6464 (set_attr "type" "branch")
6465 (set_attr "atype" "agen")])
6469 ;;- Negated conditional jump instructions.
6472 (define_insn "icjump"
6475 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6477 (label_ref (match_operand 0 "" ""))))]
6480 if (get_attr_length (insn) == 4)
6482 else if (TARGET_CPU_ZARCH)
6483 return "jg%D1\t%l0";
6487 [(set_attr "op_type" "RI")
6488 (set_attr "type" "branch")
6489 (set (attr "length")
6490 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6492 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6494 (eq (symbol_ref "flag_pic") (const_int 0))
6495 (const_int 6)] (const_int 8)))])
6497 (define_insn "*icjump_long"
6500 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6502 (match_operand 0 "address_operand" "U")))]
6505 if (get_attr_op_type (insn) == OP_TYPE_RR)
6510 [(set (attr "op_type")
6511 (if_then_else (match_operand 0 "register_operand" "")
6512 (const_string "RR") (const_string "RX")))
6513 (set_attr "type" "branch")
6514 (set_attr "atype" "agen")])
6517 ;;- Trap instructions.
6521 [(trap_if (const_int 1) (const_int 0))]
6524 [(set_attr "op_type" "RX")
6525 (set_attr "type" "branch")])
6527 (define_expand "conditional_trap"
6528 [(set (match_dup 2) (match_dup 3))
6529 (trap_if (match_operator 0 "comparison_operator"
6530 [(match_dup 2) (const_int 0)])
6531 (match_operand:SI 1 "general_operand" ""))]
6534 enum machine_mode ccmode;
6536 if (operands[1] != const0_rtx) FAIL;
6538 ccmode = s390_select_ccmode (GET_CODE (operands[0]),
6539 s390_compare_op0, s390_compare_op1);
6540 operands[2] = gen_rtx_REG (ccmode, 33);
6541 operands[3] = gen_rtx_COMPARE (ccmode, s390_compare_op0, s390_compare_op1);
6544 (define_insn "*trap"
6545 [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6549 [(set_attr "op_type" "RI")
6550 (set_attr "type" "branch")])
6553 ;;- Loop instructions.
6555 ;; This is all complicated by the fact that since this is a jump insn
6556 ;; we must handle our own output reloads.
6558 (define_expand "doloop_end"
6559 [(use (match_operand 0 "" "")) ; loop pseudo
6560 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6561 (use (match_operand 2 "" "")) ; max iterations
6562 (use (match_operand 3 "" "")) ; loop level
6563 (use (match_operand 4 "" ""))] ; label
6566 if (GET_MODE (operands[0]) == SImode)
6567 emit_jump_insn (gen_doloop_si (operands[4], operands[0], operands[0]));
6568 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6569 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6576 (define_insn "doloop_si"
6579 (ne (match_operand:SI 1 "register_operand" "d,d")
6581 (label_ref (match_operand 0 "" ""))
6583 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6584 (plus:SI (match_dup 1) (const_int -1)))
6585 (clobber (match_scratch:SI 3 "=X,&d"))
6586 (clobber (reg:CC 33))]
6589 if (which_alternative != 0)
6591 else if (get_attr_length (insn) == 4)
6592 return "brct\t%1,%l0";
6596 [(set_attr "op_type" "RI")
6597 (set_attr "type" "branch")
6598 (set (attr "length")
6599 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6601 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6603 (eq (symbol_ref "flag_pic") (const_int 0))
6604 (const_int 6)] (const_int 8)))])
6606 (define_insn "*doloop_si_long"
6609 (ne (match_operand:SI 1 "register_operand" "d,d")
6611 (match_operand 0 "address_operand" "U,U")
6613 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6614 (plus:SI (match_dup 1) (const_int -1)))
6615 (clobber (match_scratch:SI 3 "=X,&d"))
6616 (clobber (reg:CC 33))]
6619 if (get_attr_op_type (insn) == OP_TYPE_RR)
6620 return "bctr\t%1,%0";
6622 return "bct\t%1,%a0";
6624 [(set (attr "op_type")
6625 (if_then_else (match_operand 0 "register_operand" "")
6626 (const_string "RR") (const_string "RX")))
6627 (set_attr "type" "branch")
6628 (set_attr "atype" "agen")])
6632 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
6634 (match_operand 0 "" "")
6636 (set (match_operand:SI 2 "nonimmediate_operand" "")
6637 (plus:SI (match_dup 1) (const_int -1)))
6638 (clobber (match_scratch:SI 3 ""))
6639 (clobber (reg:CC 33))]
6641 && (! REG_P (operands[2])
6642 || ! rtx_equal_p (operands[1], operands[2]))"
6643 [(set (match_dup 3) (match_dup 1))
6644 (parallel [(set (reg:CCAN 33)
6645 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6647 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6648 (set (match_dup 2) (match_dup 3))
6649 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6654 (define_insn "doloop_di"
6657 (ne (match_operand:DI 1 "register_operand" "d,d")
6659 (label_ref (match_operand 0 "" ""))
6661 (set (match_operand:DI 2 "register_operand" "=1,?*m*r")
6662 (plus:DI (match_dup 1) (const_int -1)))
6663 (clobber (match_scratch:DI 3 "=X,&d"))
6664 (clobber (reg:CC 33))]
6667 if (which_alternative != 0)
6669 else if (get_attr_length (insn) == 4)
6670 return "brctg\t%1,%l0";
6674 [(set_attr "op_type" "RI")
6675 (set_attr "type" "branch")
6676 (set (attr "length")
6677 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6678 (const_int 4) (const_int 12)))])
6680 (define_insn "*doloop_di_long"
6683 (ne (match_operand:DI 1 "register_operand" "d,d")
6685 (match_operand 0 "address_operand" "U,U")
6687 (set (match_operand:DI 2 "register_operand" "=1,?*m*d")
6688 (plus:DI (match_dup 1) (const_int -1)))
6689 (clobber (match_scratch:DI 3 "=X,&d"))
6690 (clobber (reg:CC 33))]
6693 if (get_attr_op_type (insn) == OP_TYPE_RRE)
6694 return "bctgr\t%1,%0";
6696 return "bctg\t%1,%a0";
6698 [(set (attr "op_type")
6699 (if_then_else (match_operand 0 "register_operand" "")
6700 (const_string "RRE") (const_string "RXE")))
6701 (set_attr "type" "branch")
6702 (set_attr "atype" "agen")])
6706 (if_then_else (ne (match_operand:DI 1 "register_operand" "")
6708 (match_operand 0 "" "")
6710 (set (match_operand:DI 2 "nonimmediate_operand" "")
6711 (plus:DI (match_dup 1) (const_int -1)))
6712 (clobber (match_scratch:DI 3 ""))
6713 (clobber (reg:CC 33))]
6715 && (! REG_P (operands[2])
6716 || ! rtx_equal_p (operands[1], operands[2]))"
6717 [(set (match_dup 3) (match_dup 1))
6718 (parallel [(set (reg:CCAN 33)
6719 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6721 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6722 (set (match_dup 2) (match_dup 3))
6723 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6729 ;;- Unconditional jump instructions.
6733 ; jump instruction pattern(s).
6737 [(set (pc) (label_ref (match_operand 0 "" "")))]
6740 if (get_attr_length (insn) == 4)
6742 else if (TARGET_CPU_ZARCH)
6747 [(set_attr "op_type" "RI")
6748 (set_attr "type" "branch")
6749 (set (attr "length")
6750 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6752 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6754 (eq (symbol_ref "flag_pic") (const_int 0))
6755 (const_int 6)] (const_int 8)))])
6758 ; indirect-jump instruction pattern(s).
6761 (define_insn "indirect_jump"
6762 [(set (pc) (match_operand 0 "address_operand" "U"))]
6765 if (get_attr_op_type (insn) == OP_TYPE_RR)
6770 [(set (attr "op_type")
6771 (if_then_else (match_operand 0 "register_operand" "")
6772 (const_string "RR") (const_string "RX")))
6773 (set_attr "type" "branch")
6774 (set_attr "atype" "agen")])
6777 ; casesi instruction pattern(s).
6780 (define_insn "casesi_jump"
6781 [(set (pc) (match_operand 0 "address_operand" "U"))
6782 (use (label_ref (match_operand 1 "" "")))]
6785 if (get_attr_op_type (insn) == OP_TYPE_RR)
6790 [(set (attr "op_type")
6791 (if_then_else (match_operand 0 "register_operand" "")
6792 (const_string "RR") (const_string "RX")))
6793 (set_attr "type" "branch")
6794 (set_attr "atype" "agen")])
6796 (define_expand "casesi"
6797 [(match_operand:SI 0 "general_operand" "")
6798 (match_operand:SI 1 "general_operand" "")
6799 (match_operand:SI 2 "general_operand" "")
6800 (label_ref (match_operand 3 "" ""))
6801 (label_ref (match_operand 4 "" ""))]
6804 rtx index = gen_reg_rtx (SImode);
6805 rtx base = gen_reg_rtx (Pmode);
6806 rtx target = gen_reg_rtx (Pmode);
6808 emit_move_insn (index, operands[0]);
6809 emit_insn (gen_subsi3 (index, index, operands[1]));
6810 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6813 if (Pmode != SImode)
6814 index = convert_to_mode (Pmode, index, 1);
6815 if (GET_CODE (index) != REG)
6816 index = copy_to_mode_reg (Pmode, index);
6819 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6821 emit_insn (gen_ashlsi3 (index, index, GEN_INT (2)));
6823 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6825 index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
6826 emit_move_insn (target, index);
6829 target = gen_rtx_PLUS (Pmode, base, target);
6830 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6837 ;;- Jump to subroutine.
6842 ; untyped call instruction pattern(s).
6845 ;; Call subroutine returning any type.
6846 (define_expand "untyped_call"
6847 [(parallel [(call (match_operand 0 "" "")
6849 (match_operand 1 "" "")
6850 (match_operand 2 "" "")])]
6855 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6857 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6859 rtx set = XVECEXP (operands[2], 0, i);
6860 emit_move_insn (SET_DEST (set), SET_SRC (set));
6863 /* The optimizer does not know that the call sets the function value
6864 registers we stored in the result block. We avoid problems by
6865 claiming that all hard registers are used and clobbered at this
6867 emit_insn (gen_blockage ());
6872 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6873 ;; all of memory. This blocks insns from being moved across this point.
6875 (define_insn "blockage"
6876 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6879 [(set_attr "type" "none")
6880 (set_attr "length" "0")])
6885 ; call instruction pattern(s).
6888 (define_expand "call"
6889 [(call (match_operand 0 "" "")
6890 (match_operand 1 "" ""))
6891 (use (match_operand 2 "" ""))]
6894 bool plt_call = false;
6897 /* Direct function calls need special treatment. */
6898 if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
6900 rtx sym = XEXP (operands[0], 0);
6902 /* When calling a global routine in PIC mode, we must
6903 replace the symbol itself with the PLT stub. */
6904 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
6906 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
6907 sym = gen_rtx_CONST (Pmode, sym);
6911 /* Unless we can use the bras(l) insn, force the
6912 routine address into a register. */
6913 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
6916 sym = legitimize_pic_address (sym, 0);
6918 sym = force_reg (Pmode, sym);
6921 operands[0] = gen_rtx_MEM (QImode, sym);
6925 insn = emit_call_insn (gen_call_exp (operands[0], operands[1],
6926 gen_rtx_REG (Pmode, RETURN_REGNUM)));
6928 /* 31-bit PLT stubs use the GOT register implicitly. */
6929 if (!TARGET_64BIT && plt_call)
6930 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
6935 (define_expand "call_exp"
6936 [(parallel [(call (match_operand 0 "" "")
6937 (match_operand 1 "" ""))
6938 (clobber (match_operand 2 "" ""))])]
6942 (define_insn "*bras"
6943 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6944 (match_operand 1 "const_int_operand" "n"))
6945 (clobber (match_operand 2 "register_operand" "=r"))]
6946 "TARGET_SMALL_EXEC && GET_MODE (operands[2]) == Pmode"
6948 [(set_attr "op_type" "RI")
6949 (set_attr "type" "jsr")])
6951 (define_insn "*brasl"
6952 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6953 (match_operand 1 "const_int_operand" "n"))
6954 (clobber (match_operand 2 "register_operand" "=r"))]
6955 "TARGET_CPU_ZARCH && GET_MODE (operands[2]) == Pmode"
6957 [(set_attr "op_type" "RIL")
6958 (set_attr "type" "jsr")])
6960 (define_insn "*basr"
6961 [(call (mem:QI (match_operand 0 "address_operand" "U"))
6962 (match_operand 1 "const_int_operand" "n"))
6963 (clobber (match_operand 2 "register_operand" "=r"))]
6964 "GET_MODE (operands[2]) == Pmode"
6966 if (get_attr_op_type (insn) == OP_TYPE_RR)
6967 return "basr\t%2,%0";
6969 return "bas\t%2,%a0";
6971 [(set (attr "op_type")
6972 (if_then_else (match_operand 0 "register_operand" "")
6973 (const_string "RR") (const_string "RX")))
6974 (set_attr "type" "jsr")
6975 (set_attr "atype" "agen")])
6978 ; call_value instruction pattern(s).
6981 (define_expand "call_value"
6982 [(set (match_operand 0 "" "")
6983 (call (match_operand 1 "" "")
6984 (match_operand 2 "" "")))
6985 (use (match_operand 3 "" ""))]
6988 bool plt_call = false;
6991 /* Direct function calls need special treatment. */
6992 if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
6994 rtx sym = XEXP (operands[1], 0);
6996 /* When calling a global routine in PIC mode, we must
6997 replace the symbol itself with the PLT stub. */
6998 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
7000 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7001 sym = gen_rtx_CONST (Pmode, sym);
7005 /* Unless we can use the bras(l) insn, force the
7006 routine address into a register. */
7007 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7010 sym = legitimize_pic_address (sym, 0);
7012 sym = force_reg (Pmode, sym);
7015 operands[1] = gen_rtx_MEM (QImode, sym);
7019 insn = emit_call_insn (
7020 gen_call_value_exp (operands[0], operands[1], operands[2],
7021 gen_rtx_REG (Pmode, RETURN_REGNUM)));
7023 /* 31-bit PLT stubs use the GOT register implicitly. */
7024 if (!TARGET_64BIT && plt_call)
7025 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7030 (define_expand "call_value_exp"
7031 [(parallel [(set (match_operand 0 "" "")
7032 (call (match_operand 1 "" "")
7033 (match_operand 2 "" "")))
7034 (clobber (match_operand 3 "" ""))])]
7038 (define_insn "*bras_r"
7039 [(set (match_operand 0 "register_operand" "=df")
7040 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7041 (match_operand:SI 2 "const_int_operand" "n")))
7042 (clobber (match_operand 3 "register_operand" "=r"))]
7043 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7045 [(set_attr "op_type" "RI")
7046 (set_attr "type" "jsr")])
7048 (define_insn "*brasl_r"
7049 [(set (match_operand 0 "register_operand" "=df")
7050 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7051 (match_operand 2 "const_int_operand" "n")))
7052 (clobber (match_operand 3 "register_operand" "=r"))]
7053 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7055 [(set_attr "op_type" "RIL")
7056 (set_attr "type" "jsr")])
7058 (define_insn "*basr_r"
7059 [(set (match_operand 0 "register_operand" "=df")
7060 (call (mem:QI (match_operand 1 "address_operand" "U"))
7061 (match_operand 2 "const_int_operand" "n")))
7062 (clobber (match_operand 3 "register_operand" "=r"))]
7063 "GET_MODE (operands[3]) == Pmode"
7065 if (get_attr_op_type (insn) == OP_TYPE_RR)
7066 return "basr\t%3,%1";
7068 return "bas\t%3,%a1";
7070 [(set (attr "op_type")
7071 (if_then_else (match_operand 1 "register_operand" "")
7072 (const_string "RR") (const_string "RX")))
7073 (set_attr "type" "jsr")
7074 (set_attr "atype" "agen")])
7077 ;;- Thread-local storage support.
7080 (define_insn "get_tp_64"
7081 [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7082 (unspec:DI [(const_int 0)] UNSPEC_TP))]
7085 ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7087 [(set_attr "op_type" "NN,RS")
7088 (set_attr "atype" "reg,*")
7089 (set_attr "type" "o3,*")
7090 (set_attr "length" "14,*")])
7092 (define_insn "get_tp_31"
7093 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7094 (unspec:SI [(const_int 0)] UNSPEC_TP))]
7099 [(set_attr "op_type" "RRE,RS")])
7101 (define_insn "set_tp_64"
7102 [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7103 (clobber (match_scratch:SI 1 "=d,X"))]
7106 sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7108 [(set_attr "op_type" "NN,RS")
7109 (set_attr "atype" "reg,*")
7110 (set_attr "type" "o3,*")
7111 (set_attr "length" "14,*")])
7113 (define_insn "set_tp_31"
7114 [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7119 [(set_attr "op_type" "RRE,RS")])
7121 (define_insn "*tls_load_64"
7122 [(set (match_operand:DI 0 "register_operand" "=d")
7123 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7124 (match_operand:DI 2 "" "")]
7128 [(set_attr "op_type" "RXE")])
7130 (define_insn "*tls_load_31"
7131 [(set (match_operand:SI 0 "register_operand" "=d,d")
7132 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7133 (match_operand:SI 2 "" "")]
7139 [(set_attr "op_type" "RX,RXY")])
7141 (define_expand "call_value_tls"
7142 [(set (match_operand 0 "" "")
7143 (call (const_int 0) (const_int 0)))
7144 (use (match_operand 1 "" ""))]
7152 sym = s390_tls_get_offset ();
7153 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7154 sym = gen_rtx_CONST (Pmode, sym);
7156 /* Unless we can use the bras(l) insn, force the
7157 routine address into a register. */
7158 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7161 sym = legitimize_pic_address (sym, 0);
7163 sym = force_reg (Pmode, sym);
7166 sym = gen_rtx_MEM (QImode, sym);
7169 insn = emit_call_insn (
7170 gen_call_value_tls_exp (operands[0], sym, const0_rtx,
7171 gen_rtx_REG (Pmode, RETURN_REGNUM),
7174 /* The calling convention of __tls_get_offset uses the
7175 GOT register implicitly. */
7176 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7177 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), operands[0]);
7178 CONST_OR_PURE_CALL_P (insn) = 1;
7183 (define_expand "call_value_tls_exp"
7184 [(parallel [(set (match_operand 0 "" "")
7185 (call (match_operand 1 "" "")
7186 (match_operand 2 "" "")))
7187 (clobber (match_operand 3 "" ""))
7188 (use (match_operand 4 "" ""))])]
7192 (define_insn "*bras_tls"
7193 [(set (match_operand 0 "register_operand" "=df")
7194 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7195 (match_operand 2 "const_int_operand" "n")))
7196 (clobber (match_operand 3 "register_operand" "=r"))
7197 (use (match_operand 4 "" ""))]
7198 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7200 [(set_attr "op_type" "RI")
7201 (set_attr "type" "jsr")])
7203 (define_insn "*brasl_tls"
7204 [(set (match_operand 0 "register_operand" "=df")
7205 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7206 (match_operand 2 "const_int_operand" "n")))
7207 (clobber (match_operand 3 "register_operand" "=r"))
7208 (use (match_operand 4 "" ""))]
7209 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7211 [(set_attr "op_type" "RIL")
7212 (set_attr "type" "jsr")])
7214 (define_insn "*basr_tls"
7215 [(set (match_operand 0 "register_operand" "=df")
7216 (call (mem:QI (match_operand 1 "address_operand" "U"))
7217 (match_operand 2 "const_int_operand" "n")))
7218 (clobber (match_operand 3 "register_operand" "=r"))
7219 (use (match_operand 4 "" ""))]
7220 "GET_MODE (operands[3]) == Pmode"
7222 if (get_attr_op_type (insn) == OP_TYPE_RR)
7223 return "basr\t%3,%1%J4";
7225 return "bas\t%3,%a1%J4";
7227 [(set (attr "op_type")
7228 (if_then_else (match_operand 1 "register_operand" "")
7229 (const_string "RR") (const_string "RX")))
7230 (set_attr "type" "jsr")
7231 (set_attr "atype" "agen")])
7234 ;;- Miscellaneous instructions.
7238 ; allocate stack instruction pattern(s).
7241 (define_expand "allocate_stack"
7243 (plus (reg 15) (match_operand 1 "general_operand" "")))
7244 (set (match_operand 0 "general_operand" "")
7248 rtx stack = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
7249 rtx chain = gen_rtx (MEM, Pmode, stack);
7250 rtx temp = gen_reg_rtx (Pmode);
7252 emit_move_insn (temp, chain);
7255 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7257 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7259 emit_move_insn (chain, temp);
7261 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7267 ; setjmp instruction pattern.
7270 (define_expand "builtin_setjmp_receiver"
7271 [(match_operand 0 "" "")]
7274 s390_load_got (false);
7275 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7279 ;; These patterns say how to save and restore the stack pointer. We need not
7280 ;; save the stack pointer at function level since we are careful to
7281 ;; preserve the backchain. At block level, we have to restore the backchain
7282 ;; when we restore the stack pointer.
7284 ;; For nonlocal gotos, we must save both the stack pointer and its
7285 ;; backchain and restore both. Note that in the nonlocal case, the
7286 ;; save area is a memory location.
7288 (define_expand "save_stack_function"
7289 [(match_operand 0 "general_operand" "")
7290 (match_operand 1 "general_operand" "")]
7294 (define_expand "restore_stack_function"
7295 [(match_operand 0 "general_operand" "")
7296 (match_operand 1 "general_operand" "")]
7300 (define_expand "restore_stack_block"
7301 [(use (match_operand 0 "register_operand" ""))
7302 (set (match_dup 2) (match_dup 3))
7303 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7304 (set (match_dup 3) (match_dup 2))]
7307 operands[2] = gen_reg_rtx (Pmode);
7308 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7311 (define_expand "save_stack_nonlocal"
7312 [(match_operand 0 "memory_operand" "")
7313 (match_operand 1 "register_operand" "")]
7316 rtx temp = gen_reg_rtx (Pmode);
7318 /* Copy the backchain to the first word, sp to the second and the literal pool
7319 base to the third. */
7320 emit_move_insn (operand_subword (operands[0], 2, 0,
7321 TARGET_64BIT ? OImode : TImode),
7322 gen_rtx_REG (Pmode, BASE_REGISTER));
7323 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7324 emit_move_insn (operand_subword (operands[0], 0, 0,
7325 TARGET_64BIT ? OImode : TImode),
7327 emit_move_insn (operand_subword (operands[0], 1, 0,
7328 TARGET_64BIT ? OImode : TImode),
7333 (define_expand "restore_stack_nonlocal"
7334 [(match_operand 0 "register_operand" "")
7335 (match_operand 1 "memory_operand" "")]
7338 rtx temp = gen_reg_rtx (Pmode);
7339 rtx base = gen_rtx_REG (Pmode, BASE_REGISTER);
7341 /* Restore the backchain from the first word, sp from the second and the
7342 literal pool base from the third. */
7343 emit_move_insn (temp,
7344 operand_subword (operands[1], 0, 0,
7345 TARGET_64BIT ? OImode : TImode));
7346 emit_move_insn (operands[0],
7347 operand_subword (operands[1], 1, 0,
7348 TARGET_64BIT ? OImode : TImode));
7349 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7350 emit_move_insn (base,
7351 operand_subword (operands[1], 2, 0,
7352 TARGET_64BIT ? OImode : TImode));
7353 emit_insn (gen_rtx_USE (VOIDmode, base));
7360 ; nop instruction pattern(s).
7367 [(set_attr "op_type" "RR")])
7371 ; Special literal pool access instruction pattern(s).
7374 (define_insn "*pool_entry"
7375 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7376 UNSPECV_POOL_ENTRY)]
7379 enum machine_mode mode = GET_MODE (PATTERN (insn));
7380 unsigned int align = GET_MODE_BITSIZE (mode);
7381 s390_output_pool_entry (asm_out_file, operands[0], mode, align);
7384 [(set_attr "op_type" "NN")
7385 (set (attr "length")
7386 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7388 (define_insn "pool_start_31"
7389 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7392 [(set_attr "op_type" "NN")
7393 (set_attr "length" "2")])
7395 (define_insn "pool_end_31"
7396 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7399 [(set_attr "op_type" "NN")
7400 (set_attr "length" "2")])
7402 (define_insn "pool_start_64"
7403 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7405 ".section\t.rodata\;.align\t8"
7406 [(set_attr "op_type" "NN")
7407 (set_attr "length" "0")])
7409 (define_insn "pool_end_64"
7410 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7413 [(set_attr "op_type" "NN")
7414 (set_attr "length" "0")])
7416 (define_insn "main_base_31_small"
7417 [(set (match_operand 0 "register_operand" "=a")
7418 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7419 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7421 [(set_attr "op_type" "RR")
7422 (set_attr "type" "la")])
7424 (define_insn "main_base_31_large"
7425 [(set (match_operand 0 "register_operand" "=a")
7426 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7427 (set (pc) (label_ref (match_operand 2 "" "")))]
7428 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7430 [(set_attr "op_type" "RI")])
7432 (define_insn "main_base_64"
7433 [(set (match_operand 0 "register_operand" "=a")
7434 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7435 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7437 [(set_attr "op_type" "RIL")
7438 (set_attr "type" "larl")])
7440 (define_insn "main_pool"
7441 [(unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL)]
7444 [(set_attr "op_type" "NN")])
7446 (define_insn "reload_base_31"
7447 [(set (match_operand 0 "register_operand" "=a")
7448 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7449 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7450 "basr\t%0,0\;la\t%0,%1-.(%0)"
7451 [(set_attr "op_type" "NN")
7452 (set_attr "type" "la")
7453 (set_attr "length" "6")])
7455 (define_insn "reload_base_64"
7456 [(set (match_operand 0 "register_operand" "=a")
7457 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7458 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7460 [(set_attr "op_type" "RIL")
7461 (set_attr "type" "larl")])
7464 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7467 [(set_attr "op_type" "NN")
7468 (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7471 ;; Insns related to generating the function prologue and epilogue.
7475 (define_expand "prologue"
7476 [(use (const_int 0))]
7478 "s390_emit_prologue (); DONE;")
7480 (define_expand "epilogue"
7481 [(use (const_int 1))]
7483 "s390_emit_epilogue (); DONE;")
7485 (define_insn "*return"
7487 (use (match_operand 0 "register_operand" "a"))]
7488 "GET_MODE (operands[0]) == Pmode"
7490 [(set_attr "op_type" "RR")
7491 (set_attr "type" "jsr")
7492 (set_attr "atype" "agen")])
7495 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7496 ;; pointer. This is used for compatability.
7498 (define_expand "ptr_extend"
7499 [(set (match_operand:DI 0 "register_operand" "=r")
7500 (match_operand:SI 1 "register_operand" "r"))]
7503 emit_insn (gen_anddi3 (operands[0],
7504 gen_lowpart (DImode, operands[1]),
7505 GEN_INT (0x7fffffff)));