1 ;;- Machine description for GNU compiler -- S/390 / zSeries version.
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
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
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
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
25 ;; Special constraints for s/390 machine description:
27 ;; a -- Any address register from 1 to 15.
28 ;; c -- Condition code register 33.
29 ;; d -- Any register from 0 to 15.
30 ;; I -- An 8-bit constant (0..255).
31 ;; J -- A 12-bit constant (0..4095).
32 ;; K -- A 16-bit constant (-32768..32767).
33 ;; L -- Value appropriate as displacement.
34 ;; (0..4095) for short displacement
35 ;; (-524288..524287) for long displacement
36 ;; M -- Constant integer with a value of 0x7fffffff.
37 ;; N -- Multiple letter constraint followed by 4 parameter letters.
38 ;; 0..9,x: number of the part counting from most to least significant
39 ;; H,Q: mode of the part
40 ;; D,S,H: mode of the containing operand
41 ;; 0,F: value of the other parts (F - all bits set)
43 ;; The constraint matches if the specified part of a constant
44 ;; has a value different from its other parts. If the letter x
45 ;; is specified instead of a part number, the constraint matches
46 ;; if there is any single part with non-default value.
47 ;; Q -- Memory reference without index register and with short displacement.
48 ;; R -- Memory reference with index register and short displacement.
49 ;; S -- Memory reference without index register but with long displacement.
50 ;; T -- Memory reference with index register and long displacement.
51 ;; A -- Multiple letter constraint followed by Q, R, S, or T:
52 ;; Offsettable memory reference of type specified by second letter.
53 ;; B -- Multiple letter constraint followed by Q, R, S, or T:
54 ;; Memory reference of the type specified by second letter that
55 ;; does *not* refer to a literal pool entry.
56 ;; U -- Pointer with short displacement.
57 ;; W -- Pointer with long displacement.
58 ;; Y -- Shift count operand.
60 ;; Special formats used for outputting 390 instructions.
62 ;; %C: print opcode suffix for branch condition.
63 ;; %D: print opcode suffix for inverse branch condition.
64 ;; %J: print tls_load/tls_gdcall/tls_ldcall suffix
65 ;; %O: print only the displacement of a memory reference.
66 ;; %R: print only the base register of a memory reference.
67 ;; %S: print S-type memory reference (base+displacement).
68 ;; %N: print the second word of a DImode operand.
69 ;; %M: print the second word of a TImode operand.
71 ;; %b: print integer X as if it's an unsigned byte.
72 ;; %x: print integer X as if it's an unsigned word.
73 ;; %h: print integer X as if it's a signed word.
74 ;; %i: print the first nonzero HImode part of X
75 ;; %j: print the first HImode part unequal to 0xffff of X
78 ;; We have a special constraint for pattern matching.
80 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
93 ; GOT/PLT and lt-relative accesses
94 (UNSPEC_LTREL_OFFSET 100)
95 (UNSPEC_LTREL_BASE 101)
103 (UNSPEC_RELOAD_BASE 210)
104 (UNSPEC_MAIN_BASE 211)
109 ; TLS relocation specifiers
114 (UNSPEC_GOTNTPOFF 504)
115 (UNSPEC_INDNTPOFF 505)
118 (UNSPEC_TLSLDM_NTPOFF 511)
119 (UNSPEC_TLS_LOAD 512)
126 ;; UNSPEC_VOLATILE usage
134 (UNSPECV_TPF_PROLOGUE 20)
135 (UNSPECV_TPF_EPILOGUE 21)
139 (UNSPECV_POOL_SECTION 201)
140 (UNSPECV_POOL_ALIGN 202)
141 (UNSPECV_POOL_ENTRY 203)
142 (UNSPECV_MAIN_POOL 300)
154 ; Sibling call register.
156 ; Literal pool base register.
158 ; Return address register.
160 ; Condition code register.
162 ; Thread local storage pointer register.
167 ;; Instruction operand type as used in the Principles of Operation.
168 ;; Used to determine defaults for length and other attribute values.
170 (define_attr "op_type"
171 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
174 ;; Instruction type attribute used for scheduling.
176 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
178 imulhi,imulsi,imuldi,
179 branch,jsr,fsimpdf,fsimpsf,
180 floaddf,floadsf,fstoredf,fstoresf,
181 fmuldf,fmulsf,fdivdf,fdivsf,
182 ftoi,itof,fsqrtdf,fsqrtsf,
184 (cond [(eq_attr "op_type" "NN") (const_string "other")
185 (eq_attr "op_type" "SS") (const_string "cs")]
186 (const_string "integer")))
188 ;; Another attribute used for scheduling purposes:
189 ;; agen: Instruction uses the address generation unit
190 ;; reg: Instruction does not use the agen unit
192 (define_attr "atype" "agen,reg"
193 (cond [(eq_attr "op_type" "E") (const_string "reg")
194 (eq_attr "op_type" "RR") (const_string "reg")
195 (eq_attr "op_type" "RX") (const_string "agen")
196 (eq_attr "op_type" "RI") (const_string "reg")
197 (eq_attr "op_type" "RRE") (const_string "reg")
198 (eq_attr "op_type" "RS") (const_string "agen")
199 (eq_attr "op_type" "RSI") (const_string "agen")
200 (eq_attr "op_type" "S") (const_string "agen")
201 (eq_attr "op_type" "SI") (const_string "agen")
202 (eq_attr "op_type" "SS") (const_string "agen")
203 (eq_attr "op_type" "SSE") (const_string "agen")
204 (eq_attr "op_type" "RXE") (const_string "agen")
205 (eq_attr "op_type" "RSE") (const_string "agen")
206 (eq_attr "op_type" "RIL") (const_string "agen")
207 (eq_attr "op_type" "RXY") (const_string "agen")
208 (eq_attr "op_type" "RSY") (const_string "agen")
209 (eq_attr "op_type" "SIY") (const_string "agen")]
210 (const_string "agen")))
214 (define_attr "length" ""
215 (cond [(eq_attr "op_type" "E") (const_int 2)
216 (eq_attr "op_type" "RR") (const_int 2)
217 (eq_attr "op_type" "RX") (const_int 4)
218 (eq_attr "op_type" "RI") (const_int 4)
219 (eq_attr "op_type" "RRE") (const_int 4)
220 (eq_attr "op_type" "RS") (const_int 4)
221 (eq_attr "op_type" "RSI") (const_int 4)
222 (eq_attr "op_type" "S") (const_int 4)
223 (eq_attr "op_type" "SI") (const_int 4)
224 (eq_attr "op_type" "SS") (const_int 6)
225 (eq_attr "op_type" "SSE") (const_int 6)
226 (eq_attr "op_type" "RXE") (const_int 6)
227 (eq_attr "op_type" "RSE") (const_int 6)
228 (eq_attr "op_type" "RIL") (const_int 6)
229 (eq_attr "op_type" "RXY") (const_int 6)
230 (eq_attr "op_type" "RSY") (const_int 6)
231 (eq_attr "op_type" "SIY") (const_int 6)]
235 ;; Processor type. This attribute must exactly match the processor_type
236 ;; enumeration in s390.h. The current machine description does not
237 ;; distinguish between g5 and g6, but there are differences between the two
238 ;; CPUs could in theory be modeled.
240 (define_attr "cpu" "g5,g6,z900,z990"
241 (const (symbol_ref "s390_tune")))
243 ;; Pipeline description for z900. For lack of anything better,
244 ;; this description is also used for the g5 and g6.
247 ;; Pipeline description for z990.
251 (include "predicates.md")
256 ;; This mode macro allows DF and SF patterns to be generated from the
258 (define_mode_macro FPR [DF SF])
260 ;; These mode macros allow 31-bit and 64-bit GPR patterns to be generated
261 ;; from the same template.
262 (define_mode_macro GPR [(DI "TARGET_64BIT") SI])
263 (define_mode_macro DSI [DI SI])
265 ;; This mode macro allows :P to be used for patterns that operate on
266 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
267 (define_mode_macro P [(DI "TARGET_64BIT") (SI "!TARGET_64BIT")])
269 ;; This mode macro allows the QI and HI patterns to be defined from
270 ;; the same template.
271 (define_mode_macro HQI [HI QI])
273 ;; This mode macro allows the integer patterns to be defined from the
275 (define_mode_macro INT [(DI "TARGET_64BIT") SI HI QI])
277 ;; This macro allows to unify all 'bCOND' expander patterns.
278 (define_code_macro COMPARE [eq ne gt gtu lt ltu ge geu le leu unordered
279 ordered uneq unlt ungt unle unge ltgt])
281 ;; This macro allows to unify all 'sCOND' patterns.
282 (define_code_macro SCOND [ltu gtu leu geu])
284 ;; This macro allows some 'ashift' and 'lshiftrt' pattern to be defined from
285 ;; the same template.
286 (define_code_macro SHIFT [ashift lshiftrt])
289 ;; In FPR templates, a string like "lt<de>br" will expand to "ltdbr" in DFmode
290 ;; and "ltebr" in SFmode.
291 (define_mode_attr de [(DF "d") (SF "e")])
293 ;; In FPR templates, a string like "m<dee>br" will expand to "mdbr" in DFmode
294 ;; and "meebr" in SFmode. This is needed for the 'mul<mode>3' pattern.
295 (define_mode_attr dee [(DF "d") (SF "ee")])
297 ;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in
298 ;; 'ashift' and "srdl" in 'lshiftrt'.
299 (define_code_attr lr [(ashift "l") (lshiftrt "r")])
301 ;; In SHIFT templates, this attribute holds the correct standard name for the
302 ;; pattern itself and the corresponding function calls.
303 (define_code_attr shift [(ashift "ashl") (lshiftrt "lshr")])
305 ;; This attribute handles differences in the instruction 'type' and will result
306 ;; in "RRE" for DImode and "RR" for SImode.
307 (define_mode_attr E [(DI "E") (SI "")])
309 ;; In GPR templates, a string like "lc<g>r" will expand to "lcgr" in DImode
310 ;; and "lcr" in SImode.
311 (define_mode_attr g [(DI "g") (SI "")])
313 ;; In GPR templates, a string like "c<gf>dbr" will expand to "cgdbr" in DImode
314 ;; and "cfdbr" in SImode.
315 (define_mode_attr gf [(DI "g") (SI "f")])
317 ;; ICM mask required to load MODE value into the highest subreg
318 ;; of a SImode register.
319 (define_mode_attr icm_hi [(HI "12") (QI "8")])
321 ;; ICM mask required to load MODE value into the lowest subreg
322 ;; of a SImode register.
323 (define_mode_attr icm_lo [(HI "3") (QI "1")])
325 ;; In HQI templates, a string like "llg<hc>" will expand to "llgh" in
326 ;; HImode and "llgc" in QImode.
327 (define_mode_attr hc [(HI "h") (QI "c")])
329 ;; Maximum unsigned integer that fits in MODE.
330 (define_mode_attr max_uint [(HI "65535") (QI "255")])
334 ;;- Compare instructions.
337 (define_expand "cmp<mode>"
338 [(set (reg:CC CC_REGNUM)
339 (compare:CC (match_operand:GPR 0 "register_operand" "")
340 (match_operand:GPR 1 "general_operand" "")))]
343 s390_compare_op0 = operands[0];
344 s390_compare_op1 = operands[1];
348 (define_expand "cmp<mode>"
349 [(set (reg:CC CC_REGNUM)
350 (compare:CC (match_operand:FPR 0 "register_operand" "")
351 (match_operand:FPR 1 "general_operand" "")))]
354 s390_compare_op0 = operands[0];
355 s390_compare_op1 = operands[1];
360 ; Test-under-Mask instructions
362 (define_insn "*tmqi_mem"
363 [(set (reg CC_REGNUM)
364 (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S")
365 (match_operand:QI 1 "immediate_operand" "n,n"))
366 (match_operand:QI 2 "immediate_operand" "n,n")))]
367 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], false))"
371 [(set_attr "op_type" "SI,SIY")])
373 (define_insn "*tmdi_reg"
374 [(set (reg CC_REGNUM)
375 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
376 (match_operand:DI 1 "immediate_operand"
377 "N0HD0,N1HD0,N2HD0,N3HD0"))
378 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
380 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
381 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
387 [(set_attr "op_type" "RI")])
389 (define_insn "*tmsi_reg"
390 [(set (reg CC_REGNUM)
391 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
392 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
393 (match_operand:SI 2 "immediate_operand" "n,n")))]
394 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
395 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
399 [(set_attr "op_type" "RI")])
401 (define_insn "*tm<mode>_full"
402 [(set (reg CC_REGNUM)
403 (compare (match_operand:HQI 0 "register_operand" "d")
404 (match_operand:HQI 1 "immediate_operand" "n")))]
405 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], true))"
407 [(set_attr "op_type" "RI")])
410 ; Load-and-Test instructions
412 (define_insn "*tstdi_sign"
413 [(set (reg CC_REGNUM)
414 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
415 (const_int 32)) (const_int 32))
416 (match_operand:DI 1 "const0_operand" "")))
417 (set (match_operand:DI 2 "register_operand" "=d")
418 (sign_extend:DI (match_dup 0)))]
419 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
421 [(set_attr "op_type" "RRE")])
423 (define_insn "*tstdi"
424 [(set (reg CC_REGNUM)
425 (compare (match_operand:DI 0 "register_operand" "d")
426 (match_operand:DI 1 "const0_operand" "")))
427 (set (match_operand:DI 2 "register_operand" "=d")
429 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
431 [(set_attr "op_type" "RRE")])
433 (define_insn "*tstdi_cconly"
434 [(set (reg CC_REGNUM)
435 (compare (match_operand:DI 0 "register_operand" "d")
436 (match_operand:DI 1 "const0_operand" "")))]
437 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
439 [(set_attr "op_type" "RRE")])
441 (define_insn "*tstdi_cconly_31"
442 [(set (reg CC_REGNUM)
443 (compare (match_operand:DI 0 "register_operand" "d")
444 (match_operand:DI 1 "const0_operand" "")))]
445 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
447 [(set_attr "op_type" "RS")
448 (set_attr "atype" "reg")])
451 (define_insn "*tstsi"
452 [(set (reg CC_REGNUM)
453 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
454 (match_operand:SI 1 "const0_operand" "")))
455 (set (match_operand:SI 2 "register_operand" "=d,d,d")
457 "s390_match_ccmode(insn, CCSmode)"
462 [(set_attr "op_type" "RR,RS,RSY")])
464 (define_insn "*tstsi_cconly"
465 [(set (reg CC_REGNUM)
466 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
467 (match_operand:SI 1 "const0_operand" "")))
468 (clobber (match_scratch:SI 2 "=X,d,d"))]
469 "s390_match_ccmode(insn, CCSmode)"
474 [(set_attr "op_type" "RR,RS,RSY")])
476 (define_insn "*tstsi_cconly2"
477 [(set (reg CC_REGNUM)
478 (compare (match_operand:SI 0 "register_operand" "d")
479 (match_operand:SI 1 "const0_operand" "")))]
480 "s390_match_ccmode(insn, CCSmode)"
482 [(set_attr "op_type" "RR")])
484 (define_insn "*tst<mode>CCT"
485 [(set (reg CC_REGNUM)
486 (compare (match_operand:HQI 0 "nonimmediate_operand" "?Q,?S,d")
487 (match_operand:HQI 1 "const0_operand" "")))
488 (set (match_operand:HQI 2 "register_operand" "=d,d,0")
490 "s390_match_ccmode(insn, CCTmode)"
493 icmy\t%2,<icm_lo>,%S0
495 [(set_attr "op_type" "RS,RSY,RI")])
497 (define_insn "*tsthiCCT_cconly"
498 [(set (reg CC_REGNUM)
499 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
500 (match_operand:HI 1 "const0_operand" "")))
501 (clobber (match_scratch:HI 2 "=d,d,X"))]
502 "s390_match_ccmode(insn, CCTmode)"
507 [(set_attr "op_type" "RS,RSY,RI")])
509 (define_insn "*tstqiCCT_cconly"
510 [(set (reg CC_REGNUM)
511 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
512 (match_operand:QI 1 "const0_operand" "")))]
513 "s390_match_ccmode(insn, CCTmode)"
518 [(set_attr "op_type" "SI,SIY,RI")])
520 (define_insn "*tst<mode>"
521 [(set (reg CC_REGNUM)
522 (compare (match_operand:HQI 0 "s_operand" "Q,S")
523 (match_operand:HQI 1 "const0_operand" "")))
524 (set (match_operand:HQI 2 "register_operand" "=d,d")
526 "s390_match_ccmode(insn, CCSmode)"
529 icmy\t%2,<icm_lo>,%S0"
530 [(set_attr "op_type" "RS,RSY")])
532 (define_insn "*tst<mode>_cconly"
533 [(set (reg CC_REGNUM)
534 (compare (match_operand:HQI 0 "s_operand" "Q,S")
535 (match_operand:HQI 1 "const0_operand" "")))
536 (clobber (match_scratch:HQI 2 "=d,d"))]
537 "s390_match_ccmode(insn, CCSmode)"
540 icmy\t%2,<icm_lo>,%S0"
541 [(set_attr "op_type" "RS,RSY")])
544 ; Compare (equality) instructions
546 (define_insn "*cmpdi_cct"
547 [(set (reg CC_REGNUM)
548 (compare (match_operand:DI 0 "nonimmediate_operand" "%d,d,d,Q")
549 (match_operand:DI 1 "general_operand" "d,K,m,BQ")))]
550 "s390_match_ccmode (insn, CCTmode) && TARGET_64BIT"
556 [(set_attr "op_type" "RRE,RI,RXY,SS")])
558 (define_insn "*cmpsi_cct"
559 [(set (reg CC_REGNUM)
560 (compare (match_operand:SI 0 "nonimmediate_operand" "%d,d,d,d,Q")
561 (match_operand:SI 1 "general_operand" "d,K,R,T,BQ")))]
562 "s390_match_ccmode (insn, CCTmode)"
569 [(set_attr "op_type" "RR,RI,RX,RXY,SS")])
572 ; Compare (signed) instructions
574 (define_insn "*cmpdi_ccs_sign"
575 [(set (reg CC_REGNUM)
576 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
577 (match_operand:DI 0 "register_operand" "d,d")))]
578 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
582 [(set_attr "op_type" "RRE,RXY")])
584 (define_insn "*cmpdi_ccs"
585 [(set (reg CC_REGNUM)
586 (compare (match_operand:DI 0 "register_operand" "d,d,d")
587 (match_operand:DI 1 "general_operand" "d,K,m")))]
588 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
593 [(set_attr "op_type" "RRE,RI,RXY")])
595 (define_insn "*cmpsi_ccs_sign"
596 [(set (reg CC_REGNUM)
597 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
598 (match_operand:SI 0 "register_operand" "d,d")))]
599 "s390_match_ccmode(insn, CCSRmode)"
603 [(set_attr "op_type" "RX,RXY")])
605 (define_insn "*cmpsi_ccs"
606 [(set (reg CC_REGNUM)
607 (compare (match_operand:SI 0 "register_operand" "d,d,d,d")
608 (match_operand:SI 1 "general_operand" "d,K,R,T")))]
609 "s390_match_ccmode(insn, CCSmode)"
615 [(set_attr "op_type" "RR,RI,RX,RXY")])
618 ; Compare (unsigned) instructions
620 (define_insn "*cmpdi_ccu_zero"
621 [(set (reg CC_REGNUM)
622 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
623 (match_operand:DI 0 "register_operand" "d,d")))]
624 "s390_match_ccmode (insn, CCURmode) && TARGET_64BIT"
628 [(set_attr "op_type" "RRE,RXY")])
630 (define_insn "*cmpdi_ccu"
631 [(set (reg CC_REGNUM)
632 (compare (match_operand:DI 0 "nonimmediate_operand" "d,d,Q,BQ")
633 (match_operand:DI 1 "general_operand" "d,m,BQ,Q")))]
634 "s390_match_ccmode (insn, CCUmode) && TARGET_64BIT"
640 [(set_attr "op_type" "RRE,RXY,SS,SS")])
642 (define_insn "*cmpsi_ccu"
643 [(set (reg CC_REGNUM)
644 (compare (match_operand:SI 0 "nonimmediate_operand" "d,d,d,Q,BQ")
645 (match_operand:SI 1 "general_operand" "d,R,T,BQ,Q")))]
646 "s390_match_ccmode (insn, CCUmode)"
653 [(set_attr "op_type" "RR,RX,RXY,SS,SS")])
655 (define_insn "*cmphi_ccu"
656 [(set (reg CC_REGNUM)
657 (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,BQ")
658 (match_operand:HI 1 "general_operand" "Q,S,BQ,Q")))]
659 "s390_match_ccmode (insn, CCUmode)
660 && !register_operand (operands[1], HImode)"
666 [(set_attr "op_type" "RS,RSY,SS,SS")])
668 (define_insn "*cmpqi_ccu"
669 [(set (reg CC_REGNUM)
670 (compare (match_operand:QI 0 "nonimmediate_operand" "d,d,Q,S,Q,BQ")
671 (match_operand:QI 1 "general_operand" "Q,S,n,n,BQ,Q")))]
672 "s390_match_ccmode (insn, CCUmode)
673 && !register_operand (operands[1], QImode)"
681 [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS")])
684 ; Block compare (CLC) instruction patterns.
687 [(set (reg CC_REGNUM)
688 (compare (match_operand:BLK 0 "memory_operand" "Q")
689 (match_operand:BLK 1 "memory_operand" "Q")))
690 (use (match_operand 2 "const_int_operand" "n"))]
691 "s390_match_ccmode (insn, CCUmode)
692 && INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
693 "clc\t%O0(%2,%R0),%S1"
694 [(set_attr "op_type" "SS")])
697 [(set (reg CC_REGNUM)
698 (compare (match_operand 0 "memory_operand" "")
699 (match_operand 1 "memory_operand" "")))]
701 && s390_match_ccmode (insn, CCUmode)
702 && GET_MODE (operands[0]) == GET_MODE (operands[1])
703 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
705 [(set (match_dup 0) (match_dup 1))
706 (use (match_dup 2))])]
708 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
709 operands[0] = adjust_address (operands[0], BLKmode, 0);
710 operands[1] = adjust_address (operands[1], BLKmode, 0);
712 operands[1] = gen_rtx_COMPARE (GET_MODE (SET_DEST (PATTERN (curr_insn))),
713 operands[0], operands[1]);
714 operands[0] = SET_DEST (PATTERN (curr_insn));
718 ; (DF|SF) instructions
720 (define_insn "*cmp<mode>_ccs_0"
721 [(set (reg CC_REGNUM)
722 (compare (match_operand:FPR 0 "register_operand" "f")
723 (match_operand:FPR 1 "const0_operand" "")))]
724 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
726 [(set_attr "op_type" "RRE")
727 (set_attr "type" "fsimp<mode>")])
729 (define_insn "*cmp<mode>_ccs_0_ibm"
730 [(set (reg CC_REGNUM)
731 (compare (match_operand:FPR 0 "register_operand" "f")
732 (match_operand:FPR 1 "const0_operand" "")))]
733 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
735 [(set_attr "op_type" "RR")
736 (set_attr "type" "fsimp<mode>")])
738 (define_insn "*cmp<mode>_ccs"
739 [(set (reg CC_REGNUM)
740 (compare (match_operand:FPR 0 "register_operand" "f,f")
741 (match_operand:FPR 1 "general_operand" "f,R")))]
742 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
746 [(set_attr "op_type" "RRE,RXE")
747 (set_attr "type" "fsimp<mode>")])
749 (define_insn "*cmp<mode>_ccs_ibm"
750 [(set (reg CC_REGNUM)
751 (compare (match_operand:FPR 0 "register_operand" "f,f")
752 (match_operand:FPR 1 "general_operand" "f,R")))]
753 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
757 [(set_attr "op_type" "RR,RX")
758 (set_attr "type" "fsimp<mode>")])
762 ;;- Move instructions.
766 ; movti instruction pattern(s).
770 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
771 (match_operand:TI 1 "general_operand" "QS,d,dKm,d,Q"))]
779 [(set_attr "op_type" "RSY,RSY,*,*,SS")
780 (set_attr "type" "lm,stm,*,*,*")])
783 [(set (match_operand:TI 0 "nonimmediate_operand" "")
784 (match_operand:TI 1 "general_operand" ""))]
785 "TARGET_64BIT && reload_completed
786 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
787 [(set (match_dup 2) (match_dup 4))
788 (set (match_dup 3) (match_dup 5))]
790 operands[2] = operand_subword (operands[0], 0, 0, TImode);
791 operands[3] = operand_subword (operands[0], 1, 0, TImode);
792 operands[4] = operand_subword (operands[1], 0, 0, TImode);
793 operands[5] = operand_subword (operands[1], 1, 0, TImode);
797 [(set (match_operand:TI 0 "nonimmediate_operand" "")
798 (match_operand:TI 1 "general_operand" ""))]
799 "TARGET_64BIT && reload_completed
800 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
801 [(set (match_dup 2) (match_dup 4))
802 (set (match_dup 3) (match_dup 5))]
804 operands[2] = operand_subword (operands[0], 1, 0, TImode);
805 operands[3] = operand_subword (operands[0], 0, 0, TImode);
806 operands[4] = operand_subword (operands[1], 1, 0, TImode);
807 operands[5] = operand_subword (operands[1], 0, 0, TImode);
811 [(set (match_operand:TI 0 "register_operand" "")
812 (match_operand:TI 1 "memory_operand" ""))]
813 "TARGET_64BIT && reload_completed
814 && !s_operand (operands[1], VOIDmode)"
815 [(set (match_dup 0) (match_dup 1))]
817 rtx addr = operand_subword (operands[0], 1, 0, TImode);
818 s390_load_address (addr, XEXP (operands[1], 0));
819 operands[1] = replace_equiv_address (operands[1], addr);
822 (define_expand "reload_outti"
823 [(parallel [(match_operand:TI 0 "" "")
824 (match_operand:TI 1 "register_operand" "d")
825 (match_operand:DI 2 "register_operand" "=&a")])]
828 gcc_assert (MEM_P (operands[0]));
829 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
830 operands[0] = replace_equiv_address (operands[0], operands[2]);
831 emit_move_insn (operands[0], operands[1]);
836 ; movdi instruction pattern(s).
839 (define_expand "movdi"
840 [(set (match_operand:DI 0 "general_operand" "")
841 (match_operand:DI 1 "general_operand" ""))]
844 /* Handle symbolic constants. */
845 if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
846 emit_symbolic_move (operands);
849 (define_insn "*movdi_larl"
850 [(set (match_operand:DI 0 "register_operand" "=d")
851 (match_operand:DI 1 "larl_operand" "X"))]
853 && !FP_REG_P (operands[0])"
855 [(set_attr "op_type" "RIL")
856 (set_attr "type" "larl")])
858 (define_insn "*movdi_64"
859 [(set (match_operand:DI 0 "nonimmediate_operand"
860 "=d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,d,t,Q,t,?Q")
861 (match_operand:DI 1 "general_operand"
862 "K,N0HD0,N1HD0,N2HD0,N3HD0,L,d,m,d,*f,R,T,*f,*f,t,d,t,Q,?Q"))]
884 [(set_attr "op_type" "RI,RI,RI,RI,RI,RXY,RRE,RXY,RXY,
885 RR,RX,RXY,RX,RXY,*,*,RS,RS,SS")
886 (set_attr "type" "*,*,*,*,*,la,lr,load,store,
887 floaddf,floaddf,floaddf,fstoredf,fstoredf,*,*,*,*,*")])
890 [(set (match_operand:DI 0 "register_operand" "")
891 (match_operand:DI 1 "register_operand" ""))]
892 "TARGET_64BIT && ACCESS_REG_P (operands[1])"
893 [(set (match_dup 2) (match_dup 3))
894 (set (match_dup 0) (ashift:DI (match_dup 0) (const_int 32)))
895 (set (strict_low_part (match_dup 2)) (match_dup 4))]
896 "operands[2] = gen_lowpart (SImode, operands[0]);
897 s390_split_access_reg (operands[1], &operands[4], &operands[3]);")
900 [(set (match_operand:DI 0 "register_operand" "")
901 (match_operand:DI 1 "register_operand" ""))]
902 "TARGET_64BIT && ACCESS_REG_P (operands[0])
903 && dead_or_set_p (insn, operands[1])"
904 [(set (match_dup 3) (match_dup 2))
905 (set (match_dup 1) (lshiftrt:DI (match_dup 1) (const_int 32)))
906 (set (match_dup 4) (match_dup 2))]
907 "operands[2] = gen_lowpart (SImode, operands[1]);
908 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
911 [(set (match_operand:DI 0 "register_operand" "")
912 (match_operand:DI 1 "register_operand" ""))]
913 "TARGET_64BIT && ACCESS_REG_P (operands[0])
914 && !dead_or_set_p (insn, operands[1])"
915 [(set (match_dup 3) (match_dup 2))
916 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))
917 (set (match_dup 4) (match_dup 2))
918 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))]
919 "operands[2] = gen_lowpart (SImode, operands[1]);
920 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
922 (define_insn "*movdi_31"
923 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,o,!*f,!*f,!*f,!R,!T,Q")
924 (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,R,T,*f,*f,Q"))]
937 [(set_attr "op_type" "RS,RS,*,*,RR,RX,RXY,RX,RXY,SS")
938 (set_attr "type" "lm,stm,*,*,floaddf,floaddf,floaddf,fstoredf,fstoredf,*")])
941 [(set (match_operand:DI 0 "nonimmediate_operand" "")
942 (match_operand:DI 1 "general_operand" ""))]
943 "!TARGET_64BIT && reload_completed
944 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
945 [(set (match_dup 2) (match_dup 4))
946 (set (match_dup 3) (match_dup 5))]
948 operands[2] = operand_subword (operands[0], 0, 0, DImode);
949 operands[3] = operand_subword (operands[0], 1, 0, DImode);
950 operands[4] = operand_subword (operands[1], 0, 0, DImode);
951 operands[5] = operand_subword (operands[1], 1, 0, DImode);
955 [(set (match_operand:DI 0 "nonimmediate_operand" "")
956 (match_operand:DI 1 "general_operand" ""))]
957 "!TARGET_64BIT && reload_completed
958 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
959 [(set (match_dup 2) (match_dup 4))
960 (set (match_dup 3) (match_dup 5))]
962 operands[2] = operand_subword (operands[0], 1, 0, DImode);
963 operands[3] = operand_subword (operands[0], 0, 0, DImode);
964 operands[4] = operand_subword (operands[1], 1, 0, DImode);
965 operands[5] = operand_subword (operands[1], 0, 0, DImode);
969 [(set (match_operand:DI 0 "register_operand" "")
970 (match_operand:DI 1 "memory_operand" ""))]
971 "!TARGET_64BIT && reload_completed
972 && !FP_REG_P (operands[0])
973 && !s_operand (operands[1], VOIDmode)"
974 [(set (match_dup 0) (match_dup 1))]
976 rtx addr = operand_subword (operands[0], 1, 0, DImode);
977 s390_load_address (addr, XEXP (operands[1], 0));
978 operands[1] = replace_equiv_address (operands[1], addr);
981 (define_expand "reload_outdi"
982 [(parallel [(match_operand:DI 0 "" "")
983 (match_operand:DI 1 "register_operand" "d")
984 (match_operand:SI 2 "register_operand" "=&a")])]
987 gcc_assert (MEM_P (operands[0]));
988 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
989 operands[0] = replace_equiv_address (operands[0], operands[2]);
990 emit_move_insn (operands[0], operands[1]);
995 [(set (match_operand:DI 0 "register_operand" "")
996 (mem:DI (match_operand 1 "address_operand" "")))]
998 && !FP_REG_P (operands[0])
999 && GET_CODE (operands[1]) == SYMBOL_REF
1000 && CONSTANT_POOL_ADDRESS_P (operands[1])
1001 && get_pool_mode (operands[1]) == DImode
1002 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1003 [(set (match_dup 0) (match_dup 2))]
1004 "operands[2] = get_pool_constant (operands[1]);")
1006 (define_insn "*la_64"
1007 [(set (match_operand:DI 0 "register_operand" "=d,d")
1008 (match_operand:QI 1 "address_operand" "U,W"))]
1013 [(set_attr "op_type" "RX,RXY")
1014 (set_attr "type" "la")])
1018 [(set (match_operand:DI 0 "register_operand" "")
1019 (match_operand:QI 1 "address_operand" ""))
1020 (clobber (reg:CC CC_REGNUM))])]
1022 && preferred_la_operand_p (operands[1], const0_rtx)"
1023 [(set (match_dup 0) (match_dup 1))]
1027 [(set (match_operand:DI 0 "register_operand" "")
1028 (match_operand:DI 1 "register_operand" ""))
1031 (plus:DI (match_dup 0)
1032 (match_operand:DI 2 "nonmemory_operand" "")))
1033 (clobber (reg:CC CC_REGNUM))])]
1035 && !reg_overlap_mentioned_p (operands[0], operands[2])
1036 && preferred_la_operand_p (operands[1], operands[2])"
1037 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1040 (define_expand "reload_indi"
1041 [(parallel [(match_operand:DI 0 "register_operand" "=a")
1042 (match_operand:DI 1 "s390_plus_operand" "")
1043 (match_operand:DI 2 "register_operand" "=&a")])]
1046 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1051 ; movsi instruction pattern(s).
1054 (define_expand "movsi"
1055 [(set (match_operand:SI 0 "general_operand" "")
1056 (match_operand:SI 1 "general_operand" ""))]
1059 /* Handle symbolic constants. */
1060 if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1061 emit_symbolic_move (operands);
1064 (define_insn "*movsi_larl"
1065 [(set (match_operand:SI 0 "register_operand" "=d")
1066 (match_operand:SI 1 "larl_operand" "X"))]
1067 "!TARGET_64BIT && TARGET_CPU_ZARCH
1068 && !FP_REG_P (operands[0])"
1070 [(set_attr "op_type" "RIL")
1071 (set_attr "type" "larl")])
1073 (define_insn "*movsi_zarch"
1074 [(set (match_operand:SI 0 "nonimmediate_operand"
1075 "=d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,d,t,Q,t,?Q")
1076 (match_operand:SI 1 "general_operand"
1077 "K,N0HS0,N1HS0,L,d,R,T,d,d,*f,R,T,*f,*f,t,d,t,Q,?Q"))]
1099 [(set_attr "op_type" "RI,RI,RI,RXY,RR,RX,RXY,RX,RXY,
1100 RR,RX,RXY,RX,RXY,RRE,RRE,RS,RS,SS")
1101 (set_attr "type" "*,*,*,la,lr,load,load,store,store,
1102 floadsf,floadsf,floadsf,fstoresf,fstoresf,*,*,*,*,*")])
1104 (define_insn "*movsi_esa"
1105 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,d,t,Q,t,?Q")
1106 (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,t,d,t,Q,?Q"))]
1121 [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,RRE,RRE,RS,RS,SS")
1122 (set_attr "type" "*,lr,load,store,floadsf,floadsf,fstoresf,*,*,*,*,*")])
1125 [(set (match_operand:SI 0 "register_operand" "")
1126 (mem:SI (match_operand 1 "address_operand" "")))]
1127 "!FP_REG_P (operands[0])
1128 && GET_CODE (operands[1]) == SYMBOL_REF
1129 && CONSTANT_POOL_ADDRESS_P (operands[1])
1130 && get_pool_mode (operands[1]) == SImode
1131 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1132 [(set (match_dup 0) (match_dup 2))]
1133 "operands[2] = get_pool_constant (operands[1]);")
1135 (define_insn "*la_31"
1136 [(set (match_operand:SI 0 "register_operand" "=d,d")
1137 (match_operand:QI 1 "address_operand" "U,W"))]
1138 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1142 [(set_attr "op_type" "RX,RXY")
1143 (set_attr "type" "la")])
1147 [(set (match_operand:SI 0 "register_operand" "")
1148 (match_operand:QI 1 "address_operand" ""))
1149 (clobber (reg:CC CC_REGNUM))])]
1151 && preferred_la_operand_p (operands[1], const0_rtx)"
1152 [(set (match_dup 0) (match_dup 1))]
1156 [(set (match_operand:SI 0 "register_operand" "")
1157 (match_operand:SI 1 "register_operand" ""))
1160 (plus:SI (match_dup 0)
1161 (match_operand:SI 2 "nonmemory_operand" "")))
1162 (clobber (reg:CC CC_REGNUM))])]
1164 && !reg_overlap_mentioned_p (operands[0], operands[2])
1165 && preferred_la_operand_p (operands[1], operands[2])"
1166 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1169 (define_insn "*la_31_and"
1170 [(set (match_operand:SI 0 "register_operand" "=d,d")
1171 (and:SI (match_operand:QI 1 "address_operand" "U,W")
1172 (const_int 2147483647)))]
1177 [(set_attr "op_type" "RX,RXY")
1178 (set_attr "type" "la")])
1180 (define_insn_and_split "*la_31_and_cc"
1181 [(set (match_operand:SI 0 "register_operand" "=d")
1182 (and:SI (match_operand:QI 1 "address_operand" "p")
1183 (const_int 2147483647)))
1184 (clobber (reg:CC CC_REGNUM))]
1187 "&& reload_completed"
1189 (and:SI (match_dup 1) (const_int 2147483647)))]
1191 [(set_attr "op_type" "RX")
1192 (set_attr "type" "la")])
1194 (define_insn "force_la_31"
1195 [(set (match_operand:SI 0 "register_operand" "=d,d")
1196 (match_operand:QI 1 "address_operand" "U,W"))
1197 (use (const_int 0))]
1202 [(set_attr "op_type" "RX")
1203 (set_attr "type" "la")])
1205 (define_expand "reload_insi"
1206 [(parallel [(match_operand:SI 0 "register_operand" "=a")
1207 (match_operand:SI 1 "s390_plus_operand" "")
1208 (match_operand:SI 2 "register_operand" "=&a")])]
1211 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1216 ; movhi instruction pattern(s).
1219 (define_expand "movhi"
1220 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1221 (match_operand:HI 1 "general_operand" ""))]
1224 /* Make it explicit that loading a register from memory
1225 always sign-extends (at least) to SImode. */
1226 if (optimize && !no_new_pseudos
1227 && register_operand (operands[0], VOIDmode)
1228 && GET_CODE (operands[1]) == MEM)
1230 rtx tmp = gen_reg_rtx (SImode);
1231 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1232 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1233 operands[1] = gen_lowpart (HImode, tmp);
1237 (define_insn "*movhi"
1238 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1239 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1249 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1250 (set_attr "type" "lr,*,*,*,store,store,*")])
1253 [(set (match_operand:HI 0 "register_operand" "")
1254 (mem:HI (match_operand 1 "address_operand" "")))]
1255 "GET_CODE (operands[1]) == SYMBOL_REF
1256 && CONSTANT_POOL_ADDRESS_P (operands[1])
1257 && get_pool_mode (operands[1]) == HImode
1258 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1259 [(set (match_dup 0) (match_dup 2))]
1260 "operands[2] = get_pool_constant (operands[1]);")
1263 ; movqi instruction pattern(s).
1266 (define_expand "movqi"
1267 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1268 (match_operand:QI 1 "general_operand" ""))]
1271 /* On z/Architecture, zero-extending from memory to register
1272 is just as fast as a QImode load. */
1273 if (TARGET_ZARCH && optimize && !no_new_pseudos
1274 && register_operand (operands[0], VOIDmode)
1275 && GET_CODE (operands[1]) == MEM)
1277 rtx tmp = gen_reg_rtx (word_mode);
1278 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1279 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1280 operands[1] = gen_lowpart (QImode, tmp);
1284 (define_insn "*movqi"
1285 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1286 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1298 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1299 (set_attr "type" "lr,*,*,*,store,store,store,store,*")])
1302 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1303 (mem:QI (match_operand 1 "address_operand" "")))]
1304 "GET_CODE (operands[1]) == SYMBOL_REF
1305 && CONSTANT_POOL_ADDRESS_P (operands[1])
1306 && get_pool_mode (operands[1]) == QImode
1307 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1308 [(set (match_dup 0) (match_dup 2))]
1309 "operands[2] = get_pool_constant (operands[1]);")
1312 ; movstrictqi instruction pattern(s).
1315 (define_insn "*movstrictqi"
1316 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1317 (match_operand:QI 1 "memory_operand" "R,T"))]
1322 [(set_attr "op_type" "RX,RXY")])
1325 ; movstricthi instruction pattern(s).
1328 (define_insn "*movstricthi"
1329 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1330 (match_operand:HI 1 "memory_operand" "Q,S"))
1331 (clobber (reg:CC CC_REGNUM))]
1336 [(set_attr "op_type" "RS,RSY")])
1339 ; movstrictsi instruction pattern(s).
1342 (define_insn "movstrictsi"
1343 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d,d"))
1344 (match_operand:SI 1 "general_operand" "d,R,T,t"))]
1351 [(set_attr "op_type" "RR,RX,RXY,RRE")
1352 (set_attr "type" "lr,load,load,*")])
1355 ; movdf instruction pattern(s).
1358 (define_expand "movdf"
1359 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1360 (match_operand:DF 1 "general_operand" ""))]
1364 (define_insn "*movdf_64"
1365 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1366 (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1378 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1379 (set_attr "type" "floaddf,floaddf,floaddf,fstoredf,fstoredf,lr,load,store,*")])
1381 (define_insn "*movdf_31"
1382 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1383 (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1396 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,*,*,SS")
1397 (set_attr "type" "floaddf,floaddf,floaddf,fstoredf,fstoredf,lm,stm,*,*,*")])
1400 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1401 (match_operand:DF 1 "general_operand" ""))]
1402 "!TARGET_64BIT && reload_completed
1403 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1404 [(set (match_dup 2) (match_dup 4))
1405 (set (match_dup 3) (match_dup 5))]
1407 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1408 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1409 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1410 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1414 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1415 (match_operand:DF 1 "general_operand" ""))]
1416 "!TARGET_64BIT && reload_completed
1417 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1418 [(set (match_dup 2) (match_dup 4))
1419 (set (match_dup 3) (match_dup 5))]
1421 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1422 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1423 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1424 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1428 [(set (match_operand:DF 0 "register_operand" "")
1429 (match_operand:DF 1 "memory_operand" ""))]
1430 "!TARGET_64BIT && reload_completed
1431 && !FP_REG_P (operands[0])
1432 && !s_operand (operands[1], VOIDmode)"
1433 [(set (match_dup 0) (match_dup 1))]
1435 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1436 s390_load_address (addr, XEXP (operands[1], 0));
1437 operands[1] = replace_equiv_address (operands[1], addr);
1440 (define_expand "reload_outdf"
1441 [(parallel [(match_operand:DF 0 "" "")
1442 (match_operand:DF 1 "register_operand" "d")
1443 (match_operand:SI 2 "register_operand" "=&a")])]
1446 gcc_assert (MEM_P (operands[0]));
1447 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
1448 operands[0] = replace_equiv_address (operands[0], operands[2]);
1449 emit_move_insn (operands[0], operands[1]);
1454 ; movsf instruction pattern(s).
1457 (define_insn "movsf"
1458 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1459 (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1473 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1474 (set_attr "type" "floadsf,floadsf,floadsf,fstoresf,fstoresf,
1475 lr,load,load,store,store,*")])
1478 ; movcc instruction pattern
1481 (define_insn "movcc"
1482 [(set (match_operand:CC 0 "nonimmediate_operand" "=d,c,d,d,d,R,T")
1483 (match_operand:CC 1 "nonimmediate_operand" "d,d,c,R,T,d,d"))]
1493 [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY")
1494 (set_attr "type" "lr,*,*,store,store,load,load")])
1497 ; Block move (MVC) patterns.
1501 [(set (match_operand:BLK 0 "memory_operand" "=Q")
1502 (match_operand:BLK 1 "memory_operand" "Q"))
1503 (use (match_operand 2 "const_int_operand" "n"))]
1504 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
1505 "mvc\t%O0(%2,%R0),%S1"
1506 [(set_attr "op_type" "SS")])
1509 [(set (match_operand 0 "memory_operand" "")
1510 (match_operand 1 "memory_operand" ""))]
1512 && GET_MODE (operands[0]) == GET_MODE (operands[1])
1513 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
1515 [(set (match_dup 0) (match_dup 1))
1516 (use (match_dup 2))])]
1518 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
1519 operands[0] = adjust_address (operands[0], BLKmode, 0);
1520 operands[1] = adjust_address (operands[1], BLKmode, 0);
1525 [(set (match_operand:BLK 0 "memory_operand" "")
1526 (match_operand:BLK 1 "memory_operand" ""))
1527 (use (match_operand 2 "const_int_operand" ""))])
1529 [(set (match_operand:BLK 3 "memory_operand" "")
1530 (match_operand:BLK 4 "memory_operand" ""))
1531 (use (match_operand 5 "const_int_operand" ""))])]
1532 "s390_offset_p (operands[0], operands[3], operands[2])
1533 && s390_offset_p (operands[1], operands[4], operands[2])
1534 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
1536 [(set (match_dup 6) (match_dup 7))
1537 (use (match_dup 8))])]
1538 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
1539 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
1540 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
1544 ; load_multiple pattern(s).
1546 ; ??? Due to reload problems with replacing registers inside match_parallel
1547 ; we currently support load_multiple/store_multiple only after reload.
1550 (define_expand "load_multiple"
1551 [(match_par_dup 3 [(set (match_operand 0 "" "")
1552 (match_operand 1 "" ""))
1553 (use (match_operand 2 "" ""))])]
1556 enum machine_mode mode;
1562 /* Support only loading a constant number of fixed-point registers from
1563 memory and only bother with this if more than two */
1564 if (GET_CODE (operands[2]) != CONST_INT
1565 || INTVAL (operands[2]) < 2
1566 || INTVAL (operands[2]) > 16
1567 || GET_CODE (operands[1]) != MEM
1568 || GET_CODE (operands[0]) != REG
1569 || REGNO (operands[0]) >= 16)
1572 count = INTVAL (operands[2]);
1573 regno = REGNO (operands[0]);
1574 mode = GET_MODE (operands[0]);
1575 if (mode != SImode && mode != word_mode)
1578 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1581 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1583 from = XEXP (operands[1], 0);
1586 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1587 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1588 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1590 from = XEXP (XEXP (operands[1], 0), 0);
1591 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1598 from = force_reg (Pmode, XEXP (operands[1], 0));
1602 for (i = 0; i < count; i++)
1603 XVECEXP (operands[3], 0, i)
1604 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1605 change_address (operands[1], mode,
1606 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1609 (define_insn "*load_multiple_di"
1610 [(match_parallel 0 "load_multiple_operation"
1611 [(set (match_operand:DI 1 "register_operand" "=r")
1612 (match_operand:DI 2 "s_operand" "QS"))])]
1613 "reload_completed && word_mode == DImode"
1615 int words = XVECLEN (operands[0], 0);
1616 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1617 return "lmg\t%1,%0,%S2";
1619 [(set_attr "op_type" "RSY")
1620 (set_attr "type" "lm")])
1622 (define_insn "*load_multiple_si"
1623 [(match_parallel 0 "load_multiple_operation"
1624 [(set (match_operand:SI 1 "register_operand" "=r,r")
1625 (match_operand:SI 2 "s_operand" "Q,S"))])]
1628 int words = XVECLEN (operands[0], 0);
1629 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1630 return which_alternative == 0 ? "lm\t%1,%0,%S2" : "lmy\t%1,%0,%S2";
1632 [(set_attr "op_type" "RS,RSY")
1633 (set_attr "type" "lm")])
1636 ; store multiple pattern(s).
1639 (define_expand "store_multiple"
1640 [(match_par_dup 3 [(set (match_operand 0 "" "")
1641 (match_operand 1 "" ""))
1642 (use (match_operand 2 "" ""))])]
1645 enum machine_mode mode;
1651 /* Support only storing a constant number of fixed-point registers to
1652 memory and only bother with this if more than two. */
1653 if (GET_CODE (operands[2]) != CONST_INT
1654 || INTVAL (operands[2]) < 2
1655 || INTVAL (operands[2]) > 16
1656 || GET_CODE (operands[0]) != MEM
1657 || GET_CODE (operands[1]) != REG
1658 || REGNO (operands[1]) >= 16)
1661 count = INTVAL (operands[2]);
1662 regno = REGNO (operands[1]);
1663 mode = GET_MODE (operands[1]);
1664 if (mode != SImode && mode != word_mode)
1667 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1671 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1673 to = XEXP (operands[0], 0);
1676 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1677 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1678 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1680 to = XEXP (XEXP (operands[0], 0), 0);
1681 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1688 to = force_reg (Pmode, XEXP (operands[0], 0));
1692 for (i = 0; i < count; i++)
1693 XVECEXP (operands[3], 0, i)
1694 = gen_rtx_SET (VOIDmode,
1695 change_address (operands[0], mode,
1696 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1697 gen_rtx_REG (mode, regno + i));
1700 (define_insn "*store_multiple_di"
1701 [(match_parallel 0 "store_multiple_operation"
1702 [(set (match_operand:DI 1 "s_operand" "=QS")
1703 (match_operand:DI 2 "register_operand" "r"))])]
1704 "reload_completed && word_mode == DImode"
1706 int words = XVECLEN (operands[0], 0);
1707 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1708 return "stmg\t%2,%0,%S1";
1710 [(set_attr "op_type" "RSY")
1711 (set_attr "type" "stm")])
1714 (define_insn "*store_multiple_si"
1715 [(match_parallel 0 "store_multiple_operation"
1716 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1717 (match_operand:SI 2 "register_operand" "r,r"))])]
1720 int words = XVECLEN (operands[0], 0);
1721 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1722 return which_alternative == 0 ? "stm\t%2,%0,%S1" : "stmy\t%2,%0,%S1";
1724 [(set_attr "op_type" "RS,RSY")
1725 (set_attr "type" "stm")])
1728 ;; String instructions.
1731 (define_insn "*execute"
1732 [(match_parallel 0 ""
1733 [(unspec [(match_operand 1 "register_operand" "a")
1734 (match_operand:BLK 2 "memory_operand" "R")
1735 (match_operand 3 "" "")] UNSPEC_EXECUTE)])]
1736 "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
1737 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
1739 [(set_attr "op_type" "RX")
1740 (set_attr "type" "cs")])
1744 ; strlenM instruction pattern(s).
1747 (define_expand "strlen<mode>"
1748 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1751 (unspec:P [(const_int 0)
1752 (match_operand:BLK 1 "memory_operand" "")
1754 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1755 (clobber (scratch:P))
1756 (clobber (reg:CC CC_REGNUM))])
1758 [(set (match_operand:P 0 "register_operand" "")
1759 (minus:P (match_dup 4) (match_dup 5)))
1760 (clobber (reg:CC CC_REGNUM))])]
1763 operands[4] = gen_reg_rtx (Pmode);
1764 operands[5] = gen_reg_rtx (Pmode);
1765 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1766 operands[1] = replace_equiv_address (operands[1], operands[5]);
1769 (define_insn "*strlen<mode>"
1770 [(set (match_operand:P 0 "register_operand" "=a")
1771 (unspec:P [(match_operand:P 2 "general_operand" "0")
1772 (mem:BLK (match_operand:P 3 "register_operand" "1"))
1774 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1775 (clobber (match_scratch:P 1 "=a"))
1776 (clobber (reg:CC CC_REGNUM))]
1778 "srst\t%0,%1\;jo\t.-4"
1779 [(set_attr "length" "8")
1780 (set_attr "type" "vs")])
1783 ; movmemM instruction pattern(s).
1786 (define_expand "movmem<mode>"
1787 [(set (match_operand:BLK 0 "memory_operand" "")
1788 (match_operand:BLK 1 "memory_operand" ""))
1789 (use (match_operand:GPR 2 "general_operand" ""))
1790 (match_operand 3 "" "")]
1792 "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
1794 ; Move a block that is up to 256 bytes in length.
1795 ; The block length is taken as (operands[2] % 256) + 1.
1797 (define_expand "movmem_short"
1799 [(set (match_operand:BLK 0 "memory_operand" "")
1800 (match_operand:BLK 1 "memory_operand" ""))
1801 (use (match_operand 2 "nonmemory_operand" ""))
1802 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
1803 (clobber (match_dup 3))])]
1805 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1807 (define_insn "*movmem_short"
1808 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q")
1809 (match_operand:BLK 1 "memory_operand" "Q,Q,Q"))
1810 (use (match_operand 2 "nonmemory_operand" "n,a,a"))
1811 (use (match_operand 3 "immediate_operand" "X,R,X"))
1812 (clobber (match_scratch 4 "=X,X,&a"))]
1813 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
1814 && GET_MODE (operands[4]) == Pmode"
1816 [(set_attr "type" "cs")])
1819 [(set (match_operand:BLK 0 "memory_operand" "")
1820 (match_operand:BLK 1 "memory_operand" ""))
1821 (use (match_operand 2 "const_int_operand" ""))
1822 (use (match_operand 3 "immediate_operand" ""))
1823 (clobber (scratch))]
1826 [(set (match_dup 0) (match_dup 1))
1827 (use (match_dup 2))])]
1828 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
1831 [(set (match_operand:BLK 0 "memory_operand" "")
1832 (match_operand:BLK 1 "memory_operand" ""))
1833 (use (match_operand 2 "register_operand" ""))
1834 (use (match_operand 3 "memory_operand" ""))
1835 (clobber (scratch))]
1838 [(unspec [(match_dup 2) (match_dup 3)
1839 (const_int 0)] UNSPEC_EXECUTE)
1840 (set (match_dup 0) (match_dup 1))
1841 (use (const_int 1))])]
1845 [(set (match_operand:BLK 0 "memory_operand" "")
1846 (match_operand:BLK 1 "memory_operand" ""))
1847 (use (match_operand 2 "register_operand" ""))
1848 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
1849 (clobber (match_operand 3 "register_operand" ""))]
1850 "reload_completed && TARGET_CPU_ZARCH"
1851 [(set (match_dup 3) (label_ref (match_dup 4)))
1853 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
1854 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
1855 (set (match_dup 0) (match_dup 1))
1856 (use (const_int 1))])]
1857 "operands[4] = gen_label_rtx ();")
1859 ; Move a block of arbitrary length.
1861 (define_expand "movmem_long"
1863 [(clobber (match_dup 2))
1864 (clobber (match_dup 3))
1865 (set (match_operand:BLK 0 "memory_operand" "")
1866 (match_operand:BLK 1 "memory_operand" ""))
1867 (use (match_operand 2 "general_operand" ""))
1869 (clobber (reg:CC CC_REGNUM))])]
1872 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1873 rtx reg0 = gen_reg_rtx (dword_mode);
1874 rtx reg1 = gen_reg_rtx (dword_mode);
1875 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1876 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
1877 rtx len0 = gen_lowpart (Pmode, reg0);
1878 rtx len1 = gen_lowpart (Pmode, reg1);
1880 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1881 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1882 emit_move_insn (len0, operands[2]);
1884 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
1885 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1886 emit_move_insn (len1, operands[2]);
1888 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1889 operands[1] = replace_equiv_address_nv (operands[1], addr1);
1894 (define_insn "*movmem_long_64"
1895 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1896 (clobber (match_operand:TI 1 "register_operand" "=d"))
1897 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1898 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
1901 (clobber (reg:CC CC_REGNUM))]
1903 "mvcle\t%0,%1,0\;jo\t.-4"
1904 [(set_attr "length" "8")
1905 (set_attr "type" "vs")])
1907 (define_insn "*movmem_long_31"
1908 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1909 (clobber (match_operand:DI 1 "register_operand" "=d"))
1910 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1911 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
1914 (clobber (reg:CC CC_REGNUM))]
1916 "mvcle\t%0,%1,0\;jo\t.-4"
1917 [(set_attr "length" "8")
1918 (set_attr "type" "vs")])
1921 ; clrmemM instruction pattern(s).
1924 (define_expand "clrmem<mode>"
1925 [(set (match_operand:BLK 0 "memory_operand" "")
1927 (use (match_operand:GPR 1 "general_operand" ""))
1928 (match_operand 2 "" "")]
1930 "s390_expand_clrmem (operands[0], operands[1]); DONE;")
1932 ; Clear a block that is up to 256 bytes in length.
1933 ; The block length is taken as (operands[1] % 256) + 1.
1935 (define_expand "clrmem_short"
1937 [(set (match_operand:BLK 0 "memory_operand" "")
1939 (use (match_operand 1 "nonmemory_operand" ""))
1940 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
1941 (clobber (match_dup 2))
1942 (clobber (reg:CC CC_REGNUM))])]
1944 "operands[2] = gen_rtx_SCRATCH (Pmode);")
1946 (define_insn "*clrmem_short"
1947 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q")
1949 (use (match_operand 1 "nonmemory_operand" "n,a,a"))
1950 (use (match_operand 2 "immediate_operand" "X,R,X"))
1951 (clobber (match_scratch 3 "=X,X,&a"))
1952 (clobber (reg:CC CC_REGNUM))]
1953 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
1954 && GET_MODE (operands[3]) == Pmode"
1956 [(set_attr "type" "cs")])
1959 [(set (match_operand:BLK 0 "memory_operand" "")
1961 (use (match_operand 1 "const_int_operand" ""))
1962 (use (match_operand 2 "immediate_operand" ""))
1964 (clobber (reg:CC CC_REGNUM))]
1967 [(set (match_dup 0) (const_int 0))
1969 (clobber (reg:CC CC_REGNUM))])]
1970 "operands[1] = GEN_INT ((INTVAL (operands[1]) & 0xff) + 1);")
1973 [(set (match_operand:BLK 0 "memory_operand" "")
1975 (use (match_operand 1 "register_operand" ""))
1976 (use (match_operand 2 "memory_operand" ""))
1978 (clobber (reg:CC CC_REGNUM))]
1981 [(unspec [(match_dup 1) (match_dup 2)
1982 (const_int 0)] UNSPEC_EXECUTE)
1983 (set (match_dup 0) (const_int 0))
1985 (clobber (reg:CC CC_REGNUM))])]
1989 [(set (match_operand:BLK 0 "memory_operand" "")
1991 (use (match_operand 1 "register_operand" ""))
1992 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
1993 (clobber (match_operand 2 "register_operand" ""))
1994 (clobber (reg:CC CC_REGNUM))]
1995 "reload_completed && TARGET_CPU_ZARCH"
1996 [(set (match_dup 2) (label_ref (match_dup 3)))
1998 [(unspec [(match_dup 1) (mem:BLK (match_dup 2))
1999 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
2000 (set (match_dup 0) (const_int 0))
2002 (clobber (reg:CC CC_REGNUM))])]
2003 "operands[3] = gen_label_rtx ();")
2005 ; Clear a block of arbitrary length.
2007 (define_expand "clrmem_long"
2009 [(clobber (match_dup 1))
2010 (set (match_operand:BLK 0 "memory_operand" "")
2012 (use (match_operand 1 "general_operand" ""))
2014 (clobber (reg:CC CC_REGNUM))])]
2017 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2018 rtx reg0 = gen_reg_rtx (dword_mode);
2019 rtx reg1 = gen_reg_rtx (dword_mode);
2020 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2021 rtx len0 = gen_lowpart (Pmode, reg0);
2023 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2024 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2025 emit_move_insn (len0, operands[1]);
2027 emit_move_insn (reg1, const0_rtx);
2029 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2034 (define_insn "*clrmem_long_64"
2035 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2036 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2039 (use (match_operand:TI 1 "register_operand" "d"))
2040 (clobber (reg:CC CC_REGNUM))]
2042 "mvcle\t%0,%1,0\;jo\t.-4"
2043 [(set_attr "length" "8")
2044 (set_attr "type" "vs")])
2046 (define_insn "*clrmem_long_31"
2047 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2048 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2051 (use (match_operand:DI 1 "register_operand" "d"))
2052 (clobber (reg:CC CC_REGNUM))]
2054 "mvcle\t%0,%1,0\;jo\t.-4"
2055 [(set_attr "length" "8")
2056 (set_attr "type" "vs")])
2059 ; cmpmemM instruction pattern(s).
2062 (define_expand "cmpmemsi"
2063 [(set (match_operand:SI 0 "register_operand" "")
2064 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2065 (match_operand:BLK 2 "memory_operand" "") ) )
2066 (use (match_operand:SI 3 "general_operand" ""))
2067 (use (match_operand:SI 4 "" ""))]
2069 "s390_expand_cmpmem (operands[0], operands[1],
2070 operands[2], operands[3]); DONE;")
2072 ; Compare a block that is up to 256 bytes in length.
2073 ; The block length is taken as (operands[2] % 256) + 1.
2075 (define_expand "cmpmem_short"
2077 [(set (reg:CCU CC_REGNUM)
2078 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2079 (match_operand:BLK 1 "memory_operand" "")))
2080 (use (match_operand 2 "nonmemory_operand" ""))
2081 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2082 (clobber (match_dup 3))])]
2084 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2086 (define_insn "*cmpmem_short"
2087 [(set (reg:CCU CC_REGNUM)
2088 (compare:CCU (match_operand:BLK 0 "memory_operand" "Q,Q,Q")
2089 (match_operand:BLK 1 "memory_operand" "Q,Q,Q")))
2090 (use (match_operand 2 "nonmemory_operand" "n,a,a"))
2091 (use (match_operand 3 "immediate_operand" "X,R,X"))
2092 (clobber (match_scratch 4 "=X,X,&a"))]
2093 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2094 && GET_MODE (operands[4]) == Pmode"
2096 [(set_attr "type" "cs")])
2099 [(set (reg:CCU CC_REGNUM)
2100 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2101 (match_operand:BLK 1 "memory_operand" "")))
2102 (use (match_operand 2 "const_int_operand" ""))
2103 (use (match_operand 3 "immediate_operand" ""))
2104 (clobber (scratch))]
2107 [(set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
2108 (use (match_dup 2))])]
2109 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
2112 [(set (reg:CCU CC_REGNUM)
2113 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2114 (match_operand:BLK 1 "memory_operand" "")))
2115 (use (match_operand 2 "register_operand" ""))
2116 (use (match_operand 3 "memory_operand" ""))
2117 (clobber (scratch))]
2120 [(unspec [(match_dup 2) (match_dup 3)
2121 (const_int 0)] UNSPEC_EXECUTE)
2122 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
2123 (use (const_int 1))])]
2127 [(set (reg:CCU CC_REGNUM)
2128 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2129 (match_operand:BLK 1 "memory_operand" "")))
2130 (use (match_operand 2 "register_operand" ""))
2131 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2132 (clobber (match_operand 3 "register_operand" ""))]
2133 "reload_completed && TARGET_CPU_ZARCH"
2134 [(set (match_dup 3) (label_ref (match_dup 4)))
2136 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
2137 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
2138 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
2139 (use (const_int 1))])]
2140 "operands[4] = gen_label_rtx ();")
2142 ; Compare a block of arbitrary length.
2144 (define_expand "cmpmem_long"
2146 [(clobber (match_dup 2))
2147 (clobber (match_dup 3))
2148 (set (reg:CCU CC_REGNUM)
2149 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2150 (match_operand:BLK 1 "memory_operand" "")))
2151 (use (match_operand 2 "general_operand" ""))
2152 (use (match_dup 3))])]
2155 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2156 rtx reg0 = gen_reg_rtx (dword_mode);
2157 rtx reg1 = gen_reg_rtx (dword_mode);
2158 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2159 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2160 rtx len0 = gen_lowpart (Pmode, reg0);
2161 rtx len1 = gen_lowpart (Pmode, reg1);
2163 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2164 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2165 emit_move_insn (len0, operands[2]);
2167 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2168 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2169 emit_move_insn (len1, operands[2]);
2171 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2172 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2177 (define_insn "*cmpmem_long_64"
2178 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2179 (clobber (match_operand:TI 1 "register_operand" "=d"))
2180 (set (reg:CCU CC_REGNUM)
2181 (compare:CCU (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2182 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2184 (use (match_dup 3))]
2186 "clcle\t%0,%1,0\;jo\t.-4"
2187 [(set_attr "length" "8")
2188 (set_attr "type" "vs")])
2190 (define_insn "*cmpmem_long_31"
2191 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2192 (clobber (match_operand:DI 1 "register_operand" "=d"))
2193 (set (reg:CCU CC_REGNUM)
2194 (compare:CCU (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2195 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2197 (use (match_dup 3))]
2199 "clcle\t%0,%1,0\;jo\t.-4"
2200 [(set_attr "length" "8")
2201 (set_attr "type" "vs")])
2203 ; Convert CCUmode condition code to integer.
2204 ; Result is zero if EQ, positive if LTU, negative if GTU.
2206 (define_insn_and_split "cmpint"
2207 [(set (match_operand:SI 0 "register_operand" "=d")
2208 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2210 (clobber (reg:CC CC_REGNUM))]
2214 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
2216 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))
2217 (clobber (reg:CC CC_REGNUM))])])
2219 (define_insn_and_split "*cmpint_cc"
2220 [(set (reg CC_REGNUM)
2221 (compare (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2224 (set (match_operand:SI 0 "register_operand" "=d")
2225 (unspec:SI [(match_dup 1)] UNSPEC_CMPINT))]
2226 "s390_match_ccmode (insn, CCSmode)"
2228 "&& reload_completed"
2229 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
2231 [(set (match_dup 2) (match_dup 3))
2232 (set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))])]
2234 rtx result = gen_rtx_ASHIFTRT (SImode, operands[0], GEN_INT (30));
2235 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
2236 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
2239 (define_insn_and_split "*cmpint_sign"
2240 [(set (match_operand:DI 0 "register_operand" "=d")
2241 (sign_extend:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2243 (clobber (reg:CC CC_REGNUM))]
2246 "&& reload_completed"
2247 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
2249 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))
2250 (clobber (reg:CC CC_REGNUM))])])
2252 (define_insn_and_split "*cmpint_sign_cc"
2253 [(set (reg CC_REGNUM)
2254 (compare (ashiftrt:DI (ashift:DI (subreg:DI
2255 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2257 (const_int 32)) (const_int 32))
2259 (set (match_operand:DI 0 "register_operand" "=d")
2260 (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_CMPINT)))]
2261 "s390_match_ccmode (insn, CCSmode) && TARGET_64BIT"
2263 "&& reload_completed"
2264 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
2266 [(set (match_dup 2) (match_dup 3))
2267 (set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))])]
2269 rtx result = gen_rtx_ASHIFTRT (DImode, operands[0], GEN_INT (62));
2270 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
2271 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
2276 ;;- Conversion instructions.
2280 (define_insn "*sethigh<mode>si"
2281 [(set (match_operand:SI 0 "register_operand" "=d,d")
2282 (unspec:SI [(match_operand:HQI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2283 (clobber (reg:CC CC_REGNUM))]
2286 icm\t%0,<icm_hi>,%S1
2287 icmy\t%0,<icm_hi>,%S1"
2288 [(set_attr "op_type" "RS,RSY")])
2290 (define_insn "*sethighqidi_64"
2291 [(set (match_operand:DI 0 "register_operand" "=d")
2292 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2293 (clobber (reg:CC CC_REGNUM))]
2296 [(set_attr "op_type" "RSY")])
2298 (define_insn "*sethighqidi_31"
2299 [(set (match_operand:DI 0 "register_operand" "=d,d")
2300 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2301 (clobber (reg:CC CC_REGNUM))]
2306 [(set_attr "op_type" "RS,RSY")])
2308 (define_insn_and_split "*extractqi"
2309 [(set (match_operand:SI 0 "register_operand" "=d")
2310 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2311 (match_operand 2 "const_int_operand" "n")
2313 (clobber (reg:CC CC_REGNUM))]
2315 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2317 "&& reload_completed"
2319 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2320 (clobber (reg:CC CC_REGNUM))])
2321 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2323 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2324 operands[1] = change_address (operands[1], QImode, 0);
2327 (define_insn_and_split "*extracthi"
2328 [(set (match_operand:SI 0 "register_operand" "=d")
2329 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2330 (match_operand 2 "const_int_operand" "n")
2332 (clobber (reg:CC CC_REGNUM))]
2334 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2336 "&& reload_completed"
2338 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2339 (clobber (reg:CC CC_REGNUM))])
2340 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2342 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2343 operands[1] = change_address (operands[1], HImode, 0);
2347 ; extendsidi2 instruction pattern(s).
2350 (define_expand "extendsidi2"
2351 [(set (match_operand:DI 0 "register_operand" "")
2352 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2358 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2359 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2360 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2361 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2367 (define_insn "*extendsidi2"
2368 [(set (match_operand:DI 0 "register_operand" "=d,d")
2369 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2374 [(set_attr "op_type" "RRE,RXY")])
2377 ; extend(hi|qi)di2 instruction pattern(s).
2380 (define_expand "extend<mode>di2"
2381 [(set (match_operand:DI 0 "register_operand" "")
2382 (sign_extend:DI (match_operand:HQI 1 "register_operand" "")))]
2388 rtx tmp = gen_reg_rtx (SImode);
2389 emit_insn (gen_extend<mode>si2 (tmp, operands[1]));
2390 emit_insn (gen_extendsidi2 (operands[0], tmp));
2395 rtx bitcount = GEN_INT (GET_MODE_BITSIZE (DImode) -
2396 GET_MODE_BITSIZE (<MODE>mode));
2397 operands[1] = gen_lowpart (DImode, operands[1]);
2398 emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount));
2399 emit_insn (gen_ashrdi3 (operands[0], operands[0], bitcount));
2405 (define_insn "*extendhidi2"
2406 [(set (match_operand:DI 0 "register_operand" "=d")
2407 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2410 [(set_attr "op_type" "RXY")])
2412 (define_insn "*extendqidi2"
2413 [(set (match_operand:DI 0 "register_operand" "=d")
2414 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2415 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2417 [(set_attr "op_type" "RXY")])
2419 (define_insn_and_split "*extendqidi2_short_displ"
2420 [(set (match_operand:DI 0 "register_operand" "=d")
2421 (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))
2422 (clobber (reg:CC CC_REGNUM))]
2423 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2425 "&& reload_completed"
2427 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2428 (clobber (reg:CC CC_REGNUM))])
2430 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2431 (clobber (reg:CC CC_REGNUM))])]
2435 ; extend(hi|qi)si2 instruction pattern(s).
2438 (define_expand "extend<mode>si2"
2439 [(set (match_operand:SI 0 "register_operand" "")
2440 (sign_extend:SI (match_operand:HQI 1 "register_operand" "")))]
2444 rtx bitcount = GEN_INT (GET_MODE_BITSIZE(SImode) -
2445 GET_MODE_BITSIZE(<MODE>mode));
2446 operands[1] = gen_lowpart (SImode, operands[1]);
2447 emit_insn (gen_ashlsi3 (operands[0], operands[1], bitcount));
2448 emit_insn (gen_ashrsi3 (operands[0], operands[0], bitcount));
2453 (define_insn "*extendhisi2"
2454 [(set (match_operand:SI 0 "register_operand" "=d,d")
2455 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2460 [(set_attr "op_type" "RX,RXY")])
2462 (define_insn "*extendqisi2"
2463 [(set (match_operand:SI 0 "register_operand" "=d")
2464 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2465 "TARGET_LONG_DISPLACEMENT"
2467 [(set_attr "op_type" "RXY")])
2469 (define_insn_and_split "*extendqisi2_short_displ"
2470 [(set (match_operand:SI 0 "register_operand" "=d")
2471 (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))
2472 (clobber (reg:CC CC_REGNUM))]
2473 "!TARGET_LONG_DISPLACEMENT"
2475 "&& reload_completed"
2477 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2478 (clobber (reg:CC CC_REGNUM))])
2480 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2481 (clobber (reg:CC CC_REGNUM))])]
2485 ; extendqihi2 instruction pattern(s).
2490 ; zero_extendsidi2 instruction pattern(s).
2493 (define_expand "zero_extendsidi2"
2494 [(set (match_operand:DI 0 "register_operand" "")
2495 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2501 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2502 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2503 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2509 (define_insn "*zero_extendsidi2"
2510 [(set (match_operand:DI 0 "register_operand" "=d,d")
2511 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2516 [(set_attr "op_type" "RRE,RXY")])
2519 ; zero_extend(hi|qi)di2 instruction pattern(s).
2522 (define_expand "zero_extend<mode>di2"
2523 [(set (match_operand:DI 0 "register_operand" "")
2524 (zero_extend:DI (match_operand:HQI 1 "register_operand" "")))]
2530 rtx tmp = gen_reg_rtx (SImode);
2531 emit_insn (gen_zero_extend<mode>si2 (tmp, operands[1]));
2532 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2537 rtx bitcount = GEN_INT (GET_MODE_BITSIZE(DImode) -
2538 GET_MODE_BITSIZE(<MODE>mode));
2539 operands[1] = gen_lowpart (DImode, operands[1]);
2540 emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount));
2541 emit_insn (gen_lshrdi3 (operands[0], operands[0], bitcount));
2547 (define_insn "*zero_extend<mode>di2"
2548 [(set (match_operand:DI 0 "register_operand" "=d")
2549 (zero_extend:DI (match_operand:HQI 1 "memory_operand" "m")))]
2552 [(set_attr "op_type" "RXY")])
2555 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2558 (define_insn "*llgt_sidi"
2559 [(set (match_operand:DI 0 "register_operand" "=d")
2560 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2561 (const_int 2147483647)))]
2564 [(set_attr "op_type" "RXE")])
2566 (define_insn_and_split "*llgt_sidi_split"
2567 [(set (match_operand:DI 0 "register_operand" "=d")
2568 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2569 (const_int 2147483647)))
2570 (clobber (reg:CC CC_REGNUM))]
2573 "&& reload_completed"
2575 (and:DI (subreg:DI (match_dup 1) 0)
2576 (const_int 2147483647)))]
2579 (define_insn "*llgt_sisi"
2580 [(set (match_operand:SI 0 "register_operand" "=d,d")
2581 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2582 (const_int 2147483647)))]
2587 [(set_attr "op_type" "RRE,RXE")])
2589 (define_insn "*llgt_didi"
2590 [(set (match_operand:DI 0 "register_operand" "=d,d")
2591 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2592 (const_int 2147483647)))]
2597 [(set_attr "op_type" "RRE,RXE")])
2600 [(set (match_operand:GPR 0 "register_operand" "")
2601 (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "")
2602 (const_int 2147483647)))
2603 (clobber (reg:CC CC_REGNUM))]
2604 "TARGET_64BIT && reload_completed"
2606 (and:GPR (match_dup 1)
2607 (const_int 2147483647)))]
2611 ; zero_extend(hi|qi)si2 instruction pattern(s).
2614 (define_expand "zero_extend<mode>si2"
2615 [(set (match_operand:SI 0 "register_operand" "")
2616 (zero_extend:SI (match_operand:HQI 1 "register_operand" "")))]
2620 operands[1] = gen_lowpart (SImode, operands[1]);
2621 emit_insn (gen_andsi3 (operands[0], operands[1],
2622 GEN_INT ((1 << GET_MODE_BITSIZE(<MODE>mode)) - 1)));
2627 (define_insn "*zero_extend<mode>si2_64"
2628 [(set (match_operand:SI 0 "register_operand" "=d")
2629 (zero_extend:SI (match_operand:HQI 1 "memory_operand" "m")))]
2632 [(set_attr "op_type" "RXY")])
2634 (define_insn_and_split "*zero_extendhisi2_31"
2635 [(set (match_operand:SI 0 "register_operand" "=&d")
2636 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2637 (clobber (reg:CC CC_REGNUM))]
2640 "&& reload_completed"
2641 [(set (match_dup 0) (const_int 0))
2643 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2644 (clobber (reg:CC CC_REGNUM))])]
2645 "operands[2] = gen_lowpart (HImode, operands[0]);")
2647 (define_insn_and_split "*zero_extendqisi2_31"
2648 [(set (match_operand:SI 0 "register_operand" "=&d")
2649 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2652 "&& reload_completed"
2653 [(set (match_dup 0) (const_int 0))
2654 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2655 "operands[2] = gen_lowpart (QImode, operands[0]);")
2658 ; zero_extendqihi2 instruction pattern(s).
2661 (define_expand "zero_extendqihi2"
2662 [(set (match_operand:HI 0 "register_operand" "")
2663 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2667 operands[1] = gen_lowpart (HImode, operands[1]);
2668 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2673 (define_insn "*zero_extendqihi2_64"
2674 [(set (match_operand:HI 0 "register_operand" "=d")
2675 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2678 [(set_attr "op_type" "RXY")])
2680 (define_insn_and_split "*zero_extendqihi2_31"
2681 [(set (match_operand:HI 0 "register_operand" "=&d")
2682 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2685 "&& reload_completed"
2686 [(set (match_dup 0) (const_int 0))
2687 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2688 "operands[2] = gen_lowpart (QImode, operands[0]);")
2692 ; fixuns_trunc(sf|df)(si|di)2 and fix_trunc(sf|df)(si|di)2 instruction pattern(s).
2695 (define_expand "fixuns_trunc<FPR:mode><GPR:mode>2"
2696 [(set (match_operand:GPR 0 "register_operand" "")
2697 (unsigned_fix:GPR (match_operand:FPR 1 "register_operand" "")))]
2698 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2700 rtx label1 = gen_label_rtx ();
2701 rtx label2 = gen_label_rtx ();
2702 rtx temp = gen_reg_rtx (<FPR:MODE>mode);
2703 REAL_VALUE_TYPE cmp, sub;
2705 operands[1] = force_reg (<FPR:MODE>mode, operands[1]);
2706 real_2expN (&cmp, GET_MODE_BITSIZE(<GPR:MODE>mode) - 1);
2707 real_2expN (&sub, GET_MODE_BITSIZE(<GPR:MODE>mode));
2709 emit_insn (gen_cmp<FPR:mode> (operands[1],
2710 CONST_DOUBLE_FROM_REAL_VALUE (cmp, <FPR:MODE>mode)));
2711 emit_jump_insn (gen_blt (label1));
2712 emit_insn (gen_sub<FPR:mode>3 (temp, operands[1],
2713 CONST_DOUBLE_FROM_REAL_VALUE (sub, <FPR:MODE>mode)));
2714 emit_insn (gen_fix_trunc<FPR:mode><GPR:mode>2_ieee (operands[0], temp,
2718 emit_label (label1);
2719 emit_insn (gen_fix_trunc<FPR:mode><GPR:mode>2_ieee (operands[0],
2720 operands[1], GEN_INT(5)));
2721 emit_label (label2);
2725 (define_expand "fix_trunc<FPR:mode>di2"
2726 [(set (match_operand:DI 0 "register_operand" "")
2727 (fix:DI (match_operand:FPR 1 "nonimmediate_operand" "")))]
2728 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2730 operands[1] = force_reg (<FPR:MODE>mode, operands[1]);
2731 emit_insn (gen_fix_trunc<FPR:mode>di2_ieee (operands[0], operands[1],
2736 (define_insn "fix_trunc<FPR:mode><GPR:mode>2_ieee"
2737 [(set (match_operand:GPR 0 "register_operand" "=d")
2738 (fix:GPR (match_operand:FPR 1 "register_operand" "f")))
2739 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
2740 (clobber (reg:CC CC_REGNUM))]
2741 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2742 "c<GPR:gf><FPR:de>br\t%0,%h2,%1"
2743 [(set_attr "op_type" "RRE")
2744 (set_attr "type" "ftoi")])
2747 ; fix_truncdfsi2 instruction pattern(s).
2750 (define_expand "fix_truncdfsi2"
2751 [(set (match_operand:SI 0 "register_operand" "")
2752 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2755 if (TARGET_IBM_FLOAT)
2757 /* This is the algorithm from POP chapter A.5.7.2. */
2759 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2760 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2761 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2763 operands[1] = force_reg (DFmode, operands[1]);
2764 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2765 two31r, two32, temp));
2769 operands[1] = force_reg (DFmode, operands[1]);
2770 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2776 (define_insn "fix_truncdfsi2_ibm"
2777 [(set (match_operand:SI 0 "register_operand" "=d")
2778 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2779 (use (match_operand:DI 2 "immediate_operand" "m"))
2780 (use (match_operand:DI 3 "immediate_operand" "m"))
2781 (use (match_operand:BLK 4 "memory_operand" "m"))
2782 (clobber (reg:CC CC_REGNUM))]
2783 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2785 output_asm_insn ("sd\t%1,%2", operands);
2786 output_asm_insn ("aw\t%1,%3", operands);
2787 output_asm_insn ("std\t%1,%4", operands);
2788 output_asm_insn ("xi\t%N4,128", operands);
2791 [(set_attr "length" "20")])
2794 ; fix_truncsfsi2 instruction pattern(s).
2797 (define_expand "fix_truncsfsi2"
2798 [(set (match_operand:SI 0 "register_operand" "")
2799 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
2802 if (TARGET_IBM_FLOAT)
2804 /* Convert to DFmode and then use the POP algorithm. */
2805 rtx temp = gen_reg_rtx (DFmode);
2806 emit_insn (gen_extendsfdf2 (temp, operands[1]));
2807 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
2811 operands[1] = force_reg (SFmode, operands[1]);
2812 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2819 ; floatdi(df|sf)2 instruction pattern(s).
2822 (define_insn "floatdi<mode>2"
2823 [(set (match_operand:FPR 0 "register_operand" "=f")
2824 (float:FPR (match_operand:DI 1 "register_operand" "d")))]
2825 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2827 [(set_attr "op_type" "RRE")
2828 (set_attr "type" "itof" )])
2831 ; floatsidf2 instruction pattern(s).
2834 (define_expand "floatsidf2"
2835 [(set (match_operand:DF 0 "register_operand" "")
2836 (float:DF (match_operand:SI 1 "register_operand" "")))]
2839 if (TARGET_IBM_FLOAT)
2841 /* This is the algorithm from POP chapter A.5.7.1. */
2843 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2844 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
2846 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
2851 (define_insn "floatsidf2_ieee"
2852 [(set (match_operand:DF 0 "register_operand" "=f")
2853 (float:DF (match_operand:SI 1 "register_operand" "d")))]
2854 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2856 [(set_attr "op_type" "RRE")
2857 (set_attr "type" "itof" )])
2859 (define_insn "floatsidf2_ibm"
2860 [(set (match_operand:DF 0 "register_operand" "=f")
2861 (float:DF (match_operand:SI 1 "register_operand" "d")))
2862 (use (match_operand:DI 2 "immediate_operand" "m"))
2863 (use (match_operand:BLK 3 "memory_operand" "m"))
2864 (clobber (reg:CC CC_REGNUM))]
2865 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2867 output_asm_insn ("st\t%1,%N3", operands);
2868 output_asm_insn ("xi\t%N3,128", operands);
2869 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
2870 output_asm_insn ("ld\t%0,%3", operands);
2873 [(set_attr "length" "20")])
2876 ; floatsisf2 instruction pattern(s).
2879 (define_expand "floatsisf2"
2880 [(set (match_operand:SF 0 "register_operand" "")
2881 (float:SF (match_operand:SI 1 "register_operand" "")))]
2884 if (TARGET_IBM_FLOAT)
2886 /* Use the POP algorithm to convert to DFmode and then truncate. */
2887 rtx temp = gen_reg_rtx (DFmode);
2888 emit_insn (gen_floatsidf2 (temp, operands[1]));
2889 emit_insn (gen_truncdfsf2 (operands[0], temp));
2894 (define_insn "floatsisf2_ieee"
2895 [(set (match_operand:SF 0 "register_operand" "=f")
2896 (float:SF (match_operand:SI 1 "register_operand" "d")))]
2897 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2899 [(set_attr "op_type" "RRE")
2900 (set_attr "type" "itof" )])
2903 ; truncdfsf2 instruction pattern(s).
2906 (define_expand "truncdfsf2"
2907 [(set (match_operand:SF 0 "register_operand" "")
2908 (float_truncate:SF (match_operand:DF 1 "register_operand" "")))]
2912 (define_insn "truncdfsf2_ieee"
2913 [(set (match_operand:SF 0 "register_operand" "=f")
2914 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
2915 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2917 [(set_attr "op_type" "RRE")])
2919 (define_insn "truncdfsf2_ibm"
2920 [(set (match_operand:SF 0 "register_operand" "=f,f")
2921 (float_truncate:SF (match_operand:DF 1 "nonimmediate_operand" "f,R")))]
2922 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2926 [(set_attr "op_type" "RR,RX")
2927 (set_attr "type" "floadsf")])
2930 ; extendsfdf2 instruction pattern(s).
2933 (define_expand "extendsfdf2"
2934 [(set (match_operand:DF 0 "register_operand" "")
2935 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
2938 if (TARGET_IBM_FLOAT)
2940 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
2945 (define_insn "extendsfdf2_ieee"
2946 [(set (match_operand:DF 0 "register_operand" "=f,f")
2947 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
2948 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2952 [(set_attr "op_type" "RRE,RXE")
2953 (set_attr "type" "floadsf")])
2955 (define_insn "extendsfdf2_ibm"
2956 [(set (match_operand:DF 0 "register_operand" "=f,f")
2957 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
2958 (clobber (reg:CC CC_REGNUM))]
2959 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2961 sdr\t%0,%0\;ler\t%0,%1
2962 sdr\t%0,%0\;le\t%0,%1"
2963 [(set_attr "length" "4,6")
2964 (set_attr "type" "floadsf")])
2968 ;; ARITHMETIC OPERATIONS
2970 ; arithmetic operations set the ConditionCode,
2971 ; because of unpredictable Bits in Register for Halfword and Byte
2972 ; the ConditionCode can be set wrong in operations for Halfword and Byte
2975 ;;- Add instructions.
2979 ; addti3 instruction pattern(s).
2982 (define_insn_and_split "addti3"
2983 [(set (match_operand:TI 0 "register_operand" "=&d")
2984 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
2985 (match_operand:TI 2 "general_operand" "do") ) )
2986 (clobber (reg:CC CC_REGNUM))]
2989 "&& reload_completed"
2991 [(set (reg:CCL1 CC_REGNUM)
2992 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
2994 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
2996 [(set (match_dup 3) (plus:DI (plus:DI (match_dup 4) (match_dup 5))
2997 (ltu:DI (reg:CCL1 CC_REGNUM) (const_int 0))))
2998 (clobber (reg:CC CC_REGNUM))])]
2999 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3000 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3001 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3002 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3003 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3004 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
3007 ; adddi3 instruction pattern(s).
3010 (define_insn "*adddi3_sign"
3011 [(set (match_operand:DI 0 "register_operand" "=d,d")
3012 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3013 (match_operand:DI 1 "register_operand" "0,0")))
3014 (clobber (reg:CC CC_REGNUM))]
3019 [(set_attr "op_type" "RRE,RXY")])
3021 (define_insn "*adddi3_zero_cc"
3022 [(set (reg CC_REGNUM)
3023 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3024 (match_operand:DI 1 "register_operand" "0,0"))
3026 (set (match_operand:DI 0 "register_operand" "=d,d")
3027 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3028 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3032 [(set_attr "op_type" "RRE,RXY")])
3034 (define_insn "*adddi3_zero_cconly"
3035 [(set (reg CC_REGNUM)
3036 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3037 (match_operand:DI 1 "register_operand" "0,0"))
3039 (clobber (match_scratch:DI 0 "=d,d"))]
3040 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3044 [(set_attr "op_type" "RRE,RXY")])
3046 (define_insn "*adddi3_zero"
3047 [(set (match_operand:DI 0 "register_operand" "=d,d")
3048 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3049 (match_operand:DI 1 "register_operand" "0,0")))
3050 (clobber (reg:CC CC_REGNUM))]
3055 [(set_attr "op_type" "RRE,RXY")])
3057 (define_insn "*adddi3_imm_cc"
3058 [(set (reg CC_REGNUM)
3059 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3060 (match_operand:DI 2 "const_int_operand" "K"))
3062 (set (match_operand:DI 0 "register_operand" "=d")
3063 (plus:DI (match_dup 1) (match_dup 2)))]
3065 && s390_match_ccmode (insn, CCAmode)
3066 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3068 [(set_attr "op_type" "RI")])
3070 (define_insn "*adddi3_carry1_cc"
3071 [(set (reg CC_REGNUM)
3072 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3073 (match_operand:DI 2 "general_operand" "d,m"))
3075 (set (match_operand:DI 0 "register_operand" "=d,d")
3076 (plus:DI (match_dup 1) (match_dup 2)))]
3077 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3081 [(set_attr "op_type" "RRE,RXY")])
3083 (define_insn "*adddi3_carry1_cconly"
3084 [(set (reg CC_REGNUM)
3085 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3086 (match_operand:DI 2 "general_operand" "d,m"))
3088 (clobber (match_scratch:DI 0 "=d,d"))]
3089 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3093 [(set_attr "op_type" "RRE,RXY")])
3095 (define_insn "*adddi3_carry2_cc"
3096 [(set (reg CC_REGNUM)
3097 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3098 (match_operand:DI 2 "general_operand" "d,m"))
3100 (set (match_operand:DI 0 "register_operand" "=d,d")
3101 (plus:DI (match_dup 1) (match_dup 2)))]
3102 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3106 [(set_attr "op_type" "RRE,RXY")])
3108 (define_insn "*adddi3_carry2_cconly"
3109 [(set (reg CC_REGNUM)
3110 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3111 (match_operand:DI 2 "general_operand" "d,m"))
3113 (clobber (match_scratch:DI 0 "=d,d"))]
3114 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3118 [(set_attr "op_type" "RRE,RXY")])
3120 (define_insn "*adddi3_cc"
3121 [(set (reg CC_REGNUM)
3122 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3123 (match_operand:DI 2 "general_operand" "d,m"))
3125 (set (match_operand:DI 0 "register_operand" "=d,d")
3126 (plus:DI (match_dup 1) (match_dup 2)))]
3127 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3131 [(set_attr "op_type" "RRE,RXY")])
3133 (define_insn "*adddi3_cconly"
3134 [(set (reg CC_REGNUM)
3135 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3136 (match_operand:DI 2 "general_operand" "d,m"))
3138 (clobber (match_scratch:DI 0 "=d,d"))]
3139 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3143 [(set_attr "op_type" "RRE,RXY")])
3145 (define_insn "*adddi3_cconly2"
3146 [(set (reg CC_REGNUM)
3147 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3148 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3149 (clobber (match_scratch:DI 0 "=d,d"))]
3150 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3154 [(set_attr "op_type" "RRE,RXY")])
3156 (define_insn "*adddi3_64"
3157 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3158 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3159 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3160 (clobber (reg:CC CC_REGNUM))]
3166 [(set_attr "op_type" "RRE,RI,RXY")])
3168 (define_insn_and_split "*adddi3_31z"
3169 [(set (match_operand:DI 0 "register_operand" "=&d")
3170 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3171 (match_operand:DI 2 "general_operand" "do") ) )
3172 (clobber (reg:CC CC_REGNUM))]
3173 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3175 "&& reload_completed"
3177 [(set (reg:CCL1 CC_REGNUM)
3178 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3180 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3182 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3183 (ltu:SI (reg:CCL1 CC_REGNUM) (const_int 0))))
3184 (clobber (reg:CC CC_REGNUM))])]
3185 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3186 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3187 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3188 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3189 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3190 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
3192 (define_insn_and_split "*adddi3_31"
3193 [(set (match_operand:DI 0 "register_operand" "=&d")
3194 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3195 (match_operand:DI 2 "general_operand" "do") ) )
3196 (clobber (reg:CC CC_REGNUM))]
3199 "&& reload_completed"
3201 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3202 (clobber (reg:CC CC_REGNUM))])
3204 [(set (reg:CCL1 CC_REGNUM)
3205 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3207 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3209 (if_then_else (ltu (reg:CCL1 CC_REGNUM) (const_int 0))
3211 (label_ref (match_dup 9))))
3213 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3214 (clobber (reg:CC CC_REGNUM))])
3216 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3217 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3218 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3219 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3220 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3221 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3222 operands[9] = gen_label_rtx ();")
3224 (define_expand "adddi3"
3226 [(set (match_operand:DI 0 "register_operand" "")
3227 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3228 (match_operand:DI 2 "general_operand" "")))
3229 (clobber (reg:CC CC_REGNUM))])]
3234 ; addsi3 instruction pattern(s).
3237 (define_insn "*addsi3_imm_cc"
3238 [(set (reg CC_REGNUM)
3239 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3240 (match_operand:SI 2 "const_int_operand" "K"))
3242 (set (match_operand:SI 0 "register_operand" "=d")
3243 (plus:SI (match_dup 1) (match_dup 2)))]
3244 "s390_match_ccmode (insn, CCAmode)
3245 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3247 [(set_attr "op_type" "RI")])
3249 (define_insn "*addsi3_carry1_cc"
3250 [(set (reg CC_REGNUM)
3251 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3252 (match_operand:SI 2 "general_operand" "d,R,T"))
3254 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3255 (plus:SI (match_dup 1) (match_dup 2)))]
3256 "s390_match_ccmode (insn, CCL1mode)"
3261 [(set_attr "op_type" "RR,RX,RXY")])
3263 (define_insn "*addsi3_carry1_cconly"
3264 [(set (reg CC_REGNUM)
3265 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3266 (match_operand:SI 2 "general_operand" "d,R,T"))
3268 (clobber (match_scratch:SI 0 "=d,d,d"))]
3269 "s390_match_ccmode (insn, CCL1mode)"
3274 [(set_attr "op_type" "RR,RX,RXY")])
3276 (define_insn "*addsi3_carry2_cc"
3277 [(set (reg CC_REGNUM)
3278 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3279 (match_operand:SI 2 "general_operand" "d,R,T"))
3281 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3282 (plus:SI (match_dup 1) (match_dup 2)))]
3283 "s390_match_ccmode (insn, CCL1mode)"
3288 [(set_attr "op_type" "RR,RX,RXY")])
3290 (define_insn "*addsi3_carry2_cconly"
3291 [(set (reg CC_REGNUM)
3292 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3293 (match_operand:SI 2 "general_operand" "d,R,T"))
3295 (clobber (match_scratch:SI 0 "=d,d,d"))]
3296 "s390_match_ccmode (insn, CCL1mode)"
3301 [(set_attr "op_type" "RR,RX,RXY")])
3303 (define_insn "*addsi3_cc"
3304 [(set (reg CC_REGNUM)
3305 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3306 (match_operand:SI 2 "general_operand" "d,R,T"))
3308 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3309 (plus:SI (match_dup 1) (match_dup 2)))]
3310 "s390_match_ccmode (insn, CCLmode)"
3315 [(set_attr "op_type" "RR,RX,RXY")])
3317 (define_insn "*addsi3_cconly"
3318 [(set (reg CC_REGNUM)
3319 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3320 (match_operand:SI 2 "general_operand" "d,R,T"))
3322 (clobber (match_scratch:SI 0 "=d,d,d"))]
3323 "s390_match_ccmode (insn, CCLmode)"
3328 [(set_attr "op_type" "RR,RX,RXY")])
3330 (define_insn "*addsi3_cconly2"
3331 [(set (reg CC_REGNUM)
3332 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3333 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3334 (clobber (match_scratch:SI 0 "=d,d,d"))]
3335 "s390_match_ccmode (insn, CCLmode)"
3340 [(set_attr "op_type" "RR,RX,RXY")])
3342 (define_insn "*addsi3_sign"
3343 [(set (match_operand:SI 0 "register_operand" "=d,d")
3344 (plus:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
3345 (match_operand:SI 1 "register_operand" "0,0")))
3346 (clobber (reg:CC CC_REGNUM))]
3351 [(set_attr "op_type" "RX,RXY")])
3353 (define_insn "addsi3"
3354 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3355 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3356 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3357 (clobber (reg:CC CC_REGNUM))]
3364 [(set_attr "op_type" "RR,RI,RX,RXY")])
3367 ; add(df|sf)3 instruction pattern(s).
3370 (define_expand "add<mode>3"
3372 [(set (match_operand:FPR 0 "register_operand" "=f,f")
3373 (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
3374 (match_operand:FPR 2 "general_operand" "f,R")))
3375 (clobber (reg:CC CC_REGNUM))])]
3379 (define_insn "*add<mode>3"
3380 [(set (match_operand:FPR 0 "register_operand" "=f,f")
3381 (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
3382 (match_operand:FPR 2 "general_operand" "f,R")))
3383 (clobber (reg:CC CC_REGNUM))]
3384 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3388 [(set_attr "op_type" "RRE,RXE")
3389 (set_attr "type" "fsimp<mode>")])
3391 (define_insn "*add<mode>3_cc"
3392 [(set (reg CC_REGNUM)
3393 (compare (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
3394 (match_operand:FPR 2 "general_operand" "f,R"))
3395 (match_operand:FPR 3 "const0_operand" "")))
3396 (set (match_operand:FPR 0 "register_operand" "=f,f")
3397 (plus:FPR (match_dup 1) (match_dup 2)))]
3398 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3402 [(set_attr "op_type" "RRE,RXE")
3403 (set_attr "type" "fsimp<mode>")])
3405 (define_insn "*add<mode>3_cconly"
3406 [(set (reg CC_REGNUM)
3407 (compare (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
3408 (match_operand:FPR 2 "general_operand" "f,R"))
3409 (match_operand:FPR 3 "const0_operand" "")))
3410 (clobber (match_scratch:FPR 0 "=f,f"))]
3411 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3415 [(set_attr "op_type" "RRE,RXE")
3416 (set_attr "type" "fsimp<mode>")])
3418 (define_insn "*add<mode>3_ibm"
3419 [(set (match_operand:FPR 0 "register_operand" "=f,f")
3420 (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
3421 (match_operand:FPR 2 "general_operand" "f,R")))
3422 (clobber (reg:CC CC_REGNUM))]
3423 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3427 [(set_attr "op_type" "RR,RX")
3428 (set_attr "type" "fsimp<mode>")])
3432 ;;- Subtract instructions.
3436 ; subti3 instruction pattern(s).
3439 (define_insn_and_split "subti3"
3440 [(set (match_operand:TI 0 "register_operand" "=&d")
3441 (minus:TI (match_operand:TI 1 "register_operand" "0")
3442 (match_operand:TI 2 "general_operand" "do") ) )
3443 (clobber (reg:CC CC_REGNUM))]
3446 "&& reload_completed"
3448 [(set (reg:CCL2 CC_REGNUM)
3449 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
3451 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
3453 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
3454 (gtu:DI (reg:CCL2 CC_REGNUM) (const_int 0))))
3455 (clobber (reg:CC CC_REGNUM))])]
3456 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3457 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3458 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3459 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3460 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3461 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
3464 ; subdi3 instruction pattern(s).
3467 (define_insn "*subdi3_sign"
3468 [(set (match_operand:DI 0 "register_operand" "=d,d")
3469 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3470 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3471 (clobber (reg:CC CC_REGNUM))]
3476 [(set_attr "op_type" "RRE,RXY")])
3478 (define_insn "*subdi3_zero_cc"
3479 [(set (reg CC_REGNUM)
3480 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3481 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3483 (set (match_operand:DI 0 "register_operand" "=d,d")
3484 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3485 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3489 [(set_attr "op_type" "RRE,RXY")])
3491 (define_insn "*subdi3_zero_cconly"
3492 [(set (reg CC_REGNUM)
3493 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3494 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3496 (clobber (match_scratch:DI 0 "=d,d"))]
3497 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3501 [(set_attr "op_type" "RRE,RXY")])
3503 (define_insn "*subdi3_zero"
3504 [(set (match_operand:DI 0 "register_operand" "=d,d")
3505 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3506 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3507 (clobber (reg:CC CC_REGNUM))]
3512 [(set_attr "op_type" "RRE,RXY")])
3514 (define_insn "*subdi3_borrow_cc"
3515 [(set (reg CC_REGNUM)
3516 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3517 (match_operand:DI 2 "general_operand" "d,m"))
3519 (set (match_operand:DI 0 "register_operand" "=d,d")
3520 (minus:DI (match_dup 1) (match_dup 2)))]
3521 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3525 [(set_attr "op_type" "RRE,RXY")])
3527 (define_insn "*subdi3_borrow_cconly"