* emit-rtl.c (gen_const_mem): New.
[official-gcc.git] / gcc / config / s390 / s390.md
blobbbfed329f36232ad62cdb7771fa5a61635d8f3ae
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)
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)
95    (UNSPEC_LTREF                212)
97    ; TLS relocation specifiers
98    (UNSPEC_TLSGD                500)
99    (UNSPEC_TLSLDM               501)
100    (UNSPEC_NTPOFF               502)
101    (UNSPEC_DTPOFF               503)
102    (UNSPEC_GOTNTPOFF            504)
103    (UNSPEC_INDNTPOFF            505)
105    ; TLS support
106    (UNSPEC_TP                   510)
107    (UNSPEC_TLSLDM_NTPOFF        511)
108    (UNSPEC_TLS_LOAD             512)
110    ; String Functions
111    (UNSPEC_SRST         600)
112  ])
115 ;; UNSPEC_VOLATILE usage
118 (define_constants
119   [; Blockage
120    (UNSPECV_BLOCKAGE            0)
122    ; TPF Support
123    (UNSPECV_TPF_PROLOGUE        20)
124    (UNSPECV_TPF_EPILOGUE        21)
126    ; Literal pool
127    (UNSPECV_POOL                200)
128    (UNSPECV_POOL_START          201)
129    (UNSPECV_POOL_END            202)
130    (UNSPECV_POOL_ENTRY          203)
131    (UNSPECV_MAIN_POOL           300)
133    ; TLS support
134    (UNSPECV_SET_TP              500)
135   ])
138 ;; Processor type.  This attribute must exactly match the processor_type
139 ;; enumeration in s390.h.  The current machine description does not
140 ;; distinguish between g5 and g6, but there are differences between the two
141 ;; CPUs could in theory be modeled.
143 (define_attr "cpu" "g5,g6,z900,z990"
144   (const (symbol_ref "s390_tune")))
146 ;; Define an insn type attribute.  This is used in function unit delay
147 ;; computations.
149 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
150                      cs,vs,store,imul,idiv,
151                      branch,jsr,fsimpd,fsimps,
152                      floadd,floads,fstored, fstores,
153                      fmuld,fmuls,fdivd,fdivs,
154                      ftoi,itof,fsqrtd,fsqrts,
155                      other,o2,o3"
156   (const_string "integer"))
158 ;; Operand type. Used to default length attribute values
160 (define_attr "op_type"
161   "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
162   (const_string "RX"))
164 ;; Insn are devide in two classes:
165 ;;   agen: Insn using agen
166 ;;   reg: Insn not using agen
168 (define_attr "atype" "agen,reg"
169 (cond [ (eq_attr "op_type" "E")    (const_string "reg")
170          (eq_attr "op_type" "RR")  (const_string "reg")
171          (eq_attr "op_type" "RX")  (const_string "agen")
172          (eq_attr "op_type" "RI")  (const_string "reg")
173          (eq_attr "op_type" "RRE") (const_string "reg")
174          (eq_attr "op_type" "RS")  (const_string "agen")
175          (eq_attr "op_type" "RSI") (const_string "agen")
176          (eq_attr "op_type" "S")   (const_string "agen")
177          (eq_attr "op_type" "SI")  (const_string "agen")
178          (eq_attr "op_type" "SS")  (const_string "agen")
179          (eq_attr "op_type" "SSE") (const_string "agen")
180          (eq_attr "op_type" "RXE") (const_string "agen")
181          (eq_attr "op_type" "RSE") (const_string "agen")
182          (eq_attr "op_type" "RIL") (const_string "agen")
183          (eq_attr "op_type" "RXY") (const_string "agen")
184          (eq_attr "op_type" "RSY") (const_string "agen")
185          (eq_attr "op_type" "SIY") (const_string "agen")]
186   (const_string "reg")))
188 ;; Pipeline description for z900.  For lack of anything better,
189 ;; this description is also used for the g5 and g6.
190 (include "2064.md")
192 ;; Pipeline description for z990. 
193 (include "2084.md")
195 ;; Length in bytes.
197 (define_attr "length" ""
198 (cond [ (eq_attr "op_type" "E")    (const_int 2)
199          (eq_attr "op_type" "RR")  (const_int 2)
200          (eq_attr "op_type" "RX")  (const_int 4)
201          (eq_attr "op_type" "RI")  (const_int 4)
202          (eq_attr "op_type" "RRE") (const_int 4)
203          (eq_attr "op_type" "RS")  (const_int 4)
204          (eq_attr "op_type" "RSI") (const_int 4)
205          (eq_attr "op_type" "S")   (const_int 4)
206          (eq_attr "op_type" "SI")  (const_int 4)
207          (eq_attr "op_type" "SS")  (const_int 6)
208          (eq_attr "op_type" "SSE") (const_int 6)
209          (eq_attr "op_type" "RXE") (const_int 6)
210          (eq_attr "op_type" "RSE") (const_int 6)
211          (eq_attr "op_type" "RIL") (const_int 6)
212          (eq_attr "op_type" "RXY") (const_int 6)
213          (eq_attr "op_type" "RSY") (const_int 6)
214          (eq_attr "op_type" "SIY") (const_int 6)]
215          (const_int 4)))
217 ;; Define attributes for `asm' insns.
219 (define_asm_attributes [(set_attr "type" "other")
220                         (set_attr "op_type" "NN")])
223 ;;  Condition Codes
226 ;   CCL:  Zero     Nonzero   Zero      Nonzero      (AL, ALR, SL, SLR, N, NC, NI, NR, O, OC, OI, OR, X, XC, XI, XR)
227 ;   CCA:  Zero     <Zero     >Zero     Overflow     (A, AR, AH, AHI, S, SR, SH, SHI, LTR, LCR, LNR, LPR, SLA, SLDA, SLA, SRDA)
228 ;   CCU:  Equal    ULess     UGreater  --           (CL, CLR, CLI, CLM)
229 ;   CCS:  Equal    SLess     SGreater  --           (C, CR, CH, CHI, ICM)
230 ;   CCT:  Zero     Mixed     Mixed     Ones         (TM, TMH, TML)
232 ;   CCZ  -> CCL / CCZ1
233 ;   CCZ1 -> CCA/CCU/CCS/CCT
234 ;   CCS  -> CCA
236 ;   String:    CLC, CLCL, CLCLE, CLST, CUSE, MVCL, MVCLE, MVPG, MVST, SRST
237 ;   Clobber:   CKSM, CFC, CS, CDS, CUUTF, CUTFU, PLO, SPM, STCK, STCKE, TS, TRT, TRE, UPT
241 ;;- Compare instructions.
244 (define_expand "cmpdi"
245   [(set (reg:CC 33)
246         (compare:CC (match_operand:DI 0 "register_operand" "")
247                     (match_operand:DI 1 "general_operand" "")))]
248   "TARGET_64BIT"
250   s390_compare_op0 = operands[0];
251   s390_compare_op1 = operands[1];
252   DONE;
255 (define_expand "cmpsi"
256   [(set (reg:CC 33)
257         (compare:CC (match_operand:SI 0 "register_operand" "")
258                     (match_operand:SI 1 "general_operand" "")))]
259   ""
261   s390_compare_op0 = operands[0];
262   s390_compare_op1 = operands[1];
263   DONE;
266 (define_expand "cmpdf"
267   [(set (reg:CC 33)
268         (compare:CC (match_operand:DF 0 "register_operand" "")
269                     (match_operand:DF 1 "general_operand" "")))]
270   "TARGET_HARD_FLOAT"
272   s390_compare_op0 = operands[0];
273   s390_compare_op1 = operands[1];
274   DONE;
277 (define_expand "cmpsf"
278   [(set (reg:CC 33)
279         (compare:CC (match_operand:SF 0 "register_operand" "")
280                     (match_operand:SF 1 "general_operand" "")))]
281   "TARGET_HARD_FLOAT"
283   s390_compare_op0 = operands[0];
284   s390_compare_op1 = operands[1];
285   DONE;
289 ; Test-under-Mask instructions
291 (define_insn "*tmqi_mem"
292   [(set (reg 33)
293         (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S")
294                          (match_operand:QI 1 "immediate_operand" "n,n"))
295                  (match_operand:QI 2 "immediate_operand" "n,n")))]
296   "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))"
297   "@
298    tm\t%0,%b1
299    tmy\t%0,%b1"
300   [(set_attr "op_type" "SI,SIY")])
302 (define_insn "*tmdi_reg"
303   [(set (reg 33)
304         (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
305                          (match_operand:DI 1 "immediate_operand"
306                                              "N0HD0,N1HD0,N2HD0,N3HD0"))
307                  (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
308   "TARGET_64BIT
309    && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
310    && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
311   "@
312    tmhh\t%0,%i1
313    tmhl\t%0,%i1
314    tmlh\t%0,%i1
315    tmll\t%0,%i1"
316   [(set_attr "op_type" "RI")])
318 (define_insn "*tmsi_reg"
319   [(set (reg 33)
320         (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
321                          (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
322                  (match_operand:SI 2 "immediate_operand" "n,n")))]
323   "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
324    && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
325   "@
326    tmh\t%0,%i1
327    tml\t%0,%i1"
328   [(set_attr "op_type" "RI")])
330 (define_insn "*tmhi_full"
331   [(set (reg 33)
332         (compare (match_operand:HI 0 "register_operand" "d")
333                  (match_operand:HI 1 "immediate_operand" "n")))]
334   "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
335   "tml\t%0,65535"
336   [(set_attr "op_type" "RX")])
338 (define_insn "*tmqi_full"
339   [(set (reg 33)
340         (compare (match_operand:QI 0 "register_operand" "d")
341                  (match_operand:QI 1 "immediate_operand" "n")))]
342   "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
343   "tml\t%0,255"
344   [(set_attr "op_type" "RI")])
347 ; Load-and-Test instructions
349 (define_insn "*tstdi_sign"
350   [(set (reg 33)
351         (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
352                                          (const_int 32)) (const_int 32))
353                  (match_operand:DI 1 "const0_operand" "")))
354    (set (match_operand:DI 2 "register_operand" "=d")
355         (sign_extend:DI (match_dup 0)))]
356   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
357   "ltgfr\t%2,%0"
358   [(set_attr "op_type" "RRE")])
360 (define_insn "*tstdi"
361   [(set (reg 33)
362         (compare (match_operand:DI 0 "register_operand" "d")
363                  (match_operand:DI 1 "const0_operand" "")))
364    (set (match_operand:DI 2 "register_operand" "=d")
365         (match_dup 0))]
366   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
367   "ltgr\t%2,%0"
368   [(set_attr "op_type" "RRE")])
370 (define_insn "*tstdi_cconly"
371   [(set (reg 33)
372         (compare (match_operand:DI 0 "register_operand" "d")
373                  (match_operand:DI 1 "const0_operand" "")))]
374   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
375   "ltgr\t%0,%0"
376   [(set_attr "op_type" "RRE")])
378 (define_insn "*tstdi_cconly_31"
379   [(set (reg 33)
380         (compare (match_operand:DI 0 "register_operand" "d")
381                  (match_operand:DI 1 "const0_operand" "")))]
382   "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
383   "srda\t%0,0"
384   [(set_attr "op_type" "RS")
385    (set_attr "atype"   "reg")])
388 (define_insn "*tstsi"
389   [(set (reg 33)
390         (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
391                  (match_operand:SI 1 "const0_operand" "")))
392    (set (match_operand:SI 2 "register_operand" "=d,d,d")
393         (match_dup 0))]
394   "s390_match_ccmode(insn, CCSmode)"
395   "@
396    ltr\t%2,%0
397    icm\t%2,15,%0
398    icmy\t%2,15,%0"
399   [(set_attr "op_type" "RR,RS,RSY")])
401 (define_insn "*tstsi_cconly"
402   [(set (reg 33)
403         (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
404                  (match_operand:SI 1 "const0_operand" "")))
405    (clobber (match_scratch:SI 2 "=X,d,d"))]
406   "s390_match_ccmode(insn, CCSmode)"
407   "@
408    ltr\t%0,%0
409    icm\t%2,15,%0
410    icmy\t%2,15,%0"
411   [(set_attr "op_type" "RR,RS,RSY")])
413 (define_insn "*tstsi_cconly2"
414   [(set (reg 33)
415         (compare (match_operand:SI 0 "register_operand" "d")
416                  (match_operand:SI 1 "const0_operand" "")))]
417   "s390_match_ccmode(insn, CCSmode)"
418   "ltr\t%0,%0"
419   [(set_attr "op_type" "RR")])
421 (define_insn "*tsthiCCT"
422   [(set (reg 33)
423         (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d")
424                  (match_operand:HI 1 "const0_operand" "")))
425    (set (match_operand:HI 2 "register_operand" "=d,d,0")
426         (match_dup 0))]
427   "s390_match_ccmode(insn, CCTmode)"
428   "@
429    icm\t%2,3,%0
430    icmy\t%2,3,%0
431    tml\t%0,65535"
432   [(set_attr "op_type" "RS,RSY,RI")])
434 (define_insn "*tsthiCCT_cconly"
435   [(set (reg 33)
436         (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
437                  (match_operand:HI 1 "const0_operand" "")))
438    (clobber (match_scratch:HI 2 "=d,d,X"))]
439   "s390_match_ccmode(insn, CCTmode)"
440   "@
441    icm\t%2,3,%0
442    icmy\t%2,3,%0
443    tml\t%0,65535"
444   [(set_attr "op_type" "RS,RSY,RI")])
446 (define_insn "*tsthi"
447   [(set (reg 33)
448         (compare (match_operand:HI 0 "s_operand" "Q,S")
449                  (match_operand:HI 1 "const0_operand" "")))
450    (set (match_operand:HI 2 "register_operand" "=d,d")
451         (match_dup 0))]
452   "s390_match_ccmode(insn, CCSmode)"
453   "@
454    icm\t%2,3,%0
455    icmy\t%2,3,%0"
456   [(set_attr "op_type" "RS,RSY")])
458 (define_insn "*tsthi_cconly"
459   [(set (reg 33)
460         (compare (match_operand:HI 0 "s_operand" "Q,S")
461                  (match_operand:HI 1 "const0_operand" "")))
462    (clobber (match_scratch:HI 2 "=d,d"))]
463   "s390_match_ccmode(insn, CCSmode)"
464   "@
465    icm\t%2,3,%0
466    icmy\t%2,3,%0"
467   [(set_attr "op_type" "RS,RSY")])
469 (define_insn "*tstqiCCT"
470   [(set (reg 33)
471         (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
472                  (match_operand:QI 1 "const0_operand" "")))
473    (set (match_operand:QI 2 "register_operand" "=d,d,0")
474         (match_dup 0))]
475   "s390_match_ccmode(insn, CCTmode)"
476   "@
477    icm\t%2,1,%0
478    icmy\t%2,1,%0
479    tml\t%0,255"
480   [(set_attr "op_type" "RS,RSY,RI")])
482 (define_insn "*tstqiCCT_cconly"
483   [(set (reg 33)
484         (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
485                  (match_operand:QI 1 "const0_operand" "")))]
486   "s390_match_ccmode(insn, CCTmode)"
487   "@
488    cli\t%0,0
489    cliy\t%0,0
490    tml\t%0,255"
491   [(set_attr "op_type" "SI,SIY,RI")])
493 (define_insn "*tstqi"
494   [(set (reg 33)
495         (compare (match_operand:QI 0 "s_operand" "Q,S")
496                  (match_operand:QI 1 "const0_operand" "")))
497    (set (match_operand:QI 2 "register_operand" "=d,d")
498         (match_dup 0))]
499   "s390_match_ccmode(insn, CCSmode)"
500   "@
501    icm\t%2,1,%0
502    icmy\t%2,1,%0"
503   [(set_attr "op_type" "RS,RSY")])
505 (define_insn "*tstqi_cconly"
506   [(set (reg 33)
507         (compare (match_operand:QI 0 "s_operand" "Q,S")
508                  (match_operand:QI 1 "const0_operand" "")))
509    (clobber (match_scratch:QI 2 "=d,d"))]
510   "s390_match_ccmode(insn, CCSmode)"
511   "@
512    icm\t%2,1,%0
513    icmy\t%2,1,%0"
514   [(set_attr "op_type" "RS,RSY")])
517 ; Compare (signed) instructions
519 (define_insn "*cmpdi_ccs_sign"
520   [(set (reg 33)
521         (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
522                  (match_operand:DI 0 "register_operand" "d,d")))]
523   "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
524   "@
525    cgfr\t%0,%1
526    cgf\t%0,%1"
527   [(set_attr "op_type" "RRE,RXY")])
529 (define_insn "*cmpdi_ccs"
530   [(set (reg 33)
531         (compare (match_operand:DI 0 "register_operand" "d,d,d")
532                  (match_operand:DI 1 "general_operand" "d,K,m")))]
533   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
534   "@
535    cgr\t%0,%1
536    cghi\t%0,%c1
537    cg\t%0,%1"
538   [(set_attr "op_type" "RRE,RI,RXY")])
540 (define_insn "*cmpsi_ccs_sign"
541   [(set (reg 33)
542         (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
543                  (match_operand:SI 0 "register_operand" "d,d")))]
544   "s390_match_ccmode(insn, CCSRmode)"
545   "@
546    ch\t%0,%1
547    chy\t%0,%1"
548   [(set_attr "op_type" "RX,RXY")])
550 (define_insn "*cmpsi_ccs"
551   [(set (reg 33)
552         (compare (match_operand:SI 0 "register_operand" "d,d,d,d")
553                  (match_operand:SI 1 "general_operand" "d,K,R,T")))]
554   "s390_match_ccmode(insn, CCSmode)"
555   "@
556    cr\t%0,%1
557    chi\t%0,%c1
558    c\t%0,%1
559    cy\t%0,%1"
560   [(set_attr "op_type" "RR,RI,RX,RXY")])
563 ; Compare (unsigned) instructions
565 (define_insn "*cmpdi_ccu_zero"
566   [(set (reg 33)
567         (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
568                  (match_operand:DI 0 "register_operand" "d,d")))]
569   "s390_match_ccmode(insn, CCURmode) && TARGET_64BIT"
570   "@
571    clgfr\t%0,%1
572    clgf\t%0,%1"
573   [(set_attr "op_type" "RRE,RXY")])
575 (define_insn "*cmpdi_ccu"
576   [(set (reg 33)
577         (compare (match_operand:DI 0 "register_operand" "d,d")
578                  (match_operand:DI 1 "general_operand" "d,m")))]
579   "s390_match_ccmode(insn, CCUmode) && TARGET_64BIT"
580   "@
581    clgr\t%0,%1
582    clg\t%0,%1"
583   [(set_attr "op_type" "RRE,RXY")])
585 (define_insn "*cmpsi_ccu"
586   [(set (reg 33)
587         (compare (match_operand:SI 0 "register_operand" "d,d,d")
588                  (match_operand:SI 1 "general_operand" "d,R,T")))]
589   "s390_match_ccmode(insn, CCUmode)"
590   "@
591    clr\t%0,%1
592    cl\t%0,%1
593    cly\t%0,%1"
594   [(set_attr "op_type" "RR,RX,RXY")])
596 (define_insn "*cmphi_ccu"
597   [(set (reg 33)
598         (compare (match_operand:HI 0 "register_operand" "d,d")
599                  (match_operand:HI 1 "s_imm_operand" "Q,S")))]
600   "s390_match_ccmode(insn, CCUmode)"
601   "@
602    clm\t%0,3,%1
603    clmy\t%0,3,%1"
604   [(set_attr "op_type" "RS,RSY")])
606 (define_insn "*cmpqi_ccu"
607   [(set (reg 33)
608         (compare (match_operand:QI 0 "register_operand" "d,d")
609                  (match_operand:QI 1 "s_imm_operand" "Q,S")))]
610   "s390_match_ccmode(insn, CCUmode)"
611   "@
612    clm\t%0,1,%1
613    clmy\t%0,1,%1"
614   [(set_attr "op_type" "RS,RSY")])
616 (define_insn "*cli"
617   [(set (reg 33)
618         (compare (match_operand:QI 0 "memory_operand" "Q,S")
619                  (match_operand:QI 1 "immediate_operand" "n,n")))]
620   "s390_match_ccmode (insn, CCUmode)"
621   "@
622    cli\t%0,%b1
623    cliy\t%0,%b1"
624   [(set_attr "op_type" "SI,SIY")])
626 (define_insn "*cmpdi_ccu_mem"
627   [(set (reg 33)
628         (compare (match_operand:DI 0 "s_operand" "Q")
629                  (match_operand:DI 1 "s_imm_operand" "Q")))]
630   "s390_match_ccmode(insn, CCUmode)"
631   "clc\t%O0(8,%R0),%1"
632   [(set_attr "op_type" "SS")])
634 (define_insn "*cmpsi_ccu_mem"
635   [(set (reg 33)
636         (compare (match_operand:SI 0 "s_operand" "Q")
637                  (match_operand:SI 1 "s_imm_operand" "Q")))]
638   "s390_match_ccmode(insn, CCUmode)"
639   "clc\t%O0(4,%R0),%1"
640    [(set_attr "op_type" "SS")])
642 (define_insn "*cmphi_ccu_mem"
643   [(set (reg 33)
644         (compare (match_operand:HI 0 "s_operand" "Q")
645                  (match_operand:HI 1 "s_imm_operand" "Q")))]
646   "s390_match_ccmode(insn, CCUmode)"
647   "clc\t%O0(2,%R0),%1"
648   [(set_attr "op_type" "SS")])
650 (define_insn "*cmpqi_ccu_mem"
651   [(set (reg 33)
652         (compare (match_operand:QI 0 "s_operand" "Q")
653                  (match_operand:QI 1 "s_imm_operand" "Q")))]
654   "s390_match_ccmode(insn, CCUmode)"
655   "clc\t%O0(1,%R0),%1"
656   [(set_attr "op_type" "SS")])
659 ; DF instructions
661 (define_insn "*cmpdf_ccs_0"
662   [(set (reg 33)
663         (compare (match_operand:DF 0 "register_operand" "f")
664                  (match_operand:DF 1 "const0_operand" "")))]
665   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
666   "ltdbr\t%0,%0"
667    [(set_attr "op_type" "RRE")
668     (set_attr "type"  "fsimpd")])
670 (define_insn "*cmpdf_ccs_0_ibm"
671   [(set (reg 33)
672         (compare (match_operand:DF 0 "register_operand" "f")
673                  (match_operand:DF 1 "const0_operand" "")))]
674   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
675   "ltdr\t%0,%0"
676    [(set_attr "op_type" "RR")
677     (set_attr "type"  "fsimpd")])
679 (define_insn "*cmpdf_ccs"
680   [(set (reg 33)
681         (compare (match_operand:DF 0 "register_operand" "f,f")
682                  (match_operand:DF 1 "general_operand" "f,R")))]
683   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
684   "@
685    cdbr\t%0,%1
686    cdb\t%0,%1"
687    [(set_attr "op_type" "RRE,RXE")
688     (set_attr "type"  "fsimpd")])
690 (define_insn "*cmpdf_ccs_ibm"
691   [(set (reg 33)
692         (compare (match_operand:DF 0 "register_operand" "f,f")
693                  (match_operand:DF 1 "general_operand" "f,R")))]
694   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
695   "@
696    cdr\t%0,%1
697    cd\t%0,%1"
698    [(set_attr "op_type" "RR,RX")
699     (set_attr "type"  "fsimpd")])
702 ; SF instructions
704 (define_insn "*cmpsf_ccs_0"
705   [(set (reg 33)
706         (compare (match_operand:SF 0 "register_operand" "f")
707                  (match_operand:SF 1 "const0_operand" "")))]
708   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
709   "ltebr\t%0,%0"
710    [(set_attr "op_type" "RRE")
711     (set_attr "type"  "fsimps")])
713 (define_insn "*cmpsf_ccs_0_ibm"
714   [(set (reg 33)
715         (compare (match_operand:SF 0 "register_operand" "f")
716                  (match_operand:SF 1 "const0_operand" "")))]
717   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
718   "lter\t%0,%0"
719    [(set_attr "op_type" "RR")
720     (set_attr "type"  "fsimps")])
722 (define_insn "*cmpsf_ccs"
723   [(set (reg 33)
724         (compare (match_operand:SF 0 "register_operand" "f,f")
725                  (match_operand:SF 1 "general_operand" "f,R")))]
726   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
727   "@
728    cebr\t%0,%1
729    ceb\t%0,%1"
730    [(set_attr "op_type" "RRE,RXE")
731     (set_attr "type"  "fsimps")])
733 (define_insn "*cmpsf_ccs"
734   [(set (reg 33)
735         (compare (match_operand:SF 0 "register_operand" "f,f")
736                  (match_operand:SF 1 "general_operand" "f,R")))]
737   "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
738   "@
739    cer\t%0,%1
740    ce\t%0,%1"
741    [(set_attr "op_type" "RR,RX")
742     (set_attr "type"  "fsimps")])
746 ;;- Move instructions.
750 ; movti instruction pattern(s).
753 (define_insn "movti"
754   [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
755         (match_operand:TI 1 "general_operand" "QS,d,dKm,d,Q"))]
756   "TARGET_64BIT"
757   "@
758    lmg\t%0,%N0,%1
759    stmg\t%1,%N1,%0
760    #
761    #
762    mvc\t%O0(16,%R0),%1"
763   [(set_attr "op_type" "RSY,RSY,NN,NN,SS")
764    (set_attr "type" "lm,stm,*,*,cs")])
766 (define_split
767   [(set (match_operand:TI 0 "nonimmediate_operand" "")
768         (match_operand:TI 1 "general_operand" ""))]
769   "TARGET_64BIT && reload_completed
770    && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
771   [(set (match_dup 2) (match_dup 4))
772    (set (match_dup 3) (match_dup 5))]
774   operands[2] = operand_subword (operands[0], 0, 0, TImode);
775   operands[3] = operand_subword (operands[0], 1, 0, TImode);
776   operands[4] = operand_subword (operands[1], 0, 0, TImode);
777   operands[5] = operand_subword (operands[1], 1, 0, TImode);
780 (define_split
781   [(set (match_operand:TI 0 "nonimmediate_operand" "")
782         (match_operand:TI 1 "general_operand" ""))]
783   "TARGET_64BIT && reload_completed
784    && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
785   [(set (match_dup 2) (match_dup 4))
786    (set (match_dup 3) (match_dup 5))]
788   operands[2] = operand_subword (operands[0], 1, 0, TImode);
789   operands[3] = operand_subword (operands[0], 0, 0, TImode);
790   operands[4] = operand_subword (operands[1], 1, 0, TImode);
791   operands[5] = operand_subword (operands[1], 0, 0, TImode);
794 (define_split
795   [(set (match_operand:TI 0 "register_operand" "")
796         (match_operand:TI 1 "memory_operand" ""))]
797   "TARGET_64BIT && reload_completed
798    && !s_operand (operands[1], VOIDmode)"
799   [(set (match_dup 0) (match_dup 1))]
801   rtx addr = operand_subword (operands[0], 1, 0, TImode);
802   s390_load_address (addr, XEXP (operands[1], 0));
803   operands[1] = replace_equiv_address (operands[1], addr);
806 (define_expand "reload_outti"
807   [(parallel [(match_operand:TI 0 "memory_operand" "")
808               (match_operand:TI 1 "register_operand" "d")
809               (match_operand:DI 2 "register_operand" "=&a")])]
810   "TARGET_64BIT"
812   s390_load_address (operands[2], XEXP (operands[0], 0));
813   operands[0] = replace_equiv_address (operands[0], operands[2]);
814   emit_move_insn (operands[0], operands[1]);
815   DONE;
819 ; movdi instruction pattern(s).
822 (define_expand "movdi"
823   [(set (match_operand:DI 0 "general_operand" "")
824         (match_operand:DI 1 "general_operand" ""))]
825   ""
827   /* Handle symbolic constants.  */
828   if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
829     emit_symbolic_move (operands);
831   /* During and after reload, we need to force constants
832      to the literal pool ourselves, if necessary.  */
833   if ((reload_in_progress || reload_completed)
834       && CONSTANT_P (operands[1])
835       && (!legitimate_reload_constant_p (operands[1])
836           || FP_REG_P (operands[0])))
837     operands[1] = force_const_mem (DImode, operands[1]);
840 (define_insn "*movdi_larl"
841   [(set (match_operand:DI 0 "register_operand" "=d")
842         (match_operand:DI 1 "larl_operand" "X"))]
843   "TARGET_64BIT
844    && !FP_REG_P (operands[0])"
845   "larl\t%0,%1"
846    [(set_attr "op_type" "RIL")
847     (set_attr "type"    "larl")])
849 (define_insn "*movdi_64"
850   [(set (match_operand:DI 0 "nonimmediate_operand"
851                             "=d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,?Q")
852         (match_operand:DI 1 "general_operand"
853                             "K,N0HD0,N1HD0,N2HD0,N3HD0,L,d,m,d,*f,R,T,*f,*f,?Q"))]
854   "TARGET_64BIT"
855   "@
856    lghi\t%0,%h1
857    llihh\t%0,%i1
858    llihl\t%0,%i1
859    llilh\t%0,%i1
860    llill\t%0,%i1
861    lay\t%0,%a1
862    lgr\t%0,%1
863    lg\t%0,%1
864    stg\t%1,%0
865    ldr\t%0,%1
866    ld\t%0,%1
867    ldy\t%0,%1
868    std\t%1,%0
869    stdy\t%1,%0
870    mvc\t%O0(8,%R0),%1"
871   [(set_attr "op_type" "RI,RI,RI,RI,RI,RXY,RRE,RXY,RXY,RR,RX,RXY,RX,RXY,SS")
872    (set_attr "type" "*,*,*,*,*,la,lr,load,store,floadd,floadd,floadd,
873                      fstored,fstored,cs")])
875 (define_insn "*movdi_31"
876   [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,o,!*f,!*f,!*f,!R,!T,Q")
877         (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,R,T,*f,*f,Q"))]
878   "!TARGET_64BIT"
879   "@
880    lm\t%0,%N0,%1
881    stm\t%1,%N1,%0
882    #
883    #
884    ldr\t%0,%1
885    ld\t%0,%1
886    ldy\t%0,%1
887    std\t%1,%0
888    stdy\t%1,%0
889    mvc\t%O0(8,%R0),%1"
890   [(set_attr "op_type" "RS,RS,NN,NN,RR,RX,RXY,RX,RXY,SS")
891    (set_attr "type" "lm,stm,*,*,floadd,floadd,floadd,fstored,fstored,cs")])
893 (define_split
894   [(set (match_operand:DI 0 "nonimmediate_operand" "")
895         (match_operand:DI 1 "general_operand" ""))]
896   "!TARGET_64BIT && reload_completed
897    && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
898   [(set (match_dup 2) (match_dup 4))
899    (set (match_dup 3) (match_dup 5))]
901   operands[2] = operand_subword (operands[0], 0, 0, DImode);
902   operands[3] = operand_subword (operands[0], 1, 0, DImode);
903   operands[4] = operand_subword (operands[1], 0, 0, DImode);
904   operands[5] = operand_subword (operands[1], 1, 0, DImode);
907 (define_split
908   [(set (match_operand:DI 0 "nonimmediate_operand" "")
909         (match_operand:DI 1 "general_operand" ""))]
910   "!TARGET_64BIT && reload_completed
911    && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
912   [(set (match_dup 2) (match_dup 4))
913    (set (match_dup 3) (match_dup 5))]
915   operands[2] = operand_subword (operands[0], 1, 0, DImode);
916   operands[3] = operand_subword (operands[0], 0, 0, DImode);
917   operands[4] = operand_subword (operands[1], 1, 0, DImode);
918   operands[5] = operand_subword (operands[1], 0, 0, DImode);
921 (define_split
922   [(set (match_operand:DI 0 "register_operand" "")
923         (match_operand:DI 1 "memory_operand" ""))]
924   "!TARGET_64BIT && reload_completed
925    && !FP_REG_P (operands[0])
926    && !s_operand (operands[1], VOIDmode)"
927   [(set (match_dup 0) (match_dup 1))]
929   rtx addr = operand_subword (operands[0], 1, 0, DImode);
930   s390_load_address (addr, XEXP (operands[1], 0));
931   operands[1] = replace_equiv_address (operands[1], addr);
934 (define_expand "reload_outdi"
935   [(parallel [(match_operand:DI 0 "memory_operand" "")
936               (match_operand:DI 1 "register_operand" "d")
937               (match_operand:SI 2 "register_operand" "=&a")])]
938   "!TARGET_64BIT"
940   s390_load_address (operands[2], XEXP (operands[0], 0));
941   operands[0] = replace_equiv_address (operands[0], operands[2]);
942   emit_move_insn (operands[0], operands[1]);
943   DONE;
946 (define_peephole2
947   [(set (match_operand:DI 0 "register_operand" "")
948         (mem:DI (match_operand 1 "address_operand" "")))]
949   "TARGET_64BIT
950    && !FP_REG_P (operands[0])
951    && GET_CODE (operands[1]) == SYMBOL_REF
952    && CONSTANT_POOL_ADDRESS_P (operands[1])
953    && get_pool_mode (operands[1]) == DImode
954    && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
955   [(set (match_dup 0) (match_dup 2))]
956   "operands[2] = get_pool_constant (operands[1]);")
958 (define_insn "*la_64"
959   [(set (match_operand:DI 0 "register_operand" "=d,d")
960         (match_operand:QI 1 "address_operand" "U,W"))]
961   "TARGET_64BIT"
962   "@
963    la\t%0,%a1
964    lay\t%0,%a1"
965   [(set_attr "op_type" "RX,RXY")
966    (set_attr "type"    "la")])
968 (define_peephole2
969   [(parallel
970     [(set (match_operand:DI 0 "register_operand" "")
971           (match_operand:QI 1 "address_operand" ""))
972      (clobber (reg:CC 33))])]
973   "TARGET_64BIT
974    && strict_memory_address_p (VOIDmode, operands[1])
975    && preferred_la_operand_p (operands[1])"
976   [(set (match_dup 0) (match_dup 1))]
977   "")
979 (define_peephole2
980   [(set (match_operand:DI 0 "register_operand" "")
981         (match_operand:DI 1 "register_operand" ""))
982    (parallel
983     [(set (match_dup 0)
984           (plus:DI (match_dup 0)
985                    (match_operand:DI 2 "nonmemory_operand" "")))
986      (clobber (reg:CC 33))])]
987   "TARGET_64BIT
988    && !reg_overlap_mentioned_p (operands[0], operands[2])
989    && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (DImode, operands[1], operands[2]))
990    && preferred_la_operand_p (gen_rtx_PLUS (DImode, operands[1], operands[2]))"
991   [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
992   "")
994 (define_expand "reload_indi"
995   [(parallel [(match_operand:DI 0 "register_operand" "=a")
996               (match_operand:DI 1 "s390_plus_operand" "")
997               (match_operand:DI 2 "register_operand" "=&a")])]
998   "TARGET_64BIT"
1000   s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1001   DONE;
1005 ; movsi instruction pattern(s).
1008 (define_expand "movsi"
1009   [(set (match_operand:SI 0 "general_operand" "")
1010         (match_operand:SI 1 "general_operand" ""))]
1011   ""
1013   /* Handle symbolic constants.  */
1014   if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1015     emit_symbolic_move (operands);
1017   /* expr.c tries to load an effective address using
1018      force_reg.  This fails because we don't have a
1019      generic load_address pattern.  Convert the move
1020      to a proper arithmetic operation instead, unless
1021      it is guaranteed to be OK.  */
1022   if (GET_CODE (operands[1]) == PLUS
1023       && !legitimate_la_operand_p (operands[1]))
1024     {
1025       operands[1] = force_operand (operands[1], operands[0]);
1026       if (operands[1] == operands[0])
1027         DONE;
1028     }
1030   /* During and after reload, we need to force constants
1031      to the literal pool ourselves, if necessary.  */
1032   if ((reload_in_progress || reload_completed)
1033       && CONSTANT_P (operands[1])
1034       && (!legitimate_reload_constant_p (operands[1])
1035           || FP_REG_P (operands[0])))
1036     operands[1] = force_const_mem (SImode, operands[1]);
1039 (define_insn "*movsi_larl"
1040   [(set (match_operand:SI 0 "register_operand" "=d")
1041         (match_operand:SI 1 "larl_operand" "X"))]
1042   "!TARGET_64BIT && TARGET_CPU_ZARCH
1043    && !FP_REG_P (operands[0])"
1044   "larl\t%0,%1"
1045    [(set_attr "op_type" "RIL")
1046     (set_attr "type"    "larl")])
1048 (define_insn "*movsi_zarch"
1049   [(set (match_operand:SI 0 "nonimmediate_operand"
1050                             "=d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,?Q")
1051         (match_operand:SI 1 "general_operand"
1052                             "K,N0HS0,N1HS0,L,d,R,T,d,d,*f,R,T,*f,*f,?Q"))]
1053   "TARGET_ZARCH"
1054   "@
1055    lhi\t%0,%h1
1056    llilh\t%0,%i1
1057    llill\t%0,%i1
1058    lay\t%0,%a1
1059    lr\t%0,%1
1060    l\t%0,%1
1061    ly\t%0,%1
1062    st\t%1,%0
1063    sty\t%1,%0
1064    ler\t%0,%1
1065    le\t%0,%1
1066    ley\t%0,%1
1067    ste\t%1,%0
1068    stey\t%1,%0
1069    mvc\t%O0(4,%R0),%1"
1070   [(set_attr "op_type" "RI,RI,RI,RXY,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1071    (set_attr "type" "*,*,*,la,lr,load,load,store,store,floads,floads,floads,fstores,fstores,cs")])
1073 (define_insn "*movsi_esa"
1074   [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,?Q")
1075         (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,?Q"))]
1076   "!TARGET_ZARCH"
1077   "@
1078    lhi\t%0,%h1
1079    lr\t%0,%1
1080    l\t%0,%1
1081    st\t%1,%0
1082    ler\t%0,%1
1083    le\t%0,%1
1084    ste\t%1,%0
1085    mvc\t%O0(4,%R0),%1"
1086   [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,SS")
1087    (set_attr "type" "*,lr,load,store,floads,floads,fstores,cs")])
1089 (define_peephole2
1090   [(set (match_operand:SI 0 "register_operand" "")
1091         (mem:SI (match_operand 1 "address_operand" "")))]
1092   "!FP_REG_P (operands[0])
1093    && GET_CODE (operands[1]) == SYMBOL_REF
1094    && CONSTANT_POOL_ADDRESS_P (operands[1])
1095    && get_pool_mode (operands[1]) == SImode
1096    && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1097   [(set (match_dup 0) (match_dup 2))]
1098   "operands[2] = get_pool_constant (operands[1]);")
1100 (define_insn "*la_31"
1101   [(set (match_operand:SI 0 "register_operand" "=d,d")
1102         (match_operand:QI 1 "address_operand" "U,W"))]
1103   "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1104   "@
1105    la\t%0,%a1
1106    lay\t%0,%a1"
1107   [(set_attr "op_type"  "RX,RXY")
1108    (set_attr "type"     "la")])
1110 (define_peephole2
1111   [(parallel
1112     [(set (match_operand:SI 0 "register_operand" "")
1113           (match_operand:QI 1 "address_operand" ""))
1114      (clobber (reg:CC 33))])]
1115   "!TARGET_64BIT
1116    && strict_memory_address_p (VOIDmode, operands[1])
1117    && preferred_la_operand_p (operands[1])"
1118   [(set (match_dup 0) (match_dup 1))]
1119   "")
1121 (define_peephole2
1122   [(set (match_operand:SI 0 "register_operand" "")
1123         (match_operand:SI 1 "register_operand" ""))
1124    (parallel
1125     [(set (match_dup 0)
1126           (plus:SI (match_dup 0)
1127                    (match_operand:SI 2 "nonmemory_operand" "")))
1128      (clobber (reg:CC 33))])]
1129   "!TARGET_64BIT
1130    && !reg_overlap_mentioned_p (operands[0], operands[2])
1131    && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
1132    && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
1133   [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1134   "")
1136 (define_insn "*la_31_and"
1137   [(set (match_operand:SI 0 "register_operand" "=d,d")
1138         (and:SI (match_operand:QI 1 "address_operand" "U,W")
1139                 (const_int 2147483647)))]
1140   "!TARGET_64BIT"
1141   "@
1142    la\t%0,%a1
1143    lay\t%0,%a1"
1144   [(set_attr "op_type"  "RX,RXY")
1145    (set_attr "type"     "la")])
1147 (define_insn_and_split "*la_31_and_cc"
1148   [(set (match_operand:SI 0 "register_operand" "=d")
1149         (and:SI (match_operand:QI 1 "address_operand" "p")
1150                 (const_int 2147483647)))
1151    (clobber (reg:CC 33))]
1152   "!TARGET_64BIT"
1153   "#"
1154   "&& reload_completed"
1155   [(set (match_dup 0)
1156         (and:SI (match_dup 1) (const_int 2147483647)))]
1157   ""
1158   [(set_attr "op_type"  "RX")
1159    (set_attr "type"     "la")])
1161 (define_insn "force_la_31"
1162   [(set (match_operand:SI 0 "register_operand" "=d,d")
1163         (match_operand:QI 1 "address_operand" "U,W"))
1164    (use (const_int 0))]
1165   "!TARGET_64BIT"
1166   "@
1167    la\t%0,%a1
1168    lay\t%0,%a1"
1169   [(set_attr "op_type"  "RX")
1170    (set_attr "type"     "la")])
1172 (define_expand "reload_insi"
1173   [(parallel [(match_operand:SI 0 "register_operand" "=a")
1174               (match_operand:SI 1 "s390_plus_operand" "")
1175               (match_operand:SI 2 "register_operand" "=&a")])]
1176   "!TARGET_64BIT"
1178   s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1179   DONE;
1183 ; movhi instruction pattern(s).
1186 (define_expand "movhi"
1187   [(set (match_operand:HI 0 "nonimmediate_operand" "")
1188         (match_operand:HI 1 "general_operand" ""))]
1189   ""
1191   /* Make it explicit that loading a register from memory
1192      always sign-extends (at least) to SImode.  */
1193   if (optimize && !no_new_pseudos
1194       && register_operand (operands[0], VOIDmode)
1195       && GET_CODE (operands[1]) == MEM)
1196     {
1197       rtx tmp = gen_reg_rtx (SImode);
1198       rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1199       emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1200       operands[1] = gen_lowpart (HImode, tmp);
1201     }
1204 (define_insn "*movhi"
1205   [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1206         (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1207   ""
1208   "@
1209    lr\t%0,%1
1210    lhi\t%0,%h1
1211    lh\t%0,%1
1212    lhy\t%0,%1
1213    sth\t%1,%0
1214    sthy\t%1,%0
1215    mvc\t%O0(2,%R0),%1"
1216   [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1217    (set_attr "type" "lr,*,*,*,store,store,cs")])
1219 (define_peephole2
1220   [(set (match_operand:HI 0 "register_operand" "")
1221         (mem:HI (match_operand 1 "address_operand" "")))]
1222   "GET_CODE (operands[1]) == SYMBOL_REF
1223    && CONSTANT_POOL_ADDRESS_P (operands[1])
1224    && get_pool_mode (operands[1]) == HImode
1225    && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1226   [(set (match_dup 0) (match_dup 2))]
1227   "operands[2] = get_pool_constant (operands[1]);")
1230 ; movqi instruction pattern(s).
1233 (define_expand "movqi"
1234   [(set (match_operand:QI 0 "nonimmediate_operand" "")
1235         (match_operand:QI 1 "general_operand" ""))]
1236   ""
1238   /* On z/Architecture, zero-extending from memory to register
1239      is just as fast as a QImode load.  */
1240   if (TARGET_ZARCH && optimize && !no_new_pseudos
1241       && register_operand (operands[0], VOIDmode)
1242       && GET_CODE (operands[1]) == MEM)
1243     {
1244       rtx tmp = gen_reg_rtx (word_mode);
1245       rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1246       emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1247       operands[1] = gen_lowpart (QImode, tmp);
1248     }
1251 (define_insn "*movqi"
1252   [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1253         (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1254   ""
1255   "@
1256    lr\t%0,%1
1257    lhi\t%0,%b1
1258    ic\t%0,%1
1259    icy\t%0,%1
1260    stc\t%1,%0
1261    stcy\t%1,%0
1262    mvi\t%0,%b1
1263    mviy\t%0,%b1
1264    mvc\t%O0(1,%R0),%1"
1265   [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1266    (set_attr "type" "lr,*,*,*,store,store,store,store,cs")])
1268 (define_peephole2
1269   [(set (match_operand:QI 0 "nonimmediate_operand" "")
1270         (mem:QI (match_operand 1 "address_operand" "")))]
1271   "GET_CODE (operands[1]) == SYMBOL_REF
1272    && CONSTANT_POOL_ADDRESS_P (operands[1])
1273    && get_pool_mode (operands[1]) == QImode
1274    && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1275   [(set (match_dup 0) (match_dup 2))]
1276   "operands[2] = get_pool_constant (operands[1]);")
1279 ; movstrictqi instruction pattern(s).
1282 (define_insn "*movstrictqi"
1283   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1284                          (match_operand:QI 1 "memory_operand" "R,T"))]
1285   ""
1286   "@
1287    ic\t%0,%1
1288    icy\t%0,%1"
1289   [(set_attr "op_type"  "RX,RXY")])
1292 ; movstricthi instruction pattern(s).
1295 (define_insn "*movstricthi"
1296   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1297                          (match_operand:HI 1 "s_imm_operand" "Q,S"))
1298    (clobber (reg:CC 33))]
1299   ""
1300   "@
1301    icm\t%0,3,%1
1302    icmy\t%0,3,%1"
1303   [(set_attr "op_type" "RS,RSY")])
1306 ; movstrictsi instruction pattern(s).
1309 (define_insn "movstrictsi"
1310   [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d"))
1311                          (match_operand:SI 1 "general_operand" "d,R,T"))]
1312   "TARGET_64BIT"
1313   "@
1314    lr\t%0,%1
1315    l\t%0,%1
1316    ly\t%0,%1"
1317   [(set_attr "op_type" "RR,RX,RXY")
1318    (set_attr "type" "lr,load,load")])
1321 ; movdf instruction pattern(s).
1324 (define_expand "movdf"
1325   [(set (match_operand:DF 0 "nonimmediate_operand" "")
1326         (match_operand:DF 1 "general_operand"  ""))]
1327   ""
1329   /* During and after reload, we need to force constants
1330      to the literal pool ourselves, if necessary.  */
1331   if ((reload_in_progress || reload_completed)
1332       && CONSTANT_P (operands[1]))
1333     operands[1] = force_const_mem (DFmode, operands[1]);
1336 (define_insn "*movdf_64"
1337   [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1338         (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1339   "TARGET_64BIT"
1340   "@
1341    ldr\t%0,%1
1342    ld\t%0,%1
1343    ldy\t%0,%1
1344    std\t%1,%0
1345    stdy\t%1,%0
1346    lgr\t%0,%1
1347    lg\t%0,%1
1348    stg\t%1,%0
1349    mvc\t%O0(8,%R0),%1"
1350   [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1351    (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,cs")])
1353 (define_insn "*movdf_31"
1354   [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1355         (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1356   "!TARGET_64BIT"
1357   "@
1358    ldr\t%0,%1
1359    ld\t%0,%1
1360    ldy\t%0,%1
1361    std\t%1,%0
1362    stdy\t%1,%0
1363    lm\t%0,%N0,%1
1364    stm\t%1,%N1,%0
1365    #
1366    #
1367    mvc\t%O0(8,%R0),%1"
1368   [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,NN,NN,SS")
1369    (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,cs")])
1371 (define_split
1372   [(set (match_operand:DF 0 "nonimmediate_operand" "")
1373         (match_operand:DF 1 "general_operand" ""))]
1374   "!TARGET_64BIT && reload_completed
1375    && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1376   [(set (match_dup 2) (match_dup 4))
1377    (set (match_dup 3) (match_dup 5))]
1379   operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1380   operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1381   operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1382   operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1385 (define_split
1386   [(set (match_operand:DF 0 "nonimmediate_operand" "")
1387         (match_operand:DF 1 "general_operand" ""))]
1388   "!TARGET_64BIT && reload_completed
1389    && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1390   [(set (match_dup 2) (match_dup 4))
1391    (set (match_dup 3) (match_dup 5))]
1393   operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1394   operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1395   operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1396   operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1399 (define_split
1400   [(set (match_operand:DF 0 "register_operand" "")
1401         (match_operand:DF 1 "memory_operand" ""))]
1402   "!TARGET_64BIT && reload_completed
1403    && !FP_REG_P (operands[0])
1404    && !s_operand (operands[1], VOIDmode)"
1405   [(set (match_dup 0) (match_dup 1))]
1407   rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1408   s390_load_address (addr, XEXP (operands[1], 0));
1409   operands[1] = replace_equiv_address (operands[1], addr);
1412 (define_expand "reload_outdf"
1413   [(parallel [(match_operand:DF 0 "memory_operand" "")
1414               (match_operand:DF 1 "register_operand" "d")
1415               (match_operand:SI 2 "register_operand" "=&a")])]
1416   "!TARGET_64BIT"
1418   s390_load_address (operands[2], XEXP (operands[0], 0));
1419   operands[0] = replace_equiv_address (operands[0], operands[2]);
1420   emit_move_insn (operands[0], operands[1]);
1421   DONE;
1425 ; movsf instruction pattern(s).
1428 (define_expand "movsf"
1429   [(set (match_operand:SF 0 "nonimmediate_operand" "")
1430         (match_operand:SF 1 "general_operand"  ""))]
1431   ""
1433   /* During and after reload, we need to force constants
1434      to the literal pool ourselves, if necessary.  */
1435   if ((reload_in_progress || reload_completed)
1436       && CONSTANT_P (operands[1]))
1437     operands[1] = force_const_mem (SFmode, operands[1]);
1440 (define_insn "*movsf"
1441   [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1442         (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1443   ""
1444   "@
1445    ler\t%0,%1
1446    le\t%0,%1
1447    ley\t%0,%1
1448    ste\t%1,%0
1449    stey\t%1,%0
1450    lr\t%0,%1
1451    l\t%0,%1
1452    ly\t%0,%1
1453    st\t%1,%0
1454    sty\t%1,%0
1455    mvc\t%O0(4,%R0),%1"
1456   [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1457    (set_attr "type" "floads,floads,floads,fstores,fstores,lr,load,load,store,store,cs")])
1460 ; load_multiple pattern(s).
1462 ; ??? Due to reload problems with replacing registers inside match_parallel
1463 ; we currently support load_multiple/store_multiple only after reload.
1466 (define_expand "load_multiple"
1467   [(match_par_dup 3 [(set (match_operand 0 "" "")
1468                           (match_operand 1 "" ""))
1469                      (use (match_operand 2 "" ""))])]
1470   "reload_completed"
1472   enum machine_mode mode;
1473   int regno;
1474   int count;
1475   rtx from;
1476   int i, off;
1478   /* Support only loading a constant number of fixed-point registers from
1479      memory and only bother with this if more than two */
1480   if (GET_CODE (operands[2]) != CONST_INT
1481       || INTVAL (operands[2]) < 2
1482       || INTVAL (operands[2]) > 16
1483       || GET_CODE (operands[1]) != MEM
1484       || GET_CODE (operands[0]) != REG
1485       || REGNO (operands[0]) >= 16)
1486     FAIL;
1488   count = INTVAL (operands[2]);
1489   regno = REGNO (operands[0]);
1490   mode = GET_MODE (operands[0]);
1491   if (mode != SImode && mode != word_mode)
1492     FAIL;
1494   operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1495   if (no_new_pseudos)
1496     {
1497       if (GET_CODE (XEXP (operands[1], 0)) == REG)
1498         {
1499           from = XEXP (operands[1], 0);
1500           off = 0;
1501         }
1502       else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1503                && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1504                && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1505         {
1506           from = XEXP (XEXP (operands[1], 0), 0);
1507           off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1508         }
1509       else
1510         FAIL;
1511     }
1512   else
1513     {
1514       from = force_reg (Pmode, XEXP (operands[1], 0));
1515       off = 0;
1516     }
1518   for (i = 0; i < count; i++)
1519     XVECEXP (operands[3], 0, i)
1520       = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1521                      change_address (operands[1], mode,
1522                        plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1525 (define_insn "*load_multiple_di"
1526   [(match_parallel 0 "load_multiple_operation"
1527                    [(set (match_operand:DI 1 "register_operand" "=r")
1528                          (match_operand:DI 2 "s_operand" "QS"))])]
1529   "reload_completed && word_mode == DImode"
1531   int words = XVECLEN (operands[0], 0);
1532   operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1533   return "lmg\t%1,%0,%2";
1535    [(set_attr "op_type" "RSY")
1536     (set_attr "type"    "lm")])
1538 (define_insn "*load_multiple_si"
1539   [(match_parallel 0 "load_multiple_operation"
1540                    [(set (match_operand:SI 1 "register_operand" "=r,r")
1541                          (match_operand:SI 2 "s_operand" "Q,S"))])]
1542   "reload_completed"
1544   int words = XVECLEN (operands[0], 0);
1545   operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1546   return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1548    [(set_attr "op_type" "RS,RSY")
1549     (set_attr "type"    "lm")])
1552 ; store multiple pattern(s).
1555 (define_expand "store_multiple"
1556   [(match_par_dup 3 [(set (match_operand 0 "" "")
1557                           (match_operand 1 "" ""))
1558                      (use (match_operand 2 "" ""))])]
1559   "reload_completed"
1561   enum machine_mode mode;
1562   int regno;
1563   int count;
1564   rtx to;
1565   int i, off;
1567   /* Support only storing a constant number of fixed-point registers to
1568      memory and only bother with this if more than two.  */
1569   if (GET_CODE (operands[2]) != CONST_INT
1570       || INTVAL (operands[2]) < 2
1571       || INTVAL (operands[2]) > 16
1572       || GET_CODE (operands[0]) != MEM
1573       || GET_CODE (operands[1]) != REG
1574       || REGNO (operands[1]) >= 16)
1575     FAIL;
1577   count = INTVAL (operands[2]);
1578   regno = REGNO (operands[1]);
1579   mode = GET_MODE (operands[1]);
1580   if (mode != SImode && mode != word_mode)
1581     FAIL;
1583   operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1585   if (no_new_pseudos)
1586     {
1587       if (GET_CODE (XEXP (operands[0], 0)) == REG)
1588         {
1589           to = XEXP (operands[0], 0);
1590           off = 0;
1591         }
1592       else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1593                && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1594                && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1595         {
1596           to = XEXP (XEXP (operands[0], 0), 0);
1597           off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1598         }
1599       else
1600         FAIL;
1601     }
1602   else
1603     {
1604       to = force_reg (Pmode, XEXP (operands[0], 0));
1605       off = 0;
1606     }
1608   for (i = 0; i < count; i++)
1609     XVECEXP (operands[3], 0, i)
1610       = gen_rtx_SET (VOIDmode,
1611                      change_address (operands[0], mode,
1612                        plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1613                      gen_rtx_REG (mode, regno + i));
1616 (define_insn "*store_multiple_di"
1617   [(match_parallel 0 "store_multiple_operation"
1618                    [(set (match_operand:DI 1 "s_operand" "=QS")
1619                          (match_operand:DI 2 "register_operand" "r"))])]
1620   "reload_completed && word_mode == DImode"
1622   int words = XVECLEN (operands[0], 0);
1623   operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1624   return "stmg\t%2,%0,%1";
1626    [(set_attr "op_type" "RSY")
1627     (set_attr "type"    "stm")])
1630 (define_insn "*store_multiple_si"
1631   [(match_parallel 0 "store_multiple_operation"
1632                    [(set (match_operand:SI 1 "s_operand" "=Q,S")
1633                          (match_operand:SI 2 "register_operand" "r,r"))])]
1634   "reload_completed"
1636   int words = XVECLEN (operands[0], 0);
1637   operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1638   return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1640    [(set_attr "op_type" "RS,RSY")
1641     (set_attr "type"    "stm")])
1644 ;; String instructions.
1648 ; strlenM instruction pattern(s).
1651 (define_expand "strlendi"
1652   [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1653    (parallel
1654     [(set (match_dup 4)
1655           (unspec:DI [(const_int 0)
1656                       (match_operand:BLK 1 "memory_operand" "")
1657                       (reg:QI 0)
1658                       (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1659      (clobber (scratch:DI))
1660      (clobber (reg:CC 33))])
1661    (parallel
1662     [(set (match_operand:DI 0 "register_operand" "")
1663           (minus:DI (match_dup 4) (match_dup 5)))
1664      (clobber (reg:CC 33))])]
1665   "TARGET_64BIT"
1667   operands[4] = gen_reg_rtx (DImode);
1668   operands[5] = gen_reg_rtx (DImode);
1669   emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1670   operands[1] = replace_equiv_address (operands[1], operands[5]);
1673 (define_insn "*strlendi"
1674   [(set (match_operand:DI 0 "register_operand" "=a")
1675         (unspec:DI [(match_operand:DI 2 "general_operand" "0")
1676                     (mem:BLK (match_operand:DI 3 "register_operand" "1"))
1677                     (reg:QI 0)
1678                     (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1679    (clobber (match_scratch:DI 1 "=a"))
1680    (clobber (reg:CC 33))]
1681   "TARGET_64BIT"
1682   "srst\t%0,%1\;jo\t.-4"
1683   [(set_attr "op_type" "NN")
1684    (set_attr "type"    "vs")
1685    (set_attr "length"  "8")])
1687 (define_expand "strlensi"
1688   [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1689    (parallel
1690     [(set (match_dup 4)
1691           (unspec:SI [(const_int 0)
1692                       (match_operand:BLK 1 "memory_operand" "")
1693                       (reg:QI 0)
1694                       (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1695      (clobber (scratch:SI))
1696      (clobber (reg:CC 33))])
1697    (parallel
1698     [(set (match_operand:SI 0 "register_operand" "")
1699           (minus:SI (match_dup 4) (match_dup 5)))
1700      (clobber (reg:CC 33))])]
1701   "!TARGET_64BIT"
1703   operands[4] = gen_reg_rtx (SImode);
1704   operands[5] = gen_reg_rtx (SImode);
1705   emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1706   operands[1] = replace_equiv_address (operands[1], operands[5]);
1709 (define_insn "*strlensi"
1710   [(set (match_operand:SI 0 "register_operand" "=a")
1711         (unspec:SI [(match_operand:SI 2 "general_operand" "0")
1712                     (mem:BLK (match_operand:SI 3 "register_operand" "1"))
1713                     (reg:QI 0)
1714                     (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1715    (clobber (match_scratch:SI 1 "=a"))
1716    (clobber (reg:CC 33))]
1717   "!TARGET_64BIT"
1718   "srst\t%0,%1\;jo\t.-4"
1719   [(set_attr "op_type" "NN")
1720    (set_attr "type"    "vs")
1721    (set_attr "length"  "8")])
1724 ; movmemM instruction pattern(s).
1727 (define_expand "movmemdi"
1728   [(set (match_operand:BLK 0 "memory_operand" "")
1729         (match_operand:BLK 1 "memory_operand" ""))
1730    (use (match_operand:DI 2 "general_operand" ""))
1731    (match_operand 3 "" "")]
1732   "TARGET_64BIT"
1733   "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
1735 (define_expand "movmemsi"
1736   [(set (match_operand:BLK 0 "memory_operand" "")
1737         (match_operand:BLK 1 "memory_operand" ""))
1738    (use (match_operand:SI 2 "general_operand" ""))
1739    (match_operand 3 "" "")]
1740   ""
1741   "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
1743 ; Move a block that is up to 256 bytes in length.
1744 ; The block length is taken as (operands[2] % 256) + 1.
1746 (define_expand "movmem_short"
1747   [(parallel
1748     [(set (match_operand:BLK 0 "memory_operand" "")
1749           (match_operand:BLK 1 "memory_operand" ""))
1750      (use (match_operand 2 "nonmemory_operand" ""))
1751      (clobber (match_dup 3))])]
1752   ""
1753   "operands[3] = gen_rtx_SCRATCH (Pmode);")
1755 (define_insn "*movmem_short"
1756   [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1757         (match_operand:BLK 1 "memory_operand" "Q,Q"))
1758    (use (match_operand 2 "nonmemory_operand" "n,a"))
1759    (clobber (match_scratch 3 "=X,&a"))]
1760   "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
1761    && GET_MODE (operands[3]) == Pmode"
1763   switch (which_alternative)
1764     {
1765       case 0:
1766         return "mvc\t%O0(%b2+1,%R0),%1";
1768       case 1:
1769         output_asm_insn ("bras\t%3,.+10", operands);
1770         output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
1771         return "ex\t%2,0(%3)";
1773       default:
1774         abort ();
1775     }
1777   [(set_attr "op_type" "SS,NN")
1778    (set_attr "type"    "cs,cs")
1779    (set_attr "atype"   "*,agen")
1780    (set_attr "length"  "*,14")])
1782 ; Move a block of arbitrary length.
1784 (define_expand "movmem_long"
1785   [(parallel
1786     [(clobber (match_dup 2))
1787      (clobber (match_dup 3))
1788      (set (match_operand:BLK 0 "memory_operand" "")
1789           (match_operand:BLK 1 "memory_operand" ""))
1790      (use (match_operand 2 "general_operand" ""))
1791      (use (match_dup 3))
1792      (clobber (reg:CC 33))])]
1793   ""
1795   enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1796   rtx reg0 = gen_reg_rtx (dword_mode);
1797   rtx reg1 = gen_reg_rtx (dword_mode);
1798   rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1799   rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
1800   rtx len0 = gen_lowpart (Pmode, reg0);
1801   rtx len1 = gen_lowpart (Pmode, reg1);
1803   emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1804   emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1805   emit_move_insn (len0, operands[2]);
1807   emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
1808   emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1809   emit_move_insn (len1, operands[2]);
1811   operands[0] = replace_equiv_address_nv (operands[0], addr0);
1812   operands[1] = replace_equiv_address_nv (operands[1], addr1);
1813   operands[2] = reg0;
1814   operands[3] = reg1;
1817 (define_insn "*movmem_long_64"
1818   [(clobber (match_operand:TI 0 "register_operand" "=d"))
1819    (clobber (match_operand:TI 1 "register_operand" "=d"))
1820    (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1821         (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
1822    (use (match_dup 2))
1823    (use (match_dup 3))
1824    (clobber (reg:CC 33))]
1825   "TARGET_64BIT"
1826   "mvcle\t%0,%1,0\;jo\t.-4"
1827   [(set_attr "op_type" "NN")
1828    (set_attr "type"    "vs")
1829    (set_attr "length"  "8")])
1831 (define_insn "*movmem_long_31"
1832   [(clobber (match_operand:DI 0 "register_operand" "=d"))
1833    (clobber (match_operand:DI 1 "register_operand" "=d"))
1834    (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1835         (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
1836    (use (match_dup 2))
1837    (use (match_dup 3))
1838    (clobber (reg:CC 33))]
1839   "!TARGET_64BIT"
1840   "mvcle\t%0,%1,0\;jo\t.-4"
1841   [(set_attr "op_type" "NN")
1842    (set_attr "type"    "vs")
1843    (set_attr "length"  "8")])
1846 ; clrmemM instruction pattern(s).
1849 (define_expand "clrmemdi"
1850   [(set (match_operand:BLK 0 "memory_operand" "")
1851         (const_int 0))
1852    (use (match_operand:DI 1 "general_operand" ""))
1853    (match_operand 2 "" "")]
1854   "TARGET_64BIT"
1855   "s390_expand_clrmem (operands[0], operands[1]); DONE;")
1857 (define_expand "clrmemsi"
1858   [(set (match_operand:BLK 0 "memory_operand" "")
1859         (const_int 0))
1860    (use (match_operand:SI 1 "general_operand" ""))
1861    (match_operand 2 "" "")]
1862   ""
1863   "s390_expand_clrmem (operands[0], operands[1]); DONE;")
1865 ; Clear a block that is up to 256 bytes in length.
1866 ; The block length is taken as (operands[1] % 256) + 1.
1868 (define_expand "clrmem_short"
1869   [(parallel
1870     [(set (match_operand:BLK 0 "memory_operand" "")
1871           (const_int 0))
1872      (use (match_operand 1 "nonmemory_operand" ""))
1873      (clobber (match_dup 2))
1874      (clobber (reg:CC 33))])]
1875   ""
1876   "operands[2] = gen_rtx_SCRATCH (Pmode);")
1878 (define_insn "*clrmem_short"
1879   [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1880         (const_int 0))
1881    (use (match_operand 1 "nonmemory_operand" "n,a"))
1882    (clobber (match_scratch 2 "=X,&a"))
1883    (clobber (reg:CC 33))]
1884   "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
1885    && GET_MODE (operands[2]) == Pmode"
1887   switch (which_alternative)
1888     {
1889       case 0:
1890         return "xc\t%O0(%b1+1,%R0),%0";
1892       case 1:
1893         output_asm_insn ("bras\t%2,.+10", operands);
1894         output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
1895         return "ex\t%1,0(%2)";
1897       default:
1898         abort ();
1899     }
1901   [(set_attr "op_type" "SS,NN")
1902    (set_attr "type"    "cs,cs")
1903    (set_attr "atype"   "*,agen")
1904    (set_attr "length"  "*,14")])
1906 ; Clear a block of arbitrary length.
1908 (define_expand "clrmem_long"
1909   [(parallel
1910     [(clobber (match_dup 1))
1911      (set (match_operand:BLK 0 "memory_operand" "")
1912           (const_int 0))
1913      (use (match_operand 1 "general_operand" ""))
1914      (use (match_dup 2))
1915      (clobber (reg:CC 33))])]
1916   ""
1918   enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1919   rtx reg0 = gen_reg_rtx (dword_mode);
1920   rtx reg1 = gen_reg_rtx (dword_mode);
1921   rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1922   rtx len0 = gen_lowpart (Pmode, reg0);
1924   emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1925   emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1926   emit_move_insn (len0, operands[1]);
1928   emit_move_insn (reg1, const0_rtx);
1930   operands[0] = replace_equiv_address_nv (operands[0], addr0);
1931   operands[1] = reg0;
1932   operands[2] = reg1;
1935 (define_insn "*clrmem_long_64"
1936   [(clobber (match_operand:TI 0 "register_operand" "=d"))
1937    (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1938         (const_int 0))
1939    (use (match_dup 2))
1940    (use (match_operand:TI 1 "register_operand" "d"))
1941    (clobber (reg:CC 33))]
1942   "TARGET_64BIT"
1943   "mvcle\t%0,%1,0\;jo\t.-4"
1944   [(set_attr "op_type" "NN")
1945    (set_attr "type"    "vs")
1946    (set_attr "length"  "8")])
1948 (define_insn "*clrmem_long_31"
1949   [(clobber (match_operand:DI 0 "register_operand" "=d"))
1950    (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1951         (const_int 0))
1952    (use (match_dup 2))
1953    (use (match_operand:DI 1 "register_operand" "d"))
1954    (clobber (reg:CC 33))]
1955   "!TARGET_64BIT"
1956   "mvcle\t%0,%1,0\;jo\t.-4"
1957   [(set_attr "op_type" "NN")
1958    (set_attr "type"    "vs")
1959    (set_attr "length"  "8")])
1962 ; cmpmemM instruction pattern(s).
1965 (define_expand "cmpmemdi"
1966   [(set (match_operand:DI 0 "register_operand" "")
1967         (compare:DI (match_operand:BLK 1 "memory_operand" "")
1968                     (match_operand:BLK 2 "memory_operand" "") ) )
1969    (use (match_operand:DI 3 "general_operand" ""))
1970    (use (match_operand:DI 4 "" ""))]
1971   "TARGET_64BIT"
1972   "s390_expand_cmpmem (operands[0], operands[1],
1973                        operands[2], operands[3]); DONE;")
1975 (define_expand "cmpmemsi"
1976   [(set (match_operand:SI 0 "register_operand" "")
1977         (compare:SI (match_operand:BLK 1 "memory_operand" "")
1978                     (match_operand:BLK 2 "memory_operand" "") ) )
1979    (use (match_operand:SI 3 "general_operand" ""))
1980    (use (match_operand:SI 4 "" ""))]
1981   ""
1982   "s390_expand_cmpmem (operands[0], operands[1],
1983                        operands[2], operands[3]); DONE;")
1985 ; Compare a block that is up to 256 bytes in length.
1986 ; The block length is taken as (operands[2] % 256) + 1.
1988 (define_expand "cmpmem_short"
1989   [(parallel
1990     [(set (reg:CCS 33)
1991           (compare:CCS (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 "*cmpmem_short"
1999   [(set (reg:CCS 33)
2000         (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2001                      (match_operand:BLK 1 "memory_operand" "Q,Q")))
2002    (use (match_operand 2 "nonmemory_operand" "n,a"))
2003    (clobber (match_scratch 3 "=X,&a"))]
2004   "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2005    && GET_MODE (operands[3]) == Pmode"
2007   switch (which_alternative)
2008     {
2009       case 0:
2010         return "clc\t%O0(%b2+1,%R0),%1";
2012       case 1:
2013         output_asm_insn ("bras\t%3,.+10", operands);
2014         output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2015         return "ex\t%2,0(%3)";
2017       default:
2018         abort ();
2019     }
2021   [(set_attr "op_type" "SS,NN")
2022    (set_attr "type"    "cs,cs")
2023    (set_attr "atype"   "*,agen")
2024    (set_attr "length"  "*,14")])
2026 ; Compare a block of arbitrary length.
2028 (define_expand "cmpmem_long"
2029   [(parallel
2030     [(clobber (match_dup 2))
2031      (clobber (match_dup 3))
2032      (set (reg:CCS 33)
2033           (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2034                        (match_operand:BLK 1 "memory_operand" "")))
2035      (use (match_operand 2 "general_operand" ""))
2036      (use (match_dup 3))])]
2037   ""
2039   enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2040   rtx reg0 = gen_reg_rtx (dword_mode);
2041   rtx reg1 = gen_reg_rtx (dword_mode);
2042   rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2043   rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2044   rtx len0 = gen_lowpart (Pmode, reg0);
2045   rtx len1 = gen_lowpart (Pmode, reg1);
2047   emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2048   emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2049   emit_move_insn (len0, operands[2]);
2051   emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2052   emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2053   emit_move_insn (len1, operands[2]);
2055   operands[0] = replace_equiv_address_nv (operands[0], addr0);
2056   operands[1] = replace_equiv_address_nv (operands[1], addr1);
2057   operands[2] = reg0;
2058   operands[3] = reg1;
2061 (define_insn "*cmpmem_long_64"
2062   [(clobber (match_operand:TI 0 "register_operand" "=d"))
2063    (clobber (match_operand:TI 1 "register_operand" "=d"))
2064    (set (reg:CCS 33)
2065         (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2066                      (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2067    (use (match_dup 2))
2068    (use (match_dup 3))]
2069   "TARGET_64BIT"
2070   "clcle\t%0,%1,0\;jo\t.-4"
2071   [(set_attr "op_type" "NN")
2072    (set_attr "type"    "vs")
2073    (set_attr "length"  "8")])
2075 (define_insn "*cmpmem_long_31"
2076   [(clobber (match_operand:DI 0 "register_operand" "=d"))
2077    (clobber (match_operand:DI 1 "register_operand" "=d"))
2078    (set (reg:CCS 33)
2079         (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2080                      (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2081    (use (match_dup 2))
2082    (use (match_dup 3))]
2083   "!TARGET_64BIT"
2084   "clcle\t%0,%1,0\;jo\t.-4"
2085   [(set_attr "op_type" "NN")
2086    (set_attr "type"    "vs")
2087    (set_attr "length"  "8")])
2089 ; Convert condition code to integer in range (-1, 0, 1)
2091 (define_insn "cmpint_si"
2092   [(set (match_operand:SI 0 "register_operand" "=d")
2093         (compare:SI (reg:CCS 33) (const_int 0)))]
2094   ""
2096    output_asm_insn ("lhi\t%0,1", operands);
2097    output_asm_insn ("jh\t.+12", operands);
2098    output_asm_insn ("jl\t.+6", operands);
2099    output_asm_insn ("sr\t%0,%0", operands);
2100    return "lcr\t%0,%0";
2102   [(set_attr "op_type" "NN")
2103    (set_attr "length"  "16")
2104    (set_attr "type"    "other")])
2106 (define_insn "cmpint_di"
2107   [(set (match_operand:DI 0 "register_operand" "=d")
2108         (compare:DI (reg:CCS 33) (const_int 0)))]
2109   "TARGET_64BIT"
2111    output_asm_insn ("lghi\t%0,1", operands);
2112    output_asm_insn ("jh\t.+16", operands);
2113    output_asm_insn ("jl\t.+8", operands);
2114    output_asm_insn ("sgr\t%0,%0", operands);
2115    return "lcgr\t%0,%0";
2117   [(set_attr "op_type" "NN")
2118    (set_attr "length"  "20")
2119    (set_attr "type"    "other")])
2123 ;;- Conversion instructions.
2126 (define_insn "*sethighqisi"
2127   [(set (match_operand:SI 0 "register_operand" "=d,d")
2128         (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2129    (clobber (reg:CC 33))]
2130   ""
2131   "@
2132    icm\t%0,8,%1
2133    icmy\t%0,8,%1"
2134   [(set_attr "op_type" "RS,RSY")])
2136 (define_insn "*sethighhisi"
2137   [(set (match_operand:SI 0 "register_operand" "=d,d")
2138         (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2139    (clobber (reg:CC 33))]
2140   ""
2141   "@
2142    icm\t%0,12,%1
2143    icmy\t%0,12,%1"
2144   [(set_attr "op_type" "RS,RSY")])
2146 (define_insn "*sethighqidi_64"
2147   [(set (match_operand:DI 0 "register_operand" "=d")
2148         (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2149    (clobber (reg:CC 33))]
2150   "TARGET_64BIT"
2151   "icmh\t%0,8,%1"
2152   [(set_attr "op_type" "RSY")])
2154 (define_insn "*sethighqidi_31"
2155   [(set (match_operand:DI 0 "register_operand" "=d,d")
2156         (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2157    (clobber (reg:CC 33))]
2158   "!TARGET_64BIT"
2159   "@
2160    icm\t%0,8,%1
2161    icmy\t%0,8,%1"
2162   [(set_attr "op_type" "RS,RSY")])
2164 (define_insn_and_split "*extractqi"
2165   [(set (match_operand:SI 0 "register_operand" "=d")
2166         (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2167                          (match_operand 2 "const_int_operand" "n")
2168                          (const_int 0)))
2169    (clobber (reg:CC 33))]
2170   "!TARGET_64BIT
2171    && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2172   "#"
2173   "&& reload_completed"
2174   [(parallel
2175     [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2176      (clobber (reg:CC 33))])
2177     (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2179   operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2180   operands[1] = change_address (operands[1], QImode, 0);
2182   [(set_attr "atype"   "agen")])
2184 (define_insn_and_split "*extracthi"
2185   [(set (match_operand:SI 0 "register_operand" "=d")
2186         (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2187                          (match_operand 2 "const_int_operand" "n")
2188                          (const_int 0)))
2189    (clobber (reg:CC 33))]
2190   "!TARGET_64BIT
2191    && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2192   "#"
2193   "&& reload_completed"
2194   [(parallel
2195     [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2196      (clobber (reg:CC 33))])
2197     (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2199   operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2200   operands[1] = change_address (operands[1], HImode, 0);
2202   [(set_attr "atype"   "agen")])
2205 ; extendsidi2 instruction pattern(s).
2208 (define_expand "extendsidi2"
2209   [(set (match_operand:DI 0 "register_operand" "")
2210         (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2211   ""
2212   "
2214   if (!TARGET_64BIT)
2215     {
2216       emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2217       emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2218       emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2219       emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2220       DONE;
2221     }
2225 (define_insn "*extendsidi2"
2226   [(set (match_operand:DI 0 "register_operand" "=d,d")
2227         (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2228   "TARGET_64BIT"
2229   "@
2230    lgfr\t%0,%1
2231    lgf\t%0,%1"
2232   [(set_attr "op_type" "RRE,RXY")])
2235 ; extendhidi2 instruction pattern(s).
2238 (define_expand "extendhidi2"
2239   [(set (match_operand:DI 0 "register_operand" "")
2240         (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2241   ""
2242   "
2244   if (!TARGET_64BIT)
2245     {
2246       rtx tmp = gen_reg_rtx (SImode);
2247       emit_insn (gen_extendhisi2 (tmp, operands[1]));
2248       emit_insn (gen_extendsidi2 (operands[0], tmp));
2249       DONE;
2250     }
2251   else
2252     {
2253       operands[1] = gen_lowpart (DImode, operands[1]);
2254       emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2255       emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2256       DONE;
2257     }
2261 (define_insn "*extendhidi2"
2262   [(set (match_operand:DI 0 "register_operand" "=d")
2263         (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2264   "TARGET_64BIT"
2265   "lgh\t%0,%1"
2266   [(set_attr "op_type" "RXY")])
2269 ; extendqidi2 instruction pattern(s).
2272 (define_expand "extendqidi2"
2273   [(set (match_operand:DI 0 "register_operand" "")
2274         (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2275   ""
2276   "
2278   if (!TARGET_64BIT)
2279     {
2280       rtx tmp = gen_reg_rtx (SImode);
2281       emit_insn (gen_extendqisi2 (tmp, operands[1]));
2282       emit_insn (gen_extendsidi2 (operands[0], tmp));
2283       DONE;
2284     }
2285   else
2286     {
2287       operands[1] = gen_lowpart (DImode, operands[1]);
2288       emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2289       emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2290       DONE;
2291     }
2295 (define_insn "*extendqidi2"
2296   [(set (match_operand:DI 0 "register_operand" "=d")
2297         (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2298   "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2299   "lgb\t%0,%1"
2300   [(set_attr "op_type" "RXY")])
2302 (define_insn_and_split "*extendqidi2_short_displ"
2303   [(set (match_operand:DI 0 "register_operand" "=d")
2304         (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))
2305    (clobber (reg:CC 33))]
2306   "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2307   "#"
2308   "&& reload_completed"
2309   [(parallel
2310     [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2311      (clobber (reg:CC 33))])
2312    (parallel
2313     [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2314      (clobber (reg:CC 33))])]
2315   "")
2318 ; extendhisi2 instruction pattern(s).
2321 (define_expand "extendhisi2"
2322   [(set (match_operand:SI 0 "register_operand" "")
2323         (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2324   ""
2325   "
2327   operands[1] = gen_lowpart (SImode, operands[1]);
2328   emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2329   emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2330   DONE;
2334 (define_insn "*extendhisi2"
2335   [(set (match_operand:SI 0 "register_operand" "=d,d")
2336         (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2337   ""
2338   "@
2339    lh\t%0,%1
2340    lhy\t%0,%1"
2341   [(set_attr "op_type" "RX,RXY")])
2344 ; extendqisi2 instruction pattern(s).
2347 (define_expand "extendqisi2"
2348   [(set (match_operand:SI 0 "register_operand" "")
2349         (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2350   ""
2351   "
2353   operands[1] = gen_lowpart (SImode, operands[1]);
2354   emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2355   emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2356   DONE;
2360 (define_insn "*extendqisi2"
2361   [(set (match_operand:SI 0 "register_operand" "=d")
2362         (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2363   "TARGET_LONG_DISPLACEMENT"
2364   "lb\t%0,%1"
2365   [(set_attr "op_type" "RXY")])
2367 (define_insn_and_split "*extendqisi2_short_displ"
2368   [(set (match_operand:SI 0 "register_operand" "=d")
2369         (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))
2370    (clobber (reg:CC 33))]
2371   "!TARGET_LONG_DISPLACEMENT"
2372   "#"
2373   "&& reload_completed"
2374   [(parallel
2375     [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2376      (clobber (reg:CC 33))])
2377    (parallel
2378     [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2379      (clobber (reg:CC 33))])]
2380   "")
2383 ; extendqihi2 instruction pattern(s).
2388 ; zero_extendsidi2 instruction pattern(s).
2391 (define_expand "zero_extendsidi2"
2392   [(set (match_operand:DI 0 "register_operand" "")
2393         (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2394   ""
2395   "
2397   if (!TARGET_64BIT)
2398     {
2399       emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2400       emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2401       emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2402       DONE;
2403     }
2407 (define_insn "*zero_extendsidi2"
2408   [(set (match_operand:DI 0 "register_operand" "=d,d")
2409         (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2410   "TARGET_64BIT"
2411   "@
2412    llgfr\t%0,%1
2413    llgf\t%0,%1"
2414   [(set_attr "op_type" "RRE,RXY")])
2417 ; zero_extendhidi2 instruction pattern(s).
2420 (define_expand "zero_extendhidi2"
2421   [(set (match_operand:DI 0 "register_operand" "")
2422         (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2423   ""
2424   "
2426   if (!TARGET_64BIT)
2427     {
2428       rtx tmp = gen_reg_rtx (SImode);
2429       emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2430       emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2431       DONE;
2432     }
2433   else
2434     {
2435       operands[1] = gen_lowpart (DImode, operands[1]);
2436       emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2437       emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2438       DONE;
2439     }
2443 (define_insn "*zero_extendhidi2"
2444   [(set (match_operand:DI 0 "register_operand" "=d")
2445         (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2446   "TARGET_64BIT"
2447   "llgh\t%0,%1"
2448   [(set_attr "op_type" "RXY")])
2451 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2454 (define_insn "*llgt_sisi"
2455   [(set (match_operand:SI 0 "register_operand" "=d,d")
2456         (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2457                 (const_int 2147483647)))]
2458   "TARGET_64BIT"
2459   "@
2460    llgtr\t%0,%1
2461    llgt\t%0,%1"
2462   [(set_attr "op_type"  "RRE,RXE")])
2464 (define_split
2465   [(set (match_operand:SI 0 "register_operand" "")
2466         (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2467                 (const_int 2147483647)))
2468    (clobber (reg:CC 33))]
2469   "TARGET_64BIT && reload_completed"
2470   [(set (match_dup 0)
2471         (and:SI (match_dup 1)
2472                 (const_int 2147483647)))]
2473   "")
2475 (define_insn "*llgt_didi"
2476   [(set (match_operand:DI 0 "register_operand" "=d,d")
2477         (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2478                 (const_int 2147483647)))]
2479   "TARGET_64BIT"
2480   "@
2481    llgtr\t%0,%1
2482    llgt\t%0,%N1"
2483   [(set_attr "op_type"  "RRE,RXE")])
2485 (define_split
2486   [(set (match_operand:DI 0 "register_operand" "")
2487         (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
2488                 (const_int 2147483647)))
2489    (clobber (reg:CC 33))]
2490   "TARGET_64BIT && reload_completed"
2491   [(set (match_dup 0)
2492         (and:DI (match_dup 1)
2493                 (const_int 2147483647)))]
2494   "")
2496 (define_insn "*llgt_sidi"
2497   [(set (match_operand:DI 0 "register_operand" "=d")
2498         (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2499                 (const_int 2147483647)))]
2500   "TARGET_64BIT"
2501   "llgt\t%0,%1"
2502   [(set_attr "op_type"  "RXE")])
2504 (define_insn_and_split "*llgt_sidi_split"
2505   [(set (match_operand:DI 0 "register_operand" "=d")
2506         (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2507                 (const_int 2147483647)))
2508    (clobber (reg:CC 33))]
2509   "TARGET_64BIT"
2510   "#"
2511   "&& reload_completed"
2512   [(set (match_dup 0)
2513         (and:DI (subreg:DI (match_dup 1) 0)
2514                 (const_int 2147483647)))]
2515   "")
2518 ; zero_extendqidi2 instruction pattern(s)
2521 (define_expand "zero_extendqidi2"
2522   [(set (match_operand:DI 0 "register_operand" "")
2523         (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2524   ""
2525   "
2527   if (!TARGET_64BIT)
2528     {
2529       rtx tmp = gen_reg_rtx (SImode);
2530       emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2531       emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2532       DONE;
2533     }
2534   else
2535     {
2536       operands[1] = gen_lowpart (DImode, operands[1]);
2537       emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2538       emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2539       DONE;
2540     }
2544 (define_insn "*zero_extendqidi2"
2545   [(set (match_operand:DI 0 "register_operand" "=d")
2546         (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2547   "TARGET_64BIT"
2548   "llgc\t%0,%1"
2549   [(set_attr "op_type" "RXY")])
2552 ; zero_extendhisi2 instruction pattern(s).
2555 (define_expand "zero_extendhisi2"
2556   [(set (match_operand:SI 0 "register_operand" "")
2557         (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2558   ""
2559   "
2561   operands[1] = gen_lowpart (SImode, operands[1]);
2562   emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2563   DONE;
2567 (define_insn "*zero_extendhisi2_64"
2568   [(set (match_operand:SI 0 "register_operand" "=d")
2569         (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2570   "TARGET_64BIT"
2571   "llgh\t%0,%1"
2572   [(set_attr "op_type" "RXY")])
2574 (define_insn_and_split "*zero_extendhisi2_31"
2575   [(set (match_operand:SI 0 "register_operand" "=&d")
2576         (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2577    (clobber (reg:CC 33))]
2578   "!TARGET_64BIT"
2579   "#"
2580   "&& reload_completed"
2581   [(set (match_dup 0) (const_int 0))
2582    (parallel
2583     [(set (strict_low_part (match_dup 2)) (match_dup 1))
2584      (clobber (reg:CC 33))])]
2585   "operands[2] = gen_lowpart (HImode, operands[0]);"
2586   [(set_attr "atype" "agen")])
2589 ; zero_extendqisi2 instruction pattern(s).
2592 (define_expand "zero_extendqisi2"
2593   [(set (match_operand:SI 0 "register_operand" "")
2594         (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2595   ""
2596   "
2598   operands[1] = gen_lowpart (SImode, operands[1]);
2599   emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2600   DONE;
2604 (define_insn "*zero_extendqisi2_64"
2605   [(set (match_operand:SI 0 "register_operand" "=d")
2606         (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2607   "TARGET_ZARCH"
2608   "llgc\t%0,%1"
2609   [(set_attr "op_type" "RXY")])
2611 (define_insn_and_split "*zero_extendqisi2_31"
2612   [(set (match_operand:SI 0 "register_operand" "=&d")
2613         (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2614   "!TARGET_ZARCH"
2615   "#"
2616   "&& reload_completed"
2617   [(set (match_dup 0) (const_int 0))
2618    (set (strict_low_part (match_dup 2)) (match_dup 1))]
2619   "operands[2] = gen_lowpart (QImode, operands[0]);"
2620   [(set_attr "atype" "agen")])
2623 ; zero_extendqihi2 instruction pattern(s).
2626 (define_expand "zero_extendqihi2"
2627   [(set (match_operand:HI 0 "register_operand" "")
2628         (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2629   "TARGET_ZARCH"
2630   "
2632   operands[1] = gen_lowpart (HImode, operands[1]);
2633   emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2634   DONE;
2638 (define_insn "*zero_extendqihi2_64"
2639   [(set (match_operand:HI 0 "register_operand" "=d")
2640         (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2641   "TARGET_ZARCH"
2642   "llgc\t%0,%1"
2643   [(set_attr "op_type" "RXY")])
2645 (define_insn_and_split "*zero_extendqihi2_31"
2646   [(set (match_operand:HI 0 "register_operand" "=&d")
2647         (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2648   "!TARGET_ZARCH"
2649   "#"
2650   "&& reload_completed"
2651   [(set (match_dup 0) (const_int 0))
2652    (set (strict_low_part (match_dup 2)) (match_dup 1))]
2653   "operands[2] = gen_lowpart (QImode, operands[0]);"
2654   [(set_attr "atype" "agen")])
2658 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2661 (define_expand "fixuns_truncdfdi2"
2662   [(set (match_operand:DI 0 "register_operand" "")
2663         (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2664   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2666   rtx label1 = gen_label_rtx ();
2667   rtx label2 = gen_label_rtx ();
2668   rtx temp = gen_reg_rtx (DFmode);
2669   operands[1] = force_reg (DFmode, operands[1]);
2671   emit_insn (gen_cmpdf (operands[1],
2672         CONST_DOUBLE_FROM_REAL_VALUE (
2673           REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2674   emit_jump_insn (gen_blt (label1));
2675   emit_insn (gen_subdf3 (temp, operands[1],
2676         CONST_DOUBLE_FROM_REAL_VALUE (
2677           REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2678   emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2679   emit_jump (label2);
2681   emit_label (label1);
2682   emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2683   emit_label (label2);
2684   DONE;
2687 (define_expand "fix_truncdfdi2"
2688   [(set (match_operand:DI 0 "register_operand" "")
2689         (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2690   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2692   operands[1] = force_reg (DFmode, operands[1]);
2693   emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2694   DONE;
2697 (define_insn "fix_truncdfdi2_ieee"
2698   [(set (match_operand:DI 0 "register_operand" "=d")
2699         (fix:DI (match_operand:DF 1 "register_operand" "f")))
2700    (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2701    (clobber (reg:CC 33))]
2702   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2703   "cgdbr\t%0,%h2,%1"
2704   [(set_attr "op_type" "RRE")
2705    (set_attr "type"    "ftoi")])
2708 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2711 (define_expand "fixuns_truncdfsi2"
2712   [(set (match_operand:SI 0 "register_operand" "")
2713         (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2714   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2716   rtx label1 = gen_label_rtx ();
2717   rtx label2 = gen_label_rtx ();
2718   rtx temp = gen_reg_rtx (DFmode);
2720   operands[1] = force_reg (DFmode,operands[1]);
2721   emit_insn (gen_cmpdf (operands[1],
2722         CONST_DOUBLE_FROM_REAL_VALUE (
2723           REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2724   emit_jump_insn (gen_blt (label1));
2725   emit_insn (gen_subdf3 (temp, operands[1],
2726         CONST_DOUBLE_FROM_REAL_VALUE (
2727           REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2728   emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2729   emit_jump (label2);
2731   emit_label (label1);
2732   emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2733   emit_label (label2);
2734   DONE;
2737 (define_expand "fix_truncdfsi2"
2738   [(set (match_operand:SI 0 "register_operand" "")
2739         (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2740   "TARGET_HARD_FLOAT"
2742   if (TARGET_IBM_FLOAT)
2743     {
2744       /* This is the algorithm from POP chapter A.5.7.2.  */
2746       rtx temp   = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2747       rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2748       rtx two32  = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2750       operands[1] = force_reg (DFmode, operands[1]);
2751       emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2752                                          two31r, two32, temp));
2753     }
2754   else
2755     {
2756       operands[1] = force_reg (DFmode, operands[1]);
2757       emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2758     }
2760   DONE;
2763 (define_insn "fix_truncdfsi2_ieee"
2764   [(set (match_operand:SI 0 "register_operand" "=d")
2765         (fix:SI (match_operand:DF 1 "register_operand" "f")))
2766     (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2767     (clobber (reg:CC 33))]
2768   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2769   "cfdbr\t%0,%h2,%1"
2770    [(set_attr "op_type" "RRE")
2771     (set_attr "type"    "other" )])
2773 (define_insn "fix_truncdfsi2_ibm"
2774   [(set (match_operand:SI 0 "register_operand" "=d")
2775         (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2776    (use (match_operand:DI 2 "immediate_operand" "m"))
2777    (use (match_operand:DI 3 "immediate_operand" "m"))
2778    (use (match_operand:BLK 4 "memory_operand" "m"))
2779    (clobber (reg:CC 33))]
2780   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2782    output_asm_insn ("sd\t%1,%2", operands);
2783    output_asm_insn ("aw\t%1,%3", operands);
2784    output_asm_insn ("std\t%1,%4", operands);
2785    output_asm_insn ("xi\t%N4,128", operands);
2786    return "l\t%0,%N4";
2788   [(set_attr "op_type" "NN")
2789    (set_attr "type"    "ftoi")
2790    (set_attr "atype"   "agen")
2791    (set_attr "length"  "20")])
2794 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
2797 (define_expand "fixuns_truncsfdi2"
2798   [(set (match_operand:DI 0 "register_operand" "")
2799         (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2800   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2802   rtx label1 = gen_label_rtx ();
2803   rtx label2 = gen_label_rtx ();
2804   rtx temp = gen_reg_rtx (SFmode);
2806   operands[1] = force_reg (SFmode, operands[1]);
2807   emit_insn (gen_cmpsf (operands[1],
2808         CONST_DOUBLE_FROM_REAL_VALUE (
2809           REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
2810   emit_jump_insn (gen_blt (label1));
2812   emit_insn (gen_subsf3 (temp, operands[1],
2813         CONST_DOUBLE_FROM_REAL_VALUE (
2814           REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
2815   emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
2816   emit_jump (label2);
2818   emit_label (label1);
2819   emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2820   emit_label (label2);
2821   DONE;
2824 (define_expand "fix_truncsfdi2"
2825   [(set (match_operand:DI 0 "register_operand" "")
2826         (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
2827   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2829   operands[1] = force_reg (SFmode, operands[1]);
2830   emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2831   DONE;
2834 (define_insn "fix_truncsfdi2_ieee"
2835   [(set (match_operand:DI 0 "register_operand" "=d")
2836         (fix:DI (match_operand:SF 1 "register_operand"  "f")))
2837    (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2838    (clobber (reg:CC 33))]
2839   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2840   "cgebr\t%0,%h2,%1"
2841   [(set_attr "op_type" "RRE")
2842    (set_attr "type"    "ftoi")])
2845 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
2848 (define_expand "fixuns_truncsfsi2"
2849   [(set (match_operand:SI 0 "register_operand" "")
2850         (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
2851   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2853   rtx label1 = gen_label_rtx ();
2854   rtx label2 = gen_label_rtx ();
2855   rtx temp = gen_reg_rtx (SFmode);
2857   operands[1] = force_reg (SFmode, operands[1]);
2858   emit_insn (gen_cmpsf (operands[1],
2859         CONST_DOUBLE_FROM_REAL_VALUE (
2860           REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
2861   emit_jump_insn (gen_blt (label1));
2862   emit_insn (gen_subsf3 (temp, operands[1],
2863         CONST_DOUBLE_FROM_REAL_VALUE (
2864           REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
2865   emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
2866   emit_jump (label2);
2868   emit_label (label1);
2869   emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2870   emit_label (label2);
2871   DONE;
2874 (define_expand "fix_truncsfsi2"
2875   [(set (match_operand:SI 0 "register_operand" "")
2876         (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
2877   "TARGET_HARD_FLOAT"
2879   if (TARGET_IBM_FLOAT)
2880     {
2881       /* Convert to DFmode and then use the POP algorithm.  */
2882       rtx temp = gen_reg_rtx (DFmode);
2883       emit_insn (gen_extendsfdf2 (temp, operands[1]));
2884       emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
2885     }
2886   else
2887     {
2888       operands[1] = force_reg (SFmode, operands[1]);
2889       emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2890     }
2892   DONE;
2895 (define_insn "fix_truncsfsi2_ieee"
2896   [(set (match_operand:SI 0 "register_operand" "=d")
2897         (fix:SI (match_operand:SF 1 "register_operand" "f")))
2898     (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2899     (clobber (reg:CC 33))]
2900   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2901   "cfebr\t%0,%h2,%1"
2902   [(set_attr "op_type" "RRE")
2903    (set_attr "type"    "ftoi")])
2906 ; floatdidf2 instruction pattern(s).
2909 (define_insn "floatdidf2"
2910   [(set (match_operand:DF 0 "register_operand" "=f")
2911         (float:DF (match_operand:DI 1 "register_operand" "d")))
2912    (clobber (reg:CC 33))]
2913   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2914   "cdgbr\t%0,%1"
2915   [(set_attr "op_type" "RRE")
2916    (set_attr "type"    "itof" )])
2919 ; floatdisf2 instruction pattern(s).
2922 (define_insn "floatdisf2"
2923   [(set (match_operand:SF 0 "register_operand" "=f")
2924         (float:SF (match_operand:DI 1 "register_operand" "d")))
2925    (clobber (reg:CC 33))]
2926   "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2927   "cegbr\t%0,%1"
2928   [(set_attr "op_type" "RRE")
2929    (set_attr "type"    "itof" )])
2932 ; floatsidf2 instruction pattern(s).
2935 (define_expand "floatsidf2"
2936   [(parallel
2937     [(set (match_operand:DF 0 "register_operand" "")
2938           (float:DF (match_operand:SI 1 "register_operand" "")))
2939      (clobber (reg:CC 33))])]
2940   "TARGET_HARD_FLOAT"
2942   if (TARGET_IBM_FLOAT)
2943     {
2944       /* This is the algorithm from POP chapter A.5.7.1.  */
2946       rtx temp  = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2947       rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
2949       emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
2950       DONE;
2951     }
2954 (define_insn "floatsidf2_ieee"
2955   [(set (match_operand:DF 0 "register_operand" "=f")
2956         (float:DF (match_operand:SI 1 "register_operand"  "d")))
2957    (clobber (reg:CC 33))]
2958   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2959   "cdfbr\t%0,%1"
2960   [(set_attr "op_type" "RRE")
2961    (set_attr "type"   "itof" )])
2963 (define_insn "floatsidf2_ibm"
2964   [(set (match_operand:DF 0 "register_operand" "=f")
2965         (float:DF (match_operand:SI 1 "register_operand" "d")))
2966    (use (match_operand:DI 2 "immediate_operand" "m"))
2967    (use (match_operand:BLK 3 "memory_operand" "m"))
2968    (clobber (reg:CC 33))]
2969   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2971    output_asm_insn ("st\t%1,%N3", operands);
2972    output_asm_insn ("xi\t%N3,128", operands);
2973    output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
2974    output_asm_insn ("ld\t%0,%3", operands);
2975    return "sd\t%0,%2";
2977   [(set_attr "op_type" "NN")
2978    (set_attr "type"    "other" )
2979    (set_attr "atype"   "agen")
2980    (set_attr "length"  "20")])
2983 ; floatsisf2 instruction pattern(s).
2986 (define_expand "floatsisf2"
2987   [(parallel
2988     [(set (match_operand:SF 0 "register_operand" "")
2989           (float:SF (match_operand:SI 1 "register_operand" "")))
2990      (clobber (reg:CC 33))])]
2991   "TARGET_HARD_FLOAT"
2993   if (TARGET_IBM_FLOAT)
2994     {
2995       /* Use the POP algorithm to convert to DFmode and then truncate.  */
2996       rtx temp = gen_reg_rtx (DFmode);
2997       emit_insn (gen_floatsidf2 (temp, operands[1]));
2998       emit_insn (gen_truncdfsf2 (operands[0], temp));
2999       DONE;
3000     }
3003 (define_insn "floatsisf2_ieee"
3004   [(set (match_operand:SF 0 "register_operand" "=f")
3005         (float:SF (match_operand:SI 1 "register_operand" "d")))
3006    (clobber (reg:CC 33))]
3007   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3008   "cefbr\t%0,%1"
3009   [(set_attr "op_type" "RRE")
3010    (set_attr "type"    "itof" )])
3013 ; truncdfsf2 instruction pattern(s).
3016 (define_expand "truncdfsf2"
3017   [(set (match_operand:SF 0 "register_operand" "")
3018         (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3019   "TARGET_HARD_FLOAT"
3020   "")
3022 (define_insn "truncdfsf2_ieee"
3023   [(set (match_operand:SF 0 "register_operand" "=f")
3024         (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3025   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3026   "ledbr\t%0,%1"
3027   [(set_attr "op_type"  "RRE")])
3029 (define_insn "truncdfsf2_ibm"
3030   [(set (match_operand:SF 0 "register_operand" "=f,f")
3031         (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3032   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3033   "@
3034    lrer\t%0,%1
3035    le\t%0,%1"
3036   [(set_attr "op_type"  "RR,RX")
3037    (set_attr "type"   "floads,floads")])
3040 ; extendsfdf2 instruction pattern(s).
3043 (define_expand "extendsfdf2"
3044   [(set (match_operand:DF 0 "register_operand" "")
3045         (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3046   "TARGET_HARD_FLOAT"
3048   if (TARGET_IBM_FLOAT)
3049     {
3050       emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3051       DONE;
3052     }
3055 (define_insn "extendsfdf2_ieee"
3056   [(set (match_operand:DF 0 "register_operand" "=f,f")
3057         (float_extend:DF (match_operand:SF 1 "nonimmediate_operand"  "f,R")))]
3058   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3059   "@
3060    ldebr\t%0,%1
3061    ldeb\t%0,%1"
3062   [(set_attr "op_type"  "RRE,RXE")
3063    (set_attr "type"   "floads,floads")])
3065 (define_insn "extendsfdf2_ibm"
3066   [(set (match_operand:DF 0 "register_operand" "=f,f")
3067         (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3068    (clobber (reg:CC 33))]
3069   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3070   "@
3071    sdr\t%0,%0\;ler\t%0,%1
3072    sdr\t%0,%0\;le\t%0,%1"
3073   [(set_attr "op_type"  "NN,NN")
3074    (set_attr "atype"    "reg,agen")
3075    (set_attr "length"   "4,6")
3076    (set_attr "type"     "o2,o2")])
3080 ;; ARITHMETIC OPERATIONS
3082 ;  arithmetic operations set the ConditionCode,
3083 ;  because of unpredictable Bits in Register for Halfword and Byte
3084 ;  the ConditionCode can be set wrong in operations for Halfword and Byte
3087 ;;- Add instructions.
3091 ; addti3 instruction pattern(s).
3094 (define_insn_and_split "addti3"
3095   [(set (match_operand:TI 0 "register_operand" "=&d")
3096         (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
3097                  (match_operand:TI 2 "general_operand" "do") ) )
3098    (clobber (reg:CC 33))]
3099   "TARGET_64BIT"
3100   "#"
3101   "&& reload_completed"
3102   [(parallel
3103     [(set (reg:CCL1 33)
3104           (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
3105                         (match_dup 7)))
3106      (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
3107    (parallel
3108     [(set (match_dup 3) (plus:DI (plus:DI (match_dup 4) (match_dup 5))
3109                                  (ltu:DI (reg:CCL1 33) (const_int 0))))
3110      (clobber (reg:CC 33))])]
3111   "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3112    operands[4] = operand_subword (operands[1], 0, 0, TImode);
3113    operands[5] = operand_subword (operands[2], 0, 0, TImode);
3114    operands[6] = operand_subword (operands[0], 1, 0, TImode);
3115    operands[7] = operand_subword (operands[1], 1, 0, TImode);
3116    operands[8] = operand_subword (operands[2], 1, 0, TImode);"
3117   [(set_attr "op_type"  "NN")])
3120 ; adddi3 instruction pattern(s).
3123 (define_insn "*adddi3_sign"
3124   [(set (match_operand:DI 0 "register_operand" "=d,d")
3125         (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3126                  (match_operand:DI 1 "register_operand" "0,0")))
3127    (clobber (reg:CC 33))]
3128   "TARGET_64BIT"
3129   "@
3130    agfr\t%0,%2
3131    agf\t%0,%2"
3132   [(set_attr "op_type"  "RRE,RXY")])
3134 (define_insn "*adddi3_zero_cc"
3135   [(set (reg 33)
3136         (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3137                           (match_operand:DI 1 "register_operand" "0,0"))
3138                  (const_int 0)))
3139    (set (match_operand:DI 0 "register_operand" "=d,d")
3140         (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3141   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3142   "@
3143    algfr\t%0,%2
3144    algf\t%0,%2"
3145   [(set_attr "op_type"  "RRE,RXY")])
3147 (define_insn "*adddi3_zero_cconly"
3148   [(set (reg 33)
3149         (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3150                           (match_operand:DI 1 "register_operand" "0,0"))
3151                  (const_int 0)))
3152    (clobber (match_scratch:DI 0 "=d,d"))]
3153   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3154   "@
3155    algfr\t%0,%2
3156    algf\t%0,%2"
3157   [(set_attr "op_type"  "RRE,RXY")])
3159 (define_insn "*adddi3_zero"
3160   [(set (match_operand:DI 0 "register_operand" "=d,d")
3161         (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3162                  (match_operand:DI 1 "register_operand" "0,0")))
3163    (clobber (reg:CC 33))]
3164   "TARGET_64BIT"
3165   "@
3166    algfr\t%0,%2
3167    algf\t%0,%2"
3168   [(set_attr "op_type"  "RRE,RXY")])
3170 (define_insn "*adddi3_imm_cc"
3171   [(set (reg 33)
3172         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3173                           (match_operand:DI 2 "const_int_operand" "K"))
3174                  (const_int 0)))
3175    (set (match_operand:DI 0 "register_operand" "=d")
3176         (plus:DI (match_dup 1) (match_dup 2)))]
3177   "TARGET_64BIT
3178    && s390_match_ccmode (insn, CCAmode)
3179    && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3180   "aghi\t%0,%h2"
3181   [(set_attr "op_type"  "RI")])
3183 (define_insn "*adddi3_carry1_cc"
3184   [(set (reg 33)
3185         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3186                           (match_operand:DI 2 "general_operand" "d,m"))
3187                  (match_dup 1)))
3188    (set (match_operand:DI 0 "register_operand" "=d,d")
3189         (plus:DI (match_dup 1) (match_dup 2)))]
3190   "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3191   "@
3192    algr\t%0,%2
3193    alg\t%0,%2"
3194   [(set_attr "op_type"  "RRE,RXY")])
3196 (define_insn "*adddi3_carry1_cconly"
3197   [(set (reg 33)
3198         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3199                           (match_operand:DI 2 "general_operand" "d,m"))
3200                  (match_dup 1)))
3201    (clobber (match_scratch:DI 0 "=d,d"))]
3202   "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3203   "@
3204    algr\t%0,%2
3205    alg\t%0,%2"
3206   [(set_attr "op_type"  "RRE,RXY")])
3208 (define_insn "*adddi3_carry2_cc"
3209   [(set (reg 33)
3210         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3211                           (match_operand:DI 2 "general_operand" "d,m"))
3212                  (match_dup 2)))
3213    (set (match_operand:DI 0 "register_operand" "=d,d")
3214         (plus:DI (match_dup 1) (match_dup 2)))]
3215   "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3216   "@
3217    algr\t%0,%2
3218    alg\t%0,%2"
3219   [(set_attr "op_type"  "RRE,RXY")])
3221 (define_insn "*adddi3_carry2_cconly"
3222   [(set (reg 33)
3223         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3224                           (match_operand:DI 2 "general_operand" "d,m"))
3225                  (match_dup 2)))
3226    (clobber (match_scratch:DI 0 "=d,d"))]
3227   "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3228   "@
3229    algr\t%0,%2
3230    alg\t%0,%2"
3231   [(set_attr "op_type"  "RRE,RXY")])
3233 (define_insn "*adddi3_cc"
3234   [(set (reg 33)
3235         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3236                           (match_operand:DI 2 "general_operand" "d,m"))
3237                  (const_int 0)))
3238    (set (match_operand:DI 0 "register_operand" "=d,d")
3239         (plus:DI (match_dup 1) (match_dup 2)))]
3240   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3241   "@
3242    algr\t%0,%2
3243    alg\t%0,%2"
3244   [(set_attr "op_type"  "RRE,RXY")])
3246 (define_insn "*adddi3_cconly"
3247   [(set (reg 33)
3248         (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3249                           (match_operand:DI 2 "general_operand" "d,m"))
3250                  (const_int 0)))
3251    (clobber (match_scratch:DI 0 "=d,d"))]
3252   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3253   "@
3254    algr\t%0,%2
3255    alg\t%0,%2"
3256   [(set_attr "op_type"  "RRE,RXY")])
3258 (define_insn "*adddi3_cconly2"
3259   [(set (reg 33)
3260         (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3261                  (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3262    (clobber (match_scratch:DI 0 "=d,d"))]
3263   "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3264   "@
3265    algr\t%0,%2
3266    alg\t%0,%2"
3267   [(set_attr "op_type"  "RRE,RXY")])
3269 (define_insn "*adddi3_64"
3270   [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3271         (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3272                  (match_operand:DI 2 "general_operand" "d,K,m") ) )
3273    (clobber (reg:CC 33))]
3274   "TARGET_64BIT"
3275   "@
3276    agr\t%0,%2
3277    aghi\t%0,%h2
3278    ag\t%0,%2"
3279   [(set_attr "op_type"  "RRE,RI,RXY")])
3281 (define_insn_and_split "*adddi3_31z"
3282   [(set (match_operand:DI 0 "register_operand" "=&d")
3283         (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3284                  (match_operand:DI 2 "general_operand" "do") ) )
3285    (clobber (reg:CC 33))]
3286   "!TARGET_64BIT && TARGET_CPU_ZARCH"
3287   "#"
3288   "&& reload_completed"
3289   [(parallel
3290     [(set (reg:CCL1 33)
3291           (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3292                         (match_dup 7)))
3293      (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3294    (parallel
3295     [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3296                                  (ltu:SI (reg:CCL1 33) (const_int 0))))
3297      (clobber (reg:CC 33))])]
3298   "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3299    operands[4] = operand_subword (operands[1], 0, 0, DImode);
3300    operands[5] = operand_subword (operands[2], 0, 0, DImode);
3301    operands[6] = operand_subword (operands[0], 1, 0, DImode);
3302    operands[7] = operand_subword (operands[1], 1, 0, DImode);
3303    operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3304   [(set_attr "op_type"  "NN")])
3306 (define_insn_and_split "*adddi3_31"
3307   [(set (match_operand:DI 0 "register_operand" "=&d")
3308         (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3309                  (match_operand:DI 2 "general_operand" "do") ) )
3310    (clobber (reg:CC 33))]
3311   "!TARGET_CPU_ZARCH"
3312   "#"
3313   "&& reload_completed"
3314   [(parallel
3315     [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3316      (clobber (reg:CC 33))])
3317    (parallel
3318     [(set (reg:CCL1 33)
3319           (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3320                         (match_dup 7)))
3321      (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3322    (set (pc)
3323         (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3324                       (pc)
3325                       (label_ref (match_dup 9))))
3326    (parallel
3327     [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3328      (clobber (reg:CC 33))])
3329    (match_dup 9)]
3330   "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3331    operands[4] = operand_subword (operands[1], 0, 0, DImode);
3332    operands[5] = operand_subword (operands[2], 0, 0, DImode);
3333    operands[6] = operand_subword (operands[0], 1, 0, DImode);
3334    operands[7] = operand_subword (operands[1], 1, 0, DImode);
3335    operands[8] = operand_subword (operands[2], 1, 0, DImode);
3336    operands[9] = gen_label_rtx ();"
3337   [(set_attr "op_type"  "NN")])
3339 (define_expand "adddi3"
3340   [(parallel
3341     [(set (match_operand:DI 0 "register_operand" "")
3342           (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3343                    (match_operand:DI 2 "general_operand" "")))
3344      (clobber (reg:CC 33))])]
3345   ""
3346   "")
3349 ; addsi3 instruction pattern(s).
3352 (define_insn "*addsi3_imm_cc"
3353   [(set (reg 33)
3354         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3355                           (match_operand:SI 2 "const_int_operand" "K"))
3356                  (const_int 0)))
3357    (set (match_operand:SI 0 "register_operand" "=d")
3358         (plus:SI (match_dup 1) (match_dup 2)))]
3359   "s390_match_ccmode (insn, CCAmode)
3360    && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3361   "ahi\t%0,%h2"
3362   [(set_attr "op_type"  "RI")])
3364 (define_insn "*addsi3_carry1_cc"
3365   [(set (reg 33)
3366         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3367                           (match_operand:SI 2 "general_operand" "d,R,T"))
3368                  (match_dup 1)))
3369    (set (match_operand:SI 0 "register_operand" "=d,d,d")
3370         (plus:SI (match_dup 1) (match_dup 2)))]
3371   "s390_match_ccmode (insn, CCL1mode)"
3372   "@
3373    alr\t%0,%2
3374    al\t%0,%2
3375    aly\t%0,%2"
3376   [(set_attr "op_type"  "RR,RX,RXY")])
3378 (define_insn "*addsi3_carry1_cconly"
3379   [(set (reg 33)
3380         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3381                           (match_operand:SI 2 "general_operand" "d,R,T"))
3382                  (match_dup 1)))
3383    (clobber (match_scratch:SI 0 "=d,d,d"))]
3384   "s390_match_ccmode (insn, CCL1mode)"
3385   "@
3386    alr\t%0,%2
3387    al\t%0,%2
3388    aly\t%0,%2"
3389   [(set_attr "op_type"  "RR,RX,RXY")])
3391 (define_insn "*addsi3_carry2_cc"
3392   [(set (reg 33)
3393         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3394                           (match_operand:SI 2 "general_operand" "d,R,T"))
3395                  (match_dup 2)))
3396    (set (match_operand:SI 0 "register_operand" "=d,d,d")
3397         (plus:SI (match_dup 1) (match_dup 2)))]
3398   "s390_match_ccmode (insn, CCL1mode)"
3399   "@
3400    alr\t%0,%2
3401    al\t%0,%2
3402    aly\t%0,%2"
3403   [(set_attr "op_type"  "RR,RX,RXY")])
3405 (define_insn "*addsi3_carry2_cconly"
3406   [(set (reg 33)
3407         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3408                           (match_operand:SI 2 "general_operand" "d,R,T"))
3409                  (match_dup 2)))
3410    (clobber (match_scratch:SI 0 "=d,d,d"))]
3411   "s390_match_ccmode (insn, CCL1mode)"
3412   "@
3413    alr\t%0,%2
3414    al\t%0,%2
3415    aly\t%0,%2"
3416   [(set_attr "op_type"  "RR,RX,RXY")])
3418 (define_insn "*addsi3_cc"
3419   [(set (reg 33)
3420         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3421                           (match_operand:SI 2 "general_operand" "d,R,T"))
3422                  (const_int 0)))
3423    (set (match_operand:SI 0 "register_operand" "=d,d,d")
3424         (plus:SI (match_dup 1) (match_dup 2)))]
3425   "s390_match_ccmode (insn, CCLmode)"
3426   "@
3427    alr\t%0,%2
3428    al\t%0,%2
3429    aly\t%0,%2"
3430   [(set_attr "op_type"  "RR,RX,RXY")])
3432 (define_insn "*addsi3_cconly"
3433   [(set (reg 33)
3434         (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3435                           (match_operand:SI 2 "general_operand" "d,R,T"))
3436                  (const_int 0)))
3437    (clobber (match_scratch:SI 0 "=d,d,d"))]
3438   "s390_match_ccmode (insn, CCLmode)"
3439   "@
3440    alr\t%0,%2
3441    al\t%0,%2
3442    aly\t%0,%2"
3443   [(set_attr "op_type"  "RR,RX,RXY")])
3445 (define_insn "*addsi3_cconly2"
3446   [(set (reg 33)
3447         (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3448                  (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3449    (clobber (match_scratch:SI 0 "=d,d,d"))]
3450   "s390_match_ccmode (insn, CCLmode)"
3451   "@
3452    alr\t%0,%2
3453    al\t%0,%2
3454    aly\t%0,%2"
3455   [(set_attr "op_type"  "RR,RX,RXY")])
3457 (define_insn "*addsi3_sign"
3458   [(set (match_operand:SI 0 "register_operand" "=d,d")
3459         (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3460                  (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3461    (clobber (reg:CC 33))]
3462   ""
3463   "@
3464    ah\t%0,%2
3465    ahy\t%0,%2"
3466   [(set_attr "op_type"  "RX,RXY")])
3468 (define_insn "addsi3"
3469   [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3470         (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3471                  (match_operand:SI 2 "general_operand" "d,K,R,T")))
3472    (clobber (reg:CC 33))]
3473   ""
3474   "@
3475    ar\t%0,%2
3476    ahi\t%0,%h2
3477    a\t%0,%2
3478    ay\t%0,%2"
3479   [(set_attr "op_type"  "RR,RI,RX,RXY")])
3482 ; adddf3 instruction pattern(s).
3485 (define_expand "adddf3"
3486   [(parallel
3487     [(set (match_operand:DF 0 "register_operand" "=f,f")
3488           (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3489                    (match_operand:DF 2 "general_operand" "f,R")))
3490      (clobber (reg:CC 33))])]
3491   "TARGET_HARD_FLOAT"
3492   "")
3494 (define_insn "*adddf3"
3495   [(set (match_operand:DF 0 "register_operand" "=f,f")
3496         (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3497                  (match_operand:DF 2 "general_operand" "f,R")))
3498    (clobber (reg:CC 33))]
3499   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3500   "@
3501    adbr\t%0,%2
3502    adb\t%0,%2"
3503   [(set_attr "op_type"  "RRE,RXE")
3504    (set_attr "type"     "fsimpd,fsimpd")])
3506 (define_insn "*adddf3_cc"
3507   [(set (reg 33)
3508         (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3509                           (match_operand:DF 2 "general_operand" "f,R"))
3510                  (match_operand:DF 3 "const0_operand" "")))
3511    (set (match_operand:DF 0 "register_operand" "=f,f")
3512         (plus:DF (match_dup 1) (match_dup 2)))]
3513   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3514   "@
3515    adbr\t%0,%2
3516    adb\t%0,%2"
3517   [(set_attr "op_type"  "RRE,RXE")
3518    (set_attr "type"     "fsimpd,fsimpd")])
3520 (define_insn "*adddf3_cconly"
3521   [(set (reg 33)
3522         (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3523                           (match_operand:DF 2 "general_operand" "f,R"))
3524                  (match_operand:DF 3 "const0_operand" "")))
3525    (clobber (match_scratch:DF 0 "=f,f"))]
3526   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3527   "@
3528   adbr\t%0,%2
3529   adb\t%0,%2"
3530   [(set_attr "op_type"  "RRE,RXE")
3531    (set_attr "type"     "fsimpd,fsimpd")])
3533 (define_insn "*adddf3_ibm"
3534   [(set (match_operand:DF 0 "register_operand" "=f,f")
3535         (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3536                  (match_operand:DF 2 "general_operand" "f,R")))
3537    (clobber (reg:CC 33))]
3538   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3539   "@
3540    adr\t%0,%2
3541    ad\t%0,%2"
3542   [(set_attr "op_type"  "RR,RX")
3543    (set_attr "type"     "fsimpd,fsimpd")])
3546 ; addsf3 instruction pattern(s).
3549 (define_expand "addsf3"
3550   [(parallel
3551     [(set (match_operand:SF 0 "register_operand" "=f,f")
3552           (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3553                    (match_operand:SF 2 "general_operand" "f,R")))
3554      (clobber (reg:CC 33))])]
3555   "TARGET_HARD_FLOAT"
3556   "")
3558 (define_insn "*addsf3"
3559   [(set (match_operand:SF 0 "register_operand" "=f,f")
3560         (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3561                  (match_operand:SF 2 "general_operand" "f,R")))
3562    (clobber (reg:CC 33))]
3563   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3564   "@
3565    aebr\t%0,%2
3566    aeb\t%0,%2"
3567   [(set_attr "op_type"  "RRE,RXE")
3568    (set_attr "type"     "fsimps,fsimps")])
3570 (define_insn "*addsf3_cc"
3571   [(set (reg 33)
3572         (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3573                           (match_operand:SF 2 "general_operand" "f,R"))
3574                  (match_operand:SF 3 "const0_operand" "")))
3575    (set (match_operand:SF 0 "register_operand" "=f,f")
3576         (plus:SF (match_dup 1) (match_dup 2)))]
3577   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3578   "@
3579    aebr\t%0,%2
3580    aeb\t%0,%2"
3581   [(set_attr "op_type"  "RRE,RXE")
3582    (set_attr "type"     "fsimps,fsimps")])
3584 (define_insn "*addsf3_cconly"
3585   [(set (reg 33)
3586         (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3587                           (match_operand:SF 2 "general_operand" "f,R"))
3588                  (match_operand:SF 3 "const0_operand" "")))
3589    (clobber (match_scratch:SF 0 "=f,f"))]
3590   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3591   "@
3592    aebr\t%0,%2
3593    aeb\t%0,%2"
3594   [(set_attr "op_type"  "RRE,RXE")
3595    (set_attr "type"     "fsimps,fsimps")])
3597 (define_insn "*addsf3"
3598   [(set (match_operand:SF 0 "register_operand" "=f,f")
3599         (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3600                  (match_operand:SF 2 "general_operand" "f,R")))
3601    (clobber (reg:CC 33))]
3602   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3603   "@
3604    aer\t%0,%2
3605    ae\t%0,%2"
3606   [(set_attr "op_type"  "RR,RX")
3607    (set_attr "type"     "fsimps,fsimps")])
3611 ;;- Subtract instructions.
3615 ; subti3 instruction pattern(s).
3618 (define_insn_and_split "subti3"
3619   [(set (match_operand:TI 0 "register_operand" "=&d")
3620         (minus:TI (match_operand:TI 1 "register_operand" "0")
3621                   (match_operand:TI 2 "general_operand" "do") ) )
3622    (clobber (reg:CC 33))]
3623   "TARGET_64BIT"
3624   "#"
3625   "&& reload_completed"
3626   [(parallel
3627     [(set (reg:CCL2 33)
3628           (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
3629                         (match_dup 7)))
3630      (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
3631    (parallel
3632     [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
3633                                   (gtu:DI (reg:CCL2 33) (const_int 0))))
3634      (clobber (reg:CC 33))])]
3635   "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3636    operands[4] = operand_subword (operands[1], 0, 0, TImode);
3637    operands[5] = operand_subword (operands[2], 0, 0, TImode);
3638    operands[6] = operand_subword (operands[0], 1, 0, TImode);
3639    operands[7] = operand_subword (operands[1], 1, 0, TImode);
3640    operands[8] = operand_subword (operands[2], 1, 0, TImode);"
3641   [(set_attr "op_type"  "NN")])
3644 ; subdi3 instruction pattern(s).
3647 (define_insn "*subdi3_sign"
3648   [(set (match_operand:DI 0 "register_operand" "=d,d")
3649         (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3650                   (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3651    (clobber (reg:CC 33))]
3652   "TARGET_64BIT"
3653   "@
3654    sgfr\t%0,%2
3655    sgf\t%0,%2"
3656   [(set_attr "op_type"  "RRE,RXY")])
3658 (define_insn "*subdi3_zero_cc"
3659   [(set (reg 33)
3660         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3661                            (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3662                  (const_int 0)))
3663    (set (match_operand:DI 0 "register_operand" "=d,d")
3664         (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3665   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3666   "@
3667    slgfr\t%0,%2
3668    slgf\t%0,%2"
3669   [(set_attr "op_type"  "RRE,RXY")])
3671 (define_insn "*subdi3_zero_cconly"
3672   [(set (reg 33)
3673         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3674                            (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3675                  (const_int 0)))
3676    (clobber (match_scratch:DI 0 "=d,d"))]
3677   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3678   "@
3679    slgfr\t%0,%2
3680    slgf\t%0,%2"
3681   [(set_attr "op_type"  "RRE,RXY")])
3683 (define_insn "*subdi3_zero"
3684   [(set (match_operand:DI 0 "register_operand" "=d,d")
3685         (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3686                   (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3687    (clobber (reg:CC 33))]
3688   "TARGET_64BIT"
3689   "@
3690    slgfr\t%0,%2
3691    slgf\t%0,%2"
3692   [(set_attr "op_type"  "RRE,RXY")])
3694 (define_insn "*subdi3_borrow_cc"
3695   [(set (reg 33)
3696         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3697                            (match_operand:DI 2 "general_operand" "d,m"))
3698                  (match_dup 1)))
3699    (set (match_operand:DI 0 "register_operand" "=d,d")
3700         (minus:DI (match_dup 1) (match_dup 2)))]
3701   "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3702   "@
3703    slgr\t%0,%2
3704    slg\t%0,%2"
3705   [(set_attr "op_type"  "RRE,RXY")])
3707 (define_insn "*subdi3_borrow_cconly"
3708   [(set (reg 33)
3709         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3710                            (match_operand:DI 2 "general_operand" "d,m"))
3711                  (match_dup 1)))
3712    (clobber (match_scratch:DI 0 "=d,d"))]
3713   "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3714   "@
3715    slgr\t%0,%2
3716    slg\t%0,%2"
3717   [(set_attr "op_type"  "RRE,RXY")])
3719 (define_insn "*subdi3_cc"
3720   [(set (reg 33)
3721         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3722                            (match_operand:DI 2 "general_operand" "d,m"))
3723                  (const_int 0)))
3724    (set (match_operand:DI 0 "register_operand" "=d,d")
3725         (minus:DI (match_dup 1) (match_dup 2)))]
3726   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3727   "@
3728    slgr\t%0,%2
3729    slg\t%0,%2"
3730   [(set_attr "op_type"  "RRE,RXY")])
3732 (define_insn "*subdi3_cc2"
3733   [(set (reg 33)
3734         (compare (match_operand:DI 1 "register_operand" "0,0")
3735                  (match_operand:DI 2 "general_operand" "d,m")))
3736    (set (match_operand:DI 0 "register_operand" "=d,d")
3737         (minus:DI (match_dup 1) (match_dup 2)))]
3738   "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3739   "@
3740    slgr\t%0,%2
3741    slg\t%0,%2"
3742   [(set_attr "op_type"  "RRE,RXY")])
3744 (define_insn "*subdi3_cconly"
3745   [(set (reg 33)
3746         (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3747                            (match_operand:DI 2 "general_operand" "d,m"))
3748                  (const_int 0)))
3749    (clobber (match_scratch:DI 0 "=d,d"))]
3750   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3751   "@
3752    slgr\t%0,%2
3753    slg\t%0,%2"
3754   [(set_attr "op_type"  "RRE,RXY")])
3756 (define_insn "*subdi3_cconly2"
3757   [(set (reg 33)
3758         (compare (match_operand:DI 1 "register_operand" "0,0")
3759                  (match_operand:DI 2 "general_operand" "d,m")))
3760    (clobber (match_scratch:DI 0 "=d,d"))]
3761   "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3762   "@
3763    slgr\t%0,%2
3764    slg\t%0,%2"
3765   [(set_attr "op_type"  "RRE,RXY")])
3767 (define_insn "*subdi3_64"
3768   [(set (match_operand:DI 0 "register_operand" "=d,d")
3769         (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3770                   (match_operand:DI 2 "general_operand" "d,m") ) )
3771    (clobber (reg:CC 33))]
3772   "TARGET_64BIT"
3773   "@
3774    sgr\t%0,%2
3775    sg\t%0,%2"
3776   [(set_attr "op_type"  "RRE,RRE")])
3778 (define_insn_and_split "*subdi3_31z"
3779   [(set (match_operand:DI 0 "register_operand" "=&d")
3780         (minus:DI (match_operand:DI 1 "register_operand" "0")
3781                   (match_operand:DI 2 "general_operand" "do") ) )
3782    (clobber (reg:CC 33))]
3783   "!TARGET_64BIT && TARGET_CPU_ZARCH"
3784   "#"
3785   "&& reload_completed"
3786   [(parallel
3787     [(set (reg:CCL2 33)
3788           (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3789                         (match_dup 7)))
3790      (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3791    (parallel
3792     [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3793                                   (gtu:SI (reg:CCL2 33) (const_int 0))))
3794      (clobber (reg:CC 33))])]
3795   "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3796    operands[4] = operand_subword (operands[1], 0, 0, DImode);
3797    operands[5] = operand_subword (operands[2], 0, 0, DImode);
3798    operands[6] = operand_subword (operands[0], 1, 0, DImode);
3799    operands[7] = operand_subword (operands[1], 1, 0, DImode);
3800    operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3801   [(set_attr "op_type"  "NN")])
3803 (define_insn_and_split "*subdi3_31"
3804   [(set (match_operand:DI 0 "register_operand" "=&d")
3805         (minus:DI (match_operand:DI 1 "register_operand" "0")
3806                   (match_operand:DI 2 "general_operand" "do") ) )
3807    (clobber (reg:CC 33))]
3808   "!TARGET_CPU_ZARCH"
3809   "#"
3810   "&& reload_completed"
3811   [(parallel
3812     [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3813      (clobber (reg:CC 33))])
3814    (parallel
3815     [(set (reg:CCL2 33)
3816           (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3817                         (match_dup 7)))
3818      (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3819    (set (pc)
3820         (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3821                       (pc)
3822                       (label_ref (match_dup 9))))
3823    (parallel
3824     [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3825      (clobber (reg:CC 33))])
3826    (match_dup 9)]
3827   "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3828    operands[4] = operand_subword (operands[1], 0, 0, DImode);
3829    operands[5] = operand_subword (operands[2], 0, 0, DImode);
3830    operands[6] = operand_subword (operands[0], 1, 0, DImode);
3831    operands[7] = operand_subword (operands[1], 1, 0, DImode);
3832    operands[8] = operand_subword (operands[2], 1, 0, DImode);
3833    operands[9] = gen_label_rtx ();"
3834   [(set_attr "op_type"  "NN")])
3836 (define_expand "subdi3"
3837   [(parallel
3838     [(set (match_operand:DI 0 "register_operand" "")
3839           (minus:DI (match_operand:DI 1 "register_operand" "")
3840                     (match_operand:DI 2 "general_operand" "")))
3841      (clobber (reg:CC 33))])]
3842   ""
3843   "")
3846 ; subsi3 instruction pattern(s).
3849 (define_insn "*subsi3_borrow_cc"
3850   [(set (reg 33)
3851         (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3852                            (match_operand:SI 2 "general_operand" "d,R,T"))
3853                  (match_dup 1)))
3854    (set (match_operand:SI 0 "register_operand" "=d,d,d")
3855         (minus:SI (match_dup 1) (match_dup 2)))]
3856   "s390_match_ccmode (insn, CCL2mode)"
3857   "@
3858    slr\t%0,%2
3859    sl\t%0,%2
3860    sly\t%0,%2"
3861   [(set_attr "op_type"  "RR,RX,RXY")])
3863 (define_insn "*subsi3_borrow_cconly"
3864   [(set (reg 33)
3865         (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3866                            (match_operand:SI 2 "general_operand" "d,R,T"))
3867                  (match_dup 1)))
3868    (clobber (match_scratch:SI 0 "=d,d,d"))]
3869   "s390_match_ccmode (insn, CCL2mode)"
3870   "@
3871    slr\t%0,%2
3872    sl\t%0,%2
3873    sly\t%0,%2"
3874   [(set_attr "op_type"  "RR,RX,RXY")])
3876 (define_insn "*subsi3_cc"
3877   [(set (reg 33)
3878         (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3879                            (match_operand:SI 2 "general_operand" "d,R,T"))
3880                  (const_int 0)))
3881    (set (match_operand:SI 0 "register_operand" "=d,d,d")
3882         (minus:SI (match_dup 1) (match_dup 2)))]
3883   "s390_match_ccmode (insn, CCLmode)"
3884   "@
3885    slr\t%0,%2
3886    sl\t%0,%2
3887    sly\t%0,%2"
3888   [(set_attr "op_type"  "RR,RX,RXY")])
3890 (define_insn "*subsi3_cc2"
3891   [(set (reg 33)
3892         (compare (match_operand:SI 1 "register_operand" "0,0,0")
3893                  (match_operand:SI 2 "general_operand" "d,R,T")))
3894    (set (match_operand:SI 0 "register_operand" "=d,d,d")
3895         (minus:SI (match_dup 1) (match_dup 2)))]
3896   "s390_match_ccmode (insn, CCL3mode)"
3897   "@
3898    slr\t%0,%2
3899    sl\t%0,%2
3900    sly\t%0,%2"
3901   [(set_attr "op_type"  "RR,RX,RXY")])
3903 (define_insn "*subsi3_cconly"
3904   [(set (reg 33)
3905         (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3906                            (match_operand:SI 2 "general_operand" "d,R,T"))
3907                  (const_int 0)))
3908    (clobber (match_scratch:SI 0 "=d,d,d"))]
3909   "s390_match_ccmode (insn, CCLmode)"
3910   "@
3911    slr\t%0,%2
3912    sl\t%0,%2
3913    sly\t%0,%2"
3914   [(set_attr "op_type"  "RR,RX,RXY")])
3916 (define_insn "*subsi3_cconly2"
3917   [(set (reg 33)
3918         (compare (match_operand:SI 1 "register_operand" "0,0,0")
3919                  (match_operand:SI 2 "general_operand" "d,R,T")))
3920    (clobber (match_scratch:SI 0 "=d,d,d"))]
3921   "s390_match_ccmode (insn, CCL3mode)"
3922   "@
3923    slr\t%0,%2
3924    sl\t%0,%2
3925    sly\t%0,%2"
3926   [(set_attr "op_type"  "RR,RX,RXY")])
3928 (define_insn "*subsi3_sign"
3929   [(set (match_operand:SI 0 "register_operand" "=d,d")
3930         (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3931                   (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3932    (clobber (reg:CC 33))]
3933   ""
3934   "@
3935    sh\t%0,%2
3936    shy\t%0,%2"
3937   [(set_attr "op_type"  "RX,RXY")])
3939 (define_insn "subsi3"
3940   [(set (match_operand:SI 0 "register_operand" "=d,d,d")
3941         (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3942                   (match_operand:SI 2 "general_operand" "d,R,T")))
3943    (clobber (reg:CC 33))]
3944   ""
3945   "@
3946    sr\t%0,%2
3947    s\t%0,%2
3948    sy\t%0,%2"
3949   [(set_attr "op_type"  "RR,RX,RXY")])
3953 ; subdf3 instruction pattern(s).
3956 (define_expand "subdf3"
3957   [(parallel
3958     [(set (match_operand:DF 0 "register_operand" "=f,f")
3959           (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3960                     (match_operand:DF 2 "general_operand" "f,R")))
3961      (clobber (reg:CC 33))])]
3962   "TARGET_HARD_FLOAT"
3963   "")
3965 (define_insn "*subdf3"
3966   [(set (match_operand:DF 0 "register_operand" "=f,f")
3967         (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3968                   (match_operand:DF 2 "general_operand" "f,R")))
3969    (clobber (reg:CC 33))]
3970   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3971   "@
3972    sdbr\t%0,%2
3973    sdb\t%0,%2"
3974   [(set_attr "op_type"  "RRE,RXE")
3975    (set_attr "type"     "fsimpd,fsimpd")])
3977 (define_insn "*subdf3_cc"
3978   [(set (reg 33)
3979         (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
3980                            (match_operand:DF 2 "general_operand" "f,R"))
3981                  (match_operand:DF 3 "const0_operand" "")))
3982    (set (match_operand:DF 0 "register_operand" "=f,f")
3983         (plus:DF (match_dup 1) (match_dup 2)))]
3984   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3985   "@
3986    sdbr\t%0,%2
3987    sdb\t%0,%2"
3988   [(set_attr "op_type"  "RRE,RXE")
3989    (set_attr "type"     "fsimpd,fsimpd")])
3991 (define_insn "*subdf3_cconly"
3992   [(set (reg 33)
3993         (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
3994                            (match_operand:DF 2 "general_operand" "f,R"))
3995                  (match_operand:DF 3 "const0_operand" "")))
3996    (clobber (match_scratch:DF 0 "=f,f"))]
3997   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3998   "@
3999    sdbr\t%0,%2
4000    sdb\t%0,%2"
4001   [(set_attr "op_type"  "RRE,RXE")
4002    (set_attr "type"     "fsimpd,fsimpd")])
4004 (define_insn "*subdf3_ibm"
4005   [(set (match_operand:DF 0 "register_operand" "=f,f")
4006         (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4007                   (match_operand:DF 2 "general_operand" "f,R")))
4008    (clobber (reg:CC 33))]
4009   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4010   "@
4011    sdr\t%0,%2
4012    sd\t%0,%2"
4013   [(set_attr "op_type"  "RR,RX")
4014    (set_attr "type"     "fsimpd,fsimpd")])
4017 ; subsf3 instruction pattern(s).
4020 (define_expand "subsf3"
4021   [(parallel
4022     [(set (match_operand:SF 0 "register_operand" "=f,f")
4023           (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4024                     (match_operand:SF 2 "general_operand" "f,R")))
4025      (clobber (reg:CC 33))])]
4026   "TARGET_HARD_FLOAT"
4027   "")
4029 (define_insn "*subsf3"
4030   [(set (match_operand:SF 0 "register_operand" "=f,f")
4031         (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4032                   (match_operand:SF 2 "general_operand" "f,R")))
4033    (clobber (reg:CC 33))]
4034   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4035   "@
4036    sebr\t%0,%2
4037    seb\t%0,%2"
4038   [(set_attr "op_type"  "RRE,RXE")
4039    (set_attr "type"     "fsimps,fsimps")])
4041 (define_insn "*subsf3_cc"
4042   [(set (reg 33)
4043         (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4044                            (match_operand:SF 2 "general_operand" "f,R"))
4045                  (match_operand:SF 3 "const0_operand" "")))
4046    (set (match_operand:SF 0 "register_operand" "=f,f")
4047         (minus:SF (match_dup 1) (match_dup 2)))]
4048   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4049   "@
4050    sebr\t%0,%2
4051    seb\t%0,%2"
4052   [(set_attr "op_type"  "RRE,RXE")
4053    (set_attr "type"     "fsimps,fsimps")])
4055 (define_insn "*subsf3_cconly"
4056   [(set (reg 33)
4057         (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4058                            (match_operand:SF 2 "general_operand" "f,R"))
4059                  (match_operand:SF 3 "const0_operand" "")))
4060    (clobber (match_scratch:SF 0 "=f,f"))]
4061   "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4062   "@
4063    sebr\t%0,%2
4064    seb\t%0,%2"
4065   [(set_attr "op_type"  "RRE,RXE")
4066    (set_attr "type"     "fsimps,fsimps")])
4068 (define_insn "*subsf3_ibm"
4069   [(set (match_operand:SF 0 "register_operand" "=f,f")
4070         (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4071                   (match_operand:SF 2 "general_operand" "f,R")))
4072    (clobber (reg:CC 33))]
4073   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4074   "@
4075    ser\t%0,%2
4076    se\t%0,%2"
4077   [(set_attr "op_type"  "RR,RX")
4078    (set_attr "type"     "fsimps,fsimps")])
4082 ;;- Conditional add/subtract instructions.
4086 ; adddicc instruction pattern(s).
4089 (define_insn "*adddi3_alc_cc"
4090   [(set (reg 33)
4091         (compare
4092           (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4093                             (match_operand:DI 2 "general_operand" "d,m"))
4094                    (match_operand:DI 3 "s390_alc_comparison" ""))
4095           (const_int 0)))
4096    (set (match_operand:DI 0 "register_operand" "=d,d")
4097         (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4098   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4099   "@
4100    alcgr\\t%0,%2
4101    alcg\\t%0,%2"
4102   [(set_attr "op_type"  "RRE,RXY")])
4104 (define_insn "*adddi3_alc"
4105   [(set (match_operand:DI 0 "register_operand" "=d,d")
4106         (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4107                           (match_operand:DI 2 "general_operand" "d,m"))
4108                  (match_operand:DI 3 "s390_alc_comparison" "")))
4109    (clobber (reg:CC 33))]
4110   "TARGET_64BIT"
4111   "@
4112    alcgr\\t%0,%2
4113    alcg\\t%0,%2"
4114   [(set_attr "op_type"  "RRE,RXY")])
4116 (define_insn "*subdi3_slb_cc"
4117   [(set (reg 33)
4118         (compare
4119           (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4120                               (match_operand:DI 2 "general_operand" "d,m"))
4121                     (match_operand:DI 3 "s390_slb_comparison" ""))
4122           (const_int 0)))
4123    (set (match_operand:DI 0 "register_operand" "=d,d")
4124         (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4125   "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4126   "@
4127    slbgr\\t%0,%2
4128    slbg\\t%0,%2"
4129   [(set_attr "op_type"  "RRE,RXY")])
4131 (define_insn "*subdi3_slb"
4132   [(set (match_operand:DI 0 "register_operand" "=d,d")
4133         (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4134                             (match_operand:DI 2 "general_operand" "d,m"))
4135                   (match_operand:DI 3 "s390_slb_comparison" "")))
4136    (clobber (reg:CC 33))]
4137   "TARGET_64BIT"
4138   "@
4139    slbgr\\t%0,%2
4140    slbg\\t%0,%2"
4141   [(set_attr "op_type"  "RRE,RXY")])
4143 (define_expand "adddicc"
4144   [(match_operand:DI 0 "register_operand" "")
4145    (match_operand 1 "comparison_operator" "")
4146    (match_operand:DI 2 "register_operand" "")
4147    (match_operand:DI 3 "const_int_operand" "")]
4148   "TARGET_64BIT"
4149   "if (!s390_expand_addcc (GET_CODE (operands[1]), 
4150                            s390_compare_op0, s390_compare_op1, 
4151                            operands[0], operands[2], 
4152                            operands[3])) FAIL; DONE;")
4155 ; addsicc instruction pattern(s).
4158 (define_insn "*addsi3_alc_cc"
4159   [(set (reg 33)
4160         (compare
4161           (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4162                             (match_operand:SI 2 "general_operand" "d,m"))
4163                    (match_operand:SI 3 "s390_alc_comparison" ""))
4164           (const_int 0)))
4165    (set (match_operand:SI 0 "register_operand" "=d,d")
4166         (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4167   "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4168   "@
4169    alcr\\t%0,%2
4170    alc\\t%0,%2"
4171   [(set_attr "op_type"  "RRE,RXY")])
4173 (define_insn "*addsi3_alc"
4174   [(set (match_operand:SI 0 "register_operand" "=d,d")
4175         (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4176                           (match_operand:SI 2 "general_operand" "d,m"))
4177                  (match_operand:SI 3 "s390_alc_comparison" "")))
4178    (clobber (reg:CC 33))]
4179   "TARGET_CPU_ZARCH"
4180   "@
4181    alcr\\t%0,%2
4182    alc\\t%0,%2"
4183   [(set_attr "op_type"  "RRE,RXY")])
4185 (define_insn "*subsi3_slb_cc"
4186   [(set (reg 33)
4187         (compare
4188           (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4189                               (match_operand:SI 2 "general_operand" "d,m"))
4190                     (match_operand:SI 3 "s390_slb_comparison" ""))
4191           (const_int 0)))
4192    (set (match_operand:SI 0 "register_operand" "=d,d")
4193         (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4194   "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4195   "@
4196    slbr\\t%0,%2
4197    slb\\t%0,%2"
4198   [(set_attr "op_type"  "RRE,RXY")])
4200 (define_insn "*subsi3_slb"
4201   [(set (match_operand:SI 0 "register_operand" "=d,d")
4202         (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4203                             (match_operand:SI 2 "general_operand" "d,m"))
4204                   (match_operand:SI 3 "s390_slb_comparison" "")))
4205    (clobber (reg:CC 33))]
4206   "TARGET_CPU_ZARCH"
4207   "@
4208    slbr\\t%0,%2
4209    slb\\t%0,%2"
4210   [(set_attr "op_type"  "RRE,RXY")])
4212 (define_expand "addsicc"
4213   [(match_operand:SI 0 "register_operand" "")
4214    (match_operand 1 "comparison_operator" "")
4215    (match_operand:SI 2 "register_operand" "")
4216    (match_operand:SI 3 "const_int_operand" "")]
4217   "TARGET_CPU_ZARCH"
4218   "if (!s390_expand_addcc (GET_CODE (operands[1]), 
4219                            s390_compare_op0, s390_compare_op1, 
4220                            operands[0], operands[2], 
4221                            operands[3])) FAIL; DONE;")
4224 ; scond instruction pattern(s).
4227 (define_insn_and_split "*sconddi"
4228   [(set (match_operand:DI 0 "register_operand" "=&d")
4229         (match_operand:DI 1 "s390_alc_comparison" ""))
4230    (clobber (reg:CC 33))]
4231   "TARGET_64BIT"
4232   "#"
4233   "&& reload_completed"
4234   [(set (match_dup 0) (const_int 0))
4235    (parallel
4236     [(set (match_dup 0) (plus:DI (plus:DI (match_dup 0) (match_dup 0))
4237                                  (match_dup 1)))
4238      (clobber (reg:CC 33))])]
4239   ""
4240   [(set_attr "op_type"  "NN")])
4242 (define_insn_and_split "*scondsi"
4243   [(set (match_operand:SI 0 "register_operand" "=&d")
4244         (match_operand:SI 1 "s390_alc_comparison" ""))
4245    (clobber (reg:CC 33))]
4246   "TARGET_CPU_ZARCH"
4247   "#"
4248   "&& reload_completed"
4249   [(set (match_dup 0) (const_int 0))
4250    (parallel
4251     [(set (match_dup 0) (plus:SI (plus:SI (match_dup 0) (match_dup 0))
4252                                  (match_dup 1)))
4253      (clobber (reg:CC 33))])]
4254   ""
4255   [(set_attr "op_type"  "NN")])
4257 (define_insn_and_split "*sconddi_neg"
4258   [(set (match_operand:DI 0 "register_operand" "=&d")
4259         (match_operand:DI 1 "s390_slb_comparison" ""))
4260    (clobber (reg:CC 33))]
4261   "TARGET_64BIT"
4262   "#"
4263   "&& reload_completed"
4264   [(set (match_dup 0) (const_int 0))
4265    (parallel
4266     [(set (match_dup 0) (minus:DI (minus:DI (match_dup 0) (match_dup 0))
4267                                   (match_dup 1)))
4268      (clobber (reg:CC 33))])
4269    (parallel
4270     [(set (match_dup 0) (neg:DI (match_dup 0)))
4271      (clobber (reg:CC 33))])]
4272   ""
4273   [(set_attr "op_type"  "NN")])
4275 (define_insn_and_split "*scondsi_neg"
4276   [(set (match_operand:SI 0 "register_operand" "=&d")
4277         (match_operand:SI 1 "s390_slb_comparison" ""))
4278    (clobber (reg:CC 33))]
4279   "TARGET_CPU_ZARCH"
4280   "#"
4281   "&& reload_completed"
4282   [(set (match_dup 0) (const_int 0))
4283    (parallel
4284     [(set (match_dup 0) (minus:SI (minus:SI (match_dup 0) (match_dup 0))
4285                                   (match_dup 1)))
4286      (clobber (reg:CC 33))])
4287    (parallel
4288     [(set (match_dup 0) (neg:SI (match_dup 0)))
4289      (clobber (reg:CC 33))])]
4290   ""
4291   [(set_attr "op_type"  "NN")])
4293 (define_expand "sltu"
4294   [(match_operand:SI 0 "register_operand" "")]
4295   "TARGET_CPU_ZARCH"
4296   "if (!s390_expand_addcc (LTU, s390_compare_op0, s390_compare_op1,
4297                            operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4299 (define_expand "sgtu"
4300   [(match_operand:SI 0 "register_operand" "")]
4301   "TARGET_CPU_ZARCH"
4302   "if (!s390_expand_addcc (GTU, s390_compare_op0, s390_compare_op1,
4303                            operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4305 (define_expand "sleu"
4306   [(match_operand:SI 0 "register_operand" "")]
4307   "TARGET_CPU_ZARCH"
4308   "if (!s390_expand_addcc (LEU, s390_compare_op0, s390_compare_op1,
4309                            operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4311 (define_expand "sgeu"
4312   [(match_operand:SI 0 "register_operand" "")]
4313   "TARGET_CPU_ZARCH"
4314   "if (!s390_expand_addcc (GEU, s390_compare_op0, s390_compare_op1,
4315                            operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4319 ;;- Multiply instructions.
4323 ; muldi3 instruction pattern(s).
4326 (define_insn "*muldi3_sign"
4327   [(set (match_operand:DI 0 "register_operand" "=d,d")
4328         (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4329                  (match_operand:DI 1 "register_operand" "0,0")))]
4330   "TARGET_64BIT"
4331   "@
4332    msgfr\t%0,%2
4333    msgf\t%0,%2"
4334   [(set_attr "op_type"  "RRE,RXY")
4335    (set_attr "type"     "imul")])
4337 (define_insn "muldi3"
4338   [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4339         (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4340                  (match_operand:DI 2 "general_operand" "d,K,m")))]
4341   "TARGET_64BIT"
4342   "@
4343    msgr\t%0,%2
4344    mghi\t%0,%h2
4345    msg\t%0,%2"
4346   [(set_attr "op_type"  "RRE,RI,RXY")
4347    (set_attr "type"     "imul")])
4350 ; mulsi3 instruction pattern(s).
4353 (define_insn "*mulsi3_sign"
4354   [(set (match_operand:SI 0 "register_operand" "=d")
4355         (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4356                  (match_operand:SI 1 "register_operand" "0")))]
4357   ""
4358   "mh\t%0,%2"
4359   [(set_attr "op_type"  "RX")
4360    (set_attr "type"     "imul")])
4362 (define_insn "mulsi3"
4363   [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4364         (mult:SI  (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4365                   (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4366   ""
4367   "@
4368    msr\t%0,%2
4369    mhi\t%0,%h2
4370    ms\t%0,%2
4371    msy\t%0,%2"
4372   [(set_attr "op_type"  "RRE,RI,RX,RXY")
4373    (set_attr "type"     "imul")])
4376 ; mulsidi3 instruction pattern(s).
4379 (define_insn "mulsidi3"
4380   [(set (match_operand:DI 0 "register_operand" "=d,d")
4381         (mult:DI (sign_extend:DI
4382                    (match_operand:SI 1 "register_operand" "%0,0"))
4383                  (sign_extend:DI
4384                    (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4385   "!TARGET_64BIT"
4386   "@
4387    mr\t%0,%2
4388    m\t%0,%2"
4389   [(set_attr "op_type"  "RR,RX")
4390    (set_attr "type"     "imul")])
4393 ; umulsidi3 instruction pattern(s).
4396 (define_insn "umulsidi3"
4397   [(set (match_operand:DI 0 "register_operand" "=d,d")
4398         (mult:DI (zero_extend:DI
4399                    (match_operand:SI 1 "register_operand" "%0,0"))
4400                  (zero_extend:DI
4401                    (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4402   "!TARGET_64BIT && TARGET_CPU_ZARCH"
4403   "@
4404    mlr\t%0,%2
4405    ml\t%0,%2"
4406   [(set_attr "op_type"  "RRE,RXY")
4407    (set_attr "type"     "imul")])
4410 ; muldf3 instruction pattern(s).
4413 (define_expand "muldf3"
4414   [(set (match_operand:DF 0 "register_operand" "=f,f")
4415         (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4416                  (match_operand:DF 2 "general_operand" "f,R")))]
4417   "TARGET_HARD_FLOAT"
4418   "")
4420 (define_insn "*muldf3"
4421   [(set (match_operand:DF 0 "register_operand" "=f,f")
4422         (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4423                  (match_operand:DF 2 "general_operand" "f,R")))]
4424   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4425   "@
4426    mdbr\t%0,%2
4427    mdb\t%0,%2"
4428   [(set_attr "op_type"  "RRE,RXE")
4429    (set_attr "type"     "fmuld")])
4431 (define_insn "*muldf3_ibm"
4432   [(set (match_operand:DF 0 "register_operand" "=f,f")
4433         (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4434                  (match_operand:DF 2 "general_operand" "f,R")))]
4435   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4436   "@
4437    mdr\t%0,%2
4438    md\t%0,%2"
4439   [(set_attr "op_type"  "RR,RX")
4440    (set_attr "type"    "fmuld")])
4442 (define_insn "*fmadddf"
4443   [(set (match_operand:DF 0 "register_operand" "=f,f")
4444         (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4445                           (match_operand:DF 2 "nonimmediate_operand"  "f,R"))
4446                  (match_operand:DF 3 "register_operand" "0,0")))]
4447   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4448   "@
4449    madbr\t%0,%1,%2
4450    madb\t%0,%1,%2"
4451   [(set_attr "op_type"  "RRE,RXE")
4452    (set_attr "type" "fmuld")])
4454 (define_insn "*fmsubdf"
4455   [(set (match_operand:DF 0 "register_operand" "=f,f")
4456         (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4457                            (match_operand:DF 2 "nonimmediate_operand"  "f,R"))
4458                  (match_operand:DF 3 "register_operand" "0,0")))]
4459   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4460   "@
4461    msdbr\t%0,%1,%2
4462    msdb\t%0,%1,%2"
4463   [(set_attr "op_type"  "RRE,RXE")
4464    (set_attr "type" "fmuld")])
4467 ; mulsf3 instruction pattern(s).
4470 (define_expand "mulsf3"
4471   [(set (match_operand:SF 0 "register_operand" "=f,f")
4472         (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4473                  (match_operand:SF 2 "general_operand" "f,R")))]
4474   "TARGET_HARD_FLOAT"
4475   "")
4477 (define_insn "*mulsf3"
4478   [(set (match_operand:SF 0 "register_operand" "=f,f")
4479         (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4480                  (match_operand:SF 2 "general_operand" "f,R")))]
4481   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4482   "@
4483    meebr\t%0,%2
4484    meeb\t%0,%2"
4485   [(set_attr "op_type"  "RRE,RXE")
4486    (set_attr "type"     "fmuls")])
4488 (define_insn "*mulsf3_ibm"
4489   [(set (match_operand:SF 0 "register_operand" "=f,f")
4490         (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4491                  (match_operand:SF 2 "general_operand" "f,R")))]
4492   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4493   "@
4494    mer\t%0,%2
4495    me\t%0,%2"
4496   [(set_attr "op_type"  "RR,RX")
4497    (set_attr "type"     "fmuls")])
4499 (define_insn "*fmaddsf"
4500   [(set (match_operand:SF 0 "register_operand" "=f,f")
4501         (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4502                           (match_operand:SF 2 "nonimmediate_operand"  "f,R"))
4503                  (match_operand:SF 3 "register_operand" "0,0")))]
4504   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4505   "@
4506    maebr\t%0,%1,%2
4507    maeb\t%0,%1,%2"
4508   [(set_attr "op_type"  "RRE,RXE")
4509    (set_attr "type" "fmuls")])
4511 (define_insn "*fmsubsf"
4512   [(set (match_operand:SF 0 "register_operand" "=f,f")
4513         (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4514                            (match_operand:SF 2 "nonimmediate_operand"  "f,R"))
4515                   (match_operand:SF 3 "register_operand" "0,0")))]
4516   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4517   "@
4518    msebr\t%0,%1,%2
4519    mseb\t%0,%1,%2"
4520   [(set_attr "op_type"  "RRE,RXE")
4521    (set_attr "type" "fmuls")])
4524 ;;- Divide and modulo instructions.
4528 ; divmoddi4 instruction pattern(s).
4531 (define_expand "divmoddi4"
4532   [(parallel [(set (match_operand:DI 0 "general_operand" "")
4533                    (div:DI (match_operand:DI 1 "register_operand" "")
4534                            (match_operand:DI 2 "general_operand" "")))
4535               (set (match_operand:DI 3 "general_operand" "")
4536                    (mod:DI (match_dup 1) (match_dup 2)))])
4537    (clobber (match_dup 4))]
4538   "TARGET_64BIT"
4540   rtx insn, div_equal, mod_equal;
4542   div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4543   mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4545   operands[4] = gen_reg_rtx(TImode);
4546   emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4548   insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4549   REG_NOTES (insn) =
4550         gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4552   insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4553   REG_NOTES (insn) =
4554         gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4556   DONE;
4559 (define_insn "divmodtidi3"
4560   [(set (match_operand:TI 0 "register_operand" "=d,d")
4561         (ior:TI
4562           (ashift:TI
4563             (zero_extend:TI
4564               (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4565                       (match_operand:DI 2 "general_operand" "d,m")))
4566             (const_int 64))
4567           (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
4568   "TARGET_64BIT"
4569   "@
4570    dsgr\t%0,%2
4571    dsg\t%0,%2"
4572   [(set_attr "op_type"  "RRE,RXY")
4573    (set_attr "type"     "idiv")])
4575 (define_insn "divmodtisi3"
4576   [(set (match_operand:TI 0 "register_operand" "=d,d")
4577         (ior:TI
4578           (ashift:TI
4579             (zero_extend:TI
4580               (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4581                       (sign_extend:DI
4582                         (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4583             (const_int 64))
4584           (zero_extend:TI
4585             (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
4586   "TARGET_64BIT"
4587   "@
4588    dsgfr\t%0,%2
4589    dsgf\t%0,%2"
4590   [(set_attr "op_type"  "RRE,RXY")
4591    (set_attr "type"     "idiv")])
4594 ; udivmoddi4 instruction pattern(s).
4597 (define_expand "udivmoddi4"
4598   [(parallel [(set (match_operand:DI 0 "general_operand" "")
4599                    (udiv:DI (match_operand:DI 1 "general_operand" "")
4600                             (match_operand:DI 2 "nonimmediate_operand" "")))
4601               (set (match_operand:DI 3 "general_operand" "")
4602                    (umod:DI (match_dup 1) (match_dup 2)))])
4603    (clobber (match_dup 4))]
4604   "TARGET_64BIT"
4606   rtx insn, div_equal, mod_equal, equal;
4608   div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4609   mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4610   equal = gen_rtx_IOR (TImode,
4611                        gen_rtx_ASHIFT (TImode,
4612                                        gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4613                                        GEN_INT (64)),
4614                        gen_rtx_ZERO_EXTEND (TImode, div_equal));
4616   operands[4] = gen_reg_rtx(TImode);
4617   emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4618   emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4619   emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4620   insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4621   REG_NOTES (insn) =
4622         gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4624   insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4625   REG_NOTES (insn) =
4626         gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4628   insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4629   REG_NOTES (insn) =
4630         gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4632   DONE;
4635 (define_insn "udivmodtidi3"
4636   [(set (match_operand:TI 0 "register_operand" "=d,d")
4637         (ior:TI
4638           (ashift:TI
4639             (zero_extend:TI
4640               (truncate:DI
4641                 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
4642                          (zero_extend:TI
4643                            (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4644             (const_int 64))
4645           (zero_extend:TI
4646             (truncate:DI
4647               (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
4648   "TARGET_64BIT"
4649   "@
4650    dlgr\t%0,%2
4651    dlg\t%0,%2"
4652   [(set_attr "op_type"  "RRE,RXY")
4653    (set_attr "type"     "idiv")])
4656 ; divmodsi4 instruction pattern(s).
4659 (define_expand "divmodsi4"
4660   [(parallel [(set (match_operand:SI 0 "general_operand" "")
4661                    (div:SI (match_operand:SI 1 "general_operand" "")
4662                            (match_operand:SI 2 "nonimmediate_operand" "")))
4663               (set (match_operand:SI 3 "general_operand" "")
4664                    (mod:SI (match_dup 1) (match_dup 2)))])
4665    (clobber (match_dup 4))]
4666   "!TARGET_64BIT"
4668   rtx insn, div_equal, mod_equal, equal;
4670   div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4671   mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4672   equal = gen_rtx_IOR (DImode,
4673                        gen_rtx_ASHIFT (DImode,
4674                                        gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4675                                        GEN_INT (32)),
4676                        gen_rtx_ZERO_EXTEND (DImode, div_equal));
4678   operands[4] = gen_reg_rtx(DImode);
4679   emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4680   insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4681   REG_NOTES (insn) =
4682         gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4684   insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4685   REG_NOTES (insn) =
4686         gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4688   insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4689   REG_NOTES (insn) =
4690         gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4692   DONE;
4695 (define_insn "divmoddisi3"
4696   [(set (match_operand:DI 0 "register_operand" "=d,d")
4697         (ior:DI
4698           (ashift:DI
4699             (zero_extend:DI
4700               (truncate:SI
4701                 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4702                         (sign_extend:DI
4703                           (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4704             (const_int 32))
4705           (zero_extend:DI
4706             (truncate:SI
4707               (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
4708   "!TARGET_64BIT"
4709   "@
4710    dr\t%0,%2
4711    d\t%0,%2"
4712   [(set_attr "op_type"  "RR,RX")
4713    (set_attr "type"     "idiv")])
4716 ; udivsi3 and umodsi3 instruction pattern(s).
4719 (define_expand "udivmodsi4"
4720   [(parallel [(set (match_operand:SI 0 "general_operand" "")
4721                    (udiv:SI (match_operand:SI 1 "general_operand" "")
4722                             (match_operand:SI 2 "nonimmediate_operand" "")))
4723               (set (match_operand:SI 3 "general_operand" "")
4724                    (umod:SI (match_dup 1) (match_dup 2)))])
4725    (clobber (match_dup 4))]
4726   "!TARGET_64BIT && TARGET_CPU_ZARCH"
4728   rtx insn, div_equal, mod_equal, equal;
4730   div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4731   mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4732   equal = gen_rtx_IOR (DImode,
4733                        gen_rtx_ASHIFT (DImode,
4734                                        gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4735                                        GEN_INT (32)),
4736                        gen_rtx_ZERO_EXTEND (DImode, div_equal));
4738   operands[4] = gen_reg_rtx(DImode);
4739   emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4740   emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4741   emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4742   insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4743   REG_NOTES (insn) =
4744         gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4746   insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4747   REG_NOTES (insn) =
4748         gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4750   insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4751   REG_NOTES (insn) =
4752         gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4754   DONE;
4757 (define_insn "udivmoddisi3"
4758   [(set (match_operand:DI 0 "register_operand" "=d,d")
4759         (ior:DI
4760           (ashift:DI
4761             (zero_extend:DI
4762               (truncate:SI
4763                 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
4764                          (zero_extend:DI
4765                            (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4766             (const_int 32))
4767           (zero_extend:DI
4768             (truncate:SI
4769               (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
4770   "!TARGET_64BIT && TARGET_CPU_ZARCH"
4771   "@
4772    dlr\t%0,%2
4773    dl\t%0,%2"
4774   [(set_attr "op_type"  "RRE,RXY")
4775    (set_attr "type"     "idiv")])
4777 (define_expand "udivsi3"
4778   [(set (match_operand:SI 0 "register_operand" "=d")
4779         (udiv:SI (match_operand:SI 1 "general_operand" "")
4780                  (match_operand:SI 2 "general_operand" "")))
4781    (clobber (match_dup 3))]
4782   "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4784   rtx insn, udiv_equal, umod_equal, equal;
4786   udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4787   umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4788   equal = gen_rtx_IOR (DImode,
4789                        gen_rtx_ASHIFT (DImode,
4790                                        gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4791                                        GEN_INT (32)),
4792                        gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4794   operands[3] = gen_reg_rtx (DImode);
4796   if (CONSTANT_P (operands[2]))
4797     {
4798       if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4799         {
4800           rtx label1 = gen_label_rtx ();
4802           operands[1] = make_safe_from (operands[1], operands[0]);
4803           emit_move_insn (operands[0], const0_rtx);
4804           emit_insn (gen_cmpsi (operands[1], operands[2]));
4805           emit_jump_insn (gen_bltu (label1));
4806           emit_move_insn (operands[0], const1_rtx);
4807           emit_label (label1);
4808         }
4809       else
4810         {
4811           operands[2] = force_reg (SImode, operands[2]);
4812           operands[2] = make_safe_from (operands[2], operands[0]);
4814           emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4815           insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4816                                              operands[2]));
4817           REG_NOTES (insn) =
4818             gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4820           insn = emit_move_insn (operands[0],
4821                                  gen_lowpart (SImode, operands[3]));
4822           REG_NOTES (insn) =
4823             gen_rtx_EXPR_LIST (REG_EQUAL,
4824                                udiv_equal, REG_NOTES (insn));
4825         }
4826     }
4827   else
4828     {
4829       rtx label1 = gen_label_rtx ();
4830       rtx label2 = gen_label_rtx ();
4831       rtx label3 = gen_label_rtx ();
4833       operands[1] = force_reg (SImode, operands[1]);
4834       operands[1] = make_safe_from (operands[1], operands[0]);
4835       operands[2] = force_reg (SImode, operands[2]);
4836       operands[2] = make_safe_from (operands[2], operands[0]);
4838       emit_move_insn (operands[0], const0_rtx);
4839       emit_insn (gen_cmpsi (operands[2], operands[1]));
4840       emit_jump_insn (gen_bgtu (label3));
4841       emit_insn (gen_cmpsi (operands[2], const0_rtx));
4842       emit_jump_insn (gen_blt (label2));
4843       emit_insn (gen_cmpsi (operands[2], const1_rtx));
4844       emit_jump_insn (gen_beq (label1));
4845       emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4846       insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4847                                          operands[2]));
4848       REG_NOTES (insn) =
4849       gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4851       insn = emit_move_insn (operands[0],
4852                              gen_lowpart (SImode, operands[3]));
4853       REG_NOTES (insn) =
4854       gen_rtx_EXPR_LIST (REG_EQUAL,
4855                                udiv_equal, REG_NOTES (insn));
4856       emit_jump (label3);
4857       emit_label (label1);
4858       emit_move_insn (operands[0], operands[1]);
4859       emit_jump (label3);
4860       emit_label (label2);
4861       emit_move_insn (operands[0], const1_rtx);
4862       emit_label (label3);
4863     }
4864   emit_move_insn (operands[0], operands[0]);
4865   DONE;
4868 (define_expand "umodsi3"
4869   [(set (match_operand:SI 0 "register_operand" "=d")
4870         (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4871                  (match_operand:SI 2 "nonimmediate_operand" "")))
4872    (clobber (match_dup 3))]
4873   "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4875   rtx insn, udiv_equal, umod_equal, equal;
4877   udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4878   umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4879   equal = gen_rtx_IOR (DImode,
4880                        gen_rtx_ASHIFT (DImode,
4881                                        gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4882                                        GEN_INT (32)),
4883                        gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4885   operands[3] = gen_reg_rtx (DImode);
4887   if (CONSTANT_P (operands[2]))
4888     {
4889       if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4890         {
4891           rtx label1 = gen_label_rtx ();
4893           operands[1] = make_safe_from (operands[1], operands[0]);
4894           emit_move_insn (operands[0], operands[1]);
4895           emit_insn (gen_cmpsi (operands[0], operands[2]));
4896           emit_jump_insn (gen_bltu (label1));
4897           emit_insn (gen_abssi2 (operands[0], operands[2]));
4898           emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4899           emit_label (label1);
4900         }
4901       else
4902         {
4903           operands[2] = force_reg (SImode, operands[2]);
4904           operands[2] = make_safe_from (operands[2], operands[0]);
4906           emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4907           insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4908                                              operands[2]));
4909           REG_NOTES (insn) =
4910             gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4912           insn = emit_move_insn (operands[0],
4913                                  gen_highpart (SImode, operands[3]));
4914           REG_NOTES (insn) =
4915             gen_rtx_EXPR_LIST (REG_EQUAL,
4916                                umod_equal, REG_NOTES (insn));
4917         }
4918     }
4919   else
4920     {
4921       rtx label1 = gen_label_rtx ();
4922       rtx label2 = gen_label_rtx ();
4923       rtx label3 = gen_label_rtx ();
4925       operands[1] = force_reg (SImode, operands[1]);
4926       operands[1] = make_safe_from (operands[1], operands[0]);
4927       operands[2] = force_reg (SImode, operands[2]);
4928       operands[2] = make_safe_from (operands[2], operands[0]);
4930       emit_move_insn(operands[0], operands[1]);
4931       emit_insn (gen_cmpsi (operands[2], operands[1]));
4932       emit_jump_insn (gen_bgtu (label3));
4933       emit_insn (gen_cmpsi (operands[2], const0_rtx));
4934       emit_jump_insn (gen_blt (label2));
4935       emit_insn (gen_cmpsi (operands[2], const1_rtx));
4936       emit_jump_insn (gen_beq (label1));
4937       emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4938       insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4939                                          operands[2]));
4940       REG_NOTES (insn) =
4941       gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4943       insn = emit_move_insn (operands[0],
4944                              gen_highpart (SImode, operands[3]));
4945       REG_NOTES (insn) =
4946       gen_rtx_EXPR_LIST (REG_EQUAL,
4947                          umod_equal, REG_NOTES (insn));
4948       emit_jump (label3);
4949       emit_label (label1);
4950       emit_move_insn (operands[0], const0_rtx);
4951       emit_jump (label3);
4952       emit_label (label2);
4953       emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4954       emit_label (label3);
4955     }
4956   DONE;
4960 ; divdf3 instruction pattern(s).
4963 (define_expand "divdf3"
4964   [(set (match_operand:DF 0 "register_operand" "=f,f")
4965         (div:DF (match_operand:DF 1 "register_operand" "0,0")
4966                 (match_operand:DF 2 "general_operand" "f,R")))]
4967   "TARGET_HARD_FLOAT"
4968   "")
4970 (define_insn "*divdf3"
4971   [(set (match_operand:DF 0 "register_operand" "=f,f")
4972         (div:DF (match_operand:DF 1 "register_operand" "0,0")
4973                 (match_operand:DF 2 "general_operand" "f,R")))]
4974   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4975   "@
4976    ddbr\t%0,%2
4977    ddb\t%0,%2"
4978   [(set_attr "op_type"  "RRE,RXE")
4979    (set_attr "type"     "fdivd")])
4981 (define_insn "*divdf3_ibm"
4982   [(set (match_operand:DF 0 "register_operand" "=f,f")
4983         (div:DF (match_operand:DF 1 "register_operand" "0,0")
4984                 (match_operand:DF 2 "general_operand" "f,R")))]
4985   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4986   "@
4987    ddr\t%0,%2
4988    dd\t%0,%2"
4989   [(set_attr "op_type"  "RR,RX")
4990    (set_attr "type"     "fdivd")])
4993 ; divsf3 instruction pattern(s).
4996 (define_expand "divsf3"
4997   [(set (match_operand:SF 0 "register_operand" "=f,f")
4998         (div:SF (match_operand:SF 1 "register_operand" "0,0")
4999                 (match_operand:SF 2 "general_operand" "f,R")))]
5000   "TARGET_HARD_FLOAT"
5001   "")
5003 (define_insn "*divsf3"
5004   [(set (match_operand:SF 0 "register_operand" "=f,f")
5005         (div:SF (match_operand:SF 1 "register_operand" "0,0")
5006                 (match_operand:SF 2 "general_operand" "f,R")))]
5007   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5008   "@
5009    debr\t%0,%2
5010    deb\t%0,%2"
5011   [(set_attr "op_type"  "RRE,RXE")
5012    (set_attr "type"     "fdivs")])
5014 (define_insn "*divsf3"
5015   [(set (match_operand:SF 0 "register_operand" "=f,f")
5016         (div:SF (match_operand:SF 1 "register_operand" "0,0")
5017                 (match_operand:SF 2 "general_operand" "f,R")))]
5018   "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5019   "@
5020    der\t%0,%2
5021    de\t%0,%2"
5022   [(set_attr "op_type"  "RR,RX")
5023    (set_attr "type"     "fdivs")])
5027 ;;- And instructions.
5031 ; anddi3 instruction pattern(s).
5034 (define_insn "*anddi3_cc"
5035   [(set (reg 33)
5036         (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5037                          (match_operand:DI 2 "general_operand" "d,m"))
5038                  (const_int 0)))
5039    (set (match_operand:DI 0 "register_operand" "=d,d")
5040         (and:DI (match_dup 1) (match_dup 2)))]
5041   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5042   "@
5043    ngr\t%0,%2
5044    ng\t%0,%2"
5045   [(set_attr "op_type"  "RRE,RXY")])
5047 (define_insn "*anddi3_cconly"
5048   [(set (reg 33)
5049         (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5050                          (match_operand:DI 2 "general_operand" "d,m"))
5051                  (const_int 0)))
5052    (clobber (match_scratch:DI 0 "=d,d"))]
5053   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
5054    /* Do not steal TM patterns.  */
5055    && s390_single_part (operands[2], DImode, HImode, 0) < 0"
5056   "@
5057    ngr\t%0,%2
5058    ng\t%0,%2"
5059   [(set_attr "op_type"  "RRE,RXY")])
5061 (define_insn "anddi3"
5062   [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d,d,d")
5063         (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o,0,0,0,0,0,0")
5064                 (match_operand:DI 2 "general_operand"
5065                                     "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m")))
5066      (clobber (reg:CC 33))]
5067    "TARGET_64BIT"
5068    "@
5069     #
5070     #
5071     nihh\t%0,%j2
5072     nihl\t%0,%j2
5073     nilh\t%0,%j2
5074     nill\t%0,%j2
5075     ngr\t%0,%2
5076     ng\t%0,%2"
5077  [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY")])
5079 (define_insn "*anddi3_ss"
5080   [(set (match_operand:DI 0 "s_operand" "=Q")
5081         (and:DI (match_dup 0)
5082                 (match_operand:DI 1 "s_imm_operand" "Q")))
5083    (clobber (reg:CC 33))]
5084   ""
5085   "nc\t%O0(8,%R0),%1"
5086   [(set_attr "op_type"  "SS")])
5088 (define_insn "*anddi3_ss_inv"
5089   [(set (match_operand:DI 0 "s_operand" "=Q")
5090         (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5091                 (match_dup 0)))
5092    (clobber (reg:CC 33))]
5093   ""
5094   "nc\t%O0(8,%R0),%1"
5095   [(set_attr "op_type"  "SS")])
5098 ; andsi3 instruction pattern(s).
5101 (define_insn "*andsi3_cc"
5102   [(set (reg 33)
5103         (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5104                          (match_operand:SI 2 "general_operand" "d,R,T"))
5105                  (const_int 0)))
5106    (set (match_operand:SI 0 "register_operand" "=d,d,d")
5107         (and:SI (match_dup 1) (match_dup 2)))]
5108   "s390_match_ccmode(insn, CCTmode)"
5109   "@
5110    nr\t%0,%2
5111    n\t%0,%2
5112    ny\t%0,%2"
5113   [(set_attr "op_type"  "RR,RX,RXY")])
5115 (define_insn "*andsi3_cconly"
5116   [(set (reg 33)
5117         (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5118                          (match_operand:SI 2 "general_operand" "d,R,T"))
5119                  (const_int 0)))
5120    (clobber (match_scratch:SI 0 "=d,d,d"))]
5121   "s390_match_ccmode(insn, CCTmode)
5122    /* Do not steal TM patterns.  */
5123    && s390_single_part (operands[2], SImode, HImode, 0) < 0"
5124   "@
5125    nr\t%0,%2
5126    n\t%0,%2
5127    ny\t%0,%2"
5128   [(set_attr "op_type"  "RR,RX,RXY")])
5130 (define_expand "andsi3"
5131   [(parallel
5132     [(set (match_operand:SI 0 "register_operand" "")
5133           (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
5134                   (match_operand:SI 2 "general_operand" "")))
5135      (clobber (reg:CC 33))])]
5136   ""
5137   "")
5139 (define_insn "*andsi3_zarch"
5140   [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d,d,d")
5141         (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,o,0,0,0,0,0")
5142                 (match_operand:SI 2 "general_operand" "M,M,N0HSF,N1HSF,d,R,T")))
5143    (clobber (reg:CC 33))]
5144   "TARGET_ZARCH"
5145   "@
5146    #
5147    #
5148    nilh\t%0,%j2
5149    nill\t%0,%j2
5150    nr\t%0,%2
5151    n\t%0,%2
5152    ny\t%0,%2"
5153   [(set_attr "op_type"  "RRE,RXE,RI,RI,RR,RX,RXY")])
5155 (define_insn "*andsi3_esa"
5156   [(set (match_operand:SI 0 "register_operand" "=d,d")
5157         (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5158                 (match_operand:SI 2 "general_operand" "d,R")))
5159    (clobber (reg:CC 33))]
5160   "!TARGET_ZARCH"
5161   "@
5162    nr\t%0,%2
5163    n\t%0,%2"
5164   [(set_attr "op_type"  "RR,RX")])
5166 (define_insn "*andsi3_ss"
5167   [(set (match_operand:SI 0 "s_operand" "=Q")
5168         (and:SI (match_dup 0)
5169                 (match_operand:SI 1 "s_imm_operand" "Q")))
5170    (clobber (reg:CC 33))]
5171   ""
5172   "nc\t%O0(4,%R0),%1"
5173   [(set_attr "op_type"  "SS")])
5175 (define_insn "*andsi3_ss_inv"
5176   [(set (match_operand:SI 0 "s_operand" "=Q")
5177         (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5178                 (match_dup 0)))
5179    (clobber (reg:CC 33))]
5180   ""
5181   "nc\t%O0(4,%R0),%1"
5182   [(set_attr "op_type"  "SS")])
5185 ; andhi3 instruction pattern(s).
5188 (define_insn "*andhi3_ni"
5189   [(set (match_operand:HI 0 "register_operand" "=d,d")
5190         (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5191                 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5192    (clobber (reg:CC 33))]
5193   "TARGET_ZARCH"
5194   "@
5195    nr\t%0,%2
5196    nill\t%0,%x2"
5197   [(set_attr "op_type"  "RR,RI")])
5199 (define_insn "andhi3"
5200   [(set (match_operand:HI 0 "register_operand" "=d")
5201         (and:HI (match_operand:HI 1 "register_operand" "%0")
5202                 (match_operand:HI 2 "nonmemory_operand" "d")))
5203    (clobber (reg:CC 33))]
5204   ""
5205   "nr\t%0,%2"
5206   [(set_attr "op_type"  "RR")])
5208 (define_insn "*andhi3_ss"
5209   [(set (match_operand:HI 0 "s_operand" "=Q")
5210         (and:HI (match_dup 0)
5211                 (match_operand:HI 1 "s_imm_operand" "Q")))
5212    (clobber (reg:CC 33))]
5213   ""
5214   "nc\t%O0(2,%R0),%1"
5215   [(set_attr "op_type"  "SS")])
5217 (define_insn "*andhi3_ss_inv"
5218   [(set (match_operand:HI 0 "s_operand" "=Q")
5219         (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5220                 (match_dup 0)))
5221    (clobber (reg:CC 33))]
5222   ""
5223   "nc\t%O0(2,%R0),%1"
5224   [(set_attr "op_type"  "SS")])
5227 ; andqi3 instruction pattern(s).
5230 (define_insn "*andqi3_ni"
5231   [(set (match_operand:QI 0 "register_operand" "=d,d")
5232         (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5233                 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5234    (clobber (reg:CC 33))]
5235   "TARGET_ZARCH"
5236   "@
5237    nr\t%0,%2
5238    nill\t%0,%b2"
5239   [(set_attr "op_type"  "RR,RI")])
5241 (define_insn "andqi3"
5242   [(set (match_operand:QI 0 "register_operand" "=d")
5243         (and:QI (match_operand:QI 1 "register_operand" "%0")
5244                 (match_operand:QI 2 "nonmemory_operand" "d")))
5245    (clobber (reg:CC 33))]
5246   ""
5247   "nr\t%0,%2"
5248   [(set_attr "op_type"  "RR")])
5250 (define_insn "*andqi3_ss"
5251   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5252         (and:QI (match_dup 0)
5253                 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5254    (clobber (reg:CC 33))]
5255   ""
5256   "@
5257    ni\t%0,%b1
5258    niy\t%0,%b1
5259    nc\t%O0(1,%R0),%1"
5260   [(set_attr "op_type"  "SI,SIY,SS")])
5262 (define_insn "*andqi3_ss_inv"
5263   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5264         (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5265                 (match_dup 0)))
5266    (clobber (reg:CC 33))]
5267   ""
5268   "@
5269    ni\t%0,%b1
5270    niy\t%0,%b1
5271    nc\t%O0(1,%R0),%1"
5272   [(set_attr "op_type"  "SI,SIY,SS")])
5276 ;;- Bit set (inclusive or) instructions.
5280 ; iordi3 instruction pattern(s).
5283 (define_insn "*iordi3_cc"
5284   [(set (reg 33)
5285         (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5286                          (match_operand:DI 2 "general_operand" "d,m"))
5287                  (const_int 0)))
5288    (set (match_operand:DI 0 "register_operand" "=d,d")
5289         (ior:DI (match_dup 1) (match_dup 2)))]
5290   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5291   "@
5292    ogr\t%0,%2
5293    og\t%0,%2"
5294   [(set_attr "op_type"  "RRE,RXY")])
5296 (define_insn "*iordi3_cconly"
5297   [(set (reg 33)
5298         (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5299                          (match_operand:DI 2 "general_operand" "d,m"))
5300                  (const_int 0)))
5301    (clobber (match_scratch:DI 0 "=d,d"))]
5302   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5303   "@
5304    ogr\t%0,%2
5305    og\t%0,%2"
5306   [(set_attr "op_type"  "RRE,RXY")])
5308 (define_insn "iordi3"
5309   [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d")
5310         (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,0,0,0,0")
5311                 (match_operand:DI 2 "general_operand" "N0HD0,N1HD0,N2HD0,N3HD0,d,m")))
5312    (clobber (reg:CC 33))]
5313   "TARGET_64BIT"
5314   "@
5315    oihh\t%0,%i2
5316    oihl\t%0,%i2
5317    oilh\t%0,%i2
5318    oill\t%0,%i2
5319    ogr\t%0,%2
5320    og\t%0,%2"
5321   [(set_attr "op_type"  "RI,RI,RI,RI,RRE,RXY")])
5323 (define_insn "*iordi3_ss"
5324   [(set (match_operand:DI 0 "s_operand" "=Q")
5325         (ior:DI (match_dup 0)
5326                 (match_operand:DI 1 "s_imm_operand" "Q")))
5327    (clobber (reg:CC 33))]
5328   ""
5329   "oc\t%O0(8,%R0),%1"
5330   [(set_attr "op_type"  "SS")])
5332 (define_insn "*iordi3_ss_inv"
5333   [(set (match_operand:DI 0 "s_operand" "=Q")
5334         (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5335                 (match_dup 0)))
5336    (clobber (reg:CC 33))]
5337   ""
5338   "oc\t%O0(8,%R0),%1"
5339   [(set_attr "op_type"  "SS")])
5342 ; iorsi3 instruction pattern(s).
5345 (define_insn "*iorsi3_cc"
5346   [(set (reg 33)
5347         (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5348                          (match_operand:SI 2 "general_operand" "d,R,T"))
5349                  (const_int 0)))
5350    (set (match_operand:SI 0 "register_operand" "=d,d,d")
5351         (ior:SI (match_dup 1) (match_dup 2)))]
5352   "s390_match_ccmode(insn, CCTmode)"
5353   "@
5354    or\t%0,%2
5355    o\t%0,%2
5356    oy\t%0,%2"
5357   [(set_attr "op_type"  "RR,RX,RXY")])
5359 (define_insn "*iorsi3_cconly"
5360   [(set (reg 33)
5361         (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5362                          (match_operand:SI 2 "general_operand" "d,R,T"))
5363                  (const_int 0)))
5364    (clobber (match_scratch:SI 0 "=d,d,d"))]
5365   "s390_match_ccmode(insn, CCTmode)"
5366   "@
5367    or\t%0,%2
5368    o\t%0,%2
5369    oy\t%0,%2"
5370   [(set_attr "op_type"  "RR,RX,RXY")])
5372 (define_expand "iorsi3"
5373   [(parallel
5374     [(set (match_operand:SI 0 "register_operand" "")
5375           (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
5376                   (match_operand:SI 2 "general_operand" "")))
5377      (clobber (reg:CC 33))])]
5378   ""
5379   "")
5381 (define_insn "iorsi3_zarch"
5382   [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
5383         (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0,0")
5384                 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,d,R,T")))
5385    (clobber (reg:CC 33))]
5386   "TARGET_ZARCH"
5387   "@
5388    oilh\t%0,%i2
5389    oill\t%0,%i2
5390    or\t%0,%2
5391    o\t%0,%2
5392    oy\t%0,%2"
5393   [(set_attr "op_type"  "RI,RI,RR,RX,RXY")])
5395 (define_insn "iorsi3_esa"
5396   [(set (match_operand:SI 0 "register_operand" "=d,d")
5397         (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
5398                 (match_operand:SI 2 "general_operand" "d,R")))
5399    (clobber (reg:CC 33))]
5400   "!TARGET_ZARCH"
5401   "@
5402    or\t%0,%2
5403    o\t%0,%2"
5404   [(set_attr "op_type"  "RR,RX")])
5406 (define_insn "*iorsi3_ss"
5407   [(set (match_operand:SI 0 "s_operand" "=Q")
5408         (ior:SI (match_dup 0)
5409                 (match_operand:SI 1 "s_imm_operand" "Q")))
5410    (clobber (reg:CC 33))]
5411   ""
5412   "oc\t%O0(4,%R0),%1"
5413   [(set_attr "op_type"  "SS")])
5415 (define_insn "*iorsi3_ss_inv"
5416   [(set (match_operand:SI 0 "s_operand" "=Q")
5417         (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5418                 (match_dup 0)))
5419    (clobber (reg:CC 33))]
5420   ""
5421   "oc\t%O0(4,%R0),%1"
5422   [(set_attr "op_type"  "SS")])
5425 ; iorhi3 instruction pattern(s).
5428 (define_insn "*iorhi3_oi"
5429   [(set (match_operand:HI 0 "register_operand" "=d,d")
5430         (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5431                 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5432    (clobber (reg:CC 33))]
5433   "TARGET_ZARCH"
5434   "@
5435    or\t%0,%2
5436    oill\t%0,%x2"
5437   [(set_attr "op_type"  "RR,RI")])
5439 (define_insn "iorhi3"
5440   [(set (match_operand:HI 0 "register_operand" "=d")
5441         (ior:HI (match_operand:HI 1 "register_operand" "%0")
5442                 (match_operand:HI 2 "nonmemory_operand" "d")))
5443    (clobber (reg:CC 33))]
5444   ""
5445   "or\t%0,%2"
5446   [(set_attr "op_type"  "RR")])
5448 (define_insn "*iorhi3_ss"
5449   [(set (match_operand:HI 0 "s_operand" "=Q")
5450         (ior:HI (match_dup 0)
5451                 (match_operand:HI 1 "s_imm_operand" "Q")))
5452    (clobber (reg:CC 33))]
5453   ""
5454   "oc\t%O0(2,%R0),%1"
5455   [(set_attr "op_type"  "SS")])
5457 (define_insn "*iorhi3_ss_inv"
5458   [(set (match_operand:HI 0 "s_operand" "=Q")
5459         (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5460                 (match_dup 0)))
5461    (clobber (reg:CC 33))]
5462   ""
5463   "oc\t%O0(2,%R0),%1"
5464   [(set_attr "op_type"  "SS")])
5467 ; iorqi3 instruction pattern(s).
5470 (define_insn "*iorqi3_oi"
5471   [(set (match_operand:QI 0 "register_operand" "=d,d")
5472         (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5473                 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5474    (clobber (reg:CC 33))]
5475   "TARGET_ZARCH"
5476   "@
5477    or\t%0,%2
5478    oill\t%0,%b2"
5479   [(set_attr "op_type"  "RR,RI")])
5481 (define_insn "iorqi3"
5482   [(set (match_operand:QI 0 "register_operand" "=d")
5483         (ior:QI (match_operand:QI 1 "register_operand" "%0")
5484                 (match_operand:QI 2 "nonmemory_operand" "d")))
5485    (clobber (reg:CC 33))]
5486   ""
5487   "or\t%0,%2"
5488   [(set_attr "op_type"  "RR")])
5490 (define_insn "*iorqi3_ss"
5491   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5492         (ior:QI (match_dup 0)
5493                 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5494    (clobber (reg:CC 33))]
5495   ""
5496   "@
5497    oi\t%0,%b1
5498    oiy\t%0,%b1
5499    oc\t%O0(1,%R0),%1"
5500   [(set_attr "op_type"  "SI,SIY,SS")])
5502 (define_insn "*iorqi3_ss_inv"
5503   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5504         (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5505                 (match_dup 0)))
5506    (clobber (reg:CC 33))]
5507   ""
5508   "@
5509    oi\t%0,%b1
5510    oiy\t%0,%b1
5511    oc\t%O0(1,%R0),%1"
5512   [(set_attr "op_type"  "SI,SIY,SS")])
5516 ;;- Xor instructions.
5520 ; xordi3 instruction pattern(s).
5523 (define_insn "*xordi3_cc"
5524   [(set (reg 33)
5525         (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5526                          (match_operand:DI 2 "general_operand" "d,m"))
5527                  (const_int 0)))
5528    (set (match_operand:DI 0 "register_operand" "=d,d")
5529         (xor:DI (match_dup 1) (match_dup 2)))]
5530   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5531   "@
5532    xgr\t%0,%2
5533    xg\t%0,%2"
5534   [(set_attr "op_type"  "RRE,RXY")])
5536 (define_insn "*xordi3_cconly"
5537   [(set (reg 33)
5538         (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5539                          (match_operand:DI 2 "general_operand" "d,m"))
5540                  (const_int 0)))
5541    (clobber (match_scratch:DI 0 "=d,d"))]
5542   "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5543   "@
5544    xgr\t%0,%2
5545    xr\t%0,%2"
5546   [(set_attr "op_type"  "RRE,RXY")])
5548 (define_insn "xordi3"
5549   [(set (match_operand:DI 0 "register_operand" "=d,d")
5550         (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5551                 (match_operand:DI 2 "general_operand" "d,m")))
5552    (clobber (reg:CC 33))]
5553   "TARGET_64BIT"
5554   "@
5555    xgr\t%0,%2
5556    xg\t%0,%2"
5557   [(set_attr "op_type"  "RRE,RXY")])
5559 (define_insn "*xordi3_ss"
5560   [(set (match_operand:DI 0 "s_operand" "=Q")
5561         (xor:DI (match_dup 0)
5562                 (match_operand:DI 1 "s_imm_operand" "Q")))
5563    (clobber (reg:CC 33))]
5564   ""
5565   "xc\t%O0(8,%R0),%1"
5566   [(set_attr "op_type"  "SS")])
5568 (define_insn "*xordi3_ss_inv"
5569   [(set (match_operand:DI 0 "s_operand" "=Q")
5570         (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5571                 (match_dup 0)))
5572    (clobber (reg:CC 33))]
5573   ""
5574   "xc\t%O0(8,%R0),%1"
5575   [(set_attr "op_type"  "SS")])
5578 ; xorsi3 instruction pattern(s).
5581 (define_insn "*xorsi3_cc"
5582   [(set (reg 33)
5583         (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5584                          (match_operand:SI 2 "general_operand" "d,R,T"))
5585                  (const_int 0)))
5586    (set (match_operand:SI 0 "register_operand" "=d,d,d")
5587         (xor:SI (match_dup 1) (match_dup 2)))]
5588   "s390_match_ccmode(insn, CCTmode)"
5589   "@
5590    xr\t%0,%2
5591    x\t%0,%2
5592    xy\t%0,%2"
5593   [(set_attr "op_type"  "RR,RX,RXY")])
5595 (define_insn "*xorsi3_cconly"
5596   [(set (reg 33)
5597         (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5598                          (match_operand:SI 2 "general_operand" "d,R,T"))
5599                  (const_int 0)))
5600    (clobber (match_scratch:SI 0 "=d,d,d"))]
5601   "s390_match_ccmode(insn, CCTmode)"
5602   "@
5603    xr\t%0,%2
5604    x\t%0,%2
5605    xy\t%0,%2"
5606   [(set_attr "op_type"  "RR,RX,RXY")])
5608 (define_insn "xorsi3"
5609   [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5610         (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5611                 (match_operand:SI 2 "general_operand" "d,R,T")))
5612    (clobber (reg:CC 33))]
5613   ""
5614   "@
5615    xr\t%0,%2
5616    x\t%0,%2
5617    xy\t%0,%2"
5618   [(set_attr "op_type"  "RR,RX,RXY")])
5620 (define_insn "*xorsi3_ss"
5621   [(set (match_operand:SI 0 "s_operand" "=Q")
5622         (xor:SI (match_dup 0)
5623                 (match_operand:SI 1 "s_imm_operand" "Q")))
5624    (clobber (reg:CC 33))]
5625   ""
5626   "xc\t%O0(4,%R0),%1"
5627   [(set_attr "op_type"  "SS")])
5629 (define_insn "*xorsi3_ss_inv"
5630   [(set (match_operand:SI 0 "s_operand" "=Q")
5631         (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5632                 (match_dup 0)))
5633    (clobber (reg:CC 33))]
5634   ""
5635   "xc\t%O0(4,%R0),%1"
5636   [(set_attr "op_type"  "SS")])
5639 ; xorhi3 instruction pattern(s).
5642 (define_insn "xorhi3"
5643   [(set (match_operand:HI 0 "register_operand" "=d")
5644         (xor:HI (match_operand:HI 1 "register_operand" "%0")
5645                 (match_operand:HI 2 "nonmemory_operand" "d")))
5646    (clobber (reg:CC 33))]
5647   ""
5648   "xr\t%0,%2"
5649   [(set_attr "op_type"  "RR")])
5651 (define_insn "*xorhi3_ss"
5652   [(set (match_operand:HI 0 "s_operand" "=Q")
5653         (xor:HI (match_dup 0)
5654                 (match_operand:HI 1 "s_imm_operand" "Q")))
5655    (clobber (reg:CC 33))]
5656   ""
5657   "xc\t%O0(2,%R0),%1"
5658   [(set_attr "op_type"  "SS")])
5660 (define_insn "*xorhi3_ss_inv"
5661   [(set (match_operand:HI 0 "s_operand" "=Q")
5662         (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5663                 (match_dup 0)))
5664    (clobber (reg:CC 33))]
5665   ""
5666   "xc\t%O0(2,%R0),%1"
5667   [(set_attr "op_type"  "SS")])
5670 ; xorqi3 instruction pattern(s).
5673 (define_insn "xorqi3"
5674   [(set (match_operand:QI 0 "register_operand" "=d")
5675         (xor:QI (match_operand:QI 1 "register_operand" "%0")
5676                 (match_operand:QI 2 "nonmemory_operand" "d")))
5677    (clobber (reg:CC 33))]
5678   ""
5679   "xr\t%0,%2"
5680   [(set_attr "op_type"  "RR")])
5682 (define_insn "*xorqi3_ss"
5683   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5684         (xor:QI (match_dup 0)
5685                 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5686    (clobber (reg:CC 33))]
5687   ""
5688   "@
5689    xi\t%0,%b1
5690    xiy\t%0,%b1
5691    xc\t%O0(1,%R0),%1"
5692   [(set_attr "op_type"  "SI,SIY,SS")])
5694 (define_insn "*xorqi3_ss_inv"
5695   [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5696         (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5697                 (match_dup 0)))
5698    (clobber (reg:CC 33))]
5699   ""
5700   "@
5701    xi\t%0,%b1
5702    xiy\t%0,%b1
5703    xc\t%O0(1,%R0),%1"
5704   [(set_attr "op_type"  "SI,SIY,SS")])
5708 ;;- Negate instructions.
5712 ; negdi2 instruction pattern(s).
5715 (define_expand "negdi2"
5716   [(parallel
5717     [(set (match_operand:DI 0 "register_operand" "=d")
5718           (neg:DI (match_operand:DI 1 "register_operand" "d")))
5719      (clobber (reg:CC 33))])]
5720   ""
5721   "")
5723 (define_insn "*negdi2_64"
5724   [(set (match_operand:DI 0 "register_operand" "=d")
5725         (neg:DI (match_operand:DI 1 "register_operand" "d")))
5726    (clobber (reg:CC 33))]
5727   "TARGET_64BIT"
5728   "lcgr\t%0,%1"
5729   [(set_attr "op_type"  "RR")])
5731 (define_insn "*negdi2_31"
5732   [(set (match_operand:DI 0 "register_operand" "=d")
5733         (neg:DI (match_operand:DI 1 "register_operand" "d")))
5734    (clobber (reg:CC 33))]
5735   "!TARGET_64BIT"
5737   rtx xop[1];
5738   xop[0] = gen_label_rtx ();
5739   output_asm_insn ("lcr\t%0,%1", operands);
5740   output_asm_insn ("lcr\t%N0,%N1", operands);
5741   output_asm_insn ("je\t%l0", xop);
5742   output_asm_insn ("bctr\t%0,0", operands);
5743   targetm.asm_out.internal_label (asm_out_file, "L",
5744                              CODE_LABEL_NUMBER (xop[0]));
5745   return "";
5747   [(set_attr "op_type"  "NN")
5748    (set_attr "type"     "other")
5749    (set_attr "length"   "10")])
5752 ; negsi2 instruction pattern(s).
5755 (define_insn "negsi2"
5756   [(set (match_operand:SI 0 "register_operand" "=d")
5757         (neg:SI (match_operand:SI 1 "register_operand" "d")))
5758    (clobber (reg:CC 33))]
5759   ""
5760   "lcr\t%0,%1"
5761   [(set_attr "op_type"  "RR")])
5764 ; negdf2 instruction pattern(s).
5767 (define_expand "negdf2"
5768   [(parallel
5769     [(set (match_operand:DF 0 "register_operand" "=f")
5770           (neg:DF (match_operand:DF 1 "register_operand" "f")))
5771      (clobber (reg:CC 33))])]
5772   "TARGET_HARD_FLOAT"
5773   "")
5775 (define_insn "*negdf2"
5776   [(set (match_operand:DF 0 "register_operand" "=f")
5777         (neg:DF (match_operand:DF 1 "register_operand" "f")))
5778    (clobber (reg:CC 33))]
5779   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5780   "lcdbr\t%0,%1"
5781   [(set_attr "op_type"  "RRE")
5782    (set_attr "type"     "fsimpd")])
5784 (define_insn "*negdf2_ibm"
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 && TARGET_IBM_FLOAT"
5789   "lcdr\t%0,%1"
5790   [(set_attr "op_type"  "RR")
5791    (set_attr "type"     "fsimpd")])
5794 ; negsf2 instruction pattern(s).
5797 (define_expand "negsf2"
5798   [(parallel
5799     [(set (match_operand:SF 0 "register_operand" "=f")
5800           (neg:SF (match_operand:SF 1 "register_operand" "f")))
5801      (clobber (reg:CC 33))])]
5802   "TARGET_HARD_FLOAT"
5803   "")
5805 (define_insn "*negsf2"
5806   [(set (match_operand:SF 0 "register_operand" "=f")
5807         (neg:SF (match_operand:SF 1 "register_operand" "f")))
5808    (clobber (reg:CC 33))]
5809   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5810   "lcebr\t%0,%1"
5811   [(set_attr "op_type"  "RRE")
5812    (set_attr "type"     "fsimps")])
5814 (define_insn "*negsf2"
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 && TARGET_IBM_FLOAT"
5819   "lcer\t%0,%1"
5820   [(set_attr "op_type"  "RR")
5821    (set_attr "type"     "fsimps")])
5825 ;;- Absolute value instructions.
5829 ; absdi2 instruction pattern(s).
5832 (define_insn "absdi2"
5833   [(set (match_operand:DI 0 "register_operand" "=d")
5834         (abs:DI (match_operand:DI 1 "register_operand" "d")))
5835    (clobber (reg:CC 33))]
5836   "TARGET_64BIT"
5837   "lpgr\t%0,%1"
5838   [(set_attr "op_type"  "RRE")])
5841 ; abssi2 instruction pattern(s).
5844 (define_insn "abssi2"
5845   [(set (match_operand:SI 0 "register_operand" "=d")
5846         (abs:SI (match_operand:SI 1 "register_operand" "d")))
5847    (clobber (reg:CC 33))]
5848   ""
5849   "lpr\t%0,%1"
5850   [(set_attr "op_type"  "RR")])
5853 ; absdf2 instruction pattern(s).
5856 (define_expand "absdf2"
5857   [(parallel
5858     [(set (match_operand:DF 0 "register_operand" "=f")
5859           (abs:DF (match_operand:DF 1 "register_operand" "f")))
5860      (clobber (reg:CC 33))])]
5861   "TARGET_HARD_FLOAT"
5862   "")
5864 (define_insn "*absdf2"
5865   [(set (match_operand:DF 0 "register_operand" "=f")
5866         (abs:DF (match_operand:DF 1 "register_operand" "f")))
5867    (clobber (reg:CC 33))]
5868   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5869   "lpdbr\t%0,%1"
5870   [(set_attr "op_type"  "RRE")
5871    (set_attr "type"     "fsimpd")])
5873 (define_insn "*absdf2_ibm"
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 && TARGET_IBM_FLOAT"
5878   "lpdr\t%0,%1"
5879   [(set_attr "op_type"  "RR")
5880    (set_attr "type"     "fsimpd")])
5883 ; abssf2 instruction pattern(s).
5886 (define_expand "abssf2"
5887   [(parallel
5888     [(set (match_operand:SF 0 "register_operand" "=f")
5889           (abs:SF (match_operand:SF 1 "register_operand" "f")))
5890      (clobber (reg:CC 33))])]
5891   "TARGET_HARD_FLOAT"
5892   "")
5894 (define_insn "*abssf2"
5895   [(set (match_operand:SF 0 "register_operand" "=f")
5896         (abs:SF (match_operand:SF 1 "register_operand" "f")))
5897    (clobber (reg:CC 33))]
5898   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5899   "lpebr\t%0,%1"
5900   [(set_attr "op_type"  "RRE")
5901    (set_attr "type"     "fsimps")])
5903 (define_insn "*abssf2_ibm"
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 && TARGET_IBM_FLOAT"
5908   "lper\t%0,%1"
5909   [(set_attr "op_type"  "RR")
5910    (set_attr "type"     "fsimps")])
5913 ;;- Negated absolute value instructions
5917 ; Integer
5920 (define_insn "*negabssi2"
5921   [(set (match_operand:SI 0 "register_operand" "=d")
5922         (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
5923    (clobber (reg:CC 33))]
5924   ""
5925   "lnr\t%0,%1"
5926   [(set_attr "op_type" "RR")])
5928 (define_insn "*negabsdi2"
5929   [(set (match_operand:DI 0 "register_operand" "=d")
5930         (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
5931    (clobber (reg:CC 33))]
5932   "TARGET_64BIT"
5933   "lngr\t%0,%1"
5934   [(set_attr "op_type" "RRE")])
5937 ; Floating point
5940 (define_insn "*negabssf2"
5941   [(set (match_operand:SF 0 "register_operand" "=f")
5942         (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5943    (clobber (reg:CC 33))]
5944   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5945   "lnebr\t%0,%1"
5946   [(set_attr "op_type"  "RRE")
5947    (set_attr "type"     "fsimps")])
5949 (define_insn "*negabsdf2"
5950   [(set (match_operand:DF 0 "register_operand" "=f")
5951         (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5952    (clobber (reg:CC 33))]
5953   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5954   "lndbr\t%0,%1"
5955   [(set_attr "op_type"  "RRE")
5956    (set_attr "type"     "fsimpd")])
5959 ;;- Square root instructions.
5963 ; sqrtdf2 instruction pattern(s).
5966 (define_insn "sqrtdf2"
5967   [(set (match_operand:DF 0 "register_operand" "=f,f")
5968         (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
5969   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5970   "@
5971    sqdbr\t%0,%1
5972    sqdb\t%0,%1"
5973   [(set_attr "op_type"  "RRE,RXE")])
5976 ; sqrtsf2 instruction pattern(s).
5979 (define_insn "sqrtsf2"
5980   [(set (match_operand:SF 0 "register_operand" "=f,f")
5981         (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
5982   "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5983   "@
5984    sqebr\t%0,%1
5985    sqeb\t%0,%1"
5986   [(set_attr "op_type"  "RRE,RXE")])
5989 ;;- One complement instructions.
5993 ; one_cmpldi2 instruction pattern(s).
5996 (define_expand "one_cmpldi2"
5997   [(parallel
5998     [(set (match_operand:DI 0 "register_operand" "")
5999           (xor:DI (match_operand:DI 1 "register_operand" "")
6000                   (const_int -1)))
6001      (clobber (reg:CC 33))])]
6002   "TARGET_64BIT"
6003   "")
6006 ; one_cmplsi2 instruction pattern(s).
6009 (define_expand "one_cmplsi2"
6010   [(parallel
6011     [(set (match_operand:SI 0 "register_operand" "")
6012           (xor:SI (match_operand:SI 1 "register_operand" "")
6013                   (const_int -1)))
6014      (clobber (reg:CC 33))])]
6015   ""
6016   "")
6019 ; one_cmplhi2 instruction pattern(s).
6022 (define_expand "one_cmplhi2"
6023   [(parallel
6024     [(set (match_operand:HI 0 "register_operand" "")
6025           (xor:HI (match_operand:HI 1 "register_operand" "")
6026                   (const_int -1)))
6027      (clobber (reg:CC 33))])]
6028   ""
6029   "")
6032 ; one_cmplqi2 instruction pattern(s).
6035 (define_expand "one_cmplqi2"
6036   [(parallel
6037     [(set (match_operand:QI 0 "register_operand" "")
6038           (xor:QI (match_operand:QI 1 "register_operand" "")
6039                   (const_int -1)))
6040      (clobber (reg:CC 33))])]
6041   ""
6042   "")
6046 ;;- Rotate instructions.
6050 ; rotldi3 instruction pattern(s).
6053 (define_insn "rotldi3"
6054   [(set (match_operand:DI 0 "register_operand" "=d")
6055         (rotate:DI (match_operand:DI 1 "register_operand" "d")
6056                    (match_operand:SI 2 "shift_count_operand" "Y")))]
6057   "TARGET_64BIT"
6058   "rllg\t%0,%1,%Y2"
6059   [(set_attr "op_type"  "RSE")
6060    (set_attr "atype"    "reg")])
6063 ; rotlsi3 instruction pattern(s).
6066 (define_insn "rotlsi3"
6067   [(set (match_operand:SI 0 "register_operand" "=d")
6068         (rotate:SI (match_operand:SI 1 "register_operand" "d")
6069                    (match_operand:SI 2 "shift_count_operand" "Y")))]
6070   "TARGET_CPU_ZARCH"
6071   "rll\t%0,%1,%Y2"
6072   [(set_attr "op_type"  "RSE")
6073    (set_attr "atype"    "reg")])
6077 ;;- Arithmetic shift instructions.
6081 ; ashldi3 instruction pattern(s).
6084 (define_expand "ashldi3"
6085   [(set (match_operand:DI 0 "register_operand" "")
6086         (ashift:DI (match_operand:DI 1 "register_operand" "")
6087                    (match_operand:SI 2 "shift_count_operand" "")))]
6088   ""
6089   "")
6091 (define_insn "*ashldi3_31"
6092   [(set (match_operand:DI 0 "register_operand" "=d")
6093         (ashift:DI (match_operand:DI 1 "register_operand" "0")
6094                    (match_operand:SI 2 "shift_count_operand" "Y")))]
6095   "!TARGET_64BIT"
6096   "sldl\t%0,%Y2"
6097   [(set_attr "op_type"  "RS")
6098    (set_attr "atype"    "reg")])
6100 (define_insn "*ashldi3_64"
6101   [(set (match_operand:DI 0 "register_operand" "=d")
6102         (ashift:DI (match_operand:DI 1 "register_operand" "d")
6103                    (match_operand:SI 2 "shift_count_operand" "Y")))]
6104   "TARGET_64BIT"
6105   "sllg\t%0,%1,%Y2"
6106   [(set_attr "op_type"  "RSE")
6107    (set_attr "atype"    "reg")])
6110 ; ashrdi3 instruction pattern(s).
6113 (define_expand "ashrdi3"
6114   [(parallel
6115     [(set (match_operand:DI 0 "register_operand" "")
6116           (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6117                        (match_operand:SI 2 "shift_count_operand" "")))
6118      (clobber (reg:CC 33))])]
6119   ""
6120   "")
6122 (define_insn "*ashrdi3_cc_31"
6123   [(set (reg 33)
6124         (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6125                               (match_operand:SI 2 "shift_count_operand" "Y"))
6126                  (const_int 0)))
6127    (set (match_operand:DI 0 "register_operand" "=d")
6128         (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6129   "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6130   "srda\t%0,%Y2"
6131   [(set_attr "op_type"  "RS")
6132    (set_attr "atype"    "reg")])
6134 (define_insn "*ashrdi3_cconly_31"
6135   [(set (reg 33)
6136         (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6137                               (match_operand:SI 2 "shift_count_operand" "Y"))
6138                  (const_int 0)))
6139    (clobber (match_scratch:DI 0 "=d"))]
6140   "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6141   "srda\t%0,%Y2"
6142   [(set_attr "op_type"  "RS")
6143    (set_attr "atype"    "reg")])
6145 (define_insn "*ashrdi3_31"
6146   [(set (match_operand:DI 0 "register_operand" "=d")
6147         (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6148                      (match_operand:SI 2 "shift_count_operand" "Y")))
6149    (clobber (reg:CC 33))]
6150   "!TARGET_64BIT"
6151   "srda\t%0,%Y2"
6152   [(set_attr "op_type"  "RS")
6153    (set_attr "atype"    "reg")])
6155 (define_insn "*ashrdi3_cc_64"
6156   [(set (reg 33)
6157         (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6158                               (match_operand:SI 2 "shift_count_operand" "Y"))
6159                  (const_int 0)))
6160    (set (match_operand:DI 0 "register_operand" "=d")
6161         (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6162   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6163   "srag\t%0,%1,%Y2"
6164   [(set_attr "op_type"  "RSE")
6165    (set_attr "atype"    "reg")])
6167 (define_insn "*ashrdi3_cconly_64"
6168   [(set (reg 33)
6169         (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6170                               (match_operand:SI 2 "shift_count_operand" "Y"))
6171                  (const_int 0)))
6172    (clobber (match_scratch:DI 0 "=d"))]
6173   "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6174   "srag\t%0,%1,%Y2"
6175   [(set_attr "op_type"  "RSE")
6176    (set_attr "atype"    "reg")])
6178 (define_insn "*ashrdi3_64"
6179   [(set (match_operand:DI 0 "register_operand" "=d")
6180         (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6181                      (match_operand:SI 2 "shift_count_operand" "Y")))
6182    (clobber (reg:CC 33))]
6183   "TARGET_64BIT"
6184   "srag\t%0,%1,%Y2"
6185   [(set_attr "op_type"  "RSE")
6186    (set_attr "atype"    "reg")])
6190 ; ashlsi3 instruction pattern(s).
6193 (define_insn "ashlsi3"
6194   [(set (match_operand:SI 0 "register_operand" "=d")
6195         (ashift:SI (match_operand:SI 1 "register_operand" "0")
6196                    (match_operand:SI 2 "shift_count_operand" "Y")))]
6197   ""
6198   "sll\t%0,%Y2"
6199   [(set_attr "op_type"  "RS")
6200    (set_attr "atype"    "reg")])
6203 ; ashrsi3 instruction pattern(s).
6206 (define_insn "*ashrsi3_cc"
6207   [(set (reg 33)
6208         (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6209                               (match_operand:SI 2 "shift_count_operand" "Y"))
6210                  (const_int 0)))
6211    (set (match_operand:SI 0 "register_operand" "=d")
6212         (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6213   "s390_match_ccmode(insn, CCSmode)"
6214   "sra\t%0,%Y2"
6215   [(set_attr "op_type"  "RS")
6216    (set_attr "atype"    "reg")])
6219 (define_insn "*ashrsi3_cconly"
6220   [(set (reg 33)
6221         (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6222                               (match_operand:SI 2 "shift_count_operand" "Y"))
6223                  (const_int 0)))
6224    (clobber (match_scratch:SI 0 "=d"))]
6225   "s390_match_ccmode(insn, CCSmode)"
6226   "sra\t%0,%Y2"
6227   [(set_attr "op_type"  "RS")
6228    (set_attr "atype"    "reg")])
6230 (define_insn "ashrsi3"
6231   [(set (match_operand:SI 0 "register_operand" "=d")
6232         (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6233                      (match_operand:SI 2 "shift_count_operand" "Y")))
6234    (clobber (reg:CC 33))]
6235   ""
6236   "sra\t%0,%Y2"
6237   [(set_attr "op_type"  "RS")
6238    (set_attr "atype"    "reg")])
6242 ;;- logical shift instructions.
6246 ; lshrdi3 instruction pattern(s).
6249 (define_expand "lshrdi3"
6250   [(set (match_operand:DI 0 "register_operand" "")
6251         (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6252                      (match_operand:SI 2 "shift_count_operand" "")))]
6253   ""
6254   "")
6256 (define_insn "*lshrdi3_31"
6257   [(set (match_operand:DI 0 "register_operand" "=d")
6258         (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6259                      (match_operand:SI 2 "shift_count_operand" "Y")))]
6260   "!TARGET_64BIT"
6261   "srdl\t%0,%Y2"
6262    [(set_attr "op_type"  "RS")
6263     (set_attr "atype"    "reg")])
6265 (define_insn "*lshrdi3_64"
6266   [(set (match_operand:DI 0 "register_operand" "=d")
6267         (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6268                      (match_operand:SI 2 "shift_count_operand" "Y")))]
6269   "TARGET_64BIT"
6270   "srlg\t%0,%1,%Y2"
6271   [(set_attr "op_type"  "RSE")
6272    (set_attr "atype"    "reg")])
6275 ; lshrsi3 instruction pattern(s).
6278 (define_insn "lshrsi3"
6279   [(set (match_operand:SI 0 "register_operand" "=d")
6280         (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6281                      (match_operand:SI 2 "shift_count_operand" "Y")))]
6282   ""
6283   "srl\t%0,%Y2"
6284   [(set_attr "op_type"  "RS")
6285    (set_attr "atype"    "reg")])
6289 ;; Branch instruction patterns.
6292 (define_expand "beq"
6293   [(match_operand 0 "" "")]
6294   ""
6295   "s390_emit_jump (operands[0],
6296     s390_emit_compare (EQ, s390_compare_op0, s390_compare_op1)); DONE;")
6298 (define_expand "bne"
6299   [(match_operand 0 "" "")]
6300   ""
6301   "s390_emit_jump (operands[0],
6302     s390_emit_compare (NE, s390_compare_op0, s390_compare_op1)); DONE;")
6304 (define_expand "bgt"
6305   [(match_operand 0 "" "")]
6306   ""
6307   "s390_emit_jump (operands[0],
6308     s390_emit_compare (GT, s390_compare_op0, s390_compare_op1)); DONE;")
6310 (define_expand "bgtu"
6311   [(match_operand 0 "" "")]
6312   ""
6313   "s390_emit_jump (operands[0],
6314     s390_emit_compare (GTU, s390_compare_op0, s390_compare_op1)); DONE;")
6316 (define_expand "blt"
6317   [(match_operand 0 "" "")]
6318   ""
6319   "s390_emit_jump (operands[0],
6320     s390_emit_compare (LT, s390_compare_op0, s390_compare_op1)); DONE;")
6322 (define_expand "bltu"
6323   [(match_operand 0 "" "")]
6324   ""
6325   "s390_emit_jump (operands[0],
6326     s390_emit_compare (LTU, s390_compare_op0, s390_compare_op1)); DONE;")
6328 (define_expand "bge"
6329   [(match_operand 0 "" "")]
6330   ""
6331   "s390_emit_jump (operands[0],
6332     s390_emit_compare (GE, s390_compare_op0, s390_compare_op1)); DONE;")
6334 (define_expand "bgeu"
6335   [(match_operand 0 "" "")]
6336   ""
6337   "s390_emit_jump (operands[0],
6338     s390_emit_compare (GEU, s390_compare_op0, s390_compare_op1)); DONE;")
6340 (define_expand "ble"
6341   [(match_operand 0 "" "")]
6342   ""
6343   "s390_emit_jump (operands[0],
6344     s390_emit_compare (LE, s390_compare_op0, s390_compare_op1)); DONE;")
6346 (define_expand "bleu"
6347   [(match_operand 0 "" "")]
6348   ""
6349   "s390_emit_jump (operands[0],
6350     s390_emit_compare (LEU, s390_compare_op0, s390_compare_op1)); DONE;")
6352 (define_expand "bunordered"
6353   [(match_operand 0 "" "")]
6354   ""
6355   "s390_emit_jump (operands[0],
6356     s390_emit_compare (UNORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6358 (define_expand "bordered"
6359   [(match_operand 0 "" "")]
6360   ""
6361   "s390_emit_jump (operands[0],
6362     s390_emit_compare (ORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6364 (define_expand "buneq"
6365   [(match_operand 0 "" "")]
6366   ""
6367   "s390_emit_jump (operands[0],
6368     s390_emit_compare (UNEQ, s390_compare_op0, s390_compare_op1)); DONE;")
6370 (define_expand "bunlt"
6371   [(match_operand 0 "" "")]
6372   ""
6373   "s390_emit_jump (operands[0],
6374     s390_emit_compare (UNLT, s390_compare_op0, s390_compare_op1)); DONE;")
6376 (define_expand "bungt"
6377   [(match_operand 0 "" "")]
6378   ""
6379   "s390_emit_jump (operands[0],
6380     s390_emit_compare (UNGT, s390_compare_op0, s390_compare_op1)); DONE;")
6382 (define_expand "bunle"
6383   [(match_operand 0 "" "")]
6384   ""
6385   "s390_emit_jump (operands[0],
6386     s390_emit_compare (UNLE, s390_compare_op0, s390_compare_op1)); DONE;")
6388 (define_expand "bunge"
6389   [(match_operand 0 "" "")]
6390   ""
6391   "s390_emit_jump (operands[0],
6392     s390_emit_compare (UNGE, s390_compare_op0, s390_compare_op1)); DONE;")
6394 (define_expand "bltgt"
6395   [(match_operand 0 "" "")]
6396   ""
6397   "s390_emit_jump (operands[0],
6398     s390_emit_compare (LTGT, s390_compare_op0, s390_compare_op1)); DONE;")
6402 ;;- Conditional jump instructions.
6405 (define_insn "*cjump_64"
6406   [(set (pc)
6407         (if_then_else
6408           (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6409           (label_ref (match_operand 0 "" ""))
6410           (pc)))]
6411   "TARGET_CPU_ZARCH"
6413   if (get_attr_length (insn) == 4)
6414     return "j%C1\t%l0";
6415   else
6416     return "jg%C1\t%l0";
6418   [(set_attr "op_type" "RI")
6419    (set_attr "type"    "branch")
6420    (set (attr "length")
6421         (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6422                       (const_int 4) (const_int 6)))])
6424 (define_insn "*cjump_31"
6425   [(set (pc)
6426         (if_then_else
6427           (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6428           (label_ref (match_operand 0 "" ""))
6429           (pc)))]
6430   "!TARGET_CPU_ZARCH"
6432   if (get_attr_length (insn) == 4)
6433     return "j%C1\t%l0";
6434   else
6435     abort ();
6437   [(set_attr "op_type" "RI")
6438    (set_attr "type"    "branch")
6439    (set (attr "length")
6440         (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6441           (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6442                         (const_int 4) (const_int 6))
6443           (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6444                         (const_int 4) (const_int 8))))])
6446 (define_insn "*cjump_long"
6447   [(set (pc)
6448         (if_then_else
6449           (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6450           (match_operand 0 "address_operand" "U")
6451           (pc)))]
6452   ""
6454   if (get_attr_op_type (insn) == OP_TYPE_RR)
6455     return "b%C1r\t%0";
6456   else
6457     return "b%C1\t%a0";
6459   [(set (attr "op_type")
6460         (if_then_else (match_operand 0 "register_operand" "")
6461                       (const_string "RR") (const_string "RX")))
6462    (set_attr "type"  "branch")
6463    (set_attr "atype" "agen")])
6467 ;;- Negated conditional jump instructions.
6470 (define_insn "*icjump_64"
6471   [(set (pc)
6472         (if_then_else
6473           (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6474           (pc)
6475           (label_ref (match_operand 0 "" ""))))]
6476   "TARGET_CPU_ZARCH"
6478   if (get_attr_length (insn) == 4)
6479     return "j%D1\t%l0";
6480   else
6481     return "jg%D1\t%l0";
6483   [(set_attr "op_type" "RI")
6484    (set_attr "type"    "branch")
6485    (set (attr "length")
6486         (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6487                       (const_int 4) (const_int 6)))])
6489 (define_insn "*icjump_31"
6490   [(set (pc)
6491         (if_then_else
6492           (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6493           (pc)
6494           (label_ref (match_operand 0 "" ""))))]
6495   "!TARGET_CPU_ZARCH"
6497   if (get_attr_length (insn) == 4)
6498     return "j%D1\t%l0";
6499   else
6500     abort ();
6502   [(set_attr "op_type" "RI")
6503    (set_attr "type"    "branch")
6504    (set (attr "length")
6505         (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6506           (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6507                         (const_int 4) (const_int 6))
6508           (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6509                         (const_int 4) (const_int 8))))])
6511 (define_insn "*icjump_long"
6512   [(set (pc)
6513         (if_then_else
6514           (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6515           (pc)
6516           (match_operand 0 "address_operand" "U")))]
6517   ""
6519   if (get_attr_op_type (insn) == OP_TYPE_RR)
6520     return "b%D1r\t%0";
6521   else
6522     return "b%D1\t%a0";
6524   [(set (attr "op_type")
6525         (if_then_else (match_operand 0 "register_operand" "")
6526                       (const_string "RR") (const_string "RX")))
6527    (set_attr "type"  "branch")
6528    (set_attr "atype" "agen")])
6531 ;;- Trap instructions.
6534 (define_insn "trap"
6535   [(trap_if (const_int 1) (const_int 0))]
6536   ""
6537   "j\t.+2"
6538   [(set_attr "op_type" "RI")
6539    (set_attr "type"  "branch")])
6541 (define_expand "conditional_trap"
6542   [(trap_if (match_operand 0 "comparison_operator" "")
6543             (match_operand 1 "general_operand" ""))]
6544   ""
6546   if (operands[1] != const0_rtx) FAIL;
6547   operands[0] = s390_emit_compare (GET_CODE (operands[0]), 
6548                                    s390_compare_op0, s390_compare_op1);
6551 (define_insn "*trap"
6552   [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6553             (const_int 0))]
6554   ""
6555   "j%C0\t.+2";
6556   [(set_attr "op_type" "RI")
6557    (set_attr "type"  "branch")])
6560 ;;- Loop instructions.
6562 ;;  This is all complicated by the fact that since this is a jump insn
6563 ;;  we must handle our own output reloads.
6565 (define_expand "doloop_end"
6566   [(use (match_operand 0 "" ""))        ; loop pseudo
6567    (use (match_operand 1 "" ""))        ; iterations; zero if unknown
6568    (use (match_operand 2 "" ""))        ; max iterations
6569    (use (match_operand 3 "" ""))        ; loop level
6570    (use (match_operand 4 "" ""))]       ; label
6571   ""
6573   if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
6574     emit_jump_insn (gen_doloop_si31 (operands[4], operands[0], operands[0]));
6575   else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
6576     emit_jump_insn (gen_doloop_si64 (operands[4], operands[0], operands[0]));
6577   else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6578     emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6579   else
6580     FAIL;
6582   DONE;
6585 (define_insn_and_split "doloop_si64"
6586   [(set (pc)
6587         (if_then_else
6588           (ne (match_operand:SI 1 "register_operand" "d,d")
6589               (const_int 1))
6590           (label_ref (match_operand 0 "" ""))
6591           (pc)))
6592    (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6593         (plus:SI (match_dup 1) (const_int -1)))
6594    (clobber (match_scratch:SI 3 "=X,&d"))
6595    (clobber (reg:CC 33))]
6596   "TARGET_CPU_ZARCH"
6598   if (which_alternative != 0)
6599     return "#";
6600   else if (get_attr_length (insn) == 4)
6601     return "brct\t%1,%l0";
6602   else
6603     return "ahi\t%1,-1\;jgne\t%l0";
6605   "&& reload_completed
6606    && (! REG_P (operands[2])
6607        || ! rtx_equal_p (operands[1], operands[2]))"
6608   [(set (match_dup 3) (match_dup 1))
6609    (parallel [(set (reg:CCAN 33)
6610                    (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6611                                  (const_int 0)))
6612               (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6613    (set (match_dup 2) (match_dup 3))
6614    (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6615                            (label_ref (match_dup 0))
6616                            (pc)))]
6617   ""
6618   [(set_attr "op_type"  "RI")
6619    (set_attr "type"  "branch")
6620    (set (attr "length")
6621         (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6622                       (const_int 4) (const_int 10)))])
6624 (define_insn_and_split "doloop_si31"
6625   [(set (pc)
6626         (if_then_else
6627           (ne (match_operand:SI 1 "register_operand" "d,d")
6628               (const_int 1))
6629           (label_ref (match_operand 0 "" ""))
6630           (pc)))
6631    (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6632         (plus:SI (match_dup 1) (const_int -1)))
6633    (clobber (match_scratch:SI 3 "=X,&d"))
6634    (clobber (reg:CC 33))]
6635   "!TARGET_CPU_ZARCH"
6637   if (which_alternative != 0)
6638     return "#";
6639   else if (get_attr_length (insn) == 4)
6640     return "brct\t%1,%l0";
6641   else
6642     abort ();
6644   "&& reload_completed
6645    && (! REG_P (operands[2])
6646        || ! rtx_equal_p (operands[1], operands[2]))"
6647   [(set (match_dup 3) (match_dup 1))
6648    (parallel [(set (reg:CCAN 33)
6649                    (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6650                                  (const_int 0)))
6651               (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6652    (set (match_dup 2) (match_dup 3))
6653    (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6654                            (label_ref (match_dup 0))
6655                            (pc)))]
6656   ""
6657   [(set_attr "op_type"  "RI")
6658    (set_attr "type"  "branch")
6659    (set (attr "length")
6660         (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6661           (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6662                         (const_int 4) (const_int 6))
6663           (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6664                         (const_int 4) (const_int 8))))])
6666 (define_insn "*doloop_si_long"
6667   [(set (pc)
6668         (if_then_else
6669           (ne (match_operand:SI 1 "register_operand" "d,d")
6670               (const_int 1))
6671           (match_operand 0 "address_operand" "U,U")
6672           (pc)))
6673    (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6674         (plus:SI (match_dup 1) (const_int -1)))
6675    (clobber (match_scratch:SI 3 "=X,&d"))
6676    (clobber (reg:CC 33))]
6677   "!TARGET_CPU_ZARCH"
6679   if (get_attr_op_type (insn) == OP_TYPE_RR)
6680     return "bctr\t%1,%0";
6681   else
6682     return "bct\t%1,%a0";
6684   [(set (attr "op_type")
6685         (if_then_else (match_operand 0 "register_operand" "")
6686                       (const_string "RR") (const_string "RX")))
6687    (set_attr "type"  "branch")
6688    (set_attr "atype" "agen")])
6690 (define_insn_and_split "doloop_di"
6691   [(set (pc)
6692         (if_then_else
6693           (ne (match_operand:DI 1 "register_operand" "d,d")
6694               (const_int 1))
6695           (label_ref (match_operand 0 "" ""))
6696           (pc)))
6697    (set (match_operand:DI 2 "nonimmediate_operand" "=1,?*m*r")
6698         (plus:DI (match_dup 1) (const_int -1)))
6699    (clobber (match_scratch:DI 3 "=X,&d"))
6700    (clobber (reg:CC 33))]
6701   "TARGET_64BIT"
6703   if (which_alternative != 0)
6704     return "#";
6705   else if (get_attr_length (insn) == 4)
6706     return "brctg\t%1,%l0";
6707   else
6708     return "aghi\t%1,-1\;jgne\t%l0";
6710   "&& reload_completed
6711    && (! REG_P (operands[2])
6712        || ! rtx_equal_p (operands[1], operands[2]))"
6713   [(set (match_dup 3) (match_dup 1))
6714    (parallel [(set (reg:CCAN 33)
6715                    (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6716                                  (const_int 0)))
6717               (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6718    (set (match_dup 2) (match_dup 3))
6719    (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6720                            (label_ref (match_dup 0))
6721                            (pc)))]
6722   ""
6723   [(set_attr "op_type"  "RI")
6724    (set_attr "type"  "branch")
6725    (set (attr "length")
6726         (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6727                       (const_int 4) (const_int 10)))])
6730 ;;- Unconditional jump instructions.
6734 ; jump instruction pattern(s).
6737 (define_expand "jump"
6738   [(match_operand 0 "" "")]
6739   ""
6740   "s390_emit_jump (operands[0], NULL_RTX); DONE;")
6742 (define_insn "*jump64"
6743   [(set (pc) (label_ref (match_operand 0 "" "")))]
6744   "TARGET_CPU_ZARCH"
6746   if (get_attr_length (insn) == 4)
6747     return "j\t%l0";
6748   else
6749     return "jg\t%l0";
6751   [(set_attr "op_type" "RI")
6752    (set_attr "type"  "branch")
6753    (set (attr "length")
6754         (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6755                       (const_int 4) (const_int 6)))])
6757 (define_insn "*jump31"
6758   [(set (pc) (label_ref (match_operand 0 "" "")))]
6759   "!TARGET_CPU_ZARCH"
6761   if (get_attr_length (insn) == 4)
6762     return "j\t%l0";
6763   else
6764     abort ();
6766   [(set_attr "op_type" "RI")
6767    (set_attr "type"  "branch")
6768    (set (attr "length")
6769         (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6770           (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6771                         (const_int 4) (const_int 6))
6772           (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6773                         (const_int 4) (const_int 8))))])
6776 ; indirect-jump instruction pattern(s).
6779 (define_insn "indirect_jump"
6780  [(set (pc) (match_operand 0 "address_operand" "U"))]
6781   ""
6783   if (get_attr_op_type (insn) == OP_TYPE_RR)
6784     return "br\t%0";
6785   else
6786     return "b\t%a0";
6788   [(set (attr "op_type")
6789         (if_then_else (match_operand 0 "register_operand" "")
6790                       (const_string "RR") (const_string "RX")))
6791    (set_attr "type"  "branch")
6792    (set_attr "atype" "agen")])
6795 ; casesi instruction pattern(s).
6798 (define_insn "casesi_jump"
6799  [(set (pc) (match_operand 0 "address_operand" "U"))
6800    (use (label_ref (match_operand 1 "" "")))]
6801   ""
6803   if (get_attr_op_type (insn) == OP_TYPE_RR)
6804     return "br\t%0";
6805   else
6806     return "b\t%a0";
6808   [(set (attr "op_type")
6809         (if_then_else (match_operand 0 "register_operand" "")
6810                       (const_string "RR") (const_string "RX")))
6811    (set_attr "type"  "branch")
6812    (set_attr "atype" "agen")])
6814 (define_expand "casesi"
6815   [(match_operand:SI 0 "general_operand" "")
6816    (match_operand:SI 1 "general_operand" "")
6817    (match_operand:SI 2 "general_operand" "")
6818    (label_ref (match_operand 3 "" ""))
6819    (label_ref (match_operand 4 "" ""))]
6820   ""
6822    rtx index  = gen_reg_rtx (SImode);
6823    rtx base   = gen_reg_rtx (Pmode);
6824    rtx target = gen_reg_rtx (Pmode);
6826    emit_move_insn (index, operands[0]);
6827    emit_insn (gen_subsi3 (index, index, operands[1]));
6828    emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6829                             operands[4]);
6831    if (Pmode != SImode)
6832      index = convert_to_mode (Pmode, index, 1);
6833    if (GET_CODE (index) != REG)
6834      index = copy_to_mode_reg (Pmode, index);
6836    if (TARGET_64BIT)
6837        emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6838    else
6839        emit_insn (gen_ashlsi3 (index, index, const2_rtx));
6841    emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6843    index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
6844    emit_move_insn (target, index);
6846    if (flag_pic)
6847      target = gen_rtx_PLUS (Pmode, base, target);
6848    emit_jump_insn (gen_casesi_jump (target, operands[3]));
6850    DONE;
6855 ;;- Jump to subroutine.
6860 ; untyped call instruction pattern(s).
6863 ;; Call subroutine returning any type.
6864 (define_expand "untyped_call"
6865   [(parallel [(call (match_operand 0 "" "")
6866                     (const_int 0))
6867               (match_operand 1 "" "")
6868               (match_operand 2 "" "")])]
6869   ""
6871   int i;
6873   emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6875   for (i = 0; i < XVECLEN (operands[2], 0); i++)
6876     {
6877       rtx set = XVECEXP (operands[2], 0, i);
6878       emit_move_insn (SET_DEST (set), SET_SRC (set));
6879     }
6881   /* The optimizer does not know that the call sets the function value
6882      registers we stored in the result block.  We avoid problems by
6883      claiming that all hard registers are used and clobbered at this
6884      point.  */
6885   emit_insn (gen_blockage ());
6887   DONE;
6890 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6891 ;; all of memory.  This blocks insns from being moved across this point.
6893 (define_insn "blockage"
6894   [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6895   ""
6896   ""
6897   [(set_attr "type"    "none")
6898    (set_attr "length"  "0")])
6901 ; sibcall patterns
6904 (define_expand "sibcall"
6905   [(call (match_operand 0 "" "")
6906          (match_operand 1 "" ""))]
6907   ""
6909   s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
6910   DONE;
6913 (define_insn "*sibcall_br"
6914   [(call (mem:QI (reg 1))
6915          (match_operand 0 "const_int_operand" "n"))]
6916   "SIBLING_CALL_P (insn)
6917    && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
6918   "br\t%%r1"
6919   [(set_attr "op_type" "RR")
6920    (set_attr "type"  "branch")
6921    (set_attr "atype" "agen")])
6923 (define_insn "*sibcall_brc"
6924   [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6925          (match_operand 1 "const_int_operand" "n"))]
6926   "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
6927   "j\t%0"
6928   [(set_attr "op_type" "RI")
6929    (set_attr "type"    "branch")])
6931 (define_insn "*sibcall_brcl"
6932   [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
6933          (match_operand 1 "const_int_operand" "n"))]
6934   "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
6935   "jg\t%0"
6936   [(set_attr "op_type" "RIL")
6937    (set_attr "type"    "branch")])
6940 ; sibcall_value patterns
6943 (define_expand "sibcall_value"
6944   [(set (match_operand 0 "" "")
6945         (call (match_operand 1 "" "")
6946               (match_operand 2 "" "")))]
6947   ""
6949   s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
6950   DONE;
6953 (define_insn "*sibcall_value_br"
6954   [(set (match_operand 0 "" "")
6955         (call (mem:QI (reg 1))
6956               (match_operand 1 "const_int_operand" "n")))]
6957   "SIBLING_CALL_P (insn)
6958    && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
6959   "br\t%%r1"
6960   [(set_attr "op_type" "RR")
6961    (set_attr "type"  "branch")
6962    (set_attr "atype" "agen")])
6964 (define_insn "*sibcall_value_brc"
6965   [(set (match_operand 0 "" "")
6966         (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
6967               (match_operand 2 "const_int_operand" "n")))]
6968   "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
6969   "j\t%1"
6970   [(set_attr "op_type" "RI")
6971    (set_attr "type"    "branch")])
6973 (define_insn "*sibcall_value_brcl"
6974   [(set (match_operand 0 "" "")
6975         (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
6976               (match_operand 2 "const_int_operand" "n")))]
6977   "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
6978   "jg\t%1"
6979   [(set_attr "op_type" "RIL")
6980    (set_attr "type"    "branch")])
6984 ; call instruction pattern(s).
6987 (define_expand "call"
6988   [(call (match_operand 0 "" "")
6989          (match_operand 1 "" ""))
6990    (use (match_operand 2 "" ""))]
6991   ""
6993   s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
6994                   gen_rtx_REG (Pmode, RETURN_REGNUM));
6995   DONE;
6998 (define_insn "*bras"
6999   [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7000          (match_operand 1 "const_int_operand" "n"))
7001    (clobber (match_operand 2 "register_operand" "=r"))]
7002   "!SIBLING_CALL_P (insn)
7003    && TARGET_SMALL_EXEC
7004    && GET_MODE (operands[2]) == Pmode"
7005   "bras\t%2,%0"
7006   [(set_attr "op_type" "RI")
7007    (set_attr "type"    "jsr")])
7009 (define_insn "*brasl"
7010   [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7011          (match_operand 1 "const_int_operand" "n"))
7012    (clobber (match_operand 2 "register_operand" "=r"))]
7013   "!SIBLING_CALL_P (insn)
7014    && TARGET_CPU_ZARCH
7015    && GET_MODE (operands[2]) == Pmode"
7016   "brasl\t%2,%0"
7017   [(set_attr "op_type" "RIL")
7018    (set_attr "type"    "jsr")])
7020 (define_insn "*basr"
7021   [(call (mem:QI (match_operand 0 "address_operand" "U"))
7022          (match_operand 1 "const_int_operand" "n"))
7023    (clobber (match_operand 2 "register_operand" "=r"))]
7024   "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
7026   if (get_attr_op_type (insn) == OP_TYPE_RR)
7027     return "basr\t%2,%0";
7028   else
7029     return "bas\t%2,%a0";
7031   [(set (attr "op_type")
7032         (if_then_else (match_operand 0 "register_operand" "")
7033                       (const_string "RR") (const_string "RX")))
7034    (set_attr "type"  "jsr")
7035    (set_attr "atype" "agen")])
7038 ; call_value instruction pattern(s).
7041 (define_expand "call_value"
7042   [(set (match_operand 0 "" "")
7043         (call (match_operand 1 "" "")
7044               (match_operand 2 "" "")))
7045    (use (match_operand 3 "" ""))]
7046   ""
7048   s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
7049                   gen_rtx_REG (Pmode, RETURN_REGNUM));
7050   DONE;
7053 (define_insn "*bras_r"
7054   [(set (match_operand 0 "" "")
7055         (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7056               (match_operand:SI 2 "const_int_operand" "n")))
7057    (clobber (match_operand 3 "register_operand" "=r"))]
7058   "!SIBLING_CALL_P (insn)
7059    && TARGET_SMALL_EXEC
7060    && GET_MODE (operands[3]) == Pmode"
7061   "bras\t%3,%1"
7062   [(set_attr "op_type" "RI")
7063    (set_attr "type"    "jsr")])
7065 (define_insn "*brasl_r"
7066   [(set (match_operand 0 "" "")
7067         (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7068               (match_operand 2 "const_int_operand" "n")))
7069    (clobber (match_operand 3 "register_operand" "=r"))]
7070   "!SIBLING_CALL_P (insn)
7071    && TARGET_CPU_ZARCH
7072    && GET_MODE (operands[3]) == Pmode"
7073   "brasl\t%3,%1"
7074   [(set_attr "op_type" "RIL")
7075    (set_attr "type"    "jsr")])
7077 (define_insn "*basr_r"
7078   [(set (match_operand 0 "" "")
7079         (call (mem:QI (match_operand 1 "address_operand" "U"))
7080               (match_operand 2 "const_int_operand" "n")))
7081    (clobber (match_operand 3 "register_operand" "=r"))]
7082   "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7084   if (get_attr_op_type (insn) == OP_TYPE_RR)
7085     return "basr\t%3,%1";
7086   else
7087     return "bas\t%3,%a1";
7089   [(set (attr "op_type")
7090         (if_then_else (match_operand 1 "register_operand" "")
7091                       (const_string "RR") (const_string "RX")))
7092    (set_attr "type"  "jsr")
7093    (set_attr "atype" "agen")])
7096 ;;- Thread-local storage support.
7099 (define_insn "get_tp_64"
7100   [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7101         (unspec:DI [(const_int 0)] UNSPEC_TP))]
7102   "TARGET_64BIT"
7103   "@
7104    ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7105    stam\t%%a0,%%a1,%0"
7106   [(set_attr "op_type" "NN,RS")
7107    (set_attr "atype"   "reg,*")
7108    (set_attr "type"    "o3,*")
7109    (set_attr "length"  "14,*")])
7111 (define_insn "get_tp_31"
7112   [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7113         (unspec:SI [(const_int 0)] UNSPEC_TP))]
7114   "!TARGET_64BIT"
7115   "@
7116    ear\t%0,%%a0
7117    stam\t%%a0,%%a0,%0"
7118   [(set_attr "op_type" "RRE,RS")])
7120 (define_insn "set_tp_64"
7121   [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7122    (clobber (match_scratch:SI 1 "=d,X"))]
7123   "TARGET_64BIT"
7124   "@
7125    sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7126    lam\t%%a0,%%a1,%0"
7127   [(set_attr "op_type" "NN,RS")
7128    (set_attr "atype"   "reg,*")
7129    (set_attr "type"    "o3,*")
7130    (set_attr "length"  "14,*")])
7132 (define_insn "set_tp_31"
7133   [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7134   "!TARGET_64BIT"
7135   "@
7136    sar\t%%a0,%0
7137    lam\t%%a0,%%a0,%0"
7138   [(set_attr "op_type" "RRE,RS")])
7140 (define_insn "*tls_load_64"
7141   [(set (match_operand:DI 0 "register_operand" "=d")
7142         (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7143                     (match_operand:DI 2 "" "")]
7144                    UNSPEC_TLS_LOAD))]
7145   "TARGET_64BIT"
7146   "lg\t%0,%1%J2"
7147   [(set_attr "op_type" "RXE")])
7149 (define_insn "*tls_load_31"
7150   [(set (match_operand:SI 0 "register_operand" "=d,d")
7151         (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7152                     (match_operand:SI 2 "" "")]
7153                    UNSPEC_TLS_LOAD))]
7154   "!TARGET_64BIT"
7155   "@
7156    l\t%0,%1%J2
7157    ly\t%0,%1%J2"
7158   [(set_attr "op_type" "RX,RXY")])
7160 (define_insn "*bras_tls"
7161   [(set (match_operand 0 "" "")
7162         (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7163               (match_operand 2 "const_int_operand" "n")))
7164    (clobber (match_operand 3 "register_operand" "=r"))
7165    (use (match_operand 4 "" ""))]
7166   "!SIBLING_CALL_P (insn)
7167    && TARGET_SMALL_EXEC
7168    && GET_MODE (operands[3]) == Pmode"
7169   "bras\t%3,%1%J4"
7170   [(set_attr "op_type" "RI")
7171    (set_attr "type"    "jsr")])
7173 (define_insn "*brasl_tls"
7174   [(set (match_operand 0 "" "")
7175         (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7176               (match_operand 2 "const_int_operand" "n")))
7177    (clobber (match_operand 3 "register_operand" "=r"))
7178    (use (match_operand 4 "" ""))]
7179   "!SIBLING_CALL_P (insn)
7180    && TARGET_CPU_ZARCH
7181    && GET_MODE (operands[3]) == Pmode"
7182   "brasl\t%3,%1%J4"
7183   [(set_attr "op_type" "RIL")
7184    (set_attr "type"    "jsr")])
7186 (define_insn "*basr_tls"
7187   [(set (match_operand 0 "" "")
7188         (call (mem:QI (match_operand 1 "address_operand" "U"))
7189               (match_operand 2 "const_int_operand" "n")))
7190    (clobber (match_operand 3 "register_operand" "=r"))
7191    (use (match_operand 4 "" ""))]
7192   "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7194   if (get_attr_op_type (insn) == OP_TYPE_RR)
7195     return "basr\t%3,%1%J4";
7196   else
7197     return "bas\t%3,%a1%J4";
7199   [(set (attr "op_type")
7200         (if_then_else (match_operand 1 "register_operand" "")
7201                       (const_string "RR") (const_string "RX")))
7202    (set_attr "type"  "jsr")
7203    (set_attr "atype" "agen")])
7206 ;;- Miscellaneous instructions.
7210 ; allocate stack instruction pattern(s).
7213 (define_expand "allocate_stack"
7214   [(set (reg 15)
7215         (plus (reg 15) (match_operand 1 "general_operand" "")))
7216    (set (match_operand 0 "general_operand" "")
7217         (reg 15))]
7218  "TARGET_BACKCHAIN || TARGET_KERNEL_BACKCHAIN"
7220     rtx stack = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
7221     rtx chain;
7222     rtx temp;
7224     if (TARGET_KERNEL_BACKCHAIN)
7225       chain = plus_constant (stack, STACK_POINTER_OFFSET - UNITS_PER_WORD);
7226     else
7227       chain = stack;
7229     chain = gen_rtx_MEM (Pmode, chain);
7230     temp = gen_reg_rtx (Pmode);
7232     emit_move_insn (temp, chain);
7234     if (TARGET_64BIT)
7235       emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7236     else
7237       emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7239     emit_move_insn (chain, temp);
7241     emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7242     DONE;
7247 ; setjmp instruction pattern.
7250 (define_expand "builtin_setjmp_receiver"
7251   [(match_operand 0 "" "")]
7252   "flag_pic"
7254   emit_insn (s390_load_got ());
7255   emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7256   DONE;
7259 ;; These patterns say how to save and restore the stack pointer.  We need not
7260 ;; save the stack pointer at function level since we are careful to
7261 ;; preserve the backchain.  At block level, we have to restore the backchain
7262 ;; when we restore the stack pointer.
7264 ;; For nonlocal gotos, we must save both the stack pointer and its
7265 ;; backchain and restore both.  Note that in the nonlocal case, the
7266 ;; save area is a memory location.
7268 (define_expand "save_stack_function"
7269   [(match_operand 0 "general_operand" "")
7270    (match_operand 1 "general_operand" "")]
7271   ""
7272   "DONE;")
7274 (define_expand "restore_stack_function"
7275   [(match_operand 0 "general_operand" "")
7276    (match_operand 1 "general_operand" "")]
7277   ""
7278   "DONE;")
7280 (define_expand "restore_stack_block"
7281   [(use (match_operand 0 "register_operand" ""))
7282    (set (match_dup 2) (match_dup 3))
7283    (set (match_dup 0) (match_operand 1 "register_operand" ""))
7284    (set (match_dup 3) (match_dup 2))]
7285   ""
7287   operands[2] = gen_reg_rtx (Pmode);
7288   operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7291 (define_expand "save_stack_nonlocal"
7292   [(match_operand 0 "memory_operand" "")
7293    (match_operand 1 "register_operand" "")]
7294   ""
7296   rtx temp = gen_reg_rtx (Pmode);
7298   /* Copy the backchain to the first word, sp to the second and the literal pool
7299      base to the third.  */
7300   emit_move_insn (operand_subword (operands[0], 2, 0,
7301                   TARGET_64BIT ? OImode : TImode),
7302                   gen_rtx_REG (Pmode, BASE_REGNUM));
7303   emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7304   emit_move_insn (operand_subword (operands[0], 0, 0,
7305                  TARGET_64BIT ? OImode : TImode),
7306                  temp);
7307   emit_move_insn (operand_subword (operands[0], 1, 0,
7308                  TARGET_64BIT ? OImode : TImode),
7309                  operands[1]);
7310   DONE;
7313 (define_expand "restore_stack_nonlocal"
7314   [(match_operand 0 "register_operand" "")
7315    (match_operand 1 "memory_operand" "")]
7316   ""
7318   rtx temp = gen_reg_rtx (Pmode);
7319   rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
7321   /* Restore the backchain from the first word, sp from the second and the
7322      literal pool base from the third.  */
7323   emit_move_insn (temp,
7324                  operand_subword (operands[1], 0, 0,
7325                  TARGET_64BIT ? OImode : TImode));
7326   emit_move_insn (operands[0],
7327                  operand_subword (operands[1], 1, 0,
7328                  TARGET_64BIT ? OImode : TImode));
7329   emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7330   emit_move_insn (base,
7331                   operand_subword (operands[1], 2, 0,
7332                   TARGET_64BIT ? OImode : TImode));
7333   emit_insn (gen_rtx_USE (VOIDmode, base));
7335   DONE;
7340 ; nop instruction pattern(s).
7343 (define_insn "nop"
7344   [(const_int 0)]
7345   ""
7346   "lr\t0,0"
7347   [(set_attr "op_type" "RR")])
7351 ; Special literal pool access instruction pattern(s).
7354 (define_insn "*pool_entry"
7355   [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7356                     UNSPECV_POOL_ENTRY)]
7357   ""
7359   enum machine_mode mode = GET_MODE (PATTERN (insn));
7360   unsigned int align = GET_MODE_BITSIZE (mode);
7361   s390_output_pool_entry (operands[0], mode, align);
7362   return "";
7364   [(set_attr "op_type" "NN")
7365    (set (attr "length")
7366         (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7368 (define_insn "pool_start_31"
7369   [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7370   "!TARGET_CPU_ZARCH"
7371   ".align\t4"
7372   [(set_attr "op_type"  "NN")
7373    (set_attr "length"   "2")])
7375 (define_insn "pool_end_31"
7376   [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7377   "!TARGET_CPU_ZARCH"
7378   ".align\t2"
7379   [(set_attr "op_type"  "NN")
7380    (set_attr "length"   "2")])
7382 (define_insn "pool_start_64"
7383   [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7384   "TARGET_CPU_ZARCH"
7385   ".section\t.rodata\;.align\t8"
7386   [(set_attr "op_type"  "NN")
7387    (set_attr "length"   "0")])
7389 (define_insn "pool_end_64"
7390   [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7391   "TARGET_CPU_ZARCH"
7392   ".previous"
7393   [(set_attr "op_type"  "NN")
7394    (set_attr "length"   "0")])
7396 (define_insn "main_base_31_small"
7397   [(set (match_operand 0 "register_operand" "=a")
7398         (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7399   "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7400   "basr\t%0,0"
7401   [(set_attr "op_type" "RR")
7402    (set_attr "type"    "la")])
7404 (define_insn "main_base_31_large"
7405   [(set (match_operand 0 "register_operand" "=a")
7406         (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7407    (set (pc) (label_ref (match_operand 2 "" "")))]
7408   "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7409   "bras\t%0,%2"
7410   [(set_attr "op_type" "RI")])
7412 (define_insn "main_base_64"
7413   [(set (match_operand 0 "register_operand" "=a")
7414         (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7415   "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7416   "larl\t%0,%1"
7417   [(set_attr "op_type" "RIL")
7418    (set_attr "type"    "larl")])
7420 (define_insn "main_pool"
7421   [(set (match_operand 0 "register_operand" "=a")
7422         (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
7423   "GET_MODE (operands[0]) == Pmode"
7424   "* abort ();"
7425   [(set_attr "op_type" "NN")])
7427 (define_insn "reload_base_31"
7428   [(set (match_operand 0 "register_operand" "=a")
7429         (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7430   "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7431   "basr\t%0,0\;la\t%0,%1-.(%0)"
7432   [(set_attr "op_type" "NN")
7433    (set_attr "type"    "la")
7434    (set_attr "length"  "6")])
7436 (define_insn "reload_base_64"
7437   [(set (match_operand 0 "register_operand" "=a")
7438         (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7439   "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7440   "larl\t%0,%1"
7441   [(set_attr "op_type" "RIL")
7442    (set_attr "type"    "larl")])
7444 (define_insn "pool"
7445   [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7446   ""
7447   "* abort ();"
7448   [(set_attr "op_type" "NN")
7449    (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7452 ;; Insns related to generating the function prologue and epilogue.
7456 (define_expand "prologue"
7457   [(use (const_int 0))]
7458   ""
7459   "s390_emit_prologue (); DONE;")
7461 (define_insn "prologue_tpf"
7462   [(unspec_volatile [(const_int 0)] UNSPECV_TPF_PROLOGUE)
7463    (clobber (reg:DI 1))]
7464   "TARGET_TPF_PROFILING"
7465   "bas\t%%r1,4064"
7466   [(set_attr "type" "jsr")
7467    (set_attr "op_type" "RX")])
7469 (define_expand "epilogue"
7470   [(use (const_int 1))]
7471   ""
7472   "s390_emit_epilogue (false); DONE;")
7474 (define_insn "epilogue_tpf"
7475   [(unspec_volatile [(const_int 0)] UNSPECV_TPF_EPILOGUE)
7476    (clobber (reg:DI 1))]
7477   "TARGET_TPF_PROFILING"
7478   "bas\t%%r1,4070"
7479   [(set_attr "type" "jsr")
7480    (set_attr "op_type" "RX")])
7483 (define_expand "sibcall_epilogue"
7484   [(use (const_int 0))]
7485   ""
7486   "s390_emit_epilogue (true); DONE;")
7488 (define_insn "*return"
7489   [(return)
7490    (use (match_operand 0 "register_operand" "a"))]
7491   "GET_MODE (operands[0]) == Pmode"
7492   "br\t%0"
7493   [(set_attr "op_type" "RR")
7494    (set_attr "type"    "jsr")
7495    (set_attr "atype"   "agen")])
7498 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7499 ;; pointer. This is used for compatibility.
7501 (define_expand "ptr_extend"
7502   [(set (match_operand:DI 0 "register_operand" "=r")
7503         (match_operand:SI 1 "register_operand" "r"))]
7504   "TARGET_64BIT"
7506   emit_insn (gen_anddi3 (operands[0],
7507                          gen_lowpart (DImode, operands[1]),
7508                          GEN_INT (0x7fffffff)));
7509   DONE;