This commit was manufactured by cvs2svn to create branch
[official-gcc.git] / gcc / config / s390 / s390.md
blobebb8b5729929543ae01d3742e65e9d1eb5829ce4
1 ;;- Machine description for GNU compiler -- S/390 / zSeries version.
2 ;;  Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
3 ;;  Free Software Foundation, Inc.
4 ;;  Contributed by Hartmut Penner (hpenner@de.ibm.com) and
5 ;;                 Ulrich Weigand (uweigand@de.ibm.com).
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it under
10 ;; the terms of the GNU General Public License as published by the Free
11 ;; Software Foundation; either version 2, or (at your option) any later
12 ;; version.
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 ;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17 ;; for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING.  If not, write to the Free
21 ;; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 ;; 02111-1307, USA.
25 ;; Special constraints for s/390 machine description:
27 ;;    a -- Any address register from 1 to 15.
28 ;;    d -- Any register from 0 to 15.
29 ;;    I -- An 8-bit constant (0..255).
30 ;;    J -- A 12-bit constant (0..4095).
31 ;;    K -- A 16-bit constant (-32768..32767).
32 ;;    L -- Value appropriate as displacement. 
33 ;;         (0..4095) for short displacement
34 ;;         (-524288..524287) for long displacement
35 ;;    M -- Constant integer with a value of 0x7fffffff.
36 ;;    N -- Multiple letter constraint followed by 4 parameter letters.
37 ;;         0..9:  number of the part counting from most to least significant
38 ;;         H,Q:   mode of the part
39 ;;         D,S,H: mode of the containing operand
40 ;;         0,F:   value of the other parts (F - all bits set)
41 ;;         
42 ;;         The constraint matches if the specified part of a constant
43 ;;         has a value different from its other parts.
44 ;;    Q -- Memory reference without index register and with short displacement.
45 ;;    R -- Memory reference with index register and short displacement.
46 ;;    S -- Memory reference without index register but with long displacement.
47 ;;    T -- Memory reference with index register and long displacement.
48 ;;    U -- Pointer with short displacement.
49 ;;    W -- Pointer with long displacement.
50 ;;    Y -- Shift count operand.
52 ;; Special formats used for outputting 390 instructions.
54 ;;     %C: print opcode suffix for branch condition.
55 ;;     %D: print opcode suffix for inverse branch condition.
56 ;;     %J: print tls_load/tls_gdcall/tls_ldcall suffix
57 ;;     %O: print only the displacement of a memory reference.
58 ;;     %R: print only the base register of a memory reference.
59 ;;     %N: print the second word of a DImode operand.
60 ;;     %M: print the second word of a TImode operand.
62 ;;     %b: print integer X as if it's an unsigned byte.
63 ;;     %x: print integer X as if it's an unsigned word.
64 ;;     %h: print integer X as if it's a signed word.
65 ;;     %i: print the first nonzero HImode part of X
66 ;;     %j: print the first HImode part unequal to 0xffff of X
69 ;; We have a special constraint for pattern matching.
71 ;;   s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
75 ;; UNSPEC usage
78 (define_constants
79   [; Miscellaneous
80    (UNSPEC_ROUND                1)
81    (UNSPEC_SETHIGH              10)
83    ; GOT/PLT and lt-relative accesses
84    (UNSPEC_LTREL_OFFSET         100)
85    (UNSPEC_LTREL_BASE           101)
86    (UNSPEC_GOTENT               110)
87    (UNSPEC_GOT                  111)
88    (UNSPEC_GOTOFF               112)
89    (UNSPEC_PLT                  113)
90    (UNSPEC_PLTOFF               114)
92    ; Literal pool
93    (UNSPEC_RELOAD_BASE          210)
94    (UNSPEC_MAIN_BASE            211)
96    ; TLS relocation specifiers
97    (UNSPEC_TLSGD                500)
98    (UNSPEC_TLSLDM               501)
99    (UNSPEC_NTPOFF               502)
100    (UNSPEC_DTPOFF               503)
101    (UNSPEC_GOTNTPOFF            504)
102    (UNSPEC_INDNTPOFF            505)
104    ; TLS support
105    (UNSPEC_TP                   510)
106    (UNSPEC_TLSLDM_NTPOFF        511)
107    (UNSPEC_TLS_LOAD             512)
109    ; String Functions
110    (UNSPEC_SRST         600)
111  ])
114 ;; UNSPEC_VOLATILE usage
117 (define_constants
118   [; Blockage
119    (UNSPECV_BLOCKAGE            0)
121    ; Literal pool
122    (UNSPECV_POOL                200)
123    (UNSPECV_POOL_START          201)
124    (UNSPECV_POOL_END            202)
125    (UNSPECV_POOL_ENTRY          203)
126    (UNSPECV_MAIN_POOL           300)
128    ; TLS support
129    (UNSPECV_SET_TP              500)
130   ])
133 ;; Processor type.  This attribute must exactly match the processor_type
134 ;; enumeration in s390.h.
136 (define_attr "cpu" "g5,g6,z900,z990"
137   (const (symbol_ref "s390_tune")))
139 ;; Define an insn type attribute.  This is used in function unit delay
140 ;; computations.
142 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
143                      cs,vs,store,imul,idiv,
144                      branch,jsr,fsimpd,fsimps,
145                      floadd,floads,fstored, fstores,
146                      fmuld,fmuls,fdivd,fdivs,
147                      ftoi,itof,fsqrtd,fsqrts,
148                      other,o2,o3"
149   (const_string "integer"))
151 ;; Operand type. Used to default length attribute values
153 (define_attr "op_type"
154   "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
155   (const_string "RX"))
157 ;; Insn are devide in two classes:
158 ;;   agen: Insn using agen
159 ;;   reg: Insn not using agen
161 (define_attr "atype" "agen,reg"
162 (cond [ (eq_attr "op_type" "E")    (const_string "reg")
163          (eq_attr "op_type" "RR")  (const_string "reg")
164          (eq_attr "op_type" "RX")  (const_string "agen")
165          (eq_attr "op_type" "RI")  (const_string "reg")
166          (eq_attr "op_type" "RRE") (const_string "reg")
167          (eq_attr "op_type" "RS")  (const_string "agen")
168          (eq_attr "op_type" "RSI") (const_string "agen")
169          (eq_attr "op_type" "S")   (const_string "agen")
170          (eq_attr "op_type" "SI")  (const_string "agen")
171          (eq_attr "op_type" "SS")  (const_string "agen")
172          (eq_attr "op_type" "SSE") (const_string "agen")
173          (eq_attr "op_type" "RXE") (const_string "agen")
174          (eq_attr "op_type" "RSE") (const_string "agen")
175          (eq_attr "op_type" "RIL") (const_string "agen")
176          (eq_attr "op_type" "RXY") (const_string "agen")
177          (eq_attr "op_type" "RSY") (const_string "agen")
178          (eq_attr "op_type" "SIY") (const_string "agen")]
179   (const_string "reg")))
181 ;; Generic pipeline function unit.
183 (define_function_unit "integer" 1 0
184   (eq_attr "type" "none") 0 0)
186 (define_function_unit "integer" 1 0
187   (eq_attr "type" "integer") 1 1)
189 (define_function_unit "integer" 1 0
190   (eq_attr "type" "fsimpd") 1 1)
192 (define_function_unit "integer" 1 0
193   (eq_attr "type" "fsimps") 1 1)
195 (define_function_unit "integer" 1 0
196   (eq_attr "type" "load") 1 1)
198 (define_function_unit "integer" 1 0
199   (eq_attr "type" "floadd") 1 1)
201 (define_function_unit "integer" 1 0
202   (eq_attr "type" "floads") 1 1)
204 (define_function_unit "integer" 1 0
205   (eq_attr "type" "la") 1 1)
207 (define_function_unit "integer" 1 0
208   (eq_attr "type" "larl") 1 1)
210 (define_function_unit "integer" 1 0
211   (eq_attr "type" "lr") 1 1)
213 (define_function_unit "integer" 1 0
214   (eq_attr "type" "branch") 1 1)
216 (define_function_unit "integer" 1 0
217   (eq_attr "type" "store") 1 1)
219 (define_function_unit "integer" 1 0
220   (eq_attr "type" "fstored") 1 1)
222 (define_function_unit "integer" 1 0
223   (eq_attr "type" "fstores") 1 1)
225 (define_function_unit "integer" 1 0
226   (eq_attr "type" "lm") 2 2)
228 (define_function_unit "integer" 1 0
229   (eq_attr "type" "stm") 2 2)
231 (define_function_unit "integer" 1 0
232   (eq_attr "type" "cs") 5 5)
234 (define_function_unit "integer" 1 0
235   (eq_attr "type" "vs") 30 30)
237 (define_function_unit "integer" 1 0
238   (eq_attr "type" "jsr") 5 5)
240 (define_function_unit "integer" 1 0
241   (eq_attr "type" "imul") 7 7)
243 (define_function_unit "integer" 1 0
244   (eq_attr "type" "fmuld") 6 6)
246 (define_function_unit "integer" 1 0
247   (eq_attr "type" "fmuls") 6 6)
249 (define_function_unit "integer" 1 0
250   (eq_attr "type" "idiv") 33 33)
252 (define_function_unit "integer" 1 0
253   (eq_attr "type" "fdivd") 33 33)
255 (define_function_unit "integer" 1 0
256   (eq_attr "type" "fdivs") 33 33)
258 (define_function_unit "integer" 1 0
259   (eq_attr "type" "fsqrtd") 30 30)
261 (define_function_unit "integer" 1 0
262   (eq_attr "type" "fsqrts") 30 30)
264 (define_function_unit "integer" 1 0
265   (eq_attr "type" "ftoi") 2 2)
267 (define_function_unit "integer" 1 0
268   (eq_attr "type" "itof") 2 2)
270 (define_function_unit "integer" 1 0
271   (eq_attr "type" "o2") 2 2)
273 (define_function_unit "integer" 1 0
274   (eq_attr "type" "o3") 3 3)
276 (define_function_unit "integer" 1 0
277   (eq_attr "type" "other") 5 5)
279 ;; Pipeline description for z900
281 (include "2064.md")
282 (include "2084.md")
284 ;; Length in bytes.
286 (define_attr "length" ""
287 (cond [ (eq_attr "op_type" "E")    (const_int 2)
288          (eq_attr "op_type" "RR")  (const_int 2)
289          (eq_attr "op_type" "RX")  (const_int 4)
290          (eq_attr "op_type" "RI")  (const_int 4)
291          (eq_attr "op_type" "RRE") (const_int 4)
292          (eq_attr "op_type" "RS")  (const_int 4)
293          (eq_attr "op_type" "RSI") (const_int 4)
294          (eq_attr "op_type" "S")   (const_int 4)
295          (eq_attr "op_type" "SI")  (const_int 4)
296          (eq_attr "op_type" "SS")  (const_int 6)
297          (eq_attr "op_type" "SSE") (const_int 6)
298          (eq_attr "op_type" "RXE") (const_int 6)
299          (eq_attr "op_type" "RSE") (const_int 6)
300          (eq_attr "op_type" "RIL") (const_int 6)
301          (eq_attr "op_type" "RXY") (const_int 6)
302          (eq_attr "op_type" "RSY") (const_int 6)
303          (eq_attr "op_type" "SIY") (const_int 6)]
304          (const_int 4)))
306 ;; Define attributes for `asm' insns.
308 (define_asm_attributes [(set_attr "type" "other")
309                         (set_attr "op_type" "NN")])
312 ;;  Condition Codes
315 ;   CCL:  Zero     Nonzero   Zero      Nonzero      (AL, ALR, SL, SLR, N, NC, NI, NR, O, OC, OI, OR, X, XC, XI, XR)
316 ;   CCA:  Zero     <Zero     >Zero     Overflow     (A, AR, AH, AHI, S, SR, SH, SHI, LTR, LCR, LNR, LPR, SLA, SLDA, SLA, SRDA)
317 ;   CCU:  Equal    ULess     UGreater  --           (CL, CLR, CLI, CLM)
318 ;   CCS:  Equal    SLess     SGreater  --           (C, CR, CH, CHI, ICM)
319 ;   CCT:  Zero     Mixed     Mixed     Ones         (TM, TMH, TML)
321 ;   CCZ  -> CCL / CCZ1
322 ;   CCZ1 -> CCA/CCU/CCS/CCT
323 ;   CCS  -> CCA
325 ;   String:    CLC, CLCL, CLCLE, CLST, CUSE, MVCL, MVCLE, MVPG, MVST, SRST
326 ;   Clobber:   CKSM, CFC, CS, CDS, CUUTF, CUTFU, PLO, SPM, STCK, STCKE, TS, TRT, TRE, UPT
330 ;;- Compare instructions.
333 (define_expand "cmpdi"
334   [(set (reg:CC 33)
335         (compare:CC (match_operand:DI 0 "register_operand" "")
336                     (match_operand:DI 1 "general_operand" "")))]
337   "TARGET_64BIT"
339   s390_compare_op0 = operands[0];
340   s390_compare_op1 = operands[1];
341   DONE;
344 (define_expand "cmpsi"
345   [(set (reg:CC 33)
346         (compare:CC (match_operand:SI 0 "register_operand" "")
347                     (match_operand:SI 1 "general_operand" "")))]
348   ""
350   s390_compare_op0 = operands[0];
351   s390_compare_op1 = operands[1];
352   DONE;
355 (define_expand "cmpdf"
356   [(set (reg:CC 33)
357         (compare:CC (match_operand:DF 0 "register_operand" "")
358                     (match_operand:DF 1 "general_operand" "")))]
359   "TARGET_HARD_FLOAT"
361   s390_compare_op0 = operands[0];
362   s390_compare_op1 = operands[1];
363   DONE;
366 (define_expand "cmpsf"
367   [(set (reg:CC 33)
368         (compare:CC (match_operand:SF 0 "register_operand" "")
369                     (match_operand:SF 1 "general_operand" "")))]
370   "TARGET_HARD_FLOAT"
372   s390_compare_op0 = operands[0];
373   s390_compare_op1 = operands[1];
374   DONE;
378 ; Test-under-Mask (zero_extract) instructions
380 (define_insn "*tmdi_ext"
381   [(set (reg 33)
382         (compare (zero_extract:DI (match_operand:DI 0 "register_operand" "d")
383                                   (match_operand:DI 1 "const_int_operand" "n")
384                                   (match_operand:DI 2 "const_int_operand" "n"))
385                  (const_int 0)))]
386   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
387    && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
388    && INTVAL (operands[1]) + INTVAL (operands[2]) <= 64
389    && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
390       == INTVAL (operands[2]) >> 4"
392   int part = INTVAL (operands[2]) >> 4;
393   int block = (1 << INTVAL (operands[1])) - 1;
394   int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
396   operands[2] = GEN_INT (block << shift);
398   switch (part)
399     {
400       case 0: return "tmhh\t%0,%x2";
401       case 1: return "tmhl\t%0,%x2";
402       case 2: return "tmlh\t%0,%x2";
403       case 3: return "tmll\t%0,%x2";
404       default: abort ();
405     }
407   [(set_attr "op_type" "RI")])
409 (define_insn "*tmsi_ext"
410   [(set (reg 33)
411         (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
412                                   (match_operand:SI 1 "const_int_operand" "n")
413                                   (match_operand:SI 2 "const_int_operand" "n"))
414                  (const_int 0)))]
415   "s390_match_ccmode(insn, CCTmode)
416    && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
417    && INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
418    && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
419       == INTVAL (operands[2]) >> 4"
421   int part = INTVAL (operands[2]) >> 4;
422   int block = (1 << INTVAL (operands[1])) - 1;
423   int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
425   operands[2] = GEN_INT (block << shift);
427   switch (part)
428     {
429       case 0: return "tmh\t%0,%x2";
430       case 1: return "tml\t%0,%x2";
431       default: abort ();
432     }
434   [(set_attr "op_type" "RI")])
436 (define_insn "*tmqisi_ext"
437   [(set (reg 33)
438         (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,S")
439                                   (match_operand:SI 1 "const_int_operand" "n,n")
440                                   (match_operand:SI 2 "const_int_operand" "n,n"))
441                  (const_int 0)))]
442   "!TARGET_64BIT && s390_match_ccmode(insn, CCTmode)
443    && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
444    && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
446   int block = (1 << INTVAL (operands[1])) - 1;
447   int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
449   operands[2] = GEN_INT (block << shift);
450   return which_alternative == 0 ? "tm\t%0,%b2" : "tmy\t%0,%b2";
452   [(set_attr "op_type" "SI,SIY")])
454 (define_insn "*tmqidi_ext"
455   [(set (reg 33)
456         (compare (zero_extract:DI (match_operand:QI 0 "memory_operand" "Q,S")
457                                   (match_operand:SI 1 "const_int_operand" "n,n")
458                                   (match_operand:SI 2 "const_int_operand" "n,n"))
459                  (const_int 0)))]
460   "TARGET_64BIT && s390_match_ccmode(insn, CCTmode)
461    && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
462    && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
464   int block = (1 << INTVAL (operands[1])) - 1;
465   int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
467   operands[2] = GEN_INT (block << shift);
468   return which_alternative == 0 ? "tm\t%0,%b2" : "tmy\t%0,%b2";
470   [(set_attr "op_type" "SI,SIY")])
473 ; Test-under-Mask instructions
475 (define_insn "*tmdi_mem"
476   [(set (reg 33)
477         (compare (and:DI (match_operand:DI 0 "memory_operand" "Q,S")
478                          (match_operand:DI 1 "immediate_operand" "n,n"))
479                  (match_operand:DI 2 "immediate_operand" "n,n")))]
480   "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
481    && s390_single_part (operands[1], DImode, QImode, 0) >= 0"
483   int part = s390_single_part (operands[1], DImode, QImode, 0);
484   operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
486   operands[0] = gen_rtx_MEM (QImode,
487                              plus_constant (XEXP (operands[0], 0), part));
488   return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
490   [(set_attr "op_type" "SI,SIY")])
492 (define_insn "*tmsi_mem"
493   [(set (reg 33)
494         (compare (and:SI (match_operand:SI 0 "memory_operand" "Q,S")
495                          (match_operand:SI 1 "immediate_operand" "n,n"))
496                  (match_operand:SI 2 "immediate_operand" "n,n")))]
497   "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
498    && s390_single_part (operands[1], SImode, QImode, 0) >= 0"
500   int part = s390_single_part (operands[1], SImode, QImode, 0);
501   operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
503   operands[0] = gen_rtx_MEM (QImode,
504                              plus_constant (XEXP (operands[0], 0), part));
505   return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
507   [(set_attr "op_type" "SI")])
509 (define_insn "*tmhi_mem"
510   [(set (reg 33)
511         (compare (and:SI (subreg:SI (match_operand:HI 0 "memory_operand" "Q,S") 0)
512                          (match_operand:SI 1 "immediate_operand" "n,n"))
513                  (match_operand:SI 2 "immediate_operand" "n,n")))]
514   "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
515    && s390_single_part (operands[1], HImode, QImode, 0) >= 0"
517   int part = s390_single_part (operands[1], HImode, QImode, 0);
518   operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
520   operands[0] = gen_rtx_MEM (QImode,
521                              plus_constant (XEXP (operands[0], 0), part));
522   return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
524   [(set_attr "op_type" "SI")])
526 (define_insn "*tmqi_mem"
527   [(set (reg 33)
528         (compare (and:SI (subreg:SI (match_operand:QI 0 "memory_operand" "Q,S") 0)
529                          (match_operand:SI 1 "immediate_operand" "n,n"))
530                  (match_operand:SI 2 "immediate_operand" "n,n")))]
531   "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))"
532   "@
533    tm\t%0,%b1
534    tmy\t%0,%b1"
535   [(set_attr "op_type" "SI,SIY")])
537 (define_insn "*tmdi_reg"
538   [(set (reg 33)
539         (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
540                          (match_operand:DI 1 "immediate_operand" 
541                                              "N0HD0,N1HD0,N2HD0,N3HD0"))
542                  (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
543   "TARGET_64BIT
544    && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
545    && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
546   "@
547    tmhh\t%0,%i1
548    tmhl\t%0,%i1
549    tmlh\t%0,%i1
550    tmll\t%0,%i1"
551   [(set_attr "op_type" "RI")])
553 (define_insn "*tmsi_reg"
554   [(set (reg 33)
555         (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
556                          (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
557                  (match_operand:SI 2 "immediate_operand" "n,n")))]
558   "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
559    && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
560   "@
561    tmh\t%0,%i1
562    tml\t%0,%i1"
563   [(set_attr "op_type" "RI")])
565 (define_insn "*tmhi_full"
566   [(set (reg 33)
567         (compare (match_operand:HI 0 "register_operand" "d")
568                  (match_operand:HI 1 "immediate_operand" "n")))]
569   "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
570   "tml\t%0,65535"
571   [(set_attr "op_type" "RX")])
573 (define_insn "*tmqi_full"
574   [(set (reg 33)
575         (compare (match_operand:QI 0 "register_operand" "d")
576                  (match_operand:QI 1 "immediate_operand" "n")))]
577   "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
578   "tml\t%0,255"
579   [(set_attr "op_type" "RI")])
582 ; Load-and-Test instructions
584 (define_insn "*tstdi_sign"
585   [(set (reg 33)
586         (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
587                                          (const_int 32)) (const_int 32))
588                  (match_operand:DI 1 "const0_operand" "")))
589    (set (match_operand:DI 2 "register_operand" "=d")
590         (sign_extend:DI (match_dup 0)))]
591   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
592   "ltgfr\t%2,%0"
593   [(set_attr "op_type" "RRE")])
595 (define_insn "*tstdi"
596   [(set (reg 33)
597         (compare (match_operand:DI 0 "register_operand" "d")
598                  (match_operand:DI 1 "const0_operand" "")))
599    (set (match_operand:DI 2 "register_operand" "=d")
600         (match_dup 0))]
601   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
602   "ltgr\t%2,%0"
603   [(set_attr "op_type" "RRE")])
605 (define_insn "*tstdi_cconly"
606   [(set (reg 33)
607         (compare (match_operand:DI 0 "register_operand" "d")
608                  (match_operand:DI 1 "const0_operand" "")))]
609   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
610   "ltgr\t%0,%0"
611   [(set_attr "op_type" "RRE")])
613 (define_insn "*tstdi_cconly_31"
614   [(set (reg 33)
615         (compare (match_operand:DI 0 "register_operand" "d")
616                  (match_operand:DI 1 "const0_operand" "")))]
617   "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
618   "srda\t%0,0"
619   [(set_attr "op_type" "RS")
620    (set_attr "atype"   "reg")])
623 (define_insn "*tstsi"
624   [(set (reg 33)
625         (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
626                  (match_operand:SI 1 "const0_operand" "")))
627    (set (match_operand:SI 2 "register_operand" "=d,d,d")
628         (match_dup 0))]
629   "s390_match_ccmode(insn, CCSmode)"
630   "@
631    ltr\t%2,%0
632    icm\t%2,15,%0
633    icmy\t%2,15,%0"
634   [(set_attr "op_type" "RR,RS,RSY")])
636 (define_insn "*tstsi_cconly"
637   [(set (reg 33)
638         (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
639                  (match_operand:SI 1 "const0_operand" "")))
640    (clobber (match_scratch:SI 2 "=X,d,d"))]
641   "s390_match_ccmode(insn, CCSmode)"
642   "@
643    ltr\t%0,%0
644    icm\t%2,15,%0
645    icmy\t%2,15,%0"
646   [(set_attr "op_type" "RR,RS,RSY")])
648 (define_insn "*tstsi_cconly2"
649   [(set (reg 33)
650         (compare (match_operand:SI 0 "register_operand" "d")
651                  (match_operand:SI 1 "const0_operand" "")))]
652   "s390_match_ccmode(insn, CCSmode)"
653   "ltr\t%0,%0"
654   [(set_attr "op_type" "RR")])
656 (define_insn "*tsthiCCT"
657   [(set (reg 33)
658         (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d")
659                  (match_operand:HI 1 "const0_operand" "")))
660    (set (match_operand:HI 2 "register_operand" "=d,d,0")
661         (match_dup 0))]
662   "s390_match_ccmode(insn, CCTmode)"
663   "@
664    icm\t%2,3,%0
665    icmy\t%2,3,%0
666    tml\t%0,65535"
667   [(set_attr "op_type" "RS,RSY,RI")])
669 (define_insn "*tsthiCCT_cconly"
670   [(set (reg 33)
671         (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
672                  (match_operand:HI 1 "const0_operand" "")))
673    (clobber (match_scratch:HI 2 "=d,d,X"))]
674   "s390_match_ccmode(insn, CCTmode)"
675   "@
676    icm\t%2,3,%0
677    icmy\t%2,3,%0
678    tml\t%0,65535"
679   [(set_attr "op_type" "RS,RSY,RI")])
681 (define_insn "*tsthi"
682   [(set (reg 33)
683         (compare (match_operand:HI 0 "s_operand" "Q,S")
684                  (match_operand:HI 1 "const0_operand" "")))
685    (set (match_operand:HI 2 "register_operand" "=d,d")
686         (match_dup 0))]
687   "s390_match_ccmode(insn, CCSmode)"
688   "@
689    icm\t%2,3,%0
690    icmy\t%2,3,%0"
691   [(set_attr "op_type" "RS,RSY")])
693 (define_insn "*tsthi_cconly"
694   [(set (reg 33)
695         (compare (match_operand:HI 0 "s_operand" "Q,S")
696                  (match_operand:HI 1 "const0_operand" "")))
697    (clobber (match_scratch:HI 2 "=d,d"))]
698   "s390_match_ccmode(insn, CCSmode)"
699   "@
700    icm\t%2,3,%0
701    icmy\t%2,3,%0"
702   [(set_attr "op_type" "RS,RSY")])
704 (define_insn "*tstqiCCT"
705   [(set (reg 33)
706         (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
707                  (match_operand:QI 1 "const0_operand" "")))
708    (set (match_operand:QI 2 "register_operand" "=d,d,0")
709         (match_dup 0))]
710   "s390_match_ccmode(insn, CCTmode)"
711   "@
712    icm\t%2,1,%0
713    icmy\t%2,1,%0
714    tml\t%0,255"
715   [(set_attr "op_type" "RS,RSY,RI")])
717 (define_insn "*tstqiCCT_cconly"
718   [(set (reg 33)
719         (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
720                  (match_operand:QI 1 "const0_operand" "")))]
721   "s390_match_ccmode(insn, CCTmode)"
722   "@
723    cli\t%0,0
724    cliy\t%0,0
725    tml\t%0,255"
726   [(set_attr "op_type" "SI,SIY,RI")])
728 (define_insn "*tstqi"
729   [(set (reg 33)
730         (compare (match_operand:QI 0 "s_operand" "Q,S")
731                  (match_operand:QI 1 "const0_operand" "")))
732    (set (match_operand:QI 2 "register_operand" "=d,d")
733         (match_dup 0))]
734   "s390_match_ccmode(insn, CCSmode)"
735   "@
736    icm\t%2,1,%0
737    icmy\t%2,1,%0"
738   [(set_attr "op_type" "RS,RSY")])
740 (define_insn "*tstqi_cconly"
741   [(set (reg 33)
742         (compare (match_operand:QI 0 "s_operand" "Q,S")
743                  (match_operand:QI 1 "const0_operand" "")))
744    (clobber (match_scratch:QI 2 "=d,d"))]
745   "s390_match_ccmode(insn, CCSmode)"
746   "@
747    icm\t%2,1,%0
748    icmy\t%2,1,%0"
749   [(set_attr "op_type" "RS,RSY")])
752 ; Compare (signed) instructions
754 (define_insn "*cmpdi_ccs_sign"
755   [(set (reg 33)
756         (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
757                  (match_operand:DI 0 "register_operand" "d,d")))]
758   "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
759   "@
760    cgfr\t%0,%1
761    cgf\t%0,%1"
762   [(set_attr "op_type" "RRE,RXY")])
764 (define_insn "*cmpdi_ccs"
765   [(set (reg 33)
766         (compare (match_operand:DI 0 "register_operand" "d,d,d")
767                  (match_operand:DI 1 "general_operand" "d,K,m")))]
768   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
769   "@
770    cgr\t%0,%1
771    cghi\t%0,%c1
772    cg\t%0,%1"
773   [(set_attr "op_type" "RRE,RI,RXY")])
775 (define_insn "*cmpsi_ccs_sign"
776   [(set (reg 33)
777         (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
778                  (match_operand:SI 0 "register_operand" "d,d")))]
779   "s390_match_ccmode(insn, CCSRmode)"
780   "@
781    ch\t%0,%1
782    chy\t%0,%1"
783   [(set_attr "op_type" "RX,RXY")])
785 (define_insn "*cmpsi_ccs"
786   [(set (reg 33)
787         (compare (match_operand:SI 0 "register_operand" "d,d,d,d")
788                  (match_operand:SI 1 "general_operand" "d,K,R,T")))]
789   "s390_match_ccmode(insn, CCSmode)"
790   "@
791    cr\t%0,%1
792    chi\t%0,%c1
793    c\t%0,%1
794    cy\t%0,%1"
795   [(set_attr "op_type" "RR,RI,RX,RXY")])
798 ; Compare (unsigned) instructions
800 (define_insn "*cmpdi_ccu_zero"
801   [(set (reg 33)
802         (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
803                  (match_operand:DI 0 "register_operand" "d,d")))]
804   "s390_match_ccmode(insn, CCURmode) && TARGET_64BIT"
805   "@
806    clgfr\t%0,%1
807    clgf\t%0,%1"
808   [(set_attr "op_type" "RRE,RXY")])
810 (define_insn "*cmpdi_ccu"
811   [(set (reg 33)
812         (compare (match_operand:DI 0 "register_operand" "d,d")
813                  (match_operand:DI 1 "general_operand" "d,m")))]
814   "s390_match_ccmode(insn, CCUmode) && TARGET_64BIT"
815   "@
816    clgr\t%0,%1
817    clg\t%0,%1"
818   [(set_attr "op_type" "RRE,RXY")])
820 (define_insn "*cmpsi_ccu"
821   [(set (reg 33)
822         (compare (match_operand:SI 0 "register_operand" "d,d,d")
823                  (match_operand:SI 1 "general_operand" "d,R,T")))]
824   "s390_match_ccmode(insn, CCUmode)"
825   "@
826    clr\t%0,%1
827    cl\t%0,%1
828    cly\t%0,%1"
829   [(set_attr "op_type" "RR,RX,RXY")])
831 (define_insn "*cmphi_ccu"
832   [(set (reg 33)
833         (compare (match_operand:HI 0 "register_operand" "d,d")
834                  (match_operand:HI 1 "s_imm_operand" "Q,S")))]
835   "s390_match_ccmode(insn, CCUmode)"
836   "@
837    clm\t%0,3,%1
838    clmy\t%0,3,%1"
839   [(set_attr "op_type" "RS,RSY")])
841 (define_insn "*cmpqi_ccu"
842   [(set (reg 33)
843         (compare (match_operand:QI 0 "register_operand" "d,d")
844                  (match_operand:QI 1 "s_imm_operand" "Q,S")))]
845   "s390_match_ccmode(insn, CCUmode)"
846   "@
847    clm\t%0,1,%1
848    clmy\t%0,1,%1"
849   [(set_attr "op_type" "RS,RSY")])
851 (define_insn "*cli"
852   [(set (reg 33)
853         (compare (match_operand:QI 0 "memory_operand" "Q,S")
854                  (match_operand:QI 1 "immediate_operand" "n,n")))]
855   "s390_match_ccmode (insn, CCUmode)"
856   "@
857    cli\t%0,%b1
858    cliy\t%0,%b1"
859   [(set_attr "op_type" "SI,SIY")])
861 (define_insn "*cmpdi_ccu_mem"
862   [(set (reg 33)
863         (compare (match_operand:DI 0 "s_operand" "Q")
864                  (match_operand:DI 1 "s_imm_operand" "Q")))]
865   "s390_match_ccmode(insn, CCUmode)"
866   "clc\t%O0(8,%R0),%1"
867   [(set_attr "op_type" "SS")])
869 (define_insn "*cmpsi_ccu_mem"
870   [(set (reg 33)
871         (compare (match_operand:SI 0 "s_operand" "Q")
872                  (match_operand:SI 1 "s_imm_operand" "Q")))]
873   "s390_match_ccmode(insn, CCUmode)"
874   "clc\t%O0(4,%R0),%1"
875    [(set_attr "op_type" "SS")])
877 (define_insn "*cmphi_ccu_mem"
878   [(set (reg 33)
879         (compare (match_operand:HI 0 "s_operand" "Q")
880                  (match_operand:HI 1 "s_imm_operand" "Q")))]
881   "s390_match_ccmode(insn, CCUmode)"
882   "clc\t%O0(2,%R0),%1"
883   [(set_attr "op_type" "SS")])
885 (define_insn "*cmpqi_ccu_mem"
886   [(set (reg 33)
887         (compare (match_operand:QI 0 "s_operand" "Q")
888                  (match_operand:QI 1 "s_imm_operand" "Q")))]
889   "s390_match_ccmode(insn, CCUmode)"
890   "clc\t%O0(1,%R0),%1"
891   [(set_attr "op_type" "SS")])
894 ; DF instructions
896 (define_insn "*cmpdf_ccs_0"
897   [(set (reg 33)
898         (compare (match_operand:DF 0 "register_operand" "f")
899                  (match_operand:DF 1 "const0_operand" "")))]
900   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
901   "ltdbr\t%0,%0"
902    [(set_attr "op_type" "RRE")
903     (set_attr "type"  "fsimpd")])
905 (define_insn "*cmpdf_ccs_0_ibm"
906   [(set (reg 33)
907         (compare (match_operand:DF 0 "register_operand" "f")
908                  (match_operand:DF 1 "const0_operand" "")))]
909   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
910   "ltdr\t%0,%0"
911    [(set_attr "op_type" "RR")
912     (set_attr "type"  "fsimpd")])
914 (define_insn "*cmpdf_ccs"
915   [(set (reg 33)
916         (compare (match_operand:DF 0 "register_operand" "f,f")
917                  (match_operand:DF 1 "general_operand" "f,R")))]
918   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
919   "@
920    cdbr\t%0,%1
921    cdb\t%0,%1"
922    [(set_attr "op_type" "RRE,RXE")
923     (set_attr "type"  "fsimpd")])
925 (define_insn "*cmpdf_ccs_ibm"
926   [(set (reg 33)
927         (compare (match_operand:DF 0 "register_operand" "f,f")
928                  (match_operand:DF 1 "general_operand" "f,R")))]
929   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
930   "@
931    cdr\t%0,%1
932    cd\t%0,%1"
933    [(set_attr "op_type" "RR,RX")
934     (set_attr "type"  "fsimpd")])
937 ; SF instructions
939 (define_insn "*cmpsf_ccs_0"
940   [(set (reg 33)
941         (compare (match_operand:SF 0 "register_operand" "f")
942                  (match_operand:SF 1 "const0_operand" "")))]
943   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
944   "ltebr\t%0,%0"
945    [(set_attr "op_type" "RRE")
946     (set_attr "type"  "fsimps")])
948 (define_insn "*cmpsf_ccs_0_ibm"
949   [(set (reg 33)
950         (compare (match_operand:SF 0 "register_operand" "f")
951                  (match_operand:SF 1 "const0_operand" "")))]
952   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
953   "lter\t%0,%0"
954    [(set_attr "op_type" "RR")
955     (set_attr "type"  "fsimps")])
957 (define_insn "*cmpsf_ccs"
958   [(set (reg 33)
959         (compare (match_operand:SF 0 "register_operand" "f,f")
960                  (match_operand:SF 1 "general_operand" "f,R")))]
961   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
962   "@
963    cebr\t%0,%1
964    ceb\t%0,%1"
965    [(set_attr "op_type" "RRE,RXE")
966     (set_attr "type"  "fsimps")])
968 (define_insn "*cmpsf_ccs"
969   [(set (reg 33)
970         (compare (match_operand:SF 0 "register_operand" "f,f")
971                  (match_operand:SF 1 "general_operand" "f,R")))]
972   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
973   "@
974    cer\t%0,%1
975    ce\t%0,%1"
976    [(set_attr "op_type" "RR,RX")
977     (set_attr "type"  "fsimps")])
981 ;;- Move instructions.
985 ; movti instruction pattern(s).
988 (define_insn "movti"
989   [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
990         (match_operand:TI 1 "general_operand" "QS,d,dKm,d,Q"))]
991   "TARGET_64BIT"
992   "@
993    lmg\t%0,%N0,%1
994    stmg\t%1,%N1,%0
995    #
996    #
997    mvc\t%O0(16,%R0),%1"
998   [(set_attr "op_type" "RSY,RSY,NN,NN,SS")
999    (set_attr "type" "lm,stm,*,*,cs")])
1001 (define_split
1002   [(set (match_operand:TI 0 "nonimmediate_operand" "")
1003         (match_operand:TI 1 "general_operand" ""))]
1004   "TARGET_64BIT && reload_completed
1005    && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
1006   [(set (match_dup 2) (match_dup 4))
1007    (set (match_dup 3) (match_dup 5))]
1009   operands[2] = operand_subword (operands[0], 0, 0, TImode);
1010   operands[3] = operand_subword (operands[0], 1, 0, TImode);
1011   operands[4] = operand_subword (operands[1], 0, 0, TImode);
1012   operands[5] = operand_subword (operands[1], 1, 0, TImode);
1015 (define_split
1016   [(set (match_operand:TI 0 "nonimmediate_operand" "")
1017         (match_operand:TI 1 "general_operand" ""))]
1018   "TARGET_64BIT && reload_completed
1019    && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
1020   [(set (match_dup 2) (match_dup 4))
1021    (set (match_dup 3) (match_dup 5))]
1023   operands[2] = operand_subword (operands[0], 1, 0, TImode);
1024   operands[3] = operand_subword (operands[0], 0, 0, TImode);
1025   operands[4] = operand_subword (operands[1], 1, 0, TImode);
1026   operands[5] = operand_subword (operands[1], 0, 0, TImode);
1029 (define_split
1030   [(set (match_operand:TI 0 "register_operand" "")
1031         (match_operand:TI 1 "memory_operand" ""))]
1032   "TARGET_64BIT && reload_completed
1033    && !s_operand (operands[1], VOIDmode)"
1034   [(set (match_dup 0) (match_dup 1))]
1036   rtx addr = operand_subword (operands[0], 1, 0, TImode);
1037   s390_load_address (addr, XEXP (operands[1], 0));
1038   operands[1] = replace_equiv_address (operands[1], addr);
1041 (define_expand "reload_outti"
1042   [(parallel [(match_operand:TI 0 "memory_operand" "")
1043               (match_operand:TI 1 "register_operand" "d")
1044               (match_operand:DI 2 "register_operand" "=&a")])]
1045   "TARGET_64BIT"
1047   s390_load_address (operands[2], XEXP (operands[0], 0));
1048   operands[0] = replace_equiv_address (operands[0], operands[2]);
1049   emit_move_insn (operands[0], operands[1]);
1050   DONE;
1054 ; movdi instruction pattern(s).
1057 (define_expand "movdi"
1058   [(set (match_operand:DI 0 "general_operand" "")
1059         (match_operand:DI 1 "general_operand" ""))]
1060   ""
1062   /* Handle symbolic constants.  */
1063   if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1064     emit_symbolic_move (operands);
1066   /* During and after reload, we need to force constants
1067      to the literal pool ourselves, if necessary.  */
1068   if ((reload_in_progress || reload_completed)
1069       && CONSTANT_P (operands[1])
1070       && (!legitimate_reload_constant_p (operands[1])
1071           || FP_REG_P (operands[0])))
1072     operands[1] = force_const_mem (DImode, operands[1]);
1075 (define_insn "*movdi_larl"
1076   [(set (match_operand:DI 0 "register_operand" "=d")
1077         (match_operand:DI 1 "larl_operand" "X"))]
1078   "TARGET_64BIT
1079    && !FP_REG_P (operands[0])"
1080   "larl\t%0,%1"
1081    [(set_attr "op_type" "RIL")
1082     (set_attr "type"    "larl")])
1084 (define_insn "*movdi_64"
1085   [(set (match_operand:DI 0 "nonimmediate_operand" 
1086                             "=d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,?Q")
1087         (match_operand:DI 1 "general_operand" 
1088                             "K,N0HD0,N1HD0,N2HD0,N3HD0,L,d,m,d,*f,R,T,*f,*f,?Q"))]
1089   "TARGET_64BIT"
1090   "@
1091    lghi\t%0,%h1
1092    llihh\t%0,%i1
1093    llihl\t%0,%i1
1094    llilh\t%0,%i1
1095    llill\t%0,%i1
1096    lay\t%0,%a1
1097    lgr\t%0,%1
1098    lg\t%0,%1
1099    stg\t%1,%0
1100    ldr\t%0,%1
1101    ld\t%0,%1
1102    ldy\t%0,%1
1103    std\t%1,%0
1104    stdy\t%1,%0
1105    mvc\t%O0(8,%R0),%1"
1106   [(set_attr "op_type" "RI,RI,RI,RI,RI,RXY,RRE,RXY,RXY,RR,RX,RXY,RX,RXY,SS")
1107    (set_attr "type" "*,*,*,*,*,la,lr,load,store,floadd,floadd,floadd,
1108                      fstored,fstored,cs")])
1110 (define_insn "*movdi_31"
1111   [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,o,!*f,!*f,!*f,!R,!T,Q")
1112         (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,R,T,*f,*f,Q"))]
1113   "!TARGET_64BIT"
1114   "@
1115    lm\t%0,%N0,%1
1116    stm\t%1,%N1,%0
1117    #
1118    #
1119    ldr\t%0,%1
1120    ld\t%0,%1
1121    ldy\t%0,%1
1122    std\t%1,%0
1123    stdy\t%1,%0
1124    mvc\t%O0(8,%R0),%1"
1125   [(set_attr "op_type" "RS,RS,NN,NN,RR,RX,RXY,RX,RXY,SS")
1126    (set_attr "type" "lm,stm,*,*,floadd,floadd,floadd,fstored,fstored,cs")])
1128 (define_split
1129   [(set (match_operand:DI 0 "nonimmediate_operand" "")
1130         (match_operand:DI 1 "general_operand" ""))]
1131   "!TARGET_64BIT && reload_completed
1132    && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1133   [(set (match_dup 2) (match_dup 4))
1134    (set (match_dup 3) (match_dup 5))]
1136   operands[2] = operand_subword (operands[0], 0, 0, DImode);
1137   operands[3] = operand_subword (operands[0], 1, 0, DImode);
1138   operands[4] = operand_subword (operands[1], 0, 0, DImode);
1139   operands[5] = operand_subword (operands[1], 1, 0, DImode);
1142 (define_split
1143   [(set (match_operand:DI 0 "nonimmediate_operand" "")
1144         (match_operand:DI 1 "general_operand" ""))]
1145   "!TARGET_64BIT && reload_completed
1146    && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1147   [(set (match_dup 2) (match_dup 4))
1148    (set (match_dup 3) (match_dup 5))]
1150   operands[2] = operand_subword (operands[0], 1, 0, DImode);
1151   operands[3] = operand_subword (operands[0], 0, 0, DImode);
1152   operands[4] = operand_subword (operands[1], 1, 0, DImode);
1153   operands[5] = operand_subword (operands[1], 0, 0, DImode);
1156 (define_split
1157   [(set (match_operand:DI 0 "register_operand" "")
1158         (match_operand:DI 1 "memory_operand" ""))]
1159   "!TARGET_64BIT && reload_completed
1160    && !FP_REG_P (operands[0])
1161    && !s_operand (operands[1], VOIDmode)"
1162   [(set (match_dup 0) (match_dup 1))]
1164   rtx addr = operand_subword (operands[0], 1, 0, DImode);
1165   s390_load_address (addr, XEXP (operands[1], 0));
1166   operands[1] = replace_equiv_address (operands[1], addr);
1169 (define_expand "reload_outdi"
1170   [(parallel [(match_operand:DI 0 "memory_operand" "")
1171               (match_operand:DI 1 "register_operand" "d")
1172               (match_operand:SI 2 "register_operand" "=&a")])]
1173   "!TARGET_64BIT"
1175   s390_load_address (operands[2], XEXP (operands[0], 0));
1176   operands[0] = replace_equiv_address (operands[0], operands[2]);
1177   emit_move_insn (operands[0], operands[1]);
1178   DONE;
1181 (define_peephole2
1182   [(set (match_operand:DI 0 "register_operand" "")
1183         (mem:DI (match_operand 1 "address_operand" "")))]
1184   "TARGET_64BIT
1185    && !FP_REG_P (operands[0])
1186    && GET_CODE (operands[1]) == SYMBOL_REF
1187    && CONSTANT_POOL_ADDRESS_P (operands[1])
1188    && get_pool_mode (operands[1]) == DImode
1189    && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1190   [(set (match_dup 0) (match_dup 2))]
1191   "operands[2] = get_pool_constant (operands[1]);")
1193 (define_insn "*la_64"
1194   [(set (match_operand:DI 0 "register_operand" "=d,d")
1195         (match_operand:QI 1 "address_operand" "U,W"))]
1196   "TARGET_64BIT"
1197   "@
1198    la\t%0,%a1
1199    lay\t%0,%a1"
1200   [(set_attr "op_type" "RX,RXY")
1201    (set_attr "type"    "la")])
1203 (define_peephole2
1204   [(parallel
1205     [(set (match_operand:DI 0 "register_operand" "")
1206           (match_operand:QI 1 "address_operand" ""))
1207      (clobber (reg:CC 33))])]
1208   "TARGET_64BIT
1209    && strict_memory_address_p (VOIDmode, operands[1])
1210    && preferred_la_operand_p (operands[1])"
1211   [(set (match_dup 0) (match_dup 1))]
1212   "")
1214 (define_peephole2
1215   [(set (match_operand:DI 0 "register_operand" "")
1216         (match_operand:DI 1 "register_operand" ""))
1217    (parallel
1218     [(set (match_dup 0)
1219           (plus:DI (match_dup 0)
1220                    (match_operand:DI 2 "nonmemory_operand" "")))
1221      (clobber (reg:CC 33))])]
1222   "TARGET_64BIT
1223    && !reg_overlap_mentioned_p (operands[0], operands[2])
1224    && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (DImode, operands[1], operands[2]))
1225    && preferred_la_operand_p (gen_rtx_PLUS (DImode, operands[1], operands[2]))"
1226   [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1227   "")
1229 (define_expand "reload_indi"
1230   [(parallel [(match_operand:DI 0 "register_operand" "=a")
1231               (match_operand:DI 1 "s390_plus_operand" "")
1232               (match_operand:DI 2 "register_operand" "=&a")])]
1233   "TARGET_64BIT"
1235   s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1236   DONE;
1240 ; movsi instruction pattern(s).
1243 (define_expand "movsi"
1244   [(set (match_operand:SI 0 "general_operand" "")
1245         (match_operand:SI 1 "general_operand" ""))]
1246   ""
1248   /* Handle symbolic constants.  */
1249   if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1250     emit_symbolic_move (operands);
1252   /* expr.c tries to load an effective address using
1253      force_reg.  This fails because we don't have a
1254      generic load_address pattern.  Convert the move
1255      to a proper arithmetic operation instead, unless
1256      it is guaranteed to be OK.  */
1257   if (GET_CODE (operands[1]) == PLUS
1258       && !legitimate_la_operand_p (operands[1]))
1259     {
1260       operands[1] = force_operand (operands[1], operands[0]);
1261       if (operands[1] == operands[0])
1262         DONE;
1263     }
1265   /* During and after reload, we need to force constants
1266      to the literal pool ourselves, if necessary.  */
1267   if ((reload_in_progress || reload_completed)
1268       && CONSTANT_P (operands[1])
1269       && (!legitimate_reload_constant_p (operands[1])
1270           || FP_REG_P (operands[0])))
1271     operands[1] = force_const_mem (SImode, operands[1]);
1274 (define_insn "*movsi_larl"
1275   [(set (match_operand:SI 0 "register_operand" "=d")
1276         (match_operand:SI 1 "larl_operand" "X"))]
1277   "!TARGET_64BIT && TARGET_CPU_ZARCH
1278    && !FP_REG_P (operands[0])"
1279   "larl\t%0,%1"
1280    [(set_attr "op_type" "RIL")
1281     (set_attr "type"    "larl")])
1283 (define_insn "*movsi_zarch"
1284   [(set (match_operand:SI 0 "nonimmediate_operand" 
1285                             "=d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,?Q")
1286         (match_operand:SI 1 "general_operand" 
1287                             "K,N0HS0,N1HS0,L,d,R,T,d,d,*f,R,T,*f,*f,?Q"))]
1288   "TARGET_ZARCH"
1289   "@
1290    lhi\t%0,%h1
1291    llilh\t%0,%i1
1292    llill\t%0,%i1
1293    lay\t%0,%a1
1294    lr\t%0,%1
1295    l\t%0,%1
1296    ly\t%0,%1
1297    st\t%1,%0
1298    sty\t%1,%0
1299    ler\t%0,%1
1300    le\t%0,%1
1301    ley\t%0,%1
1302    ste\t%1,%0
1303    stey\t%1,%0
1304    mvc\t%O0(4,%R0),%1"
1305   [(set_attr "op_type" "RI,RI,RI,RXY,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1306    (set_attr "type" "*,*,*,la,lr,load,load,store,store,floads,floads,floads,fstores,fstores,cs")])
1308 (define_insn "*movsi_esa"
1309   [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,?Q")
1310         (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,?Q"))]
1311   "!TARGET_ZARCH"
1312   "@
1313    lhi\t%0,%h1
1314    lr\t%0,%1
1315    l\t%0,%1
1316    st\t%1,%0
1317    ler\t%0,%1
1318    le\t%0,%1
1319    ste\t%1,%0
1320    mvc\t%O0(4,%R0),%1"
1321   [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,SS")
1322    (set_attr "type" "*,lr,load,store,floads,floads,fstores,cs")])
1324 (define_peephole2
1325   [(set (match_operand:SI 0 "register_operand" "")
1326         (mem:SI (match_operand 1 "address_operand" "")))]
1327   "!FP_REG_P (operands[0])
1328    && GET_CODE (operands[1]) == SYMBOL_REF
1329    && CONSTANT_POOL_ADDRESS_P (operands[1])
1330    && get_pool_mode (operands[1]) == SImode
1331    && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1332   [(set (match_dup 0) (match_dup 2))]
1333   "operands[2] = get_pool_constant (operands[1]);")
1335 (define_insn "*la_31"
1336   [(set (match_operand:SI 0 "register_operand" "=d,d")
1337         (match_operand:QI 1 "address_operand" "U,W"))]
1338   "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1339   "@
1340    la\t%0,%a1
1341    lay\t%0,%a1"
1342   [(set_attr "op_type"  "RX,RXY")
1343    (set_attr "type"     "la")])
1345 (define_peephole2
1346   [(parallel
1347     [(set (match_operand:SI 0 "register_operand" "")
1348           (match_operand:QI 1 "address_operand" ""))
1349      (clobber (reg:CC 33))])]
1350   "!TARGET_64BIT
1351    && strict_memory_address_p (VOIDmode, operands[1])
1352    && preferred_la_operand_p (operands[1])"
1353   [(set (match_dup 0) (match_dup 1))]
1354   "")
1356 (define_peephole2
1357   [(set (match_operand:SI 0 "register_operand" "")
1358         (match_operand:SI 1 "register_operand" ""))
1359    (parallel
1360     [(set (match_dup 0)
1361           (plus:SI (match_dup 0)
1362                    (match_operand:SI 2 "nonmemory_operand" "")))
1363      (clobber (reg:CC 33))])]
1364   "!TARGET_64BIT
1365    && !reg_overlap_mentioned_p (operands[0], operands[2])
1366    && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
1367    && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
1368   [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1369   "")
1371 (define_insn "*la_31_and"
1372   [(set (match_operand:SI 0 "register_operand" "=d,d")
1373         (and:SI (match_operand:QI 1 "address_operand" "U,W")
1374                 (const_int 2147483647)))]
1375   "!TARGET_64BIT"
1376   "@
1377    la\t%0,%a1
1378    lay\t%0,%a1"
1379   [(set_attr "op_type"  "RX,RXY")
1380    (set_attr "type"     "la")])
1382 (define_insn_and_split "*la_31_and_cc"
1383   [(set (match_operand:SI 0 "register_operand" "=d")
1384         (and:SI (match_operand:QI 1 "address_operand" "p")
1385                 (const_int 2147483647)))
1386    (clobber (reg:CC 33))]
1387   "!TARGET_64BIT"
1388   "#"
1389   "&& reload_completed"
1390   [(set (match_dup 0)
1391         (and:SI (match_dup 1) (const_int 2147483647)))]
1392   ""
1393   [(set_attr "op_type"  "RX")
1394    (set_attr "type"     "la")])
1396 (define_insn "force_la_31"
1397   [(set (match_operand:SI 0 "register_operand" "=d,d")
1398         (match_operand:QI 1 "address_operand" "U,W"))
1399    (use (const_int 0))]
1400   "!TARGET_64BIT"
1401   "@
1402    la\t%0,%a1
1403    lay\t%0,%a1"
1404   [(set_attr "op_type"  "RX")
1405    (set_attr "type"     "la")])
1407 (define_expand "reload_insi"
1408   [(parallel [(match_operand:SI 0 "register_operand" "=a")
1409               (match_operand:SI 1 "s390_plus_operand" "")
1410               (match_operand:SI 2 "register_operand" "=&a")])]
1411   "!TARGET_64BIT"
1413   s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1414   DONE;
1418 ; movhi instruction pattern(s).
1421 (define_expand "movhi"
1422   [(set (match_operand:HI 0 "nonimmediate_operand" "")
1423         (match_operand:HI 1 "general_operand" ""))]
1424   ""
1426   /* Make it explicit that loading a register from memory 
1427      always sign-extends (at least) to SImode.  */
1428   if (optimize && !no_new_pseudos
1429       && register_operand (operands[0], VOIDmode)
1430       && GET_CODE (operands[1]) == MEM
1431       && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
1432     {
1433       rtx tmp = gen_reg_rtx (SImode);
1434       rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1435       emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1436       operands[1] = gen_lowpart (HImode, tmp);
1437     }
1440 (define_insn "*movhi"
1441   [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1442         (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1443   ""
1444   "@
1445    lr\t%0,%1
1446    lhi\t%0,%h1
1447    lh\t%0,%1
1448    lhy\t%0,%1
1449    sth\t%1,%0
1450    sthy\t%1,%0
1451    mvc\t%O0(2,%R0),%1"
1452   [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1453    (set_attr "type" "lr,*,*,*,store,store,cs")])
1455 (define_peephole2
1456   [(set (match_operand:HI 0 "register_operand" "")
1457         (mem:HI (match_operand 1 "address_operand" "")))]
1458   "GET_CODE (operands[1]) == SYMBOL_REF
1459    && CONSTANT_POOL_ADDRESS_P (operands[1])
1460    && get_pool_mode (operands[1]) == HImode
1461    && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1462   [(set (match_dup 0) (match_dup 2))]
1463   "operands[2] = get_pool_constant (operands[1]);")
1466 ; movqi instruction pattern(s).
1469 (define_expand "movqi"
1470   [(set (match_operand:QI 0 "nonimmediate_operand" "")
1471         (match_operand:QI 1 "general_operand" ""))]
1472   ""
1474   /* On z/Architecture, zero-extending from memory to register
1475      is just as fast as a QImode load.  */
1476   if (TARGET_ZARCH && optimize && !no_new_pseudos
1477       && register_operand (operands[0], VOIDmode)
1478       && GET_CODE (operands[1]) == MEM
1479       && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
1480     {
1481       rtx tmp = gen_reg_rtx (word_mode);
1482       rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1483       emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1484       operands[1] = gen_lowpart (QImode, tmp);
1485     }
1488 (define_insn "*movqi"
1489   [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1490         (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1491   ""
1492   "@
1493    lr\t%0,%1
1494    lhi\t%0,%b1
1495    ic\t%0,%1
1496    icy\t%0,%1
1497    stc\t%1,%0
1498    stcy\t%1,%0
1499    mvi\t%0,%b1
1500    mviy\t%0,%b1
1501    mvc\t%O0(1,%R0),%1"
1502   [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1503    (set_attr "type" "lr,*,*,*,store,store,store,store,cs")])
1505 (define_peephole2
1506   [(set (match_operand:QI 0 "nonimmediate_operand" "")
1507         (mem:QI (match_operand 1 "address_operand" "")))]
1508   "GET_CODE (operands[1]) == SYMBOL_REF
1509    && CONSTANT_POOL_ADDRESS_P (operands[1])
1510    && get_pool_mode (operands[1]) == QImode
1511    && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1512   [(set (match_dup 0) (match_dup 2))]
1513   "operands[2] = get_pool_constant (operands[1]);")
1516 ; movstrictqi instruction pattern(s).
1519 (define_insn "*movstrictqi"
1520   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1521                          (match_operand:QI 1 "memory_operand" "R,T"))]
1522   ""
1523   "@
1524    ic\t%0,%1
1525    icy\t%0,%1"
1526   [(set_attr "op_type"  "RX,RXY")])
1529 ; movstricthi instruction pattern(s).
1532 (define_insn "*movstricthi"
1533   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1534                          (match_operand:HI 1 "s_imm_operand" "Q,S"))
1535    (clobber (reg:CC 33))]
1536   ""
1537   "@
1538    icm\t%0,3,%1
1539    icmy\t%0,3,%1"
1540   [(set_attr "op_type" "RS,RSY")])
1543 ; movstrictsi instruction pattern(s).
1546 (define_insn "movstrictsi"
1547   [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d"))
1548                          (match_operand:SI 1 "general_operand" "d,R,T"))]
1549   "TARGET_64BIT"
1550   "@
1551    lr\t%0,%1
1552    l\t%0,%1
1553    ly\t%0,%1"
1554   [(set_attr "op_type" "RR,RX,RXY")
1555    (set_attr "type" "lr,load,load")])
1558 ; movdf instruction pattern(s).
1561 (define_expand "movdf"
1562   [(set (match_operand:DF 0 "nonimmediate_operand" "")
1563         (match_operand:DF 1 "general_operand"  ""))]
1564   ""
1566   /* During and after reload, we need to force constants
1567      to the literal pool ourselves, if necessary.  */
1568   if ((reload_in_progress || reload_completed)
1569       && CONSTANT_P (operands[1]))
1570     operands[1] = force_const_mem (DFmode, operands[1]);
1573 (define_insn "*movdf_64"
1574   [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1575         (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1576   "TARGET_64BIT"
1577   "@
1578    ldr\t%0,%1
1579    ld\t%0,%1
1580    ldy\t%0,%1
1581    std\t%1,%0
1582    stdy\t%1,%0
1583    lgr\t%0,%1
1584    lg\t%0,%1
1585    stg\t%1,%0
1586    mvc\t%O0(8,%R0),%1"
1587   [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1588    (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,cs")])
1590 (define_insn "*movdf_31"
1591   [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1592         (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1593   "!TARGET_64BIT"
1594   "@
1595    ldr\t%0,%1
1596    ld\t%0,%1
1597    ldy\t%0,%1
1598    std\t%1,%0
1599    stdy\t%1,%0
1600    lm\t%0,%N0,%1
1601    stm\t%1,%N1,%0
1602    #
1603    #
1604    mvc\t%O0(8,%R0),%1"
1605   [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,NN,NN,SS")
1606    (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,cs")])
1608 (define_split
1609   [(set (match_operand:DF 0 "nonimmediate_operand" "")
1610         (match_operand:DF 1 "general_operand" ""))]
1611   "!TARGET_64BIT && reload_completed
1612    && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1613   [(set (match_dup 2) (match_dup 4))
1614    (set (match_dup 3) (match_dup 5))]
1616   operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1617   operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1618   operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1619   operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1622 (define_split
1623   [(set (match_operand:DF 0 "nonimmediate_operand" "")
1624         (match_operand:DF 1 "general_operand" ""))]
1625   "!TARGET_64BIT && reload_completed
1626    && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1627   [(set (match_dup 2) (match_dup 4))
1628    (set (match_dup 3) (match_dup 5))]
1630   operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1631   operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1632   operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1633   operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1636 (define_split
1637   [(set (match_operand:DF 0 "register_operand" "")
1638         (match_operand:DF 1 "memory_operand" ""))]
1639   "!TARGET_64BIT && reload_completed
1640    && !FP_REG_P (operands[0])
1641    && !s_operand (operands[1], VOIDmode)"
1642   [(set (match_dup 0) (match_dup 1))]
1644   rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1645   s390_load_address (addr, XEXP (operands[1], 0));
1646   operands[1] = replace_equiv_address (operands[1], addr);
1649 (define_expand "reload_outdf"
1650   [(parallel [(match_operand:DF 0 "memory_operand" "")
1651               (match_operand:DF 1 "register_operand" "d")
1652               (match_operand:SI 2 "register_operand" "=&a")])]
1653   "!TARGET_64BIT"
1655   s390_load_address (operands[2], XEXP (operands[0], 0));
1656   operands[0] = replace_equiv_address (operands[0], operands[2]);
1657   emit_move_insn (operands[0], operands[1]);
1658   DONE;
1662 ; movsf instruction pattern(s).
1665 (define_expand "movsf"
1666   [(set (match_operand:SF 0 "nonimmediate_operand" "")
1667         (match_operand:SF 1 "general_operand"  ""))]
1668   ""
1670   /* During and after reload, we need to force constants
1671      to the literal pool ourselves, if necessary.  */
1672   if ((reload_in_progress || reload_completed)
1673       && CONSTANT_P (operands[1]))
1674     operands[1] = force_const_mem (SFmode, operands[1]);
1677 (define_insn "*movsf"
1678   [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1679         (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1680   ""
1681   "@
1682    ler\t%0,%1
1683    le\t%0,%1
1684    ley\t%0,%1
1685    ste\t%1,%0
1686    stey\t%1,%0
1687    lr\t%0,%1
1688    l\t%0,%1
1689    ly\t%0,%1
1690    st\t%1,%0
1691    sty\t%1,%0
1692    mvc\t%O0(4,%R0),%1"
1693   [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1694    (set_attr "type" "floads,floads,floads,fstores,fstores,lr,load,load,store,store,cs")])
1697 ; load_multiple pattern(s).
1699 ; ??? Due to reload problems with replacing registers inside match_parallel
1700 ; we currently support load_multiple/store_multiple only after reload.
1703 (define_expand "load_multiple"
1704   [(match_par_dup 3 [(set (match_operand 0 "" "")
1705                           (match_operand 1 "" ""))
1706                      (use (match_operand 2 "" ""))])]
1707   "reload_completed"
1709   enum machine_mode mode;
1710   int regno;
1711   int count;
1712   rtx from;
1713   int i, off;
1715   /* Support only loading a constant number of fixed-point registers from
1716      memory and only bother with this if more than two */
1717   if (GET_CODE (operands[2]) != CONST_INT
1718       || INTVAL (operands[2]) < 2
1719       || INTVAL (operands[2]) > 16
1720       || GET_CODE (operands[1]) != MEM
1721       || GET_CODE (operands[0]) != REG
1722       || REGNO (operands[0]) >= 16)
1723     FAIL;
1725   count = INTVAL (operands[2]);
1726   regno = REGNO (operands[0]);
1727   mode = GET_MODE (operands[0]);
1728   if (mode != SImode && mode != word_mode)
1729     FAIL;
1731   operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1732   if (no_new_pseudos)
1733     {
1734       if (GET_CODE (XEXP (operands[1], 0)) == REG)
1735         {
1736           from = XEXP (operands[1], 0);
1737           off = 0;
1738         }
1739       else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1740                && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1741                && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1742         {
1743           from = XEXP (XEXP (operands[1], 0), 0);
1744           off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1745         }
1746       else
1747         FAIL;
1749       if (from == frame_pointer_rtx || from == arg_pointer_rtx)
1750         FAIL;
1751     }
1752   else
1753     {
1754       from = force_reg (Pmode, XEXP (operands[1], 0));
1755       off = 0;
1756     }
1758   for (i = 0; i < count; i++)
1759     XVECEXP (operands[3], 0, i)
1760       = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1761                      change_address (operands[1], mode,
1762                        plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1765 (define_insn "*load_multiple_di"
1766   [(match_parallel 0 "load_multiple_operation"
1767                    [(set (match_operand:DI 1 "register_operand" "=r")
1768                          (match_operand:DI 2 "s_operand" "QS"))])]
1769   "reload_completed && word_mode == DImode"
1771   int words = XVECLEN (operands[0], 0);
1772   operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1773   return "lmg\t%1,%0,%2";
1775    [(set_attr "op_type" "RSY")
1776     (set_attr "type"    "lm")])
1778 (define_insn "*load_multiple_si"
1779   [(match_parallel 0 "load_multiple_operation"
1780                    [(set (match_operand:SI 1 "register_operand" "=r,r")
1781                          (match_operand:SI 2 "s_operand" "Q,S"))])]
1782   "reload_completed"
1784   int words = XVECLEN (operands[0], 0);
1785   operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1786   return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1788    [(set_attr "op_type" "RS,RSY")
1789     (set_attr "type"    "lm")])
1792 ; store multiple pattern(s).
1795 (define_expand "store_multiple"
1796   [(match_par_dup 3 [(set (match_operand 0 "" "")
1797                           (match_operand 1 "" ""))
1798                      (use (match_operand 2 "" ""))])]
1799   "reload_completed"
1801   enum machine_mode mode;
1802   int regno;
1803   int count;
1804   rtx to;
1805   int i, off;
1807   /* Support only storing a constant number of fixed-point registers to
1808      memory and only bother with this if more than two.  */
1809   if (GET_CODE (operands[2]) != CONST_INT
1810       || INTVAL (operands[2]) < 2
1811       || INTVAL (operands[2]) > 16
1812       || GET_CODE (operands[0]) != MEM
1813       || GET_CODE (operands[1]) != REG
1814       || REGNO (operands[1]) >= 16)
1815     FAIL;
1817   count = INTVAL (operands[2]);
1818   regno = REGNO (operands[1]);
1819   mode = GET_MODE (operands[1]);
1820   if (mode != SImode && mode != word_mode)
1821     FAIL;
1823   operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1825   if (no_new_pseudos)
1826     {
1827       if (GET_CODE (XEXP (operands[0], 0)) == REG)
1828         {
1829           to = XEXP (operands[0], 0);
1830           off = 0;
1831         }
1832       else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1833                && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1834                && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1835         {
1836           to = XEXP (XEXP (operands[0], 0), 0);
1837           off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1838         }
1839       else
1840         FAIL;
1842       if (to == frame_pointer_rtx || to == arg_pointer_rtx)
1843         FAIL;
1844     }
1845   else
1846     {
1847       to = force_reg (Pmode, XEXP (operands[0], 0));
1848       off = 0;
1849     }
1851   for (i = 0; i < count; i++)
1852     XVECEXP (operands[3], 0, i)
1853       = gen_rtx_SET (VOIDmode,
1854                      change_address (operands[0], mode,
1855                        plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1856                      gen_rtx_REG (mode, regno + i));
1859 (define_insn "*store_multiple_di"
1860   [(match_parallel 0 "store_multiple_operation"
1861                    [(set (match_operand:DI 1 "s_operand" "=QS")
1862                          (match_operand:DI 2 "register_operand" "r"))])]
1863   "reload_completed && word_mode == DImode"
1865   int words = XVECLEN (operands[0], 0);
1866   operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1867   return "stmg\t%2,%0,%1";
1869    [(set_attr "op_type" "RSY")
1870     (set_attr "type"    "stm")])
1873 (define_insn "*store_multiple_si"
1874   [(match_parallel 0 "store_multiple_operation"
1875                    [(set (match_operand:SI 1 "s_operand" "=Q,S")
1876                          (match_operand:SI 2 "register_operand" "r,r"))])]
1877   "reload_completed"
1879   int words = XVECLEN (operands[0], 0);
1880   operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1881   return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1883    [(set_attr "op_type" "RS,RSY")
1884     (set_attr "type"    "stm")])
1887 ;; String instructions.
1891 ; strlenM instruction pattern(s).
1894 (define_expand "strlendi"
1895   [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1896    (parallel 
1897     [(set (match_dup 4)
1898           (unspec:DI [(const_int 0)
1899                       (match_operand:BLK 1 "memory_operand" "")
1900                       (reg:QI 0)
1901                       (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1902      (clobber (scratch:DI))
1903      (clobber (reg:CC 33))])
1904    (parallel
1905     [(set (match_operand:DI 0 "register_operand" "")
1906           (minus:DI (match_dup 4) (match_dup 5)))
1907      (clobber (reg:CC 33))])]
1908   "TARGET_64BIT"
1910   operands[4] = gen_reg_rtx (DImode);
1911   operands[5] = gen_reg_rtx (DImode);
1912   emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1913   operands[1] = replace_equiv_address (operands[1], operands[5]);
1916 (define_insn "*strlendi"
1917   [(set (match_operand:DI 0 "register_operand" "=a")
1918         (unspec:DI [(match_operand:DI 2 "general_operand" "0")
1919                     (mem:BLK (match_operand:DI 3 "register_operand" "1"))
1920                     (reg:QI 0)
1921                     (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1922    (clobber (match_scratch:DI 1 "=a"))
1923    (clobber (reg:CC 33))]
1924   "TARGET_64BIT"
1925   "srst\t%0,%1\;jo\t.-4"
1926   [(set_attr "op_type" "NN")
1927    (set_attr "type"    "vs")
1928    (set_attr "length"  "8")])
1930 (define_expand "strlensi"
1931   [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1932    (parallel 
1933     [(set (match_dup 4)
1934           (unspec:SI [(const_int 0)
1935                       (match_operand:BLK 1 "memory_operand" "")
1936                       (reg:QI 0)
1937                       (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1938      (clobber (scratch:SI))
1939      (clobber (reg:CC 33))])
1940    (parallel
1941     [(set (match_operand:SI 0 "register_operand" "")
1942           (minus:SI (match_dup 4) (match_dup 5)))
1943      (clobber (reg:CC 33))])]
1944   "!TARGET_64BIT"
1946   operands[4] = gen_reg_rtx (SImode);
1947   operands[5] = gen_reg_rtx (SImode);
1948   emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1949   operands[1] = replace_equiv_address (operands[1], operands[5]);
1952 (define_insn "*strlensi"
1953   [(set (match_operand:SI 0 "register_operand" "=a")
1954         (unspec:SI [(match_operand:SI 2 "general_operand" "0")
1955                     (mem:BLK (match_operand:SI 3 "register_operand" "1"))
1956                     (reg:QI 0)
1957                     (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1958    (clobber (match_scratch:SI 1 "=a"))
1959    (clobber (reg:CC 33))]       
1960   "!TARGET_64BIT"
1961   "srst\t%0,%1\;jo\t.-4"
1962   [(set_attr "op_type" "NN")
1963    (set_attr "type"    "vs")
1964    (set_attr "length"  "8")])
1967 ; movstrM instruction pattern(s).
1970 (define_expand "movstrdi"
1971   [(set (match_operand:BLK 0 "memory_operand" "")
1972         (match_operand:BLK 1 "memory_operand" ""))
1973    (use (match_operand:DI 2 "general_operand" ""))
1974    (match_operand 3 "" "")]
1975   "TARGET_64BIT"
1976   "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1978 (define_expand "movstrsi"
1979   [(set (match_operand:BLK 0 "memory_operand" "")
1980         (match_operand:BLK 1 "memory_operand" ""))
1981    (use (match_operand:SI 2 "general_operand" ""))
1982    (match_operand 3 "" "")]
1983   ""
1984   "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1986 ; Move a block that is up to 256 bytes in length.
1987 ; The block length is taken as (operands[2] % 256) + 1.
1989 (define_expand "movstr_short"
1990   [(parallel
1991     [(set (match_operand:BLK 0 "memory_operand" "")
1992           (match_operand:BLK 1 "memory_operand" ""))
1993      (use (match_operand 2 "nonmemory_operand" ""))
1994      (clobber (match_dup 3))])]
1995   ""
1996   "operands[3] = gen_rtx_SCRATCH (Pmode);")
1998 (define_insn "*movstr_short"
1999   [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
2000         (match_operand:BLK 1 "memory_operand" "Q,Q"))
2001    (use (match_operand 2 "nonmemory_operand" "n,a"))
2002    (clobber (match_scratch 3 "=X,&a"))]
2003   "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2004    && GET_MODE (operands[3]) == Pmode"
2006   switch (which_alternative)
2007     {
2008       case 0:
2009         return "mvc\t%O0(%b2+1,%R0),%1";
2011       case 1:
2012         output_asm_insn ("bras\t%3,.+10", operands);
2013         output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
2014         return "ex\t%2,0(%3)";
2016       default:
2017         abort ();
2018     }
2020   [(set_attr "op_type" "SS,NN")
2021    (set_attr "type"    "cs,cs")
2022    (set_attr "atype"   "*,agen")
2023    (set_attr "length"  "*,14")])
2025 ; Move a block of arbitrary length.
2027 (define_expand "movstr_long"
2028   [(parallel
2029     [(clobber (match_dup 2))
2030      (clobber (match_dup 3))
2031      (set (match_operand:BLK 0 "memory_operand" "")
2032           (match_operand:BLK 1 "memory_operand" ""))
2033      (use (match_operand 2 "general_operand" ""))
2034      (use (match_dup 3))
2035      (clobber (reg:CC 33))])]
2036   ""
2038   enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2039   rtx reg0 = gen_reg_rtx (dword_mode);
2040   rtx reg1 = gen_reg_rtx (dword_mode);
2041   rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2042   rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2043   rtx len0 = gen_lowpart (Pmode, reg0);
2044   rtx len1 = gen_lowpart (Pmode, reg1);
2046   emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2047   emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2048   emit_move_insn (len0, operands[2]);
2050   emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2051   emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2052   emit_move_insn (len1, operands[2]);
2054   operands[0] = replace_equiv_address_nv (operands[0], addr0);
2055   operands[1] = replace_equiv_address_nv (operands[1], addr1);
2056   operands[2] = reg0;
2057   operands[3] = reg1;
2060 (define_insn "*movstr_long_64"
2061   [(clobber (match_operand:TI 0 "register_operand" "=d"))
2062    (clobber (match_operand:TI 1 "register_operand" "=d"))
2063    (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2064         (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
2065    (use (match_dup 2))
2066    (use (match_dup 3))
2067    (clobber (reg:CC 33))]
2068   "TARGET_64BIT"
2069   "mvcle\t%0,%1,0\;jo\t.-4"
2070   [(set_attr "op_type" "NN")
2071    (set_attr "type"    "vs")
2072    (set_attr "length"  "8")])
2074 (define_insn "*movstr_long_31"
2075   [(clobber (match_operand:DI 0 "register_operand" "=d"))
2076    (clobber (match_operand:DI 1 "register_operand" "=d"))
2077    (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2078         (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
2079    (use (match_dup 2))
2080    (use (match_dup 3))
2081    (clobber (reg:CC 33))]
2082   "!TARGET_64BIT"
2083   "mvcle\t%0,%1,0\;jo\t.-4"
2084   [(set_attr "op_type" "NN")
2085    (set_attr "type"    "vs")
2086    (set_attr "length"  "8")])
2089 ; clrstrM instruction pattern(s).
2092 (define_expand "clrstrdi"
2093   [(set (match_operand:BLK 0 "memory_operand" "")
2094         (const_int 0))
2095    (use (match_operand:DI 1 "general_operand" ""))
2096    (match_operand 2 "" "")]
2097   "TARGET_64BIT"
2098   "s390_expand_clrstr (operands[0], operands[1]); DONE;")
2100 (define_expand "clrstrsi"
2101   [(set (match_operand:BLK 0 "memory_operand" "")
2102         (const_int 0))
2103    (use (match_operand:SI 1 "general_operand" ""))
2104    (match_operand 2 "" "")]
2105   ""
2106   "s390_expand_clrstr (operands[0], operands[1]); DONE;")
2108 ; Clear a block that is up to 256 bytes in length.
2109 ; The block length is taken as (operands[1] % 256) + 1.
2111 (define_expand "clrstr_short"
2112   [(parallel
2113     [(set (match_operand:BLK 0 "memory_operand" "")
2114           (const_int 0))
2115      (use (match_operand 1 "nonmemory_operand" ""))
2116      (clobber (match_dup 2))
2117      (clobber (reg:CC 33))])]
2118   ""
2119   "operands[2] = gen_rtx_SCRATCH (Pmode);")
2121 (define_insn "*clrstr_short"
2122   [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
2123         (const_int 0))
2124    (use (match_operand 1 "nonmemory_operand" "n,a"))
2125    (clobber (match_scratch 2 "=X,&a"))
2126    (clobber (reg:CC 33))]
2127   "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
2128    && GET_MODE (operands[2]) == Pmode"
2130   switch (which_alternative)
2131     {
2132       case 0:
2133         return "xc\t%O0(%b1+1,%R0),%0";
2135       case 1:
2136         output_asm_insn ("bras\t%2,.+10", operands);
2137         output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
2138         return "ex\t%1,0(%2)";
2140       default:
2141         abort ();
2142     }
2144   [(set_attr "op_type" "SS,NN")
2145    (set_attr "type"    "cs,cs")
2146    (set_attr "atype"   "*,agen")
2147    (set_attr "length"  "*,14")])
2149 ; Clear a block of arbitrary length.
2151 (define_expand "clrstr_long"
2152   [(parallel
2153     [(clobber (match_dup 1))
2154      (set (match_operand:BLK 0 "memory_operand" "")
2155           (const_int 0))
2156      (use (match_operand 1 "general_operand" ""))
2157      (use (match_dup 2))
2158      (clobber (reg:CC 33))])]
2159   ""
2161   enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2162   rtx reg0 = gen_reg_rtx (dword_mode);
2163   rtx reg1 = gen_reg_rtx (dword_mode);
2164   rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2165   rtx len0 = gen_lowpart (Pmode, reg0);
2167   emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2168   emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2169   emit_move_insn (len0, operands[1]);
2171   emit_move_insn (reg1, const0_rtx);
2173   operands[0] = replace_equiv_address_nv (operands[0], addr0);
2174   operands[1] = reg0;
2175   operands[2] = reg1;
2178 (define_insn "*clrstr_long_64"
2179   [(clobber (match_operand:TI 0 "register_operand" "=d"))
2180    (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2181         (const_int 0))
2182    (use (match_dup 2))
2183    (use (match_operand:TI 1 "register_operand" "d"))
2184    (clobber (reg:CC 33))]
2185   "TARGET_64BIT"
2186   "mvcle\t%0,%1,0\;jo\t.-4"
2187   [(set_attr "op_type" "NN")
2188    (set_attr "type"    "vs")
2189    (set_attr "length"  "8")])
2191 (define_insn "*clrstr_long_31"
2192   [(clobber (match_operand:DI 0 "register_operand" "=d"))
2193    (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2194         (const_int 0))
2195    (use (match_dup 2))
2196    (use (match_operand:DI 1 "register_operand" "d"))
2197    (clobber (reg:CC 33))]
2198   "!TARGET_64BIT"
2199   "mvcle\t%0,%1,0\;jo\t.-4"
2200   [(set_attr "op_type" "NN")
2201    (set_attr "type"    "vs")
2202    (set_attr "length"  "8")])
2205 ; cmpmemM instruction pattern(s).
2208 (define_expand "cmpmemdi"
2209   [(set (match_operand:DI 0 "register_operand" "")
2210         (compare:DI (match_operand:BLK 1 "memory_operand" "")
2211                     (match_operand:BLK 2 "memory_operand" "") ) )
2212    (use (match_operand:DI 3 "general_operand" ""))
2213    (use (match_operand:DI 4 "" ""))]
2214   "TARGET_64BIT"
2215   "s390_expand_cmpmem (operands[0], operands[1],
2216                        operands[2], operands[3]); DONE;")
2218 (define_expand "cmpmemsi"
2219   [(set (match_operand:SI 0 "register_operand" "")
2220         (compare:SI (match_operand:BLK 1 "memory_operand" "")
2221                     (match_operand:BLK 2 "memory_operand" "") ) )
2222    (use (match_operand:SI 3 "general_operand" ""))
2223    (use (match_operand:SI 4 "" ""))]
2224   ""
2225   "s390_expand_cmpmem (operands[0], operands[1],
2226                        operands[2], operands[3]); DONE;")
2228 ; Compare a block that is up to 256 bytes in length.
2229 ; The block length is taken as (operands[2] % 256) + 1.
2231 (define_expand "cmpmem_short"
2232   [(parallel
2233     [(set (reg:CCS 33)
2234           (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2235                        (match_operand:BLK 1 "memory_operand" "")))
2236      (use (match_operand 2 "nonmemory_operand" ""))
2237      (clobber (match_dup 3))])]
2238   ""
2239   "operands[3] = gen_rtx_SCRATCH (Pmode);")
2241 (define_insn "*cmpmem_short"
2242   [(set (reg:CCS 33)
2243         (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2244                      (match_operand:BLK 1 "memory_operand" "Q,Q")))
2245    (use (match_operand 2 "nonmemory_operand" "n,a"))
2246    (clobber (match_scratch 3 "=X,&a"))]
2247   "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2248    && GET_MODE (operands[3]) == Pmode"
2250   switch (which_alternative)
2251     {
2252       case 0:
2253         return "clc\t%O0(%b2+1,%R0),%1";
2255       case 1:
2256         output_asm_insn ("bras\t%3,.+10", operands);
2257         output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2258         return "ex\t%2,0(%3)";
2260       default:
2261         abort ();
2262     }
2264   [(set_attr "op_type" "SS,NN")
2265    (set_attr "type"    "cs,cs")
2266    (set_attr "atype"   "*,agen")
2267    (set_attr "length"  "*,14")])
2269 ; Compare a block of arbitrary length.
2271 (define_expand "cmpmem_long"
2272   [(parallel
2273     [(clobber (match_dup 2))
2274      (clobber (match_dup 3))
2275      (set (reg:CCS 33)
2276           (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2277                        (match_operand:BLK 1 "memory_operand" "")))
2278      (use (match_operand 2 "general_operand" ""))
2279      (use (match_dup 3))])]
2280   ""
2282   enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2283   rtx reg0 = gen_reg_rtx (dword_mode);
2284   rtx reg1 = gen_reg_rtx (dword_mode);
2285   rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2286   rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2287   rtx len0 = gen_lowpart (Pmode, reg0);
2288   rtx len1 = gen_lowpart (Pmode, reg1);
2290   emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2291   emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2292   emit_move_insn (len0, operands[2]);
2294   emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2295   emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2296   emit_move_insn (len1, operands[2]);
2298   operands[0] = replace_equiv_address_nv (operands[0], addr0);
2299   operands[1] = replace_equiv_address_nv (operands[1], addr1);
2300   operands[2] = reg0;
2301   operands[3] = reg1;
2304 (define_insn "*cmpmem_long_64"
2305   [(clobber (match_operand:TI 0 "register_operand" "=d"))
2306    (clobber (match_operand:TI 1 "register_operand" "=d"))
2307    (set (reg:CCS 33)
2308         (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2309                      (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2310    (use (match_dup 2))
2311    (use (match_dup 3))]
2312   "TARGET_64BIT"
2313   "clcle\t%0,%1,0\;jo\t.-4"
2314   [(set_attr "op_type" "NN")
2315    (set_attr "type"    "vs")
2316    (set_attr "length"  "8")])
2318 (define_insn "*cmpmem_long_31"
2319   [(clobber (match_operand:DI 0 "register_operand" "=d"))
2320    (clobber (match_operand:DI 1 "register_operand" "=d"))
2321    (set (reg:CCS 33)
2322         (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2323                      (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2324    (use (match_dup 2))
2325    (use (match_dup 3))]
2326   "!TARGET_64BIT"
2327   "clcle\t%0,%1,0\;jo\t.-4"
2328   [(set_attr "op_type" "NN")
2329    (set_attr "type"    "vs")
2330    (set_attr "length"  "8")])
2332 ; Convert condition code to integer in range (-1, 0, 1)
2334 (define_insn "cmpint_si"
2335   [(set (match_operand:SI 0 "register_operand" "=d")
2336         (compare:SI (reg:CCS 33) (const_int 0)))]
2337   ""
2339    output_asm_insn ("lhi\t%0,1", operands);
2340    output_asm_insn ("jh\t.+12", operands);
2341    output_asm_insn ("jl\t.+6", operands);
2342    output_asm_insn ("sr\t%0,%0", operands);
2343    return "lcr\t%0,%0";
2345   [(set_attr "op_type" "NN")
2346    (set_attr "length"  "16")
2347    (set_attr "type"    "other")])
2349 (define_insn "cmpint_di"
2350   [(set (match_operand:DI 0 "register_operand" "=d")
2351         (compare:DI (reg:CCS 33) (const_int 0)))]
2352   "TARGET_64BIT"
2354    output_asm_insn ("lghi\t%0,1", operands);
2355    output_asm_insn ("jh\t.+16", operands);
2356    output_asm_insn ("jl\t.+8", operands);
2357    output_asm_insn ("sgr\t%0,%0", operands);
2358    return "lcgr\t%0,%0";
2360   [(set_attr "op_type" "NN")
2361    (set_attr "length"  "20")
2362    (set_attr "type"    "other")])
2366 ;;- Conversion instructions.
2369 (define_insn "*sethighqisi"
2370   [(set (match_operand:SI 0 "register_operand" "=d,d")
2371         (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2372    (clobber (reg:CC 33))]
2373   ""
2374   "@
2375    icm\t%0,8,%1
2376    icmy\t%0,8,%1"
2377   [(set_attr "op_type" "RS,RSY")])
2379 (define_insn "*sethighhisi"
2380   [(set (match_operand:SI 0 "register_operand" "=d,d")
2381         (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2382    (clobber (reg:CC 33))]
2383   ""
2384   "@
2385    icm\t%0,12,%1
2386    icmy\t%0,12,%1"
2387   [(set_attr "op_type" "RS,RSY")])
2389 (define_insn "*sethighqidi_64"
2390   [(set (match_operand:DI 0 "register_operand" "=d")
2391         (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2392    (clobber (reg:CC 33))]
2393   "TARGET_64BIT"
2394   "icmh\t%0,8,%1"
2395   [(set_attr "op_type" "RSY")])
2397 (define_insn "*sethighqidi_31"
2398   [(set (match_operand:DI 0 "register_operand" "=d,d")
2399         (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2400    (clobber (reg:CC 33))]
2401   "!TARGET_64BIT"
2402   "@
2403    icm\t%0,8,%1
2404    icmy\t%0,8,%1"
2405   [(set_attr "op_type" "RS,RSY")])
2407 (define_insn_and_split "*extractqi"
2408   [(set (match_operand:SI 0 "register_operand" "=d")
2409         (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2410                          (match_operand 2 "const_int_operand" "n")
2411                          (const_int 0)))
2412    (clobber (reg:CC 33))]
2413   "!TARGET_64BIT
2414    && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2415   "#"
2416   "&& reload_completed"
2417   [(parallel
2418     [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2419      (clobber (reg:CC 33))])
2420     (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2422   operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2423   operands[1] = change_address (operands[1], QImode, 0);
2425   [(set_attr "atype"   "agen")])
2427 (define_insn_and_split "*extracthi"
2428   [(set (match_operand:SI 0 "register_operand" "=d")
2429         (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2430                          (match_operand 2 "const_int_operand" "n")
2431                          (const_int 0)))
2432    (clobber (reg:CC 33))]
2433   "!TARGET_64BIT
2434    && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2435   "#"
2436   "&& reload_completed"
2437   [(parallel
2438     [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2439      (clobber (reg:CC 33))])
2440     (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2442   operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2443   operands[1] = change_address (operands[1], HImode, 0);
2445   [(set_attr "atype"   "agen")])
2448 ; extendsidi2 instruction pattern(s).
2451 (define_expand "extendsidi2"
2452   [(set (match_operand:DI 0 "register_operand" "")
2453         (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2454   ""
2455   "
2457   if (!TARGET_64BIT)
2458     {
2459       emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2460       emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2461       emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2462       emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2463       DONE;
2464     }
2468 (define_insn "*extendsidi2"
2469   [(set (match_operand:DI 0 "register_operand" "=d,d")
2470         (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2471   "TARGET_64BIT"
2472   "@
2473    lgfr\t%0,%1
2474    lgf\t%0,%1"
2475   [(set_attr "op_type" "RRE,RXY")])
2478 ; extendhidi2 instruction pattern(s).
2481 (define_expand "extendhidi2"
2482   [(set (match_operand:DI 0 "register_operand" "")
2483         (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2484   ""
2485   "
2487   if (!TARGET_64BIT)
2488     {
2489       rtx tmp = gen_reg_rtx (SImode);
2490       emit_insn (gen_extendhisi2 (tmp, operands[1]));
2491       emit_insn (gen_extendsidi2 (operands[0], tmp));
2492       DONE;
2493     }
2494   else
2495     {
2496       operands[1] = gen_lowpart (DImode, operands[1]);
2497       emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2498       emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2499       DONE;
2500     }
2504 (define_insn "*extendhidi2"
2505   [(set (match_operand:DI 0 "register_operand" "=d")
2506         (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2507   "TARGET_64BIT"
2508   "lgh\t%0,%1"
2509   [(set_attr "op_type" "RXY")])
2512 ; extendqidi2 instruction pattern(s).
2515 (define_expand "extendqidi2"
2516   [(set (match_operand:DI 0 "register_operand" "")
2517         (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2518   ""
2519   "
2521   if (!TARGET_64BIT)
2522     {
2523       rtx tmp = gen_reg_rtx (SImode);
2524       emit_insn (gen_extendqisi2 (tmp, operands[1]));
2525       emit_insn (gen_extendsidi2 (operands[0], tmp));
2526       DONE;
2527     }
2528   else
2529     {
2530       operands[1] = gen_lowpart (DImode, operands[1]);
2531       emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2532       emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2533       DONE;
2534     }
2538 (define_insn "*extendqidi2"
2539   [(set (match_operand:DI 0 "register_operand" "=d")
2540         (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2541   "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2542   "lgb\t%0,%1"
2543   [(set_attr "op_type" "RXY")])
2545 (define_insn_and_split "*extendqidi2_short_displ"
2546   [(set (match_operand:DI 0 "register_operand" "=d")
2547         (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))
2548    (clobber (reg:CC 33))]
2549   "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2550   "#"
2551   "&& reload_completed"
2552   [(parallel
2553     [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2554      (clobber (reg:CC 33))])
2555    (parallel
2556     [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2557      (clobber (reg:CC 33))])]
2558   "")
2561 ; extendhisi2 instruction pattern(s).
2564 (define_expand "extendhisi2"
2565   [(set (match_operand:SI 0 "register_operand" "")
2566         (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2567   ""
2568   "
2570   operands[1] = gen_lowpart (SImode, operands[1]);
2571   emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2572   emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2573   DONE;
2577 (define_insn "*extendhisi2"
2578   [(set (match_operand:SI 0 "register_operand" "=d,d")
2579         (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2580   ""
2581   "@
2582    lh\t%0,%1
2583    lhy\t%0,%1"
2584   [(set_attr "op_type" "RX,RXY")])
2587 ; extendqisi2 instruction pattern(s).
2590 (define_expand "extendqisi2"
2591   [(set (match_operand:SI 0 "register_operand" "")
2592         (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2593   ""
2594   "
2596   operands[1] = gen_lowpart (SImode, operands[1]);
2597   emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2598   emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2599   DONE;
2603 (define_insn "*extendqisi2"
2604   [(set (match_operand:SI 0 "register_operand" "=d")
2605         (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2606   "TARGET_LONG_DISPLACEMENT"
2607   "lb\t%0,%1"
2608   [(set_attr "op_type" "RXY")])
2610 (define_insn_and_split "*extendsiqi2_short_displ"
2611   [(set (match_operand:SI 0 "register_operand" "=d")
2612         (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))
2613    (clobber (reg:CC 33))]
2614   "!TARGET_LONG_DISPLACEMENT"
2615   "#"
2616   "&& reload_completed"
2617   [(parallel
2618     [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2619      (clobber (reg:CC 33))])
2620    (parallel
2621     [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2622      (clobber (reg:CC 33))])]
2623   "")
2626 ; extendqihi2 instruction pattern(s).
2631 ; zero_extendsidi2 instruction pattern(s).
2634 (define_expand "zero_extendsidi2"
2635   [(set (match_operand:DI 0 "register_operand" "")
2636         (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2637   ""
2638   "
2640   if (!TARGET_64BIT)
2641     {
2642       emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2643       emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2644       emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2645       DONE;
2646     }
2650 (define_insn "*zero_extendsidi2"
2651   [(set (match_operand:DI 0 "register_operand" "=d,d")
2652         (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2653   "TARGET_64BIT"
2654   "@
2655    llgfr\t%0,%1
2656    llgf\t%0,%1"
2657   [(set_attr "op_type" "RRE,RXY")])
2660 ; zero_extendhidi2 instruction pattern(s).
2663 (define_expand "zero_extendhidi2"
2664   [(set (match_operand:DI 0 "register_operand" "")
2665         (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2666   ""
2667   "
2669   if (!TARGET_64BIT)
2670     {
2671       rtx tmp = gen_reg_rtx (SImode);
2672       emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2673       emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2674       DONE;
2675     }
2676   else
2677     {
2678       operands[1] = gen_lowpart (DImode, operands[1]);
2679       emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2680       emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2681       DONE;
2682     }
2686 (define_insn "*zero_extendhidi2"
2687   [(set (match_operand:DI 0 "register_operand" "=d")
2688         (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2689   "TARGET_64BIT"
2690   "llgh\t%0,%1"
2691   [(set_attr "op_type" "RXY")])
2694 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2697 (define_insn "*llgt_sisi"
2698   [(set (match_operand:SI 0 "register_operand" "=d,d")
2699         (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2700                 (const_int 2147483647)))]
2701   "TARGET_64BIT"
2702   "@
2703    llgtr\t%0,%1
2704    llgt\t%0,%1"
2705   [(set_attr "op_type"  "RRE,RXE")])
2707 (define_split
2708   [(set (match_operand:SI 0 "register_operand" "")
2709         (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2710                 (const_int 2147483647)))
2711    (clobber (reg:CC 33))]
2712   "TARGET_64BIT && reload_completed"
2713   [(set (match_dup 0)
2714         (and:SI (match_dup 1)
2715                 (const_int 2147483647)))]
2716   "")
2718 (define_insn "*llgt_didi"
2719   [(set (match_operand:DI 0 "register_operand" "=d,d")
2720         (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2721                 (const_int 2147483647)))]
2722   "TARGET_64BIT"
2723   "@
2724    llgtr\t%0,%1
2725    llgt\t%0,%N1"
2726   [(set_attr "op_type"  "RRE,RXE")])
2728 (define_split
2729   [(set (match_operand:DI 0 "register_operand" "")
2730         (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
2731                 (const_int 2147483647)))
2732    (clobber (reg:CC 33))]
2733   "TARGET_64BIT && reload_completed"
2734   [(set (match_dup 0)
2735         (and:DI (match_dup 1)
2736                 (const_int 2147483647)))]
2737   "")
2739 (define_insn "*llgt_sidi"
2740   [(set (match_operand:DI 0 "register_operand" "=d")
2741         (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2742                 (const_int 2147483647)))]
2743   "TARGET_64BIT"
2744   "llgt\t%0,%1"
2745   [(set_attr "op_type"  "RXE")])
2747 (define_insn_and_split "*llgt_sidi_split"
2748   [(set (match_operand:DI 0 "register_operand" "=d")
2749         (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0) 
2750                 (const_int 2147483647)))
2751    (clobber (reg:CC 33))]
2752   "TARGET_64BIT"
2753   "#"
2754   "&& reload_completed"
2755   [(set (match_dup 0)
2756         (and:DI (subreg:DI (match_dup 1) 0) 
2757                 (const_int 2147483647)))]
2758   "")
2761 ; zero_extendqidi2 instruction pattern(s)
2764 (define_expand "zero_extendqidi2"
2765   [(set (match_operand:DI 0 "register_operand" "")
2766         (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2767   ""
2768   "
2770   if (!TARGET_64BIT)
2771     {
2772       rtx tmp = gen_reg_rtx (SImode);
2773       emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2774       emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2775       DONE;
2776     }
2777   else
2778     {
2779       operands[1] = gen_lowpart (DImode, operands[1]);
2780       emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2781       emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2782       DONE;
2783     }
2787 (define_insn "*zero_extendqidi2"
2788   [(set (match_operand:DI 0 "register_operand" "=d")
2789         (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2790   "TARGET_64BIT"
2791   "llgc\t%0,%1"
2792   [(set_attr "op_type" "RXY")])
2795 ; zero_extendhisi2 instruction pattern(s).
2798 (define_expand "zero_extendhisi2"
2799   [(set (match_operand:SI 0 "register_operand" "")
2800         (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2801   ""
2802   "
2804   operands[1] = gen_lowpart (SImode, operands[1]);
2805   emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2806   DONE;
2810 (define_insn "*zero_extendhisi2_64"
2811   [(set (match_operand:SI 0 "register_operand" "=d")
2812         (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2813   "TARGET_64BIT"
2814   "llgh\t%0,%1"
2815   [(set_attr "op_type" "RXY")])
2817 (define_insn_and_split "*zero_extendhisi2_31"
2818   [(set (match_operand:SI 0 "register_operand" "=&d")
2819         (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2820    (clobber (reg:CC 33))]
2821   "!TARGET_64BIT"
2822   "#"
2823   "&& reload_completed"
2824   [(set (match_dup 0) (const_int 0))
2825    (parallel
2826     [(set (strict_low_part (match_dup 2)) (match_dup 1))
2827      (clobber (reg:CC 33))])]
2828   "operands[2] = gen_lowpart (HImode, operands[0]);"
2829   [(set_attr "atype" "agen")])
2832 ; zero_extendqisi2 instruction pattern(s).
2835 (define_expand "zero_extendqisi2"
2836   [(set (match_operand:SI 0 "register_operand" "")
2837         (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2838   ""
2839   "
2841   operands[1] = gen_lowpart (SImode, operands[1]);
2842   emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2843   DONE;
2847 (define_insn "*zero_extendqisi2_64"
2848   [(set (match_operand:SI 0 "register_operand" "=d")
2849         (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2850   "TARGET_ZARCH"
2851   "llgc\t%0,%1"
2852   [(set_attr "op_type" "RXY")])
2854 (define_insn_and_split "*zero_extendqisi2_31"
2855   [(set (match_operand:SI 0 "register_operand" "=&d")
2856         (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2857   "!TARGET_ZARCH"
2858   "#"
2859   "&& reload_completed"
2860   [(set (match_dup 0) (const_int 0))
2861    (set (strict_low_part (match_dup 2)) (match_dup 1))]
2862   "operands[2] = gen_lowpart (QImode, operands[0]);"
2863   [(set_attr "atype" "agen")])
2866 ; zero_extendqihi2 instruction pattern(s).
2869 (define_expand "zero_extendqihi2"
2870   [(set (match_operand:HI 0 "register_operand" "")
2871         (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2872   "TARGET_ZARCH"
2873   "
2875   operands[1] = gen_lowpart (HImode, operands[1]);
2876   emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2877   DONE;
2881 (define_insn "*zero_extendqihi2_64"
2882   [(set (match_operand:HI 0 "register_operand" "=d")
2883         (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2884   "TARGET_ZARCH"
2885   "llgc\t%0,%1"
2886   [(set_attr "op_type" "RXY")])
2888 (define_insn_and_split "*zero_extendqihi2_31"
2889   [(set (match_operand:HI 0 "register_operand" "=&d")
2890         (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2891   "!TARGET_ZARCH"
2892   "#"
2893   "&& reload_completed"
2894   [(set (match_dup 0) (const_int 0))
2895    (set (strict_low_part (match_dup 2)) (match_dup 1))]
2896   "operands[2] = gen_lowpart (QImode, operands[0]);"
2897   [(set_attr "atype" "agen")])
2901 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2904 (define_expand "fixuns_truncdfdi2"
2905   [(set (match_operand:DI 0 "register_operand" "")
2906         (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2907   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2909   rtx label1 = gen_label_rtx ();
2910   rtx label2 = gen_label_rtx ();
2911   rtx temp = gen_reg_rtx (DFmode);
2912   operands[1] = force_reg (DFmode, operands[1]);
2914   emit_insn (gen_cmpdf (operands[1],
2915         CONST_DOUBLE_FROM_REAL_VALUE (
2916           REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2917   emit_jump_insn (gen_blt (label1));
2918   emit_insn (gen_subdf3 (temp, operands[1],
2919         CONST_DOUBLE_FROM_REAL_VALUE (
2920           REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2921   emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2922   emit_jump (label2);
2924   emit_label (label1);
2925   emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2926   emit_label (label2);
2927   DONE;
2930 (define_expand "fix_truncdfdi2"
2931   [(set (match_operand:DI 0 "register_operand" "")
2932         (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2933   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2935   operands[1] = force_reg (DFmode, operands[1]);
2936   emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2937   DONE;
2940 (define_insn "fix_truncdfdi2_ieee"
2941   [(set (match_operand:DI 0 "register_operand" "=d")
2942         (fix:DI (match_operand:DF 1 "register_operand" "f")))
2943    (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2944    (clobber (reg:CC 33))]
2945   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2946   "cgdbr\t%0,%h2,%1"
2947   [(set_attr "op_type" "RRE")
2948    (set_attr "type"    "ftoi")])
2951 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2954 (define_expand "fixuns_truncdfsi2"
2955   [(set (match_operand:SI 0 "register_operand" "")
2956         (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2957   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2959   rtx label1 = gen_label_rtx ();
2960   rtx label2 = gen_label_rtx ();
2961   rtx temp = gen_reg_rtx (DFmode);
2963   operands[1] = force_reg (DFmode,operands[1]);
2964   emit_insn (gen_cmpdf (operands[1],
2965         CONST_DOUBLE_FROM_REAL_VALUE (
2966           REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2967   emit_jump_insn (gen_blt (label1));
2968   emit_insn (gen_subdf3 (temp, operands[1],
2969         CONST_DOUBLE_FROM_REAL_VALUE (
2970           REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2971   emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2972   emit_jump (label2);
2974   emit_label (label1);
2975   emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2976   emit_label (label2);
2977   DONE;
2980 (define_expand "fix_truncdfsi2"
2981   [(set (match_operand:SI 0 "register_operand" "")
2982         (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2983   "TARGET_HARD_FLOAT"
2985   if (TARGET_IBM_FLOAT)
2986     {
2987       /* This is the algorithm from POP chapter A.5.7.2.  */
2989       rtx temp   = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2990       rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2991       rtx two32  = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2993       operands[1] = force_reg (DFmode, operands[1]);
2994       emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2995                                          two31r, two32, temp));
2996     }
2997   else
2998     {
2999       operands[1] = force_reg (DFmode, operands[1]);
3000       emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3001     }
3003   DONE;
3006 (define_insn "fix_truncdfsi2_ieee"
3007   [(set (match_operand:SI 0 "register_operand" "=d")
3008         (fix:SI (match_operand:DF 1 "register_operand" "f")))
3009     (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3010     (clobber (reg:CC 33))]
3011   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3012   "cfdbr\t%0,%h2,%1"
3013    [(set_attr "op_type" "RRE")
3014     (set_attr "type"    "other" )])
3016 (define_insn "fix_truncdfsi2_ibm"
3017   [(set (match_operand:SI 0 "register_operand" "=d")
3018         (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
3019    (use (match_operand:DI 2 "immediate_operand" "m"))
3020    (use (match_operand:DI 3 "immediate_operand" "m"))
3021    (use (match_operand:BLK 4 "memory_operand" "m"))
3022    (clobber (reg:CC 33))]
3023   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3025    output_asm_insn ("sd\t%1,%2", operands);
3026    output_asm_insn ("aw\t%1,%3", operands);
3027    output_asm_insn ("std\t%1,%4", operands);
3028    output_asm_insn ("xi\t%N4,128", operands);
3029    return "l\t%0,%N4";
3031   [(set_attr "op_type" "NN")
3032    (set_attr "type"    "ftoi")
3033    (set_attr "atype"   "agen")
3034    (set_attr "length"  "20")])
3037 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
3040 (define_expand "fixuns_truncsfdi2"
3041   [(set (match_operand:DI 0 "register_operand" "")
3042         (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
3043   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3045   rtx label1 = gen_label_rtx ();
3046   rtx label2 = gen_label_rtx ();
3047   rtx temp = gen_reg_rtx (SFmode);
3049   operands[1] = force_reg (SFmode, operands[1]);
3050   emit_insn (gen_cmpsf (operands[1],
3051         CONST_DOUBLE_FROM_REAL_VALUE (
3052           REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
3053   emit_jump_insn (gen_blt (label1));
3055   emit_insn (gen_subsf3 (temp, operands[1],
3056         CONST_DOUBLE_FROM_REAL_VALUE (
3057           REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
3058   emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
3059   emit_jump (label2);
3061   emit_label (label1);
3062   emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
3063   emit_label (label2);
3064   DONE;
3067 (define_expand "fix_truncsfdi2"
3068   [(set (match_operand:DI 0 "register_operand" "")
3069         (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
3070   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3072   operands[1] = force_reg (SFmode, operands[1]);
3073   emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
3074   DONE;
3077 (define_insn "fix_truncsfdi2_ieee"
3078   [(set (match_operand:DI 0 "register_operand" "=d")
3079         (fix:DI (match_operand:SF 1 "register_operand"  "f")))
3080    (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3081    (clobber (reg:CC 33))]
3082   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3083   "cgebr\t%0,%h2,%1"
3084   [(set_attr "op_type" "RRE")
3085    (set_attr "type"    "ftoi")])
3088 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
3091 (define_expand "fixuns_truncsfsi2"
3092   [(set (match_operand:SI 0 "register_operand" "")
3093         (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
3094   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3096   rtx label1 = gen_label_rtx ();
3097   rtx label2 = gen_label_rtx ();
3098   rtx temp = gen_reg_rtx (SFmode);
3100   operands[1] = force_reg (SFmode, operands[1]);
3101   emit_insn (gen_cmpsf (operands[1],
3102         CONST_DOUBLE_FROM_REAL_VALUE (
3103           REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
3104   emit_jump_insn (gen_blt (label1));
3105   emit_insn (gen_subsf3 (temp, operands[1],
3106         CONST_DOUBLE_FROM_REAL_VALUE (
3107           REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
3108   emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
3109   emit_jump (label2);
3111   emit_label (label1);
3112   emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3113   emit_label (label2);
3114   DONE;
3117 (define_expand "fix_truncsfsi2"
3118   [(set (match_operand:SI 0 "register_operand" "")
3119         (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
3120   "TARGET_HARD_FLOAT"
3122   if (TARGET_IBM_FLOAT)
3123     {
3124       /* Convert to DFmode and then use the POP algorithm.  */
3125       rtx temp = gen_reg_rtx (DFmode);
3126       emit_insn (gen_extendsfdf2 (temp, operands[1]));
3127       emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
3128     }
3129   else
3130     {
3131       operands[1] = force_reg (SFmode, operands[1]);
3132       emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3133     }
3135   DONE;
3138 (define_insn "fix_truncsfsi2_ieee"
3139   [(set (match_operand:SI 0 "register_operand" "=d")
3140         (fix:SI (match_operand:SF 1 "register_operand" "f")))
3141     (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3142     (clobber (reg:CC 33))]
3143   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3144   "cfebr\t%0,%h2,%1"
3145   [(set_attr "op_type" "RRE")
3146    (set_attr "type"    "ftoi")])
3149 ; floatdidf2 instruction pattern(s).
3152 (define_insn "floatdidf2"
3153   [(set (match_operand:DF 0 "register_operand" "=f")
3154         (float:DF (match_operand:DI 1 "register_operand" "d")))
3155    (clobber (reg:CC 33))]
3156   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3157   "cdgbr\t%0,%1"
3158   [(set_attr "op_type" "RRE")
3159    (set_attr "type"    "itof" )])
3162 ; floatdisf2 instruction pattern(s).
3165 (define_insn "floatdisf2"
3166   [(set (match_operand:SF 0 "register_operand" "=f")
3167         (float:SF (match_operand:DI 1 "register_operand" "d")))
3168    (clobber (reg:CC 33))]
3169   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3170   "cegbr\t%0,%1"
3171   [(set_attr "op_type" "RRE")
3172    (set_attr "type"    "itof" )])
3175 ; floatsidf2 instruction pattern(s).
3178 (define_expand "floatsidf2"
3179   [(parallel
3180     [(set (match_operand:DF 0 "register_operand" "")
3181           (float:DF (match_operand:SI 1 "register_operand" "")))
3182      (clobber (reg:CC 33))])]
3183   "TARGET_HARD_FLOAT"
3185   if (TARGET_IBM_FLOAT)
3186     {
3187       /* This is the algorithm from POP chapter A.5.7.1.  */
3189       rtx temp  = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3190       rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
3192       emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
3193       DONE;
3194     }
3197 (define_insn "floatsidf2_ieee"
3198   [(set (match_operand:DF 0 "register_operand" "=f")
3199         (float:DF (match_operand:SI 1 "register_operand"  "d")))
3200    (clobber (reg:CC 33))]
3201   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3202   "cdfbr\t%0,%1"
3203   [(set_attr "op_type" "RRE")
3204    (set_attr "type"   "itof" )])
3206 (define_insn "floatsidf2_ibm"
3207   [(set (match_operand:DF 0 "register_operand" "=f")
3208         (float:DF (match_operand:SI 1 "register_operand" "d")))
3209    (use (match_operand:DI 2 "immediate_operand" "m"))
3210    (use (match_operand:BLK 3 "memory_operand" "m"))
3211    (clobber (reg:CC 33))]
3212   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3214    output_asm_insn ("st\t%1,%N3", operands);
3215    output_asm_insn ("xi\t%N3,128", operands);
3216    output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3217    output_asm_insn ("ld\t%0,%3", operands);
3218    return "sd\t%0,%2";
3220   [(set_attr "op_type" "NN")
3221    (set_attr "type"    "other" )
3222    (set_attr "atype"   "agen")
3223    (set_attr "length"  "20")])
3226 ; floatsisf2 instruction pattern(s).
3229 (define_expand "floatsisf2"
3230   [(parallel
3231     [(set (match_operand:SF 0 "register_operand" "")
3232           (float:SF (match_operand:SI 1 "register_operand" "")))
3233      (clobber (reg:CC 33))])]
3234   "TARGET_HARD_FLOAT"
3236   if (TARGET_IBM_FLOAT)
3237     {
3238       /* Use the POP algorithm to convert to DFmode and then truncate.  */
3239       rtx temp = gen_reg_rtx (DFmode);
3240       emit_insn (gen_floatsidf2 (temp, operands[1]));
3241       emit_insn (gen_truncdfsf2 (operands[0], temp));
3242       DONE;
3243     }
3246 (define_insn "floatsisf2_ieee"
3247   [(set (match_operand:SF 0 "register_operand" "=f")
3248         (float:SF (match_operand:SI 1 "register_operand" "d")))
3249    (clobber (reg:CC 33))]
3250   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3251   "cefbr\t%0,%1"
3252   [(set_attr "op_type" "RRE")
3253    (set_attr "type"    "itof" )])
3256 ; truncdfsf2 instruction pattern(s).
3259 (define_expand "truncdfsf2"
3260   [(set (match_operand:SF 0 "register_operand" "")
3261         (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3262   "TARGET_HARD_FLOAT"
3263   "")
3265 (define_insn "truncdfsf2_ieee"
3266   [(set (match_operand:SF 0 "register_operand" "=f")
3267         (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3268   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3269   "ledbr\t%0,%1"
3270   [(set_attr "op_type"  "RRE")])
3272 (define_insn "truncdfsf2_ibm"
3273   [(set (match_operand:SF 0 "register_operand" "=f,f")
3274         (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3275   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3276   "@
3277    lrer\t%0,%1
3278    le\t%0,%1"
3279   [(set_attr "op_type"  "RR,RX")
3280    (set_attr "type"   "floads,floads")])
3283 ; extendsfdf2 instruction pattern(s).
3286 (define_expand "extendsfdf2"
3287   [(set (match_operand:DF 0 "register_operand" "")
3288         (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3289   "TARGET_HARD_FLOAT"
3291   if (TARGET_IBM_FLOAT)
3292     {
3293       emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3294       DONE;
3295     }
3298 (define_insn "extendsfdf2_ieee"
3299   [(set (match_operand:DF 0 "register_operand" "=f,f")
3300         (float_extend:DF (match_operand:SF 1 "nonimmediate_operand"  "f,R")))]
3301   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3302   "@
3303    ldebr\t%0,%1
3304    ldeb\t%0,%1"
3305   [(set_attr "op_type"  "RRE,RXE")
3306    (set_attr "type"   "floads,floads")])
3308 (define_insn "extendsfdf2_ibm"
3309   [(set (match_operand:DF 0 "register_operand" "=f,f")
3310         (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3311    (clobber (reg:CC 33))]
3312   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3313   "@
3314    sdr\t%0,%0\;ler\t%0,%1
3315    sdr\t%0,%0\;le\t%0,%1"
3316   [(set_attr "op_type"  "NN,NN")
3317    (set_attr "atype"    "reg,agen")
3318    (set_attr "length"   "4,6")
3319    (set_attr "type"     "o2,o2")])
3323 ;; ARITHMETIC OPERATIONS
3325 ;  arithmetic operations set the ConditionCode,
3326 ;  because of unpredictable Bits in Register for Halfword and Byte
3327 ;  the ConditionCode can be set wrong in operations for Halfword and Byte
3330 ;;- Add instructions.
3334 ; adddi3 instruction pattern(s).
3337 (define_insn "*adddi3_sign"
3338   [(set (match_operand:DI 0 "register_operand" "=d,d")
3339         (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3340                  (match_operand:DI 1 "register_operand" "0,0")))
3341    (clobber (reg:CC 33))]
3342   "TARGET_64BIT"
3343   "@
3344    agfr\t%0,%2
3345    agf\t%0,%2"
3346   [(set_attr "op_type"  "RRE,RXY")])
3348 (define_insn "*adddi3_zero_cc"
3349   [(set (reg 33)
3350         (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3351                           (match_operand:DI 1 "register_operand" "0,0"))
3352                  (const_int 0)))
3353    (set (match_operand:DI 0 "register_operand" "=d,d")
3354         (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3355   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3356   "@
3357    algfr\t%0,%2
3358    algf\t%0,%2"
3359   [(set_attr "op_type"  "RRE,RXY")])
3361 (define_insn "*adddi3_zero_cconly"
3362   [(set (reg 33)
3363         (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3364                           (match_operand:DI 1 "register_operand" "0,0"))
3365                  (const_int 0)))
3366    (clobber (match_scratch:DI 0 "=d,d"))]
3367   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3368   "@
3369    algfr\t%0,%2
3370    algf\t%0,%2"
3371   [(set_attr "op_type"  "RRE,RXY")])
3373 (define_insn "*adddi3_zero"
3374   [(set (match_operand:DI 0 "register_operand" "=d,d")
3375         (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3376                  (match_operand:DI 1 "register_operand" "0,0")))
3377    (clobber (reg:CC 33))]
3378   "TARGET_64BIT"
3379   "@
3380    algfr\t%0,%2
3381    algf\t%0,%2"
3382   [(set_attr "op_type"  "RRE,RXY")])
3384 (define_insn "*adddi3_imm_cc"
3385   [(set (reg 33)
3386         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3387                           (match_operand:DI 2 "const_int_operand" "K"))
3388                  (const_int 0)))
3389    (set (match_operand:DI 0 "register_operand" "=d")
3390         (plus:DI (match_dup 1) (match_dup 2)))]
3391   "TARGET_64BIT
3392    && s390_match_ccmode (insn, CCAmode)
3393    && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3394   "aghi\t%0,%h2"
3395   [(set_attr "op_type"  "RI")])
3397 (define_insn "*adddi3_carry1_cc"
3398   [(set (reg 33)
3399         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3400                           (match_operand:DI 2 "general_operand" "d,m"))
3401                  (match_dup 1)))
3402    (set (match_operand:DI 0 "register_operand" "=d,d")
3403         (plus:DI (match_dup 1) (match_dup 2)))]
3404   "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3405   "@
3406    algr\t%0,%2
3407    alg\t%0,%2"
3408   [(set_attr "op_type"  "RRE,RXY")])
3410 (define_insn "*adddi3_carry1_cconly"
3411   [(set (reg 33)
3412         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3413                           (match_operand:DI 2 "general_operand" "d,m"))
3414                  (match_dup 1)))
3415    (clobber (match_scratch:DI 0 "=d,d"))]
3416   "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3417   "@
3418    algr\t%0,%2
3419    alg\t%0,%2"
3420   [(set_attr "op_type"  "RRE,RXY")])
3422 (define_insn "*adddi3_carry2_cc"
3423   [(set (reg 33)
3424         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3425                           (match_operand:DI 2 "general_operand" "d,m"))
3426                  (match_dup 2)))
3427    (set (match_operand:DI 0 "register_operand" "=d,d")
3428         (plus:DI (match_dup 1) (match_dup 2)))]
3429   "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3430   "@
3431    algr\t%0,%2
3432    alg\t%0,%2"
3433   [(set_attr "op_type"  "RRE,RXY")])
3435 (define_insn "*adddi3_carry2_cconly"
3436   [(set (reg 33)
3437         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3438                           (match_operand:DI 2 "general_operand" "d,m"))
3439                  (match_dup 2)))
3440    (clobber (match_scratch:DI 0 "=d,d"))]
3441   "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3442   "@
3443    algr\t%0,%2
3444    alg\t%0,%2"
3445   [(set_attr "op_type"  "RRE,RXY")])
3447 (define_insn "*adddi3_cc"
3448   [(set (reg 33)
3449         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3450                           (match_operand:DI 2 "general_operand" "d,m"))
3451                  (const_int 0)))
3452    (set (match_operand:DI 0 "register_operand" "=d,d")
3453         (plus:DI (match_dup 1) (match_dup 2)))]
3454   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3455   "@
3456    algr\t%0,%2
3457    alg\t%0,%2"
3458   [(set_attr "op_type"  "RRE,RXY")])
3460 (define_insn "*adddi3_cconly"
3461   [(set (reg 33)
3462         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3463                           (match_operand:DI 2 "general_operand" "d,m"))
3464                  (const_int 0)))
3465    (clobber (match_scratch:DI 0 "=d,d"))]
3466   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3467   "@
3468    algr\t%0,%2
3469    alg\t%0,%2"
3470   [(set_attr "op_type"  "RRE,RXY")])
3472 (define_insn "*adddi3_cconly2"
3473   [(set (reg 33)
3474         (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3475                  (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3476    (clobber (match_scratch:DI 0 "=d,d"))]
3477   "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3478   "@
3479    algr\t%0,%2
3480    alg\t%0,%2"
3481   [(set_attr "op_type"  "RRE,RXY")])
3483 (define_insn "*adddi3_64"
3484   [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3485         (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3486                  (match_operand:DI 2 "general_operand" "d,K,m") ) )
3487    (clobber (reg:CC 33))]
3488   "TARGET_64BIT"
3489   "@
3490    agr\t%0,%2
3491    aghi\t%0,%h2
3492    ag\t%0,%2"
3493   [(set_attr "op_type"  "RRE,RI,RXY")])
3495 (define_insn_and_split "*adddi3_31z"
3496   [(set (match_operand:DI 0 "register_operand" "=&d")
3497         (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3498                  (match_operand:DI 2 "general_operand" "do") ) )
3499    (clobber (reg:CC 33))]
3500   "!TARGET_64BIT && TARGET_CPU_ZARCH"
3501   "#"
3502   "&& reload_completed"
3503   [(parallel
3504     [(set (reg:CCL1 33)
3505           (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3506                         (match_dup 7)))
3507      (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3508    (parallel
3509     [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3510                                  (ltu:SI (reg:CCL1 33) (const_int 0))))
3511      (clobber (reg:CC 33))])]
3512   "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3513    operands[4] = operand_subword (operands[1], 0, 0, DImode);
3514    operands[5] = operand_subword (operands[2], 0, 0, DImode);
3515    operands[6] = operand_subword (operands[0], 1, 0, DImode);
3516    operands[7] = operand_subword (operands[1], 1, 0, DImode);
3517    operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3518   [(set_attr "op_type"  "NN")])
3520 (define_insn_and_split "*adddi3_31"
3521   [(set (match_operand:DI 0 "register_operand" "=&d")
3522         (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3523                  (match_operand:DI 2 "general_operand" "do") ) )
3524    (clobber (reg:CC 33))]
3525   "!TARGET_CPU_ZARCH"
3526   "#"
3527   "&& reload_completed"
3528   [(parallel
3529     [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3530      (clobber (reg:CC 33))])
3531    (parallel
3532     [(set (reg:CCL1 33)
3533           (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3534                         (match_dup 7)))
3535      (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3536    (set (pc)
3537         (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3538                       (pc)
3539                       (label_ref (match_dup 9))))
3540    (parallel
3541     [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3542      (clobber (reg:CC 33))])
3543    (match_dup 9)]
3544   "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3545    operands[4] = operand_subword (operands[1], 0, 0, DImode);
3546    operands[5] = operand_subword (operands[2], 0, 0, DImode);
3547    operands[6] = operand_subword (operands[0], 1, 0, DImode);
3548    operands[7] = operand_subword (operands[1], 1, 0, DImode);
3549    operands[8] = operand_subword (operands[2], 1, 0, DImode);
3550    operands[9] = gen_label_rtx ();"
3551   [(set_attr "op_type"  "NN")])
3553 (define_expand "adddi3"
3554   [(parallel
3555     [(set (match_operand:DI 0 "register_operand" "")
3556           (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3557                    (match_operand:DI 2 "general_operand" "")))
3558      (clobber (reg:CC 33))])]
3559   ""
3560   "")
3563 ; addsi3 instruction pattern(s).
3566 (define_insn "*addsi3_imm_cc"
3567   [(set (reg 33)
3568         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3569                           (match_operand:SI 2 "const_int_operand" "K"))
3570                  (const_int 0)))
3571    (set (match_operand:SI 0 "register_operand" "=d")
3572         (plus:SI (match_dup 1) (match_dup 2)))]
3573   "s390_match_ccmode (insn, CCAmode)
3574    && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3575   "ahi\t%0,%h2"
3576   [(set_attr "op_type"  "RI")])
3578 (define_insn "*addsi3_carry1_cc"
3579   [(set (reg 33)
3580         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3581                           (match_operand:SI 2 "general_operand" "d,R,T"))
3582                  (match_dup 1)))
3583    (set (match_operand:SI 0 "register_operand" "=d,d,d")
3584         (plus:SI (match_dup 1) (match_dup 2)))]
3585   "s390_match_ccmode (insn, CCL1mode)"
3586   "@
3587    alr\t%0,%2
3588    al\t%0,%2
3589    aly\t%0,%2"
3590   [(set_attr "op_type"  "RR,RX,RXY")])
3592 (define_insn "*addsi3_carry1_cconly"
3593   [(set (reg 33)
3594         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3595                           (match_operand:SI 2 "general_operand" "d,R,T"))
3596                  (match_dup 1)))
3597    (clobber (match_scratch:SI 0 "=d,d,d"))]
3598   "s390_match_ccmode (insn, CCL1mode)"
3599   "@
3600    alr\t%0,%2
3601    al\t%0,%2
3602    aly\t%0,%2"
3603   [(set_attr "op_type"  "RR,RX,RXY")])
3605 (define_insn "*addsi3_carry2_cc"
3606   [(set (reg 33)
3607         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3608                           (match_operand:SI 2 "general_operand" "d,R,T"))
3609                  (match_dup 2)))
3610    (set (match_operand:SI 0 "register_operand" "=d,d,d")
3611         (plus:SI (match_dup 1) (match_dup 2)))]
3612   "s390_match_ccmode (insn, CCL1mode)"
3613   "@
3614    alr\t%0,%2
3615    al\t%0,%2
3616    aly\t%0,%2"
3617   [(set_attr "op_type"  "RR,RX,RXY")])
3619 (define_insn "*addsi3_carry2_cconly"
3620   [(set (reg 33)
3621         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3622                           (match_operand:SI 2 "general_operand" "d,R,T"))
3623                  (match_dup 2)))
3624    (clobber (match_scratch:SI 0 "=d,d,d"))]
3625   "s390_match_ccmode (insn, CCL1mode)"
3626   "@
3627    alr\t%0,%2
3628    al\t%0,%2
3629    aly\t%0,%2"
3630   [(set_attr "op_type"  "RR,RX,RXY")])
3632 (define_insn "*addsi3_cc"
3633   [(set (reg 33)
3634         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3635                           (match_operand:SI 2 "general_operand" "d,R,T"))
3636                  (const_int 0)))
3637    (set (match_operand:SI 0 "register_operand" "=d,d,d")
3638         (plus:SI (match_dup 1) (match_dup 2)))]
3639   "s390_match_ccmode (insn, CCLmode)"
3640   "@
3641    alr\t%0,%2
3642    al\t%0,%2
3643    aly\t%0,%2"
3644   [(set_attr "op_type"  "RR,RX,RXY")])
3646 (define_insn "*addsi3_cconly"
3647   [(set (reg 33)
3648         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3649                           (match_operand:SI 2 "general_operand" "d,R,T"))
3650                  (const_int 0)))
3651    (clobber (match_scratch:SI 0 "=d,d,d"))]
3652   "s390_match_ccmode (insn, CCLmode)"
3653   "@
3654    alr\t%0,%2
3655    al\t%0,%2
3656    aly\t%0,%2"
3657   [(set_attr "op_type"  "RR,RX,RXY")])
3659 (define_insn "*addsi3_cconly2"
3660   [(set (reg 33)
3661         (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3662                  (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3663    (clobber (match_scratch:SI 0 "=d,d,d"))]
3664   "s390_match_ccmode (insn, CCLmode)"
3665   "@
3666    alr\t%0,%2
3667    al\t%0,%2
3668    aly\t%0,%2"
3669   [(set_attr "op_type"  "RR,RX,RXY")])
3671 (define_insn "*addsi3_sign"
3672   [(set (match_operand:SI 0 "register_operand" "=d,d")
3673         (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3674                  (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3675    (clobber (reg:CC 33))]
3676   ""
3677   "@
3678    ah\t%0,%2
3679    ahy\t%0,%2"
3680   [(set_attr "op_type"  "RX,RXY")])
3682 (define_insn "addsi3"
3683   [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3684         (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3685                  (match_operand:SI 2 "general_operand" "d,K,R,T")))
3686    (clobber (reg:CC 33))]
3687   ""
3688   "@
3689    ar\t%0,%2
3690    ahi\t%0,%h2
3691    a\t%0,%2
3692    ay\t%0,%2"
3693   [(set_attr "op_type"  "RR,RI,RX,RXY")])
3696 ; adddf3 instruction pattern(s).
3699 (define_expand "adddf3"
3700   [(parallel
3701     [(set (match_operand:DF 0 "register_operand" "=f,f")
3702           (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3703                    (match_operand:DF 2 "general_operand" "f,R")))
3704      (clobber (reg:CC 33))])]
3705   "TARGET_HARD_FLOAT"
3706   "")
3708 (define_insn "*adddf3"
3709   [(set (match_operand:DF 0 "register_operand" "=f,f")
3710         (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3711                  (match_operand:DF 2 "general_operand" "f,R")))
3712    (clobber (reg:CC 33))]
3713   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3714   "@
3715    adbr\t%0,%2
3716    adb\t%0,%2"
3717   [(set_attr "op_type"  "RRE,RXE")
3718    (set_attr "type"     "fsimpd,fsimpd")])
3720 (define_insn "*adddf3_cc"
3721   [(set (reg 33)
3722         (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3723                           (match_operand:DF 2 "general_operand" "f,R"))
3724                  (match_operand:DF 3 "const0_operand" "")))
3725    (set (match_operand:DF 0 "register_operand" "=f,f")
3726         (plus:DF (match_dup 1) (match_dup 2)))]
3727   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3728   "@
3729    adbr\t%0,%2
3730    adb\t%0,%2"
3731   [(set_attr "op_type"  "RRE,RXE")
3732    (set_attr "type"     "fsimpd,fsimpd")])
3734 (define_insn "*adddf3_cconly"
3735   [(set (reg 33)
3736         (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3737                           (match_operand:DF 2 "general_operand" "f,R"))
3738                  (match_operand:DF 3 "const0_operand" "")))
3739    (clobber (match_scratch:DF 0 "=f,f"))]
3740   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3741   "@
3742   adbr\t%0,%2
3743   adb\t%0,%2"
3744   [(set_attr "op_type"  "RRE,RXE")
3745    (set_attr "type"     "fsimpd,fsimpd")])
3747 (define_insn "*adddf3_ibm"
3748   [(set (match_operand:DF 0 "register_operand" "=f,f")
3749         (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3750                  (match_operand:DF 2 "general_operand" "f,R")))
3751    (clobber (reg:CC 33))]
3752   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3753   "@
3754    adr\t%0,%2
3755    ad\t%0,%2"
3756   [(set_attr "op_type"  "RR,RX")
3757    (set_attr "type"     "fsimpd,fsimpd")])
3760 ; addsf3 instruction pattern(s).
3763 (define_expand "addsf3"
3764   [(parallel
3765     [(set (match_operand:SF 0 "register_operand" "=f,f")
3766           (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3767                    (match_operand:SF 2 "general_operand" "f,R")))
3768      (clobber (reg:CC 33))])]
3769   "TARGET_HARD_FLOAT"
3770   "")
3772 (define_insn "*addsf3"
3773   [(set (match_operand:SF 0 "register_operand" "=f,f")
3774         (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3775                  (match_operand:SF 2 "general_operand" "f,R")))
3776    (clobber (reg:CC 33))]
3777   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3778   "@
3779    aebr\t%0,%2
3780    aeb\t%0,%2"
3781   [(set_attr "op_type"  "RRE,RXE")
3782    (set_attr "type"     "fsimps,fsimps")])
3784 (define_insn "*addsf3_cc"
3785   [(set (reg 33)
3786         (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3787                           (match_operand:SF 2 "general_operand" "f,R"))
3788                  (match_operand:SF 3 "const0_operand" "")))
3789    (set (match_operand:SF 0 "register_operand" "=f,f")
3790         (plus:SF (match_dup 1) (match_dup 2)))]
3791   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3792   "@
3793    aebr\t%0,%2
3794    aeb\t%0,%2"
3795   [(set_attr "op_type"  "RRE,RXE")
3796    (set_attr "type"     "fsimps,fsimps")])
3798 (define_insn "*addsf3_cconly"
3799   [(set (reg 33)
3800         (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3801                           (match_operand:SF 2 "general_operand" "f,R"))
3802                  (match_operand:SF 3 "const0_operand" "")))
3803    (clobber (match_scratch:SF 0 "=f,f"))]
3804   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3805   "@
3806    aebr\t%0,%2
3807    aeb\t%0,%2"
3808   [(set_attr "op_type"  "RRE,RXE")
3809    (set_attr "type"     "fsimps,fsimps")])
3811 (define_insn "*addsf3"
3812   [(set (match_operand:SF 0 "register_operand" "=f,f")
3813         (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3814                  (match_operand:SF 2 "general_operand" "f,R")))
3815    (clobber (reg:CC 33))]
3816   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3817   "@
3818    aer\t%0,%2
3819    ae\t%0,%2"
3820   [(set_attr "op_type"  "RR,RX")
3821    (set_attr "type"     "fsimps,fsimps")])
3825 ;;- Subtract instructions.
3829 ; subdi3 instruction pattern(s).
3832 (define_insn "*subdi3_sign"
3833   [(set (match_operand:DI 0 "register_operand" "=d,d")
3834         (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3835                   (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3836    (clobber (reg:CC 33))]
3837   "TARGET_64BIT"
3838   "@
3839    sgfr\t%0,%2
3840    sgf\t%0,%2"
3841   [(set_attr "op_type"  "RRE,RXY")])
3843 (define_insn "*subdi3_zero_cc"
3844   [(set (reg 33)
3845         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3846                            (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3847                  (const_int 0)))
3848    (set (match_operand:DI 0 "register_operand" "=d,d")
3849         (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3850   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3851   "@
3852    slgfr\t%0,%2
3853    slgf\t%0,%2"
3854   [(set_attr "op_type"  "RRE,RXY")])
3856 (define_insn "*subdi3_zero_cconly"
3857   [(set (reg 33)
3858         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3859                            (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3860                  (const_int 0)))
3861    (clobber (match_scratch:DI 0 "=d,d"))]
3862   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3863   "@
3864    slgfr\t%0,%2
3865    slgf\t%0,%2"
3866   [(set_attr "op_type"  "RRE,RXY")])
3868 (define_insn "*subdi3_zero"
3869   [(set (match_operand:DI 0 "register_operand" "=d,d")
3870         (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3871                   (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3872    (clobber (reg:CC 33))]
3873   "TARGET_64BIT"
3874   "@
3875    slgfr\t%0,%2
3876    slgf\t%0,%2"
3877   [(set_attr "op_type"  "RRE,RXY")])
3879 (define_insn "*subdi3_borrow_cc"
3880   [(set (reg 33)
3881         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3882                            (match_operand:DI 2 "general_operand" "d,m"))
3883                  (match_dup 1)))
3884    (set (match_operand:DI 0 "register_operand" "=d,d")
3885         (minus:DI (match_dup 1) (match_dup 2)))]
3886   "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3887   "@
3888    slgr\t%0,%2
3889    slg\t%0,%2"
3890   [(set_attr "op_type"  "RRE,RXY")])
3892 (define_insn "*subdi3_borrow_cconly"
3893   [(set (reg 33)
3894         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3895                            (match_operand:DI 2 "general_operand" "d,m"))
3896                  (match_dup 1)))
3897    (clobber (match_scratch:DI 0 "=d,d"))]
3898   "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3899   "@
3900    slgr\t%0,%2
3901    slg\t%0,%2"
3902   [(set_attr "op_type"  "RRE,RXY")])
3904 (define_insn "*subdi3_cc"
3905   [(set (reg 33)
3906         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3907                            (match_operand:DI 2 "general_operand" "d,m"))
3908                  (const_int 0)))
3909    (set (match_operand:DI 0 "register_operand" "=d,d")
3910         (minus:DI (match_dup 1) (match_dup 2)))]
3911   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3912   "@
3913    slgr\t%0,%2
3914    slg\t%0,%2"
3915   [(set_attr "op_type"  "RRE,RXY")])
3917 (define_insn "*subdi3_cconly"
3918   [(set (reg 33)
3919         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3920                            (match_operand:DI 2 "general_operand" "d,m"))
3921                  (const_int 0)))
3922    (clobber (match_scratch:DI 0 "=d,d"))]
3923   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3924   "@
3925    slgr\t%0,%2
3926    slg\t%0,%2"
3927   [(set_attr "op_type"  "RRE,RXY")])
3929 (define_insn "*subdi3_64"
3930   [(set (match_operand:DI 0 "register_operand" "=d,d")
3931         (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3932                   (match_operand:DI 2 "general_operand" "d,m") ) )
3933    (clobber (reg:CC 33))]
3934   "TARGET_64BIT"
3935   "@
3936    sgr\t%0,%2
3937    sg\t%0,%2"
3938   [(set_attr "op_type"  "RRE,RRE")])
3940 (define_insn_and_split "*subdi3_31z"
3941   [(set (match_operand:DI 0 "register_operand" "=&d")
3942         (minus:DI (match_operand:DI 1 "register_operand" "0")
3943                   (match_operand:DI 2 "general_operand" "do") ) )
3944    (clobber (reg:CC 33))]
3945   "!TARGET_64BIT && TARGET_CPU_ZARCH"
3946   "#"
3947   "&& reload_completed"
3948   [(parallel
3949     [(set (reg:CCL2 33)
3950           (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3951                         (match_dup 7)))
3952      (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3953    (parallel
3954     [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3955                                   (gtu:SI (reg:CCL2 33) (const_int 0))))
3956      (clobber (reg:CC 33))])]
3957   "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3958    operands[4] = operand_subword (operands[1], 0, 0, DImode);
3959    operands[5] = operand_subword (operands[2], 0, 0, DImode);
3960    operands[6] = operand_subword (operands[0], 1, 0, DImode);
3961    operands[7] = operand_subword (operands[1], 1, 0, DImode);
3962    operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3963   [(set_attr "op_type"  "NN")])
3965 (define_insn_and_split "*subdi3_31"
3966   [(set (match_operand:DI 0 "register_operand" "=&d")
3967         (minus:DI (match_operand:DI 1 "register_operand" "0")
3968                   (match_operand:DI 2 "general_operand" "do") ) )
3969    (clobber (reg:CC 33))]
3970   "!TARGET_CPU_ZARCH"
3971   "#"
3972   "&& reload_completed"
3973   [(parallel
3974     [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3975      (clobber (reg:CC 33))])
3976    (parallel
3977     [(set (reg:CCL2 33)
3978           (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3979                         (match_dup 7)))
3980      (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3981    (set (pc)
3982         (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3983                       (pc)
3984                       (label_ref (match_dup 9))))
3985    (parallel
3986     [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3987      (clobber (reg:CC 33))])
3988    (match_dup 9)]
3989   "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3990    operands[4] = operand_subword (operands[1], 0, 0, DImode);
3991    operands[5] = operand_subword (operands[2], 0, 0, DImode);
3992    operands[6] = operand_subword (operands[0], 1, 0, DImode);
3993    operands[7] = operand_subword (operands[1], 1, 0, DImode);
3994    operands[8] = operand_subword (operands[2], 1, 0, DImode);
3995    operands[9] = gen_label_rtx ();"
3996   [(set_attr "op_type"  "NN")])
3998 (define_expand "subdi3"
3999   [(parallel
4000     [(set (match_operand:DI 0 "register_operand" "")
4001           (minus:DI (match_operand:DI 1 "register_operand" "")
4002                     (match_operand:DI 2 "general_operand" "")))
4003      (clobber (reg:CC 33))])]
4004   ""
4005   "")
4008 ; subsi3 instruction pattern(s).
4011 (define_insn "*subsi3_borrow_cc"
4012   [(set (reg 33)
4013         (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4014                            (match_operand:SI 2 "general_operand" "d,R,T"))
4015                  (match_dup 1)))
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, CCL2mode)"
4019   "@
4020    slr\t%0,%2
4021    sl\t%0,%2
4022    sly\t%0,%2"
4023   [(set_attr "op_type"  "RR,RX,RXY")])
4025 (define_insn "*subsi3_borrow_cconly"
4026   [(set (reg 33)
4027         (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4028                            (match_operand:SI 2 "general_operand" "d,R,T"))
4029                  (match_dup 1)))
4030    (clobber (match_scratch:SI 0 "=d,d,d"))]
4031   "s390_match_ccmode (insn, CCL2mode)"
4032   "@
4033    slr\t%0,%2
4034    sl\t%0,%2
4035    sly\t%0,%2"
4036   [(set_attr "op_type"  "RR,RX,RXY")])
4038 (define_insn "*subsi3_cc"
4039   [(set (reg 33)
4040         (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4041                            (match_operand:SI 2 "general_operand" "d,R,T"))
4042                  (const_int 0)))
4043    (set (match_operand:SI 0 "register_operand" "=d,d,d")
4044         (minus:SI (match_dup 1) (match_dup 2)))]
4045   "s390_match_ccmode (insn, CCLmode)"
4046   "@
4047    slr\t%0,%2
4048    sl\t%0,%2
4049    sly\t%0,%2"
4050   [(set_attr "op_type"  "RR,RX,RXY")])
4052 (define_insn "*subsi3_cconly"
4053   [(set (reg 33)
4054         (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4055                            (match_operand:SI 2 "general_operand" "d,R,T"))
4056                  (const_int 0)))
4057    (clobber (match_scratch:SI 0 "=d,d,d"))]
4058   "s390_match_ccmode (insn, CCLmode)"
4059   "@
4060    slr\t%0,%2
4061    sl\t%0,%2
4062    sly\t%0,%2"
4063   [(set_attr "op_type"  "RR,RX,RXY")])
4065 (define_insn "*subsi3_sign"
4066   [(set (match_operand:SI 0 "register_operand" "=d,d")
4067         (minus:SI (match_operand:SI 1 "register_operand" "0,0")
4068                   (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4069    (clobber (reg:CC 33))]
4070   ""
4071   "@
4072    sh\t%0,%2
4073    shy\t%0,%2"
4074   [(set_attr "op_type"  "RX,RXY")])
4076 (define_insn "subsi3"
4077   [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4078         (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4079                   (match_operand:SI 2 "general_operand" "d,R,T")))
4080    (clobber (reg:CC 33))]
4081   ""
4082   "@
4083    sr\t%0,%2
4084    s\t%0,%2
4085    sy\t%0,%2"
4086   [(set_attr "op_type"  "RR,RX,RXY")])
4090 ; subdf3 instruction pattern(s).
4093 (define_expand "subdf3"
4094   [(parallel
4095     [(set (match_operand:DF 0 "register_operand" "=f,f")
4096           (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4097                     (match_operand:DF 2 "general_operand" "f,R")))
4098      (clobber (reg:CC 33))])]
4099   "TARGET_HARD_FLOAT"
4100   "")
4102 (define_insn "*subdf3"
4103   [(set (match_operand:DF 0 "register_operand" "=f,f")
4104         (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4105                   (match_operand:DF 2 "general_operand" "f,R")))
4106    (clobber (reg:CC 33))]
4107   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4108   "@
4109    sdbr\t%0,%2
4110    sdb\t%0,%2"
4111   [(set_attr "op_type"  "RRE,RXE")
4112    (set_attr "type"     "fsimpd,fsimpd")])
4114 (define_insn "*subdf3_cc"
4115   [(set (reg 33)
4116         (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4117                            (match_operand:DF 2 "general_operand" "f,R"))
4118                  (match_operand:DF 3 "const0_operand" "")))
4119    (set (match_operand:DF 0 "register_operand" "=f,f")
4120         (plus:DF (match_dup 1) (match_dup 2)))]
4121   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4122   "@
4123    sdbr\t%0,%2
4124    sdb\t%0,%2"
4125   [(set_attr "op_type"  "RRE,RXE")
4126    (set_attr "type"     "fsimpd,fsimpd")])
4128 (define_insn "*subdf3_cconly"
4129   [(set (reg 33)
4130         (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4131                            (match_operand:DF 2 "general_operand" "f,R"))
4132                  (match_operand:DF 3 "const0_operand" "")))
4133    (clobber (match_scratch:DF 0 "=f,f"))]
4134   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4135   "@
4136    sdbr\t%0,%2
4137    sdb\t%0,%2"
4138   [(set_attr "op_type"  "RRE,RXE")
4139    (set_attr "type"     "fsimpd,fsimpd")])
4141 (define_insn "*subdf3_ibm"
4142   [(set (match_operand:DF 0 "register_operand" "=f,f")
4143         (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4144                   (match_operand:DF 2 "general_operand" "f,R")))
4145    (clobber (reg:CC 33))]
4146   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4147   "@
4148    sdr\t%0,%2
4149    sd\t%0,%2"
4150   [(set_attr "op_type"  "RR,RX")
4151    (set_attr "type"     "fsimpd,fsimpd")])
4154 ; subsf3 instruction pattern(s).
4157 (define_expand "subsf3"
4158   [(parallel
4159     [(set (match_operand:SF 0 "register_operand" "=f,f")
4160           (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4161                     (match_operand:SF 2 "general_operand" "f,R")))
4162      (clobber (reg:CC 33))])]
4163   "TARGET_HARD_FLOAT"
4164   "")
4166 (define_insn "*subsf3"
4167   [(set (match_operand:SF 0 "register_operand" "=f,f")
4168         (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4169                   (match_operand:SF 2 "general_operand" "f,R")))
4170    (clobber (reg:CC 33))]
4171   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4172   "@
4173    sebr\t%0,%2
4174    seb\t%0,%2"
4175   [(set_attr "op_type"  "RRE,RXE")
4176    (set_attr "type"     "fsimps,fsimps")])
4178 (define_insn "*subsf3_cc"
4179   [(set (reg 33)
4180         (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4181                            (match_operand:SF 2 "general_operand" "f,R"))
4182                  (match_operand:SF 3 "const0_operand" "")))
4183    (set (match_operand:SF 0 "register_operand" "=f,f")
4184         (minus:SF (match_dup 1) (match_dup 2)))]
4185   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4186   "@
4187    sebr\t%0,%2
4188    seb\t%0,%2"
4189   [(set_attr "op_type"  "RRE,RXE")
4190    (set_attr "type"     "fsimps,fsimps")])
4192 (define_insn "*subsf3_cconly"
4193   [(set (reg 33)
4194         (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4195                            (match_operand:SF 2 "general_operand" "f,R"))
4196                  (match_operand:SF 3 "const0_operand" "")))
4197    (clobber (match_scratch:SF 0 "=f,f"))]
4198   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4199   "@
4200    sebr\t%0,%2
4201    seb\t%0,%2"
4202   [(set_attr "op_type"  "RRE,RXE")
4203    (set_attr "type"     "fsimps,fsimps")])
4205 (define_insn "*subsf3_ibm"
4206   [(set (match_operand:SF 0 "register_operand" "=f,f")
4207         (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4208                   (match_operand:SF 2 "general_operand" "f,R")))
4209    (clobber (reg:CC 33))]
4210   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4211   "@
4212    ser\t%0,%2
4213    se\t%0,%2"
4214   [(set_attr "op_type"  "RR,RX")
4215    (set_attr "type"     "fsimps,fsimps")])
4219 ;;- Conditional add/subtract instructions.
4223 ; adddicc instruction pattern(s).
4226 (define_insn "*adddi3_alc_cc"
4227   [(set (reg 33) 
4228         (compare
4229           (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4230                             (match_operand:DI 2 "general_operand" "d,m"))
4231                    (match_operand:DI 3 "s390_alc_comparison" ""))
4232           (const_int 0)))
4233    (set (match_operand:DI 0 "register_operand" "=d,d")
4234         (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4235   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT" 
4236   "@
4237    alcgr\\t%0,%2
4238    alcg\\t%0,%2"
4239   [(set_attr "op_type"  "RRE,RXY")])
4241 (define_insn "*adddi3_alc"
4242   [(set (match_operand:DI 0 "register_operand" "=d,d")
4243         (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4244                           (match_operand:DI 2 "general_operand" "d,m"))
4245                  (match_operand:DI 3 "s390_alc_comparison" "")))
4246    (clobber (reg:CC 33))] 
4247   "TARGET_64BIT" 
4248   "@
4249    alcgr\\t%0,%2
4250    alcg\\t%0,%2"
4251   [(set_attr "op_type"  "RRE,RXY")])
4253 (define_insn "*subdi3_slb_cc"
4254   [(set (reg 33) 
4255         (compare
4256           (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4257                               (match_operand:DI 2 "general_operand" "d,m"))
4258                     (match_operand:DI 3 "s390_slb_comparison" ""))
4259           (const_int 0)))
4260    (set (match_operand:DI 0 "register_operand" "=d,d")
4261         (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4262   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT" 
4263   "@
4264    slbgr\\t%0,%2
4265    slbg\\t%0,%2"
4266   [(set_attr "op_type"  "RRE,RXY")])
4268 (define_insn "*subdi3_slb"
4269   [(set (match_operand:DI 0 "register_operand" "=d,d")
4270         (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4271                             (match_operand:DI 2 "general_operand" "d,m"))
4272                   (match_operand:DI 3 "s390_slb_comparison" "")))
4273    (clobber (reg:CC 33))] 
4274   "TARGET_64BIT" 
4275   "@
4276    slbgr\\t%0,%2
4277    slbg\\t%0,%2"
4278   [(set_attr "op_type"  "RRE,RXY")])
4281 ; addsicc instruction pattern(s).
4284 (define_insn "*addsi3_alc_cc"
4285   [(set (reg 33) 
4286         (compare
4287           (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4288                             (match_operand:SI 2 "general_operand" "d,m"))
4289                    (match_operand:SI 3 "s390_alc_comparison" ""))
4290           (const_int 0)))
4291    (set (match_operand:SI 0 "register_operand" "=d,d")
4292         (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4293   "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH" 
4294   "@
4295    alcr\\t%0,%2
4296    alc\\t%0,%2"
4297   [(set_attr "op_type"  "RRE,RXY")])
4299 (define_insn "*addsi3_alc"
4300   [(set (match_operand:SI 0 "register_operand" "=d,d")
4301         (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4302                           (match_operand:SI 2 "general_operand" "d,m"))
4303                  (match_operand:SI 3 "s390_alc_comparison" "")))
4304    (clobber (reg:CC 33))]
4305   "TARGET_CPU_ZARCH" 
4306   "@
4307    alcr\\t%0,%2
4308    alc\\t%0,%2"
4309   [(set_attr "op_type"  "RRE,RXY")])
4311 (define_insn "*subsi3_slb_cc"
4312   [(set (reg 33) 
4313         (compare
4314           (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4315                               (match_operand:SI 2 "general_operand" "d,m"))
4316                     (match_operand:SI 3 "s390_slb_comparison" ""))
4317           (const_int 0)))
4318    (set (match_operand:SI 0 "register_operand" "=d,d")
4319         (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4320   "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH" 
4321   "@
4322    slbr\\t%0,%2
4323    slb\\t%0,%2"
4324   [(set_attr "op_type"  "RRE,RXY")])
4326 (define_insn "*subsi3_slb"
4327   [(set (match_operand:SI 0 "register_operand" "=d,d")
4328         (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4329                             (match_operand:SI 2 "general_operand" "d,m"))
4330                   (match_operand:SI 3 "s390_slb_comparison" "")))
4331    (clobber (reg:CC 33))] 
4332   "TARGET_CPU_ZARCH" 
4333   "@
4334    slbr\\t%0,%2
4335    slb\\t%0,%2"
4336   [(set_attr "op_type"  "RRE,RXY")])
4340 ;;- Multiply instructions.
4344 ; muldi3 instruction pattern(s).
4347 (define_insn "*muldi3_sign"
4348   [(set (match_operand:DI 0 "register_operand" "=d,d")
4349         (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4350                  (match_operand:DI 1 "register_operand" "0,0")))]
4351   "TARGET_64BIT"
4352   "@
4353    msgfr\t%0,%2
4354    msgf\t%0,%2"
4355   [(set_attr "op_type"  "RRE,RXY")
4356    (set_attr "type"     "imul")])
4358 (define_insn "muldi3"
4359   [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4360         (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4361                  (match_operand:DI 2 "general_operand" "d,K,m")))]
4362   "TARGET_64BIT"
4363   "@
4364    msgr\t%0,%2
4365    mghi\t%0,%h2
4366    msg\t%0,%2"
4367   [(set_attr "op_type"  "RRE,RI,RXY")
4368    (set_attr "type"     "imul")])
4371 ; mulsi3 instruction pattern(s).
4374 (define_insn "*mulsi3_sign"
4375   [(set (match_operand:SI 0 "register_operand" "=d")
4376         (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4377                  (match_operand:SI 1 "register_operand" "0")))]
4378   ""
4379   "mh\t%0,%2"
4380   [(set_attr "op_type"  "RX")
4381    (set_attr "type"     "imul")])
4383 (define_insn "mulsi3"
4384   [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4385         (mult:SI  (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4386                   (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4387   ""
4388   "@
4389    msr\t%0,%2
4390    mhi\t%0,%h2
4391    ms\t%0,%2
4392    msy\t%0,%2"
4393   [(set_attr "op_type"  "RRE,RI,RX,RXY")
4394    (set_attr "type"     "imul")])
4397 ; mulsidi3 instruction pattern(s).
4400 (define_insn "mulsidi3"
4401   [(set (match_operand:DI 0 "register_operand" "=d,d")
4402         (mult:DI (sign_extend:DI
4403                    (match_operand:SI 1 "register_operand" "%0,0"))
4404                  (sign_extend:DI
4405                    (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4406   "!TARGET_64BIT"
4407   "@
4408    mr\t%0,%2
4409    m\t%0,%2"
4410   [(set_attr "op_type"  "RR,RX")
4411    (set_attr "type"     "imul")])
4414 ; umulsidi3 instruction pattern(s).
4417 (define_insn "umulsidi3"
4418   [(set (match_operand:DI 0 "register_operand" "=d,d")
4419         (mult:DI (zero_extend:DI
4420                    (match_operand:SI 1 "register_operand" "%0,0"))
4421                  (zero_extend:DI
4422                    (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4423   "!TARGET_64BIT && TARGET_CPU_ZARCH"
4424   "@
4425    mlr\t%0,%2
4426    ml\t%0,%2"
4427   [(set_attr "op_type"  "RRE,RXY")
4428    (set_attr "type"     "imul")])
4431 ; muldf3 instruction pattern(s).
4434 (define_expand "muldf3"
4435   [(set (match_operand:DF 0 "register_operand" "=f,f")
4436         (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4437                  (match_operand:DF 2 "general_operand" "f,R")))]
4438   "TARGET_HARD_FLOAT"
4439   "")
4441 (define_insn "*muldf3"
4442   [(set (match_operand:DF 0 "register_operand" "=f,f")
4443         (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4444                  (match_operand:DF 2 "general_operand" "f,R")))]
4445   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4446   "@
4447    mdbr\t%0,%2
4448    mdb\t%0,%2"
4449   [(set_attr "op_type"  "RRE,RXE")
4450    (set_attr "type"     "fmuld")])
4452 (define_insn "*muldf3_ibm"
4453   [(set (match_operand:DF 0 "register_operand" "=f,f")
4454         (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4455                  (match_operand:DF 2 "general_operand" "f,R")))]
4456   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4457   "@
4458    mdr\t%0,%2
4459    md\t%0,%2"
4460   [(set_attr "op_type"  "RR,RX")
4461    (set_attr "type"    "fmuld")])
4463 (define_insn "*fmadddf"
4464   [(set (match_operand:DF 0 "register_operand" "=f,f")
4465         (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4466                           (match_operand:DF 2 "nonimmediate_operand"  "f,R"))
4467                  (match_operand:DF 3 "register_operand" "0,0")))]
4468   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4469   "@
4470    madbr\t%0,%1,%2
4471    madb\t%0,%1,%2"
4472   [(set_attr "op_type"  "RRE,RXE")
4473    (set_attr "type" "fmuld")])
4475 (define_insn "*fmsubdf"
4476   [(set (match_operand:DF 0 "register_operand" "=f,f")
4477         (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4478                            (match_operand:DF 2 "nonimmediate_operand"  "f,R"))
4479                  (match_operand:DF 3 "register_operand" "0,0")))]
4480   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4481   "@
4482    msdbr\t%0,%1,%2
4483    msdb\t%0,%1,%2"
4484   [(set_attr "op_type"  "RRE,RXE")
4485    (set_attr "type" "fmuld")])
4488 ; mulsf3 instruction pattern(s).
4491 (define_expand "mulsf3"
4492   [(set (match_operand:SF 0 "register_operand" "=f,f")
4493         (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4494                  (match_operand:SF 2 "general_operand" "f,R")))]
4495   "TARGET_HARD_FLOAT"
4496   "")
4498 (define_insn "*mulsf3"
4499   [(set (match_operand:SF 0 "register_operand" "=f,f")
4500         (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4501                  (match_operand:SF 2 "general_operand" "f,R")))]
4502   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4503   "@
4504    meebr\t%0,%2
4505    meeb\t%0,%2"
4506   [(set_attr "op_type"  "RRE,RXE")
4507    (set_attr "type"     "fmuls")])
4509 (define_insn "*mulsf3_ibm"
4510   [(set (match_operand:SF 0 "register_operand" "=f,f")
4511         (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4512                  (match_operand:SF 2 "general_operand" "f,R")))]
4513   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4514   "@
4515    mer\t%0,%2
4516    me\t%0,%2"
4517   [(set_attr "op_type"  "RR,RX")
4518    (set_attr "type"     "fmuls")])
4520 (define_insn "*fmaddsf"
4521   [(set (match_operand:SF 0 "register_operand" "=f,f")
4522         (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4523                           (match_operand:SF 2 "nonimmediate_operand"  "f,R"))
4524                  (match_operand:SF 3 "register_operand" "0,0")))]
4525   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4526   "@
4527    maebr\t%0,%1,%2
4528    maeb\t%0,%1,%2"
4529   [(set_attr "op_type"  "RRE,RXE")
4530    (set_attr "type" "fmuls")])
4532 (define_insn "*fmsubsf"
4533   [(set (match_operand:SF 0 "register_operand" "=f,f")
4534         (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4535                            (match_operand:SF 2 "nonimmediate_operand"  "f,R"))
4536                   (match_operand:SF 3 "register_operand" "0,0")))]
4537   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4538   "@
4539    msebr\t%0,%1,%2
4540    mseb\t%0,%1,%2"
4541   [(set_attr "op_type"  "RRE,RXE")
4542    (set_attr "type" "fmuls")])
4545 ;;- Divide and modulo instructions.
4549 ; divmoddi4 instruction pattern(s).
4552 (define_expand "divmoddi4"
4553   [(parallel [(set (match_operand:DI 0 "general_operand" "")
4554                    (div:DI (match_operand:DI 1 "register_operand" "")
4555                            (match_operand:DI 2 "general_operand" "")))
4556               (set (match_operand:DI 3 "general_operand" "")
4557                    (mod:DI (match_dup 1) (match_dup 2)))])
4558    (clobber (match_dup 4))]
4559   "TARGET_64BIT"
4561   rtx insn, div_equal, mod_equal;
4563   div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4564   mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4566   operands[4] = gen_reg_rtx(TImode);
4567   emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4569   insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4570   REG_NOTES (insn) =
4571         gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4573   insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4574   REG_NOTES (insn) =
4575         gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4577   DONE;
4580 (define_insn "divmodtidi3"
4581   [(set (match_operand:TI 0 "register_operand" "=d,d")
4582         (ior:TI
4583           (zero_extend:TI
4584             (div:DI (match_operand:DI 1 "register_operand" "0,0")
4585                     (match_operand:DI 2 "general_operand" "d,m")))
4586           (ashift:TI
4587             (zero_extend:TI
4588               (mod:DI (match_dup 1)
4589                       (match_dup 2)))
4590             (const_int 64))))]
4591   "TARGET_64BIT"
4592   "@
4593    dsgr\t%0,%2
4594    dsg\t%0,%2"
4595   [(set_attr "op_type"  "RRE,RXY")
4596    (set_attr "type"     "idiv")])
4598 (define_insn "divmodtisi3"
4599   [(set (match_operand:TI 0 "register_operand" "=d,d")
4600         (ior:TI
4601           (zero_extend:TI
4602             (div:DI (match_operand:DI 1 "register_operand" "0,0")
4603                     (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4604           (ashift:TI
4605             (zero_extend:TI
4606               (mod:DI (match_dup 1)
4607                       (sign_extend:DI (match_dup 2))))
4608             (const_int 64))))]
4609   "TARGET_64BIT"
4610   "@
4611    dsgfr\t%0,%2
4612    dsgf\t%0,%2"
4613   [(set_attr "op_type"  "RRE,RXY")
4614    (set_attr "type"     "idiv")])
4617 ; udivmoddi4 instruction pattern(s).
4620 (define_expand "udivmoddi4"
4621   [(parallel [(set (match_operand:DI 0 "general_operand" "")
4622                    (udiv:DI (match_operand:DI 1 "general_operand" "")
4623                             (match_operand:DI 2 "nonimmediate_operand" "")))
4624               (set (match_operand:DI 3 "general_operand" "")
4625                    (umod:DI (match_dup 1) (match_dup 2)))])
4626    (clobber (match_dup 4))]
4627   "TARGET_64BIT"
4629   rtx insn, div_equal, mod_equal, equal;
4631   div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4632   mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4633   equal = gen_rtx_IOR (TImode,
4634                        gen_rtx_ZERO_EXTEND (TImode, div_equal),
4635                        gen_rtx_ASHIFT (TImode,
4636                                        gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4637                                        GEN_INT (64)));
4639   operands[4] = gen_reg_rtx(TImode);
4640   emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4641   emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4642   emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4643   insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4644   REG_NOTES (insn) =
4645         gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4647   insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4648   REG_NOTES (insn) =
4649         gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4651   insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4652   REG_NOTES (insn) =
4653         gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4655   DONE;
4658 (define_insn "udivmodtidi3"
4659   [(set (match_operand:TI 0 "register_operand" "=d,d")
4660         (ior:TI (zero_extend:TI
4661                   (truncate:DI
4662                     (udiv:TI (match_operand:TI 1 "register_operand" "0,0")
4663                              (zero_extend:TI
4664                                (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4665                 (ashift:TI
4666                   (zero_extend:TI
4667                     (truncate:DI
4668                       (umod:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))
4669                   (const_int 64))))]
4670   "TARGET_64BIT"
4671   "@
4672    dlgr\t%0,%2
4673    dlg\t%0,%2"
4674   [(set_attr "op_type"  "RRE,RXY")
4675    (set_attr "type"     "idiv")])
4678 ; divmodsi4 instruction pattern(s).
4681 (define_expand "divmodsi4"
4682   [(parallel [(set (match_operand:SI 0 "general_operand" "")
4683                    (div:SI (match_operand:SI 1 "general_operand" "")
4684                            (match_operand:SI 2 "nonimmediate_operand" "")))
4685               (set (match_operand:SI 3 "general_operand" "")
4686                    (mod:SI (match_dup 1) (match_dup 2)))])
4687    (clobber (match_dup 4))]
4688   "!TARGET_64BIT"
4690   rtx insn, div_equal, mod_equal, equal;
4692   div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4693   mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4694   equal = gen_rtx_IOR (DImode,
4695                        gen_rtx_ZERO_EXTEND (DImode, div_equal),
4696                        gen_rtx_ASHIFT (DImode,
4697                                        gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4698                                        GEN_INT (32)));
4700   operands[4] = gen_reg_rtx(DImode);
4701   emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4702   insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4703   REG_NOTES (insn) =
4704         gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4706   insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4707   REG_NOTES (insn) =
4708         gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4710   insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4711   REG_NOTES (insn) =
4712         gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4714   DONE;
4717 (define_insn "divmoddisi3"
4718   [(set (match_operand:DI 0 "register_operand" "=d,d")
4719         (ior:DI (zero_extend:DI
4720                   (truncate:SI
4721                     (div:DI (match_operand:DI 1 "register_operand" "0,0")
4722                             (sign_extend:DI
4723                               (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4724                 (ashift:DI
4725                   (zero_extend:DI
4726                     (truncate:SI
4727                       (mod:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))
4728                   (const_int 32))))]
4729   "!TARGET_64BIT"
4730   "@
4731    dr\t%0,%2
4732    d\t%0,%2"
4733   [(set_attr "op_type"  "RR,RX")
4734    (set_attr "type"     "idiv")])
4737 ; udivsi3 and umodsi3 instruction pattern(s).
4740 (define_expand "udivmodsi4"
4741   [(parallel [(set (match_operand:SI 0 "general_operand" "")
4742                    (udiv:SI (match_operand:SI 1 "general_operand" "")
4743                             (match_operand:SI 2 "nonimmediate_operand" "")))
4744               (set (match_operand:SI 3 "general_operand" "")
4745                    (umod:SI (match_dup 1) (match_dup 2)))])
4746    (clobber (match_dup 4))]
4747   "!TARGET_64BIT && TARGET_CPU_ZARCH"
4749   rtx insn, div_equal, mod_equal, equal;
4751   div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4752   mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4753   equal = gen_rtx_IOR (DImode,
4754                        gen_rtx_ZERO_EXTEND (DImode, div_equal),
4755                        gen_rtx_ASHIFT (DImode,
4756                                        gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4757                                        GEN_INT (32)));
4759   operands[4] = gen_reg_rtx(DImode);
4760   emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4761   emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4762   emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4763   insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4764   REG_NOTES (insn) =
4765         gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4767   insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4768   REG_NOTES (insn) =
4769         gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4771   insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4772   REG_NOTES (insn) =
4773         gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4775   DONE;
4778 (define_insn "udivmoddisi3"
4779   [(set (match_operand:DI 0 "register_operand" "=d,d")
4780         (ior:DI (zero_extend:DI
4781                   (truncate:SI
4782                     (udiv:DI (match_operand:DI 1 "register_operand" "0,0")
4783                              (zero_extend:DI
4784                                (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4785                 (ashift:DI
4786                   (zero_extend:DI
4787                     (truncate:SI
4788                       (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))
4789                   (const_int 32))))]
4790   "!TARGET_64BIT && TARGET_CPU_ZARCH"
4791   "@
4792    dlr\t%0,%2
4793    dl\t%0,%2"
4794   [(set_attr "op_type"  "RRE,RXY")
4795    (set_attr "type"     "idiv")])
4797 (define_expand "udivsi3"
4798   [(set (match_operand:SI 0 "register_operand" "=d")
4799         (udiv:SI (match_operand:SI 1 "general_operand" "")
4800                  (match_operand:SI 2 "general_operand" "")))
4801    (clobber (match_dup 3))]
4802   "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4804   rtx insn, udiv_equal, umod_equal, equal;
4806   udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4807   umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4808   equal = gen_rtx_IOR (DImode,
4809                        gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4810                        gen_rtx_ASHIFT (DImode,
4811                                        gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4812                                        GEN_INT (32)));
4814   operands[3] = gen_reg_rtx (DImode);
4816   if (CONSTANT_P (operands[2]))
4817     {
4818       if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4819         {
4820           rtx label1 = gen_label_rtx ();
4822           operands[1] = make_safe_from (operands[1], operands[0]);
4823           emit_move_insn (operands[0], const0_rtx);
4824           emit_insn (gen_cmpsi (operands[1], operands[2]));
4825           emit_jump_insn (gen_bltu (label1));
4826           emit_move_insn (operands[0], const1_rtx);
4827           emit_label (label1);
4828         }
4829       else
4830         {
4831           operands[2] = force_reg (SImode, operands[2]);
4832           operands[2] = make_safe_from (operands[2], operands[0]);
4834           emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4835           insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4836                                              operands[2]));
4837           REG_NOTES (insn) =
4838             gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4840           insn = emit_move_insn (operands[0],
4841                                  gen_lowpart (SImode, operands[3]));
4842           REG_NOTES (insn) =
4843             gen_rtx_EXPR_LIST (REG_EQUAL,
4844                                udiv_equal, REG_NOTES (insn));
4845         }
4846     }
4847   else
4848     {
4849       rtx label1 = gen_label_rtx ();
4850       rtx label2 = gen_label_rtx ();
4851       rtx label3 = gen_label_rtx ();
4853       operands[1] = force_reg (SImode, operands[1]);
4854       operands[1] = make_safe_from (operands[1], operands[0]);
4855       operands[2] = force_reg (SImode, operands[2]);
4856       operands[2] = make_safe_from (operands[2], operands[0]);
4858       emit_move_insn (operands[0], const0_rtx);
4859       emit_insn (gen_cmpsi (operands[2], operands[1]));
4860       emit_jump_insn (gen_bgtu (label3));
4861       emit_insn (gen_cmpsi (operands[2], const1_rtx));
4862       emit_jump_insn (gen_blt (label2));
4863       emit_insn (gen_cmpsi (operands[2], const1_rtx));
4864       emit_jump_insn (gen_beq (label1));
4865       emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4866       insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4867                                          operands[2]));
4868       REG_NOTES (insn) =
4869       gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4871       insn = emit_move_insn (operands[0],
4872                              gen_lowpart (SImode, operands[3]));
4873       REG_NOTES (insn) =
4874       gen_rtx_EXPR_LIST (REG_EQUAL,
4875                                udiv_equal, REG_NOTES (insn));
4876       emit_jump (label3);
4877       emit_label (label1);
4878       emit_move_insn (operands[0], operands[1]);
4879       emit_jump (label3);
4880       emit_label (label2);
4881       emit_move_insn (operands[0], const1_rtx);
4882       emit_label (label3);
4883     }
4884   emit_move_insn (operands[0], operands[0]);
4885   DONE;
4888 (define_expand "umodsi3"
4889   [(set (match_operand:SI 0 "register_operand" "=d")
4890         (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4891                  (match_operand:SI 2 "nonimmediate_operand" "")))
4892    (clobber (match_dup 3))]
4893   "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4895   rtx insn, udiv_equal, umod_equal, equal;
4897   udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4898   umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4899   equal = gen_rtx_IOR (DImode,
4900                        gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4901                        gen_rtx_ASHIFT (DImode,
4902                                        gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4903                                        GEN_INT (32)));
4905   operands[3] = gen_reg_rtx (DImode);
4907   if (CONSTANT_P (operands[2]))
4908     {
4909       if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4910         {
4911           rtx label1 = gen_label_rtx ();
4913           operands[1] = make_safe_from (operands[1], operands[0]);
4914           emit_move_insn (operands[0], operands[1]);
4915           emit_insn (gen_cmpsi (operands[0], operands[2]));
4916           emit_jump_insn (gen_bltu (label1));
4917           emit_insn (gen_abssi2 (operands[0], operands[2]));
4918           emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4919           emit_label (label1);
4920         }
4921       else
4922         {
4923           operands[2] = force_reg (SImode, operands[2]);
4924           operands[2] = make_safe_from (operands[2], operands[0]);
4926           emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4927           insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4928                                              operands[2]));
4929           REG_NOTES (insn) =
4930             gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4932           insn = emit_move_insn (operands[0],
4933                                  gen_highpart (SImode, operands[3]));
4934           REG_NOTES (insn) =
4935             gen_rtx_EXPR_LIST (REG_EQUAL,
4936                                umod_equal, REG_NOTES (insn));
4937         }
4938     }
4939   else
4940     {
4941       rtx label1 = gen_label_rtx ();
4942       rtx label2 = gen_label_rtx ();
4943       rtx label3 = gen_label_rtx ();
4945       operands[1] = force_reg (SImode, operands[1]);
4946       operands[1] = make_safe_from (operands[1], operands[0]);
4947       operands[2] = force_reg (SImode, operands[2]);
4948       operands[2] = make_safe_from (operands[2], operands[0]);
4950       emit_move_insn(operands[0], operands[1]);
4951       emit_insn (gen_cmpsi (operands[2], operands[1]));
4952       emit_jump_insn (gen_bgtu (label3));
4953       emit_insn (gen_cmpsi (operands[2], const1_rtx));
4954       emit_jump_insn (gen_blt (label2));
4955       emit_insn (gen_cmpsi (operands[2], const1_rtx));
4956       emit_jump_insn (gen_beq (label1));
4957       emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4958       insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4959                                          operands[2]));
4960       REG_NOTES (insn) =
4961       gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4963       insn = emit_move_insn (operands[0],
4964                              gen_highpart (SImode, operands[3]));
4965       REG_NOTES (insn) =
4966       gen_rtx_EXPR_LIST (REG_EQUAL,
4967                          umod_equal, REG_NOTES (insn));
4968       emit_jump (label3);
4969       emit_label (label1);
4970       emit_move_insn (operands[0], const0_rtx);
4971       emit_jump (label3);
4972       emit_label (label2);
4973       emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4974       emit_label (label3);
4975     }
4976   DONE;
4980 ; divdf3 instruction pattern(s).
4983 (define_expand "divdf3"
4984   [(set (match_operand:DF 0 "register_operand" "=f,f")
4985         (div:DF (match_operand:DF 1 "register_operand" "0,0")
4986                 (match_operand:DF 2 "general_operand" "f,R")))]
4987   "TARGET_HARD_FLOAT"
4988   "")
4990 (define_insn "*divdf3"
4991   [(set (match_operand:DF 0 "register_operand" "=f,f")
4992         (div:DF (match_operand:DF 1 "register_operand" "0,0")
4993                 (match_operand:DF 2 "general_operand" "f,R")))]
4994   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4995   "@
4996    ddbr\t%0,%2
4997    ddb\t%0,%2"
4998   [(set_attr "op_type"  "RRE,RXE")
4999    (set_attr "type"     "fdivd")])
5001 (define_insn "*divdf3_ibm"
5002   [(set (match_operand:DF 0 "register_operand" "=f,f")
5003         (div:DF (match_operand:DF 1 "register_operand" "0,0")
5004                 (match_operand:DF 2 "general_operand" "f,R")))]
5005   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5006   "@
5007    ddr\t%0,%2
5008    dd\t%0,%2"
5009   [(set_attr "op_type"  "RR,RX")
5010    (set_attr "type"     "fdivd")])
5013 ; divsf3 instruction pattern(s).
5016 (define_expand "divsf3"
5017   [(set (match_operand:SF 0 "register_operand" "=f,f")
5018         (div:SF (match_operand:SF 1 "register_operand" "0,0")
5019                 (match_operand:SF 2 "general_operand" "f,R")))]
5020   "TARGET_HARD_FLOAT"
5021   "")
5023 (define_insn "*divsf3"
5024   [(set (match_operand:SF 0 "register_operand" "=f,f")
5025         (div:SF (match_operand:SF 1 "register_operand" "0,0")
5026                 (match_operand:SF 2 "general_operand" "f,R")))]
5027   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5028   "@
5029    debr\t%0,%2
5030    deb\t%0,%2"
5031   [(set_attr "op_type"  "RRE,RXE")
5032    (set_attr "type"     "fdivs")])
5034 (define_insn "*divsf3"
5035   [(set (match_operand:SF 0 "register_operand" "=f,f")
5036         (div:SF (match_operand:SF 1 "register_operand" "0,0")
5037                 (match_operand:SF 2 "general_operand" "f,R")))]
5038   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5039   "@
5040    der\t%0,%2
5041    de\t%0,%2"
5042   [(set_attr "op_type"  "RR,RX")
5043    (set_attr "type"     "fdivs")])
5047 ;;- And instructions.
5051 ; anddi3 instruction pattern(s).
5054 (define_insn "*anddi3_cc"
5055   [(set (reg 33)
5056         (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5057                          (match_operand:DI 2 "general_operand" "d,m"))
5058                  (const_int 0)))
5059    (set (match_operand:DI 0 "register_operand" "=d,d")
5060         (and:DI (match_dup 1) (match_dup 2)))]
5061   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5062   "@
5063    ngr\t%0,%2
5064    ng\t%0,%2"
5065   [(set_attr "op_type"  "RRE,RXY")])
5067 (define_insn "*anddi3_cconly"
5068   [(set (reg 33)
5069         (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5070                          (match_operand:DI 2 "general_operand" "d,m"))
5071                  (const_int 0)))
5072    (clobber (match_scratch:DI 0 "=d,d"))]
5073   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5074   "@
5075    ngr\t%0,%2
5076    ng\t%0,%2"
5077   [(set_attr "op_type"  "RRE,RXY")])
5079 (define_insn "anddi3"
5080   [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d,d,d")
5081         (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o,0,0,0,0,0,0")
5082                 (match_operand:DI 2 "general_operand" 
5083                                     "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m")))
5084      (clobber (reg:CC 33))]
5085    "TARGET_64BIT"
5086    "@
5087     #
5088     #
5089     nihh\t%0,%j2
5090     nihl\t%0,%j2
5091     nilh\t%0,%j2
5092     nill\t%0,%j2
5093     ngr\t%0,%2
5094     ng\t%0,%2"
5095  [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY")])
5097 (define_insn "*anddi3_ss"
5098   [(set (match_operand:DI 0 "s_operand" "=Q")
5099         (and:DI (match_dup 0)
5100                 (match_operand:DI 1 "s_imm_operand" "Q")))
5101    (clobber (reg:CC 33))]
5102   ""
5103   "nc\t%O0(8,%R0),%1"
5104   [(set_attr "op_type"  "SS")])
5106 (define_insn "*anddi3_ss_inv"
5107   [(set (match_operand:DI 0 "s_operand" "=Q")
5108         (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5109                 (match_dup 0)))
5110    (clobber (reg:CC 33))]
5111   ""
5112   "nc\t%O0(8,%R0),%1"
5113   [(set_attr "op_type"  "SS")])
5116 ; andsi3 instruction pattern(s).
5119 (define_insn "*andsi3_cc"
5120   [(set (reg 33)
5121         (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5122                          (match_operand:SI 2 "general_operand" "d,R,T"))
5123                  (const_int 0)))
5124    (set (match_operand:SI 0 "register_operand" "=d,d,d")
5125         (and:SI (match_dup 1) (match_dup 2)))]
5126   "s390_match_ccmode(insn, CCTmode)"
5127   "@
5128    nr\t%0,%2
5129    n\t%0,%2
5130    ny\t%0,%2"
5131   [(set_attr "op_type"  "RR,RX,RXY")])
5133 (define_insn "*andsi3_cconly"
5134   [(set (reg 33)
5135         (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5136                          (match_operand:SI 2 "general_operand" "d,R,T"))
5137                  (const_int 0)))
5138    (clobber (match_scratch:SI 0 "=d,d,d"))]
5139   "s390_match_ccmode(insn, CCTmode)"
5140   "@
5141    nr\t%0,%2
5142    n\t%0,%2
5143    ny\t%0,%2"
5144   [(set_attr "op_type"  "RR,RX,RXY")])
5146 (define_expand "andsi3"
5147   [(parallel 
5148     [(set (match_operand:SI 0 "register_operand" "")
5149           (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
5150                   (match_operand:SI 2 "general_operand" "")))
5151      (clobber (reg:CC 33))])]
5152   ""
5153   "")
5155 (define_insn "*andsi3_zarch"
5156   [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d,d,d")
5157         (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,o,0,0,0,0,0")
5158                 (match_operand:SI 2 "general_operand" "M,M,N0HSF,N1HSF,d,R,T")))
5159    (clobber (reg:CC 33))]
5160   "TARGET_ZARCH"
5161   "@
5162    #
5163    #
5164    nilh\t%0,%j2
5165    nill\t%0,%j2   
5166    nr\t%0,%2
5167    n\t%0,%2
5168    ny\t%0,%2"
5169   [(set_attr "op_type"  "RRE,RXE,RI,RI,RR,RX,RXY")])
5171 (define_insn "*andsi3_esa"
5172   [(set (match_operand:SI 0 "register_operand" "=d,d")
5173         (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5174                 (match_operand:SI 2 "general_operand" "d,R")))
5175    (clobber (reg:CC 33))]
5176   "!TARGET_ZARCH"
5177   "@
5178    nr\t%0,%2
5179    n\t%0,%2"
5180   [(set_attr "op_type"  "RR,RX")])
5182 (define_insn "*andsi3_ss"
5183   [(set (match_operand:SI 0 "s_operand" "=Q")
5184         (and:SI (match_dup 0)
5185                 (match_operand:SI 1 "s_imm_operand" "Q")))
5186    (clobber (reg:CC 33))]
5187   ""
5188   "nc\t%O0(4,%R0),%1"
5189   [(set_attr "op_type"  "SS")])
5191 (define_insn "*andsi3_ss_inv"
5192   [(set (match_operand:SI 0 "s_operand" "=Q")
5193         (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5194                 (match_dup 0)))
5195    (clobber (reg:CC 33))]
5196   ""
5197   "nc\t%O0(4,%R0),%1"
5198   [(set_attr "op_type"  "SS")])
5201 ; andhi3 instruction pattern(s).
5204 (define_insn "*andhi3_ni"
5205   [(set (match_operand:HI 0 "register_operand" "=d,d")
5206         (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5207                 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5208    (clobber (reg:CC 33))]
5209   "TARGET_ZARCH"
5210   "@
5211    nr\t%0,%2
5212    nill\t%0,%x2"
5213   [(set_attr "op_type"  "RR,RI")])
5215 (define_insn "andhi3"
5216   [(set (match_operand:HI 0 "register_operand" "=d")
5217         (and:HI (match_operand:HI 1 "register_operand" "%0")
5218                 (match_operand:HI 2 "nonmemory_operand" "d")))
5219    (clobber (reg:CC 33))]
5220   ""
5221   "nr\t%0,%2"
5222   [(set_attr "op_type"  "RR")])
5224 (define_insn "*andhi3_ss"
5225   [(set (match_operand:HI 0 "s_operand" "=Q")
5226         (and:HI (match_dup 0)
5227                 (match_operand:HI 1 "s_imm_operand" "Q")))
5228    (clobber (reg:CC 33))]
5229   ""
5230   "nc\t%O0(2,%R0),%1"
5231   [(set_attr "op_type"  "SS")])
5233 (define_insn "*andhi3_ss_inv"
5234   [(set (match_operand:HI 0 "s_operand" "=Q")
5235         (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5236                 (match_dup 0)))
5237    (clobber (reg:CC 33))]
5238   ""
5239   "nc\t%O0(2,%R0),%1"
5240   [(set_attr "op_type"  "SS")])
5243 ; andqi3 instruction pattern(s).
5246 (define_insn "*andqi3_ni"
5247   [(set (match_operand:QI 0 "register_operand" "=d,d")
5248         (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5249                 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5250    (clobber (reg:CC 33))]
5251   "TARGET_ZARCH"
5252   "@
5253    nr\t%0,%2
5254    nill\t%0,%b2"
5255   [(set_attr "op_type"  "RR,RI")])
5257 (define_insn "andqi3"
5258   [(set (match_operand:QI 0 "register_operand" "=d")
5259         (and:QI (match_operand:QI 1 "register_operand" "%0")
5260                 (match_operand:QI 2 "nonmemory_operand" "d")))
5261    (clobber (reg:CC 33))]
5262   ""
5263   "nr\t%0,%2"
5264   [(set_attr "op_type"  "RR")])
5266 (define_insn "*andqi3_ss"
5267   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5268         (and:QI (match_dup 0)
5269                 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5270    (clobber (reg:CC 33))]
5271   ""
5272   "@
5273    ni\t%0,%b1
5274    niy\t%0,%b1
5275    nc\t%O0(1,%R0),%1"
5276   [(set_attr "op_type"  "SI,SIY,SS")])
5278 (define_insn "*andqi3_ss_inv"
5279   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5280         (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5281                 (match_dup 0)))
5282    (clobber (reg:CC 33))]
5283   ""
5284   "@
5285    ni\t%0,%b1
5286    niy\t%0,%b1
5287    nc\t%O0(1,%R0),%1"
5288   [(set_attr "op_type"  "SI,SIY,SS")])
5292 ;;- Bit set (inclusive or) instructions.
5296 ; iordi3 instruction pattern(s).
5299 (define_insn "*iordi3_cc"
5300   [(set (reg 33)
5301         (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5302                          (match_operand:DI 2 "general_operand" "d,m"))
5303                  (const_int 0)))
5304    (set (match_operand:DI 0 "register_operand" "=d,d")
5305         (ior:DI (match_dup 1) (match_dup 2)))]
5306   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5307   "@
5308    ogr\t%0,%2
5309    og\t%0,%2"
5310   [(set_attr "op_type"  "RRE,RXY")])
5312 (define_insn "*iordi3_cconly"
5313   [(set (reg 33)
5314         (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5315                          (match_operand:DI 2 "general_operand" "d,m"))
5316                  (const_int 0)))
5317    (clobber (match_scratch:DI 0 "=d,d"))]
5318   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5319   "@
5320    ogr\t%0,%2
5321    og\t%0,%2"
5322   [(set_attr "op_type"  "RRE,RXY")])
5324 (define_insn "iordi3"
5325   [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d")
5326         (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,0,0,0,0")
5327                 (match_operand:DI 2 "general_operand" "N0HD0,N1HD0,N2HD0,N3HD0,d,m")))
5328    (clobber (reg:CC 33))]
5329   "TARGET_64BIT"
5330   "@
5331    oihh\t%0,%i2
5332    oihl\t%0,%i2
5333    oilh\t%0,%i2
5334    oill\t%0,%i2
5335    ogr\t%0,%2
5336    og\t%0,%2"
5337   [(set_attr "op_type"  "RI,RI,RI,RI,RRE,RXY")])
5339 (define_insn "*iordi3_ss"
5340   [(set (match_operand:DI 0 "s_operand" "=Q")
5341         (ior:DI (match_dup 0)
5342                 (match_operand:DI 1 "s_imm_operand" "Q")))
5343    (clobber (reg:CC 33))]
5344   ""
5345   "oc\t%O0(8,%R0),%1"
5346   [(set_attr "op_type"  "SS")])
5348 (define_insn "*iordi3_ss_inv"
5349   [(set (match_operand:DI 0 "s_operand" "=Q")
5350         (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5351                 (match_dup 0)))
5352    (clobber (reg:CC 33))]
5353   ""
5354   "oc\t%O0(8,%R0),%1"
5355   [(set_attr "op_type"  "SS")])
5358 ; iorsi3 instruction pattern(s).
5361 (define_insn "*iorsi3_cc"
5362   [(set (reg 33)
5363         (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5364                          (match_operand:SI 2 "general_operand" "d,R,T"))
5365                  (const_int 0)))
5366    (set (match_operand:SI 0 "register_operand" "=d,d,d")
5367         (ior:SI (match_dup 1) (match_dup 2)))]
5368   "s390_match_ccmode(insn, CCTmode)"
5369   "@
5370    or\t%0,%2
5371    o\t%0,%2
5372    oy\t%0,%2"
5373   [(set_attr "op_type"  "RR,RX,RXY")])
5375 (define_insn "*iorsi3_cconly"
5376   [(set (reg 33)
5377         (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5378                          (match_operand:SI 2 "general_operand" "d,R,T"))
5379                  (const_int 0)))
5380    (clobber (match_scratch:SI 0 "=d,d,d"))]
5381   "s390_match_ccmode(insn, CCTmode)"
5382   "@
5383    or\t%0,%2
5384    o\t%0,%2
5385    oy\t%0,%2"
5386   [(set_attr "op_type"  "RR,RX,RXY")])
5388 (define_expand "iorsi3"
5389   [(parallel 
5390     [(set (match_operand:SI 0 "register_operand" "")
5391           (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
5392                   (match_operand:SI 2 "general_operand" "")))
5393      (clobber (reg:CC 33))])]
5394   ""
5395   "")
5397 (define_insn "iorsi3_zarch"
5398   [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
5399         (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0,0")
5400                 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,d,R,T")))
5401    (clobber (reg:CC 33))]
5402   "TARGET_ZARCH"
5403   "@
5404    oilh\t%0,%i2
5405    oill\t%0,%i2
5406    or\t%0,%2
5407    o\t%0,%2
5408    oy\t%0,%2"
5409   [(set_attr "op_type"  "RI,RI,RR,RX,RXY")])
5411 (define_insn "iorsi3_esa"
5412   [(set (match_operand:SI 0 "register_operand" "=d,d")
5413         (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
5414                 (match_operand:SI 2 "general_operand" "d,R")))
5415    (clobber (reg:CC 33))]
5416   "!TARGET_ZARCH"
5417   "@
5418    or\t%0,%2
5419    o\t%0,%2"
5420   [(set_attr "op_type"  "RR,RX")])
5422 (define_insn "*iorsi3_ss"
5423   [(set (match_operand:SI 0 "s_operand" "=Q")
5424         (ior:SI (match_dup 0)
5425                 (match_operand:SI 1 "s_imm_operand" "Q")))
5426    (clobber (reg:CC 33))]
5427   ""
5428   "oc\t%O0(4,%R0),%1"
5429   [(set_attr "op_type"  "SS")])
5431 (define_insn "*iorsi3_ss_inv"
5432   [(set (match_operand:SI 0 "s_operand" "=Q")
5433         (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5434                 (match_dup 0)))
5435    (clobber (reg:CC 33))]
5436   ""
5437   "oc\t%O0(4,%R0),%1"
5438   [(set_attr "op_type"  "SS")])
5441 ; iorhi3 instruction pattern(s).
5444 (define_insn "*iorhi3_oi"
5445   [(set (match_operand:HI 0 "register_operand" "=d,d")
5446         (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5447                 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5448    (clobber (reg:CC 33))]
5449   "TARGET_ZARCH"
5450   "@
5451    or\t%0,%2
5452    oill\t%0,%x2"
5453   [(set_attr "op_type"  "RR,RI")])
5455 (define_insn "iorhi3"
5456   [(set (match_operand:HI 0 "register_operand" "=d")
5457         (ior:HI (match_operand:HI 1 "register_operand" "%0")
5458                 (match_operand:HI 2 "nonmemory_operand" "d")))
5459    (clobber (reg:CC 33))]
5460   ""
5461   "or\t%0,%2"
5462   [(set_attr "op_type"  "RR")])
5464 (define_insn "*iorhi3_ss"
5465   [(set (match_operand:HI 0 "s_operand" "=Q")
5466         (ior:HI (match_dup 0)
5467                 (match_operand:HI 1 "s_imm_operand" "Q")))
5468    (clobber (reg:CC 33))]
5469   ""
5470   "oc\t%O0(2,%R0),%1"
5471   [(set_attr "op_type"  "SS")])
5473 (define_insn "*iorhi3_ss_inv"
5474   [(set (match_operand:HI 0 "s_operand" "=Q")
5475         (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5476                 (match_dup 0)))
5477    (clobber (reg:CC 33))]
5478   ""
5479   "oc\t%O0(2,%R0),%1"
5480   [(set_attr "op_type"  "SS")])
5483 ; iorqi3 instruction pattern(s).
5486 (define_insn "*iorqi3_oi"
5487   [(set (match_operand:QI 0 "register_operand" "=d,d")
5488         (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5489                 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5490    (clobber (reg:CC 33))]
5491   "TARGET_ZARCH"
5492   "@
5493    or\t%0,%2
5494    oill\t%0,%b2"
5495   [(set_attr "op_type"  "RR,RI")])
5497 (define_insn "iorqi3"
5498   [(set (match_operand:QI 0 "register_operand" "=d")
5499         (ior:QI (match_operand:QI 1 "register_operand" "%0")
5500                 (match_operand:QI 2 "nonmemory_operand" "d")))
5501    (clobber (reg:CC 33))]
5502   ""
5503   "or\t%0,%2"
5504   [(set_attr "op_type"  "RR")])
5506 (define_insn "*iorqi3_ss"
5507   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5508         (ior:QI (match_dup 0)
5509                 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5510    (clobber (reg:CC 33))]
5511   ""
5512   "@
5513    oi\t%0,%b1
5514    oiy\t%0,%b1
5515    oc\t%O0(1,%R0),%1"
5516   [(set_attr "op_type"  "SI,SIY,SS")])
5518 (define_insn "*iorqi3_ss_inv"
5519   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5520         (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5521                 (match_dup 0)))
5522    (clobber (reg:CC 33))]
5523   ""
5524   "@
5525    oi\t%0,%b1
5526    oiy\t%0,%b1
5527    oc\t%O0(1,%R0),%1"
5528   [(set_attr "op_type"  "SI,SIY,SS")])
5532 ;;- Xor instructions.
5536 ; xordi3 instruction pattern(s).
5539 (define_insn "*xordi3_cc"
5540   [(set (reg 33)
5541         (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5542                          (match_operand:DI 2 "general_operand" "d,m"))
5543                  (const_int 0)))
5544    (set (match_operand:DI 0 "register_operand" "=d,d")
5545         (xor:DI (match_dup 1) (match_dup 2)))]
5546   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5547   "@
5548    xgr\t%0,%2
5549    xg\t%0,%2"
5550   [(set_attr "op_type"  "RRE,RXY")])
5552 (define_insn "*xordi3_cconly"
5553   [(set (reg 33)
5554         (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5555                          (match_operand:DI 2 "general_operand" "d,m"))
5556                  (const_int 0)))
5557    (clobber (match_scratch:DI 0 "=d,d"))]
5558   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5559   "@
5560    xgr\t%0,%2
5561    xr\t%0,%2"
5562   [(set_attr "op_type"  "RRE,RXY")])
5564 (define_insn "xordi3"
5565   [(set (match_operand:DI 0 "register_operand" "=d,d")
5566         (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5567                 (match_operand:DI 2 "general_operand" "d,m")))
5568    (clobber (reg:CC 33))]
5569   "TARGET_64BIT"
5570   "@
5571    xgr\t%0,%2
5572    xg\t%0,%2"
5573   [(set_attr "op_type"  "RRE,RXY")])
5575 (define_insn "*xordi3_ss"
5576   [(set (match_operand:DI 0 "s_operand" "=Q")
5577         (xor:DI (match_dup 0)
5578                 (match_operand:DI 1 "s_imm_operand" "Q")))
5579    (clobber (reg:CC 33))]
5580   ""
5581   "xc\t%O0(8,%R0),%1"
5582   [(set_attr "op_type"  "SS")])
5584 (define_insn "*xordi3_ss_inv"
5585   [(set (match_operand:DI 0 "s_operand" "=Q")
5586         (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5587                 (match_dup 0)))
5588    (clobber (reg:CC 33))]
5589   ""
5590   "xc\t%O0(8,%R0),%1"
5591   [(set_attr "op_type"  "SS")])
5594 ; xorsi3 instruction pattern(s).
5597 (define_insn "*xorsi3_cc"
5598   [(set (reg 33)
5599         (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5600                          (match_operand:SI 2 "general_operand" "d,R,T"))
5601                  (const_int 0)))
5602    (set (match_operand:SI 0 "register_operand" "=d,d,d")
5603         (xor:SI (match_dup 1) (match_dup 2)))]
5604   "s390_match_ccmode(insn, CCTmode)"
5605   "@
5606    xr\t%0,%2
5607    x\t%0,%2
5608    xy\t%0,%2"
5609   [(set_attr "op_type"  "RR,RX,RXY")])
5611 (define_insn "*xorsi3_cconly"
5612   [(set (reg 33)
5613         (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5614                          (match_operand:SI 2 "general_operand" "d,R,T"))
5615                  (const_int 0)))
5616    (clobber (match_scratch:SI 0 "=d,d,d"))]
5617   "s390_match_ccmode(insn, CCTmode)"
5618   "@
5619    xr\t%0,%2
5620    x\t%0,%2
5621    xy\t%0,%2"
5622   [(set_attr "op_type"  "RR,RX,RXY")])
5624 (define_insn "xorsi3"
5625   [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5626         (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5627                 (match_operand:SI 2 "general_operand" "d,R,T")))
5628    (clobber (reg:CC 33))]
5629   ""
5630   "@
5631    xr\t%0,%2
5632    x\t%0,%2
5633    xy\t%0,%2"
5634   [(set_attr "op_type"  "RR,RX,RXY")])
5636 (define_insn "*xorsi3_ss"
5637   [(set (match_operand:SI 0 "s_operand" "=Q")
5638         (xor:SI (match_dup 0)
5639                 (match_operand:SI 1 "s_imm_operand" "Q")))
5640    (clobber (reg:CC 33))]
5641   ""
5642   "xc\t%O0(4,%R0),%1"
5643   [(set_attr "op_type"  "SS")])
5645 (define_insn "*xorsi3_ss_inv"
5646   [(set (match_operand:SI 0 "s_operand" "=Q")
5647         (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5648                 (match_dup 0)))
5649    (clobber (reg:CC 33))]
5650   ""
5651   "xc\t%O0(4,%R0),%1"
5652   [(set_attr "op_type"  "SS")])
5655 ; xorhi3 instruction pattern(s).
5658 (define_insn "xorhi3"
5659   [(set (match_operand:HI 0 "register_operand" "=d")
5660         (xor:HI (match_operand:HI 1 "register_operand" "%0")
5661                 (match_operand:HI 2 "nonmemory_operand" "d")))
5662    (clobber (reg:CC 33))]
5663   ""
5664   "xr\t%0,%2"
5665   [(set_attr "op_type"  "RR")])
5667 (define_insn "*xorhi3_ss"
5668   [(set (match_operand:HI 0 "s_operand" "=Q")
5669         (xor:HI (match_dup 0)
5670                 (match_operand:HI 1 "s_imm_operand" "Q")))
5671    (clobber (reg:CC 33))]
5672   ""
5673   "xc\t%O0(2,%R0),%1"
5674   [(set_attr "op_type"  "SS")])
5676 (define_insn "*xorhi3_ss_inv"
5677   [(set (match_operand:HI 0 "s_operand" "=Q")
5678         (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5679                 (match_dup 0)))
5680    (clobber (reg:CC 33))]
5681   ""
5682   "xc\t%O0(2,%R0),%1"
5683   [(set_attr "op_type"  "SS")])
5686 ; xorqi3 instruction pattern(s).
5689 (define_insn "xorqi3"
5690   [(set (match_operand:QI 0 "register_operand" "=d")
5691         (xor:QI (match_operand:QI 1 "register_operand" "%0")
5692                 (match_operand:QI 2 "nonmemory_operand" "d")))
5693    (clobber (reg:CC 33))]
5694   ""
5695   "xr\t%0,%2"
5696   [(set_attr "op_type"  "RR")])
5698 (define_insn "*xorqi3_ss"
5699   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5700         (xor:QI (match_dup 0)
5701                 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5702    (clobber (reg:CC 33))]
5703   ""
5704   "@
5705    xi\t%0,%b1
5706    xiy\t%0,%b1
5707    xc\t%O0(1,%R0),%1"
5708   [(set_attr "op_type"  "SI,SIY,SS")])
5710 (define_insn "*xorqi3_ss_inv"
5711   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5712         (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5713                 (match_dup 0)))
5714    (clobber (reg:CC 33))]
5715   ""
5716   "@
5717    xi\t%0,%b1
5718    xiy\t%0,%b1
5719    xc\t%O0(1,%R0),%1"
5720   [(set_attr "op_type"  "SI,SIY,SS")])
5724 ;;- Negate instructions.
5728 ; negdi2 instruction pattern(s).
5731 (define_expand "negdi2"
5732   [(parallel
5733     [(set (match_operand:DI 0 "register_operand" "=d")
5734           (neg:DI (match_operand:DI 1 "register_operand" "d")))
5735      (clobber (reg:CC 33))])]
5736   ""
5737   "")
5739 (define_insn "*negdi2_64"
5740   [(set (match_operand:DI 0 "register_operand" "=d")
5741         (neg:DI (match_operand:DI 1 "register_operand" "d")))
5742    (clobber (reg:CC 33))]
5743   "TARGET_64BIT"
5744   "lcgr\t%0,%1"
5745   [(set_attr "op_type"  "RR")])
5747 (define_insn "*negdi2_31"
5748   [(set (match_operand:DI 0 "register_operand" "=d")
5749         (neg:DI (match_operand:DI 1 "register_operand" "d")))
5750    (clobber (reg:CC 33))]
5751   "!TARGET_64BIT"
5753   rtx xop[1];
5754   xop[0] = gen_label_rtx ();
5755   output_asm_insn ("lcr\t%0,%1", operands);
5756   output_asm_insn ("lcr\t%N0,%N1", operands);
5757   output_asm_insn ("je\t%l0", xop);
5758   output_asm_insn ("bctr\t%0,0", operands);
5759   targetm.asm_out.internal_label (asm_out_file, "L",
5760                              CODE_LABEL_NUMBER (xop[0]));
5761   return "";
5763   [(set_attr "op_type"  "NN")
5764    (set_attr "type"     "other")
5765    (set_attr "length"   "10")])
5768 ; negsi2 instruction pattern(s).
5771 (define_insn "negsi2"
5772   [(set (match_operand:SI 0 "register_operand" "=d")
5773         (neg:SI (match_operand:SI 1 "register_operand" "d")))
5774    (clobber (reg:CC 33))]
5775   ""
5776   "lcr\t%0,%1"
5777   [(set_attr "op_type"  "RR")])
5780 ; negdf2 instruction pattern(s).
5783 (define_expand "negdf2"
5784   [(parallel
5785     [(set (match_operand:DF 0 "register_operand" "=f")
5786           (neg:DF (match_operand:DF 1 "register_operand" "f")))
5787      (clobber (reg:CC 33))])]
5788   "TARGET_HARD_FLOAT"
5789   "")
5791 (define_insn "*negdf2"
5792   [(set (match_operand:DF 0 "register_operand" "=f")
5793         (neg:DF (match_operand:DF 1 "register_operand" "f")))
5794    (clobber (reg:CC 33))]
5795   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5796   "lcdbr\t%0,%1"
5797   [(set_attr "op_type"  "RRE")
5798    (set_attr "type"     "fsimpd")])
5800 (define_insn "*negdf2_ibm"
5801   [(set (match_operand:DF 0 "register_operand" "=f")
5802         (neg:DF (match_operand:DF 1 "register_operand" "f")))
5803    (clobber (reg:CC 33))]
5804   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5805   "lcdr\t%0,%1"
5806   [(set_attr "op_type"  "RR")
5807    (set_attr "type"     "fsimpd")])
5810 ; negsf2 instruction pattern(s).
5813 (define_expand "negsf2"
5814   [(parallel
5815     [(set (match_operand:SF 0 "register_operand" "=f")
5816           (neg:SF (match_operand:SF 1 "register_operand" "f")))
5817      (clobber (reg:CC 33))])]
5818   "TARGET_HARD_FLOAT"
5819   "")
5821 (define_insn "*negsf2"
5822   [(set (match_operand:SF 0 "register_operand" "=f")
5823         (neg:SF (match_operand:SF 1 "register_operand" "f")))
5824    (clobber (reg:CC 33))]
5825   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5826   "lcebr\t%0,%1"
5827   [(set_attr "op_type"  "RRE")
5828    (set_attr "type"     "fsimps")])
5830 (define_insn "*negsf2"
5831   [(set (match_operand:SF 0 "register_operand" "=f")
5832         (neg:SF (match_operand:SF 1 "register_operand" "f")))
5833    (clobber (reg:CC 33))]
5834   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5835   "lcer\t%0,%1"
5836   [(set_attr "op_type"  "RR")
5837    (set_attr "type"     "fsimps")])
5841 ;;- Absolute value instructions.
5845 ; absdi2 instruction pattern(s).
5848 (define_insn "absdi2"
5849   [(set (match_operand:DI 0 "register_operand" "=d")
5850         (abs:DI (match_operand:DI 1 "register_operand" "d")))
5851    (clobber (reg:CC 33))]
5852   "TARGET_64BIT"
5853   "lpgr\t%0,%1"
5854   [(set_attr "op_type"  "RRE")])
5857 ; abssi2 instruction pattern(s).
5860 (define_insn "abssi2"
5861   [(set (match_operand:SI 0 "register_operand" "=d")
5862         (abs:SI (match_operand:SI 1 "register_operand" "d")))
5863    (clobber (reg:CC 33))]
5864   ""
5865   "lpr\t%0,%1"
5866   [(set_attr "op_type"  "RR")])
5869 ; absdf2 instruction pattern(s).
5872 (define_expand "absdf2"
5873   [(parallel
5874     [(set (match_operand:DF 0 "register_operand" "=f")
5875           (abs:DF (match_operand:DF 1 "register_operand" "f")))
5876      (clobber (reg:CC 33))])]
5877   "TARGET_HARD_FLOAT"
5878   "")
5880 (define_insn "*absdf2"
5881   [(set (match_operand:DF 0 "register_operand" "=f")
5882         (abs:DF (match_operand:DF 1 "register_operand" "f")))
5883    (clobber (reg:CC 33))]
5884   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5885   "lpdbr\t%0,%1"
5886   [(set_attr "op_type"  "RRE")
5887    (set_attr "type"     "fsimpd")])
5889 (define_insn "*absdf2_ibm"
5890   [(set (match_operand:DF 0 "register_operand" "=f")
5891         (abs:DF (match_operand:DF 1 "register_operand" "f")))
5892    (clobber (reg:CC 33))]
5893   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5894   "lpdr\t%0,%1"
5895   [(set_attr "op_type"  "RR")
5896    (set_attr "type"     "fsimpd")])
5899 ; abssf2 instruction pattern(s).
5902 (define_expand "abssf2"
5903   [(parallel
5904     [(set (match_operand:SF 0 "register_operand" "=f")
5905           (abs:SF (match_operand:SF 1 "register_operand" "f")))
5906      (clobber (reg:CC 33))])]
5907   "TARGET_HARD_FLOAT"
5908   "")
5910 (define_insn "*abssf2"
5911   [(set (match_operand:SF 0 "register_operand" "=f")
5912         (abs:SF (match_operand:SF 1 "register_operand" "f")))
5913    (clobber (reg:CC 33))]
5914   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5915   "lpebr\t%0,%1"
5916   [(set_attr "op_type"  "RRE")
5917    (set_attr "type"     "fsimps")])
5919 (define_insn "*abssf2_ibm"
5920   [(set (match_operand:SF 0 "register_operand" "=f")
5921         (abs:SF (match_operand:SF 1 "register_operand" "f")))
5922    (clobber (reg:CC 33))]
5923   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5924   "lper\t%0,%1"
5925   [(set_attr "op_type"  "RR")
5926    (set_attr "type"     "fsimps")])
5929 ;;- Negated absolute value instructions
5933 ; Integer
5936 (define_insn "*negabssi2"
5937   [(set (match_operand:SI 0 "register_operand" "=d")
5938         (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
5939    (clobber (reg:CC 33))]
5940   ""
5941   "lnr\t%0,%1"
5942   [(set_attr "op_type" "RR")])
5944 (define_insn "*negabsdi2"
5945   [(set (match_operand:DI 0 "register_operand" "=d")
5946         (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
5947    (clobber (reg:CC 33))]
5948   "TARGET_64BIT"
5949   "lngr\t%0,%1"
5950   [(set_attr "op_type" "RRE")])
5953 ; Floating point
5956 (define_insn "*negabssf2"
5957   [(set (match_operand:SF 0 "register_operand" "=f")
5958         (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5959    (clobber (reg:CC 33))]
5960   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5961   "lnebr\t%0,%1"
5962   [(set_attr "op_type"  "RRE")
5963    (set_attr "type"     "fsimps")])
5965 (define_insn "*negabsdf2"
5966   [(set (match_operand:DF 0 "register_operand" "=f")
5967         (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5968    (clobber (reg:CC 33))]
5969   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5970   "lndbr\t%0,%1"
5971   [(set_attr "op_type"  "RRE")
5972    (set_attr "type"     "fsimpd")])
5975 ;;- Square root instructions.
5979 ; sqrtdf2 instruction pattern(s).
5982 (define_insn "sqrtdf2"
5983   [(set (match_operand:DF 0 "register_operand" "=f,f")
5984         (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
5985   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5986   "@
5987    sqdbr\t%0,%1
5988    sqdb\t%0,%1"
5989   [(set_attr "op_type"  "RRE,RXE")])
5992 ; sqrtsf2 instruction pattern(s).
5995 (define_insn "sqrtsf2"
5996   [(set (match_operand:SF 0 "register_operand" "=f,f")
5997         (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
5998   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5999   "@
6000    sqebr\t%0,%1
6001    sqeb\t%0,%1"
6002   [(set_attr "op_type"  "RRE,RXE")])
6005 ;;- One complement instructions.
6009 ; one_cmpldi2 instruction pattern(s).
6012 (define_expand "one_cmpldi2"
6013   [(parallel
6014     [(set (match_operand:DI 0 "register_operand" "")
6015           (xor:DI (match_operand:DI 1 "register_operand" "")
6016                   (const_int -1)))
6017      (clobber (reg:CC 33))])]
6018   "TARGET_64BIT"
6019   "")
6022 ; one_cmplsi2 instruction pattern(s).
6025 (define_expand "one_cmplsi2"
6026   [(parallel
6027     [(set (match_operand:SI 0 "register_operand" "")
6028           (xor:SI (match_operand:SI 1 "register_operand" "")
6029                   (const_int -1)))
6030      (clobber (reg:CC 33))])]
6031   ""
6032   "")
6035 ; one_cmplhi2 instruction pattern(s).
6038 (define_expand "one_cmplhi2"
6039   [(parallel
6040     [(set (match_operand:HI 0 "register_operand" "")
6041           (xor:HI (match_operand:HI 1 "register_operand" "")
6042                   (const_int -1)))
6043      (clobber (reg:CC 33))])]
6044   ""
6045   "")
6048 ; one_cmplqi2 instruction pattern(s).
6051 (define_expand "one_cmplqi2"
6052   [(parallel
6053     [(set (match_operand:QI 0 "register_operand" "")
6054           (xor:QI (match_operand:QI 1 "register_operand" "")
6055                   (const_int -1)))
6056      (clobber (reg:CC 33))])]
6057   ""
6058   "")
6062 ;;- Rotate instructions.
6066 ; rotldi3 instruction pattern(s).
6069 (define_insn "rotldi3"
6070   [(set (match_operand:DI 0 "register_operand" "=d")
6071         (rotate:DI (match_operand:DI 1 "register_operand" "d")
6072                    (match_operand:SI 2 "shift_count_operand" "Y")))]
6073   "TARGET_64BIT"
6074   "rllg\t%0,%1,%Y2"
6075   [(set_attr "op_type"  "RSE")
6076    (set_attr "atype"    "reg")])
6079 ; rotlsi3 instruction pattern(s).
6082 (define_insn "rotlsi3"
6083   [(set (match_operand:SI 0 "register_operand" "=d")
6084         (rotate:SI (match_operand:SI 1 "register_operand" "d")
6085                    (match_operand:SI 2 "shift_count_operand" "Y")))]
6086   "TARGET_CPU_ZARCH"
6087   "rll\t%0,%1,%Y2"
6088   [(set_attr "op_type"  "RSE")
6089    (set_attr "atype"    "reg")])
6093 ;;- Arithmetic shift instructions.
6097 ; ashldi3 instruction pattern(s).
6100 (define_expand "ashldi3"
6101   [(set (match_operand:DI 0 "register_operand" "")
6102         (ashift:DI (match_operand:DI 1 "register_operand" "")
6103                    (match_operand:SI 2 "shift_count_operand" "")))]
6104   ""
6105   "")
6107 (define_insn "*ashldi3_31"
6108   [(set (match_operand:DI 0 "register_operand" "=d")
6109         (ashift:DI (match_operand:DI 1 "register_operand" "0")
6110                    (match_operand:SI 2 "shift_count_operand" "Y")))]
6111   "!TARGET_64BIT"
6112   "sldl\t%0,%Y2"
6113   [(set_attr "op_type"  "RS")
6114    (set_attr "atype"    "reg")])
6116 (define_insn "*ashldi3_64"
6117   [(set (match_operand:DI 0 "register_operand" "=d")
6118         (ashift:DI (match_operand:DI 1 "register_operand" "d")
6119                    (match_operand:SI 2 "shift_count_operand" "Y")))]
6120   "TARGET_64BIT"
6121   "sllg\t%0,%1,%Y2"
6122   [(set_attr "op_type"  "RSE")
6123    (set_attr "atype"    "reg")])
6126 ; ashrdi3 instruction pattern(s).
6129 (define_expand "ashrdi3"
6130   [(parallel
6131     [(set (match_operand:DI 0 "register_operand" "")
6132           (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6133                        (match_operand:SI 2 "shift_count_operand" "")))
6134      (clobber (reg:CC 33))])]
6135   ""
6136   "")
6138 (define_insn "*ashrdi3_cc_31"
6139   [(set (reg 33)
6140         (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6141                               (match_operand:SI 2 "shift_count_operand" "Y"))
6142                  (const_int 0)))
6143    (set (match_operand:DI 0 "register_operand" "=d")
6144         (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6145   "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6146   "srda\t%0,%Y2"
6147   [(set_attr "op_type"  "RS")
6148    (set_attr "atype"    "reg")])
6150 (define_insn "*ashrdi3_cconly_31"
6151   [(set (reg 33)
6152         (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6153                               (match_operand:SI 2 "shift_count_operand" "Y"))
6154                  (const_int 0)))
6155    (clobber (match_scratch:DI 0 "=d"))]
6156   "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6157   "srda\t%0,%Y2"
6158   [(set_attr "op_type"  "RS")
6159    (set_attr "atype"    "reg")])
6161 (define_insn "*ashrdi3_31"
6162   [(set (match_operand:DI 0 "register_operand" "=d")
6163         (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6164                      (match_operand:SI 2 "shift_count_operand" "Y")))
6165    (clobber (reg:CC 33))]
6166   "!TARGET_64BIT"
6167   "srda\t%0,%Y2"
6168   [(set_attr "op_type"  "RS")
6169    (set_attr "atype"    "reg")])
6171 (define_insn "*ashrdi3_cc_64"
6172   [(set (reg 33)
6173         (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6174                               (match_operand:SI 2 "shift_count_operand" "Y"))
6175                  (const_int 0)))
6176    (set (match_operand:DI 0 "register_operand" "=d")
6177         (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6178   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6179   "srag\t%0,%1,%Y2"
6180   [(set_attr "op_type"  "RSE")
6181    (set_attr "atype"    "reg")])
6183 (define_insn "*ashrdi3_cconly_64"
6184   [(set (reg 33)
6185         (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6186                               (match_operand:SI 2 "shift_count_operand" "Y"))
6187                  (const_int 0)))
6188    (clobber (match_scratch:DI 0 "=d"))]
6189   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6190   "srag\t%0,%1,%Y2"
6191   [(set_attr "op_type"  "RSE")
6192    (set_attr "atype"    "reg")])
6194 (define_insn "*ashrdi3_64"
6195   [(set (match_operand:DI 0 "register_operand" "=d")
6196         (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6197                      (match_operand:SI 2 "shift_count_operand" "Y")))
6198    (clobber (reg:CC 33))]
6199   "TARGET_64BIT"
6200   "srag\t%0,%1,%Y2"
6201   [(set_attr "op_type"  "RSE")
6202    (set_attr "atype"    "reg")])
6206 ; ashlsi3 instruction pattern(s).
6209 (define_insn "ashlsi3"
6210   [(set (match_operand:SI 0 "register_operand" "=d")
6211         (ashift:SI (match_operand:SI 1 "register_operand" "0")
6212                    (match_operand:SI 2 "shift_count_operand" "Y")))]
6213   ""
6214   "sll\t%0,%Y2"
6215   [(set_attr "op_type"  "RS")
6216    (set_attr "atype"    "reg")])
6219 ; ashrsi3 instruction pattern(s).
6222 (define_insn "*ashrsi3_cc"
6223   [(set (reg 33)
6224         (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6225                               (match_operand:SI 2 "shift_count_operand" "Y"))
6226                  (const_int 0)))
6227    (set (match_operand:SI 0 "register_operand" "=d")
6228         (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6229   "s390_match_ccmode(insn, CCSmode)"
6230   "sra\t%0,%Y2"
6231   [(set_attr "op_type"  "RS")
6232    (set_attr "atype"    "reg")])
6235 (define_insn "*ashrsi3_cconly"
6236   [(set (reg 33)
6237         (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6238                               (match_operand:SI 2 "shift_count_operand" "Y"))
6239                  (const_int 0)))
6240    (clobber (match_scratch:SI 0 "=d"))]
6241   "s390_match_ccmode(insn, CCSmode)"
6242   "sra\t%0,%Y2"
6243   [(set_attr "op_type"  "RS")
6244    (set_attr "atype"    "reg")])
6246 (define_insn "ashrsi3"
6247   [(set (match_operand:SI 0 "register_operand" "=d")
6248         (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6249                      (match_operand:SI 2 "shift_count_operand" "Y")))
6250    (clobber (reg:CC 33))]
6251   ""
6252   "sra\t%0,%Y2"
6253   [(set_attr "op_type"  "RS")
6254    (set_attr "atype"    "reg")])
6258 ;;- logical shift instructions.
6262 ; lshrdi3 instruction pattern(s).
6265 (define_expand "lshrdi3"
6266   [(set (match_operand:DI 0 "register_operand" "")
6267         (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6268                      (match_operand:SI 2 "shift_count_operand" "")))]
6269   ""
6270   "")
6272 (define_insn "*lshrdi3_31"
6273   [(set (match_operand:DI 0 "register_operand" "=d")
6274         (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6275                      (match_operand:SI 2 "shift_count_operand" "Y")))]
6276   "!TARGET_64BIT"
6277   "srdl\t%0,%Y2"
6278    [(set_attr "op_type"  "RS")
6279     (set_attr "atype"    "reg")])
6281 (define_insn "*lshrdi3_64"
6282   [(set (match_operand:DI 0 "register_operand" "=d")
6283         (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6284                      (match_operand:SI 2 "shift_count_operand" "Y")))]
6285   "TARGET_64BIT"
6286   "srlg\t%0,%1,%Y2"
6287   [(set_attr "op_type"  "RSE")
6288    (set_attr "atype"    "reg")])
6291 ; lshrsi3 instruction pattern(s).
6294 (define_insn "lshrsi3"
6295   [(set (match_operand:SI 0 "register_operand" "=d")
6296         (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6297                      (match_operand:SI 2 "shift_count_operand" "Y")))]
6298   ""
6299   "srl\t%0,%Y2"
6300   [(set_attr "op_type"  "RS")
6301    (set_attr "atype"    "reg")])
6305 ;; Branch instruction patterns.
6308 (define_expand "beq"
6309   [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6310    (set (pc)
6311         (if_then_else (eq (reg:CCZ 33) (const_int 0))
6312                       (label_ref (match_operand 0 "" ""))
6313                       (pc)))]
6314   ""
6315   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6317 (define_expand "bne"
6318   [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6319    (set (pc)
6320         (if_then_else (ne (reg:CCZ 33) (const_int 0))
6321                       (label_ref (match_operand 0 "" ""))
6322                       (pc)))]
6323   ""
6324   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6326 (define_expand "bgt"
6327   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6328    (set (pc)
6329         (if_then_else (gt (reg:CCS 33) (const_int 0))
6330                       (label_ref (match_operand 0 "" ""))
6331                       (pc)))]
6332   ""
6333   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6335 (define_expand "bgtu"
6336   [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6337    (set (pc)
6338         (if_then_else (gtu (reg:CCU 33) (const_int 0))
6339                       (label_ref (match_operand 0 "" ""))
6340                       (pc)))]
6341   ""
6342   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6344 (define_expand "blt"
6345   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6346    (set (pc)
6347         (if_then_else (lt (reg:CCS 33) (const_int 0))
6348                       (label_ref (match_operand 0 "" ""))
6349                       (pc)))]
6350   ""
6351   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6353 (define_expand "bltu"
6354   [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6355    (set (pc)
6356         (if_then_else (ltu (reg:CCU 33) (const_int 0))
6357                       (label_ref (match_operand 0 "" ""))
6358                       (pc)))]
6359   ""
6360   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6362 (define_expand "bge"
6363   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6364    (set (pc)
6365         (if_then_else (ge (reg:CCS 33) (const_int 0))
6366                       (label_ref (match_operand 0 "" ""))
6367                       (pc)))]
6368   ""
6369   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6371 (define_expand "bgeu"
6372   [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6373    (set (pc)
6374         (if_then_else (geu (reg:CCU 33) (const_int 0))
6375                       (label_ref (match_operand 0 "" ""))
6376                       (pc)))]
6377   ""
6378   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6380 (define_expand "ble"
6381   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6382    (set (pc)
6383         (if_then_else (le (reg:CCS 33) (const_int 0))
6384                       (label_ref (match_operand 0 "" ""))
6385                       (pc)))]
6386   ""
6387   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6389 (define_expand "bleu"
6390   [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6391    (set (pc)
6392         (if_then_else (leu (reg:CCU 33) (const_int 0))
6393                       (label_ref (match_operand 0 "" ""))
6394                       (pc)))]
6395   ""
6396   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6398 (define_expand "bunordered"
6399   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6400    (set (pc)
6401         (if_then_else (unordered (reg:CCS 33) (const_int 0))
6402                       (label_ref (match_operand 0 "" ""))
6403                       (pc)))]
6404   ""
6405   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6407 (define_expand "bordered"
6408   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6409    (set (pc)
6410         (if_then_else (ordered (reg:CCS 33) (const_int 0))
6411                       (label_ref (match_operand 0 "" ""))
6412                       (pc)))]
6413   ""
6414   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6416 (define_expand "buneq"
6417   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6418    (set (pc)
6419         (if_then_else (uneq (reg:CCS 33) (const_int 0))
6420                       (label_ref (match_operand 0 "" ""))
6421                       (pc)))]
6422   ""
6423   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6425 (define_expand "bungt"
6426   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6427    (set (pc)
6428         (if_then_else (ungt (reg:CCS 33) (const_int 0))
6429                       (label_ref (match_operand 0 "" ""))
6430                       (pc)))]
6431   ""
6432   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6434 (define_expand "bunlt"
6435   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6436    (set (pc)
6437         (if_then_else (unlt (reg:CCS 33) (const_int 0))
6438                       (label_ref (match_operand 0 "" ""))
6439                       (pc)))]
6440   ""
6441   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6443 (define_expand "bunge"
6444   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6445    (set (pc)
6446         (if_then_else (unge (reg:CCS 33) (const_int 0))
6447                       (label_ref (match_operand 0 "" ""))
6448                       (pc)))]
6449   ""
6450   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6452 (define_expand "bunle"
6453   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6454    (set (pc)
6455         (if_then_else (unle (reg:CCS 33) (const_int 0))
6456                       (label_ref (match_operand 0 "" ""))
6457                       (pc)))]
6458   ""
6459   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6461 (define_expand "bltgt"
6462   [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6463    (set (pc)
6464         (if_then_else (ltgt (reg:CCS 33) (const_int 0))
6465                       (label_ref (match_operand 0 "" ""))
6466                       (pc)))]
6467   ""
6468   "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6472 ;;- Conditional jump instructions.
6475 (define_insn "cjump"
6476  [(set (pc)
6477        (if_then_else
6478          (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6479          (label_ref (match_operand 0 "" ""))
6480          (pc)))]
6481   ""
6483   if (get_attr_length (insn) == 4)
6484     return "j%C1\t%l0";
6485   else if (TARGET_CPU_ZARCH)
6486     return "jg%C1\t%l0";
6487   else
6488     abort ();
6490   [(set_attr "op_type" "RI")
6491    (set_attr "type"    "branch")
6492    (set (attr "length")
6493         (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6494                 (const_int 4)
6495                (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6496                  (const_int 6)
6497                (eq (symbol_ref "flag_pic") (const_int 0))
6498                  (const_int 6)] (const_int 8)))])
6500 (define_insn "*cjump_long"
6501  [(set (pc)
6502        (if_then_else
6503          (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6504          (match_operand 0 "address_operand" "U")
6505          (pc)))]
6506   ""
6508   if (get_attr_op_type (insn) == OP_TYPE_RR)
6509     return "b%C1r\t%0";
6510   else
6511     return "b%C1\t%a0";
6513   [(set (attr "op_type")
6514         (if_then_else (match_operand 0 "register_operand" "")
6515                       (const_string "RR") (const_string "RX")))
6516    (set_attr "type"    "branch")
6517    (set_attr "atype" "agen")])
6521 ;;- Negated conditional jump instructions.
6524 (define_insn "icjump"
6525  [(set (pc)
6526        (if_then_else
6527          (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6528          (pc)
6529          (label_ref (match_operand 0 "" ""))))]
6530   ""
6532   if (get_attr_length (insn) == 4)
6533     return "j%D1\t%l0";
6534   else if (TARGET_CPU_ZARCH)
6535     return "jg%D1\t%l0";
6536   else
6537     abort ();
6539   [(set_attr "op_type" "RI")
6540    (set_attr "type"    "branch")
6541    (set (attr "length")
6542         (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6543                 (const_int 4)
6544                (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6545                  (const_int 6)
6546                (eq (symbol_ref "flag_pic") (const_int 0))
6547                  (const_int 6)] (const_int 8)))])
6549 (define_insn "*icjump_long"
6550  [(set (pc)
6551        (if_then_else
6552          (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6553          (pc)
6554          (match_operand 0 "address_operand" "U")))]
6555   ""
6557   if (get_attr_op_type (insn) == OP_TYPE_RR)
6558     return "b%D1r\t%0";
6559   else
6560     return "b%D1\t%a0";
6562   [(set (attr "op_type")
6563         (if_then_else (match_operand 0 "register_operand" "")
6564                       (const_string "RR") (const_string "RX")))
6565    (set_attr "type"  "branch")
6566    (set_attr "atype" "agen")])
6569 ;;- Trap instructions.
6572 (define_insn "trap"
6573   [(trap_if (const_int 1) (const_int 0))]
6574   ""
6575   "j\t.+2"
6576   [(set_attr "op_type" "RX")
6577    (set_attr "type"  "branch")])
6579 (define_expand "conditional_trap"
6580   [(set (match_dup 2) (match_dup 3))
6581    (trap_if (match_operator 0 "comparison_operator"
6582                             [(match_dup 2) (const_int 0)])
6583             (match_operand:SI 1 "general_operand" ""))]
6584   ""
6586    enum machine_mode ccmode;
6588    if (operands[1] != const0_rtx) FAIL;
6590    ccmode = s390_select_ccmode (GET_CODE (operands[0]),
6591                                 s390_compare_op0, s390_compare_op1);
6592    operands[2] = gen_rtx_REG (ccmode, 33);
6593    operands[3] = gen_rtx_COMPARE (ccmode, s390_compare_op0, s390_compare_op1);
6596 (define_insn "*trap"
6597   [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6598             (const_int 0))]
6599   ""
6600   "j%C0\t.+2";
6601   [(set_attr "op_type" "RI")
6602    (set_attr "type"  "branch")])
6605 ;;- Loop instructions.
6607 ;;  This is all complicated by the fact that since this is a jump insn
6608 ;;  we must handle our own output reloads.
6610 (define_expand "doloop_end"
6611   [(use (match_operand 0 "" ""))        ; loop pseudo
6612    (use (match_operand 1 "" ""))        ; iterations; zero if unknown
6613    (use (match_operand 2 "" ""))        ; max iterations
6614    (use (match_operand 3 "" ""))        ; loop level
6615    (use (match_operand 4 "" ""))]       ; label
6616   ""
6618   if (GET_MODE (operands[0]) == SImode)
6619     emit_jump_insn (gen_doloop_si (operands[4], operands[0], operands[0]));
6620   else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6621     emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6622   else
6623     FAIL;
6625   DONE;
6628 (define_insn "doloop_si"
6629   [(set (pc)
6630         (if_then_else
6631           (ne (match_operand:SI 1 "register_operand" "d,d")
6632               (const_int 1))
6633           (label_ref (match_operand 0 "" ""))
6634           (pc)))
6635    (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6636         (plus:SI (match_dup 1) (const_int -1)))
6637    (clobber (match_scratch:SI 3 "=X,&d"))
6638    (clobber (reg:CC 33))]
6639   ""
6641   if (which_alternative != 0)
6642     return "#";
6643   else if (get_attr_length (insn) == 4)
6644     return "brct\t%1,%l0";
6645   else if (TARGET_CPU_ZARCH)
6646     return "ahi\t%1,-1\;jgne\t%l0";
6647   else
6648     abort ();
6650   [(set_attr "op_type"  "RI")
6651    (set_attr "type"  "branch")
6652    (set (attr "length")
6653         (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6654                 (const_int 4)
6655                (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6656                  (const_int 10)
6657                (eq (symbol_ref "flag_pic") (const_int 0))
6658                  (const_int 6)] (const_int 8)))])
6660 (define_insn "*doloop_si_long"
6661   [(set (pc)
6662         (if_then_else
6663           (ne (match_operand:SI 1 "register_operand" "d,d")
6664               (const_int 1))
6665           (match_operand 0 "address_operand" "U,U")
6666           (pc)))
6667    (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6668         (plus:SI (match_dup 1) (const_int -1)))
6669    (clobber (match_scratch:SI 3 "=X,&d"))
6670    (clobber (reg:CC 33))]
6671   ""
6673   if (get_attr_op_type (insn) == OP_TYPE_RR)
6674     return "bctr\t%1,%0";
6675   else
6676     return "bct\t%1,%a0";
6678   [(set (attr "op_type")
6679         (if_then_else (match_operand 0 "register_operand" "")
6680                       (const_string "RR") (const_string "RX")))
6681    (set_attr "type"  "branch")
6682    (set_attr "atype" "agen")])
6684 (define_split
6685   [(set (pc)
6686         (if_then_else (ne (match_operand:SI 1 "register_operand" "")
6687                           (const_int 1))
6688                       (match_operand 0 "" "")
6689                       (pc)))
6690    (set (match_operand:SI 2 "nonimmediate_operand" "")
6691         (plus:SI (match_dup 1) (const_int -1)))
6692    (clobber (match_scratch:SI 3 ""))
6693    (clobber (reg:CC 33))]
6694   "reload_completed
6695    && (! REG_P (operands[2])
6696        || ! rtx_equal_p (operands[1], operands[2]))"
6697   [(set (match_dup 3) (match_dup 1))
6698    (parallel [(set (reg:CCAN 33)
6699                    (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6700                                  (const_int 0)))
6701               (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6702    (set (match_dup 2) (match_dup 3))
6703    (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6704                            (match_dup 0)
6705                            (pc)))]
6706   "")
6708 (define_insn "doloop_di"
6709   [(set (pc)
6710         (if_then_else
6711           (ne (match_operand:DI 1 "register_operand" "d,d")
6712               (const_int 1))
6713           (label_ref (match_operand 0 "" ""))
6714           (pc)))
6715    (set (match_operand:DI 2 "register_operand" "=1,?*m*r")
6716         (plus:DI (match_dup 1) (const_int -1)))
6717    (clobber (match_scratch:DI 3 "=X,&d"))
6718    (clobber (reg:CC 33))]
6719   "TARGET_64BIT"
6721   if (which_alternative != 0)
6722     return "#";
6723   else if (get_attr_length (insn) == 4)
6724     return "brctg\t%1,%l0";
6725   else
6726     return "aghi\t%1,-1\;jgne\t%l0";
6728   [(set_attr "op_type"  "RI")
6729    (set_attr "type"  "branch")
6730    (set (attr "length")
6731         (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6732                       (const_int 4) (const_int 10)))])
6734 (define_split
6735   [(set (pc)
6736         (if_then_else (ne (match_operand:DI 1 "register_operand" "")
6737                           (const_int 1))
6738                       (match_operand 0 "" "")
6739                       (pc)))
6740    (set (match_operand:DI 2 "nonimmediate_operand" "")
6741         (plus:DI (match_dup 1) (const_int -1)))
6742    (clobber (match_scratch:DI 3 ""))
6743    (clobber (reg:CC 33))]
6744   "reload_completed
6745    && (! REG_P (operands[2])
6746        || ! rtx_equal_p (operands[1], operands[2]))"
6747   [(set (match_dup 3) (match_dup 1))
6748    (parallel [(set (reg:CCAN 33)
6749                    (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6750                                  (const_int 0)))
6751               (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6752    (set (match_dup 2) (match_dup 3))
6753    (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6754                            (match_dup 0)
6755                            (pc)))]
6756   "")
6759 ;;- Unconditional jump instructions.
6763 ; jump instruction pattern(s).
6766 (define_insn "jump"
6767   [(set (pc) (label_ref (match_operand 0 "" "")))]
6768   ""
6770   if (get_attr_length (insn) == 4)
6771     return "j\t%l0";
6772   else if (TARGET_CPU_ZARCH)
6773     return "jg\t%l0";
6774   else
6775     abort ();
6777   [(set_attr "op_type" "RI")
6778    (set_attr "type"  "branch")
6779    (set (attr "length")
6780         (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6781                 (const_int 4)
6782                (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
6783                  (const_int 6)
6784                (eq (symbol_ref "flag_pic") (const_int 0))
6785                  (const_int 6)] (const_int 8)))])
6788 ; indirect-jump instruction pattern(s).
6791 (define_insn "indirect_jump"
6792  [(set (pc) (match_operand 0 "address_operand" "U"))]
6793   ""
6795   if (get_attr_op_type (insn) == OP_TYPE_RR)
6796     return "br\t%0";
6797   else
6798     return "b\t%a0";
6800   [(set (attr "op_type")
6801         (if_then_else (match_operand 0 "register_operand" "")
6802                       (const_string "RR") (const_string "RX")))
6803    (set_attr "type"  "branch")
6804    (set_attr "atype" "agen")])
6807 ; casesi instruction pattern(s).
6810 (define_insn "casesi_jump"
6811  [(set (pc) (match_operand 0 "address_operand" "U"))
6812    (use (label_ref (match_operand 1 "" "")))]
6813   ""
6815   if (get_attr_op_type (insn) == OP_TYPE_RR)
6816     return "br\t%0";
6817   else
6818     return "b\t%a0";
6820   [(set (attr "op_type")
6821         (if_then_else (match_operand 0 "register_operand" "")
6822                       (const_string "RR") (const_string "RX")))
6823    (set_attr "type"  "branch")
6824    (set_attr "atype" "agen")])
6826 (define_expand "casesi"
6827   [(match_operand:SI 0 "general_operand" "")
6828    (match_operand:SI 1 "general_operand" "")
6829    (match_operand:SI 2 "general_operand" "")
6830    (label_ref (match_operand 3 "" ""))
6831    (label_ref (match_operand 4 "" ""))]
6832   ""
6834    rtx index  = gen_reg_rtx (SImode);
6835    rtx base   = gen_reg_rtx (Pmode);
6836    rtx target = gen_reg_rtx (Pmode);
6838    emit_move_insn (index, operands[0]);
6839    emit_insn (gen_subsi3 (index, index, operands[1]));
6840    emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6841                             operands[4]);
6843    if (Pmode != SImode)
6844      index = convert_to_mode (Pmode, index, 1);
6845    if (GET_CODE (index) != REG)
6846      index = copy_to_mode_reg (Pmode, index);
6848    if (TARGET_64BIT)
6849        emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6850    else
6851        emit_insn (gen_ashlsi3 (index, index, GEN_INT (2)));
6853    emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6855    index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
6856    emit_move_insn (target, index);
6858    if (flag_pic)
6859      target = gen_rtx_PLUS (Pmode, base, target);
6860    emit_jump_insn (gen_casesi_jump (target, operands[3]));
6862    DONE;
6867 ;;- Jump to subroutine.
6872 ; untyped call instruction pattern(s).
6875 ;; Call subroutine returning any type.
6876 (define_expand "untyped_call"
6877   [(parallel [(call (match_operand 0 "" "")
6878                     (const_int 0))
6879               (match_operand 1 "" "")
6880               (match_operand 2 "" "")])]
6881   ""
6883   int i;
6885   emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6887   for (i = 0; i < XVECLEN (operands[2], 0); i++)
6888     {
6889       rtx set = XVECEXP (operands[2], 0, i);
6890       emit_move_insn (SET_DEST (set), SET_SRC (set));
6891     }
6893   /* The optimizer does not know that the call sets the function value
6894      registers we stored in the result block.  We avoid problems by
6895      claiming that all hard registers are used and clobbered at this
6896      point.  */
6897   emit_insn (gen_blockage ());
6899   DONE;
6902 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6903 ;; all of memory.  This blocks insns from being moved across this point.
6905 (define_insn "blockage"
6906   [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6907   ""
6908   ""
6909   [(set_attr "type"    "none")
6910    (set_attr "length"  "0")])
6915 ; call instruction pattern(s).
6918 (define_expand "call"
6919   [(call (match_operand 0 "" "")
6920          (match_operand 1 "" ""))
6921    (use (match_operand 2 "" ""))]
6922   ""
6924   bool plt_call = false;
6925   rtx insn;
6927   /* Direct function calls need special treatment.  */
6928   if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
6929     {
6930       rtx sym = XEXP (operands[0], 0);
6932       /* When calling a global routine in PIC mode, we must
6933          replace the symbol itself with the PLT stub.  */
6934       if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
6935         {
6936           sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
6937           sym = gen_rtx_CONST (Pmode, sym);
6938           plt_call = true;
6939         }
6941       /* Unless we can use the bras(l) insn, force the
6942          routine address into a register.  */
6943       if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
6944         {
6945           if (flag_pic)
6946             sym = legitimize_pic_address (sym, 0);
6947           else
6948             sym = force_reg (Pmode, sym);
6949         }
6951       operands[0] = gen_rtx_MEM (QImode, sym);
6952     }
6954   /* Emit insn.  */
6955   insn = emit_call_insn (gen_call_exp (operands[0], operands[1],
6956                                        gen_rtx_REG (Pmode, RETURN_REGNUM)));
6958   /* 31-bit PLT stubs use the GOT register implicitly.  */
6959   if (!TARGET_64BIT && plt_call)
6960     use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
6961   
6962   DONE;
6965 (define_expand "call_exp"
6966   [(parallel [(call (match_operand 0 "" "")
6967                     (match_operand 1 "" ""))
6968               (clobber (match_operand 2 "" ""))])]
6969   ""
6970   "")
6972 (define_insn "*bras"
6973   [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6974          (match_operand 1 "const_int_operand" "n"))
6975    (clobber (match_operand 2 "register_operand" "=r"))]
6976   "TARGET_SMALL_EXEC && GET_MODE (operands[2]) == Pmode"
6977   "bras\t%2,%0"
6978   [(set_attr "op_type" "RI")
6979    (set_attr "type"    "jsr")])
6981 (define_insn "*brasl"
6982   [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6983          (match_operand 1 "const_int_operand" "n"))
6984    (clobber (match_operand 2 "register_operand" "=r"))]
6985   "TARGET_CPU_ZARCH && GET_MODE (operands[2]) == Pmode"
6986   "brasl\t%2,%0"
6987   [(set_attr "op_type" "RIL")
6988    (set_attr "type"    "jsr")])
6990 (define_insn "*basr"
6991   [(call (mem:QI (match_operand 0 "address_operand" "U"))
6992          (match_operand 1 "const_int_operand" "n"))
6993    (clobber (match_operand 2 "register_operand" "=r"))]
6994   "GET_MODE (operands[2]) == Pmode"
6996   if (get_attr_op_type (insn) == OP_TYPE_RR)
6997     return "basr\t%2,%0";
6998   else
6999     return "bas\t%2,%a0";
7001   [(set (attr "op_type")
7002         (if_then_else (match_operand 0 "register_operand" "")
7003                       (const_string "RR") (const_string "RX")))
7004    (set_attr "type"  "jsr")
7005    (set_attr "atype" "agen")])
7008 ; call_value instruction pattern(s).
7011 (define_expand "call_value"
7012   [(set (match_operand 0 "" "")
7013         (call (match_operand 1 "" "")
7014               (match_operand 2 "" "")))
7015    (use (match_operand 3 "" ""))]
7016   ""
7018   bool plt_call = false;
7019   rtx insn;
7021   /* Direct function calls need special treatment.  */
7022   if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
7023     {
7024       rtx sym = XEXP (operands[1], 0);
7026       /* When calling a global routine in PIC mode, we must
7027          replace the symbol itself with the PLT stub.  */
7028       if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
7029         {
7030           sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7031           sym = gen_rtx_CONST (Pmode, sym);
7032           plt_call = true;
7033         }
7035       /* Unless we can use the bras(l) insn, force the
7036          routine address into a register.  */
7037       if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7038         {
7039           if (flag_pic)
7040             sym = legitimize_pic_address (sym, 0);
7041           else
7042             sym = force_reg (Pmode, sym);
7043         }
7045       operands[1] = gen_rtx_MEM (QImode, sym);
7046     }
7048   /* Emit insn.  */
7049   insn = emit_call_insn (
7050             gen_call_value_exp (operands[0], operands[1], operands[2],
7051                                 gen_rtx_REG (Pmode, RETURN_REGNUM)));
7053   /* 31-bit PLT stubs use the GOT register implicitly.  */
7054   if (!TARGET_64BIT && plt_call)
7055     use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7056   
7057   DONE;
7060 (define_expand "call_value_exp"
7061   [(parallel [(set (match_operand 0 "" "")
7062                    (call (match_operand 1 "" "")
7063                          (match_operand 2 "" "")))
7064               (clobber (match_operand 3 "" ""))])]
7065   ""
7066   "")
7068 (define_insn "*bras_r"
7069   [(set (match_operand 0 "" "")
7070         (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7071               (match_operand:SI 2 "const_int_operand" "n")))
7072    (clobber (match_operand 3 "register_operand" "=r"))]
7073   "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7074   "bras\t%3,%1"
7075   [(set_attr "op_type" "RI")
7076    (set_attr "type"    "jsr")])
7078 (define_insn "*brasl_r"
7079   [(set (match_operand 0 "" "")
7080         (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7081               (match_operand 2 "const_int_operand" "n")))
7082    (clobber (match_operand 3 "register_operand" "=r"))]
7083   "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7084   "brasl\t%3,%1"
7085   [(set_attr "op_type" "RIL")
7086    (set_attr "type"    "jsr")])
7088 (define_insn "*basr_r"
7089   [(set (match_operand 0 "" "")
7090         (call (mem:QI (match_operand 1 "address_operand" "U"))
7091               (match_operand 2 "const_int_operand" "n")))
7092    (clobber (match_operand 3 "register_operand" "=r"))]
7093   "GET_MODE (operands[3]) == Pmode"
7095   if (get_attr_op_type (insn) == OP_TYPE_RR)
7096     return "basr\t%3,%1";
7097   else
7098     return "bas\t%3,%a1";
7100   [(set (attr "op_type")
7101         (if_then_else (match_operand 1 "register_operand" "")
7102                       (const_string "RR") (const_string "RX")))
7103    (set_attr "type"  "jsr")
7104    (set_attr "atype" "agen")])
7107 ;;- Thread-local storage support.
7110 (define_insn "get_tp_64"
7111   [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7112         (unspec:DI [(const_int 0)] UNSPEC_TP))]
7113   "TARGET_64BIT"
7114   "@
7115    ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7116    stam\t%%a0,%%a1,%0"
7117   [(set_attr "op_type" "NN,RS")
7118    (set_attr "atype"   "reg,*")
7119    (set_attr "type"    "o3,*")
7120    (set_attr "length"  "14,*")])
7122 (define_insn "get_tp_31"
7123   [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7124         (unspec:SI [(const_int 0)] UNSPEC_TP))]
7125   "!TARGET_64BIT"
7126   "@
7127    ear\t%0,%%a0
7128    stam\t%%a0,%%a0,%0"
7129   [(set_attr "op_type" "RRE,RS")])
7131 (define_insn "set_tp_64"
7132   [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7133    (clobber (match_scratch:SI 1 "=d,X"))]
7134   "TARGET_64BIT"
7135   "@
7136    sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7137    lam\t%%a0,%%a1,%0"
7138   [(set_attr "op_type" "NN,RS")
7139    (set_attr "atype"   "reg,*")
7140    (set_attr "type"    "o3,*")
7141    (set_attr "length"  "14,*")])
7143 (define_insn "set_tp_31"
7144   [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7145   "!TARGET_64BIT"
7146   "@
7147    sar\t%%a0,%0
7148    lam\t%%a0,%%a0,%0"
7149   [(set_attr "op_type" "RRE,RS")])
7151 (define_insn "*tls_load_64"
7152   [(set (match_operand:DI 0 "register_operand" "=d")
7153         (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7154                     (match_operand:DI 2 "" "")]
7155                    UNSPEC_TLS_LOAD))]
7156   "TARGET_64BIT"
7157   "lg\t%0,%1%J2"
7158   [(set_attr "op_type" "RXE")])
7160 (define_insn "*tls_load_31"
7161   [(set (match_operand:SI 0 "register_operand" "=d,d")
7162         (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7163                     (match_operand:SI 2 "" "")]
7164                    UNSPEC_TLS_LOAD))]
7165   "!TARGET_64BIT"
7166   "@
7167    l\t%0,%1%J2
7168    ly\t%0,%1%J2"
7169   [(set_attr "op_type" "RX,RXY")])
7171 (define_expand "call_value_tls"
7172   [(set (match_operand 0 "" "")
7173         (call (const_int 0) (const_int 0)))
7174    (use (match_operand 1 "" ""))]
7175   ""
7177   rtx insn, sym;
7179   if (!flag_pic)
7180     abort ();
7182   sym = s390_tls_get_offset ();
7183   sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
7184   sym = gen_rtx_CONST (Pmode, sym);
7186   /* Unless we can use the bras(l) insn, force the
7187      routine address into a register.  */
7188   if (!TARGET_SMALL_EXEC && !TARGET_CPU_ZARCH)
7189     {
7190       if (flag_pic)
7191         sym = legitimize_pic_address (sym, 0);
7192       else
7193         sym = force_reg (Pmode, sym);
7194     }
7196   sym = gen_rtx_MEM (QImode, sym);
7198   /* Emit insn.  */
7199   insn = emit_call_insn (
7200             gen_call_value_tls_exp (operands[0], sym, const0_rtx,
7201                                     gen_rtx_REG (Pmode, RETURN_REGNUM),
7202                                     operands[1]));
7204   /* The calling convention of __tls_get_offset uses the
7205      GOT register implicitly.  */
7206   use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
7207   use_reg (&CALL_INSN_FUNCTION_USAGE (insn), operands[0]);
7208   CONST_OR_PURE_CALL_P (insn) = 1;
7210   DONE;
7213 (define_expand "call_value_tls_exp"
7214   [(parallel [(set (match_operand 0 "" "")
7215                    (call (match_operand 1 "" "")
7216                          (match_operand 2 "" "")))
7217               (clobber (match_operand 3 "" ""))
7218               (use (match_operand 4 "" ""))])]
7219   ""
7220   "")
7222 (define_insn "*bras_tls"
7223   [(set (match_operand 0 "" "")
7224         (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7225               (match_operand 2 "const_int_operand" "n")))
7226    (clobber (match_operand 3 "register_operand" "=r"))
7227    (use (match_operand 4 "" ""))]
7228   "TARGET_SMALL_EXEC && GET_MODE (operands[3]) == Pmode"
7229   "bras\t%3,%1%J4"
7230   [(set_attr "op_type" "RI")
7231    (set_attr "type"    "jsr")])
7233 (define_insn "*brasl_tls"
7234   [(set (match_operand 0 "" "")
7235         (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7236               (match_operand 2 "const_int_operand" "n")))
7237    (clobber (match_operand 3 "register_operand" "=r"))
7238    (use (match_operand 4 "" ""))]
7239   "TARGET_CPU_ZARCH && GET_MODE (operands[3]) == Pmode"
7240   "brasl\t%3,%1%J4"
7241   [(set_attr "op_type" "RIL")
7242    (set_attr "type"    "jsr")])
7244 (define_insn "*basr_tls"
7245   [(set (match_operand 0 "" "")
7246         (call (mem:QI (match_operand 1 "address_operand" "U"))
7247               (match_operand 2 "const_int_operand" "n")))
7248    (clobber (match_operand 3 "register_operand" "=r"))
7249    (use (match_operand 4 "" ""))]
7250   "GET_MODE (operands[3]) == Pmode"
7252   if (get_attr_op_type (insn) == OP_TYPE_RR)
7253     return "basr\t%3,%1%J4";
7254   else
7255     return "bas\t%3,%a1%J4";
7257   [(set (attr "op_type")
7258         (if_then_else (match_operand 1 "register_operand" "")
7259                       (const_string "RR") (const_string "RX")))
7260    (set_attr "type"  "jsr")
7261    (set_attr "atype" "agen")])
7264 ;;- Miscellaneous instructions.
7268 ; allocate stack instruction pattern(s).
7271 (define_expand "allocate_stack"
7272   [(set (reg 15)
7273         (plus (reg 15) (match_operand 1 "general_operand" "")))
7274    (set (match_operand 0 "general_operand" "")
7275         (reg 15))]
7276  "TARGET_BACKCHAIN"
7278     rtx stack = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
7279     rtx chain = gen_rtx (MEM, Pmode, stack);
7280     rtx temp = gen_reg_rtx (Pmode);
7282     emit_move_insn (temp, chain);
7284     if (TARGET_64BIT)
7285       emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7286     else
7287       emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7289     emit_move_insn (chain, temp);
7291     emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7292     DONE;
7297 ; setjmp instruction pattern.
7300 (define_expand "builtin_setjmp_receiver"
7301   [(match_operand 0 "" "")]
7302   "flag_pic"
7304   s390_load_got (false);
7305   emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7306   DONE;
7309 ;; These patterns say how to save and restore the stack pointer.  We need not
7310 ;; save the stack pointer at function level since we are careful to
7311 ;; preserve the backchain.  At block level, we have to restore the backchain
7312 ;; when we restore the stack pointer.
7314 ;; For nonlocal gotos, we must save both the stack pointer and its
7315 ;; backchain and restore both.  Note that in the nonlocal case, the
7316 ;; save area is a memory location.
7318 (define_expand "save_stack_function"
7319   [(match_operand 0 "general_operand" "")
7320    (match_operand 1 "general_operand" "")]
7321   ""
7322   "DONE;")
7324 (define_expand "restore_stack_function"
7325   [(match_operand 0 "general_operand" "")
7326    (match_operand 1 "general_operand" "")]
7327   ""
7328   "DONE;")
7330 (define_expand "restore_stack_block"
7331   [(use (match_operand 0 "register_operand" ""))
7332    (set (match_dup 2) (match_dup 3))
7333    (set (match_dup 0) (match_operand 1 "register_operand" ""))
7334    (set (match_dup 3) (match_dup 2))]
7335   ""
7337   operands[2] = gen_reg_rtx (Pmode);
7338   operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7341 (define_expand "save_stack_nonlocal"
7342   [(match_operand 0 "memory_operand" "")
7343    (match_operand 1 "register_operand" "")]
7344   ""
7346   rtx temp = gen_reg_rtx (Pmode);
7348   /* Copy the backchain to the first word, sp to the second and the literal pool
7349      base to the third. */
7350   emit_move_insn (operand_subword (operands[0], 2, 0,
7351                   TARGET_64BIT ? OImode : TImode),
7352                   gen_rtx_REG (Pmode, BASE_REGISTER));
7353   emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7354   emit_move_insn (operand_subword (operands[0], 0, 0,
7355                  TARGET_64BIT ? OImode : TImode),
7356                  temp);
7357   emit_move_insn (operand_subword (operands[0], 1, 0,
7358                  TARGET_64BIT ? OImode : TImode),
7359                  operands[1]);
7360   DONE;
7363 (define_expand "restore_stack_nonlocal"
7364   [(match_operand 0 "register_operand" "")
7365    (match_operand 1 "memory_operand" "")]
7366   ""
7368   rtx temp = gen_reg_rtx (Pmode);
7369   rtx base = gen_rtx_REG (Pmode, BASE_REGISTER);
7371   /* Restore the backchain from the first word, sp from the second and the
7372      literal pool base from the third. */
7373   emit_move_insn (temp,
7374                  operand_subword (operands[1], 0, 0,
7375                  TARGET_64BIT ? OImode : TImode));
7376   emit_move_insn (operands[0],
7377                  operand_subword (operands[1], 1, 0,
7378                  TARGET_64BIT ? OImode : TImode));
7379   emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7380   emit_move_insn (base,
7381                   operand_subword (operands[1], 2, 0,
7382                   TARGET_64BIT ? OImode : TImode));
7383   emit_insn (gen_rtx_USE (VOIDmode, base));
7385   DONE;
7390 ; nop instruction pattern(s).
7393 (define_insn "nop"
7394   [(const_int 0)]
7395   ""
7396   "lr\t0,0"
7397   [(set_attr "op_type" "RR")])
7401 ; Special literal pool access instruction pattern(s).
7404 (define_insn "*pool_entry"
7405   [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7406                     UNSPECV_POOL_ENTRY)]
7407   ""
7409   enum machine_mode mode = GET_MODE (PATTERN (insn));
7410   unsigned int align = GET_MODE_BITSIZE (mode);
7411   s390_output_pool_entry (asm_out_file, operands[0], mode, align);
7412   return "";
7414   [(set_attr "op_type" "NN")
7415    (set (attr "length") 
7416         (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7418 (define_insn "pool_start_31"
7419   [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7420   "!TARGET_CPU_ZARCH"
7421   ".align\t4"
7422   [(set_attr "op_type"  "NN")
7423    (set_attr "length"   "2")])
7425 (define_insn "pool_end_31"
7426   [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7427   "!TARGET_CPU_ZARCH"
7428   ".align\t2"
7429   [(set_attr "op_type"  "NN")
7430    (set_attr "length"   "2")])
7432 (define_insn "pool_start_64"
7433   [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7434   "TARGET_CPU_ZARCH"
7435   ".section\t.rodata\;.align\t8"
7436   [(set_attr "op_type"  "NN")
7437    (set_attr "length"   "0")])
7439 (define_insn "pool_end_64"
7440   [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7441   "TARGET_CPU_ZARCH"
7442   ".previous"
7443   [(set_attr "op_type"  "NN")
7444    (set_attr "length"   "0")])
7446 (define_insn "main_base_31_small"
7447   [(set (match_operand 0 "register_operand" "=a")
7448         (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7449   "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7450   "basr\t%0,0"
7451   [(set_attr "op_type" "RR")
7452    (set_attr "type"    "la")])
7454 (define_insn "main_base_31_large"
7455   [(set (match_operand 0 "register_operand" "=a")
7456         (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7457    (set (pc) (label_ref (match_operand 2 "" "")))]
7458   "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7459   "bras\t%0,%2"
7460   [(set_attr "op_type" "RI")])
7462 (define_insn "main_base_64"
7463   [(set (match_operand 0 "register_operand" "=a")
7464         (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7465   "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7466   "larl\t%0,%1"
7467   [(set_attr "op_type" "RIL")
7468    (set_attr "type"    "larl")])
7470 (define_insn "main_pool"
7471   [(unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL)]
7472   ""
7473   "* abort ();"
7474   [(set_attr "op_type" "NN")])
7476 (define_insn "reload_base_31"
7477   [(set (match_operand 0 "register_operand" "=a")
7478         (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7479   "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7480   "basr\t%0,0\;la\t%0,%1-.(%0)"
7481   [(set_attr "op_type" "NN")
7482    (set_attr "type"    "la")
7483    (set_attr "length"  "6")])
7485 (define_insn "reload_base_64"
7486   [(set (match_operand 0 "register_operand" "=a")
7487         (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7488   "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7489   "larl\t%0,%1"
7490   [(set_attr "op_type" "RIL")
7491    (set_attr "type"    "larl")])
7493 (define_insn "pool"
7494   [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7495   ""
7496   "* abort ();"
7497   [(set_attr "op_type" "NN")
7498    (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7501 ;; Insns related to generating the function prologue and epilogue.
7505 (define_expand "prologue"
7506   [(use (const_int 0))]
7507   ""
7508   "s390_emit_prologue (); DONE;")
7510 (define_expand "epilogue"
7511   [(use (const_int 1))]
7512   ""
7513   "s390_emit_epilogue (); DONE;")
7515 (define_insn "*return"
7516   [(return)
7517    (use (match_operand 0 "register_operand" "a"))]
7518   "GET_MODE (operands[0]) == Pmode"
7519   "br\t%0"
7520   [(set_attr "op_type" "RR")
7521    (set_attr "type"    "jsr")
7522    (set_attr "atype"   "agen")])
7525 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7526 ;; pointer. This is used for compatibility.
7528 (define_expand "ptr_extend"
7529   [(set (match_operand:DI 0 "register_operand" "=r")
7530         (match_operand:SI 1 "register_operand" "r"))]
7531   "TARGET_64BIT"
7533   emit_insn (gen_anddi3 (operands[0],
7534                          gen_lowpart (DImode, operands[1]),
7535                          GEN_INT (0x7fffffff)));
7536   DONE;