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 ;; L -- Value appropriate as displacement.
32 ;; (0..4095) for short displacement
33 ;; (-524288..524287) for long displacement
34 ;; M -- Constant integer with a value of 0x7fffffff.
35 ;; N -- Multiple letter constraint followed by 4 parameter letters.
36 ;; 0..9: number of the part counting from most to least significant
37 ;; H,Q: mode of the part
38 ;; D,S,H: mode of the containing operand
39 ;; 0,F: value of the other parts (F - all bits set)
41 ;; The constraint matches if the specified part of a constant
42 ;; has a value different from its other parts.
43 ;; Q -- Memory reference without index register and with short displacement.
44 ;; R -- Memory reference with index register and short displacement.
45 ;; S -- Memory reference without index register but with long displacement.
46 ;; T -- Memory reference with index register and long displacement.
47 ;; U -- Pointer with short displacement.
48 ;; W -- Pointer with long displacement.
49 ;; Y -- Shift count operand.
51 ;; Special formats used for outputting 390 instructions.
53 ;; %C: print opcode suffix for branch condition.
54 ;; %D: print opcode suffix for inverse branch condition.
55 ;; %J: print tls_load/tls_gdcall/tls_ldcall suffix
56 ;; %O: print only the displacement of a memory reference.
57 ;; %R: print only the base register of a memory reference.
58 ;; %N: print the second word of a DImode operand.
59 ;; %M: print the second word of a TImode operand.
61 ;; %b: print integer X as if it's an unsigned byte.
62 ;; %x: print integer X as if it's an unsigned word.
63 ;; %h: print integer X as if it's a signed word.
64 ;; %i: print the first nonzero HImode part of X
65 ;; %j: print the first HImode part unequal to 0xffff of X
68 ;; We have a special constraint for pattern matching.
70 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
82 ; GOT/PLT and lt-relative accesses
83 (UNSPEC_LTREL_OFFSET 100)
84 (UNSPEC_LTREL_BASE 101)
92 (UNSPEC_RELOAD_BASE 210)
93 (UNSPEC_MAIN_BASE 211)
95 ; TLS relocation specifiers
100 (UNSPEC_GOTNTPOFF 504)
101 (UNSPEC_INDNTPOFF 505)
105 (UNSPEC_TLSLDM_NTPOFF 511)
106 (UNSPEC_TLS_LOAD 512)
113 ;; UNSPEC_VOLATILE usage
122 (UNSPECV_POOL_START 201)
123 (UNSPECV_POOL_END 202)
124 (UNSPECV_POOL_ENTRY 203)
125 (UNSPECV_MAIN_POOL 300)
132 ;; Processor type. This attribute must exactly match the processor_type
133 ;; enumeration in s390.h.
135 (define_attr "cpu" "g5,g6,z900,z990"
136 (const (symbol_ref "s390_tune")))
138 ;; Define an insn type attribute. This is used in function unit delay
141 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
142 cs,vs,store,imul,idiv,
143 branch,jsr,fsimpd,fsimps,
144 floadd,floads,fstored, fstores,
145 fmuld,fmuls,fdivd,fdivs,
146 ftoi,itof,fsqrtd,fsqrts,
148 (const_string "integer"))
150 ;; Operand type. Used to default length attribute values
152 (define_attr "op_type"
153 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
156 ;; Insn are devide in two classes:
157 ;; agen: Insn using agen
158 ;; reg: Insn not using agen
160 (define_attr "atype" "agen,reg"
161 (cond [ (eq_attr "op_type" "E") (const_string "reg")
162 (eq_attr "op_type" "RR") (const_string "reg")
163 (eq_attr "op_type" "RX") (const_string "agen")
164 (eq_attr "op_type" "RI") (const_string "reg")
165 (eq_attr "op_type" "RRE") (const_string "reg")
166 (eq_attr "op_type" "RS") (const_string "agen")
167 (eq_attr "op_type" "RSI") (const_string "agen")
168 (eq_attr "op_type" "S") (const_string "agen")
169 (eq_attr "op_type" "SI") (const_string "agen")
170 (eq_attr "op_type" "SS") (const_string "agen")
171 (eq_attr "op_type" "SSE") (const_string "agen")
172 (eq_attr "op_type" "RXE") (const_string "agen")
173 (eq_attr "op_type" "RSE") (const_string "agen")
174 (eq_attr "op_type" "RIL") (const_string "agen")
175 (eq_attr "op_type" "RXY") (const_string "agen")
176 (eq_attr "op_type" "RSY") (const_string "agen")
177 (eq_attr "op_type" "SIY") (const_string "agen")]
178 (const_string "reg")))
180 ;; Generic pipeline function unit.
182 (define_function_unit "integer" 1 0
183 (eq_attr "type" "none") 0 0)
185 (define_function_unit "integer" 1 0
186 (eq_attr "type" "integer") 1 1)
188 (define_function_unit "integer" 1 0
189 (eq_attr "type" "fsimpd") 1 1)
191 (define_function_unit "integer" 1 0
192 (eq_attr "type" "fsimps") 1 1)
194 (define_function_unit "integer" 1 0
195 (eq_attr "type" "load") 1 1)
197 (define_function_unit "integer" 1 0
198 (eq_attr "type" "floadd") 1 1)
200 (define_function_unit "integer" 1 0
201 (eq_attr "type" "floads") 1 1)
203 (define_function_unit "integer" 1 0
204 (eq_attr "type" "la") 1 1)
206 (define_function_unit "integer" 1 0
207 (eq_attr "type" "larl") 1 1)
209 (define_function_unit "integer" 1 0
210 (eq_attr "type" "lr") 1 1)
212 (define_function_unit "integer" 1 0
213 (eq_attr "type" "branch") 1 1)
215 (define_function_unit "integer" 1 0
216 (eq_attr "type" "store") 1 1)
218 (define_function_unit "integer" 1 0
219 (eq_attr "type" "fstored") 1 1)
221 (define_function_unit "integer" 1 0
222 (eq_attr "type" "fstores") 1 1)
224 (define_function_unit "integer" 1 0
225 (eq_attr "type" "lm") 2 2)
227 (define_function_unit "integer" 1 0
228 (eq_attr "type" "stm") 2 2)
230 (define_function_unit "integer" 1 0
231 (eq_attr "type" "cs") 5 5)
233 (define_function_unit "integer" 1 0
234 (eq_attr "type" "vs") 30 30)
236 (define_function_unit "integer" 1 0
237 (eq_attr "type" "jsr") 5 5)
239 (define_function_unit "integer" 1 0
240 (eq_attr "type" "imul") 7 7)
242 (define_function_unit "integer" 1 0
243 (eq_attr "type" "fmuld") 6 6)
245 (define_function_unit "integer" 1 0
246 (eq_attr "type" "fmuls") 6 6)
248 (define_function_unit "integer" 1 0
249 (eq_attr "type" "idiv") 33 33)
251 (define_function_unit "integer" 1 0
252 (eq_attr "type" "fdivd") 33 33)
254 (define_function_unit "integer" 1 0
255 (eq_attr "type" "fdivs") 33 33)
257 (define_function_unit "integer" 1 0
258 (eq_attr "type" "fsqrtd") 30 30)
260 (define_function_unit "integer" 1 0
261 (eq_attr "type" "fsqrts") 30 30)
263 (define_function_unit "integer" 1 0
264 (eq_attr "type" "ftoi") 2 2)
266 (define_function_unit "integer" 1 0
267 (eq_attr "type" "itof") 2 2)
269 (define_function_unit "integer" 1 0
270 (eq_attr "type" "o2") 2 2)
272 (define_function_unit "integer" 1 0
273 (eq_attr "type" "o3") 3 3)
275 (define_function_unit "integer" 1 0
276 (eq_attr "type" "other") 5 5)
278 ;; Pipeline description for z900
285 (define_attr "length" ""
286 (cond [ (eq_attr "op_type" "E") (const_int 2)
287 (eq_attr "op_type" "RR") (const_int 2)
288 (eq_attr "op_type" "RX") (const_int 4)
289 (eq_attr "op_type" "RI") (const_int 4)
290 (eq_attr "op_type" "RRE") (const_int 4)
291 (eq_attr "op_type" "RS") (const_int 4)
292 (eq_attr "op_type" "RSI") (const_int 4)
293 (eq_attr "op_type" "S") (const_int 4)
294 (eq_attr "op_type" "SI") (const_int 4)
295 (eq_attr "op_type" "SS") (const_int 6)
296 (eq_attr "op_type" "SSE") (const_int 6)
297 (eq_attr "op_type" "RXE") (const_int 6)
298 (eq_attr "op_type" "RSE") (const_int 6)
299 (eq_attr "op_type" "RIL") (const_int 6)
300 (eq_attr "op_type" "RXY") (const_int 6)
301 (eq_attr "op_type" "RSY") (const_int 6)
302 (eq_attr "op_type" "SIY") (const_int 6)]
305 ;; Define attributes for `asm' insns.
307 (define_asm_attributes [(set_attr "type" "other")
308 (set_attr "op_type" "NN")])
314 ; CCL: Zero Nonzero Zero Nonzero (AL, ALR, SL, SLR, N, NC, NI, NR, O, OC, OI, OR, X, XC, XI, XR)
315 ; CCA: Zero <Zero >Zero Overflow (A, AR, AH, AHI, S, SR, SH, SHI, LTR, LCR, LNR, LPR, SLA, SLDA, SLA, SRDA)
316 ; CCU: Equal ULess UGreater -- (CL, CLR, CLI, CLM)
317 ; CCS: Equal SLess SGreater -- (C, CR, CH, CHI, ICM)
318 ; CCT: Zero Mixed Mixed Ones (TM, TMH, TML)
321 ; CCZ1 -> CCA/CCU/CCS/CCT
324 ; String: CLC, CLCL, CLCLE, CLST, CUSE, MVCL, MVCLE, MVPG, MVST, SRST
325 ; Clobber: CKSM, CFC, CS, CDS, CUUTF, CUTFU, PLO, SPM, STCK, STCKE, TS, TRT, TRE, UPT
329 ;;- Compare instructions.
332 (define_expand "cmpdi"
334 (compare:CC (match_operand:DI 0 "register_operand" "")
335 (match_operand:DI 1 "general_operand" "")))]
338 s390_compare_op0 = operands[0];
339 s390_compare_op1 = operands[1];
343 (define_expand "cmpsi"
345 (compare:CC (match_operand:SI 0 "register_operand" "")
346 (match_operand:SI 1 "general_operand" "")))]
349 s390_compare_op0 = operands[0];
350 s390_compare_op1 = operands[1];
354 (define_expand "cmpdf"
356 (compare:CC (match_operand:DF 0 "register_operand" "")
357 (match_operand:DF 1 "general_operand" "")))]
360 s390_compare_op0 = operands[0];
361 s390_compare_op1 = operands[1];
365 (define_expand "cmpsf"
367 (compare:CC (match_operand:SF 0 "register_operand" "")
368 (match_operand:SF 1 "general_operand" "")))]
371 s390_compare_op0 = operands[0];
372 s390_compare_op1 = operands[1];
377 ; Test-under-Mask (zero_extract) instructions
379 (define_insn "*tmdi_ext"
381 (compare (zero_extract:DI (match_operand:DI 0 "register_operand" "d")
382 (match_operand:DI 1 "const_int_operand" "n")
383 (match_operand:DI 2 "const_int_operand" "n"))
385 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
386 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
387 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 64
388 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
389 == INTVAL (operands[2]) >> 4"
391 int part = INTVAL (operands[2]) >> 4;
392 int block = (1 << INTVAL (operands[1])) - 1;
393 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
395 operands[2] = GEN_INT (block << shift);
399 case 0: return "tmhh\t%0,%x2";
400 case 1: return "tmhl\t%0,%x2";
401 case 2: return "tmlh\t%0,%x2";
402 case 3: return "tmll\t%0,%x2";
406 [(set_attr "op_type" "RI")])
408 (define_insn "*tmsi_ext"
410 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
411 (match_operand:SI 1 "const_int_operand" "n")
412 (match_operand:SI 2 "const_int_operand" "n"))
414 "s390_match_ccmode(insn, CCTmode)
415 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
416 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
417 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
418 == INTVAL (operands[2]) >> 4"
420 int part = INTVAL (operands[2]) >> 4;
421 int block = (1 << INTVAL (operands[1])) - 1;
422 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
424 operands[2] = GEN_INT (block << shift);
428 case 0: return "tmh\t%0,%x2";
429 case 1: return "tml\t%0,%x2";
433 [(set_attr "op_type" "RI")])
435 (define_insn "*tmqi_ext"
437 (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,S")
438 (match_operand:SI 1 "const_int_operand" "n,n")
439 (match_operand:SI 2 "const_int_operand" "n,n"))
441 "s390_match_ccmode(insn, CCTmode)
442 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
443 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
445 int block = (1 << INTVAL (operands[1])) - 1;
446 int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
448 operands[2] = GEN_INT (block << shift);
449 return which_alternative == 0 ? "tm\t%0,%b2" : "tmy\t%0,%b2";
451 [(set_attr "op_type" "SI,SIY")])
453 ; Test-under-Mask instructions
455 (define_insn "*tmdi_mem"
457 (compare (and:DI (match_operand:DI 0 "memory_operand" "Q,S")
458 (match_operand:DI 1 "immediate_operand" "n,n"))
459 (match_operand:DI 2 "immediate_operand" "n,n")))]
460 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
461 && s390_single_part (operands[1], DImode, QImode, 0) >= 0"
463 int part = s390_single_part (operands[1], DImode, QImode, 0);
464 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
466 operands[0] = gen_rtx_MEM (QImode,
467 plus_constant (XEXP (operands[0], 0), part));
468 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
470 [(set_attr "op_type" "SI,SIY")])
472 (define_insn "*tmsi_mem"
474 (compare (and:SI (match_operand:SI 0 "memory_operand" "Q,S")
475 (match_operand:SI 1 "immediate_operand" "n,n"))
476 (match_operand:SI 2 "immediate_operand" "n,n")))]
477 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
478 && s390_single_part (operands[1], SImode, QImode, 0) >= 0"
480 int part = s390_single_part (operands[1], SImode, QImode, 0);
481 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
483 operands[0] = gen_rtx_MEM (QImode,
484 plus_constant (XEXP (operands[0], 0), part));
485 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
487 [(set_attr "op_type" "SI")])
489 (define_insn "*tmhi_mem"
491 (compare (and:SI (subreg:SI (match_operand:HI 0 "memory_operand" "Q,S") 0)
492 (match_operand:SI 1 "immediate_operand" "n,n"))
493 (match_operand:SI 2 "immediate_operand" "n,n")))]
494 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
495 && s390_single_part (operands[1], HImode, QImode, 0) >= 0"
497 int part = s390_single_part (operands[1], HImode, QImode, 0);
498 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
500 operands[0] = gen_rtx_MEM (QImode,
501 plus_constant (XEXP (operands[0], 0), part));
502 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
504 [(set_attr "op_type" "SI")])
506 (define_insn "*tmqi_mem"
508 (compare (and:SI (subreg:SI (match_operand:QI 0 "memory_operand" "Q,S") 0)
509 (match_operand:SI 1 "immediate_operand" "n,n"))
510 (match_operand:SI 2 "immediate_operand" "n,n")))]
511 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))"
515 [(set_attr "op_type" "SI,SIY")])
517 (define_insn "*tmdi_reg"
519 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
520 (match_operand:DI 1 "immediate_operand"
521 "N0HD0,N1HD0,N2HD0,N3HD0"))
522 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
524 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
525 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
531 [(set_attr "op_type" "RI")])
533 (define_insn "*tmsi_reg"
535 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
536 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
537 (match_operand:SI 2 "immediate_operand" "n,n")))]
538 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
539 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
543 [(set_attr "op_type" "RI")])
545 (define_insn "*tmhi_full"
547 (compare (match_operand:HI 0 "register_operand" "d")
548 (match_operand:HI 1 "immediate_operand" "n")))]
549 "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
551 [(set_attr "op_type" "RX")])
553 (define_insn "*tmqi_full"
555 (compare (match_operand:QI 0 "register_operand" "d")
556 (match_operand:QI 1 "immediate_operand" "n")))]
557 "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
559 [(set_attr "op_type" "RI")])
562 ; Load-and-Test instructions
564 (define_insn "*tstdi_sign"
566 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
567 (const_int 32)) (const_int 32))
568 (match_operand:DI 1 "const0_operand" "")))
569 (set (match_operand:DI 2 "register_operand" "=d")
570 (sign_extend:DI (match_dup 0)))]
571 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
573 [(set_attr "op_type" "RRE")])
575 (define_insn "*tstdi"
577 (compare (match_operand:DI 0 "register_operand" "d")
578 (match_operand:DI 1 "const0_operand" "")))
579 (set (match_operand:DI 2 "register_operand" "=d")
581 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
583 [(set_attr "op_type" "RRE")])
585 (define_insn "*tstdi_cconly"
587 (compare (match_operand:DI 0 "register_operand" "d")
588 (match_operand:DI 1 "const0_operand" "")))]
589 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
591 [(set_attr "op_type" "RRE")])
593 (define_insn "*tstdi_cconly_31"
595 (compare (match_operand:DI 0 "register_operand" "d")
596 (match_operand:DI 1 "const0_operand" "")))]
597 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
599 [(set_attr "op_type" "RS")
600 (set_attr "atype" "reg")])
603 (define_insn "*tstsi"
605 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
606 (match_operand:SI 1 "const0_operand" "")))
607 (set (match_operand:SI 2 "register_operand" "=d,d,d")
609 "s390_match_ccmode(insn, CCSmode)"
614 [(set_attr "op_type" "RR,RS,RSY")])
616 (define_insn "*tstsi_cconly"
618 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
619 (match_operand:SI 1 "const0_operand" "")))
620 (clobber (match_scratch:SI 2 "=X,d,d"))]
621 "s390_match_ccmode(insn, CCSmode)"
626 [(set_attr "op_type" "RR,RS,RSY")])
628 (define_insn "*tstsi_cconly2"
630 (compare (match_operand:SI 0 "register_operand" "d")
631 (match_operand:SI 1 "const0_operand" "")))]
632 "s390_match_ccmode(insn, CCSmode)"
634 [(set_attr "op_type" "RR")])
636 (define_insn "*tsthiCCT"
638 (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d")
639 (match_operand:HI 1 "const0_operand" "")))
640 (set (match_operand:HI 2 "register_operand" "=d,d,0")
642 "s390_match_ccmode(insn, CCTmode)"
647 [(set_attr "op_type" "RS,RSY,RI")])
649 (define_insn "*tsthiCCT_cconly"
651 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
652 (match_operand:HI 1 "const0_operand" "")))
653 (clobber (match_scratch:HI 2 "=d,d,X"))]
654 "s390_match_ccmode(insn, CCTmode)"
659 [(set_attr "op_type" "RS,RSY,RI")])
661 (define_insn "*tsthi"
663 (compare (match_operand:HI 0 "s_operand" "Q,S")
664 (match_operand:HI 1 "const0_operand" "")))
665 (set (match_operand:HI 2 "register_operand" "=d,d")
667 "s390_match_ccmode(insn, CCSmode)"
671 [(set_attr "op_type" "RS,RSY")])
673 (define_insn "*tsthi_cconly"
675 (compare (match_operand:HI 0 "s_operand" "Q,S")
676 (match_operand:HI 1 "const0_operand" "")))
677 (clobber (match_scratch:HI 2 "=d,d"))]
678 "s390_match_ccmode(insn, CCSmode)"
682 [(set_attr "op_type" "RS,RSY")])
684 (define_insn "*tstqiCCT"
686 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
687 (match_operand:QI 1 "const0_operand" "")))
688 (set (match_operand:QI 2 "register_operand" "=d,d,0")
690 "s390_match_ccmode(insn, CCTmode)"
695 [(set_attr "op_type" "RS,RSY,RI")])
697 (define_insn "*tstqiCCT_cconly"
699 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
700 (match_operand:QI 1 "const0_operand" "")))]
701 "s390_match_ccmode(insn, CCTmode)"
706 [(set_attr "op_type" "SI,SIY,RI")])
708 (define_insn "*tstqi"
710 (compare (match_operand:QI 0 "s_operand" "Q,S")
711 (match_operand:QI 1 "const0_operand" "")))
712 (set (match_operand:QI 2 "register_operand" "=d,d")
714 "s390_match_ccmode(insn, CCSmode)"
718 [(set_attr "op_type" "RS,RSY")])
720 (define_insn "*tstqi_cconly"
722 (compare (match_operand:QI 0 "s_operand" "Q,S")
723 (match_operand:QI 1 "const0_operand" "")))
724 (clobber (match_scratch:QI 2 "=d,d"))]
725 "s390_match_ccmode(insn, CCSmode)"
729 [(set_attr "op_type" "RS,RSY")])
732 ; Compare (signed) instructions
734 (define_insn "*cmpdi_ccs_sign"
736 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
737 (match_operand:DI 0 "register_operand" "d,d")))]
738 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
742 [(set_attr "op_type" "RRE,RXY")])
744 (define_insn "*cmpdi_ccs"
746 (compare (match_operand:DI 0 "register_operand" "d,d,d")
747 (match_operand:DI 1 "general_operand" "d,K,m")))]
748 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
753 [(set_attr "op_type" "RRE,RI,RXY")])
755 (define_insn "*cmpsi_ccs_sign"
757 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
758 (match_operand:SI 0 "register_operand" "d,d")))]
759 "s390_match_ccmode(insn, CCSRmode)"
763 [(set_attr "op_type" "RX,RXY")])
765 (define_insn "*cmpsi_ccs"
767 (compare (match_operand:SI 0 "register_operand" "d,d,d,d")
768 (match_operand:SI 1 "general_operand" "d,K,R,T")))]
769 "s390_match_ccmode(insn, CCSmode)"
775 [(set_attr "op_type" "RR,RI,RX,RXY")])
778 ; Compare (unsigned) instructions
780 (define_insn "*cmpdi_ccu_zero"
782 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
783 (match_operand:DI 0 "register_operand" "d,d")))]
784 "s390_match_ccmode(insn, CCURmode) && TARGET_64BIT"
788 [(set_attr "op_type" "RRE,RXY")])
790 (define_insn "*cmpdi_ccu"
792 (compare (match_operand:DI 0 "register_operand" "d,d")
793 (match_operand:DI 1 "general_operand" "d,m")))]
794 "s390_match_ccmode(insn, CCUmode) && TARGET_64BIT"
798 [(set_attr "op_type" "RRE,RXY")])
800 (define_insn "*cmpsi_ccu"
802 (compare (match_operand:SI 0 "register_operand" "d,d,d")
803 (match_operand:SI 1 "general_operand" "d,R,T")))]
804 "s390_match_ccmode(insn, CCUmode)"
809 [(set_attr "op_type" "RR,RX,RXY")])
811 (define_insn "*cmphi_ccu"
813 (compare (match_operand:HI 0 "register_operand" "d,d")
814 (match_operand:HI 1 "s_imm_operand" "Q,S")))]
815 "s390_match_ccmode(insn, CCUmode)"
819 [(set_attr "op_type" "RS,RSY")])
821 (define_insn "*cmpqi_ccu"
823 (compare (match_operand:QI 0 "register_operand" "d,d")
824 (match_operand:QI 1 "s_imm_operand" "Q,S")))]
825 "s390_match_ccmode(insn, CCUmode)"
829 [(set_attr "op_type" "RS,RSY")])
833 (compare (match_operand:QI 0 "memory_operand" "Q,S")
834 (match_operand:QI 1 "immediate_operand" "n,n")))]
835 "s390_match_ccmode (insn, CCUmode)"
839 [(set_attr "op_type" "SI,SIY")])
841 (define_insn "*cmpdi_ccu_mem"
843 (compare (match_operand:DI 0 "s_operand" "Q")
844 (match_operand:DI 1 "s_imm_operand" "Q")))]
845 "s390_match_ccmode(insn, CCUmode)"
847 [(set_attr "op_type" "SS")])
849 (define_insn "*cmpsi_ccu_mem"
851 (compare (match_operand:SI 0 "s_operand" "Q")
852 (match_operand:SI 1 "s_imm_operand" "Q")))]
853 "s390_match_ccmode(insn, CCUmode)"
855 [(set_attr "op_type" "SS")])
857 (define_insn "*cmphi_ccu_mem"
859 (compare (match_operand:HI 0 "s_operand" "Q")
860 (match_operand:HI 1 "s_imm_operand" "Q")))]
861 "s390_match_ccmode(insn, CCUmode)"
863 [(set_attr "op_type" "SS")])
865 (define_insn "*cmpqi_ccu_mem"
867 (compare (match_operand:QI 0 "s_operand" "Q")
868 (match_operand:QI 1 "s_imm_operand" "Q")))]
869 "s390_match_ccmode(insn, CCUmode)"
871 [(set_attr "op_type" "SS")])
876 (define_insn "*cmpdf_ccs_0"
878 (compare (match_operand:DF 0 "register_operand" "f")
879 (match_operand:DF 1 "const0_operand" "")))]
880 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
882 [(set_attr "op_type" "RRE")
883 (set_attr "type" "fsimpd")])
885 (define_insn "*cmpdf_ccs_0_ibm"
887 (compare (match_operand:DF 0 "register_operand" "f")
888 (match_operand:DF 1 "const0_operand" "")))]
889 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
891 [(set_attr "op_type" "RR")
892 (set_attr "type" "fsimpd")])
894 (define_insn "*cmpdf_ccs"
896 (compare (match_operand:DF 0 "register_operand" "f,f")
897 (match_operand:DF 1 "general_operand" "f,R")))]
898 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
902 [(set_attr "op_type" "RRE,RXE")
903 (set_attr "type" "fsimpd")])
905 (define_insn "*cmpdf_ccs_ibm"
907 (compare (match_operand:DF 0 "register_operand" "f,f")
908 (match_operand:DF 1 "general_operand" "f,R")))]
909 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
913 [(set_attr "op_type" "RR,RX")
914 (set_attr "type" "fsimpd")])
919 (define_insn "*cmpsf_ccs_0"
921 (compare (match_operand:SF 0 "register_operand" "f")
922 (match_operand:SF 1 "const0_operand" "")))]
923 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
925 [(set_attr "op_type" "RRE")
926 (set_attr "type" "fsimps")])
928 (define_insn "*cmpsf_ccs_0_ibm"
930 (compare (match_operand:SF 0 "register_operand" "f")
931 (match_operand:SF 1 "const0_operand" "")))]
932 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
934 [(set_attr "op_type" "RR")
935 (set_attr "type" "fsimps")])
937 (define_insn "*cmpsf_ccs"
939 (compare (match_operand:SF 0 "register_operand" "f,f")
940 (match_operand:SF 1 "general_operand" "f,R")))]
941 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
945 [(set_attr "op_type" "RRE,RXE")
946 (set_attr "type" "fsimps")])
948 (define_insn "*cmpsf_ccs"
950 (compare (match_operand:SF 0 "register_operand" "f,f")
951 (match_operand:SF 1 "general_operand" "f,R")))]
952 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
956 [(set_attr "op_type" "RR,RX")
957 (set_attr "type" "fsimps")])
961 ;;- Move instructions.
965 ; movti instruction pattern(s).
969 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
970 (match_operand:TI 1 "general_operand" "QS,d,dKm,d,Q"))]
978 [(set_attr "op_type" "RSY,RSY,NN,NN,SS")
979 (set_attr "type" "lm,stm,*,*,cs")])
982 [(set (match_operand:TI 0 "nonimmediate_operand" "")
983 (match_operand:TI 1 "general_operand" ""))]
984 "TARGET_64BIT && reload_completed
985 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
986 [(set (match_dup 2) (match_dup 4))
987 (set (match_dup 3) (match_dup 5))]
989 operands[2] = operand_subword (operands[0], 0, 0, TImode);
990 operands[3] = operand_subword (operands[0], 1, 0, TImode);
991 operands[4] = operand_subword (operands[1], 0, 0, TImode);
992 operands[5] = operand_subword (operands[1], 1, 0, TImode);
996 [(set (match_operand:TI 0 "nonimmediate_operand" "")
997 (match_operand:TI 1 "general_operand" ""))]
998 "TARGET_64BIT && reload_completed
999 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
1000 [(set (match_dup 2) (match_dup 4))
1001 (set (match_dup 3) (match_dup 5))]
1003 operands[2] = operand_subword (operands[0], 1, 0, TImode);
1004 operands[3] = operand_subword (operands[0], 0, 0, TImode);
1005 operands[4] = operand_subword (operands[1], 1, 0, TImode);
1006 operands[5] = operand_subword (operands[1], 0, 0, TImode);
1010 [(set (match_operand:TI 0 "register_operand" "")
1011 (match_operand:TI 1 "memory_operand" ""))]
1012 "TARGET_64BIT && reload_completed
1013 && !s_operand (operands[1], VOIDmode)"
1014 [(set (match_dup 0) (match_dup 1))]
1016 rtx addr = operand_subword (operands[0], 1, 0, TImode);
1017 s390_load_address (addr, XEXP (operands[1], 0));
1018 operands[1] = replace_equiv_address (operands[1], addr);
1021 (define_expand "reload_outti"
1022 [(parallel [(match_operand:TI 0 "memory_operand" "")
1023 (match_operand:TI 1 "register_operand" "d")
1024 (match_operand:DI 2 "register_operand" "=&a")])]
1027 s390_load_address (operands[2], XEXP (operands[0], 0));
1028 operands[0] = replace_equiv_address (operands[0], operands[2]);
1029 emit_move_insn (operands[0], operands[1]);
1034 ; movdi instruction pattern(s).
1037 (define_expand "movdi"
1038 [(set (match_operand:DI 0 "general_operand" "")
1039 (match_operand:DI 1 "general_operand" ""))]
1042 /* Handle symbolic constants. */
1043 if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1044 emit_symbolic_move (operands);
1046 /* During and after reload, we need to force constants
1047 to the literal pool ourselves, if necessary. */
1048 if ((reload_in_progress || reload_completed)
1049 && CONSTANT_P (operands[1])
1050 && (!legitimate_reload_constant_p (operands[1])
1051 || FP_REG_P (operands[0])))
1052 operands[1] = force_const_mem (DImode, operands[1]);
1055 (define_insn "*movdi_larl"
1056 [(set (match_operand:DI 0 "register_operand" "=d")
1057 (match_operand:DI 1 "larl_operand" "X"))]
1059 && !FP_REG_P (operands[0])"
1061 [(set_attr "op_type" "RIL")
1062 (set_attr "type" "larl")])
1064 (define_insn "*movdi_64"
1065 [(set (match_operand:DI 0 "nonimmediate_operand"
1066 "=d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,?Q")
1067 (match_operand:DI 1 "general_operand"
1068 "K,N0HD0,N1HD0,N2HD0,N3HD0,L,d,m,d,*f,R,T,*f,*f,?Q"))]
1086 [(set_attr "op_type" "RI,RI,RI,RI,RI,RXY,RRE,RXY,RXY,RR,RX,RXY,RX,RXY,SS")
1087 (set_attr "type" "*,*,*,*,*,la,lr,load,store,floadd,floadd,floadd,
1088 fstored,fstored,cs")])
1090 (define_insn "*movdi_31"
1091 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,o,!*f,!*f,!*f,!R,!T,Q")
1092 (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,R,T,*f,*f,Q"))]
1105 [(set_attr "op_type" "RS,RS,NN,NN,RR,RX,RXY,RX,RXY,SS")
1106 (set_attr "type" "lm,stm,*,*,floadd,floadd,floadd,fstored,fstored,cs")])
1109 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1110 (match_operand:DI 1 "general_operand" ""))]
1111 "!TARGET_64BIT && reload_completed
1112 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1113 [(set (match_dup 2) (match_dup 4))
1114 (set (match_dup 3) (match_dup 5))]
1116 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1117 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1118 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1119 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1123 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1124 (match_operand:DI 1 "general_operand" ""))]
1125 "!TARGET_64BIT && reload_completed
1126 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1127 [(set (match_dup 2) (match_dup 4))
1128 (set (match_dup 3) (match_dup 5))]
1130 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1131 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1132 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1133 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1137 [(set (match_operand:DI 0 "register_operand" "")
1138 (match_operand:DI 1 "memory_operand" ""))]
1139 "!TARGET_64BIT && reload_completed
1140 && !FP_REG_P (operands[0])
1141 && !s_operand (operands[1], VOIDmode)"
1142 [(set (match_dup 0) (match_dup 1))]
1144 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1145 s390_load_address (addr, XEXP (operands[1], 0));
1146 operands[1] = replace_equiv_address (operands[1], addr);
1149 (define_expand "reload_outdi"
1150 [(parallel [(match_operand:DI 0 "memory_operand" "")
1151 (match_operand:DI 1 "register_operand" "d")
1152 (match_operand:SI 2 "register_operand" "=&a")])]
1155 s390_load_address (operands[2], XEXP (operands[0], 0));
1156 operands[0] = replace_equiv_address (operands[0], operands[2]);
1157 emit_move_insn (operands[0], operands[1]);
1162 [(set (match_operand:DI 0 "register_operand" "")
1163 (mem:DI (match_operand 1 "address_operand" "")))]
1165 && !FP_REG_P (operands[0])
1166 && GET_CODE (operands[1]) == SYMBOL_REF
1167 && CONSTANT_POOL_ADDRESS_P (operands[1])
1168 && get_pool_mode (operands[1]) == DImode
1169 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1170 [(set (match_dup 0) (match_dup 2))]
1171 "operands[2] = get_pool_constant (operands[1]);")
1174 ; movsi instruction pattern(s).
1177 (define_expand "movsi"
1178 [(set (match_operand:SI 0 "general_operand" "")
1179 (match_operand:SI 1 "general_operand" ""))]
1182 /* Handle symbolic constants. */
1183 if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1184 emit_symbolic_move (operands);
1186 /* expr.c tries to load an effective address using
1187 force_reg. This fails because we don't have a
1188 generic load_address pattern. Convert the move
1189 to a proper arithmetic operation instead, unless
1190 it is guaranteed to be OK. */
1191 if (GET_CODE (operands[1]) == PLUS
1192 && !legitimate_la_operand_p (operands[1]))
1194 operands[1] = force_operand (operands[1], operands[0]);
1195 if (operands[1] == operands[0])
1199 /* During and after reload, we need to force constants
1200 to the literal pool ourselves, if necessary. */
1201 if ((reload_in_progress || reload_completed)
1202 && CONSTANT_P (operands[1])
1203 && (!legitimate_reload_constant_p (operands[1])
1204 || FP_REG_P (operands[0])))
1205 operands[1] = force_const_mem (SImode, operands[1]);
1208 (define_insn "*movsi_larl"
1209 [(set (match_operand:SI 0 "register_operand" "=d")
1210 (match_operand:SI 1 "larl_operand" "X"))]
1211 "!TARGET_64BIT && TARGET_CPU_ZARCH
1212 && !FP_REG_P (operands[0])"
1214 [(set_attr "op_type" "RIL")
1215 (set_attr "type" "larl")])
1217 (define_insn "*movsi_zarch"
1218 [(set (match_operand:SI 0 "nonimmediate_operand"
1219 "=d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,?Q")
1220 (match_operand:SI 1 "general_operand"
1221 "K,N0HS0,N1HS0,L,d,R,T,d,d,*f,R,T,*f,*f,?Q"))]
1239 [(set_attr "op_type" "RI,RI,RI,RXY,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1240 (set_attr "type" "*,*,*,la,lr,load,load,store,store,floads,floads,floads,fstores,fstores,cs")])
1242 (define_insn "*movsi_esa"
1243 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,?Q")
1244 (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,?Q"))]
1255 [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,SS")
1256 (set_attr "type" "*,lr,load,store,floads,floads,fstores,cs")])
1259 [(set (match_operand:SI 0 "register_operand" "")
1260 (mem:SI (match_operand 1 "address_operand" "")))]
1261 "!FP_REG_P (operands[0])
1262 && GET_CODE (operands[1]) == SYMBOL_REF
1263 && CONSTANT_POOL_ADDRESS_P (operands[1])
1264 && get_pool_mode (operands[1]) == SImode
1265 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1266 [(set (match_dup 0) (match_dup 2))]
1267 "operands[2] = get_pool_constant (operands[1]);")
1270 ; movhi instruction pattern(s).
1273 (define_expand "movhi"
1274 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1275 (match_operand:HI 1 "general_operand" ""))]
1278 /* Make it explicit that loading a register from memory
1279 always sign-extends (at least) to SImode. */
1280 if (optimize && !no_new_pseudos
1281 && register_operand (operands[0], VOIDmode)
1282 && GET_CODE (operands[1]) == MEM
1283 && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
1285 rtx tmp = gen_reg_rtx (SImode);
1286 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1287 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1288 operands[1] = gen_lowpart (HImode, tmp);
1292 (define_insn "*movhi"
1293 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1294 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1304 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1305 (set_attr "type" "lr,*,*,*,store,store,cs")])
1308 [(set (match_operand:HI 0 "register_operand" "")
1309 (mem:HI (match_operand 1 "address_operand" "")))]
1310 "GET_CODE (operands[1]) == SYMBOL_REF
1311 && CONSTANT_POOL_ADDRESS_P (operands[1])
1312 && get_pool_mode (operands[1]) == HImode
1313 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1314 [(set (match_dup 0) (match_dup 2))]
1315 "operands[2] = get_pool_constant (operands[1]);")
1318 ; movqi instruction pattern(s).
1321 (define_expand "movqi"
1322 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1323 (match_operand:QI 1 "general_operand" ""))]
1326 /* On z/Architecture, zero-extending from memory to register
1327 is just as fast as a QImode load. */
1328 if (TARGET_ZARCH && optimize && !no_new_pseudos
1329 && register_operand (operands[0], VOIDmode)
1330 && GET_CODE (operands[1]) == MEM
1331 && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
1333 rtx tmp = gen_reg_rtx (word_mode);
1334 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1335 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1336 operands[1] = gen_lowpart (QImode, tmp);
1340 (define_insn "*movqi"
1341 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1342 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1354 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1355 (set_attr "type" "lr,*,*,*,store,store,store,store,cs")])
1358 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1359 (mem:QI (match_operand 1 "address_operand" "")))]
1360 "GET_CODE (operands[1]) == SYMBOL_REF
1361 && CONSTANT_POOL_ADDRESS_P (operands[1])
1362 && get_pool_mode (operands[1]) == QImode
1363 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1364 [(set (match_dup 0) (match_dup 2))]
1365 "operands[2] = get_pool_constant (operands[1]);")
1368 ; movstrictqi instruction pattern(s).
1371 (define_insn "*movstrictqi"
1372 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1373 (match_operand:QI 1 "memory_operand" "R,T"))]
1378 [(set_attr "op_type" "RX,RXY")])
1381 ; movstricthi instruction pattern(s).
1384 (define_insn "*movstricthi"
1385 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1386 (match_operand:HI 1 "s_imm_operand" "Q,S"))
1387 (clobber (reg:CC 33))]
1392 [(set_attr "op_type" "RS,RSY")])
1395 ; movstrictsi instruction pattern(s).
1398 (define_insn "movstrictsi"
1399 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d"))
1400 (match_operand:SI 1 "general_operand" "d,R,T"))]
1406 [(set_attr "op_type" "RR,RX,RXY")
1407 (set_attr "type" "lr,load,load")])
1410 ; movdf instruction pattern(s).
1413 (define_expand "movdf"
1414 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1415 (match_operand:DF 1 "general_operand" ""))]
1418 /* During and after reload, we need to force constants
1419 to the literal pool ourselves, if necessary. */
1420 if ((reload_in_progress || reload_completed)
1421 && CONSTANT_P (operands[1]))
1422 operands[1] = force_const_mem (DFmode, operands[1]);
1425 (define_insn "*movdf_64"
1426 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1427 (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1439 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1440 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,cs")])
1442 (define_insn "*movdf_31"
1443 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1444 (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1457 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,NN,NN,SS")
1458 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,cs")])
1461 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1462 (match_operand:DF 1 "general_operand" ""))]
1463 "!TARGET_64BIT && reload_completed
1464 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1465 [(set (match_dup 2) (match_dup 4))
1466 (set (match_dup 3) (match_dup 5))]
1468 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1469 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1470 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1471 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1475 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1476 (match_operand:DF 1 "general_operand" ""))]
1477 "!TARGET_64BIT && reload_completed
1478 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1479 [(set (match_dup 2) (match_dup 4))
1480 (set (match_dup 3) (match_dup 5))]
1482 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1483 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1484 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1485 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1489 [(set (match_operand:DF 0 "register_operand" "")
1490 (match_operand:DF 1 "memory_operand" ""))]
1491 "!TARGET_64BIT && reload_completed
1492 && !FP_REG_P (operands[0])
1493 && !s_operand (operands[1], VOIDmode)"
1494 [(set (match_dup 0) (match_dup 1))]
1496 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1497 s390_load_address (addr, XEXP (operands[1], 0));
1498 operands[1] = replace_equiv_address (operands[1], addr);
1501 (define_expand "reload_outdf"
1502 [(parallel [(match_operand:DF 0 "memory_operand" "")
1503 (match_operand:DF 1 "register_operand" "d")
1504 (match_operand:SI 2 "register_operand" "=&a")])]
1507 s390_load_address (operands[2], XEXP (operands[0], 0));
1508 operands[0] = replace_equiv_address (operands[0], operands[2]);
1509 emit_move_insn (operands[0], operands[1]);
1514 ; movsf instruction pattern(s).
1517 (define_expand "movsf"
1518 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1519 (match_operand:SF 1 "general_operand" ""))]
1522 /* During and after reload, we need to force constants
1523 to the literal pool ourselves, if necessary. */
1524 if ((reload_in_progress || reload_completed)
1525 && CONSTANT_P (operands[1]))
1526 operands[1] = force_const_mem (SFmode, operands[1]);
1529 (define_insn "*movsf"
1530 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1531 (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1545 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1546 (set_attr "type" "floads,floads,floads,fstores,fstores,lr,load,load,store,store,cs")])
1549 ; load_multiple pattern(s).
1552 (define_expand "load_multiple"
1553 [(match_par_dup 3 [(set (match_operand 0 "" "")
1554 (match_operand 1 "" ""))
1555 (use (match_operand 2 "" ""))])]
1558 enum machine_mode mode;
1564 /* Support only loading a constant number of fixed-point registers from
1565 memory and only bother with this if more than two */
1566 if (GET_CODE (operands[2]) != CONST_INT
1567 || INTVAL (operands[2]) < 2
1568 || INTVAL (operands[2]) > 16
1569 || GET_CODE (operands[1]) != MEM
1570 || GET_CODE (operands[0]) != REG
1571 || REGNO (operands[0]) >= 16)
1574 count = INTVAL (operands[2]);
1575 regno = REGNO (operands[0]);
1576 mode = GET_MODE (operands[0]);
1577 if (mode != SImode && mode != word_mode)
1580 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1583 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1585 from = XEXP (operands[1], 0);
1588 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1589 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1590 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1592 from = XEXP (XEXP (operands[1], 0), 0);
1593 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1598 if (from == frame_pointer_rtx || from == arg_pointer_rtx)
1603 from = force_reg (Pmode, XEXP (operands[1], 0));
1607 for (i = 0; i < count; i++)
1608 XVECEXP (operands[3], 0, i)
1609 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1610 change_address (operands[1], mode,
1611 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1614 (define_insn "*load_multiple_di"
1615 [(match_parallel 0 "load_multiple_operation"
1616 [(set (match_operand:DI 1 "register_operand" "=r")
1617 (match_operand:DI 2 "s_operand" "QS"))])]
1618 "word_mode == DImode"
1620 int words = XVECLEN (operands[0], 0);
1621 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1622 return "lmg\t%1,%0,%2";
1624 [(set_attr "op_type" "RSY")
1625 (set_attr "type" "lm")])
1627 (define_insn "*load_multiple_si"
1628 [(match_parallel 0 "load_multiple_operation"
1629 [(set (match_operand:SI 1 "register_operand" "=r,r")
1630 (match_operand:SI 2 "s_operand" "Q,S"))])]
1633 int words = XVECLEN (operands[0], 0);
1634 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1635 return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1637 [(set_attr "op_type" "RS,RSY")
1638 (set_attr "type" "lm")])
1641 ; store multiple pattern(s).
1644 (define_expand "store_multiple"
1645 [(match_par_dup 3 [(set (match_operand 0 "" "")
1646 (match_operand 1 "" ""))
1647 (use (match_operand 2 "" ""))])]
1650 enum machine_mode mode;
1656 /* Support only storing a constant number of fixed-point registers to
1657 memory and only bother with this if more than two. */
1658 if (GET_CODE (operands[2]) != CONST_INT
1659 || INTVAL (operands[2]) < 2
1660 || INTVAL (operands[2]) > 16
1661 || GET_CODE (operands[0]) != MEM
1662 || GET_CODE (operands[1]) != REG
1663 || REGNO (operands[1]) >= 16)
1666 count = INTVAL (operands[2]);
1667 regno = REGNO (operands[1]);
1668 mode = GET_MODE (operands[1]);
1669 if (mode != SImode && mode != word_mode)
1672 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1676 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1678 to = XEXP (operands[0], 0);
1681 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1682 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1683 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1685 to = XEXP (XEXP (operands[0], 0), 0);
1686 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1691 if (to == frame_pointer_rtx || to == arg_pointer_rtx)
1696 to = force_reg (Pmode, XEXP (operands[0], 0));
1700 for (i = 0; i < count; i++)
1701 XVECEXP (operands[3], 0, i)
1702 = gen_rtx_SET (VOIDmode,
1703 change_address (operands[0], mode,
1704 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1705 gen_rtx_REG (mode, regno + i));
1708 (define_insn "*store_multiple_di"
1709 [(match_parallel 0 "store_multiple_operation"
1710 [(set (match_operand:DI 1 "s_operand" "=QS")
1711 (match_operand:DI 2 "register_operand" "r"))])]
1712 "word_mode == DImode"
1714 int words = XVECLEN (operands[0], 0);
1715 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1716 return "stmg\t%2,%0,%1";
1718 [(set_attr "op_type" "RSY")
1719 (set_attr "type" "stm")])
1722 (define_insn "*store_multiple_si"
1723 [(match_parallel 0 "store_multiple_operation"
1724 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1725 (match_operand:SI 2 "register_operand" "r,r"))])]
1728 int words = XVECLEN (operands[0], 0);
1729 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1730 return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1732 [(set_attr "op_type" "RS,RSY")
1733 (set_attr "type" "stm")])
1736 ;; String instructions.
1740 ; strlenM instruction pattern(s).
1743 (define_expand "strlendi"
1744 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1747 (unspec:DI [(const_int 0)
1748 (match_operand:BLK 1 "memory_operand" "")
1750 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1751 (clobber (scratch:DI))
1752 (clobber (reg:CC 33))])
1754 [(set (match_operand:DI 0 "register_operand" "")
1755 (minus:DI (match_dup 4) (match_dup 5)))
1756 (clobber (reg:CC 33))])]
1759 operands[4] = gen_reg_rtx (DImode);
1760 operands[5] = gen_reg_rtx (DImode);
1761 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1762 operands[1] = replace_equiv_address (operands[1], operands[5]);
1765 (define_insn "*strlendi"
1766 [(set (match_operand:DI 0 "register_operand" "=a")
1767 (unspec:DI [(match_operand:DI 2 "general_operand" "0")
1768 (mem:BLK (match_operand:DI 3 "register_operand" "1"))
1770 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1771 (clobber (match_scratch:DI 1 "=a"))
1772 (clobber (reg:CC 33))]
1774 "srst\t%0,%1\;jo\t.-4"
1775 [(set_attr "op_type" "NN")
1776 (set_attr "type" "vs")
1777 (set_attr "length" "8")])
1779 (define_expand "strlensi"
1780 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1783 (unspec:SI [(const_int 0)
1784 (match_operand:BLK 1 "memory_operand" "")
1786 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1787 (clobber (scratch:SI))
1788 (clobber (reg:CC 33))])
1790 [(set (match_operand:SI 0 "register_operand" "")
1791 (minus:SI (match_dup 4) (match_dup 5)))
1792 (clobber (reg:CC 33))])]
1795 operands[4] = gen_reg_rtx (SImode);
1796 operands[5] = gen_reg_rtx (SImode);
1797 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1798 operands[1] = replace_equiv_address (operands[1], operands[5]);
1801 (define_insn "*strlensi"
1802 [(set (match_operand:SI 0 "register_operand" "=a")
1803 (unspec:SI [(match_operand:SI 2 "general_operand" "0")
1804 (mem:BLK (match_operand:SI 3 "register_operand" "1"))
1806 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1807 (clobber (match_scratch:SI 1 "=a"))
1808 (clobber (reg:CC 33))]
1810 "srst\t%0,%1\;jo\t.-4"
1811 [(set_attr "op_type" "NN")
1812 (set_attr "type" "vs")
1813 (set_attr "length" "8")])
1816 ; movstrM instruction pattern(s).
1819 (define_expand "movstrdi"
1820 [(set (match_operand:BLK 0 "memory_operand" "")
1821 (match_operand:BLK 1 "memory_operand" ""))
1822 (use (match_operand:DI 2 "general_operand" ""))
1823 (match_operand 3 "" "")]
1825 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1827 (define_expand "movstrsi"
1828 [(set (match_operand:BLK 0 "memory_operand" "")
1829 (match_operand:BLK 1 "memory_operand" ""))
1830 (use (match_operand:SI 2 "general_operand" ""))
1831 (match_operand 3 "" "")]
1833 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1835 ; Move a block that is up to 256 bytes in length.
1836 ; The block length is taken as (operands[2] % 256) + 1.
1838 (define_expand "movstr_short"
1840 [(set (match_operand:BLK 0 "memory_operand" "")
1841 (match_operand:BLK 1 "memory_operand" ""))
1842 (use (match_operand 2 "nonmemory_operand" ""))
1843 (clobber (match_dup 3))])]
1845 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1847 (define_insn "*movstr_short"
1848 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1849 (match_operand:BLK 1 "memory_operand" "Q,Q"))
1850 (use (match_operand 2 "nonmemory_operand" "n,a"))
1851 (clobber (match_scratch 3 "=X,&a"))]
1852 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
1853 && GET_MODE (operands[3]) == Pmode"
1855 switch (which_alternative)
1858 return "mvc\t%O0(%b2+1,%R0),%1";
1861 output_asm_insn ("bras\t%3,.+10", operands);
1862 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
1863 return "ex\t%2,0(%3)";
1869 [(set_attr "op_type" "SS,NN")
1870 (set_attr "type" "cs,cs")
1871 (set_attr "atype" "*,agen")
1872 (set_attr "length" "*,14")])
1874 ; Move a block of arbitrary length.
1876 (define_expand "movstr_long"
1878 [(clobber (match_dup 2))
1879 (clobber (match_dup 3))
1880 (set (match_operand:BLK 0 "memory_operand" "")
1881 (match_operand:BLK 1 "memory_operand" ""))
1882 (use (match_operand 2 "general_operand" ""))
1884 (clobber (reg:CC 33))])]
1887 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1888 rtx reg0 = gen_reg_rtx (dword_mode);
1889 rtx reg1 = gen_reg_rtx (dword_mode);
1890 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1891 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
1892 rtx len0 = gen_lowpart (Pmode, reg0);
1893 rtx len1 = gen_lowpart (Pmode, reg1);
1895 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1896 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1897 emit_move_insn (len0, operands[2]);
1899 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
1900 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1901 emit_move_insn (len1, operands[2]);
1903 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1904 operands[1] = replace_equiv_address_nv (operands[1], addr1);
1909 (define_insn "*movstr_long_64"
1910 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1911 (clobber (match_operand:TI 1 "register_operand" "=d"))
1912 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1913 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
1916 (clobber (reg:CC 33))]
1918 "mvcle\t%0,%1,0\;jo\t.-4"
1919 [(set_attr "op_type" "NN")
1920 (set_attr "type" "vs")
1921 (set_attr "length" "8")])
1923 (define_insn "*movstr_long_31"
1924 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1925 (clobber (match_operand:DI 1 "register_operand" "=d"))
1926 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1927 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
1930 (clobber (reg:CC 33))]
1932 "mvcle\t%0,%1,0\;jo\t.-4"
1933 [(set_attr "op_type" "NN")
1934 (set_attr "type" "vs")
1935 (set_attr "length" "8")])
1938 ; clrstrM instruction pattern(s).
1941 (define_expand "clrstrdi"
1942 [(set (match_operand:BLK 0 "memory_operand" "")
1944 (use (match_operand:DI 1 "general_operand" ""))
1945 (match_operand 2 "" "")]
1947 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
1949 (define_expand "clrstrsi"
1950 [(set (match_operand:BLK 0 "memory_operand" "")
1952 (use (match_operand:SI 1 "general_operand" ""))
1953 (match_operand 2 "" "")]
1955 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
1957 ; Clear a block that is up to 256 bytes in length.
1958 ; The block length is taken as (operands[1] % 256) + 1.
1960 (define_expand "clrstr_short"
1962 [(set (match_operand:BLK 0 "memory_operand" "")
1964 (use (match_operand 1 "nonmemory_operand" ""))
1965 (clobber (match_dup 2))
1966 (clobber (reg:CC 33))])]
1968 "operands[2] = gen_rtx_SCRATCH (Pmode);")
1970 (define_insn "*clrstr_short"
1971 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1973 (use (match_operand 1 "nonmemory_operand" "n,a"))
1974 (clobber (match_scratch 2 "=X,&a"))
1975 (clobber (reg:CC 33))]
1976 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
1977 && GET_MODE (operands[2]) == Pmode"
1979 switch (which_alternative)
1982 return "xc\t%O0(%b1+1,%R0),%0";
1985 output_asm_insn ("bras\t%2,.+10", operands);
1986 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
1987 return "ex\t%1,0(%2)";
1993 [(set_attr "op_type" "SS,NN")
1994 (set_attr "type" "cs,cs")
1995 (set_attr "atype" "*,agen")
1996 (set_attr "length" "*,14")])
1998 ; Clear a block of arbitrary length.
2000 (define_expand "clrstr_long"
2002 [(clobber (match_dup 1))
2003 (set (match_operand:BLK 0 "memory_operand" "")
2005 (use (match_operand 1 "general_operand" ""))
2007 (clobber (reg:CC 33))])]
2010 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2011 rtx reg0 = gen_reg_rtx (dword_mode);
2012 rtx reg1 = gen_reg_rtx (dword_mode);
2013 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2014 rtx len0 = gen_lowpart (Pmode, reg0);
2016 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2017 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2018 emit_move_insn (len0, operands[1]);
2020 emit_move_insn (reg1, const0_rtx);
2022 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2027 (define_insn "*clrstr_long_64"
2028 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2029 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2032 (use (match_operand:TI 1 "register_operand" "d"))
2033 (clobber (reg:CC 33))]
2035 "mvcle\t%0,%1,0\;jo\t.-4"
2036 [(set_attr "op_type" "NN")
2037 (set_attr "type" "vs")
2038 (set_attr "length" "8")])
2040 (define_insn "*clrstr_long_31"
2041 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2042 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2045 (use (match_operand:DI 1 "register_operand" "d"))
2046 (clobber (reg:CC 33))]
2048 "mvcle\t%0,%1,0\;jo\t.-4"
2049 [(set_attr "op_type" "NN")
2050 (set_attr "type" "vs")
2051 (set_attr "length" "8")])
2054 ; cmpmemM instruction pattern(s).
2057 (define_expand "cmpmemdi"
2058 [(set (match_operand:DI 0 "register_operand" "")
2059 (compare:DI (match_operand:BLK 1 "memory_operand" "")
2060 (match_operand:BLK 2 "memory_operand" "") ) )
2061 (use (match_operand:DI 3 "general_operand" ""))
2062 (use (match_operand:DI 4 "" ""))]
2064 "s390_expand_cmpmem (operands[0], operands[1],
2065 operands[2], operands[3]); DONE;")
2067 (define_expand "cmpmemsi"
2068 [(set (match_operand:SI 0 "register_operand" "")
2069 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2070 (match_operand:BLK 2 "memory_operand" "") ) )
2071 (use (match_operand:SI 3 "general_operand" ""))
2072 (use (match_operand:SI 4 "" ""))]
2074 "s390_expand_cmpmem (operands[0], operands[1],
2075 operands[2], operands[3]); DONE;")
2077 ; Compare a block that is up to 256 bytes in length.
2078 ; The block length is taken as (operands[2] % 256) + 1.
2080 (define_expand "cmpmem_short"
2083 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2084 (match_operand:BLK 1 "memory_operand" "")))
2085 (use (match_operand 2 "nonmemory_operand" ""))
2086 (clobber (match_dup 3))])]
2088 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2090 (define_insn "*cmpmem_short"
2092 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2093 (match_operand:BLK 1 "memory_operand" "Q,Q")))
2094 (use (match_operand 2 "nonmemory_operand" "n,a"))
2095 (clobber (match_scratch 3 "=X,&a"))]
2096 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2097 && GET_MODE (operands[3]) == Pmode"
2099 switch (which_alternative)
2102 return "clc\t%O0(%b2+1,%R0),%1";
2105 output_asm_insn ("bras\t%3,.+10", operands);
2106 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2107 return "ex\t%2,0(%3)";
2113 [(set_attr "op_type" "SS,NN")
2114 (set_attr "type" "cs,cs")
2115 (set_attr "atype" "*,agen")
2116 (set_attr "length" "*,14")])
2118 ; Compare a block of arbitrary length.
2120 (define_expand "cmpmem_long"
2122 [(clobber (match_dup 2))
2123 (clobber (match_dup 3))
2125 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2126 (match_operand:BLK 1 "memory_operand" "")))
2127 (use (match_operand 2 "general_operand" ""))
2128 (use (match_dup 3))])]
2131 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2132 rtx reg0 = gen_reg_rtx (dword_mode);
2133 rtx reg1 = gen_reg_rtx (dword_mode);
2134 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2135 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2136 rtx len0 = gen_lowpart (Pmode, reg0);
2137 rtx len1 = gen_lowpart (Pmode, reg1);
2139 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2140 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2141 emit_move_insn (len0, operands[2]);
2143 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2144 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2145 emit_move_insn (len1, operands[2]);
2147 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2148 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2153 (define_insn "*cmpmem_long_64"
2154 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2155 (clobber (match_operand:TI 1 "register_operand" "=d"))
2157 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2158 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2160 (use (match_dup 3))]
2162 "clcle\t%0,%1,0\;jo\t.-4"
2163 [(set_attr "op_type" "NN")
2164 (set_attr "type" "vs")
2165 (set_attr "length" "8")])
2167 (define_insn "*cmpmem_long_31"
2168 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2169 (clobber (match_operand:DI 1 "register_operand" "=d"))
2171 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2172 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2174 (use (match_dup 3))]
2176 "clcle\t%0,%1,0\;jo\t.-4"
2177 [(set_attr "op_type" "NN")
2178 (set_attr "type" "vs")
2179 (set_attr "length" "8")])
2181 ; Convert condition code to integer in range (-1, 0, 1)
2183 (define_insn "cmpint_si"
2184 [(set (match_operand:SI 0 "register_operand" "=d")
2185 (compare:SI (reg:CCS 33) (const_int 0)))]
2188 output_asm_insn ("lhi\t%0,1", operands);
2189 output_asm_insn ("jh\t.+12", operands);
2190 output_asm_insn ("jl\t.+6", operands);
2191 output_asm_insn ("sr\t%0,%0", operands);
2192 return "lcr\t%0,%0";
2194 [(set_attr "op_type" "NN")
2195 (set_attr "length" "16")
2196 (set_attr "type" "other")])
2198 (define_insn "cmpint_di"
2199 [(set (match_operand:DI 0 "register_operand" "=d")
2200 (compare:DI (reg:CCS 33) (const_int 0)))]
2203 output_asm_insn ("lghi\t%0,1", operands);
2204 output_asm_insn ("jh\t.+16", operands);
2205 output_asm_insn ("jl\t.+8", operands);
2206 output_asm_insn ("sgr\t%0,%0", operands);
2207 return "lcgr\t%0,%0";
2209 [(set_attr "op_type" "NN")
2210 (set_attr "length" "20")
2211 (set_attr "type" "other")])
2215 ;;- Conversion instructions.
2218 (define_insn "*sethighqisi"
2219 [(set (match_operand:SI 0 "register_operand" "=d,d")
2220 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2221 (clobber (reg:CC 33))]
2226 [(set_attr "op_type" "RS,RSY")])
2228 (define_insn "*sethighhisi"
2229 [(set (match_operand:SI 0 "register_operand" "=d,d")
2230 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2231 (clobber (reg:CC 33))]
2236 [(set_attr "op_type" "RS,RSY")])
2238 (define_insn "*sethighqidi_64"
2239 [(set (match_operand:DI 0 "register_operand" "=d")
2240 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2241 (clobber (reg:CC 33))]
2244 [(set_attr "op_type" "RSY")])
2246 (define_insn "*sethighqidi_31"
2247 [(set (match_operand:DI 0 "register_operand" "=d,d")
2248 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2249 (clobber (reg:CC 33))]
2254 [(set_attr "op_type" "RS,RSY")])
2256 (define_insn_and_split "*extractqi"
2257 [(set (match_operand:SI 0 "register_operand" "=d")
2258 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2259 (match_operand 2 "const_int_operand" "n")
2261 (clobber (reg:CC 33))]
2263 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2265 "&& reload_completed"
2267 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2268 (clobber (reg:CC 33))])
2269 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2271 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2272 operands[1] = change_address (operands[1], QImode, 0);
2274 [(set_attr "atype" "agen")])
2276 (define_insn_and_split "*extracthi"
2277 [(set (match_operand:SI 0 "register_operand" "=d")
2278 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2279 (match_operand 2 "const_int_operand" "n")
2281 (clobber (reg:CC 33))]
2283 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2285 "&& reload_completed"
2287 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2288 (clobber (reg:CC 33))])
2289 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2291 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2292 operands[1] = change_address (operands[1], HImode, 0);
2294 [(set_attr "atype" "agen")])
2297 ; extendsidi2 instruction pattern(s).
2300 (define_expand "extendsidi2"
2301 [(set (match_operand:DI 0 "register_operand" "")
2302 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2308 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2309 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2310 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2311 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2317 (define_insn "*extendsidi2"
2318 [(set (match_operand:DI 0 "register_operand" "=d,d")
2319 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2324 [(set_attr "op_type" "RRE,RXY")])
2327 ; extendhidi2 instruction pattern(s).
2330 (define_expand "extendhidi2"
2331 [(set (match_operand:DI 0 "register_operand" "")
2332 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2338 rtx tmp = gen_reg_rtx (SImode);
2339 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2340 emit_insn (gen_extendsidi2 (operands[0], tmp));
2345 operands[1] = gen_lowpart (DImode, operands[1]);
2346 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2347 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2353 (define_insn "*extendhidi2"
2354 [(set (match_operand:DI 0 "register_operand" "=d")
2355 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2358 [(set_attr "op_type" "RXY")])
2361 ; extendqidi2 instruction pattern(s).
2364 (define_expand "extendqidi2"
2365 [(set (match_operand:DI 0 "register_operand" "")
2366 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2372 rtx tmp = gen_reg_rtx (SImode);
2373 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2374 emit_insn (gen_extendsidi2 (operands[0], tmp));
2379 operands[1] = gen_lowpart (DImode, operands[1]);
2380 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2381 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2387 (define_insn "*extendqidi2"
2388 [(set (match_operand:DI 0 "register_operand" "=d")
2389 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2390 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2392 [(set_attr "op_type" "RXY")])
2395 [(set (match_operand:DI 0 "register_operand" "")
2396 (sign_extend:DI (match_operand:QI 1 "s_operand" "")))]
2397 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT && !reload_completed"
2399 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2400 (clobber (reg:CC 33))])
2402 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2403 (clobber (reg:CC 33))])]
2407 ; extendhisi2 instruction pattern(s).
2410 (define_expand "extendhisi2"
2411 [(set (match_operand:SI 0 "register_operand" "")
2412 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2416 operands[1] = gen_lowpart (SImode, operands[1]);
2417 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2418 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2423 (define_insn "*extendhisi2"
2424 [(set (match_operand:SI 0 "register_operand" "=d,d")
2425 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2430 [(set_attr "op_type" "RX,RXY")])
2433 ; extendqisi2 instruction pattern(s).
2436 (define_expand "extendqisi2"
2437 [(set (match_operand:SI 0 "register_operand" "")
2438 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2442 operands[1] = gen_lowpart (SImode, operands[1]);
2443 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2444 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2449 (define_insn "*extendqisi2"
2450 [(set (match_operand:SI 0 "register_operand" "=d")
2451 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2452 "TARGET_LONG_DISPLACEMENT"
2454 [(set_attr "op_type" "RXY")])
2457 [(set (match_operand:SI 0 "register_operand" "")
2458 (sign_extend:SI (match_operand:QI 1 "s_operand" "")))]
2459 "!TARGET_LONG_DISPLACEMENT && !reload_completed"
2461 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2462 (clobber (reg:CC 33))])
2464 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2465 (clobber (reg:CC 33))])]
2469 ; extendqihi2 instruction pattern(s).
2474 ; zero_extendsidi2 instruction pattern(s).
2477 (define_expand "zero_extendsidi2"
2478 [(set (match_operand:DI 0 "register_operand" "")
2479 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2485 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2486 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2487 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2493 (define_insn "*zero_extendsidi2"
2494 [(set (match_operand:DI 0 "register_operand" "=d,d")
2495 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2500 [(set_attr "op_type" "RRE,RXY")])
2503 ; zero_extendhidi2 instruction pattern(s).
2506 (define_expand "zero_extendhidi2"
2507 [(set (match_operand:DI 0 "register_operand" "")
2508 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2514 rtx tmp = gen_reg_rtx (SImode);
2515 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2516 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2521 operands[1] = gen_lowpart (DImode, operands[1]);
2522 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2523 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2529 (define_insn "*zero_extendhidi2"
2530 [(set (match_operand:DI 0 "register_operand" "=d")
2531 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2534 [(set_attr "op_type" "RXY")])
2537 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2540 (define_insn "*llgt_sisi"
2541 [(set (match_operand:SI 0 "register_operand" "=d,d")
2542 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2543 (const_int 2147483647)))]
2548 [(set_attr "op_type" "RRE,RXE")])
2551 [(set (match_operand:SI 0 "register_operand" "")
2552 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2553 (const_int 2147483647)))
2554 (clobber (reg:CC 33))]
2555 "TARGET_64BIT && reload_completed"
2557 (and:SI (match_dup 1)
2558 (const_int 2147483647)))]
2561 (define_insn "*llgt_didi"
2562 [(set (match_operand:DI 0 "register_operand" "=d,d")
2563 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2564 (const_int 2147483647)))]
2569 [(set_attr "op_type" "RRE,RXE")])
2572 [(set (match_operand:DI 0 "register_operand" "")
2573 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
2574 (const_int 2147483647)))
2575 (clobber (reg:CC 33))]
2576 "TARGET_64BIT && reload_completed"
2578 (and:DI (match_dup 1)
2579 (const_int 2147483647)))]
2582 (define_insn "*llgt_sidi"
2583 [(set (match_operand:DI 0 "register_operand" "=d")
2584 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2585 (const_int 2147483647)))]
2588 [(set_attr "op_type" "RXE")])
2590 (define_insn_and_split "*llgt_sidi_split"
2591 [(set (match_operand:DI 0 "register_operand" "=d")
2592 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2593 (const_int 2147483647)))
2594 (clobber (reg:CC 33))]
2597 "&& reload_completed"
2599 (and:DI (subreg:DI (match_dup 1) 0)
2600 (const_int 2147483647)))]
2604 ; zero_extendqidi2 instruction pattern(s)
2607 (define_expand "zero_extendqidi2"
2608 [(set (match_operand:DI 0 "register_operand" "")
2609 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2615 rtx tmp = gen_reg_rtx (SImode);
2616 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2617 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2622 operands[1] = gen_lowpart (DImode, operands[1]);
2623 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2624 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2630 (define_insn "*zero_extendqidi2"
2631 [(set (match_operand:DI 0 "register_operand" "=d")
2632 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2635 [(set_attr "op_type" "RXY")])
2638 ; zero_extendhisi2 instruction pattern(s).
2641 (define_expand "zero_extendhisi2"
2642 [(set (match_operand:SI 0 "register_operand" "")
2643 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2647 operands[1] = gen_lowpart (SImode, operands[1]);
2648 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2653 (define_insn "*zero_extendhisi2_64"
2654 [(set (match_operand:SI 0 "register_operand" "=d")
2655 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2658 [(set_attr "op_type" "RXY")])
2660 (define_insn_and_split "*zero_extendhisi2_31"
2661 [(set (match_operand:SI 0 "register_operand" "=&d")
2662 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2663 (clobber (reg:CC 33))]
2666 "&& reload_completed"
2667 [(set (match_dup 0) (const_int 0))
2669 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2670 (clobber (reg:CC 33))])]
2671 "operands[2] = gen_lowpart (HImode, operands[0]);"
2672 [(set_attr "atype" "agen")])
2675 ; zero_extendqisi2 instruction pattern(s).
2678 (define_expand "zero_extendqisi2"
2679 [(set (match_operand:SI 0 "register_operand" "")
2680 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2684 operands[1] = gen_lowpart (SImode, operands[1]);
2685 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2690 (define_insn "*zero_extendqisi2_64"
2691 [(set (match_operand:SI 0 "register_operand" "=d")
2692 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2695 [(set_attr "op_type" "RXY")])
2697 (define_insn_and_split "*zero_extendqisi2_31"
2698 [(set (match_operand:SI 0 "register_operand" "=&d")
2699 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2702 "&& reload_completed"
2703 [(set (match_dup 0) (const_int 0))
2704 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2705 "operands[2] = gen_lowpart (QImode, operands[0]);"
2706 [(set_attr "atype" "agen")])
2709 ; zero_extendqihi2 instruction pattern(s).
2712 (define_expand "zero_extendqihi2"
2713 [(set (match_operand:HI 0 "register_operand" "")
2714 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2718 operands[1] = gen_lowpart (HImode, operands[1]);
2719 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2724 (define_insn "*zero_extendqihi2_64"
2725 [(set (match_operand:HI 0 "register_operand" "=d")
2726 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2729 [(set_attr "op_type" "RXY")])
2731 (define_insn_and_split "*zero_extendqihi2_31"
2732 [(set (match_operand:HI 0 "register_operand" "=&d")
2733 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2736 "&& reload_completed"
2737 [(set (match_dup 0) (const_int 0))
2738 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2739 "operands[2] = gen_lowpart (QImode, operands[0]);"
2740 [(set_attr "atype" "agen")])
2744 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2747 (define_expand "fixuns_truncdfdi2"
2748 [(set (match_operand:DI 0 "register_operand" "")
2749 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2750 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2752 rtx label1 = gen_label_rtx ();
2753 rtx label2 = gen_label_rtx ();
2754 rtx temp = gen_reg_rtx (DFmode);
2755 operands[1] = force_reg (DFmode, operands[1]);
2757 emit_insn (gen_cmpdf (operands[1],
2758 CONST_DOUBLE_FROM_REAL_VALUE (
2759 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2760 emit_jump_insn (gen_blt (label1));
2761 emit_insn (gen_subdf3 (temp, operands[1],
2762 CONST_DOUBLE_FROM_REAL_VALUE (
2763 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2764 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2767 emit_label (label1);
2768 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2769 emit_label (label2);
2773 (define_expand "fix_truncdfdi2"
2774 [(set (match_operand:DI 0 "register_operand" "")
2775 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2776 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2778 operands[1] = force_reg (DFmode, operands[1]);
2779 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2783 (define_insn "fix_truncdfdi2_ieee"
2784 [(set (match_operand:DI 0 "register_operand" "=d")
2785 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2786 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2787 (clobber (reg:CC 33))]
2788 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2790 [(set_attr "op_type" "RRE")
2791 (set_attr "type" "ftoi")])
2794 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2797 (define_expand "fixuns_truncdfsi2"
2798 [(set (match_operand:SI 0 "register_operand" "")
2799 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2800 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2802 rtx label1 = gen_label_rtx ();
2803 rtx label2 = gen_label_rtx ();
2804 rtx temp = gen_reg_rtx (DFmode);
2806 operands[1] = force_reg (DFmode,operands[1]);
2807 emit_insn (gen_cmpdf (operands[1],
2808 CONST_DOUBLE_FROM_REAL_VALUE (
2809 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2810 emit_jump_insn (gen_blt (label1));
2811 emit_insn (gen_subdf3 (temp, operands[1],
2812 CONST_DOUBLE_FROM_REAL_VALUE (
2813 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2814 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2817 emit_label (label1);
2818 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2819 emit_label (label2);
2823 (define_expand "fix_truncdfsi2"
2824 [(set (match_operand:SI 0 "register_operand" "")
2825 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2828 if (TARGET_IBM_FLOAT)
2830 /* This is the algorithm from POP chapter A.5.7.2. */
2832 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2833 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2834 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2836 operands[1] = force_reg (DFmode, operands[1]);
2837 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2838 two31r, two32, temp));
2842 operands[1] = force_reg (DFmode, operands[1]);
2843 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2849 (define_insn "fix_truncdfsi2_ieee"
2850 [(set (match_operand:SI 0 "register_operand" "=d")
2851 (fix:SI (match_operand:DF 1 "register_operand" "f")))
2852 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2853 (clobber (reg:CC 33))]
2854 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2856 [(set_attr "op_type" "RRE")
2857 (set_attr "type" "other" )])
2859 (define_insn "fix_truncdfsi2_ibm"
2860 [(set (match_operand:SI 0 "register_operand" "=d")
2861 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2862 (use (match_operand:DI 2 "immediate_operand" "m"))
2863 (use (match_operand:DI 3 "immediate_operand" "m"))
2864 (use (match_operand:BLK 4 "memory_operand" "m"))
2865 (clobber (reg:CC 33))]
2866 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2868 output_asm_insn ("sd\t%1,%2", operands);
2869 output_asm_insn ("aw\t%1,%3", operands);
2870 output_asm_insn ("std\t%1,%4", operands);
2871 output_asm_insn ("xi\t%N4,128", operands);
2874 [(set_attr "op_type" "NN")
2875 (set_attr "type" "ftoi")
2876 (set_attr "atype" "agen")
2877 (set_attr "length" "20")])
2880 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
2883 (define_expand "fixuns_truncsfdi2"
2884 [(set (match_operand:DI 0 "register_operand" "")
2885 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2886 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2888 rtx label1 = gen_label_rtx ();
2889 rtx label2 = gen_label_rtx ();
2890 rtx temp = gen_reg_rtx (SFmode);
2892 operands[1] = force_reg (SFmode, operands[1]);
2893 emit_insn (gen_cmpsf (operands[1],
2894 CONST_DOUBLE_FROM_REAL_VALUE (
2895 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
2896 emit_jump_insn (gen_blt (label1));
2898 emit_insn (gen_subsf3 (temp, operands[1],
2899 CONST_DOUBLE_FROM_REAL_VALUE (
2900 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
2901 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
2904 emit_label (label1);
2905 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2906 emit_label (label2);
2910 (define_expand "fix_truncsfdi2"
2911 [(set (match_operand:DI 0 "register_operand" "")
2912 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
2913 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2915 operands[1] = force_reg (SFmode, operands[1]);
2916 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2920 (define_insn "fix_truncsfdi2_ieee"
2921 [(set (match_operand:DI 0 "register_operand" "=d")
2922 (fix:DI (match_operand:SF 1 "register_operand" "f")))
2923 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2924 (clobber (reg:CC 33))]
2925 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2927 [(set_attr "op_type" "RRE")
2928 (set_attr "type" "ftoi")])
2931 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
2934 (define_expand "fixuns_truncsfsi2"
2935 [(set (match_operand:SI 0 "register_operand" "")
2936 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
2937 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2939 rtx label1 = gen_label_rtx ();
2940 rtx label2 = gen_label_rtx ();
2941 rtx temp = gen_reg_rtx (SFmode);
2943 operands[1] = force_reg (SFmode, operands[1]);
2944 emit_insn (gen_cmpsf (operands[1],
2945 CONST_DOUBLE_FROM_REAL_VALUE (
2946 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
2947 emit_jump_insn (gen_blt (label1));
2948 emit_insn (gen_subsf3 (temp, operands[1],
2949 CONST_DOUBLE_FROM_REAL_VALUE (
2950 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
2951 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
2954 emit_label (label1);
2955 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2956 emit_label (label2);
2960 (define_expand "fix_truncsfsi2"
2961 [(set (match_operand:SI 0 "register_operand" "")
2962 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
2965 if (TARGET_IBM_FLOAT)
2967 /* Convert to DFmode and then use the POP algorithm. */
2968 rtx temp = gen_reg_rtx (DFmode);
2969 emit_insn (gen_extendsfdf2 (temp, operands[1]));
2970 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
2974 operands[1] = force_reg (SFmode, operands[1]);
2975 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2981 (define_insn "fix_truncsfsi2_ieee"
2982 [(set (match_operand:SI 0 "register_operand" "=d")
2983 (fix:SI (match_operand:SF 1 "register_operand" "f")))
2984 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2985 (clobber (reg:CC 33))]
2986 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2988 [(set_attr "op_type" "RRE")
2989 (set_attr "type" "ftoi")])
2992 ; floatdidf2 instruction pattern(s).
2995 (define_insn "floatdidf2"
2996 [(set (match_operand:DF 0 "register_operand" "=f")
2997 (float:DF (match_operand:DI 1 "register_operand" "d")))
2998 (clobber (reg:CC 33))]
2999 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3001 [(set_attr "op_type" "RRE")
3002 (set_attr "type" "itof" )])
3005 ; floatdisf2 instruction pattern(s).
3008 (define_insn "floatdisf2"
3009 [(set (match_operand:SF 0 "register_operand" "=f")
3010 (float:SF (match_operand:DI 1 "register_operand" "d")))
3011 (clobber (reg:CC 33))]
3012 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3014 [(set_attr "op_type" "RRE")
3015 (set_attr "type" "itof" )])
3018 ; floatsidf2 instruction pattern(s).
3021 (define_expand "floatsidf2"
3023 [(set (match_operand:DF 0 "register_operand" "")
3024 (float:DF (match_operand:SI 1 "register_operand" "")))
3025 (clobber (reg:CC 33))])]
3028 if (TARGET_IBM_FLOAT)
3030 /* This is the algorithm from POP chapter A.5.7.1. */
3032 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3033 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
3035 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
3040 (define_insn "floatsidf2_ieee"
3041 [(set (match_operand:DF 0 "register_operand" "=f")
3042 (float:DF (match_operand:SI 1 "register_operand" "d")))
3043 (clobber (reg:CC 33))]
3044 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3046 [(set_attr "op_type" "RRE")
3047 (set_attr "type" "itof" )])
3049 (define_insn "floatsidf2_ibm"
3050 [(set (match_operand:DF 0 "register_operand" "=f")
3051 (float:DF (match_operand:SI 1 "register_operand" "d")))
3052 (use (match_operand:DI 2 "immediate_operand" "m"))
3053 (use (match_operand:BLK 3 "memory_operand" "m"))
3054 (clobber (reg:CC 33))]
3055 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3057 output_asm_insn ("st\t%1,%N3", operands);
3058 output_asm_insn ("xi\t%N3,128", operands);
3059 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3060 output_asm_insn ("ld\t%0,%3", operands);
3063 [(set_attr "op_type" "NN")
3064 (set_attr "type" "other" )
3065 (set_attr "atype" "agen")
3066 (set_attr "length" "20")])
3069 ; floatsisf2 instruction pattern(s).
3072 (define_expand "floatsisf2"
3074 [(set (match_operand:SF 0 "register_operand" "")
3075 (float:SF (match_operand:SI 1 "register_operand" "")))
3076 (clobber (reg:CC 33))])]
3079 if (TARGET_IBM_FLOAT)
3081 /* Use the POP algorithm to convert to DFmode and then truncate. */
3082 rtx temp = gen_reg_rtx (DFmode);
3083 emit_insn (gen_floatsidf2 (temp, operands[1]));
3084 emit_insn (gen_truncdfsf2 (operands[0], temp));
3089 (define_insn "floatsisf2_ieee"
3090 [(set (match_operand:SF 0 "register_operand" "=f")
3091 (float:SF (match_operand:SI 1 "register_operand" "d")))
3092 (clobber (reg:CC 33))]
3093 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3095 [(set_attr "op_type" "RRE")
3096 (set_attr "type" "itof" )])
3099 ; truncdfsf2 instruction pattern(s).
3102 (define_expand "truncdfsf2"
3103 [(set (match_operand:SF 0 "register_operand" "")
3104 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3108 (define_insn "truncdfsf2_ieee"
3109 [(set (match_operand:SF 0 "register_operand" "=f")
3110 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3111 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3113 [(set_attr "op_type" "RRE")])
3115 (define_insn "truncdfsf2_ibm"
3116 [(set (match_operand:SF 0 "register_operand" "=f,f")
3117 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3118 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3122 [(set_attr "op_type" "RR,RX")
3123 (set_attr "type" "floads,floads")])
3126 ; extendsfdf2 instruction pattern(s).
3129 (define_expand "extendsfdf2"
3130 [(set (match_operand:DF 0 "register_operand" "")
3131 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3134 if (TARGET_IBM_FLOAT)
3136 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3141 (define_insn "extendsfdf2_ieee"
3142 [(set (match_operand:DF 0 "register_operand" "=f,f")
3143 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3144 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3148 [(set_attr "op_type" "RRE,RXE")
3149 (set_attr "type" "floads,floads")])
3151 (define_insn "extendsfdf2_ibm"
3152 [(set (match_operand:DF 0 "register_operand" "=f,f")
3153 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3154 (clobber (reg:CC 33))]
3155 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3157 sdr\t%0,%0\;ler\t%0,%1
3158 sdr\t%0,%0\;le\t%0,%1"
3159 [(set_attr "op_type" "NN,NN")
3160 (set_attr "atype" "reg,agen")
3161 (set_attr "length" "4,6")
3162 (set_attr "type" "o2,o2")])
3166 ;; ARITHMETIC OPERATIONS
3168 ; arithmetic operations set the ConditionCode,
3169 ; because of unpredictable Bits in Register for Halfword and Byte
3170 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3173 ;;- Add instructions.
3177 ; adddi3 instruction pattern(s).
3180 (define_insn "*adddi3_sign"
3181 [(set (match_operand:DI 0 "register_operand" "=d,d")
3182 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3183 (match_operand:DI 1 "register_operand" "0,0")))
3184 (clobber (reg:CC 33))]
3189 [(set_attr "op_type" "RRE,RXY")])
3191 (define_insn "*adddi3_zero_cc"
3193 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3194 (match_operand:DI 1 "register_operand" "0,0"))
3196 (set (match_operand:DI 0 "register_operand" "=d,d")
3197 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3198 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3202 [(set_attr "op_type" "RRE,RXY")])
3204 (define_insn "*adddi3_zero_cconly"
3206 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3207 (match_operand:DI 1 "register_operand" "0,0"))
3209 (clobber (match_scratch:DI 0 "=d,d"))]
3210 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3214 [(set_attr "op_type" "RRE,RXY")])
3216 (define_insn "*adddi3_zero"
3217 [(set (match_operand:DI 0 "register_operand" "=d,d")
3218 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3219 (match_operand:DI 1 "register_operand" "0,0")))
3220 (clobber (reg:CC 33))]
3225 [(set_attr "op_type" "RRE,RXY")])
3227 (define_insn "*adddi3_imm_cc"
3229 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3230 (match_operand:DI 2 "const_int_operand" "K"))
3232 (set (match_operand:DI 0 "register_operand" "=d")
3233 (plus:DI (match_dup 1) (match_dup 2)))]
3235 && s390_match_ccmode (insn, CCAmode)
3236 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3238 [(set_attr "op_type" "RI")])
3240 (define_insn "*adddi3_carry1_cc"
3242 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3243 (match_operand:DI 2 "general_operand" "d,m"))
3245 (set (match_operand:DI 0 "register_operand" "=d,d")
3246 (plus:DI (match_dup 1) (match_dup 2)))]
3247 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3251 [(set_attr "op_type" "RRE,RXY")])
3253 (define_insn "*adddi3_carry1_cconly"
3255 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3256 (match_operand:DI 2 "general_operand" "d,m"))
3258 (clobber (match_scratch:DI 0 "=d,d"))]
3259 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3263 [(set_attr "op_type" "RRE,RXY")])
3265 (define_insn "*adddi3_carry2_cc"
3267 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3268 (match_operand:DI 2 "general_operand" "d,m"))
3270 (set (match_operand:DI 0 "register_operand" "=d,d")
3271 (plus:DI (match_dup 1) (match_dup 2)))]
3272 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3276 [(set_attr "op_type" "RRE,RXY")])
3278 (define_insn "*adddi3_carry2_cconly"
3280 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3281 (match_operand:DI 2 "general_operand" "d,m"))
3283 (clobber (match_scratch:DI 0 "=d,d"))]
3284 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3288 [(set_attr "op_type" "RRE,RXY")])
3290 (define_insn "*adddi3_cc"
3292 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3293 (match_operand:DI 2 "general_operand" "d,m"))
3295 (set (match_operand:DI 0 "register_operand" "=d,d")
3296 (plus:DI (match_dup 1) (match_dup 2)))]
3297 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3301 [(set_attr "op_type" "RRE,RXY")])
3303 (define_insn "*adddi3_cconly"
3305 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3306 (match_operand:DI 2 "general_operand" "d,m"))
3308 (clobber (match_scratch:DI 0 "=d,d"))]
3309 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3313 [(set_attr "op_type" "RRE,RXY")])
3315 (define_insn "*adddi3_cconly2"
3317 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3318 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3319 (clobber (match_scratch:DI 0 "=d,d"))]
3320 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3324 [(set_attr "op_type" "RRE,RXY")])
3326 (define_insn "*adddi3_64"
3327 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3328 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3329 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3330 (clobber (reg:CC 33))]
3336 [(set_attr "op_type" "RRE,RI,RXY")])
3338 (define_insn_and_split "*adddi3_31z"
3339 [(set (match_operand:DI 0 "register_operand" "=&d")
3340 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3341 (match_operand:DI 2 "general_operand" "do") ) )
3342 (clobber (reg:CC 33))]
3343 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3345 "&& reload_completed"
3348 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3350 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3352 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3353 (ltu:SI (reg:CCL1 33) (const_int 0))))
3354 (clobber (reg:CC 33))])]
3355 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3356 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3357 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3358 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3359 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3360 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3361 [(set_attr "op_type" "NN")])
3363 (define_insn_and_split "*adddi3_31"
3364 [(set (match_operand:DI 0 "register_operand" "=&d")
3365 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3366 (match_operand:DI 2 "general_operand" "do") ) )
3367 (clobber (reg:CC 33))]
3370 "&& reload_completed"
3372 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3373 (clobber (reg:CC 33))])
3376 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3378 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3380 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3382 (label_ref (match_dup 9))))
3384 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3385 (clobber (reg:CC 33))])
3387 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3388 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3389 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3390 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3391 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3392 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3393 operands[9] = gen_label_rtx ();"
3394 [(set_attr "op_type" "NN")])
3396 (define_expand "adddi3"
3398 [(set (match_operand:DI 0 "register_operand" "")
3399 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3400 (match_operand:DI 2 "general_operand" "")))
3401 (clobber (reg:CC 33))])]
3405 (define_insn "*la_64"
3406 [(set (match_operand:DI 0 "register_operand" "=d,d")
3407 (match_operand:QI 1 "address_operand" "U,W"))]
3412 [(set_attr "op_type" "RX,RXY")
3413 (set_attr "type" "la")])
3417 [(set (match_operand:DI 0 "register_operand" "")
3418 (match_operand:QI 1 "address_operand" ""))
3419 (clobber (reg:CC 33))])]
3421 && strict_memory_address_p (VOIDmode, operands[1])
3422 && preferred_la_operand_p (operands[1])"
3423 [(set (match_dup 0) (match_dup 1))]
3427 [(set (match_operand:DI 0 "register_operand" "")
3428 (match_operand:DI 1 "register_operand" ""))
3431 (plus:DI (match_dup 0)
3432 (match_operand:DI 2 "nonmemory_operand" "")))
3433 (clobber (reg:CC 33))])]
3435 && !reg_overlap_mentioned_p (operands[0], operands[2])
3436 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (DImode, operands[1], operands[2]))
3437 && preferred_la_operand_p (gen_rtx_PLUS (DImode, operands[1], operands[2]))"
3438 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3441 (define_expand "reload_indi"
3442 [(parallel [(match_operand:DI 0 "register_operand" "=a")
3443 (match_operand:DI 1 "s390_plus_operand" "")
3444 (match_operand:DI 2 "register_operand" "=&a")])]
3447 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3453 ; addsi3 instruction pattern(s).
3456 (define_insn "*addsi3_imm_cc"
3458 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3459 (match_operand:SI 2 "const_int_operand" "K"))
3461 (set (match_operand:SI 0 "register_operand" "=d")
3462 (plus:SI (match_dup 1) (match_dup 2)))]
3463 "s390_match_ccmode (insn, CCAmode)
3464 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3466 [(set_attr "op_type" "RI")])
3468 (define_insn "*addsi3_carry1_cc"
3470 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3471 (match_operand:SI 2 "general_operand" "d,R,T"))
3473 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3474 (plus:SI (match_dup 1) (match_dup 2)))]
3475 "s390_match_ccmode (insn, CCL1mode)"
3480 [(set_attr "op_type" "RR,RX,RXY")])
3482 (define_insn "*addsi3_carry1_cconly"
3484 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3485 (match_operand:SI 2 "general_operand" "d,R,T"))
3487 (clobber (match_scratch:SI 0 "=d,d,d"))]
3488 "s390_match_ccmode (insn, CCL1mode)"
3493 [(set_attr "op_type" "RR,RX,RXY")])
3495 (define_insn "*addsi3_carry2_cc"
3497 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3498 (match_operand:SI 2 "general_operand" "d,R,T"))
3500 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3501 (plus:SI (match_dup 1) (match_dup 2)))]
3502 "s390_match_ccmode (insn, CCL1mode)"
3507 [(set_attr "op_type" "RR,RX,RXY")])
3509 (define_insn "*addsi3_carry2_cconly"
3511 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3512 (match_operand:SI 2 "general_operand" "d,R,T"))
3514 (clobber (match_scratch:SI 0 "=d,d,d"))]
3515 "s390_match_ccmode (insn, CCL1mode)"
3520 [(set_attr "op_type" "RR,RX,RXY")])
3522 (define_insn "*addsi3_cc"
3524 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3525 (match_operand:SI 2 "general_operand" "d,R,T"))
3527 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3528 (plus:SI (match_dup 1) (match_dup 2)))]
3529 "s390_match_ccmode (insn, CCLmode)"
3534 [(set_attr "op_type" "RR,RX,RXY")])
3536 (define_insn "*addsi3_cconly"
3538 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3539 (match_operand:SI 2 "general_operand" "d,R,T"))
3541 (clobber (match_scratch:SI 0 "=d,d,d"))]
3542 "s390_match_ccmode (insn, CCLmode)"
3547 [(set_attr "op_type" "RR,RX,RXY")])
3549 (define_insn "*addsi3_cconly2"
3551 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3552 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3553 (clobber (match_scratch:SI 0 "=d,d,d"))]
3554 "s390_match_ccmode (insn, CCLmode)"
3559 [(set_attr "op_type" "RR,RX,RXY")])
3561 (define_insn "*addsi3_sign"
3562 [(set (match_operand:SI 0 "register_operand" "=d,d")
3563 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3564 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3565 (clobber (reg:CC 33))]
3570 [(set_attr "op_type" "RX,RXY")])
3572 (define_insn "addsi3"
3573 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3574 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3575 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3576 (clobber (reg:CC 33))]
3583 [(set_attr "op_type" "RR,RI,RX,RXY")])
3585 (define_insn "*la_31"
3586 [(set (match_operand:SI 0 "register_operand" "=d,d")
3587 (match_operand:QI 1 "address_operand" "U,W"))]
3588 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
3592 [(set_attr "op_type" "RX,RXY")
3593 (set_attr "type" "la")])
3597 [(set (match_operand:SI 0 "register_operand" "")
3598 (match_operand:QI 1 "address_operand" ""))
3599 (clobber (reg:CC 33))])]
3601 && strict_memory_address_p (VOIDmode, operands[1])
3602 && preferred_la_operand_p (operands[1])"
3603 [(set (match_dup 0) (match_dup 1))]
3607 [(set (match_operand:SI 0 "register_operand" "")
3608 (match_operand:SI 1 "register_operand" ""))
3611 (plus:SI (match_dup 0)
3612 (match_operand:SI 2 "nonmemory_operand" "")))
3613 (clobber (reg:CC 33))])]
3615 && !reg_overlap_mentioned_p (operands[0], operands[2])
3616 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
3617 && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
3618 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3621 (define_insn "*la_31_and"
3622 [(set (match_operand:SI 0 "register_operand" "=d,d")
3623 (and:SI (match_operand:QI 1 "address_operand" "U,W")
3624 (const_int 2147483647)))]
3629 [(set_attr "op_type" "RX,RXY")
3630 (set_attr "type" "la")])
3632 (define_insn_and_split "*la_31_and_cc"
3633 [(set (match_operand:SI 0 "register_operand" "=d")
3634 (and:SI (match_operand:QI 1 "address_operand" "p")
3635 (const_int 2147483647)))
3636 (clobber (reg:CC 33))]
3639 "&& reload_completed"
3641 (and:SI (match_dup 1) (const_int 2147483647)))]
3643 [(set_attr "op_type" "RX")
3644 (set_attr "type" "la")])
3646 (define_insn "force_la_31"
3647 [(set (match_operand:SI 0 "register_operand" "=d,d")
3648 (match_operand:QI 1 "address_operand" "U,W"))
3649 (use (const_int 0))]
3654 [(set_attr "op_type" "RX")
3655 (set_attr "type" "la")])
3657 (define_expand "reload_insi"
3658 [(parallel [(match_operand:SI 0 "register_operand" "=a")
3659 (match_operand:SI 1 "s390_plus_operand" "")
3660 (match_operand:SI 2 "register_operand" "=&a")])]
3663 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3669 ; adddf3 instruction pattern(s).
3672 (define_expand "adddf3"
3674 [(set (match_operand:DF 0 "register_operand" "=f,f")
3675 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3676 (match_operand:DF 2 "general_operand" "f,R")))
3677 (clobber (reg:CC 33))])]
3681 (define_insn "*adddf3"
3682 [(set (match_operand:DF 0 "register_operand" "=f,f")
3683 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3684 (match_operand:DF 2 "general_operand" "f,R")))
3685 (clobber (reg:CC 33))]
3686 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3690 [(set_attr "op_type" "RRE,RXE")
3691 (set_attr "type" "fsimpd,fsimpd")])
3693 (define_insn "*adddf3_cc"
3695 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3696 (match_operand:DF 2 "general_operand" "f,R"))
3697 (match_operand:DF 3 "const0_operand" "")))
3698 (set (match_operand:DF 0 "register_operand" "=f,f")
3699 (plus:DF (match_dup 1) (match_dup 2)))]
3700 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3704 [(set_attr "op_type" "RRE,RXE")
3705 (set_attr "type" "fsimpd,fsimpd")])
3707 (define_insn "*adddf3_cconly"
3709 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3710 (match_operand:DF 2 "general_operand" "f,R"))
3711 (match_operand:DF 3 "const0_operand" "")))
3712 (clobber (match_scratch:DF 0 "=f,f"))]
3713 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3717 [(set_attr "op_type" "RRE,RXE")
3718 (set_attr "type" "fsimpd,fsimpd")])
3720 (define_insn "*adddf3_ibm"
3721 [(set (match_operand:DF 0 "register_operand" "=f,f")
3722 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3723 (match_operand:DF 2 "general_operand" "f,R")))
3724 (clobber (reg:CC 33))]
3725 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3729 [(set_attr "op_type" "RR,RX")
3730 (set_attr "type" "fsimpd,fsimpd")])
3733 ; addsf3 instruction pattern(s).
3736 (define_expand "addsf3"
3738 [(set (match_operand:SF 0 "register_operand" "=f,f")
3739 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3740 (match_operand:SF 2 "general_operand" "f,R")))
3741 (clobber (reg:CC 33))])]
3745 (define_insn "*addsf3"
3746 [(set (match_operand:SF 0 "register_operand" "=f,f")
3747 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3748 (match_operand:SF 2 "general_operand" "f,R")))
3749 (clobber (reg:CC 33))]
3750 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3754 [(set_attr "op_type" "RRE,RXE")
3755 (set_attr "type" "fsimps,fsimps")])
3757 (define_insn "*addsf3_cc"
3759 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3760 (match_operand:SF 2 "general_operand" "f,R"))
3761 (match_operand:SF 3 "const0_operand" "")))
3762 (set (match_operand:SF 0 "register_operand" "=f,f")
3763 (plus:SF (match_dup 1) (match_dup 2)))]
3764 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3768 [(set_attr "op_type" "RRE,RXE")
3769 (set_attr "type" "fsimps,fsimps")])
3771 (define_insn "*addsf3_cconly"
3773 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3774 (match_operand:SF 2 "general_operand" "f,R"))
3775 (match_operand:SF 3 "const0_operand" "")))
3776 (clobber (match_scratch:SF 0 "=f,f"))]
3777 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3781 [(set_attr "op_type" "RRE,RXE")
3782 (set_attr "type" "fsimps,fsimps")])
3784 (define_insn "*addsf3"
3785 [(set (match_operand:SF 0 "register_operand" "=f,f")
3786 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3787 (match_operand:SF 2 "general_operand" "f,R")))
3788 (clobber (reg:CC 33))]
3789 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3793 [(set_attr "op_type" "RR,RX")
3794 (set_attr "type" "fsimps,fsimps")])
3798 ;;- Subtract instructions.
3802 ; subdi3 instruction pattern(s).
3805 (define_insn "*subdi3_sign"
3806 [(set (match_operand:DI 0 "register_operand" "=d,d")
3807 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3808 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3809 (clobber (reg:CC 33))]
3814 [(set_attr "op_type" "RRE,RXY")])
3816 (define_insn "*subdi3_zero_cc"
3818 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3819 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3821 (set (match_operand:DI 0 "register_operand" "=d,d")
3822 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3823 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3827 [(set_attr "op_type" "RRE,RXY")])
3829 (define_insn "*subdi3_zero_cconly"
3831 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3832 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3834 (clobber (match_scratch:DI 0 "=d,d"))]
3835 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3839 [(set_attr "op_type" "RRE,RXY")])
3841 (define_insn "*subdi3_zero"
3842 [(set (match_operand:DI 0 "register_operand" "=d,d")
3843 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3844 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3845 (clobber (reg:CC 33))]
3850 [(set_attr "op_type" "RRE,RXY")])
3852 (define_insn "*subdi3_borrow_cc"
3854 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3855 (match_operand:DI 2 "general_operand" "d,m"))
3857 (set (match_operand:DI 0 "register_operand" "=d,d")
3858 (minus:DI (match_dup 1) (match_dup 2)))]
3859 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3863 [(set_attr "op_type" "RRE,RXY")])
3865 (define_insn "*subdi3_borrow_cconly"
3867 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3868 (match_operand:DI 2 "general_operand" "d,m"))
3870 (clobber (match_scratch:DI 0 "=d,d"))]
3871 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3875 [(set_attr "op_type" "RRE,RXY")])
3877 (define_insn "*subdi3_cc"
3879 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3880 (match_operand:DI 2 "general_operand" "d,m"))
3882 (set (match_operand:DI 0 "register_operand" "=d,d")
3883 (minus:DI (match_dup 1) (match_dup 2)))]
3884 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3888 [(set_attr "op_type" "RRE,RXY")])
3890 (define_insn "*subdi3_cconly"
3892 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3893 (match_operand:DI 2 "general_operand" "d,m"))
3895 (clobber (match_scratch:DI 0 "=d,d"))]
3896 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3900 [(set_attr "op_type" "RRE,RXY")])
3902 (define_insn "*subdi3_64"
3903 [(set (match_operand:DI 0 "register_operand" "=d,d")
3904 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3905 (match_operand:DI 2 "general_operand" "d,m") ) )
3906 (clobber (reg:CC 33))]
3911 [(set_attr "op_type" "RRE,RRE")])
3913 (define_insn_and_split "*subdi3_31z"
3914 [(set (match_operand:DI 0 "register_operand" "=&d")
3915 (minus:DI (match_operand:DI 1 "register_operand" "0")
3916 (match_operand:DI 2 "general_operand" "do") ) )
3917 (clobber (reg:CC 33))]
3918 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3920 "&& reload_completed"
3923 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3925 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3927 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3928 (gtu:SI (reg:CCL2 33) (const_int 0))))
3929 (clobber (reg:CC 33))])]
3930 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3931 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3932 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3933 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3934 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3935 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3936 [(set_attr "op_type" "NN")])
3938 (define_insn_and_split "*subdi3_31"
3939 [(set (match_operand:DI 0 "register_operand" "=&d")
3940 (minus:DI (match_operand:DI 1 "register_operand" "0")
3941 (match_operand:DI 2 "general_operand" "do") ) )
3942 (clobber (reg:CC 33))]
3945 "&& reload_completed"
3947 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3948 (clobber (reg:CC 33))])
3951 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3953 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3955 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3957 (label_ref (match_dup 9))))
3959 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3960 (clobber (reg:CC 33))])
3962 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3963 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3964 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3965 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3966 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3967 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3968 operands[9] = gen_label_rtx ();"
3969 [(set_attr "op_type" "NN")])
3971 (define_expand "subdi3"
3973 [(set (match_operand:DI 0 "register_operand" "")
3974 (minus:DI (match_operand:DI 1 "register_operand" "")
3975 (match_operand:DI 2 "general_operand" "")))
3976 (clobber (reg:CC 33))])]
3981 ; subsi3 instruction pattern(s).
3984 (define_insn "*subsi3_borrow_cc"
3986 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3987 (match_operand:SI 2 "general_operand" "d,R,T"))
3989 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3990 (minus:SI (match_dup 1) (match_dup 2)))]
3991 "s390_match_ccmode (insn, CCL2mode)"
3996 [(set_attr "op_type" "RR,RX,RXY")])
3998 (define_insn "*subsi3_borrow_cconly"
4000 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4001 (match_operand:SI 2 "general_operand" "d,R,T"))
4003 (clobber (match_scratch:SI 0 "=d,d,d"))]
4004 "s390_match_ccmode (insn, CCL2mode)"
4009 [(set_attr "op_type" "RR,RX,RXY")])
4011 (define_insn "*subsi3_cc"
4013 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4014 (match_operand:SI 2 "general_operand" "d,R,T"))
4016 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4017 (minus:SI (match_dup 1) (match_dup 2)))]
4018 "s390_match_ccmode (insn, CCLmode)"
4023 [(set_attr "op_type" "RR,RX,RXY")])
4025 (define_insn "*subsi3_cconly"
4027 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4028 (match_operand:SI 2 "general_operand" "d,R,T"))
4030 (clobber (match_scratch:SI 0 "=d,d,d"))]
4031 "s390_match_ccmode (insn, CCLmode)"
4036 [(set_attr "op_type" "RR,RX,RXY")])
4038 (define_insn "*subsi3_sign"
4039 [(set (match_operand:SI 0 "register_operand" "=d,d")
4040 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
4041 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4042 (clobber (reg:CC 33))]
4047 [(set_attr "op_type" "RX,RXY")])
4049 (define_insn "subsi3"
4050 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4051 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4052 (match_operand:SI 2 "general_operand" "d,R,T")))
4053 (clobber (reg:CC 33))]
4059 [(set_attr "op_type" "RR,RX,RXY")])
4063 ; subdf3 instruction pattern(s).
4066 (define_expand "subdf3"
4068 [(set (match_operand:DF 0 "register_operand" "=f,f")
4069 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4070 (match_operand:DF 2 "general_operand" "f,R")))
4071 (clobber (reg:CC 33))])]
4075 (define_insn "*subdf3"
4076 [(set (match_operand:DF 0 "register_operand" "=f,f")
4077 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4078 (match_operand:DF 2 "general_operand" "f,R")))
4079 (clobber (reg:CC 33))]
4080 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4084 [(set_attr "op_type" "RRE,RXE")
4085 (set_attr "type" "fsimpd,fsimpd")])
4087 (define_insn "*subdf3_cc"
4089 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4090 (match_operand:DF 2 "general_operand" "f,R"))
4091 (match_operand:DF 3 "const0_operand" "")))
4092 (set (match_operand:DF 0 "register_operand" "=f,f")
4093 (plus:DF (match_dup 1) (match_dup 2)))]
4094 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4098 [(set_attr "op_type" "RRE,RXE")
4099 (set_attr "type" "fsimpd,fsimpd")])
4101 (define_insn "*subdf3_cconly"
4103 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4104 (match_operand:DF 2 "general_operand" "f,R"))
4105 (match_operand:DF 3 "const0_operand" "")))
4106 (clobber (match_scratch:DF 0 "=f,f"))]
4107 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4111 [(set_attr "op_type" "RRE,RXE")
4112 (set_attr "type" "fsimpd,fsimpd")])
4114 (define_insn "*subdf3_ibm"
4115 [(set (match_operand:DF 0 "register_operand" "=f,f")
4116 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4117 (match_operand:DF 2 "general_operand" "f,R")))
4118 (clobber (reg:CC 33))]
4119 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4123 [(set_attr "op_type" "RR,RX")
4124 (set_attr "type" "fsimpd,fsimpd")])
4127 ; subsf3 instruction pattern(s).
4130 (define_expand "subsf3"
4132 [(set (match_operand:SF 0 "register_operand" "=f,f")
4133 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4134 (match_operand:SF 2 "general_operand" "f,R")))
4135 (clobber (reg:CC 33))])]
4139 (define_insn "*subsf3"
4140 [(set (match_operand:SF 0 "register_operand" "=f,f")
4141 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4142 (match_operand:SF 2 "general_operand" "f,R")))
4143 (clobber (reg:CC 33))]
4144 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4148 [(set_attr "op_type" "RRE,RXE")
4149 (set_attr "type" "fsimps,fsimps")])
4151 (define_insn "*subsf3_cc"
4153 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4154 (match_operand:SF 2 "general_operand" "f,R"))
4155 (match_operand:SF 3 "const0_operand" "")))
4156 (set (match_operand:SF 0 "register_operand" "=f,f")
4157 (minus:SF (match_dup 1) (match_dup 2)))]
4158 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4162 [(set_attr "op_type" "RRE,RXE")
4163 (set_attr "type" "fsimps,fsimps")])
4165 (define_insn "*subsf3_cconly"
4167 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4168 (match_operand:SF 2 "general_operand" "f,R"))
4169 (match_operand:SF 3 "const0_operand" "")))
4170 (clobber (match_scratch:SF 0 "=f,f"))]
4171 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4175 [(set_attr "op_type" "RRE,RXE")
4176 (set_attr "type" "fsimps,fsimps")])
4178 (define_insn "*subsf3_ibm"
4179 [(set (match_operand:SF 0 "register_operand" "=f,f")
4180 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4181 (match_operand:SF 2 "general_operand" "f,R")))
4182 (clobber (reg:CC 33))]
4183 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4187 [(set_attr "op_type" "RR,RX")
4188 (set_attr "type" "fsimps,fsimps")])
4192 ;;- Conditional add/subtract instructions.
4196 ; adddicc instruction pattern(s).
4199 (define_insn "*adddi3_alc_cc"
4202 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4203 (match_operand:DI 2 "general_operand" "d,m"))
4204 (match_operand:DI 3 "s390_alc_comparison" ""))
4206 (set (match_operand:DI 0 "register_operand" "=d,d")
4207 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4208 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4212 [(set_attr "op_type" "RRE,RXY")])
4214 (define_insn "*adddi3_alc"
4215 [(set (match_operand:DI 0 "register_operand" "=d,d")
4216 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4217 (match_operand:DI 2 "general_operand" "d,m"))
4218 (match_operand:DI 3 "s390_alc_comparison" "")))
4219 (clobber (reg:CC 33))]
4224 [(set_attr "op_type" "RRE,RXY")])
4226 (define_insn "*subdi3_slb_cc"
4229 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4230 (match_operand:DI 2 "general_operand" "d,m"))
4231 (match_operand:DI 3 "s390_slb_comparison" ""))
4233 (set (match_operand:DI 0 "register_operand" "=d,d")
4234 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4235 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4239 [(set_attr "op_type" "RRE,RXY")])
4241 (define_insn "*subdi3_slb"
4242 [(set (match_operand:DI 0 "register_operand" "=d,d")
4243 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4244 (match_operand:DI 2 "general_operand" "d,m"))
4245 (match_operand:DI 3 "s390_slb_comparison" "")))
4246 (clobber (reg:CC 33))]
4251 [(set_attr "op_type" "RRE,RXY")])
4254 ; addsicc instruction pattern(s).
4257 (define_insn "*addsi3_alc_cc"
4260 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4261 (match_operand:SI 2 "general_operand" "d,m"))
4262 (match_operand:SI 3 "s390_alc_comparison" ""))
4264 (set (match_operand:SI 0 "register_operand" "=d,d")
4265 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4266 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4270 [(set_attr "op_type" "RRE,RXY")])
4272 (define_insn "*addsi3_alc"
4273 [(set (match_operand:SI 0 "register_operand" "=d,d")
4274 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4275 (match_operand:SI 2 "general_operand" "d,m"))
4276 (match_operand:SI 3 "s390_alc_comparison" "")))
4277 (clobber (reg:CC 33))]
4282 [(set_attr "op_type" "RRE,RXY")])
4284 (define_insn "*subsi3_slb_cc"
4287 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4288 (match_operand:SI 2 "general_operand" "d,m"))
4289 (match_operand:SI 3 "s390_slb_comparison" ""))
4291 (set (match_operand:SI 0 "register_operand" "=d,d")
4292 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4293 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4297 [(set_attr "op_type" "RRE,RXY")])
4299 (define_insn "*subsi3_slb"
4300 [(set (match_operand:SI 0 "register_operand" "=d,d")
4301 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4302 (match_operand:SI 2 "general_operand" "d,m"))
4303 (match_operand:SI 3 "s390_slb_comparison" "")))
4304 (clobber (reg:CC 33))]
4309 [(set_attr "op_type" "RRE,RXY")])
4313 ;;- Multiply instructions.
4317 ; muldi3 instruction pattern(s).
4320 (define_insn "*muldi3_sign"
4321 [(set (match_operand:DI 0 "register_operand" "=d,d")
4322 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4323 (match_operand:DI 1 "register_operand" "0,0")))]
4328 [(set_attr "op_type" "RRE,RXY")
4329 (set_attr "type" "imul")])
4331 (define_insn "muldi3"
4332 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4333 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4334 (match_operand:DI 2 "general_operand" "d,K,m")))]
4340 [(set_attr "op_type" "RRE,RI,RXY")
4341 (set_attr "type" "imul")])
4344 ; mulsi3 instruction pattern(s).
4347 (define_insn "*mulsi3_sign"
4348 [(set (match_operand:SI 0 "register_operand" "=d")
4349 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4350 (match_operand:SI 1 "register_operand" "0")))]
4353 [(set_attr "op_type" "RX")
4354 (set_attr "type" "imul")])
4356 (define_insn "mulsi3"
4357 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4358 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4359 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4366 [(set_attr "op_type" "RRE,RI,RX,RXY")
4367 (set_attr "type" "imul")])
4370 ; mulsidi3 instruction pattern(s).
4373 (define_insn "mulsidi3"
4374 [(set (match_operand:DI 0 "register_operand" "=d,d")
4375 (mult:DI (sign_extend:DI
4376 (match_operand:SI 1 "register_operand" "%0,0"))
4378 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4383 [(set_attr "op_type" "RR,RX")
4384 (set_attr "type" "imul")])
4387 ; umulsidi3 instruction pattern(s).
4390 (define_insn "umulsidi3"
4391 [(set (match_operand:DI 0 "register_operand" "=d,d")
4392 (mult:DI (zero_extend:DI
4393 (match_operand:SI 1 "register_operand" "%0,0"))
4395 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4396 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4400 [(set_attr "op_type" "RRE,RXY")
4401 (set_attr "type" "imul")])
4404 ; muldf3 instruction pattern(s).
4407 (define_expand "muldf3"
4408 [(set (match_operand:DF 0 "register_operand" "=f,f")
4409 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4410 (match_operand:DF 2 "general_operand" "f,R")))]
4414 (define_insn "*muldf3"
4415 [(set (match_operand:DF 0 "register_operand" "=f,f")
4416 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4417 (match_operand:DF 2 "general_operand" "f,R")))]
4418 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4422 [(set_attr "op_type" "RRE,RXE")
4423 (set_attr "type" "fmuld")])
4425 (define_insn "*muldf3_ibm"
4426 [(set (match_operand:DF 0 "register_operand" "=f,f")
4427 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4428 (match_operand:DF 2 "general_operand" "f,R")))]
4429 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4433 [(set_attr "op_type" "RR,RX")
4434 (set_attr "type" "fmuld")])
4436 (define_insn "*fmadddf"
4437 [(set (match_operand:DF 0 "register_operand" "=f,f")
4438 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4439 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4440 (match_operand:DF 3 "register_operand" "0,0")))]
4441 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4445 [(set_attr "op_type" "RRE,RXE")
4446 (set_attr "type" "fmuld")])
4448 (define_insn "*fmsubdf"
4449 [(set (match_operand:DF 0 "register_operand" "=f,f")
4450 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4451 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4452 (match_operand:DF 3 "register_operand" "0,0")))]
4453 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4457 [(set_attr "op_type" "RRE,RXE")
4458 (set_attr "type" "fmuld")])
4461 ; mulsf3 instruction pattern(s).
4464 (define_expand "mulsf3"
4465 [(set (match_operand:SF 0 "register_operand" "=f,f")
4466 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4467 (match_operand:SF 2 "general_operand" "f,R")))]
4471 (define_insn "*mulsf3"
4472 [(set (match_operand:SF 0 "register_operand" "=f,f")
4473 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4474 (match_operand:SF 2 "general_operand" "f,R")))]
4475 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4479 [(set_attr "op_type" "RRE,RXE")
4480 (set_attr "type" "fmuls")])
4482 (define_insn "*mulsf3_ibm"
4483 [(set (match_operand:SF 0 "register_operand" "=f,f")
4484 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4485 (match_operand:SF 2 "general_operand" "f,R")))]
4486 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4490 [(set_attr "op_type" "RR,RX")
4491 (set_attr "type" "fmuls")])
4493 (define_insn "*fmaddsf"
4494 [(set (match_operand:SF 0 "register_operand" "=f,f")
4495 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4496 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4497 (match_operand:SF 3 "register_operand" "0,0")))]
4498 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4502 [(set_attr "op_type" "RRE,RXE")
4503 (set_attr "type" "fmuls")])
4505 (define_insn "*fmsubsf"
4506 [(set (match_operand:SF 0 "register_operand" "=f,f")
4507 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4508 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4509 (match_operand:SF 3 "register_operand" "0,0")))]
4510 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4514 [(set_attr "op_type" "RRE,RXE")
4515 (set_attr "type" "fmuls")])
4518 ;;- Divide and modulo instructions.
4522 ; divmoddi4 instruction pattern(s).
4525 (define_expand "divmoddi4"
4526 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4527 (div:DI (match_operand:DI 1 "register_operand" "")
4528 (match_operand:DI 2 "general_operand" "")))
4529 (set (match_operand:DI 3 "general_operand" "")
4530 (mod:DI (match_dup 1) (match_dup 2)))])
4531 (clobber (match_dup 4))]
4534 rtx insn, div_equal, mod_equal;
4536 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4537 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4539 operands[4] = gen_reg_rtx(TImode);
4540 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4542 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4544 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4546 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4548 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4553 (define_insn "divmodtidi3"
4554 [(set (match_operand:TI 0 "register_operand" "=d,d")
4557 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4558 (match_operand:DI 2 "general_operand" "d,m")))
4561 (mod:DI (match_dup 1)
4568 [(set_attr "op_type" "RRE,RXY")
4569 (set_attr "type" "idiv")])
4571 (define_insn "divmodtisi3"
4572 [(set (match_operand:TI 0 "register_operand" "=d,d")
4575 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4576 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4579 (mod:DI (match_dup 1)
4580 (sign_extend:DI (match_dup 2))))
4586 [(set_attr "op_type" "RRE,RXY")
4587 (set_attr "type" "idiv")])
4590 ; udivmoddi4 instruction pattern(s).
4593 (define_expand "udivmoddi4"
4594 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4595 (udiv:DI (match_operand:DI 1 "general_operand" "")
4596 (match_operand:DI 2 "nonimmediate_operand" "")))
4597 (set (match_operand:DI 3 "general_operand" "")
4598 (umod:DI (match_dup 1) (match_dup 2)))])
4599 (clobber (match_dup 4))]
4602 rtx insn, div_equal, mod_equal, equal;
4604 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4605 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4606 equal = gen_rtx_IOR (TImode,
4607 gen_rtx_ZERO_EXTEND (TImode, div_equal),
4608 gen_rtx_ASHIFT (TImode,
4609 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4612 operands[4] = gen_reg_rtx(TImode);
4613 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4614 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4615 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4616 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4618 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4620 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4622 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4624 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4626 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4631 (define_insn "udivmodtidi3"
4632 [(set (match_operand:TI 0 "register_operand" "=d,d")
4633 (ior:TI (zero_extend:TI
4635 (udiv:TI (match_operand:TI 1 "register_operand" "0,0")
4637 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4641 (umod:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))
4647 [(set_attr "op_type" "RRE,RXY")
4648 (set_attr "type" "idiv")])
4651 ; divmodsi4 instruction pattern(s).
4654 (define_expand "divmodsi4"
4655 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4656 (div:SI (match_operand:SI 1 "general_operand" "")
4657 (match_operand:SI 2 "nonimmediate_operand" "")))
4658 (set (match_operand:SI 3 "general_operand" "")
4659 (mod:SI (match_dup 1) (match_dup 2)))])
4660 (clobber (match_dup 4))]
4663 rtx insn, div_equal, mod_equal, equal;
4665 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4666 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4667 equal = gen_rtx_IOR (DImode,
4668 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4669 gen_rtx_ASHIFT (DImode,
4670 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4673 operands[4] = gen_reg_rtx(DImode);
4674 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4675 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4677 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4679 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4681 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4683 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4685 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4690 (define_insn "divmoddisi3"
4691 [(set (match_operand:DI 0 "register_operand" "=d,d")
4692 (ior:DI (zero_extend:DI
4694 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4696 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4700 (mod:DI (match_dup 1) (sign_extend:SI (match_dup 2)))))
4706 [(set_attr "op_type" "RR,RX")
4707 (set_attr "type" "idiv")])
4710 ; udivsi3 and umodsi3 instruction pattern(s).
4713 (define_expand "udivmodsi4"
4714 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4715 (udiv:SI (match_operand:SI 1 "general_operand" "")
4716 (match_operand:SI 2 "nonimmediate_operand" "")))
4717 (set (match_operand:SI 3 "general_operand" "")
4718 (umod:SI (match_dup 1) (match_dup 2)))])
4719 (clobber (match_dup 4))]
4720 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4722 rtx insn, div_equal, mod_equal, equal;
4724 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4725 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4726 equal = gen_rtx_IOR (DImode,
4727 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4728 gen_rtx_ASHIFT (DImode,
4729 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4732 operands[4] = gen_reg_rtx(DImode);
4733 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4734 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4735 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4736 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4738 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4740 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4742 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4744 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4746 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4751 (define_insn "udivmoddisi3"
4752 [(set (match_operand:DI 0 "register_operand" "=d,d")
4753 (ior:DI (zero_extend:DI
4755 (udiv:DI (match_operand:DI 1 "register_operand" "0,0")
4757 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4761 (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))
4763 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4767 [(set_attr "op_type" "RRE,RXY")
4768 (set_attr "type" "idiv")])
4770 (define_expand "udivsi3"
4771 [(set (match_operand:SI 0 "register_operand" "=d")
4772 (udiv:SI (match_operand:SI 1 "general_operand" "")
4773 (match_operand:SI 2 "general_operand" "")))
4774 (clobber (match_dup 3))]
4775 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4777 rtx insn, udiv_equal, umod_equal, equal;
4779 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4780 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4781 equal = gen_rtx_IOR (DImode,
4782 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4783 gen_rtx_ASHIFT (DImode,
4784 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4787 operands[3] = gen_reg_rtx (DImode);
4789 if (CONSTANT_P (operands[2]))
4791 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4793 rtx label1 = gen_label_rtx ();
4795 operands[1] = make_safe_from (operands[1], operands[0]);
4796 emit_move_insn (operands[0], const0_rtx);
4797 emit_insn (gen_cmpsi (operands[1], operands[2]));
4798 emit_jump_insn (gen_bltu (label1));
4799 emit_move_insn (operands[0], const1_rtx);
4800 emit_label (label1);
4804 operands[2] = force_reg (SImode, operands[2]);
4805 operands[2] = make_safe_from (operands[2], operands[0]);
4807 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4808 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4811 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4813 insn = emit_move_insn (operands[0],
4814 gen_lowpart (SImode, operands[3]));
4816 gen_rtx_EXPR_LIST (REG_EQUAL,
4817 udiv_equal, REG_NOTES (insn));
4822 rtx label1 = gen_label_rtx ();
4823 rtx label2 = gen_label_rtx ();
4824 rtx label3 = gen_label_rtx ();
4826 operands[1] = force_reg (SImode, operands[1]);
4827 operands[1] = make_safe_from (operands[1], operands[0]);
4828 operands[2] = force_reg (SImode, operands[2]);
4829 operands[2] = make_safe_from (operands[2], operands[0]);
4831 emit_move_insn (operands[0], const0_rtx);
4832 emit_insn (gen_cmpsi (operands[2], operands[1]));
4833 emit_jump_insn (gen_bgtu (label3));
4834 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4835 emit_jump_insn (gen_blt (label2));
4836 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4837 emit_jump_insn (gen_beq (label1));
4838 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4839 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4842 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4844 insn = emit_move_insn (operands[0],
4845 gen_lowpart (SImode, operands[3]));
4847 gen_rtx_EXPR_LIST (REG_EQUAL,
4848 udiv_equal, REG_NOTES (insn));
4850 emit_label (label1);
4851 emit_move_insn (operands[0], operands[1]);
4853 emit_label (label2);
4854 emit_move_insn (operands[0], const1_rtx);
4855 emit_label (label3);
4857 emit_move_insn (operands[0], operands[0]);
4861 (define_expand "umodsi3"
4862 [(set (match_operand:SI 0 "register_operand" "=d")
4863 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4864 (match_operand:SI 2 "nonimmediate_operand" "")))
4865 (clobber (match_dup 3))]
4866 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4868 rtx insn, udiv_equal, umod_equal, equal;
4870 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4871 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4872 equal = gen_rtx_IOR (DImode,
4873 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4874 gen_rtx_ASHIFT (DImode,
4875 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4878 operands[3] = gen_reg_rtx (DImode);
4880 if (CONSTANT_P (operands[2]))
4882 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4884 rtx label1 = gen_label_rtx ();
4886 operands[1] = make_safe_from (operands[1], operands[0]);
4887 emit_move_insn (operands[0], operands[1]);
4888 emit_insn (gen_cmpsi (operands[0], operands[2]));
4889 emit_jump_insn (gen_bltu (label1));
4890 emit_insn (gen_abssi2 (operands[0], operands[2]));
4891 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4892 emit_label (label1);
4896 operands[2] = force_reg (SImode, operands[2]);
4897 operands[2] = make_safe_from (operands[2], operands[0]);
4899 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4900 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4903 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4905 insn = emit_move_insn (operands[0],
4906 gen_highpart (SImode, operands[3]));
4908 gen_rtx_EXPR_LIST (REG_EQUAL,
4909 umod_equal, REG_NOTES (insn));
4914 rtx label1 = gen_label_rtx ();
4915 rtx label2 = gen_label_rtx ();
4916 rtx label3 = gen_label_rtx ();
4918 operands[1] = force_reg (SImode, operands[1]);
4919 operands[1] = make_safe_from (operands[1], operands[0]);
4920 operands[2] = force_reg (SImode, operands[2]);
4921 operands[2] = make_safe_from (operands[2], operands[0]);
4923 emit_move_insn(operands[0], operands[1]);
4924 emit_insn (gen_cmpsi (operands[2], operands[1]));
4925 emit_jump_insn (gen_bgtu (label3));
4926 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4927 emit_jump_insn (gen_blt (label2));
4928 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4929 emit_jump_insn (gen_beq (label1));
4930 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4931 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4934 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4936 insn = emit_move_insn (operands[0],
4937 gen_highpart (SImode, operands[3]));
4939 gen_rtx_EXPR_LIST (REG_EQUAL,
4940 umod_equal, REG_NOTES (insn));
4942 emit_label (label1);
4943 emit_move_insn (operands[0], const0_rtx);
4945 emit_label (label2);
4946 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4947 emit_label (label3);
4953 ; divdf3 instruction pattern(s).
4956 (define_expand "divdf3"
4957 [(set (match_operand:DF 0 "register_operand" "=f,f")
4958 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4959 (match_operand:DF 2 "general_operand" "f,R")))]
4963 (define_insn "*divdf3"
4964 [(set (match_operand:DF 0 "register_operand" "=f,f")
4965 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4966 (match_operand:DF 2 "general_operand" "f,R")))]
4967 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4971 [(set_attr "op_type" "RRE,RXE")
4972 (set_attr "type" "fdivd")])
4974 (define_insn "*divdf3_ibm"
4975 [(set (match_operand:DF 0 "register_operand" "=f,f")
4976 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4977 (match_operand:DF 2 "general_operand" "f,R")))]
4978 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4982 [(set_attr "op_type" "RR,RX")
4983 (set_attr "type" "fdivd")])
4986 ; divsf3 instruction pattern(s).
4989 (define_expand "divsf3"
4990 [(set (match_operand:SF 0 "register_operand" "=f,f")
4991 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4992 (match_operand:SF 2 "general_operand" "f,R")))]
4996 (define_insn "*divsf3"
4997 [(set (match_operand:SF 0 "register_operand" "=f,f")
4998 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4999 (match_operand:SF 2 "general_operand" "f,R")))]
5000 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5004 [(set_attr "op_type" "RRE,RXE")
5005 (set_attr "type" "fdivs")])
5007 (define_insn "*divsf3"
5008 [(set (match_operand:SF 0 "register_operand" "=f,f")
5009 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5010 (match_operand:SF 2 "general_operand" "f,R")))]
5011 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5015 [(set_attr "op_type" "RR,RX")
5016 (set_attr "type" "fdivs")])
5020 ;;- And instructions.
5024 ; anddi3 instruction pattern(s).
5027 (define_insn "*anddi3_cc"
5029 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5030 (match_operand:DI 2 "general_operand" "d,m"))
5032 (set (match_operand:DI 0 "register_operand" "=d,d")
5033 (and:DI (match_dup 1) (match_dup 2)))]
5034 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5038 [(set_attr "op_type" "RRE,RXY")])
5040 (define_insn "*anddi3_cconly"
5042 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5043 (match_operand:DI 2 "general_operand" "d,m"))
5045 (clobber (match_scratch:DI 0 "=d,d"))]
5046 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5050 [(set_attr "op_type" "RRE,RXY")])
5052 (define_insn "anddi3"
5053 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d,d,d")
5054 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o,0,0,0,0,0,0")
5055 (match_operand:DI 2 "general_operand"
5056 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m")))
5057 (clobber (reg:CC 33))]
5068 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY")])
5070 (define_insn "*anddi3_ss"
5071 [(set (match_operand:DI 0 "s_operand" "=Q")
5072 (and:DI (match_dup 0)
5073 (match_operand:DI 1 "s_imm_operand" "Q")))
5074 (clobber (reg:CC 33))]
5077 [(set_attr "op_type" "SS")])
5079 (define_insn "*anddi3_ss_inv"
5080 [(set (match_operand:DI 0 "s_operand" "=Q")
5081 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5083 (clobber (reg:CC 33))]
5086 [(set_attr "op_type" "SS")])
5089 ; andsi3 instruction pattern(s).
5092 (define_insn "*andsi3_cc"
5094 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5095 (match_operand:SI 2 "general_operand" "d,R,T"))
5097 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5098 (and:SI (match_dup 1) (match_dup 2)))]
5099 "s390_match_ccmode(insn, CCTmode)"
5104 [(set_attr "op_type" "RR,RX,RXY")])
5106 (define_insn "*andsi3_cconly"
5108 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5109 (match_operand:SI 2 "general_operand" "d,R,T"))
5111 (clobber (match_scratch:SI 0 "=d,d,d"))]
5112 "s390_match_ccmode(insn, CCTmode)"
5117 [(set_attr "op_type" "RR,RX,RXY")])
5119 (define_expand "andsi3"
5121 [(set (match_operand:SI 0 "register_operand" "")
5122 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
5123 (match_operand:SI 2 "general_operand" "")))
5124 (clobber (reg:CC 33))])]
5128 (define_insn "*andsi3_zarch"
5129 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d,d,d")
5130 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,o,0,0,0,0,0")
5131 (match_operand:SI 2 "general_operand" "M,M,N0HSF,N1HSF,d,R,T")))
5132 (clobber (reg:CC 33))]
5142 [(set_attr "op_type" "RRE,RXE,RI,RI,RR,RX,RXY")])
5144 (define_insn "*andsi3_esa"
5145 [(set (match_operand:SI 0 "register_operand" "=d,d")
5146 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5147 (match_operand:SI 2 "general_operand" "d,R")))
5148 (clobber (reg:CC 33))]
5153 [(set_attr "op_type" "RR,RX")])
5155 (define_insn "*andsi3_ss"
5156 [(set (match_operand:SI 0 "s_operand" "=Q")
5157 (and:SI (match_dup 0)
5158 (match_operand:SI 1 "s_imm_operand" "Q")))
5159 (clobber (reg:CC 33))]
5162 [(set_attr "op_type" "SS")])
5164 (define_insn "*andsi3_ss_inv"
5165 [(set (match_operand:SI 0 "s_operand" "=Q")
5166 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5168 (clobber (reg:CC 33))]
5171 [(set_attr "op_type" "SS")])
5174 ; andhi3 instruction pattern(s).
5177 (define_insn "*andhi3_ni"
5178 [(set (match_operand:HI 0 "register_operand" "=d,d")
5179 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5180 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5181 (clobber (reg:CC 33))]
5186 [(set_attr "op_type" "RR,RI")])
5188 (define_insn "andhi3"
5189 [(set (match_operand:HI 0 "register_operand" "=d")
5190 (and:HI (match_operand:HI 1 "register_operand" "%0")
5191 (match_operand:HI 2 "nonmemory_operand" "d")))
5192 (clobber (reg:CC 33))]
5195 [(set_attr "op_type" "RR")])
5197 (define_insn "*andhi3_ss"
5198 [(set (match_operand:HI 0 "s_operand" "=Q")
5199 (and:HI (match_dup 0)
5200 (match_operand:HI 1 "s_imm_operand" "Q")))
5201 (clobber (reg:CC 33))]
5204 [(set_attr "op_type" "SS")])
5206 (define_insn "*andhi3_ss_inv"
5207 [(set (match_operand:HI 0 "s_operand" "=Q")
5208 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5210 (clobber (reg:CC 33))]
5213 [(set_attr "op_type" "SS")])
5216 ; andqi3 instruction pattern(s).
5219 (define_insn "*andqi3_ni"
5220 [(set (match_operand:QI 0 "register_operand" "=d,d")
5221 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5222 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5223 (clobber (reg:CC 33))]
5228 [(set_attr "op_type" "RR,RI")])
5230 (define_insn "andqi3"
5231 [(set (match_operand:QI 0 "register_operand" "=d")
5232 (and:QI (match_operand:QI 1 "register_operand" "%0")
5233 (match_operand:QI 2 "nonmemory_operand" "d")))
5234 (clobber (reg:CC 33))]
5237 [(set_attr "op_type" "RR")])
5239 (define_insn "*andqi3_ss"
5240 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5241 (and:QI (match_dup 0)
5242 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5243 (clobber (reg:CC 33))]
5249 [(set_attr "op_type" "SI,SIY,SS")])
5251 (define_insn "*andqi3_ss_inv"
5252 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5253 (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5255 (clobber (reg:CC 33))]
5261 [(set_attr "op_type" "SI,SIY,SS")])
5265 ;;- Bit set (inclusive or) instructions.
5269 ; iordi3 instruction pattern(s).
5272 (define_insn "*iordi3_cc"
5274 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5275 (match_operand:DI 2 "general_operand" "d,m"))
5277 (set (match_operand:DI 0 "register_operand" "=d,d")
5278 (ior:DI (match_dup 1) (match_dup 2)))]
5279 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5283 [(set_attr "op_type" "RRE,RXY")])
5285 (define_insn "*iordi3_cconly"
5287 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5288 (match_operand:DI 2 "general_operand" "d,m"))
5290 (clobber (match_scratch:DI 0 "=d,d"))]
5291 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5295 [(set_attr "op_type" "RRE,RXY")])
5297 (define_insn "iordi3"
5298 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d")
5299 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,0,0,0,0")
5300 (match_operand:DI 2 "general_operand" "N0HD0,N1HD0,N2HD0,N3HD0,d,m")))
5301 (clobber (reg:CC 33))]
5310 [(set_attr "op_type" "RI,RI,RI,RI,RRE,RXY")])
5312 (define_insn "*iordi3_ss"
5313 [(set (match_operand:DI 0 "s_operand" "=Q")
5314 (ior:DI (match_dup 0)
5315 (match_operand:DI 1 "s_imm_operand" "Q")))
5316 (clobber (reg:CC 33))]
5319 [(set_attr "op_type" "SS")])
5321 (define_insn "*iordi3_ss_inv"
5322 [(set (match_operand:DI 0 "s_operand" "=Q")
5323 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5325 (clobber (reg:CC 33))]
5328 [(set_attr "op_type" "SS")])
5331 ; iorsi3 instruction pattern(s).
5334 (define_insn "*iorsi3_cc"
5336 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5337 (match_operand:SI 2 "general_operand" "d,R,T"))
5339 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5340 (ior:SI (match_dup 1) (match_dup 2)))]
5341 "s390_match_ccmode(insn, CCTmode)"
5346 [(set_attr "op_type" "RR,RX,RXY")])
5348 (define_insn "*iorsi3_cconly"
5350 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5351 (match_operand:SI 2 "general_operand" "d,R,T"))
5353 (clobber (match_scratch:SI 0 "=d,d,d"))]
5354 "s390_match_ccmode(insn, CCTmode)"
5359 [(set_attr "op_type" "RR,RX,RXY")])
5361 (define_expand "iorsi3"
5363 [(set (match_operand:SI 0 "register_operand" "")
5364 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
5365 (match_operand:SI 2 "general_operand" "")))
5366 (clobber (reg:CC 33))])]
5370 (define_insn "iorsi3_zarch"
5371 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
5372 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0,0")
5373 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,d,R,T")))
5374 (clobber (reg:CC 33))]
5382 [(set_attr "op_type" "RI,RI,RR,RX,RXY")])
5384 (define_insn "iorsi3_esa"
5385 [(set (match_operand:SI 0 "register_operand" "=d,d")
5386 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
5387 (match_operand:SI 2 "general_operand" "d,R")))
5388 (clobber (reg:CC 33))]
5393 [(set_attr "op_type" "RR,RX")])
5395 (define_insn "*iorsi3_ss"
5396 [(set (match_operand:SI 0 "s_operand" "=Q")
5397 (ior:SI (match_dup 0)
5398 (match_operand:SI 1 "s_imm_operand" "Q")))
5399 (clobber (reg:CC 33))]
5402 [(set_attr "op_type" "SS")])
5404 (define_insn "*iorsi3_ss_inv"
5405 [(set (match_operand:SI 0 "s_operand" "=Q")
5406 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5408 (clobber (reg:CC 33))]
5411 [(set_attr "op_type" "SS")])
5414 ; iorhi3 instruction pattern(s).
5417 (define_insn "*iorhi3_oi"
5418 [(set (match_operand:HI 0 "register_operand" "=d,d")
5419 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5420 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5421 (clobber (reg:CC 33))]
5426 [(set_attr "op_type" "RR,RI")])
5428 (define_insn "iorhi3"
5429 [(set (match_operand:HI 0 "register_operand" "=d")
5430 (ior:HI (match_operand:HI 1 "register_operand" "%0")
5431 (match_operand:HI 2 "nonmemory_operand" "d")))
5432 (clobber (reg:CC 33))]
5435 [(set_attr "op_type" "RR")])
5437 (define_insn "*iorhi3_ss"
5438 [(set (match_operand:HI 0 "s_operand" "=Q")
5439 (ior:HI (match_dup 0)
5440 (match_operand:HI 1 "s_imm_operand" "Q")))
5441 (clobber (reg:CC 33))]
5444 [(set_attr "op_type" "SS")])
5446 (define_insn "*iorhi3_ss_inv"
5447 [(set (match_operand:HI 0 "s_operand" "=Q")
5448 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5450 (clobber (reg:CC 33))]
5453 [(set_attr "op_type" "SS")])
5456 ; iorqi3 instruction pattern(s).
5459 (define_insn "*iorqi3_oi"
5460 [(set (match_operand:QI 0 "register_operand" "=d,d")
5461 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5462 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5463 (clobber (reg:CC 33))]
5468 [(set_attr "op_type" "RR,RI")])
5470 (define_insn "iorqi3"
5471 [(set (match_operand:QI 0 "register_operand" "=d")
5472 (ior:QI (match_operand:QI 1 "register_operand" "%0")
5473 (match_operand:QI 2 "nonmemory_operand" "d")))
5474 (clobber (reg:CC 33))]
5477 [(set_attr "op_type" "RR")])
5479 (define_insn "*iorqi3_ss"
5480 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5481 (ior:QI (match_dup 0)
5482 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5483 (clobber (reg:CC 33))]
5489 [(set_attr "op_type" "SI,SIY,SS")])
5491 (define_insn "*iorqi3_ss_inv"
5492 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5493 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5495 (clobber (reg:CC 33))]
5501 [(set_attr "op_type" "SI,SIY,SS")])
5505 ;;- Xor instructions.
5509 ; xordi3 instruction pattern(s).
5512 (define_insn "*xordi3_cc"
5514 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5515 (match_operand:DI 2 "general_operand" "d,m"))
5517 (set (match_operand:DI 0 "register_operand" "=d,d")
5518 (xor:DI (match_dup 1) (match_dup 2)))]
5519 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5523 [(set_attr "op_type" "RRE,RXY")])
5525 (define_insn "*xordi3_cconly"
5527 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5528 (match_operand:DI 2 "general_operand" "d,m"))
5530 (clobber (match_scratch:DI 0 "=d,d"))]
5531 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5535 [(set_attr "op_type" "RRE,RXY")])
5537 (define_insn "xordi3"
5538 [(set (match_operand:DI 0 "register_operand" "=d,d")
5539 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5540 (match_operand:DI 2 "general_operand" "d,m")))
5541 (clobber (reg:CC 33))]
5546 [(set_attr "op_type" "RRE,RXY")])
5548 (define_insn "*xordi3_ss"
5549 [(set (match_operand:DI 0 "s_operand" "=Q")
5550 (xor:DI (match_dup 0)
5551 (match_operand:DI 1 "s_imm_operand" "Q")))
5552 (clobber (reg:CC 33))]
5555 [(set_attr "op_type" "SS")])
5557 (define_insn "*xordi3_ss_inv"
5558 [(set (match_operand:DI 0 "s_operand" "=Q")
5559 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5561 (clobber (reg:CC 33))]
5564 [(set_attr "op_type" "SS")])
5567 ; xorsi3 instruction pattern(s).
5570 (define_insn "*xorsi3_cc"
5572 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5573 (match_operand:SI 2 "general_operand" "d,R,T"))
5575 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5576 (xor:SI (match_dup 1) (match_dup 2)))]
5577 "s390_match_ccmode(insn, CCTmode)"
5582 [(set_attr "op_type" "RR,RX,RXY")])
5584 (define_insn "*xorsi3_cconly"
5586 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5587 (match_operand:SI 2 "general_operand" "d,R,T"))
5589 (clobber (match_scratch:SI 0 "=d,d,d"))]
5590 "s390_match_ccmode(insn, CCTmode)"
5595 [(set_attr "op_type" "RR,RX,RXY")])
5597 (define_insn "xorsi3"
5598 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5599 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5600 (match_operand:SI 2 "general_operand" "d,R,T")))
5601 (clobber (reg:CC 33))]
5607 [(set_attr "op_type" "RR,RX,RXY")])
5609 (define_insn "*xorsi3_ss"
5610 [(set (match_operand:SI 0 "s_operand" "=Q")
5611 (xor:SI (match_dup 0)
5612 (match_operand:SI 1 "s_imm_operand" "Q")))
5613 (clobber (reg:CC 33))]
5616 [(set_attr "op_type" "SS")])
5618 (define_insn "*xorsi3_ss_inv"
5619 [(set (match_operand:SI 0 "s_operand" "=Q")
5620 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5622 (clobber (reg:CC 33))]
5625 [(set_attr "op_type" "SS")])
5628 ; xorhi3 instruction pattern(s).
5631 (define_insn "xorhi3"
5632 [(set (match_operand:HI 0 "register_operand" "=d")
5633 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5634 (match_operand:HI 2 "nonmemory_operand" "d")))
5635 (clobber (reg:CC 33))]
5638 [(set_attr "op_type" "RR")])
5640 (define_insn "*xorhi3_ss"
5641 [(set (match_operand:HI 0 "s_operand" "=Q")
5642 (xor:HI (match_dup 0)
5643 (match_operand:HI 1 "s_imm_operand" "Q")))
5644 (clobber (reg:CC 33))]
5647 [(set_attr "op_type" "SS")])
5649 (define_insn "*xorhi3_ss_inv"
5650 [(set (match_operand:HI 0 "s_operand" "=Q")
5651 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5653 (clobber (reg:CC 33))]
5656 [(set_attr "op_type" "SS")])
5659 ; xorqi3 instruction pattern(s).
5662 (define_insn "xorqi3"
5663 [(set (match_operand:QI 0 "register_operand" "=d")
5664 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5665 (match_operand:QI 2 "nonmemory_operand" "d")))
5666 (clobber (reg:CC 33))]
5669 [(set_attr "op_type" "RR")])
5671 (define_insn "*xorqi3_ss"
5672 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5673 (xor:QI (match_dup 0)
5674 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5675 (clobber (reg:CC 33))]
5681 [(set_attr "op_type" "SI,SIY,SS")])
5683 (define_insn "*xorqi3_ss_inv"
5684 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5685 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5687 (clobber (reg:CC 33))]
5693 [(set_attr "op_type" "SI,SIY,SS")])
5697 ;;- Negate instructions.
5701 ; negdi2 instruction pattern(s).
5704 (define_expand "negdi2"
5706 [(set (match_operand:DI 0 "register_operand" "=d")
5707 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5708 (clobber (reg:CC 33))])]
5712 (define_insn "*negdi2_64"
5713 [(set (match_operand:DI 0 "register_operand" "=d")
5714 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5715 (clobber (reg:CC 33))]
5718 [(set_attr "op_type" "RR")])
5720 (define_insn "*negdi2_31"
5721 [(set (match_operand:DI 0 "register_operand" "=d")
5722 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5723 (clobber (reg:CC 33))]
5727 xop[0] = gen_label_rtx ();
5728 output_asm_insn ("lcr\t%0,%1", operands);
5729 output_asm_insn ("lcr\t%N0,%N1", operands);
5730 output_asm_insn ("je\t%l0", xop);
5731 output_asm_insn ("bctr\t%0,0", operands);
5732 targetm.asm_out.internal_label (asm_out_file, "L",
5733 CODE_LABEL_NUMBER (xop[0]));
5736 [(set_attr "op_type" "NN")
5737 (set_attr "type" "other")
5738 (set_attr "length" "10")])
5741 ; negsi2 instruction pattern(s).
5744 (define_insn "negsi2"
5745 [(set (match_operand:SI 0 "register_operand" "=d")
5746 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5747 (clobber (reg:CC 33))]
5750 [(set_attr "op_type" "RR")])
5753 ; negdf2 instruction pattern(s).
5756 (define_expand "negdf2"
5758 [(set (match_operand:DF 0 "register_operand" "=f")
5759 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5760 (clobber (reg:CC 33))])]
5764 (define_insn "*negdf2"
5765 [(set (match_operand:DF 0 "register_operand" "=f")
5766 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5767 (clobber (reg:CC 33))]
5768 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5770 [(set_attr "op_type" "RRE")
5771 (set_attr "type" "fsimpd")])
5773 (define_insn "*negdf2_ibm"
5774 [(set (match_operand:DF 0 "register_operand" "=f")
5775 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5776 (clobber (reg:CC 33))]
5777 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5779 [(set_attr "op_type" "RR")
5780 (set_attr "type" "fsimpd")])
5783 ; negsf2 instruction pattern(s).
5786 (define_expand "negsf2"
5788 [(set (match_operand:SF 0 "register_operand" "=f")
5789 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5790 (clobber (reg:CC 33))])]
5794 (define_insn "*negsf2"
5795 [(set (match_operand:SF 0 "register_operand" "=f")
5796 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5797 (clobber (reg:CC 33))]
5798 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5800 [(set_attr "op_type" "RRE")
5801 (set_attr "type" "fsimps")])
5803 (define_insn "*negsf2"
5804 [(set (match_operand:SF 0 "register_operand" "=f")
5805 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5806 (clobber (reg:CC 33))]
5807 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5809 [(set_attr "op_type" "RR")
5810 (set_attr "type" "fsimps")])
5814 ;;- Absolute value instructions.
5818 ; absdi2 instruction pattern(s).
5821 (define_insn "absdi2"
5822 [(set (match_operand:DI 0 "register_operand" "=d")
5823 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5824 (clobber (reg:CC 33))]
5827 [(set_attr "op_type" "RRE")])
5830 ; abssi2 instruction pattern(s).
5833 (define_insn "abssi2"
5834 [(set (match_operand:SI 0 "register_operand" "=d")
5835 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5836 (clobber (reg:CC 33))]
5839 [(set_attr "op_type" "RR")])
5842 ; absdf2 instruction pattern(s).
5845 (define_expand "absdf2"
5847 [(set (match_operand:DF 0 "register_operand" "=f")
5848 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5849 (clobber (reg:CC 33))])]
5853 (define_insn "*absdf2"
5854 [(set (match_operand:DF 0 "register_operand" "=f")
5855 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5856 (clobber (reg:CC 33))]
5857 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5859 [(set_attr "op_type" "RRE")
5860 (set_attr "type" "fsimpd")])
5862 (define_insn "*absdf2_ibm"
5863 [(set (match_operand:DF 0 "register_operand" "=f")
5864 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5865 (clobber (reg:CC 33))]
5866 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5868 [(set_attr "op_type" "RR")
5869 (set_attr "type" "fsimpd")])
5872 ; abssf2 instruction pattern(s).
5875 (define_expand "abssf2"
5877 [(set (match_operand:SF 0 "register_operand" "=f")
5878 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5879 (clobber (reg:CC 33))])]
5883 (define_insn "*abssf2"
5884 [(set (match_operand:SF 0 "register_operand" "=f")
5885 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5886 (clobber (reg:CC 33))]
5887 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5889 [(set_attr "op_type" "RRE")
5890 (set_attr "type" "fsimps")])
5892 (define_insn "*abssf2_ibm"
5893 [(set (match_operand:SF 0 "register_operand" "=f")
5894 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5895 (clobber (reg:CC 33))]
5896 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5898 [(set_attr "op_type" "RR")
5899 (set_attr "type" "fsimps")])
5902 ;;- Negated absolute value instructions
5909 (define_insn "*negabssi2"
5910 [(set (match_operand:SI 0 "register_operand" "=d")
5911 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
5912 (clobber (reg:CC 33))]
5915 [(set_attr "op_type" "RR")])
5917 (define_insn "*negabsdi2"
5918 [(set (match_operand:DI 0 "register_operand" "=d")
5919 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
5920 (clobber (reg:CC 33))]
5923 [(set_attr "op_type" "RRE")])
5929 (define_insn "*negabssf2"
5930 [(set (match_operand:SF 0 "register_operand" "=f")
5931 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5932 (clobber (reg:CC 33))]
5933 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5935 [(set_attr "op_type" "RRE")
5936 (set_attr "type" "fsimps")])
5938 (define_insn "*negabsdf2"
5939 [(set (match_operand:DF 0 "register_operand" "=f")
5940 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5941 (clobber (reg:CC 33))]
5942 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5944 [(set_attr "op_type" "RRE")
5945 (set_attr "type" "fsimpd")])
5948 ;;- Square root instructions.
5952 ; sqrtdf2 instruction pattern(s).
5955 (define_insn "sqrtdf2"
5956 [(set (match_operand:DF 0 "register_operand" "=f,f")
5957 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
5958 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5962 [(set_attr "op_type" "RRE,RXE")])
5965 ; sqrtsf2 instruction pattern(s).
5968 (define_insn "sqrtsf2"
5969 [(set (match_operand:SF 0 "register_operand" "=f,f")
5970 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
5971 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5975 [(set_attr "op_type" "RRE,RXE")])
5978 ;;- One complement instructions.
5982 ; one_cmpldi2 instruction pattern(s).
5985 (define_expand "one_cmpldi2"
5987 [(set (match_operand:DI 0 "register_operand" "")
5988 (xor:DI (match_operand:DI 1 "register_operand" "")
5990 (clobber (reg:CC 33))])]
5995 ; one_cmplsi2 instruction pattern(s).
5998 (define_expand "one_cmplsi2"
6000 [(set (match_operand:SI 0 "register_operand" "")
6001 (xor:SI (match_operand:SI 1 "register_operand" "")
6003 (clobber (reg:CC 33))])]
6008 ; one_cmplhi2 instruction pattern(s).
6011 (define_expand "one_cmplhi2"
6013 [(set (match_operand:HI 0 "register_operand" "")
6014 (xor:HI (match_operand:HI 1 "register_operand" "")
6016 (clobber (reg:CC 33))])]
6021 ; one_cmplqi2 instruction pattern(s).
6024 (define_expand "one_cmplqi2"
6026 [(set (match_operand:QI 0 "register_operand" "")
6027 (xor:QI (match_operand:QI 1 "register_operand" "")
6029 (clobber (reg:CC 33))])]
6035 ;;- Rotate instructions.
6039 ; rotldi3 instruction pattern(s).
6042 (define_insn "rotldi3"
6043 [(set (match_operand:DI 0 "register_operand" "=d")
6044 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6045 (match_operand:SI 2 "shift_count_operand" "Y")))]
6048 [(set_attr "op_type" "RSE")
6049 (set_attr "atype" "reg")])
6052 ; rotlsi3 instruction pattern(s).
6055 (define_insn "rotlsi3"
6056 [(set (match_operand:SI 0 "register_operand" "=d")
6057 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6058 (match_operand:SI 2 "shift_count_operand" "Y")))]
6061 [(set_attr "op_type" "RSE")
6062 (set_attr "atype" "reg")])
6066 ;;- Arithmetic shift instructions.
6070 ; ashldi3 instruction pattern(s).
6073 (define_expand "ashldi3"
6074 [(set (match_operand:DI 0 "register_operand" "")
6075 (ashift:DI (match_operand:DI 1 "register_operand" "")
6076 (match_operand:SI 2 "shift_count_operand" "")))]
6080 (define_insn "*ashldi3_31"
6081 [(set (match_operand:DI 0 "register_operand" "=d")
6082 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6083 (match_operand:SI 2 "shift_count_operand" "Y")))]
6086 [(set_attr "op_type" "RS")
6087 (set_attr "atype" "reg")])
6089 (define_insn "*ashldi3_64"
6090 [(set (match_operand:DI 0 "register_operand" "=d")
6091 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6092 (match_operand:SI 2 "shift_count_operand" "Y")))]
6095 [(set_attr "op_type" "RSE")
6096 (set_attr "atype" "reg")])
6099 ; ashrdi3 instruction pattern(s).
6102 (define_expand "ashrdi3"
6104 [(set (match_operand:DI 0 "register_operand" "")
6105 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6106 (match_operand:SI 2 "shift_count_operand" "")))
6107 (clobber (reg:CC 33))])]
6111 (define_insn "*ashrdi3_cc_31"
6113 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6114 (match_operand:SI 2 "shift_count_operand" "Y"))
6116 (set (match_operand:DI 0 "register_operand" "=d")
6117 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6118 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6120 [(set_attr "op_type" "RS")
6121 (set_attr "atype" "reg")])
6123 (define_insn "*ashrdi3_cconly_31"
6125 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6126 (match_operand:SI 2 "shift_count_operand" "Y"))
6128 (clobber (match_scratch:DI 0 "=d"))]
6129 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6131 [(set_attr "op_type" "RS")
6132 (set_attr "atype" "reg")])
6134 (define_insn "*ashrdi3_31"
6135 [(set (match_operand:DI 0 "register_operand" "=d")
6136 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6137 (match_operand:SI 2 "shift_count_operand" "Y")))
6138 (clobber (reg:CC 33))]
6141 [(set_attr "op_type" "RS")
6142 (set_attr "atype" "reg")])
6144 (define_insn "*ashrdi3_cc_64"
6146 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6147 (match_operand:SI 2 "shift_count_operand" "Y"))
6149 (set (match_operand:DI 0 "register_operand" "=d")
6150 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6151 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6153 [(set_attr "op_type" "RSE")
6154 (set_attr "atype" "reg")])
6156 (define_insn "*ashrdi3_cconly_64"
6158 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6159 (match_operand:SI 2 "shift_count_operand" "Y"))
6161 (clobber (match_scratch:DI 0 "=d"))]
6162 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6164 [(set_attr "op_type" "RSE")
6165 (set_attr "atype" "reg")])
6167 (define_insn "*ashrdi3_64"
6168 [(set (match_operand:DI 0 "register_operand" "=d")
6169 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6170 (match_operand:SI 2 "shift_count_operand" "Y")))
6171 (clobber (reg:CC 33))]
6174 [(set_attr "op_type" "RSE")
6175 (set_attr "atype" "reg")])
6179 ; ashlsi3 instruction pattern(s).
6182 (define_insn "ashlsi3"
6183 [(set (match_operand:SI 0 "register_operand" "=d")
6184 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6185 (match_operand:SI 2 "shift_count_operand" "Y")))]
6188 [(set_attr "op_type" "RS")
6189 (set_attr "atype" "reg")])
6192 ; ashrsi3 instruction pattern(s).
6195 (define_insn "*ashrsi3_cc"
6197 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6198 (match_operand:SI 2 "shift_count_operand" "Y"))
6200 (set (match_operand:SI 0 "register_operand" "=d")
6201 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6202 "s390_match_ccmode(insn, CCSmode)"
6204 [(set_attr "op_type" "RS")
6205 (set_attr "atype" "reg")])
6208 (define_insn "*ashrsi3_cconly"
6210 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6211 (match_operand:SI 2 "shift_count_operand" "Y"))
6213 (clobber (match_scratch:SI 0 "=d"))]
6214 "s390_match_ccmode(insn, CCSmode)"
6216 [(set_attr "op_type" "RS")
6217 (set_attr "atype" "reg")])
6219 (define_insn "ashrsi3"
6220 [(set (match_operand:SI 0 "register_operand" "=d")
6221 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6222 (match_operand:SI 2 "shift_count_operand" "Y")))
6223 (clobber (reg:CC 33))]
6226 [(set_attr "op_type" "RS")
6227 (set_attr "atype" "reg")])
6231 ;;- logical shift instructions.
6235 ; lshrdi3 instruction pattern(s).
6238 (define_expand "lshrdi3"
6239 [(set (match_operand:DI 0 "register_operand" "")
6240 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6241 (match_operand:SI 2 "shift_count_operand" "")))]
6245 (define_insn "*lshrdi3_31"
6246 [(set (match_operand:DI 0 "register_operand" "=d")
6247 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6248 (match_operand:SI 2 "shift_count_operand" "Y")))]
6251 [(set_attr "op_type" "RS")
6252 (set_attr "atype" "reg")])
6254 (define_insn "*lshrdi3_64"
6255 [(set (match_operand:DI 0 "register_operand" "=d")
6256 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6257 (match_operand:SI 2 "shift_count_operand" "Y")))]
6260 [(set_attr "op_type" "RSE")
6261 (set_attr "atype" "reg")])
6264 ; lshrsi3 instruction pattern(s).
6267 (define_insn "lshrsi3"
6268 [(set (match_operand:SI 0 "register_operand" "=d")
6269 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6270 (match_operand:SI 2 "shift_count_operand" "Y")))]
6273 [(set_attr "op_type" "RS")
6274 (set_attr "atype" "reg")])
6278 ;; Branch instruction patterns.
6281 (define_expand "beq"
6282 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6284 (if_then_else (eq (reg:CCZ 33) (const_int 0))
6285 (label_ref (match_operand 0 "" ""))
6288 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6290 (define_expand "bne"
6291 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6293 (if_then_else (ne (reg:CCZ 33) (const_int 0))
6294 (label_ref (match_operand 0 "" ""))
6297 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6299 (define_expand "bgt"
6300 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6302 (if_then_else (gt (reg:CCS 33) (const_int 0))
6303 (label_ref (match_operand 0 "" ""))
6306 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6308 (define_expand "bgtu"
6309 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6311 (if_then_else (gtu (reg:CCU 33) (const_int 0))
6312 (label_ref (match_operand 0 "" ""))
6315 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6317 (define_expand "blt"
6318 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6320 (if_then_else (lt (reg:CCS 33) (const_int 0))
6321 (label_ref (match_operand 0 "" ""))
6324 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6326 (define_expand "bltu"
6327 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6329 (if_then_else (ltu (reg:CCU 33) (const_int 0))
6330 (label_ref (match_operand 0 "" ""))
6333 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6335 (define_expand "bge"
6336 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6338 (if_then_else (ge (reg:CCS 33) (const_int 0))
6339 (label_ref (match_operand 0 "" ""))
6342 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6344 (define_expand "bgeu"
6345 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6347 (if_then_else (geu (reg:CCU 33) (const_int 0))
6348 (label_ref (match_operand 0 "" ""))
6351 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6353 (define_expand "ble"
6354 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6356 (if_then_else (le (reg:CCS 33) (const_int 0))
6357 (label_ref (match_operand 0 "" ""))
6360 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6362 (define_expand "bleu"
6363 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6365 (if_then_else (leu (reg:CCU 33) (const_int 0))
6366 (label_ref (match_operand 0 "" ""))
6369 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6371 (define_expand "bunordered"
6372 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6374 (if_then_else (unordered (reg:CCS 33) (const_int 0))
6375 (label_ref (match_operand 0 "" ""))
6378 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6380 (define_expand "bordered"
6381 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6383 (if_then_else (ordered (reg:CCS 33) (const_int 0))
6384 (label_ref (match_operand 0 "" ""))
6387 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6389 (define_expand "buneq"
6390 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6392 (if_then_else (uneq (reg:CCS 33) (const_int 0))
6393 (label_ref (match_operand 0 "" ""))
6396 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6398 (define_expand "bungt"
6399 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6401 (if_then_else (ungt (reg:CCS 33) (const_int 0))
6402 (label_ref (match_operand 0 "" ""))
6405 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6407 (define_expand "bunlt"
6408 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6410 (if_then_else (unlt (reg:CCS 33) (const_int 0))
6411 (label_ref (match_operand 0 "" ""))
6414 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6416 (define_expand "bunge"
6417 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6419 (if_then_else (unge (reg:CCS 33) (const_int 0))
6420 (label_ref (match_operand 0 "" ""))
6423 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6425 (define_expand "bunle"
6426 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6428 (if_then_else (unle (reg:CCS 33) (const_int 0))
6429 (label_ref (match_operand 0 "" ""))
6432 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6434 (define_expand "bltgt"
6435 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6437 (if_then_else (ltgt (reg:CCS 33) (const_int 0))
6438 (label_ref (match_operand 0 "" ""))
6441 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6445 ;;- Conditional jump instructions.
6448 (define_insn "cjump"
6451 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6452 (label_ref (match_operand 0 "" ""))
6456 if (get_attr_length (insn) == 4)
6458 else if (TARGET_CPU_ZARCH)
6459 return "jg%C1\t%l0";
6463 [(set_attr "op_type" "RI")
6464 (set_attr "type" "branch")
6465 (set (attr "length")
6466 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6468 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6470 (eq (symbol_ref "flag_pic") (const_int 0))
6471 (const_int 6)] (const_int 8)))])
6473 (define_insn "*cjump_long"
6476 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6477 (match_operand 0 "address_operand" "U")
6481 if (get_attr_op_type (insn) == OP_TYPE_RR)
6486 [(set (attr "op_type")
6487 (if_then_else (match_operand 0 "register_operand" "")
6488 (const_string "RR") (const_string "RX")))
6489 (set_attr "type" "branch")
6490 (set_attr "atype" "agen")])
6494 ;;- Negated conditional jump instructions.
6497 (define_insn "icjump"
6500 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6502 (label_ref (match_operand 0 "" ""))))]
6505 if (get_attr_length (insn) == 4)
6507 else if (TARGET_CPU_ZARCH)
6508 return "jg%D1\t%l0";
6512 [(set_attr "op_type" "RI")
6513 (set_attr "type" "branch")
6514 (set (attr "length")
6515 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6517 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6519 (eq (symbol_ref "flag_pic") (const_int 0))
6520 (const_int 6)] (const_int 8)))])
6522 (define_insn "*icjump_long"
6525 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6527 (match_operand 0 "address_operand" "U")))]
6530 if (get_attr_op_type (insn) == OP_TYPE_RR)
6535 [(set (attr "op_type")
6536 (if_then_else (match_operand 0 "register_operand" "")
6537 (const_string "RR") (const_string "RX")))
6538 (set_attr "type" "branch")
6539 (set_attr "atype" "agen")])
6542 ;;- Trap instructions.
6546 [(trap_if (const_int 1) (const_int 0))]
6549 [(set_attr "op_type" "RX")
6550 (set_attr "type" "branch")])
6552 (define_expand "conditional_trap"
6553 [(set (match_dup 2) (match_dup 3))
6554 (trap_if (match_operator 0 "comparison_operator"
6555 [(match_dup 2) (const_int 0)])
6556 (match_operand:SI 1 "general_operand" ""))]
6559 enum machine_mode ccmode;
6561 if (operands[1] != const0_rtx) FAIL;
6563 ccmode = s390_select_ccmode (GET_CODE (operands[0]),
6564 s390_compare_op0, s390_compare_op1);
6565 operands[2] = gen_rtx_REG (ccmode, 33);
6566 operands[3] = gen_rtx_COMPARE (ccmode, s390_compare_op0, s390_compare_op1);
6569 (define_insn "*trap"
6570 [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6574 [(set_attr "op_type" "RI")
6575 (set_attr "type" "branch")])
6578 ;;- Loop instructions.
6580 ;; This is all complicated by the fact that since this is a jump insn
6581 ;; we must handle our own output reloads.
6583 (define_expand "doloop_end"
6584 [(use (match_operand 0 "" "")) ; loop pseudo
6585 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6586 (use (match_operand 2 "" "")) ; max iterations
6587 (use (match_operand 3 "" "")) ; loop level
6588 (use (match_operand 4 "" ""))] ; label
6591 if (GET_MODE (operands[0]) == SImode)
6592 emit_jump_insn (gen_doloop_si (operands[4], operands[0], operands[0]));
6593 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6594 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6601 (define_insn "doloop_si"
6604 (ne (match_operand:SI 1 "register_operand" "d,d")
6606 (label_ref (match_operand 0 "" ""))
6608 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6609 (plus:SI (match_dup 1) (const_int -1)))
6610 (clobber (match_scratch:SI 3 "=X,&d"))
6611 (clobber (reg:CC 33))]
6614 if (which_alternative != 0)
6616 else if (get_attr_length (insn) == 4)
6617 return "brct\t%1,%l0";
6618 else if (TARGET_CPU_ZARCH)
6619 return "ahi\t%1,-1\;jgne\t%l0";
6623 [(set_attr "op_type" "RI")
6624 (set_attr "type" "branch")
6625 (set (attr "length")
6626 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6628 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6630 (eq (symbol_ref "flag_pic") (const_int 0))
6631 (const_int 6)] (const_int 8)))])
6633 (define_insn "*doloop_si_long"
6636 (ne (match_operand:SI 1 "register_operand" "d,d")
6638 (match_operand 0 "address_operand" "U,U")
6640 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6641 (plus:SI (match_dup 1) (const_int -1)))
6642 (clobber (match_scratch:SI 3 "=X,&d"))
6643 (clobber (reg:CC 33))]
6646 if (get_attr_op_type (insn) == OP_TYPE_RR)
6647 return "bctr\t%1,%0";
6649 return "bct\t%1,%a0";
6651 [(set (attr "op_type")
6652 (if_then_else (match_operand 0 "register_operand" "")
6653 (const_string "RR") (const_string "RX")))
6654 (set_attr "type" "branch")
6655 (set_attr "atype" "agen")])
6659 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
6661 (match_operand 0 "" "")
6663 (set (match_operand:SI 2 "nonimmediate_operand" "")
6664 (plus:SI (match_dup 1) (const_int -1)))
6665 (clobber (match_scratch:SI 3 ""))
6666 (clobber (reg:CC 33))]
6668 && (! REG_P (operands[2])
6669 || ! rtx_equal_p (operands[1], operands[2]))"
6670 [(set (match_dup 3) (match_dup 1))
6671 (parallel [(set (reg:CCAN 33)
6672 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6674 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6675 (set (match_dup 2) (match_dup 3))
6676 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6681 (define_insn "doloop_di"
6684 (ne (match_operand:DI 1 "register_operand" "d,d")
6686 (label_ref (match_operand 0 "" ""))
6688 (set (match_operand:DI 2 "register_operand" "=1,?*m*r")
6689 (plus:DI (match_dup 1) (const_int -1)))
6690 (clobber (match_scratch:DI 3 "=X,&d"))
6691 (clobber (reg:CC 33))]
6694 if (which_alternative != 0)
6696 else if (get_attr_length (insn) == 4)
6697 return "brctg\t%1,%l0";
6699 return "aghi\t%1,-1\;jgne\t%l0";
6701 [(set_attr "op_type" "RI")
6702 (set_attr "type" "branch")
6703 (set (attr "length")
6704 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6705 (const_int 4) (const_int 10)))])
6709 (if_then_else (ne (match_operand:DI 1 "register_operand" "")
6711 (match_operand 0 "" "")
6713 (set (match_operand:DI 2 "nonimmediate_operand" "")
6714 (plus:DI (match_dup 1) (const_int -1)))
6715 (clobber (match_scratch:DI 3 ""))
6716 (clobber (reg:CC 33))]
6718 && (! REG_P (operands[2])
6719 || ! rtx_equal_p (operands[1], operands[2]))"
6720 [(set (match_dup 3) (match_dup 1))
6721 (parallel [(set (reg:CCAN 33)
6722 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6724 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6725 (set (match_dup 2) (match_dup 3))
6726 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6732 ;;- Unconditional jump instructions.
6736 ; jump instruction pattern(s).
6740 [(set (pc) (label_ref (match_operand 0 "" "")))]
6743 if (get_attr_length (insn) == 4)
6745 else if (TARGET_CPU_ZARCH)
6750 [(set_attr "op_type" "RI")
6751 (set_attr "type" "branch")
6752 (set (attr "length")
6753 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6755 (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6757 (eq (symbol_ref "flag_pic") (const_int 0))
6758 (const_int 6)] (const_int 8)))])
6761 ; indirect-jump instruction pattern(s).
6764 (define_insn "indirect_jump"
6765 [(set (pc) (match_operand 0 "address_operand" "U"))]
6768 if (get_attr_op_type (insn) == OP_TYPE_RR)
6773 [(set (attr "op_type")
6774 (if_then_else (match_operand 0 "register_operand" "")
6775 (const_string "RR") (const_string "RX")))
6776 (set_attr "type" "branch")
6777 (set_attr "atype" "agen")])
6780 ; casesi instruction pattern(s).
6783 (define_insn "casesi_jump"
6784 [(set (pc) (match_operand 0 "address_operand" "U"))
6785 (use (label_ref (match_operand 1 "" "")))]
6788 if (get_attr_op_type (insn) == OP_TYPE_RR)
6793 [(set (attr "op_type")
6794 (if_then_else (match_operand 0 "register_operand" "")
6795 (const_string "RR") (const_string "RX")))
6796 (set_attr "type" "branch")
6797 (set_attr "atype" "agen")])
6799 (define_expand "casesi"
6800 [(match_operand:SI 0 "general_operand" "")
6801 (match_operand:SI 1 "general_operand" "")
6802 (match_operand:SI 2 "general_operand" "")
6803 (label_ref (match_operand 3 "" ""))
6804 (label_ref (match_operand 4 "" ""))]
6807 rtx index = gen_reg_rtx (SImode);
6808 rtx base = gen_reg_rtx (Pmode);
6809 rtx target = gen_reg_rtx (Pmode);
6811 emit_move_insn (index, operands[0]);
6812 emit_insn (gen_subsi3 (index, index, operands[1]));
6813 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6816 if (Pmode != SImode)
6817 index = convert_to_mode (Pmode, index, 1);
6818 if (GET_CODE (index) != REG)
6819 index = copy_to_mode_reg (Pmode, index);
6822 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6824 emit_insn (gen_ashlsi3 (index, index, GEN_INT (2)));
6826 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6828 index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
6829 emit_move_insn (target, index);
6832 target = gen_rtx_PLUS (Pmode, base, target);
6833 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6840 ;;- Jump to subroutine.
6845 ; untyped call instruction pattern(s).
6848 ;; Call subroutine returning any type.
6849 (define_expand "untyped_call"
6850 [(parallel [(call (match_operand 0 "" "")
6852 (match_operand 1 "" "")
6853 (match_operand 2 "" "")])]
6858 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6860 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6862 rtx set = XVECEXP (operands[2], 0, i);
6863 emit_move_insn (SET_DEST (set), SET_SRC (set));
6866 /* The optimizer does not know that the call sets the function value
6867 registers we stored in the result block. We avoid problems by
6868 claiming that all hard registers are used and clobbered at this
6870 emit_insn (gen_blockage ());
6875 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6876 ;; all of memory. This blocks insns from being moved across this point.
6878 (define_insn "blockage"
6879 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6882 [(set_attr "type" "none")
6883 (set_attr "length" "0")])
6888 ; call instruction pattern(s).
6891 (define_expand "call"
6892 [(call (match_operand 0 "" "")
6893 (match_operand 1 "" ""))
6894 (use (match_operand 2 "" ""))]
6897 bool plt_call = false;
6900 /* Direct function calls need special treatment. */
6901 if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
6903 rtx sym = XEXP (operands[0], 0);
6905 /* When calling a global routine in PIC mode, we must
6906 replace the symbol itself with the PLT stub. */
6907 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
6909 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
6910 sym = gen_rtx_CONST (Pmode, sym);
6914 /* Unless we can use the bras(l) insn, force the
6915 routine address into a register. */
6916 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
6919 sym = legitimize_pic_address (sym, 0);
6921 sym = force_reg (Pmode, sym);
6924 operands[0] = gen_rtx_MEM (QImode, sym);
6928 insn = emit_call_insn (gen_call_exp (operands[0], operands[1],
6929 gen_rtx_REG (Pmode, RETURN_REGNUM)));
6931 /* 31-bit PLT stubs use the GOT register implicitly. */
6932 if (!TARGET_64BIT && plt_call)
6933 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
6938 (define_expand "call_exp"
6939 [(parallel [(call (match_operand 0 "" "")
6940 (match_operand 1 "" ""))
6941 (clobber (match_operand 2 "" ""))])]
6945 (define_insn "*bras"
6946 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6947 (match_operand 1 "const_int_operand" "n"))
6948 (clobber (match_operand 2 "register_operand" "=r"))]
6949 "TARGET_SMALL_EXEC && GET_MODE (operands[2]) == Pmode"
6951 [(set_attr "op_type" "RI")
6952 (set_attr "type" "jsr")])
6954 (define_insn "*brasl"
6955 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6956 (match_operand 1 "const_int_operand" "n"))
6957 (clobber (match_operand 2 "register_operand" "=r"))]
6958 "TARGET_CPU_ZARCH && GET_MODE (operands[2]) == Pmode"
6960 [(set_attr "op_type" "RIL")
6961 (set_attr "type" "jsr")])
6963 (define_insn "*basr"
6964 [(call (mem:QI (match_operand 0 "address_operand" "U"))
6965 (match_operand 1 "const_int_operand" "n"))
6966 (clobber (match_operand 2 "register_operand" "=r"))]
6967 "GET_MODE (operands[2]) == Pmode"
6969 if (get_attr_op_type (insn) == OP_TYPE_RR)
6970 return "basr\t%2,%0";
6972 return "bas\t%2,%a0";
6974 [(set (attr "op_type")
6975 (if_then_else (match_operand 0 "register_operand" "")
6976 (const_string "RR") (const_string "RX")))
6977 (set_attr "type" "jsr")
6978 (set_attr "atype" "agen")])
6981 ; call_value instruction pattern(s).
6984 (define_expand "call_value"
6985 [(set (match_operand 0 "" "")
6986 (call (match_operand 1 "" "")
6987 (match_operand 2 "" "")))
6988 (use (match_operand 3 "" ""))]
6991 bool plt_call = false;
6994 /* Direct function calls need special treatment. */
6995 if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
6997 rtx sym = XEXP (operands[1], 0);
6999 /* When calling a global routine in PIC mode, we must
7000 replace the symbol itself with the PLT stub. */
7001 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
7003 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7004 sym = gen_rtx_CONST (Pmode, sym);
7008 /* Unless we can use the bras(l) insn, force the
7009 routine address into a register. */
7010 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7013 sym = legitimize_pic_address (sym, 0);
7015 sym = force_reg (Pmode, sym);
7018 operands[1] = gen_rtx_MEM (QImode, sym);
7022 insn = emit_call_insn (
7023 gen_call_value_exp (operands[0], operands[1], operands[2],
7024 gen_rtx_REG (Pmode, RETURN_REGNUM)));
7026 /* 31-bit PLT stubs use the GOT register implicitly. */
7027 if (!TARGET_64BIT && plt_call)
7028 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7033 (define_expand "call_value_exp"
7034 [(parallel [(set (match_operand 0 "" "")
7035 (call (match_operand 1 "" "")
7036 (match_operand 2 "" "")))
7037 (clobber (match_operand 3 "" ""))])]
7041 (define_insn "*bras_r"
7042 [(set (match_operand 0 "" "")
7043 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7044 (match_operand:SI 2 "const_int_operand" "n")))
7045 (clobber (match_operand 3 "register_operand" "=r"))]
7046 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7048 [(set_attr "op_type" "RI")
7049 (set_attr "type" "jsr")])
7051 (define_insn "*brasl_r"
7052 [(set (match_operand 0 "" "")
7053 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7054 (match_operand 2 "const_int_operand" "n")))
7055 (clobber (match_operand 3 "register_operand" "=r"))]
7056 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7058 [(set_attr "op_type" "RIL")
7059 (set_attr "type" "jsr")])
7061 (define_insn "*basr_r"
7062 [(set (match_operand 0 "" "")
7063 (call (mem:QI (match_operand 1 "address_operand" "U"))
7064 (match_operand 2 "const_int_operand" "n")))
7065 (clobber (match_operand 3 "register_operand" "=r"))]
7066 "GET_MODE (operands[3]) == Pmode"
7068 if (get_attr_op_type (insn) == OP_TYPE_RR)
7069 return "basr\t%3,%1";
7071 return "bas\t%3,%a1";
7073 [(set (attr "op_type")
7074 (if_then_else (match_operand 1 "register_operand" "")
7075 (const_string "RR") (const_string "RX")))
7076 (set_attr "type" "jsr")
7077 (set_attr "atype" "agen")])
7080 ;;- Thread-local storage support.
7083 (define_insn "get_tp_64"
7084 [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7085 (unspec:DI [(const_int 0)] UNSPEC_TP))]
7088 ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7090 [(set_attr "op_type" "NN,RS")
7091 (set_attr "atype" "reg,*")
7092 (set_attr "type" "o3,*")
7093 (set_attr "length" "14,*")])
7095 (define_insn "get_tp_31"
7096 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7097 (unspec:SI [(const_int 0)] UNSPEC_TP))]
7102 [(set_attr "op_type" "RRE,RS")])
7104 (define_insn "set_tp_64"
7105 [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7106 (clobber (match_scratch:SI 1 "=d,X"))]
7109 sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7111 [(set_attr "op_type" "NN,RS")
7112 (set_attr "atype" "reg,*")
7113 (set_attr "type" "o3,*")
7114 (set_attr "length" "14,*")])
7116 (define_insn "set_tp_31"
7117 [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7122 [(set_attr "op_type" "RRE,RS")])
7124 (define_insn "*tls_load_64"
7125 [(set (match_operand:DI 0 "register_operand" "=d")
7126 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7127 (match_operand:DI 2 "" "")]
7131 [(set_attr "op_type" "RXE")])
7133 (define_insn "*tls_load_31"
7134 [(set (match_operand:SI 0 "register_operand" "=d,d")
7135 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7136 (match_operand:SI 2 "" "")]
7142 [(set_attr "op_type" "RX,RXY")])
7144 (define_expand "call_value_tls"
7145 [(set (match_operand 0 "" "")
7146 (call (const_int 0) (const_int 0)))
7147 (use (match_operand 1 "" ""))]
7155 sym = s390_tls_get_offset ();
7156 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7157 sym = gen_rtx_CONST (Pmode, sym);
7159 /* Unless we can use the bras(l) insn, force the
7160 routine address into a register. */
7161 if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7164 sym = legitimize_pic_address (sym, 0);
7166 sym = force_reg (Pmode, sym);
7169 sym = gen_rtx_MEM (QImode, sym);
7172 insn = emit_call_insn (
7173 gen_call_value_tls_exp (operands[0], sym, const0_rtx,
7174 gen_rtx_REG (Pmode, RETURN_REGNUM),
7177 /* The calling convention of __tls_get_offset uses the
7178 GOT register implicitly. */
7179 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7180 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), operands[0]);
7181 CONST_OR_PURE_CALL_P (insn) = 1;
7186 (define_expand "call_value_tls_exp"
7187 [(parallel [(set (match_operand 0 "" "")
7188 (call (match_operand 1 "" "")
7189 (match_operand 2 "" "")))
7190 (clobber (match_operand 3 "" ""))
7191 (use (match_operand 4 "" ""))])]
7195 (define_insn "*bras_tls"
7196 [(set (match_operand 0 "" "")
7197 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7198 (match_operand 2 "const_int_operand" "n")))
7199 (clobber (match_operand 3 "register_operand" "=r"))
7200 (use (match_operand 4 "" ""))]
7201 "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7203 [(set_attr "op_type" "RI")
7204 (set_attr "type" "jsr")])
7206 (define_insn "*brasl_tls"
7207 [(set (match_operand 0 "" "")
7208 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7209 (match_operand 2 "const_int_operand" "n")))
7210 (clobber (match_operand 3 "register_operand" "=r"))
7211 (use (match_operand 4 "" ""))]
7212 "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7214 [(set_attr "op_type" "RIL")
7215 (set_attr "type" "jsr")])
7217 (define_insn "*basr_tls"
7218 [(set (match_operand 0 "" "")
7219 (call (mem:QI (match_operand 1 "address_operand" "U"))
7220 (match_operand 2 "const_int_operand" "n")))
7221 (clobber (match_operand 3 "register_operand" "=r"))
7222 (use (match_operand 4 "" ""))]
7223 "GET_MODE (operands[3]) == Pmode"
7225 if (get_attr_op_type (insn) == OP_TYPE_RR)
7226 return "basr\t%3,%1%J4";
7228 return "bas\t%3,%a1%J4";
7230 [(set (attr "op_type")
7231 (if_then_else (match_operand 1 "register_operand" "")
7232 (const_string "RR") (const_string "RX")))
7233 (set_attr "type" "jsr")
7234 (set_attr "atype" "agen")])
7237 ;;- Miscellaneous instructions.
7241 ; allocate stack instruction pattern(s).
7244 (define_expand "allocate_stack"
7246 (plus (reg 15) (match_operand 1 "general_operand" "")))
7247 (set (match_operand 0 "general_operand" "")
7251 rtx stack = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
7252 rtx chain = gen_rtx (MEM, Pmode, stack);
7253 rtx temp = gen_reg_rtx (Pmode);
7255 emit_move_insn (temp, chain);
7258 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7260 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7262 emit_move_insn (chain, temp);
7264 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7270 ; setjmp instruction pattern.
7273 (define_expand "builtin_setjmp_receiver"
7274 [(match_operand 0 "" "")]
7277 s390_load_got (false);
7278 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7282 ;; These patterns say how to save and restore the stack pointer. We need not
7283 ;; save the stack pointer at function level since we are careful to
7284 ;; preserve the backchain. At block level, we have to restore the backchain
7285 ;; when we restore the stack pointer.
7287 ;; For nonlocal gotos, we must save both the stack pointer and its
7288 ;; backchain and restore both. Note that in the nonlocal case, the
7289 ;; save area is a memory location.
7291 (define_expand "save_stack_function"
7292 [(match_operand 0 "general_operand" "")
7293 (match_operand 1 "general_operand" "")]
7297 (define_expand "restore_stack_function"
7298 [(match_operand 0 "general_operand" "")
7299 (match_operand 1 "general_operand" "")]
7303 (define_expand "restore_stack_block"
7304 [(use (match_operand 0 "register_operand" ""))
7305 (set (match_dup 2) (match_dup 3))
7306 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7307 (set (match_dup 3) (match_dup 2))]
7310 operands[2] = gen_reg_rtx (Pmode);
7311 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7314 (define_expand "save_stack_nonlocal"
7315 [(match_operand 0 "memory_operand" "")
7316 (match_operand 1 "register_operand" "")]
7319 rtx temp = gen_reg_rtx (Pmode);
7321 /* Copy the backchain to the first word, sp to the second and the literal pool
7322 base to the third. */
7323 emit_move_insn (operand_subword (operands[0], 2, 0,
7324 TARGET_64BIT ? OImode : TImode),
7325 gen_rtx_REG (Pmode, BASE_REGISTER));
7326 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7327 emit_move_insn (operand_subword (operands[0], 0, 0,
7328 TARGET_64BIT ? OImode : TImode),
7330 emit_move_insn (operand_subword (operands[0], 1, 0,
7331 TARGET_64BIT ? OImode : TImode),
7336 (define_expand "restore_stack_nonlocal"
7337 [(match_operand 0 "register_operand" "")
7338 (match_operand 1 "memory_operand" "")]
7341 rtx temp = gen_reg_rtx (Pmode);
7342 rtx base = gen_rtx_REG (Pmode, BASE_REGISTER);
7344 /* Restore the backchain from the first word, sp from the second and the
7345 literal pool base from the third. */
7346 emit_move_insn (temp,
7347 operand_subword (operands[1], 0, 0,
7348 TARGET_64BIT ? OImode : TImode));
7349 emit_move_insn (operands[0],
7350 operand_subword (operands[1], 1, 0,
7351 TARGET_64BIT ? OImode : TImode));
7352 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7353 emit_move_insn (base,
7354 operand_subword (operands[1], 2, 0,
7355 TARGET_64BIT ? OImode : TImode));
7356 emit_insn (gen_rtx_USE (VOIDmode, base));
7363 ; nop instruction pattern(s).
7370 [(set_attr "op_type" "RR")])
7374 ; Special literal pool access instruction pattern(s).
7377 (define_insn "*pool_entry"
7378 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7379 UNSPECV_POOL_ENTRY)]
7382 enum machine_mode mode = GET_MODE (PATTERN (insn));
7383 unsigned int align = GET_MODE_BITSIZE (mode);
7384 s390_output_pool_entry (asm_out_file, operands[0], mode, align);
7387 [(set_attr "op_type" "NN")
7388 (set (attr "length")
7389 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7391 (define_insn "pool_start_31"
7392 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7395 [(set_attr "op_type" "NN")
7396 (set_attr "length" "2")])
7398 (define_insn "pool_end_31"
7399 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7402 [(set_attr "op_type" "NN")
7403 (set_attr "length" "2")])
7405 (define_insn "pool_start_64"
7406 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7408 ".section\t.rodata\;.align\t8"
7409 [(set_attr "op_type" "NN")
7410 (set_attr "length" "0")])
7412 (define_insn "pool_end_64"
7413 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7416 [(set_attr "op_type" "NN")
7417 (set_attr "length" "0")])
7419 (define_insn "main_base_31_small"
7420 [(set (match_operand 0 "register_operand" "=a")
7421 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7422 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7424 [(set_attr "op_type" "RR")
7425 (set_attr "type" "la")])
7427 (define_insn "main_base_31_large"
7428 [(set (match_operand 0 "register_operand" "=a")
7429 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7430 (set (pc) (label_ref (match_operand 2 "" "")))]
7431 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7433 [(set_attr "op_type" "RI")])
7435 (define_insn "main_base_64"
7436 [(set (match_operand 0 "register_operand" "=a")
7437 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7438 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7440 [(set_attr "op_type" "RIL")
7441 (set_attr "type" "larl")])
7443 (define_insn "main_pool"
7444 [(unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL)]
7447 [(set_attr "op_type" "NN")])
7449 (define_insn "reload_base_31"
7450 [(set (match_operand 0 "register_operand" "=a")
7451 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7452 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7453 "basr\t%0,0\;la\t%0,%1-.(%0)"
7454 [(set_attr "op_type" "NN")
7455 (set_attr "type" "la")
7456 (set_attr "length" "6")])
7458 (define_insn "reload_base_64"
7459 [(set (match_operand 0 "register_operand" "=a")
7460 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7461 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7463 [(set_attr "op_type" "RIL")
7464 (set_attr "type" "larl")])
7467 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7470 [(set_attr "op_type" "NN")
7471 (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7474 ;; Insns related to generating the function prologue and epilogue.
7478 (define_expand "prologue"
7479 [(use (const_int 0))]
7481 "s390_emit_prologue (); DONE;")
7483 (define_expand "epilogue"
7484 [(use (const_int 1))]
7486 "s390_emit_epilogue (); DONE;")
7488 (define_insn "*return"
7490 (use (match_operand 0 "register_operand" "a"))]
7491 "GET_MODE (operands[0]) == Pmode"
7493 [(set_attr "op_type" "RR")
7494 (set_attr "type" "jsr")
7495 (set_attr "atype" "agen")])
7498 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7499 ;; pointer. This is used for compatibility.
7501 (define_expand "ptr_extend"
7502 [(set (match_operand:DI 0 "register_operand" "=r")
7503 (match_operand:SI 1 "register_operand" "r"))]
7506 emit_insn (gen_anddi3 (operands[0],
7507 gen_lowpart (DImode, operands[1]),
7508 GEN_INT (0x7fffffff)));