1 ;;- Machine description for GNU compiler -- S/390 / zSeries version.
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
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, 51 Franklin Street, Fifth Floor, 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 ;; f -- Floating point registers.
31 ;; t -- Access registers 36 and 37.
32 ;; G -- Const double zero operand
33 ;; I -- An 8-bit constant (0..255).
34 ;; J -- A 12-bit constant (0..4095).
35 ;; K -- A 16-bit constant (-32768..32767).
36 ;; L -- Value appropriate as displacement.
37 ;; (0..4095) for short displacement
38 ;; (-524288..524287) for long displacement
39 ;; M -- Constant integer with a value of 0x7fffffff.
40 ;; N -- Multiple letter constraint followed by 4 parameter letters.
41 ;; 0..9,x: number of the part counting from most to least significant
42 ;; H,Q: mode of the part
43 ;; D,S,H: mode of the containing operand
44 ;; 0,F: value of the other parts (F - all bits set)
46 ;; The constraint matches if the specified part of a constant
47 ;; has a value different from its other parts. If the letter x
48 ;; is specified instead of a part number, the constraint matches
49 ;; if there is any single part with non-default value.
50 ;; O -- Multiple letter constraint followed by 1 parameter.
51 ;; s: Signed extended immediate value (-2G .. 2G-1).
52 ;; p: Positive extended immediate value (0 .. 4G-1).
53 ;; n: Negative extended immediate value (-4G .. -1).
54 ;; These constraints do not accept any operand if the machine does
55 ;; not provide the extended-immediate facility.
56 ;; P -- Any integer constant that can be loaded without literal pool.
57 ;; Q -- Memory reference without index register and with short displacement.
58 ;; R -- Memory reference with index register and short displacement.
59 ;; S -- Memory reference without index register but with long displacement.
60 ;; T -- Memory reference with index register and long displacement.
61 ;; A -- Multiple letter constraint followed by Q, R, S, or T:
62 ;; Offsettable memory reference of type specified by second letter.
63 ;; B -- Multiple letter constraint followed by Q, R, S, or T:
64 ;; Memory reference of the type specified by second letter that
65 ;; does *not* refer to a literal pool entry.
66 ;; U -- Pointer with short displacement.
67 ;; W -- Pointer with long displacement.
68 ;; Y -- Shift count operand.
70 ;; Special formats used for outputting 390 instructions.
72 ;; %C: print opcode suffix for branch condition.
73 ;; %D: print opcode suffix for inverse branch condition.
74 ;; %J: print tls_load/tls_gdcall/tls_ldcall suffix
75 ;; %G: print the size of the operand in bytes.
76 ;; %O: print only the displacement of a memory reference.
77 ;; %R: print only the base register of a memory reference.
78 ;; %S: print S-type memory reference (base+displacement).
79 ;; %N: print the second word of a DImode operand.
80 ;; %M: print the second word of a TImode operand.
81 ;; %Y: print shift count operand.
83 ;; %b: print integer X as if it's an unsigned byte.
84 ;; %x: print integer X as if it's an unsigned halfword.
85 ;; %h: print integer X as if it's a signed halfword.
86 ;; %i: print the first nonzero HImode part of X.
87 ;; %j: print the first HImode part unequal to -1 of X.
88 ;; %k: print the first nonzero SImode part of X.
89 ;; %m: print the first SImode part unequal to -1 of X.
90 ;; %o: print integer X as if it's an unsigned 32bit word.
92 ;; We have a special constraint for pattern matching.
94 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
107 ; GOT/PLT and lt-relative accesses
108 (UNSPEC_LTREL_OFFSET 100)
109 (UNSPEC_LTREL_BASE 101)
117 (UNSPEC_RELOAD_BASE 210)
118 (UNSPEC_MAIN_BASE 211)
123 ; TLS relocation specifiers
128 (UNSPEC_GOTNTPOFF 504)
129 (UNSPEC_INDNTPOFF 505)
132 (UNSPEC_TLSLDM_NTPOFF 511)
133 (UNSPEC_TLS_LOAD 512)
139 ; Stack Smashing Protector
145 ;; UNSPEC_VOLATILE usage
153 (UNSPECV_TPF_PROLOGUE 20)
154 (UNSPECV_TPF_EPILOGUE 21)
158 (UNSPECV_POOL_SECTION 201)
159 (UNSPECV_POOL_ALIGN 202)
160 (UNSPECV_POOL_ENTRY 203)
161 (UNSPECV_MAIN_POOL 300)
177 ; Sibling call register.
179 ; Literal pool base register.
181 ; Return address register.
183 ; Condition code register.
185 ; Thread local storage pointer register.
190 ;; Instruction operand type as used in the Principles of Operation.
191 ;; Used to determine defaults for length and other attribute values.
193 (define_attr "op_type"
194 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
197 ;; Instruction type attribute used for scheduling.
199 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
200 cs,vs,store,sem,idiv,
201 imulhi,imulsi,imuldi,
202 branch,jsr,fsimptf,fsimpdf,fsimpsf,
203 floadtf,floaddf,floadsf,fstoredf,fstoresf,
204 fmultf,fmuldf,fmulsf,fdivtf,fdivdf,fdivsf,
205 ftoi,itof,fsqrttf,fsqrtdf,fsqrtsf,
206 ftrunctf,ftruncdf,other"
207 (cond [(eq_attr "op_type" "NN") (const_string "other")
208 (eq_attr "op_type" "SS") (const_string "cs")]
209 (const_string "integer")))
211 ;; Another attribute used for scheduling purposes:
212 ;; agen: Instruction uses the address generation unit
213 ;; reg: Instruction does not use the agen unit
215 (define_attr "atype" "agen,reg"
216 (if_then_else (eq_attr "op_type" "E,RR,RI,RRE")
218 (const_string "agen")))
222 (define_attr "length" ""
223 (cond [(eq_attr "op_type" "E,RR") (const_int 2)
224 (eq_attr "op_type" "RX,RI,RRE,RS,RSI,S,SI") (const_int 4)]
228 ;; Processor type. This attribute must exactly match the processor_type
229 ;; enumeration in s390.h. The current machine description does not
230 ;; distinguish between g5 and g6, but there are differences between the two
231 ;; CPUs could in theory be modeled.
233 (define_attr "cpu" "g5,g6,z900,z990,z9_109"
234 (const (symbol_ref "s390_tune")))
236 ;; Pipeline description for z900. For lack of anything better,
237 ;; this description is also used for the g5 and g6.
240 ;; Pipeline description for z990.
244 (include "predicates.md")
251 ;; This mode macro allows floating point patterns to be generated from the
253 (define_mode_macro FPR [TF DF SF])
254 (define_mode_macro DSF [DF SF])
256 ;; These mode macros allow 31-bit and 64-bit TDSI patterns to be generated
257 ;; from the same template.
258 (define_mode_macro TDSI [(TI "TARGET_64BIT") DI SI])
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 DP [(TI "TARGET_64BIT") (DI "!TARGET_64BIT")])
268 (define_mode_macro P [(DI "TARGET_64BIT") (SI "!TARGET_64BIT")])
270 ;; This mode macro allows the QI and HI patterns to be defined from
271 ;; the same template.
272 (define_mode_macro HQI [HI QI])
274 ;; This mode macro allows the integer patterns to be defined from the
276 (define_mode_macro INT [(DI "TARGET_64BIT") SI HI QI])
278 ;; This macro allows to unify all 'bCOND' expander patterns.
279 (define_code_macro COMPARE [eq ne gt gtu lt ltu ge geu le leu unordered
280 ordered uneq unlt ungt unle unge ltgt])
282 ;; This macro allows to unify all 'sCOND' patterns.
283 (define_code_macro SCOND [ltu gtu leu geu])
285 ;; This macro allows some 'ashift' and 'lshiftrt' pattern to be defined from
286 ;; the same template.
287 (define_code_macro SHIFT [ashift lshiftrt])
289 ;; These macros allow to combine most atomic operations.
290 (define_code_macro ATOMIC [and ior xor plus minus mult])
291 (define_code_attr atomic [(and "and") (ior "ior") (xor "xor")
292 (plus "add") (minus "sub") (mult "nand")])
295 ;; In FPR templates, a string like "lt<de>br" will expand to "ltxbr" in TFmode,
296 ;; "ltdbr" in DFmode, and "ltebr" in SFmode.
297 (define_mode_attr xde [(TF "x") (DF "d") (SF "e")])
299 ;; In FPR templates, a string like "m<dee>br" will expand to "mxbr" in TFmode,
300 ;; "mdbr" in DFmode, and "meebr" in SFmode.
301 (define_mode_attr xdee [(TF "x") (DF "d") (SF "ee")])
303 ;; In FPR templates, "<RRe>" will expand to "RRE" in TFmode and "RR" otherwise.
304 ;; Likewise for "<RXe>".
305 (define_mode_attr RRe [(TF "RRE") (DF "RR") (SF "RR")])
306 (define_mode_attr RXe [(TF "RXE") (DF "RX") (SF "RX")])
308 ;; In FPR templates, "<Rf>" will expand to "f" in TFmode and "R" otherwise.
309 ;; This is used to disable the memory alternative in TFmode patterns.
310 (define_mode_attr Rf [(TF "f") (DF "R") (SF "R")])
312 ;; In GPR and P templates, a constraint like "<d0>" will expand to "d" in DImode
313 ;; and "0" in SImode. This allows to combine instructions of which the 31bit
314 ;; version only operates on one register.
315 (define_mode_attr d0 [(DI "d") (SI "0")])
317 ;; In combination with d0 this allows to combine instructions of which the 31bit
318 ;; version only operates on one register. The DImode version needs an additional
319 ;; register for the assembler output.
320 (define_mode_attr 1 [(DI "%1,") (SI "")])
322 ;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in
323 ;; 'ashift' and "srdl" in 'lshiftrt'.
324 (define_code_attr lr [(ashift "l") (lshiftrt "r")])
326 ;; In SHIFT templates, this attribute holds the correct standard name for the
327 ;; pattern itself and the corresponding function calls.
328 (define_code_attr shift [(ashift "ashl") (lshiftrt "lshr")])
330 ;; This attribute handles differences in the instruction 'type' and will result
331 ;; in "RRE" for DImode and "RR" for SImode.
332 (define_mode_attr E [(DI "E") (SI "")])
334 ;; This attribute handles differences in the instruction 'type' and makes RX<Y>
335 ;; to result in "RXY" for DImode and "RX" for SImode.
336 (define_mode_attr Y [(DI "Y") (SI "")])
338 ;; This attribute handles differences in the instruction 'type' and will result
339 ;; in "RSE" for TImode and "RS" for DImode.
340 (define_mode_attr TE [(TI "E") (DI "")])
342 ;; In GPR templates, a string like "lc<g>r" will expand to "lcgr" in DImode
343 ;; and "lcr" in SImode.
344 (define_mode_attr g [(DI "g") (SI "")])
346 ;; In GPR templates, a string like "sl<y>" will expand to "slg" in DImode
347 ;; and "sly" in SImode. This is useful because on 64bit the ..g instructions
348 ;; were enhanced with long displacements whereas 31bit instructions got a ..y
349 ;; variant for long displacements.
350 (define_mode_attr y [(DI "g") (SI "y")])
352 ;; In DP templates, a string like "cds<g>" will expand to "cdsg" in TImode
353 ;; and "cds" in DImode.
354 (define_mode_attr tg [(TI "g") (DI "")])
356 ;; In GPR templates, a string like "c<gf>dbr" will expand to "cgdbr" in DImode
357 ;; and "cfdbr" in SImode.
358 (define_mode_attr gf [(DI "g") (SI "f")])
360 ;; ICM mask required to load MODE value into the lowest subreg
361 ;; of a SImode register.
362 (define_mode_attr icm_lo [(HI "3") (QI "1")])
364 ;; In HQI templates, a string like "llg<hc>" will expand to "llgh" in
365 ;; HImode and "llgc" in QImode.
366 (define_mode_attr hc [(HI "h") (QI "c")])
368 ;; In P templates, the mode <DBL> will expand to "TI" in DImode and "DI"
370 (define_mode_attr DBL [(DI "TI") (SI "DI")])
372 ;; Maximum unsigned integer that fits in MODE.
373 (define_mode_attr max_uint [(HI "65535") (QI "255")])
377 ;;- Compare instructions.
380 (define_expand "cmp<mode>"
381 [(set (reg:CC CC_REGNUM)
382 (compare:CC (match_operand:GPR 0 "register_operand" "")
383 (match_operand:GPR 1 "general_operand" "")))]
386 s390_compare_op0 = operands[0];
387 s390_compare_op1 = operands[1];
391 (define_expand "cmp<mode>"
392 [(set (reg:CC CC_REGNUM)
393 (compare:CC (match_operand:FPR 0 "register_operand" "")
394 (match_operand:FPR 1 "general_operand" "")))]
397 s390_compare_op0 = operands[0];
398 s390_compare_op1 = operands[1];
403 ; Test-under-Mask instructions
405 (define_insn "*tmqi_mem"
406 [(set (reg CC_REGNUM)
407 (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S")
408 (match_operand:QI 1 "immediate_operand" "n,n"))
409 (match_operand:QI 2 "immediate_operand" "n,n")))]
410 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], false))"
414 [(set_attr "op_type" "SI,SIY")])
416 (define_insn "*tmdi_reg"
417 [(set (reg CC_REGNUM)
418 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
419 (match_operand:DI 1 "immediate_operand"
420 "N0HD0,N1HD0,N2HD0,N3HD0"))
421 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
423 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
424 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
430 [(set_attr "op_type" "RI")])
432 (define_insn "*tmsi_reg"
433 [(set (reg CC_REGNUM)
434 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
435 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
436 (match_operand:SI 2 "immediate_operand" "n,n")))]
437 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
438 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
442 [(set_attr "op_type" "RI")])
444 (define_insn "*tm<mode>_full"
445 [(set (reg CC_REGNUM)
446 (compare (match_operand:HQI 0 "register_operand" "d")
447 (match_operand:HQI 1 "immediate_operand" "n")))]
448 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], true))"
450 [(set_attr "op_type" "RI")])
454 ; Load-and-Test instructions
457 ; tst(di|si) intruction pattern(s).
459 (define_insn "*tstdi_sign"
460 [(set (reg CC_REGNUM)
461 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
462 (const_int 32)) (const_int 32))
463 (match_operand:DI 1 "const0_operand" "")))
464 (set (match_operand:DI 2 "register_operand" "=d")
465 (sign_extend:DI (match_dup 0)))]
466 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
468 [(set_attr "op_type" "RRE")])
470 (define_insn "*tst<mode>_extimm"
471 [(set (reg CC_REGNUM)
472 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,m")
473 (match_operand:GPR 1 "const0_operand" "")))
474 (set (match_operand:GPR 2 "register_operand" "=d,d")
476 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
480 [(set_attr "op_type" "RR<E>,RXY")])
482 (define_insn "*tst<mode>_cconly_extimm"
483 [(set (reg CC_REGNUM)
484 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,m")
485 (match_operand:GPR 1 "const0_operand" "")))
486 (clobber (match_scratch:GPR 2 "=X,d"))]
487 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
491 [(set_attr "op_type" "RR<E>,RXY")])
493 (define_insn "*tstdi"
494 [(set (reg CC_REGNUM)
495 (compare (match_operand:DI 0 "register_operand" "d")
496 (match_operand:DI 1 "const0_operand" "")))
497 (set (match_operand:DI 2 "register_operand" "=d")
499 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT && !TARGET_EXTIMM"
501 [(set_attr "op_type" "RRE")])
503 (define_insn "*tstsi"
504 [(set (reg CC_REGNUM)
505 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
506 (match_operand:SI 1 "const0_operand" "")))
507 (set (match_operand:SI 2 "register_operand" "=d,d,d")
509 "s390_match_ccmode(insn, CCSmode) && !TARGET_EXTIMM"
514 [(set_attr "op_type" "RR,RS,RSY")])
516 (define_insn "*tstsi_cconly"
517 [(set (reg CC_REGNUM)
518 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
519 (match_operand:SI 1 "const0_operand" "")))
520 (clobber (match_scratch:SI 2 "=X,d,d"))]
521 "s390_match_ccmode(insn, CCSmode)"
526 [(set_attr "op_type" "RR,RS,RSY")])
528 (define_insn "*tstdi_cconly_31"
529 [(set (reg CC_REGNUM)
530 (compare (match_operand:DI 0 "register_operand" "d")
531 (match_operand:DI 1 "const0_operand" "")))]
532 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
534 [(set_attr "op_type" "RS")
535 (set_attr "atype" "reg")])
537 (define_insn "*tst<mode>_cconly2"
538 [(set (reg CC_REGNUM)
539 (compare (match_operand:GPR 0 "register_operand" "d")
540 (match_operand:GPR 1 "const0_operand" "")))]
541 "s390_match_ccmode(insn, CCSmode)"
543 [(set_attr "op_type" "RR<E>")])
545 ; tst(hi|qi) intruction pattern(s).
547 (define_insn "*tst<mode>CCT"
548 [(set (reg CC_REGNUM)
549 (compare (match_operand:HQI 0 "nonimmediate_operand" "?Q,?S,d")
550 (match_operand:HQI 1 "const0_operand" "")))
551 (set (match_operand:HQI 2 "register_operand" "=d,d,0")
553 "s390_match_ccmode(insn, CCTmode)"
556 icmy\t%2,<icm_lo>,%S0
558 [(set_attr "op_type" "RS,RSY,RI")])
560 (define_insn "*tsthiCCT_cconly"
561 [(set (reg CC_REGNUM)
562 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
563 (match_operand:HI 1 "const0_operand" "")))
564 (clobber (match_scratch:HI 2 "=d,d,X"))]
565 "s390_match_ccmode(insn, CCTmode)"
570 [(set_attr "op_type" "RS,RSY,RI")])
572 (define_insn "*tstqiCCT_cconly"
573 [(set (reg CC_REGNUM)
574 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
575 (match_operand:QI 1 "const0_operand" "")))]
576 "s390_match_ccmode(insn, CCTmode)"
581 [(set_attr "op_type" "SI,SIY,RI")])
583 (define_insn "*tst<mode>"
584 [(set (reg CC_REGNUM)
585 (compare (match_operand:HQI 0 "s_operand" "Q,S")
586 (match_operand:HQI 1 "const0_operand" "")))
587 (set (match_operand:HQI 2 "register_operand" "=d,d")
589 "s390_match_ccmode(insn, CCSmode)"
592 icmy\t%2,<icm_lo>,%S0"
593 [(set_attr "op_type" "RS,RSY")])
595 (define_insn "*tst<mode>_cconly"
596 [(set (reg CC_REGNUM)
597 (compare (match_operand:HQI 0 "s_operand" "Q,S")
598 (match_operand:HQI 1 "const0_operand" "")))
599 (clobber (match_scratch:HQI 2 "=d,d"))]
600 "s390_match_ccmode(insn, CCSmode)"
603 icmy\t%2,<icm_lo>,%S0"
604 [(set_attr "op_type" "RS,RSY")])
607 ; Compare (equality) instructions
609 (define_insn "*cmpdi_cct"
610 [(set (reg CC_REGNUM)
611 (compare (match_operand:DI 0 "nonimmediate_operand" "%d,d,d,d,Q")
612 (match_operand:DI 1 "general_operand" "d,K,Os,m,BQ")))]
613 "s390_match_ccmode (insn, CCTmode) && TARGET_64BIT"
620 [(set_attr "op_type" "RRE,RI,RIL,RXY,SS")])
622 (define_insn "*cmpsi_cct"
623 [(set (reg CC_REGNUM)
624 (compare (match_operand:SI 0 "nonimmediate_operand" "%d,d,d,d,d,Q")
625 (match_operand:SI 1 "general_operand" "d,K,Os,R,T,BQ")))]
626 "s390_match_ccmode (insn, CCTmode)"
634 [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS")])
637 ; Compare (signed) instructions
639 (define_insn "*cmpdi_ccs_sign"
640 [(set (reg CC_REGNUM)
641 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
642 (match_operand:DI 0 "register_operand" "d,d")))]
643 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
647 [(set_attr "op_type" "RRE,RXY")])
649 (define_insn "*cmpsi_ccs_sign"
650 [(set (reg CC_REGNUM)
651 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
652 (match_operand:SI 0 "register_operand" "d,d")))]
653 "s390_match_ccmode(insn, CCSRmode)"
657 [(set_attr "op_type" "RX,RXY")])
659 (define_insn "*cmp<mode>_ccs"
660 [(set (reg CC_REGNUM)
661 (compare (match_operand:GPR 0 "register_operand" "d,d,d,d,d")
662 (match_operand:GPR 1 "general_operand" "d,K,Os,R,T")))]
663 "s390_match_ccmode(insn, CCSmode)"
670 [(set_attr "op_type" "RR<E>,RI,RIL,RX<Y>,RXY")])
673 ; Compare (unsigned) instructions
675 (define_insn "*cmpdi_ccu_zero"
676 [(set (reg CC_REGNUM)
677 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
678 (match_operand:DI 0 "register_operand" "d,d")))]
679 "s390_match_ccmode (insn, CCURmode) && TARGET_64BIT"
683 [(set_attr "op_type" "RRE,RXY")])
685 (define_insn "*cmpdi_ccu"
686 [(set (reg CC_REGNUM)
687 (compare (match_operand:DI 0 "nonimmediate_operand" "d,d,d,Q,BQ")
688 (match_operand:DI 1 "general_operand" "d,Op,m,BQ,Q")))]
689 "s390_match_ccmode (insn, CCUmode) && TARGET_64BIT"
696 [(set_attr "op_type" "RRE,RIL,RXY,SS,SS")])
698 (define_insn "*cmpsi_ccu"
699 [(set (reg CC_REGNUM)
700 (compare (match_operand:SI 0 "nonimmediate_operand" "d,d,d,d,Q,BQ")
701 (match_operand:SI 1 "general_operand" "d,Os,R,T,BQ,Q")))]
702 "s390_match_ccmode (insn, CCUmode)"
710 [(set_attr "op_type" "RR,RIL,RX,RXY,SS,SS")])
712 (define_insn "*cmphi_ccu"
713 [(set (reg CC_REGNUM)
714 (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,BQ")
715 (match_operand:HI 1 "general_operand" "Q,S,BQ,Q")))]
716 "s390_match_ccmode (insn, CCUmode)
717 && !register_operand (operands[1], HImode)"
723 [(set_attr "op_type" "RS,RSY,SS,SS")])
725 (define_insn "*cmpqi_ccu"
726 [(set (reg CC_REGNUM)
727 (compare (match_operand:QI 0 "nonimmediate_operand" "d,d,Q,S,Q,BQ")
728 (match_operand:QI 1 "general_operand" "Q,S,n,n,BQ,Q")))]
729 "s390_match_ccmode (insn, CCUmode)
730 && !register_operand (operands[1], QImode)"
738 [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS")])
741 ; Block compare (CLC) instruction patterns.
744 [(set (reg CC_REGNUM)
745 (compare (match_operand:BLK 0 "memory_operand" "Q")
746 (match_operand:BLK 1 "memory_operand" "Q")))
747 (use (match_operand 2 "const_int_operand" "n"))]
748 "s390_match_ccmode (insn, CCUmode)
749 && INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
750 "clc\t%O0(%2,%R0),%S1"
751 [(set_attr "op_type" "SS")])
754 [(set (reg CC_REGNUM)
755 (compare (match_operand 0 "memory_operand" "")
756 (match_operand 1 "memory_operand" "")))]
758 && s390_match_ccmode (insn, CCUmode)
759 && GET_MODE (operands[0]) == GET_MODE (operands[1])
760 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
762 [(set (match_dup 0) (match_dup 1))
763 (use (match_dup 2))])]
765 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
766 operands[0] = adjust_address (operands[0], BLKmode, 0);
767 operands[1] = adjust_address (operands[1], BLKmode, 0);
769 operands[1] = gen_rtx_COMPARE (GET_MODE (SET_DEST (PATTERN (curr_insn))),
770 operands[0], operands[1]);
771 operands[0] = SET_DEST (PATTERN (curr_insn));
775 ; (DF|SF) instructions
777 (define_insn "*cmp<mode>_ccs_0"
778 [(set (reg CC_REGNUM)
779 (compare (match_operand:FPR 0 "register_operand" "f")
780 (match_operand:FPR 1 "const0_operand" "")))]
781 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
783 [(set_attr "op_type" "RRE")
784 (set_attr "type" "fsimp<mode>")])
786 (define_insn "*cmp<mode>_ccs_0_ibm"
787 [(set (reg CC_REGNUM)
788 (compare (match_operand:FPR 0 "register_operand" "f")
789 (match_operand:FPR 1 "const0_operand" "")))]
790 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
792 [(set_attr "op_type" "<RRe>")
793 (set_attr "type" "fsimp<mode>")])
795 (define_insn "*cmp<mode>_ccs"
796 [(set (reg CC_REGNUM)
797 (compare (match_operand:FPR 0 "register_operand" "f,f")
798 (match_operand:FPR 1 "general_operand" "f,<Rf>")))]
799 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
803 [(set_attr "op_type" "RRE,RXE")
804 (set_attr "type" "fsimp<mode>")])
806 (define_insn "*cmp<mode>_ccs_ibm"
807 [(set (reg CC_REGNUM)
808 (compare (match_operand:FPR 0 "register_operand" "f,f")
809 (match_operand:FPR 1 "general_operand" "f,<Rf>")))]
810 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
814 [(set_attr "op_type" "<RRe>,<RXe>")
815 (set_attr "type" "fsimp<mode>")])
819 ;;- Move instructions.
823 ; movti instruction pattern(s).
827 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
828 (match_operand:TI 1 "general_operand" "QS,d,dPm,d,Q"))]
836 [(set_attr "op_type" "RSY,RSY,*,*,SS")
837 (set_attr "type" "lm,stm,*,*,*")])
840 [(set (match_operand:TI 0 "nonimmediate_operand" "")
841 (match_operand:TI 1 "general_operand" ""))]
842 "TARGET_64BIT && reload_completed
843 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
844 [(set (match_dup 2) (match_dup 4))
845 (set (match_dup 3) (match_dup 5))]
847 operands[2] = operand_subword (operands[0], 0, 0, TImode);
848 operands[3] = operand_subword (operands[0], 1, 0, TImode);
849 operands[4] = operand_subword (operands[1], 0, 0, TImode);
850 operands[5] = operand_subword (operands[1], 1, 0, TImode);
854 [(set (match_operand:TI 0 "nonimmediate_operand" "")
855 (match_operand:TI 1 "general_operand" ""))]
856 "TARGET_64BIT && reload_completed
857 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
858 [(set (match_dup 2) (match_dup 4))
859 (set (match_dup 3) (match_dup 5))]
861 operands[2] = operand_subword (operands[0], 1, 0, TImode);
862 operands[3] = operand_subword (operands[0], 0, 0, TImode);
863 operands[4] = operand_subword (operands[1], 1, 0, TImode);
864 operands[5] = operand_subword (operands[1], 0, 0, TImode);
868 [(set (match_operand:TI 0 "register_operand" "")
869 (match_operand:TI 1 "memory_operand" ""))]
870 "TARGET_64BIT && reload_completed
871 && !s_operand (operands[1], VOIDmode)"
872 [(set (match_dup 0) (match_dup 1))]
874 rtx addr = operand_subword (operands[0], 1, 0, TImode);
875 s390_load_address (addr, XEXP (operands[1], 0));
876 operands[1] = replace_equiv_address (operands[1], addr);
879 (define_expand "reload_outti"
880 [(parallel [(match_operand:TI 0 "" "")
881 (match_operand:TI 1 "register_operand" "d")
882 (match_operand:DI 2 "register_operand" "=&a")])]
885 gcc_assert (MEM_P (operands[0]));
886 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
887 operands[0] = replace_equiv_address (operands[0], operands[2]);
888 emit_move_insn (operands[0], operands[1]);
893 ; movdi instruction pattern(s).
896 (define_expand "movdi"
897 [(set (match_operand:DI 0 "general_operand" "")
898 (match_operand:DI 1 "general_operand" ""))]
901 /* Handle symbolic constants. */
902 if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
903 emit_symbolic_move (operands);
906 (define_insn "*movdi_larl"
907 [(set (match_operand:DI 0 "register_operand" "=d")
908 (match_operand:DI 1 "larl_operand" "X"))]
910 && !FP_REG_P (operands[0])"
912 [(set_attr "op_type" "RIL")
913 (set_attr "type" "larl")])
915 (define_insn "*movdi_64extimm"
916 [(set (match_operand:DI 0 "nonimmediate_operand"
917 "=d,d,d,d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,d,t,Q,t,?Q")
918 (match_operand:DI 1 "general_operand"
919 "K,N0HD0,N1HD0,N2HD0,N3HD0,Os,N0SD0,N1SD0,L,d,m,d,*f,R,T,*f,*f,t,d,t,Q,?Q"))]
920 "TARGET_64BIT && TARGET_EXTIMM"
944 [(set_attr "op_type" "RI,RI,RI,RI,RI,RIL,RIL,RIL,RXY,RRE,RXY,RXY,
945 RR,RX,RXY,RX,RXY,*,*,RS,RS,SS")
946 (set_attr "type" "*,*,*,*,*,*,*,*,la,lr,load,store,
947 floaddf,floaddf,floaddf,fstoredf,fstoredf,*,*,*,*,*")])
949 (define_insn "*movdi_64"
950 [(set (match_operand:DI 0 "nonimmediate_operand"
951 "=d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,d,t,Q,t,?Q")
952 (match_operand:DI 1 "general_operand"
953 "K,N0HD0,N1HD0,N2HD0,N3HD0,L,d,m,d,*f,R,T,*f,*f,t,d,t,Q,?Q"))]
954 "TARGET_64BIT && !TARGET_EXTIMM"
975 [(set_attr "op_type" "RI,RI,RI,RI,RI,RXY,RRE,RXY,RXY,
976 RR,RX,RXY,RX,RXY,*,*,RS,RS,SS")
977 (set_attr "type" "*,*,*,*,*,la,lr,load,store,
978 floaddf,floaddf,floaddf,fstoredf,fstoredf,*,*,*,*,*")])
981 [(set (match_operand:DI 0 "register_operand" "")
982 (match_operand:DI 1 "register_operand" ""))]
983 "TARGET_64BIT && ACCESS_REG_P (operands[1])"
984 [(set (match_dup 2) (match_dup 3))
985 (set (match_dup 0) (ashift:DI (match_dup 0) (const_int 32)))
986 (set (strict_low_part (match_dup 2)) (match_dup 4))]
987 "operands[2] = gen_lowpart (SImode, operands[0]);
988 s390_split_access_reg (operands[1], &operands[4], &operands[3]);")
991 [(set (match_operand:DI 0 "register_operand" "")
992 (match_operand:DI 1 "register_operand" ""))]
993 "TARGET_64BIT && ACCESS_REG_P (operands[0])
994 && dead_or_set_p (insn, operands[1])"
995 [(set (match_dup 3) (match_dup 2))
996 (set (match_dup 1) (lshiftrt:DI (match_dup 1) (const_int 32)))
997 (set (match_dup 4) (match_dup 2))]
998 "operands[2] = gen_lowpart (SImode, operands[1]);
999 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1002 [(set (match_operand:DI 0 "register_operand" "")
1003 (match_operand:DI 1 "register_operand" ""))]
1004 "TARGET_64BIT && ACCESS_REG_P (operands[0])
1005 && !dead_or_set_p (insn, operands[1])"
1006 [(set (match_dup 3) (match_dup 2))
1007 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))
1008 (set (match_dup 4) (match_dup 2))
1009 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))]
1010 "operands[2] = gen_lowpart (SImode, operands[1]);
1011 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1013 (define_insn "*movdi_31"
1014 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,Q,S,d,o,!*f,!*f,!*f,!R,!T,Q")
1015 (match_operand:DI 1 "general_operand" "Q,S,d,d,dPm,d,*f,R,T,*f,*f,Q"))]
1030 [(set_attr "op_type" "RS,RSY,RS,RSY,*,*,RR,RX,RXY,RX,RXY,SS")
1031 (set_attr "type" "lm,lm,stm,stm,*,*,floaddf,floaddf,floaddf,fstoredf,fstoredf,*")])
1034 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1035 (match_operand:DI 1 "general_operand" ""))]
1036 "!TARGET_64BIT && reload_completed
1037 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1038 [(set (match_dup 2) (match_dup 4))
1039 (set (match_dup 3) (match_dup 5))]
1041 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1042 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1043 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1044 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1048 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1049 (match_operand:DI 1 "general_operand" ""))]
1050 "!TARGET_64BIT && reload_completed
1051 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1052 [(set (match_dup 2) (match_dup 4))
1053 (set (match_dup 3) (match_dup 5))]
1055 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1056 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1057 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1058 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1062 [(set (match_operand:DI 0 "register_operand" "")
1063 (match_operand:DI 1 "memory_operand" ""))]
1064 "!TARGET_64BIT && reload_completed
1065 && !FP_REG_P (operands[0])
1066 && !s_operand (operands[1], VOIDmode)"
1067 [(set (match_dup 0) (match_dup 1))]
1069 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1070 s390_load_address (addr, XEXP (operands[1], 0));
1071 operands[1] = replace_equiv_address (operands[1], addr);
1074 (define_expand "reload_outdi"
1075 [(parallel [(match_operand:DI 0 "" "")
1076 (match_operand:DI 1 "register_operand" "d")
1077 (match_operand:SI 2 "register_operand" "=&a")])]
1080 gcc_assert (MEM_P (operands[0]));
1081 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
1082 operands[0] = replace_equiv_address (operands[0], operands[2]);
1083 emit_move_insn (operands[0], operands[1]);
1088 [(set (match_operand:DI 0 "register_operand" "")
1089 (mem:DI (match_operand 1 "address_operand" "")))]
1091 && !FP_REG_P (operands[0])
1092 && GET_CODE (operands[1]) == SYMBOL_REF
1093 && CONSTANT_POOL_ADDRESS_P (operands[1])
1094 && get_pool_mode (operands[1]) == DImode
1095 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1096 [(set (match_dup 0) (match_dup 2))]
1097 "operands[2] = get_pool_constant (operands[1]);")
1099 (define_insn "*la_64"
1100 [(set (match_operand:DI 0 "register_operand" "=d,d")
1101 (match_operand:QI 1 "address_operand" "U,W"))]
1106 [(set_attr "op_type" "RX,RXY")
1107 (set_attr "type" "la")])
1111 [(set (match_operand:DI 0 "register_operand" "")
1112 (match_operand:QI 1 "address_operand" ""))
1113 (clobber (reg:CC CC_REGNUM))])]
1115 && preferred_la_operand_p (operands[1], const0_rtx)"
1116 [(set (match_dup 0) (match_dup 1))]
1120 [(set (match_operand:DI 0 "register_operand" "")
1121 (match_operand:DI 1 "register_operand" ""))
1124 (plus:DI (match_dup 0)
1125 (match_operand:DI 2 "nonmemory_operand" "")))
1126 (clobber (reg:CC CC_REGNUM))])]
1128 && !reg_overlap_mentioned_p (operands[0], operands[2])
1129 && preferred_la_operand_p (operands[1], operands[2])"
1130 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1133 (define_expand "reload_indi"
1134 [(parallel [(match_operand:DI 0 "register_operand" "=a")
1135 (match_operand:DI 1 "s390_plus_operand" "")
1136 (match_operand:DI 2 "register_operand" "=&a")])]
1139 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1144 ; movsi instruction pattern(s).
1147 (define_expand "movsi"
1148 [(set (match_operand:SI 0 "general_operand" "")
1149 (match_operand:SI 1 "general_operand" ""))]
1152 /* Handle symbolic constants. */
1153 if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1154 emit_symbolic_move (operands);
1157 (define_insn "*movsi_larl"
1158 [(set (match_operand:SI 0 "register_operand" "=d")
1159 (match_operand:SI 1 "larl_operand" "X"))]
1160 "!TARGET_64BIT && TARGET_CPU_ZARCH
1161 && !FP_REG_P (operands[0])"
1163 [(set_attr "op_type" "RIL")
1164 (set_attr "type" "larl")])
1166 (define_insn "*movsi_zarch"
1167 [(set (match_operand:SI 0 "nonimmediate_operand"
1168 "=d,d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,d,t,Q,t,?Q")
1169 (match_operand:SI 1 "general_operand"
1170 "K,N0HS0,N1HS0,Os,L,d,R,T,d,d,*f,R,T,*f,*f,t,d,t,Q,?Q"))]
1193 [(set_attr "op_type" "RI,RI,RI,RIL,RXY,RR,RX,RXY,RX,RXY,
1194 RR,RX,RXY,RX,RXY,RRE,RRE,RS,RS,SS")
1195 (set_attr "type" "*,*,*,*,la,lr,load,load,store,store,
1196 floadsf,floadsf,floadsf,fstoresf,fstoresf,*,*,*,*,*")])
1198 (define_insn "*movsi_esa"
1199 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,d,t,Q,t,?Q")
1200 (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,t,d,t,Q,?Q"))]
1215 [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,RRE,RRE,RS,RS,SS")
1216 (set_attr "type" "*,lr,load,store,floadsf,floadsf,fstoresf,*,*,*,*,*")])
1219 [(set (match_operand:SI 0 "register_operand" "")
1220 (mem:SI (match_operand 1 "address_operand" "")))]
1221 "!FP_REG_P (operands[0])
1222 && GET_CODE (operands[1]) == SYMBOL_REF
1223 && CONSTANT_POOL_ADDRESS_P (operands[1])
1224 && get_pool_mode (operands[1]) == SImode
1225 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1226 [(set (match_dup 0) (match_dup 2))]
1227 "operands[2] = get_pool_constant (operands[1]);")
1229 (define_insn "*la_31"
1230 [(set (match_operand:SI 0 "register_operand" "=d,d")
1231 (match_operand:QI 1 "address_operand" "U,W"))]
1232 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1236 [(set_attr "op_type" "RX,RXY")
1237 (set_attr "type" "la")])
1241 [(set (match_operand:SI 0 "register_operand" "")
1242 (match_operand:QI 1 "address_operand" ""))
1243 (clobber (reg:CC CC_REGNUM))])]
1245 && preferred_la_operand_p (operands[1], const0_rtx)"
1246 [(set (match_dup 0) (match_dup 1))]
1250 [(set (match_operand:SI 0 "register_operand" "")
1251 (match_operand:SI 1 "register_operand" ""))
1254 (plus:SI (match_dup 0)
1255 (match_operand:SI 2 "nonmemory_operand" "")))
1256 (clobber (reg:CC CC_REGNUM))])]
1258 && !reg_overlap_mentioned_p (operands[0], operands[2])
1259 && preferred_la_operand_p (operands[1], operands[2])"
1260 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1263 (define_insn "*la_31_and"
1264 [(set (match_operand:SI 0 "register_operand" "=d,d")
1265 (and:SI (match_operand:QI 1 "address_operand" "U,W")
1266 (const_int 2147483647)))]
1271 [(set_attr "op_type" "RX,RXY")
1272 (set_attr "type" "la")])
1274 (define_insn_and_split "*la_31_and_cc"
1275 [(set (match_operand:SI 0 "register_operand" "=d")
1276 (and:SI (match_operand:QI 1 "address_operand" "p")
1277 (const_int 2147483647)))
1278 (clobber (reg:CC CC_REGNUM))]
1281 "&& reload_completed"
1283 (and:SI (match_dup 1) (const_int 2147483647)))]
1285 [(set_attr "op_type" "RX")
1286 (set_attr "type" "la")])
1288 (define_insn "force_la_31"
1289 [(set (match_operand:SI 0 "register_operand" "=d,d")
1290 (match_operand:QI 1 "address_operand" "U,W"))
1291 (use (const_int 0))]
1296 [(set_attr "op_type" "RX")
1297 (set_attr "type" "la")])
1299 (define_expand "reload_insi"
1300 [(parallel [(match_operand:SI 0 "register_operand" "=a")
1301 (match_operand:SI 1 "s390_plus_operand" "")
1302 (match_operand:SI 2 "register_operand" "=&a")])]
1305 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1310 ; movhi instruction pattern(s).
1313 (define_expand "movhi"
1314 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1315 (match_operand:HI 1 "general_operand" ""))]
1318 /* Make it explicit that loading a register from memory
1319 always sign-extends (at least) to SImode. */
1320 if (optimize && !no_new_pseudos
1321 && register_operand (operands[0], VOIDmode)
1322 && GET_CODE (operands[1]) == MEM)
1324 rtx tmp = gen_reg_rtx (SImode);
1325 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1326 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1327 operands[1] = gen_lowpart (HImode, tmp);
1331 (define_insn "*movhi"
1332 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1333 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1343 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1344 (set_attr "type" "lr,*,*,*,store,store,*")])
1347 [(set (match_operand:HI 0 "register_operand" "")
1348 (mem:HI (match_operand 1 "address_operand" "")))]
1349 "GET_CODE (operands[1]) == SYMBOL_REF
1350 && CONSTANT_POOL_ADDRESS_P (operands[1])
1351 && get_pool_mode (operands[1]) == HImode
1352 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1353 [(set (match_dup 0) (match_dup 2))]
1354 "operands[2] = get_pool_constant (operands[1]);")
1357 ; movqi instruction pattern(s).
1360 (define_expand "movqi"
1361 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1362 (match_operand:QI 1 "general_operand" ""))]
1365 /* On z/Architecture, zero-extending from memory to register
1366 is just as fast as a QImode load. */
1367 if (TARGET_ZARCH && optimize && !no_new_pseudos
1368 && register_operand (operands[0], VOIDmode)
1369 && GET_CODE (operands[1]) == MEM)
1371 rtx tmp = gen_reg_rtx (word_mode);
1372 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1373 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1374 operands[1] = gen_lowpart (QImode, tmp);
1378 (define_insn "*movqi"
1379 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1380 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1392 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1393 (set_attr "type" "lr,*,*,*,store,store,store,store,*")])
1396 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1397 (mem:QI (match_operand 1 "address_operand" "")))]
1398 "GET_CODE (operands[1]) == SYMBOL_REF
1399 && CONSTANT_POOL_ADDRESS_P (operands[1])
1400 && get_pool_mode (operands[1]) == QImode
1401 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1402 [(set (match_dup 0) (match_dup 2))]
1403 "operands[2] = get_pool_constant (operands[1]);")
1406 ; movstrictqi instruction pattern(s).
1409 (define_insn "*movstrictqi"
1410 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1411 (match_operand:QI 1 "memory_operand" "R,T"))]
1416 [(set_attr "op_type" "RX,RXY")])
1419 ; movstricthi instruction pattern(s).
1422 (define_insn "*movstricthi"
1423 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1424 (match_operand:HI 1 "memory_operand" "Q,S"))
1425 (clobber (reg:CC CC_REGNUM))]
1430 [(set_attr "op_type" "RS,RSY")])
1433 ; movstrictsi instruction pattern(s).
1436 (define_insn "movstrictsi"
1437 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d,d"))
1438 (match_operand:SI 1 "general_operand" "d,R,T,t"))]
1445 [(set_attr "op_type" "RR,RX,RXY,RRE")
1446 (set_attr "type" "lr,load,load,*")])
1449 ; movtf instruction pattern(s).
1452 (define_expand "movtf"
1453 [(set (match_operand:TF 0 "nonimmediate_operand" "")
1454 (match_operand:TF 1 "general_operand" ""))]
1458 (define_insn "*movtf_64"
1459 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,f,f,o,d,QS,d,o,Q")
1460 (match_operand:TF 1 "general_operand" "G,f,o,f,QS,d,dm,d,Q"))]
1472 [(set_attr "op_type" "RRE,RRE,*,*,RSY,RSY,*,*,*")
1473 (set_attr "type" "fsimptf,fsimptf,*,*,lm,stm,*,*,*")])
1475 (define_insn "*movtf_31"
1476 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,f,f,o,Q")
1477 (match_operand:TF 1 "general_operand" "G,f,o,f,Q"))]
1485 [(set_attr "op_type" "RRE,RRE,*,*,*")
1486 (set_attr "type" "fsimptf,fsimptf,*,*,*")])
1488 ; TFmode in GPRs splitters
1491 [(set (match_operand:TF 0 "nonimmediate_operand" "")
1492 (match_operand:TF 1 "general_operand" ""))]
1493 "TARGET_64BIT && reload_completed
1494 && s390_split_ok_p (operands[0], operands[1], TFmode, 0)"
1495 [(set (match_dup 2) (match_dup 4))
1496 (set (match_dup 3) (match_dup 5))]
1498 operands[2] = operand_subword (operands[0], 0, 0, TFmode);
1499 operands[3] = operand_subword (operands[0], 1, 0, TFmode);
1500 operands[4] = operand_subword (operands[1], 0, 0, TFmode);
1501 operands[5] = operand_subword (operands[1], 1, 0, TFmode);
1505 [(set (match_operand:TF 0 "nonimmediate_operand" "")
1506 (match_operand:TF 1 "general_operand" ""))]
1507 "TARGET_64BIT && reload_completed
1508 && s390_split_ok_p (operands[0], operands[1], TFmode, 1)"
1509 [(set (match_dup 2) (match_dup 4))
1510 (set (match_dup 3) (match_dup 5))]
1512 operands[2] = operand_subword (operands[0], 1, 0, TFmode);
1513 operands[3] = operand_subword (operands[0], 0, 0, TFmode);
1514 operands[4] = operand_subword (operands[1], 1, 0, TFmode);
1515 operands[5] = operand_subword (operands[1], 0, 0, TFmode);
1519 [(set (match_operand:TF 0 "register_operand" "")
1520 (match_operand:TF 1 "memory_operand" ""))]
1521 "TARGET_64BIT && reload_completed
1522 && !FP_REG_P (operands[0])
1523 && !s_operand (operands[1], VOIDmode)"
1524 [(set (match_dup 0) (match_dup 1))]
1526 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1527 s390_load_address (addr, XEXP (operands[1], 0));
1528 operands[1] = replace_equiv_address (operands[1], addr);
1531 ; TFmode in FPRs splitters
1534 [(set (match_operand:TF 0 "register_operand" "")
1535 (match_operand:TF 1 "memory_operand" ""))]
1536 "reload_completed && offsettable_memref_p (operands[1])
1537 && FP_REG_P (operands[0])"
1538 [(set (match_dup 2) (match_dup 4))
1539 (set (match_dup 3) (match_dup 5))]
1541 operands[2] = simplify_gen_subreg (DFmode, operands[0], TFmode, 0);
1542 operands[3] = simplify_gen_subreg (DFmode, operands[0], TFmode, 8);
1543 operands[4] = adjust_address_nv (operands[1], DFmode, 0);
1544 operands[5] = adjust_address_nv (operands[1], DFmode, 8);
1548 [(set (match_operand:TF 0 "memory_operand" "")
1549 (match_operand:TF 1 "register_operand" ""))]
1550 "reload_completed && offsettable_memref_p (operands[0])
1551 && FP_REG_P (operands[1])"
1552 [(set (match_dup 2) (match_dup 4))
1553 (set (match_dup 3) (match_dup 5))]
1555 operands[2] = adjust_address_nv (operands[0], DFmode, 0);
1556 operands[3] = adjust_address_nv (operands[0], DFmode, 8);
1557 operands[4] = simplify_gen_subreg (DFmode, operands[1], TFmode, 0);
1558 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, 8);
1561 (define_expand "reload_outtf"
1562 [(parallel [(match_operand:TF 0 "" "")
1563 (match_operand:TF 1 "register_operand" "f")
1564 (match_operand:SI 2 "register_operand" "=&a")])]
1567 rtx addr = gen_lowpart (Pmode, operands[2]);
1569 gcc_assert (MEM_P (operands[0]));
1570 s390_load_address (addr, find_replacement (&XEXP (operands[0], 0)));
1571 operands[0] = replace_equiv_address (operands[0], addr);
1572 emit_move_insn (operands[0], operands[1]);
1576 (define_expand "reload_intf"
1577 [(parallel [(match_operand:TF 0 "register_operand" "=f")
1578 (match_operand:TF 1 "" "")
1579 (match_operand:SI 2 "register_operand" "=&a")])]
1582 rtx addr = gen_lowpart (Pmode, operands[2]);
1584 gcc_assert (MEM_P (operands[1]));
1585 s390_load_address (addr, find_replacement (&XEXP (operands[1], 0)));
1586 operands[1] = replace_equiv_address (operands[1], addr);
1587 emit_move_insn (operands[0], operands[1]);
1592 ; movdf instruction pattern(s).
1595 (define_expand "movdf"
1596 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1597 (match_operand:DF 1 "general_operand" ""))]
1601 (define_insn "*movdf_64"
1602 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,m,?Q")
1603 (match_operand:DF 1 "general_operand" "G,f,R,T,f,f,d,m,d,?Q"))]
1616 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1617 (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,fstoredf,fstoredf,lr,load,store,*")])
1619 (define_insn "*movdf_31"
1620 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,Q,S,d,o,Q")
1621 (match_operand:DF 1 "general_operand" "G,f,R,T,f,f,Q,S,d,d,dPm,d,Q"))]
1637 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*,SS")
1638 (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,fstoredf,fstoredf,\
1639 lm,lm,stm,stm,*,*,*")])
1642 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1643 (match_operand:DF 1 "general_operand" ""))]
1644 "!TARGET_64BIT && reload_completed
1645 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1646 [(set (match_dup 2) (match_dup 4))
1647 (set (match_dup 3) (match_dup 5))]
1649 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1650 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1651 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1652 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1656 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1657 (match_operand:DF 1 "general_operand" ""))]
1658 "!TARGET_64BIT && reload_completed
1659 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1660 [(set (match_dup 2) (match_dup 4))
1661 (set (match_dup 3) (match_dup 5))]
1663 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1664 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1665 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1666 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1670 [(set (match_operand:DF 0 "register_operand" "")
1671 (match_operand:DF 1 "memory_operand" ""))]
1672 "!TARGET_64BIT && reload_completed
1673 && !FP_REG_P (operands[0])
1674 && !s_operand (operands[1], VOIDmode)"
1675 [(set (match_dup 0) (match_dup 1))]
1677 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1678 s390_load_address (addr, XEXP (operands[1], 0));
1679 operands[1] = replace_equiv_address (operands[1], addr);
1682 (define_expand "reload_outdf"
1683 [(parallel [(match_operand:DF 0 "" "")
1684 (match_operand:DF 1 "register_operand" "d")
1685 (match_operand:SI 2 "register_operand" "=&a")])]
1688 gcc_assert (MEM_P (operands[0]));
1689 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
1690 operands[0] = replace_equiv_address (operands[0], operands[2]);
1691 emit_move_insn (operands[0], operands[1]);
1696 ; movsf instruction pattern(s).
1699 (define_insn "movsf"
1700 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,d,R,T,?Q")
1701 (match_operand:SF 1 "general_operand" "G,f,R,T,f,f,d,R,T,d,d,?Q"))]
1716 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1717 (set_attr "type" "fsimpsf,floadsf,floadsf,floadsf,fstoresf,fstoresf,
1718 lr,load,load,store,store,*")])
1721 ; movcc instruction pattern
1724 (define_insn "movcc"
1725 [(set (match_operand:CC 0 "nonimmediate_operand" "=d,c,d,d,d,R,T")
1726 (match_operand:CC 1 "nonimmediate_operand" "d,d,c,R,T,d,d"))]
1736 [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY")
1737 (set_attr "type" "lr,*,*,store,store,load,load")])
1740 ; Block move (MVC) patterns.
1744 [(set (match_operand:BLK 0 "memory_operand" "=Q")
1745 (match_operand:BLK 1 "memory_operand" "Q"))
1746 (use (match_operand 2 "const_int_operand" "n"))]
1747 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
1748 "mvc\t%O0(%2,%R0),%S1"
1749 [(set_attr "op_type" "SS")])
1752 [(set (match_operand 0 "memory_operand" "")
1753 (match_operand 1 "memory_operand" ""))]
1755 && GET_MODE (operands[0]) == GET_MODE (operands[1])
1756 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
1758 [(set (match_dup 0) (match_dup 1))
1759 (use (match_dup 2))])]
1761 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
1762 operands[0] = adjust_address (operands[0], BLKmode, 0);
1763 operands[1] = adjust_address (operands[1], BLKmode, 0);
1768 [(set (match_operand:BLK 0 "memory_operand" "")
1769 (match_operand:BLK 1 "memory_operand" ""))
1770 (use (match_operand 2 "const_int_operand" ""))])
1772 [(set (match_operand:BLK 3 "memory_operand" "")
1773 (match_operand:BLK 4 "memory_operand" ""))
1774 (use (match_operand 5 "const_int_operand" ""))])]
1775 "s390_offset_p (operands[0], operands[3], operands[2])
1776 && s390_offset_p (operands[1], operands[4], operands[2])
1777 && !s390_overlap_p (operands[0], operands[1],
1778 INTVAL (operands[2]) + INTVAL (operands[5]))
1779 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
1781 [(set (match_dup 6) (match_dup 7))
1782 (use (match_dup 8))])]
1783 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
1784 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
1785 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
1789 ; load_multiple pattern(s).
1791 ; ??? Due to reload problems with replacing registers inside match_parallel
1792 ; we currently support load_multiple/store_multiple only after reload.
1795 (define_expand "load_multiple"
1796 [(match_par_dup 3 [(set (match_operand 0 "" "")
1797 (match_operand 1 "" ""))
1798 (use (match_operand 2 "" ""))])]
1801 enum machine_mode mode;
1807 /* Support only loading a constant number of fixed-point registers from
1808 memory and only bother with this if more than two */
1809 if (GET_CODE (operands[2]) != CONST_INT
1810 || INTVAL (operands[2]) < 2
1811 || INTVAL (operands[2]) > 16
1812 || GET_CODE (operands[1]) != MEM
1813 || GET_CODE (operands[0]) != REG
1814 || REGNO (operands[0]) >= 16)
1817 count = INTVAL (operands[2]);
1818 regno = REGNO (operands[0]);
1819 mode = GET_MODE (operands[0]);
1820 if (mode != SImode && mode != word_mode)
1823 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1826 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1828 from = XEXP (operands[1], 0);
1831 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1832 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1833 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1835 from = XEXP (XEXP (operands[1], 0), 0);
1836 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1843 from = force_reg (Pmode, XEXP (operands[1], 0));
1847 for (i = 0; i < count; i++)
1848 XVECEXP (operands[3], 0, i)
1849 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1850 change_address (operands[1], mode,
1851 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1854 (define_insn "*load_multiple_di"
1855 [(match_parallel 0 "load_multiple_operation"
1856 [(set (match_operand:DI 1 "register_operand" "=r")
1857 (match_operand:DI 2 "s_operand" "QS"))])]
1858 "reload_completed && word_mode == DImode"
1860 int words = XVECLEN (operands[0], 0);
1861 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1862 return "lmg\t%1,%0,%S2";
1864 [(set_attr "op_type" "RSY")
1865 (set_attr "type" "lm")])
1867 (define_insn "*load_multiple_si"
1868 [(match_parallel 0 "load_multiple_operation"
1869 [(set (match_operand:SI 1 "register_operand" "=r,r")
1870 (match_operand:SI 2 "s_operand" "Q,S"))])]
1873 int words = XVECLEN (operands[0], 0);
1874 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1875 return which_alternative == 0 ? "lm\t%1,%0,%S2" : "lmy\t%1,%0,%S2";
1877 [(set_attr "op_type" "RS,RSY")
1878 (set_attr "type" "lm")])
1881 ; store multiple pattern(s).
1884 (define_expand "store_multiple"
1885 [(match_par_dup 3 [(set (match_operand 0 "" "")
1886 (match_operand 1 "" ""))
1887 (use (match_operand 2 "" ""))])]
1890 enum machine_mode mode;
1896 /* Support only storing a constant number of fixed-point registers to
1897 memory and only bother with this if more than two. */
1898 if (GET_CODE (operands[2]) != CONST_INT
1899 || INTVAL (operands[2]) < 2
1900 || INTVAL (operands[2]) > 16
1901 || GET_CODE (operands[0]) != MEM
1902 || GET_CODE (operands[1]) != REG
1903 || REGNO (operands[1]) >= 16)
1906 count = INTVAL (operands[2]);
1907 regno = REGNO (operands[1]);
1908 mode = GET_MODE (operands[1]);
1909 if (mode != SImode && mode != word_mode)
1912 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1916 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1918 to = XEXP (operands[0], 0);
1921 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1922 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1923 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1925 to = XEXP (XEXP (operands[0], 0), 0);
1926 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1933 to = force_reg (Pmode, XEXP (operands[0], 0));
1937 for (i = 0; i < count; i++)
1938 XVECEXP (operands[3], 0, i)
1939 = gen_rtx_SET (VOIDmode,
1940 change_address (operands[0], mode,
1941 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1942 gen_rtx_REG (mode, regno + i));
1945 (define_insn "*store_multiple_di"
1946 [(match_parallel 0 "store_multiple_operation"
1947 [(set (match_operand:DI 1 "s_operand" "=QS")
1948 (match_operand:DI 2 "register_operand" "r"))])]
1949 "reload_completed && word_mode == DImode"
1951 int words = XVECLEN (operands[0], 0);
1952 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1953 return "stmg\t%2,%0,%S1";
1955 [(set_attr "op_type" "RSY")
1956 (set_attr "type" "stm")])
1959 (define_insn "*store_multiple_si"
1960 [(match_parallel 0 "store_multiple_operation"
1961 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1962 (match_operand:SI 2 "register_operand" "r,r"))])]
1965 int words = XVECLEN (operands[0], 0);
1966 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1967 return which_alternative == 0 ? "stm\t%2,%0,%S1" : "stmy\t%2,%0,%S1";
1969 [(set_attr "op_type" "RS,RSY")
1970 (set_attr "type" "stm")])
1973 ;; String instructions.
1976 (define_insn "*execute"
1977 [(match_parallel 0 ""
1978 [(unspec [(match_operand 1 "register_operand" "a")
1979 (match_operand:BLK 2 "memory_operand" "R")
1980 (match_operand 3 "" "")] UNSPEC_EXECUTE)])]
1981 "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
1982 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
1984 [(set_attr "op_type" "RX")
1985 (set_attr "type" "cs")])
1989 ; strlenM instruction pattern(s).
1992 (define_expand "strlen<mode>"
1993 [(set (reg:SI 0) (match_operand:SI 2 "immediate_operand" ""))
1996 (unspec:P [(const_int 0)
1997 (match_operand:BLK 1 "memory_operand" "")
1999 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
2000 (clobber (scratch:P))
2001 (clobber (reg:CC CC_REGNUM))])
2003 [(set (match_operand:P 0 "register_operand" "")
2004 (minus:P (match_dup 4) (match_dup 5)))
2005 (clobber (reg:CC CC_REGNUM))])]
2008 operands[4] = gen_reg_rtx (Pmode);
2009 operands[5] = gen_reg_rtx (Pmode);
2010 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
2011 operands[1] = replace_equiv_address (operands[1], operands[5]);
2014 (define_insn "*strlen<mode>"
2015 [(set (match_operand:P 0 "register_operand" "=a")
2016 (unspec:P [(match_operand:P 2 "general_operand" "0")
2017 (mem:BLK (match_operand:P 3 "register_operand" "1"))
2019 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
2020 (clobber (match_scratch:P 1 "=a"))
2021 (clobber (reg:CC CC_REGNUM))]
2023 "srst\t%0,%1\;jo\t.-4"
2024 [(set_attr "length" "8")
2025 (set_attr "type" "vs")])
2028 ; cmpstrM instruction pattern(s).
2031 (define_expand "cmpstrsi"
2032 [(set (reg:SI 0) (const_int 0))
2034 [(clobber (match_operand 3 "" ""))
2035 (clobber (match_dup 4))
2036 (set (reg:CCU CC_REGNUM)
2037 (compare:CCU (match_operand:BLK 1 "memory_operand" "")
2038 (match_operand:BLK 2 "memory_operand" "")))
2041 [(set (match_operand:SI 0 "register_operand" "=d")
2042 (unspec:SI [(reg:CCU CC_REGNUM)] UNSPEC_CMPINT))
2043 (clobber (reg:CC CC_REGNUM))])]
2046 /* As the result of CMPINT is inverted compared to what we need,
2047 we have to swap the operands. */
2048 rtx op1 = operands[2];
2049 rtx op2 = operands[1];
2050 rtx addr1 = gen_reg_rtx (Pmode);
2051 rtx addr2 = gen_reg_rtx (Pmode);
2053 emit_move_insn (addr1, force_operand (XEXP (op1, 0), NULL_RTX));
2054 emit_move_insn (addr2, force_operand (XEXP (op2, 0), NULL_RTX));
2055 operands[1] = replace_equiv_address_nv (op1, addr1);
2056 operands[2] = replace_equiv_address_nv (op2, addr2);
2057 operands[3] = addr1;
2058 operands[4] = addr2;
2061 (define_insn "*cmpstr<mode>"
2062 [(clobber (match_operand:P 0 "register_operand" "=d"))
2063 (clobber (match_operand:P 1 "register_operand" "=d"))
2064 (set (reg:CCU CC_REGNUM)
2065 (compare:CCU (mem:BLK (match_operand:P 2 "register_operand" "0"))
2066 (mem:BLK (match_operand:P 3 "register_operand" "1"))))
2069 "clst\t%0,%1\;jo\t.-4"
2070 [(set_attr "length" "8")
2071 (set_attr "type" "vs")])
2074 ; movstr instruction pattern.
2077 (define_expand "movstr"
2078 [(set (reg:SI 0) (const_int 0))
2080 [(clobber (match_dup 3))
2081 (set (match_operand:BLK 1 "memory_operand" "")
2082 (match_operand:BLK 2 "memory_operand" ""))
2083 (set (match_operand 0 "register_operand" "")
2084 (unspec [(match_dup 1)
2086 (reg:SI 0)] UNSPEC_MVST))
2087 (clobber (reg:CC CC_REGNUM))])]
2090 rtx addr1 = gen_reg_rtx (Pmode);
2091 rtx addr2 = gen_reg_rtx (Pmode);
2093 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2094 emit_move_insn (addr2, force_operand (XEXP (operands[2], 0), NULL_RTX));
2095 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2096 operands[2] = replace_equiv_address_nv (operands[2], addr2);
2097 operands[3] = addr2;
2100 (define_insn "*movstr"
2101 [(clobber (match_operand:P 2 "register_operand" "=d"))
2102 (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
2103 (mem:BLK (match_operand:P 3 "register_operand" "2")))
2104 (set (match_operand:P 0 "register_operand" "=d")
2105 (unspec [(mem:BLK (match_dup 1))
2106 (mem:BLK (match_dup 3))
2107 (reg:SI 0)] UNSPEC_MVST))
2108 (clobber (reg:CC CC_REGNUM))]
2110 "mvst\t%1,%2\;jo\t.-4"
2111 [(set_attr "length" "8")
2112 (set_attr "type" "vs")])
2116 ; movmemM instruction pattern(s).
2119 (define_expand "movmem<mode>"
2120 [(set (match_operand:BLK 0 "memory_operand" "")
2121 (match_operand:BLK 1 "memory_operand" ""))
2122 (use (match_operand:GPR 2 "general_operand" ""))
2123 (match_operand 3 "" "")]
2125 "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
2127 ; Move a block that is up to 256 bytes in length.
2128 ; The block length is taken as (operands[2] % 256) + 1.
2130 (define_expand "movmem_short"
2132 [(set (match_operand:BLK 0 "memory_operand" "")
2133 (match_operand:BLK 1 "memory_operand" ""))
2134 (use (match_operand 2 "nonmemory_operand" ""))
2135 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2136 (clobber (match_dup 3))])]
2138 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2140 (define_insn "*movmem_short"
2141 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q")
2142 (match_operand:BLK 1 "memory_operand" "Q,Q,Q"))
2143 (use (match_operand 2 "nonmemory_operand" "n,a,a"))
2144 (use (match_operand 3 "immediate_operand" "X,R,X"))
2145 (clobber (match_scratch 4 "=X,X,&a"))]
2146 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2147 && GET_MODE (operands[4]) == Pmode"
2149 [(set_attr "type" "cs")])
2152 [(set (match_operand:BLK 0 "memory_operand" "")
2153 (match_operand:BLK 1 "memory_operand" ""))
2154 (use (match_operand 2 "const_int_operand" ""))
2155 (use (match_operand 3 "immediate_operand" ""))
2156 (clobber (scratch))]
2159 [(set (match_dup 0) (match_dup 1))
2160 (use (match_dup 2))])]
2161 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
2164 [(set (match_operand:BLK 0 "memory_operand" "")
2165 (match_operand:BLK 1 "memory_operand" ""))
2166 (use (match_operand 2 "register_operand" ""))
2167 (use (match_operand 3 "memory_operand" ""))
2168 (clobber (scratch))]
2171 [(unspec [(match_dup 2) (match_dup 3)
2172 (const_int 0)] UNSPEC_EXECUTE)
2173 (set (match_dup 0) (match_dup 1))
2174 (use (const_int 1))])]
2178 [(set (match_operand:BLK 0 "memory_operand" "")
2179 (match_operand:BLK 1 "memory_operand" ""))
2180 (use (match_operand 2 "register_operand" ""))
2181 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2182 (clobber (match_operand 3 "register_operand" ""))]
2183 "reload_completed && TARGET_CPU_ZARCH"
2184 [(set (match_dup 3) (label_ref (match_dup 4)))
2186 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
2187 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
2188 (set (match_dup 0) (match_dup 1))
2189 (use (const_int 1))])]
2190 "operands[4] = gen_label_rtx ();")
2192 ; Move a block of arbitrary length.
2194 (define_expand "movmem_long"
2196 [(clobber (match_dup 2))
2197 (clobber (match_dup 3))
2198 (set (match_operand:BLK 0 "memory_operand" "")
2199 (match_operand:BLK 1 "memory_operand" ""))
2200 (use (match_operand 2 "general_operand" ""))
2202 (clobber (reg:CC CC_REGNUM))])]
2205 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2206 rtx reg0 = gen_reg_rtx (dword_mode);
2207 rtx reg1 = gen_reg_rtx (dword_mode);
2208 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2209 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2210 rtx len0 = gen_lowpart (Pmode, reg0);
2211 rtx len1 = gen_lowpart (Pmode, reg1);
2213 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2214 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2215 emit_move_insn (len0, operands[2]);
2217 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2218 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2219 emit_move_insn (len1, operands[2]);
2221 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2222 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2227 (define_insn "*movmem_long"
2228 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
2229 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
2230 (set (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
2231 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0)))
2234 (clobber (reg:CC CC_REGNUM))]
2236 "mvcle\t%0,%1,0\;jo\t.-4"
2237 [(set_attr "length" "8")
2238 (set_attr "type" "vs")])
2241 ; setmemM instruction pattern(s).
2244 (define_expand "setmem<mode>"
2245 [(set (match_operand:BLK 0 "memory_operand" "")
2246 (match_operand:QI 2 "general_operand" ""))
2247 (use (match_operand:GPR 1 "general_operand" ""))
2248 (match_operand 3 "" "")]
2250 "s390_expand_setmem (operands[0], operands[1], operands[2]); DONE;")
2252 ; Clear a block that is up to 256 bytes in length.
2253 ; The block length is taken as (operands[1] % 256) + 1.
2255 (define_expand "clrmem_short"
2257 [(set (match_operand:BLK 0 "memory_operand" "")
2259 (use (match_operand 1 "nonmemory_operand" ""))
2260 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2261 (clobber (match_dup 2))
2262 (clobber (reg:CC CC_REGNUM))])]
2264 "operands[2] = gen_rtx_SCRATCH (Pmode);")
2266 (define_insn "*clrmem_short"
2267 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q")
2269 (use (match_operand 1 "nonmemory_operand" "n,a,a"))
2270 (use (match_operand 2 "immediate_operand" "X,R,X"))
2271 (clobber (match_scratch 3 "=X,X,&a"))
2272 (clobber (reg:CC CC_REGNUM))]
2273 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
2274 && GET_MODE (operands[3]) == Pmode"
2276 [(set_attr "type" "cs")])
2279 [(set (match_operand:BLK 0 "memory_operand" "")
2281 (use (match_operand 1 "const_int_operand" ""))
2282 (use (match_operand 2 "immediate_operand" ""))
2284 (clobber (reg:CC CC_REGNUM))]
2287 [(set (match_dup 0) (const_int 0))
2289 (clobber (reg:CC CC_REGNUM))])]
2290 "operands[1] = GEN_INT ((INTVAL (operands[1]) & 0xff) + 1);")
2293 [(set (match_operand:BLK 0 "memory_operand" "")
2295 (use (match_operand 1 "register_operand" ""))
2296 (use (match_operand 2 "memory_operand" ""))
2298 (clobber (reg:CC CC_REGNUM))]
2301 [(unspec [(match_dup 1) (match_dup 2)
2302 (const_int 0)] UNSPEC_EXECUTE)
2303 (set (match_dup 0) (const_int 0))
2305 (clobber (reg:CC CC_REGNUM))])]
2309 [(set (match_operand:BLK 0 "memory_operand" "")
2311 (use (match_operand 1 "register_operand" ""))
2312 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2313 (clobber (match_operand 2 "register_operand" ""))
2314 (clobber (reg:CC CC_REGNUM))]
2315 "reload_completed && TARGET_CPU_ZARCH"
2316 [(set (match_dup 2) (label_ref (match_dup 3)))
2318 [(unspec [(match_dup 1) (mem:BLK (match_dup 2))
2319 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
2320 (set (match_dup 0) (const_int 0))
2322 (clobber (reg:CC CC_REGNUM))])]
2323 "operands[3] = gen_label_rtx ();")
2325 ; Initialize a block of arbitrary length with (operands[2] % 256).
2327 (define_expand "setmem_long"
2329 [(clobber (match_dup 1))
2330 (set (match_operand:BLK 0 "memory_operand" "")
2331 (match_operand 2 "shift_count_or_setmem_operand" ""))
2332 (use (match_operand 1 "general_operand" ""))
2334 (clobber (reg:CC CC_REGNUM))])]
2337 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2338 rtx reg0 = gen_reg_rtx (dword_mode);
2339 rtx reg1 = gen_reg_rtx (dword_mode);
2340 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2341 rtx len0 = gen_lowpart (Pmode, reg0);
2343 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2344 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2345 emit_move_insn (len0, operands[1]);
2347 emit_move_insn (reg1, const0_rtx);
2349 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2354 (define_insn "*setmem_long"
2355 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
2356 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
2357 (match_operand 2 "shift_count_or_setmem_operand" "Y"))
2359 (use (match_operand:<DBL> 1 "register_operand" "d"))
2360 (clobber (reg:CC CC_REGNUM))]
2362 "mvcle\t%0,%1,%Y2\;jo\t.-4"
2363 [(set_attr "length" "8")
2364 (set_attr "type" "vs")])
2366 (define_insn "*setmem_long_and"
2367 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
2368 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
2369 (and (match_operand 2 "shift_count_or_setmem_operand" "Y")
2370 (match_operand 4 "const_int_operand" "n")))
2372 (use (match_operand:<DBL> 1 "register_operand" "d"))
2373 (clobber (reg:CC CC_REGNUM))]
2374 "(INTVAL (operands[4]) & 255) == 255"
2375 "mvcle\t%0,%1,%Y2\;jo\t.-4"
2376 [(set_attr "length" "8")
2377 (set_attr "type" "vs")])
2379 ; cmpmemM instruction pattern(s).
2382 (define_expand "cmpmemsi"
2383 [(set (match_operand:SI 0 "register_operand" "")
2384 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2385 (match_operand:BLK 2 "memory_operand" "") ) )
2386 (use (match_operand:SI 3 "general_operand" ""))
2387 (use (match_operand:SI 4 "" ""))]
2389 "s390_expand_cmpmem (operands[0], operands[1],
2390 operands[2], operands[3]); DONE;")
2392 ; Compare a block that is up to 256 bytes in length.
2393 ; The block length is taken as (operands[2] % 256) + 1.
2395 (define_expand "cmpmem_short"
2397 [(set (reg:CCU CC_REGNUM)
2398 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2399 (match_operand:BLK 1 "memory_operand" "")))
2400 (use (match_operand 2 "nonmemory_operand" ""))
2401 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2402 (clobber (match_dup 3))])]
2404 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2406 (define_insn "*cmpmem_short"
2407 [(set (reg:CCU CC_REGNUM)
2408 (compare:CCU (match_operand:BLK 0 "memory_operand" "Q,Q,Q")
2409 (match_operand:BLK 1 "memory_operand" "Q,Q,Q")))
2410 (use (match_operand 2 "nonmemory_operand" "n,a,a"))
2411 (use (match_operand 3 "immediate_operand" "X,R,X"))
2412 (clobber (match_scratch 4 "=X,X,&a"))]
2413 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2414 && GET_MODE (operands[4]) == Pmode"
2416 [(set_attr "type" "cs")])
2419 [(set (reg:CCU CC_REGNUM)
2420 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2421 (match_operand:BLK 1 "memory_operand" "")))
2422 (use (match_operand 2 "const_int_operand" ""))
2423 (use (match_operand 3 "immediate_operand" ""))
2424 (clobber (scratch))]
2427 [(set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
2428 (use (match_dup 2))])]
2429 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
2432 [(set (reg:CCU CC_REGNUM)
2433 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2434 (match_operand:BLK 1 "memory_operand" "")))
2435 (use (match_operand 2 "register_operand" ""))
2436 (use (match_operand 3 "memory_operand" ""))
2437 (clobber (scratch))]
2440 [(unspec [(match_dup 2) (match_dup 3)
2441 (const_int 0)] UNSPEC_EXECUTE)
2442 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
2443 (use (const_int 1))])]
2447 [(set (reg:CCU CC_REGNUM)
2448 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2449 (match_operand:BLK 1 "memory_operand" "")))
2450 (use (match_operand 2 "register_operand" ""))
2451 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2452 (clobber (match_operand 3 "register_operand" ""))]
2453 "reload_completed && TARGET_CPU_ZARCH"
2454 [(set (match_dup 3) (label_ref (match_dup 4)))
2456 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
2457 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
2458 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
2459 (use (const_int 1))])]
2460 "operands[4] = gen_label_rtx ();")
2462 ; Compare a block of arbitrary length.
2464 (define_expand "cmpmem_long"
2466 [(clobber (match_dup 2))
2467 (clobber (match_dup 3))
2468 (set (reg:CCU CC_REGNUM)
2469 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2470 (match_operand:BLK 1 "memory_operand" "")))
2471 (use (match_operand 2 "general_operand" ""))
2472 (use (match_dup 3))])]
2475 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2476 rtx reg0 = gen_reg_rtx (dword_mode);
2477 rtx reg1 = gen_reg_rtx (dword_mode);
2478 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2479 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2480 rtx len0 = gen_lowpart (Pmode, reg0);
2481 rtx len1 = gen_lowpart (Pmode, reg1);
2483 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2484 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2485 emit_move_insn (len0, operands[2]);
2487 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2488 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2489 emit_move_insn (len1, operands[2]);
2491 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2492 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2497 (define_insn "*cmpmem_long"
2498 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
2499 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
2500 (set (reg:CCU CC_REGNUM)
2501 (compare:CCU (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
2502 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0))))
2504 (use (match_dup 3))]
2506 "clcle\t%0,%1,0\;jo\t.-4"
2507 [(set_attr "length" "8")
2508 (set_attr "type" "vs")])
2510 ; Convert CCUmode condition code to integer.
2511 ; Result is zero if EQ, positive if LTU, negative if GTU.
2513 (define_insn_and_split "cmpint"
2514 [(set (match_operand:SI 0 "register_operand" "=d")
2515 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2517 (clobber (reg:CC CC_REGNUM))]
2521 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
2523 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))
2524 (clobber (reg:CC CC_REGNUM))])])
2526 (define_insn_and_split "*cmpint_cc"
2527 [(set (reg CC_REGNUM)
2528 (compare (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2531 (set (match_operand:SI 0 "register_operand" "=d")
2532 (unspec:SI [(match_dup 1)] UNSPEC_CMPINT))]
2533 "s390_match_ccmode (insn, CCSmode)"
2535 "&& reload_completed"
2536 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
2538 [(set (match_dup 2) (match_dup 3))
2539 (set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))])]
2541 rtx result = gen_rtx_ASHIFTRT (SImode, operands[0], GEN_INT (30));
2542 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
2543 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
2546 (define_insn_and_split "*cmpint_sign"
2547 [(set (match_operand:DI 0 "register_operand" "=d")
2548 (sign_extend:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2550 (clobber (reg:CC CC_REGNUM))]
2553 "&& reload_completed"
2554 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
2556 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))
2557 (clobber (reg:CC CC_REGNUM))])])
2559 (define_insn_and_split "*cmpint_sign_cc"
2560 [(set (reg CC_REGNUM)
2561 (compare (ashiftrt:DI (ashift:DI (subreg:DI
2562 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2564 (const_int 32)) (const_int 32))
2566 (set (match_operand:DI 0 "register_operand" "=d")
2567 (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_CMPINT)))]
2568 "s390_match_ccmode (insn, CCSmode) && TARGET_64BIT"
2570 "&& reload_completed"
2571 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
2573 [(set (match_dup 2) (match_dup 3))
2574 (set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))])]
2576 rtx result = gen_rtx_ASHIFTRT (DImode, operands[0], GEN_INT (62));
2577 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
2578 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
2583 ;;- Conversion instructions.
2586 (define_insn "*sethighpartsi"
2587 [(set (match_operand:SI 0 "register_operand" "=d,d")
2588 (unspec:SI [(match_operand:BLK 1 "s_operand" "Q,S")
2589 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
2590 (clobber (reg:CC CC_REGNUM))]
2595 [(set_attr "op_type" "RS,RSY")])
2597 (define_insn "*sethighpartdi_64"
2598 [(set (match_operand:DI 0 "register_operand" "=d")
2599 (unspec:DI [(match_operand:BLK 1 "s_operand" "QS")
2600 (match_operand 2 "const_int_operand" "n")] UNSPEC_ICM))
2601 (clobber (reg:CC CC_REGNUM))]
2604 [(set_attr "op_type" "RSY")])
2606 (define_insn "*sethighpartdi_31"
2607 [(set (match_operand:DI 0 "register_operand" "=d,d")
2608 (unspec:DI [(match_operand:BLK 1 "s_operand" "Q,S")
2609 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
2610 (clobber (reg:CC CC_REGNUM))]
2615 [(set_attr "op_type" "RS,RSY")])
2617 (define_insn_and_split "*extzv<mode>"
2618 [(set (match_operand:GPR 0 "register_operand" "=d")
2619 (zero_extract:GPR (match_operand:QI 1 "s_operand" "QS")
2620 (match_operand 2 "const_int_operand" "n")
2622 (clobber (reg:CC CC_REGNUM))]
2623 "INTVAL (operands[2]) > 0
2624 && INTVAL (operands[2]) <= GET_MODE_BITSIZE (SImode)"
2626 "&& reload_completed"
2628 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
2629 (clobber (reg:CC CC_REGNUM))])
2630 (set (match_dup 0) (lshiftrt:GPR (match_dup 0) (match_dup 2)))]
2632 int bitsize = INTVAL (operands[2]);
2633 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
2634 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
2636 operands[1] = adjust_address (operands[1], BLKmode, 0);
2637 set_mem_size (operands[1], GEN_INT (size));
2638 operands[2] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - bitsize);
2639 operands[3] = GEN_INT (mask);
2642 (define_insn_and_split "*extv<mode>"
2643 [(set (match_operand:GPR 0 "register_operand" "=d")
2644 (sign_extract:GPR (match_operand:QI 1 "s_operand" "QS")
2645 (match_operand 2 "const_int_operand" "n")
2647 (clobber (reg:CC CC_REGNUM))]
2648 "INTVAL (operands[2]) > 0
2649 && INTVAL (operands[2]) <= GET_MODE_BITSIZE (SImode)"
2651 "&& reload_completed"
2653 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
2654 (clobber (reg:CC CC_REGNUM))])
2656 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
2657 (clobber (reg:CC CC_REGNUM))])]
2659 int bitsize = INTVAL (operands[2]);
2660 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
2661 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
2663 operands[1] = adjust_address (operands[1], BLKmode, 0);
2664 set_mem_size (operands[1], GEN_INT (size));
2665 operands[2] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - bitsize);
2666 operands[3] = GEN_INT (mask);
2670 ; insv instruction patterns
2673 (define_expand "insv"
2674 [(set (zero_extract (match_operand 0 "nonimmediate_operand" "")
2675 (match_operand 1 "const_int_operand" "")
2676 (match_operand 2 "const_int_operand" ""))
2677 (match_operand 3 "general_operand" ""))]
2680 if (s390_expand_insv (operands[0], operands[1], operands[2], operands[3]))
2685 (define_insn "*insv<mode>_mem_reg"
2686 [(set (zero_extract:P (match_operand:QI 0 "memory_operand" "+Q,S")
2687 (match_operand 1 "const_int_operand" "n,n")
2689 (match_operand:P 2 "register_operand" "d,d"))]
2690 "INTVAL (operands[1]) > 0
2691 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
2692 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
2694 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
2696 operands[1] = GEN_INT ((1ul << size) - 1);
2697 return (which_alternative == 0) ? "stcm\t%2,%1,%S0"
2698 : "stcmy\t%2,%1,%S0";
2700 [(set_attr "op_type" "RS,RSY")])
2702 (define_insn "*insvdi_mem_reghigh"
2703 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "+QS")
2704 (match_operand 1 "const_int_operand" "n")
2706 (lshiftrt:DI (match_operand:DI 2 "register_operand" "d")
2709 && INTVAL (operands[1]) > 0
2710 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
2711 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
2713 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
2715 operands[1] = GEN_INT ((1ul << size) - 1);
2716 return "stcmh\t%2,%1,%S0";
2718 [(set_attr "op_type" "RSY")])
2720 (define_insn "*insv<mode>_reg_imm"
2721 [(set (zero_extract:P (match_operand:P 0 "register_operand" "+d")
2723 (match_operand 1 "const_int_operand" "n"))
2724 (match_operand:P 2 "const_int_operand" "n"))]
2726 && INTVAL (operands[1]) >= 0
2727 && INTVAL (operands[1]) < BITS_PER_WORD
2728 && INTVAL (operands[1]) % 16 == 0"
2730 switch (BITS_PER_WORD - INTVAL (operands[1]))
2732 case 64: return "iihh\t%0,%x2"; break;
2733 case 48: return "iihl\t%0,%x2"; break;
2734 case 32: return "iilh\t%0,%x2"; break;
2735 case 16: return "iill\t%0,%x2"; break;
2736 default: gcc_unreachable();
2739 [(set_attr "op_type" "RI")])
2741 (define_insn "*insv<mode>_reg_extimm"
2742 [(set (zero_extract:P (match_operand:P 0 "register_operand" "+d")
2744 (match_operand 1 "const_int_operand" "n"))
2745 (match_operand:P 2 "const_int_operand" "n"))]
2747 && INTVAL (operands[1]) >= 0
2748 && INTVAL (operands[1]) < BITS_PER_WORD
2749 && INTVAL (operands[1]) % 32 == 0"
2751 switch (BITS_PER_WORD - INTVAL (operands[1]))
2753 case 64: return "iihf\t%0,%o2"; break;
2754 case 32: return "iilf\t%0,%o2"; break;
2755 default: gcc_unreachable();
2758 [(set_attr "op_type" "RIL")])
2761 ; extendsidi2 instruction pattern(s).
2764 (define_expand "extendsidi2"
2765 [(set (match_operand:DI 0 "register_operand" "")
2766 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2771 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2772 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2773 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2774 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2779 (define_insn "*extendsidi2"
2780 [(set (match_operand:DI 0 "register_operand" "=d,d")
2781 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2786 [(set_attr "op_type" "RRE,RXY")])
2789 ; extend(hi|qi)(si|di)2 instruction pattern(s).
2792 (define_expand "extend<HQI:mode><DSI:mode>2"
2793 [(set (match_operand:DSI 0 "register_operand" "")
2794 (sign_extend:DSI (match_operand:HQI 1 "nonimmediate_operand" "")))]
2797 if (<DSI:MODE>mode == DImode && !TARGET_64BIT)
2799 rtx tmp = gen_reg_rtx (SImode);
2800 emit_insn (gen_extend<HQI:mode>si2 (tmp, operands[1]));
2801 emit_insn (gen_extendsidi2 (operands[0], tmp));
2804 else if (!TARGET_EXTIMM)
2806 rtx bitcount = GEN_INT (GET_MODE_BITSIZE (<DSI:MODE>mode) -
2807 GET_MODE_BITSIZE (<HQI:MODE>mode));
2809 operands[1] = gen_lowpart (<DSI:MODE>mode, operands[1]);
2810 emit_insn (gen_ashl<DSI:mode>3 (operands[0], operands[1], bitcount));
2811 emit_insn (gen_ashr<DSI:mode>3 (operands[0], operands[0], bitcount));
2817 ; extendhidi2 instruction pattern(s).
2820 (define_insn "*extendhidi2_extimm"
2821 [(set (match_operand:DI 0 "register_operand" "=d,d")
2822 (sign_extend:DI (match_operand:HI 1 "nonimmediate_operand" "d,m")))]
2823 "TARGET_64BIT && TARGET_EXTIMM"
2827 [(set_attr "op_type" "RRE,RXY")])
2829 (define_insn "*extendhidi2"
2830 [(set (match_operand:DI 0 "register_operand" "=d")
2831 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2834 [(set_attr "op_type" "RXY")])
2837 ; extendhisi2 instruction pattern(s).
2840 (define_insn "*extendhisi2_extimm"
2841 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
2842 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,R,T")))]
2848 [(set_attr "op_type" "RRE,RX,RXY")])
2850 (define_insn "*extendhisi2"
2851 [(set (match_operand:SI 0 "register_operand" "=d,d")
2852 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2857 [(set_attr "op_type" "RX,RXY")])
2860 ; extendqi(si|di)2 instruction pattern(s).
2863 (define_insn "*extendqi<mode>2_extimm"
2864 [(set (match_operand:GPR 0 "register_operand" "=d,d")
2865 (sign_extend:GPR (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
2870 [(set_attr "op_type" "RRE,RXY")])
2872 (define_insn "*extendqi<mode>2"
2873 [(set (match_operand:GPR 0 "register_operand" "=d")
2874 (sign_extend:GPR (match_operand:QI 1 "memory_operand" "m")))]
2875 "!TARGET_EXTIMM && TARGET_LONG_DISPLACEMENT"
2877 [(set_attr "op_type" "RXY")])
2879 (define_insn_and_split "*extendqi<mode>2_short_displ"
2880 [(set (match_operand:GPR 0 "register_operand" "=d")
2881 (sign_extend:GPR (match_operand:QI 1 "s_operand" "Q")))
2882 (clobber (reg:CC CC_REGNUM))]
2883 "!TARGET_EXTIMM && !TARGET_LONG_DISPLACEMENT"
2885 "&& reload_completed"
2887 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (const_int 8)] UNSPEC_ICM))
2888 (clobber (reg:CC CC_REGNUM))])
2890 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
2891 (clobber (reg:CC CC_REGNUM))])]
2893 operands[1] = adjust_address (operands[1], BLKmode, 0);
2894 set_mem_size (operands[1], GEN_INT (GET_MODE_SIZE (QImode)));
2895 operands[2] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode)
2896 - GET_MODE_BITSIZE (QImode));
2900 ; zero_extendsidi2 instruction pattern(s).
2903 (define_expand "zero_extendsidi2"
2904 [(set (match_operand:DI 0 "register_operand" "")
2905 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2910 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2911 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2912 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2917 (define_insn "*zero_extendsidi2"
2918 [(set (match_operand:DI 0 "register_operand" "=d,d")
2919 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2924 [(set_attr "op_type" "RRE,RXY")])
2927 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2930 (define_insn "*llgt_sidi"
2931 [(set (match_operand:DI 0 "register_operand" "=d")
2932 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2933 (const_int 2147483647)))]
2936 [(set_attr "op_type" "RXE")])
2938 (define_insn_and_split "*llgt_sidi_split"
2939 [(set (match_operand:DI 0 "register_operand" "=d")
2940 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2941 (const_int 2147483647)))
2942 (clobber (reg:CC CC_REGNUM))]
2945 "&& reload_completed"
2947 (and:DI (subreg:DI (match_dup 1) 0)
2948 (const_int 2147483647)))]
2951 (define_insn "*llgt_sisi"
2952 [(set (match_operand:SI 0 "register_operand" "=d,d")
2953 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2954 (const_int 2147483647)))]
2959 [(set_attr "op_type" "RRE,RXE")])
2961 (define_insn "*llgt_didi"
2962 [(set (match_operand:DI 0 "register_operand" "=d,d")
2963 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2964 (const_int 2147483647)))]
2969 [(set_attr "op_type" "RRE,RXE")])
2972 [(set (match_operand:GPR 0 "register_operand" "")
2973 (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "")
2974 (const_int 2147483647)))
2975 (clobber (reg:CC CC_REGNUM))]
2976 "TARGET_ZARCH && reload_completed"
2978 (and:GPR (match_dup 1)
2979 (const_int 2147483647)))]
2983 ; zero_extend(hi|qi)(si|di)2 instruction pattern(s).
2986 (define_expand "zero_extend<mode>di2"
2987 [(set (match_operand:DI 0 "register_operand" "")
2988 (zero_extend:DI (match_operand:HQI 1 "nonimmediate_operand" "")))]
2993 rtx tmp = gen_reg_rtx (SImode);
2994 emit_insn (gen_zero_extend<mode>si2 (tmp, operands[1]));
2995 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2998 else if (!TARGET_EXTIMM)
3000 rtx bitcount = GEN_INT (GET_MODE_BITSIZE(DImode) -
3001 GET_MODE_BITSIZE(<MODE>mode));
3002 operands[1] = gen_lowpart (DImode, operands[1]);
3003 emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount));
3004 emit_insn (gen_lshrdi3 (operands[0], operands[0], bitcount));
3009 (define_expand "zero_extend<mode>si2"
3010 [(set (match_operand:SI 0 "register_operand" "")
3011 (zero_extend:SI (match_operand:HQI 1 "nonimmediate_operand" "")))]
3016 operands[1] = gen_lowpart (SImode, operands[1]);
3017 emit_insn (gen_andsi3 (operands[0], operands[1],
3018 GEN_INT ((1 << GET_MODE_BITSIZE(<MODE>mode)) - 1)));
3023 (define_insn "*zero_extend<HQI:mode><GPR:mode>2_extimm"
3024 [(set (match_operand:GPR 0 "register_operand" "=d,d")
3025 (zero_extend:GPR (match_operand:HQI 1 "nonimmediate_operand" "d,m")))]
3030 [(set_attr "op_type" "RRE,RXY")])
3032 (define_insn "*zero_extend<HQI:mode><GPR:mode>2"
3033 [(set (match_operand:GPR 0 "register_operand" "=d")
3034 (zero_extend:GPR (match_operand:HQI 1 "memory_operand" "m")))]
3035 "TARGET_ZARCH && !TARGET_EXTIMM"
3037 [(set_attr "op_type" "RXY")])
3039 (define_insn_and_split "*zero_extendhisi2_31"
3040 [(set (match_operand:SI 0 "register_operand" "=&d")
3041 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
3042 (clobber (reg:CC CC_REGNUM))]
3045 "&& reload_completed"
3046 [(set (match_dup 0) (const_int 0))
3048 [(set (strict_low_part (match_dup 2)) (match_dup 1))
3049 (clobber (reg:CC CC_REGNUM))])]
3050 "operands[2] = gen_lowpart (HImode, operands[0]);")
3052 (define_insn_and_split "*zero_extendqisi2_31"
3053 [(set (match_operand:SI 0 "register_operand" "=&d")
3054 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
3057 "&& reload_completed"
3058 [(set (match_dup 0) (const_int 0))
3059 (set (strict_low_part (match_dup 2)) (match_dup 1))]
3060 "operands[2] = gen_lowpart (QImode, operands[0]);")
3063 ; zero_extendqihi2 instruction pattern(s).
3066 (define_expand "zero_extendqihi2"
3067 [(set (match_operand:HI 0 "register_operand" "")
3068 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
3069 "TARGET_ZARCH && !TARGET_EXTIMM"
3071 operands[1] = gen_lowpart (HImode, operands[1]);
3072 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
3076 (define_insn "*zero_extendqihi2_64"
3077 [(set (match_operand:HI 0 "register_operand" "=d")
3078 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
3079 "TARGET_ZARCH && !TARGET_EXTIMM"
3081 [(set_attr "op_type" "RXY")])
3083 (define_insn_and_split "*zero_extendqihi2_31"
3084 [(set (match_operand:HI 0 "register_operand" "=&d")
3085 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
3088 "&& reload_completed"
3089 [(set (match_dup 0) (const_int 0))
3090 (set (strict_low_part (match_dup 2)) (match_dup 1))]
3091 "operands[2] = gen_lowpart (QImode, operands[0]);")
3095 ; fixuns_trunc(sf|df)(si|di)2 and fix_trunc(sf|df)(si|di)2 instruction pattern(s).
3098 (define_expand "fixuns_trunc<FPR:mode><GPR:mode>2"
3099 [(set (match_operand:GPR 0 "register_operand" "")
3100 (unsigned_fix:GPR (match_operand:FPR 1 "register_operand" "")))]
3101 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3103 rtx label1 = gen_label_rtx ();
3104 rtx label2 = gen_label_rtx ();
3105 rtx temp = gen_reg_rtx (<FPR:MODE>mode);
3106 REAL_VALUE_TYPE cmp, sub;
3108 operands[1] = force_reg (<FPR:MODE>mode, operands[1]);
3109 real_2expN (&cmp, GET_MODE_BITSIZE(<GPR:MODE>mode) - 1);
3110 real_2expN (&sub, GET_MODE_BITSIZE(<GPR:MODE>mode));
3112 emit_insn (gen_cmp<FPR:mode> (operands[1],
3113 CONST_DOUBLE_FROM_REAL_VALUE (cmp, <FPR:MODE>mode)));
3114 emit_jump_insn (gen_blt (label1));
3115 emit_insn (gen_sub<FPR:mode>3 (temp, operands[1],
3116 CONST_DOUBLE_FROM_REAL_VALUE (sub, <FPR:MODE>mode)));
3117 emit_insn (gen_fix_trunc<FPR:mode><GPR:mode>2_ieee (operands[0], temp,
3121 emit_label (label1);
3122 emit_insn (gen_fix_trunc<FPR:mode><GPR:mode>2_ieee (operands[0],
3123 operands[1], GEN_INT(5)));
3124 emit_label (label2);
3128 (define_expand "fix_trunc<mode>di2"
3129 [(set (match_operand:DI 0 "register_operand" "")
3130 (fix:DI (match_operand:DSF 1 "nonimmediate_operand" "")))]
3131 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3133 operands[1] = force_reg (<MODE>mode, operands[1]);
3134 emit_insn (gen_fix_trunc<mode>di2_ieee (operands[0], operands[1],
3139 (define_insn "fix_trunc<FPR:mode><GPR:mode>2_ieee"
3140 [(set (match_operand:GPR 0 "register_operand" "=d")
3141 (fix:GPR (match_operand:FPR 1 "register_operand" "f")))
3142 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
3143 (clobber (reg:CC CC_REGNUM))]
3144 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3145 "c<GPR:gf><FPR:xde>br\t%0,%h2,%1"
3146 [(set_attr "op_type" "RRE")
3147 (set_attr "type" "ftoi")])
3150 ; fix_trunctf(si|di)2 instruction pattern(s).
3153 (define_expand "fix_trunctf<mode>2"
3154 [(parallel [(set (match_operand:GPR 0 "register_operand" "")
3155 (fix:GPR (match_operand:TF 1 "register_operand" "")))
3156 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
3157 (clobber (reg:CC CC_REGNUM))])]
3158 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3162 ; fix_truncdfsi2 instruction pattern(s).
3165 (define_expand "fix_truncdfsi2"
3166 [(set (match_operand:SI 0 "register_operand" "")
3167 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
3170 if (TARGET_IBM_FLOAT)
3172 /* This is the algorithm from POP chapter A.5.7.2. */
3174 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3175 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
3176 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
3178 operands[1] = force_reg (DFmode, operands[1]);
3179 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
3180 two31r, two32, temp));
3184 operands[1] = force_reg (DFmode, operands[1]);
3185 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3191 (define_insn "fix_truncdfsi2_ibm"
3192 [(set (match_operand:SI 0 "register_operand" "=d")
3193 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
3194 (use (match_operand:DI 2 "immediate_operand" "m"))
3195 (use (match_operand:DI 3 "immediate_operand" "m"))
3196 (use (match_operand:BLK 4 "memory_operand" "m"))
3197 (clobber (reg:CC CC_REGNUM))]
3198 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3200 output_asm_insn ("sd\t%1,%2", operands);
3201 output_asm_insn ("aw\t%1,%3", operands);
3202 output_asm_insn ("std\t%1,%4", operands);
3203 output_asm_insn ("xi\t%N4,128", operands);
3206 [(set_attr "length" "20")])
3209 ; fix_truncsfsi2 instruction pattern(s).
3212 (define_expand "fix_truncsfsi2"
3213 [(set (match_operand:SI 0 "register_operand" "")
3214 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
3217 if (TARGET_IBM_FLOAT)
3219 /* Convert to DFmode and then use the POP algorithm. */
3220 rtx temp = gen_reg_rtx (DFmode);
3221 emit_insn (gen_extendsfdf2 (temp, operands[1]));
3222 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
3226 operands[1] = force_reg (SFmode, operands[1]);
3227 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3234 ; float(si|di)(tf|df|sf)2 instruction pattern(s).
3237 (define_insn "floatdi<mode>2"
3238 [(set (match_operand:FPR 0 "register_operand" "=f")
3239 (float:FPR (match_operand:DI 1 "register_operand" "d")))]
3240 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3242 [(set_attr "op_type" "RRE")
3243 (set_attr "type" "itof" )])
3245 (define_insn "floatsi<mode>2_ieee"
3246 [(set (match_operand:FPR 0 "register_operand" "=f")
3247 (float:FPR (match_operand:SI 1 "register_operand" "d")))]
3248 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3250 [(set_attr "op_type" "RRE")
3251 (set_attr "type" "itof" )])
3255 ; floatsi(tf|df)2 instruction pattern(s).
3258 (define_expand "floatsitf2"
3259 [(set (match_operand:TF 0 "register_operand" "")
3260 (float:TF (match_operand:SI 1 "register_operand" "")))]
3261 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3264 (define_expand "floatsidf2"
3265 [(set (match_operand:DF 0 "register_operand" "")
3266 (float:DF (match_operand:SI 1 "register_operand" "")))]
3269 if (TARGET_IBM_FLOAT)
3271 /* This is the algorithm from POP chapter A.5.7.1. */
3273 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3274 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
3276 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
3281 (define_insn "floatsidf2_ibm"
3282 [(set (match_operand:DF 0 "register_operand" "=f")
3283 (float:DF (match_operand:SI 1 "register_operand" "d")))
3284 (use (match_operand:DI 2 "immediate_operand" "m"))
3285 (use (match_operand:BLK 3 "memory_operand" "m"))
3286 (clobber (reg:CC CC_REGNUM))]
3287 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3289 output_asm_insn ("st\t%1,%N3", operands);
3290 output_asm_insn ("xi\t%N3,128", operands);
3291 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3292 output_asm_insn ("ld\t%0,%3", operands);
3295 [(set_attr "length" "20")])
3298 ; floatsisf2 instruction pattern(s).
3301 (define_expand "floatsisf2"
3302 [(set (match_operand:SF 0 "register_operand" "")
3303 (float:SF (match_operand:SI 1 "register_operand" "")))]
3306 if (TARGET_IBM_FLOAT)
3308 /* Use the POP algorithm to convert to DFmode and then truncate. */
3309 rtx temp = gen_reg_rtx (DFmode);
3310 emit_insn (gen_floatsidf2 (temp, operands[1]));
3311 emit_insn (gen_truncdfsf2 (operands[0], temp));
3317 ; truncdfsf2 instruction pattern(s).
3320 (define_expand "truncdfsf2"
3321 [(set (match_operand:SF 0 "register_operand" "")
3322 (float_truncate:SF (match_operand:DF 1 "register_operand" "")))]
3326 (define_insn "truncdfsf2_ieee"
3327 [(set (match_operand:SF 0 "register_operand" "=f")
3328 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
3329 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3331 [(set_attr "op_type" "RRE")
3332 (set_attr "type" "ftruncdf")])
3334 (define_insn "truncdfsf2_ibm"
3335 [(set (match_operand:SF 0 "register_operand" "=f,f")
3336 (float_truncate:SF (match_operand:DF 1 "nonimmediate_operand" "f,R")))]
3337 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3341 [(set_attr "op_type" "RR,RX")
3342 (set_attr "type" "floadsf")])
3345 ; trunctfdf2 instruction pattern(s).
3348 (define_expand "trunctfdf2"
3350 [(set (match_operand:DF 0 "register_operand" "")
3351 (float_truncate:DF (match_operand:TF 1 "register_operand" "")))
3352 (clobber (match_scratch:TF 2 "=f"))])]
3356 (define_insn "*trunctfdf2_ieee"
3357 [(set (match_operand:DF 0 "register_operand" "=f")
3358 (float_truncate:DF (match_operand:TF 1 "register_operand" "f")))
3359 (clobber (match_scratch:TF 2 "=f"))]
3360 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3361 "ldxbr\t%2,%1\;ldr\t%0,%2"
3362 [(set_attr "length" "6")
3363 (set_attr "type" "ftrunctf")])
3365 (define_insn "*trunctfdf2_ibm"
3366 [(set (match_operand:DF 0 "register_operand" "=f")
3367 (float_truncate:DF (match_operand:TF 1 "register_operand" "f")))
3368 (clobber (match_scratch:TF 2 "=f"))]
3369 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3370 "ldxr\t%2,%1\;ldr\t%0,%2"
3371 [(set_attr "length" "4")
3372 (set_attr "type" "ftrunctf")])
3375 ; trunctfsf2 instruction pattern(s).
3378 (define_expand "trunctfsf2"
3380 [(set (match_operand:SF 0 "register_operand" "=f")
3381 (float_truncate:SF (match_operand:TF 1 "register_operand" "f")))
3382 (clobber (match_scratch:TF 2 "=f"))])]
3386 (define_insn "*trunctfsf2_ieee"
3387 [(set (match_operand:SF 0 "register_operand" "=f")
3388 (float_truncate:SF (match_operand:TF 1 "register_operand" "f")))
3389 (clobber (match_scratch:TF 2 "=f"))]
3390 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3391 "lexbr\t%2,%1\;ler\t%0,%2"
3392 [(set_attr "length" "6")
3393 (set_attr "type" "ftrunctf")])
3395 (define_insn "*trunctfsf2_ibm"
3396 [(set (match_operand:SF 0 "register_operand" "=f")
3397 (float_truncate:SF (match_operand:TF 1 "register_operand" "f")))
3398 (clobber (match_scratch:TF 2 "=f"))]
3399 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3400 "lexr\t%2,%1\;ler\t%0,%2"
3401 [(set_attr "length" "6")
3402 (set_attr "type" "ftrunctf")])
3405 ; extendsfdf2 instruction pattern(s).
3408 (define_expand "extendsfdf2"
3409 [(set (match_operand:DF 0 "register_operand" "")
3410 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3413 if (TARGET_IBM_FLOAT)
3415 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3420 (define_insn "extendsfdf2_ieee"
3421 [(set (match_operand:DF 0 "register_operand" "=f,f")
3422 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3423 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3427 [(set_attr "op_type" "RRE,RXE")
3428 (set_attr "type" "fsimpsf, floadsf")])
3430 (define_insn "extendsfdf2_ibm"
3431 [(set (match_operand:DF 0 "register_operand" "=f,f")
3432 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3433 (clobber (reg:CC CC_REGNUM))]
3434 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3436 sdr\t%0,%0\;ler\t%0,%1
3437 sdr\t%0,%0\;le\t%0,%1"
3438 [(set_attr "length" "4,6")
3439 (set_attr "type" "floadsf")])
3442 ; extenddftf2 instruction pattern(s).
3445 (define_expand "extenddftf2"
3446 [(set (match_operand:TF 0 "register_operand" "")
3447 (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "")))]
3451 (define_insn "*extenddftf2_ieee"
3452 [(set (match_operand:TF 0 "register_operand" "=f,f")
3453 (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "f,R")))]
3454 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3458 [(set_attr "op_type" "RRE,RXE")
3459 (set_attr "type" "fsimptf, floadtf")])
3461 (define_insn "*extenddftf2_ibm"
3462 [(set (match_operand:TF 0 "register_operand" "=f,f")
3463 (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "f,R")))]
3464 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3468 [(set_attr "op_type" "RRE,RXE")
3469 (set_attr "type" "fsimptf, floadtf")])
3472 ; extendsftf2 instruction pattern(s).
3475 (define_expand "extendsftf2"
3476 [(set (match_operand:TF 0 "register_operand" "")
3477 (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "")))]
3481 (define_insn "*extendsftf2_ieee"
3482 [(set (match_operand:TF 0 "register_operand" "=f,f")
3483 (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3484 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3488 [(set_attr "op_type" "RRE,RXE")
3489 (set_attr "type" "fsimptf, floadtf")])
3491 (define_insn "*extendsftf2_ibm"
3492 [(set (match_operand:TF 0 "register_operand" "=f,f")
3493 (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3494 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3498 [(set_attr "op_type" "RRE,RXE")
3499 (set_attr "type" "fsimptf, floadtf")])
3503 ;; ARITHMETIC OPERATIONS
3505 ; arithmetic operations set the ConditionCode,
3506 ; because of unpredictable Bits in Register for Halfword and Byte
3507 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3510 ;;- Add instructions.
3514 ; addti3 instruction pattern(s).
3517 (define_insn_and_split "addti3"
3518 [(set (match_operand:TI 0 "register_operand" "=&d")
3519 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
3520 (match_operand:TI 2 "general_operand" "do") ) )
3521 (clobber (reg:CC CC_REGNUM))]
3524 "&& reload_completed"
3526 [(set (reg:CCL1 CC_REGNUM)
3527 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
3529 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
3531 [(set (match_dup 3) (plus:DI (plus:DI (match_dup 4) (match_dup 5))
3532 (ltu:DI (reg:CCL1 CC_REGNUM) (const_int 0))))
3533 (clobber (reg:CC CC_REGNUM))])]
3534 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3535 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3536 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3537 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3538 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3539 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
3542 ; adddi3 instruction pattern(s).
3545 (define_expand "adddi3"
3547 [(set (match_operand:DI 0 "register_operand" "")
3548 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3549 (match_operand:DI 2 "general_operand" "")))
3550 (clobber (reg:CC CC_REGNUM))])]
3554 (define_insn "*adddi3_sign"
3555 [(set (match_operand:DI 0 "register_operand" "=d,d")
3556 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3557 (match_operand:DI 1 "register_operand" "0,0")))
3558 (clobber (reg:CC CC_REGNUM))]
3563 [(set_attr "op_type" "RRE,RXY")])
3565 (define_insn "*adddi3_zero_cc"
3566 [(set (reg CC_REGNUM)
3567 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3568 (match_operand:DI 1 "register_operand" "0,0"))
3570 (set (match_operand:DI 0 "register_operand" "=d,d")
3571 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3572 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3576 [(set_attr "op_type" "RRE,RXY")])
3578 (define_insn "*adddi3_zero_cconly"
3579 [(set (reg CC_REGNUM)
3580 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3581 (match_operand:DI 1 "register_operand" "0,0"))
3583 (clobber (match_scratch:DI 0 "=d,d"))]
3584 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3588 [(set_attr "op_type" "RRE,RXY")])
3590 (define_insn "*adddi3_zero"
3591 [(set (match_operand:DI 0 "register_operand" "=d,d")
3592 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3593 (match_operand:DI 1 "register_operand" "0,0")))
3594 (clobber (reg:CC CC_REGNUM))]
3599 [(set_attr "op_type" "RRE,RXY")])
3601 (define_insn_and_split "*adddi3_31z"
3602 [(set (match_operand:DI 0 "register_operand" "=&d")
3603 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3604 (match_operand:DI 2 "general_operand" "do") ) )
3605 (clobber (reg:CC CC_REGNUM))]
3606 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3608 "&& reload_completed"
3610 [(set (reg:CCL1 CC_REGNUM)
3611 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3613 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3615 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3616 (ltu:SI (reg:CCL1 CC_REGNUM) (const_int 0))))
3617 (clobber (reg:CC CC_REGNUM))])]
3618 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3619 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3620 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3621 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3622 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3623 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
3625 (define_insn_and_split "*adddi3_31"
3626 [(set (match_operand:DI 0 "register_operand" "=&d")
3627 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3628 (match_operand:DI 2 "general_operand" "do") ) )
3629 (clobber (reg:CC CC_REGNUM))]
3632 "&& reload_completed"
3634 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3635 (clobber (reg:CC CC_REGNUM))])
3637 [(set (reg:CCL1 CC_REGNUM)
3638 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3640 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3642 (if_then_else (ltu (reg:CCL1 CC_REGNUM) (const_int 0))
3644 (label_ref (match_dup 9))))
3646 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3647 (clobber (reg:CC CC_REGNUM))])
3649 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3650 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3651 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3652 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3653 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3654 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3655 operands[9] = gen_label_rtx ();")
3658 ; addsi3 instruction pattern(s).
3661 (define_expand "addsi3"
3663 [(set (match_operand:SI 0 "register_operand" "")
3664 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "")
3665 (match_operand:SI 2 "general_operand" "")))
3666 (clobber (reg:CC CC_REGNUM))])]
3670 (define_insn "*addsi3_sign"
3671 [(set (match_operand:SI 0 "register_operand" "=d,d")
3672 (plus:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
3673 (match_operand:SI 1 "register_operand" "0,0")))
3674 (clobber (reg:CC CC_REGNUM))]
3679 [(set_attr "op_type" "RX,RXY")])
3682 ; add(di|si)3 instruction pattern(s).
3685 (define_insn "*add<mode>3"
3686 [(set (match_operand:GPR 0 "register_operand" "=d,d,d,d,d,d")
3687 (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0,0,0,0,0")
3688 (match_operand:GPR 2 "general_operand" "d,K,Op,On,R,T") ) )
3689 (clobber (reg:CC CC_REGNUM))]
3698 [(set_attr "op_type" "RR<E>,RI,RIL,RIL,RX<Y>,RXY")])
3700 (define_insn "*add<mode>3_carry1_cc"
3701 [(set (reg CC_REGNUM)
3702 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0,0,0,0")
3703 (match_operand:GPR 2 "general_operand" "d,Op,On,R,T"))
3705 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d,d")
3706 (plus:GPR (match_dup 1) (match_dup 2)))]
3707 "s390_match_ccmode (insn, CCL1mode)"
3714 [(set_attr "op_type" "RR<E>,RIL,RIL,RX<Y>,RXY")])
3716 (define_insn "*add<mode>3_carry1_cconly"
3717 [(set (reg CC_REGNUM)
3718 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0,0")
3719 (match_operand:GPR 2 "general_operand" "d,R,T"))
3721 (clobber (match_scratch:GPR 0 "=d,d,d"))]
3722 "s390_match_ccmode (insn, CCL1mode)"
3727 [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
3729 (define_insn "*add<mode>3_carry2_cc"
3730 [(set (reg CC_REGNUM)
3731 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0,0,0,0")
3732 (match_operand:GPR 2 "general_operand" "d,Op,On,R,T"))
3734 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d,d")
3735 (plus:GPR (match_dup 1) (match_dup 2)))]
3736 "s390_match_ccmode (insn, CCL1mode)"
3743 [(set_attr "op_type" "RR<E>,RIL,RIL,RX<Y>,RXY")])
3745 (define_insn "*add<mode>3_carry2_cconly"
3746 [(set (reg CC_REGNUM)
3747 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0,0")
3748 (match_operand:GPR 2 "general_operand" "d,R,T"))
3750 (clobber (match_scratch:GPR 0 "=d,d,d"))]
3751 "s390_match_ccmode (insn, CCL1mode)"
3756 [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
3758 (define_insn "*add<mode>3_cc"
3759 [(set (reg CC_REGNUM)
3760 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0,0,0,0")
3761 (match_operand:GPR 2 "general_operand" "d,Op,On,R,T"))
3763 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d,d")
3764 (plus:GPR (match_dup 1) (match_dup 2)))]
3765 "s390_match_ccmode (insn, CCLmode)"
3772 [(set_attr "op_type" "RR<E>,RIL,RIL,RX<Y>,RXY")])
3774 (define_insn "*add<mode>3_cconly"
3775 [(set (reg CC_REGNUM)
3776 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0,0")
3777 (match_operand:GPR 2 "general_operand" "d,R,T"))
3779 (clobber (match_scratch:GPR 0 "=d,d,d"))]
3780 "s390_match_ccmode (insn, CCLmode)"
3785 [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
3787 (define_insn "*add<mode>3_cconly2"
3788 [(set (reg CC_REGNUM)
3789 (compare (match_operand:GPR 1 "nonimmediate_operand" "%0,0,0")
3790 (neg:GPR (match_operand:GPR 2 "general_operand" "d,R,T"))))
3791 (clobber (match_scratch:GPR 0 "=d,d,d"))]
3792 "s390_match_ccmode(insn, CCLmode)"
3797 [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
3799 (define_insn "*add<mode>3_imm_cc"
3800 [(set (reg CC_REGNUM)
3801 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
3802 (match_operand:GPR 2 "const_int_operand" "K,Os"))
3804 (set (match_operand:GPR 0 "register_operand" "=d,d")
3805 (plus:GPR (match_dup 1) (match_dup 2)))]
3806 "s390_match_ccmode (insn, CCAmode)
3807 && (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")
3808 || CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'O', \"Os\"))
3809 && INTVAL (operands[2]) != -((HOST_WIDE_INT)1 << (GET_MODE_BITSIZE(<MODE>mode) - 1))"
3813 [(set_attr "op_type" "RI,RIL")])
3816 ; add(df|sf)3 instruction pattern(s).
3819 (define_expand "add<mode>3"
3821 [(set (match_operand:FPR 0 "register_operand" "=f,f")
3822 (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
3823 (match_operand:FPR 2 "general_operand" "f,<Rf>")))
3824 (clobber (reg:CC CC_REGNUM))])]
3828 (define_insn "*add<mode>3"
3829 [(set (match_operand:FPR 0 "register_operand" "=f,f")
3830 (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
3831 (match_operand:FPR 2 "general_operand" "f,<Rf>")))
3832 (clobber (reg:CC CC_REGNUM))]
3833 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3837 [(set_attr "op_type" "RRE,RXE")
3838 (set_attr "type" "fsimp<mode>")])
3840 (define_insn "*add<mode>3_cc"
3841 [(set (reg CC_REGNUM)
3842 (compare (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
3843 (match_operand:FPR 2 "general_operand" "f,<Rf>"))
3844 (match_operand:FPR 3 "const0_operand" "")))
3845 (set (match_operand:FPR 0 "register_operand" "=f,f")
3846 (plus:FPR (match_dup 1) (match_dup 2)))]
3847 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3851 [(set_attr "op_type" "RRE,RXE")
3852 (set_attr "type" "fsimp<mode>")])
3854 (define_insn "*add<mode>3_cconly"
3855 [(set (reg CC_REGNUM)
3856 (compare (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
3857 (match_operand:FPR 2 "general_operand" "f,<Rf>"))
3858 (match_operand:FPR 3 "const0_operand" "")))
3859 (clobber (match_scratch:FPR 0 "=f,f"))]
3860 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3864 [(set_attr "op_type" "RRE,RXE")
3865 (set_attr "type" "fsimp<mode>")])
3867 (define_insn "*add<mode>3_ibm"
3868 [(set (match_operand:FPR 0 "register_operand" "=f,f")
3869 (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
3870 (match_operand:FPR 2 "general_operand" "f,<Rf>")))
3871 (clobber (reg:CC CC_REGNUM))]
3872 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3876 [(set_attr "op_type" "<RRe>,<RXe>")
3877 (set_attr "type" "fsimp<mode>")])
3881 ;;- Subtract instructions.
3885 ; subti3 instruction pattern(s).
3888 (define_insn_and_split "subti3"
3889 [(set (match_operand:TI 0 "register_operand" "=&d")
3890 (minus:TI (match_operand:TI 1 "register_operand" "0")
3891 (match_operand:TI 2 "general_operand" "do") ) )
3892 (clobber (reg:CC CC_REGNUM))]
3895 "&& reload_completed"
3897 [(set (reg:CCL2 CC_REGNUM)
3898 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
3900 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
3902 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
3903 (gtu:DI (reg:CCL2 CC_REGNUM) (const_int 0))))
3904 (clobber (reg:CC CC_REGNUM))])]
3905 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3906 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3907 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3908 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3909 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3910 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
3913 ; subdi3 instruction pattern(s).
3916 (define_expand "subdi3"
3918 [(set (match_operand:DI 0 "register_operand" "")
3919 (minus:DI (match_operand:DI 1 "register_operand" "")
3920 (match_operand:DI 2 "general_operand" "")))
3921 (clobber (reg:CC CC_REGNUM))])]
3925 (define_insn "*subdi3_sign"
3926 [(set (match_operand:DI 0 "register_operand" "=d,d")
3927 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3928 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3929 (clobber (reg:CC CC_REGNUM))]
3934 [(set_attr "op_type" "RRE,RXY")])
3936 (define_insn "*subdi3_zero_cc"
3937 [(set (reg CC_REGNUM)
3938 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3939 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3941 (set (match_operand:DI 0 "register_operand" "=d,d")
3942 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3943 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3947 [(set_attr "op_type" "RRE,RXY")])
3949 (define_insn "*subdi3_zero_cconly"
3950 [(set (reg CC_REGNUM)
3951 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3952 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3954 (clobber (match_scratch:DI 0 "=d,d"))]
3955 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3959 [(set_attr "op_type" "RRE,RXY")])
3961 (define_insn "*subdi3_zero"
3962 [(set (match_operand:DI 0 "register_operand" "=d,d")
3963 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3964 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3965 (clobber (reg:CC CC_REGNUM))]
3970 [(set_attr "op_type" "RRE,RXY")])
3972 (define_insn_and_split "*subdi3_31z"
3973 [(set (match_operand:DI 0 "register_operand" "=&d")
3974 (minus:DI (match_operand:DI 1 "register_operand" "0")
3975 (match_operand:DI 2 "general_operand" "do") ) )
3976 (clobber (reg:CC CC_REGNUM))]
3977 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3979 "&& reload_completed"
3981 [(set (reg:CCL2 CC_REGNUM)
3982 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3984 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3986 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3987 (gtu:SI (reg:CCL2 CC_REGNUM) (const_int 0))))
3988 (clobber (reg:CC CC_REGNUM))])]
3989 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3990 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3991 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3992 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3993 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3994 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
3996 (define_insn_and_split "*subdi3_31"
3997 [(set (match_operand:DI 0 "register_operand" "=&d")
3998 (minus:DI (match_operand:DI 1 "register_operand" "0")
3999 (match_operand:DI 2 "general_operand" "do") ) )
4000 (clobber (reg:CC CC_REGNUM))]
4003 "&& reload_completed"
4005 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
4006 (clobber (reg:CC CC_REGNUM))])
4008 [(set (reg:CCL2 CC_REGNUM)
4009 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
4011 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
4013 (if_then_else (gtu (reg:CCL2 CC_REGNUM) (const_int 0))
4015 (label_ref (match_dup 9))))
4017 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
4018 (clobber (reg:CC CC_REGNUM))])
4020 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
4021 operands[4] = operand_subword (operands[1], 0, 0, DImode);
4022 operands[5] = operand_subword (operands[2], 0, 0, DImode);
4023 operands[6] = operand_subword (operands[0], 1, 0, DImode);
4024 operands[7] = operand_subword (operands[1], 1, 0, DImode);
4025 operands[8] = operand_subword (operands[2], 1, 0, DImode);
4026 operands[9] = gen_label_rtx ();")
4029 ; subsi3 instruction pattern(s).
4032 (define_expand "subsi3"
4034 [(set (match_operand:SI 0 "register_operand" "")
4035 (minus:SI (match_operand:SI 1 "register_operand" "")
4036 (match_operand:SI 2 "general_operand" "")))
4037 (clobber (reg:CC CC_REGNUM))])]
4041 (define_insn "*subsi3_sign"
4042 [(set (match_operand:SI 0 "register_operand" "=d,d")
4043 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
4044 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4045 (clobber (reg:CC CC_REGNUM))]
4050 [(set_attr "op_type" "RX,RXY")])
4053 ; sub(di|si)3 instruction pattern(s).
4056 (define_insn "*sub<mode>3"
4057 [(set (match_operand:GPR 0 "register_operand" "=d,d,d")
4058 (minus:GPR (match_operand:GPR 1 "register_operand" "0,0,0")
4059 (match_operand:GPR 2 "general_operand" "d,R,T") ) )
4060 (clobber (reg:CC CC_REGNUM))]
4066 [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
4068 (define_insn "*sub<mode>3_borrow_cc"
4069 [(set (reg CC_REGNUM)
4070 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,0,0")
4071 (match_operand:GPR 2 "general_operand" "d,R,T"))
4073 (set (match_operand:GPR 0 "register_operand" "=d,d,d")
4074 (minus:GPR (match_dup 1) (match_dup 2)))]
4075 "s390_match_ccmode (insn, CCL2mode)"
4080 [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
4082 (define_insn "*sub<mode>3_borrow_cconly"
4083 [(set (reg CC_REGNUM)
4084 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,0,0")
4085 (match_operand:GPR 2 "general_operand" "d,R,T"))
4087 (clobber (match_scratch:GPR 0 "=d,d,d"))]
4088 "s390_match_ccmode (insn, CCL2mode)"
4093 [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
4095 (define_insn "*sub<mode>3_cc"
4096 [(set (reg CC_REGNUM)
4097 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,0,0")
4098 (match_operand:GPR 2 "general_operand" "d,R,T"))
4100 (set (match_operand:GPR 0 "register_operand" "=d,d,d")
4101 (minus:GPR (match_dup 1) (match_dup 2)))]
4102 "s390_match_ccmode (insn, CCLmode)"
4107 [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
4109 (define_insn "*sub<mode>3_cc2"
4110 [(set (reg CC_REGNUM)
4111 (compare (match_operand:GPR 1 "register_operand" "0,0,0")
4112 (match_operand:GPR 2 "general_operand" "d,R,T")))
4113 (set (match_operand:GPR 0 "register_operand" "=d,d,d")
4114 (minus:GPR (match_dup 1) (match_dup 2)))]
4115 "s390_match_ccmode (insn, CCL3mode)"
4120 [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
4122 (define_insn "*sub<mode>3_cconly"
4123 [(set (reg CC_REGNUM)
4124 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,0,0")
4125 (match_operand:GPR 2 "general_operand" "d,R,T"))
4127 (clobber (match_scratch:GPR 0 "=d,d,d"))]
4128 "s390_match_ccmode (insn, CCLmode)"
4133 [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
4135 (define_insn "*sub<mode>3_cconly2"
4136 [(set (reg CC_REGNUM)
4137 (compare (match_operand:GPR 1 "register_operand" "0,0,0")
4138 (match_operand:GPR 2 "general_operand" "d,R,T")))
4139 (clobber (match_scratch:GPR 0 "=d,d,d"))]
4140 "s390_match_ccmode (insn, CCL3mode)"
4145 [(set_attr "op_type" "RR<E>,RX<Y>,RXY")])
4148 ; sub(df|sf)3 instruction pattern(s).
4151 (define_expand "sub<mode>3"
4153 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4154 (minus:FPR (match_operand:FPR 1 "register_operand" "0,0")
4155 (match_operand:FPR 2 "general_operand" "f,R")))
4156 (clobber (reg:CC CC_REGNUM))])]
4160 (define_insn "*sub<mode>3"
4161 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4162 (minus:FPR (match_operand:FPR 1 "register_operand" "0,0")
4163 (match_operand:FPR 2 "general_operand" "f,<Rf>")))
4164 (clobber (reg:CC CC_REGNUM))]
4165 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4169 [(set_attr "op_type" "RRE,RXE")
4170 (set_attr "type" "fsimp<mode>")])
4172 (define_insn "*sub<mode>3_cc"
4173 [(set (reg CC_REGNUM)
4174 (compare (minus:FPR (match_operand:FPR 1 "nonimmediate_operand" "0,0")
4175 (match_operand:FPR 2 "general_operand" "f,<Rf>"))
4176 (match_operand:FPR 3 "const0_operand" "")))
4177 (set (match_operand:FPR 0 "register_operand" "=f,f")
4178 (minus:FPR (match_dup 1) (match_dup 2)))]
4179 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4183 [(set_attr "op_type" "RRE,RXE")
4184 (set_attr "type" "fsimp<mode>")])
4186 (define_insn "*sub<mode>3_cconly"
4187 [(set (reg CC_REGNUM)
4188 (compare (minus:FPR (match_operand:FPR 1 "nonimmediate_operand" "0,0")
4189 (match_operand:FPR 2 "general_operand" "f,<Rf>"))
4190 (match_operand:FPR 3 "const0_operand" "")))
4191 (clobber (match_scratch:FPR 0 "=f,f"))]
4192 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4196 [(set_attr "op_type" "RRE,RXE")
4197 (set_attr "type" "fsimp<mode>")])
4199 (define_insn "*sub<mode>3_ibm"
4200 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4201 (minus:FPR (match_operand:FPR 1 "register_operand" "0,0")
4202 (match_operand:FPR 2 "general_operand" "f,<Rf>")))
4203 (clobber (reg:CC CC_REGNUM))]
4204 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4208 [(set_attr "op_type" "<RRe>,<RXe>")
4209 (set_attr "type" "fsimp<mode>")])
4213 ;;- Conditional add/subtract instructions.
4217 ; add(di|si)cc instruction pattern(s).
4220 (define_insn "*add<mode>3_alc_cc"
4221 [(set (reg CC_REGNUM)
4223 (plus:GPR (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0")
4224 (match_operand:GPR 2 "general_operand" "d,m"))
4225 (match_operand:GPR 3 "s390_alc_comparison" ""))
4227 (set (match_operand:GPR 0 "register_operand" "=d,d")
4228 (plus:GPR (plus:GPR (match_dup 1) (match_dup 2)) (match_dup 3)))]
4229 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4233 [(set_attr "op_type" "RRE,RXY")])
4235 (define_insn "*add<mode>3_alc"
4236 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4237 (plus:GPR (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0")
4238 (match_operand:GPR 2 "general_operand" "d,m"))
4239 (match_operand:GPR 3 "s390_alc_comparison" "")))
4240 (clobber (reg:CC CC_REGNUM))]
4245 [(set_attr "op_type" "RRE,RXY")])
4247 (define_insn "*sub<mode>3_slb_cc"
4248 [(set (reg CC_REGNUM)
4250 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
4251 (match_operand:GPR 2 "general_operand" "d,m"))
4252 (match_operand:GPR 3 "s390_slb_comparison" ""))
4254 (set (match_operand:GPR 0 "register_operand" "=d,d")
4255 (minus:GPR (minus:GPR (match_dup 1) (match_dup 2)) (match_dup 3)))]
4256 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4260 [(set_attr "op_type" "RRE,RXY")])
4262 (define_insn "*sub<mode>3_slb"
4263 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4264 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
4265 (match_operand:GPR 2 "general_operand" "d,m"))
4266 (match_operand:GPR 3 "s390_slb_comparison" "")))
4267 (clobber (reg:CC CC_REGNUM))]
4272 [(set_attr "op_type" "RRE,RXY")])
4274 (define_expand "add<mode>cc"
4275 [(match_operand:GPR 0 "register_operand" "")
4276 (match_operand 1 "comparison_operator" "")
4277 (match_operand:GPR 2 "register_operand" "")
4278 (match_operand:GPR 3 "const_int_operand" "")]
4280 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4281 s390_compare_op0, s390_compare_op1,
4282 operands[0], operands[2],
4283 operands[3])) FAIL; DONE;")
4286 ; scond instruction pattern(s).
4289 (define_insn_and_split "*scond<mode>"
4290 [(set (match_operand:GPR 0 "register_operand" "=&d")
4291 (match_operand:GPR 1 "s390_alc_comparison" ""))
4292 (clobber (reg:CC CC_REGNUM))]
4295 "&& reload_completed"
4296 [(set (match_dup 0) (const_int 0))
4298 [(set (match_dup 0) (plus:GPR (plus:GPR (match_dup 0) (match_dup 0))
4300 (clobber (reg:CC CC_REGNUM))])]
4303 (define_insn_and_split "*scond<mode>_neg"
4304 [(set (match_operand:GPR 0 "register_operand" "=&d")
4305 (match_operand:GPR 1 "s390_slb_comparison" ""))
4306 (clobber (reg:CC CC_REGNUM))]
4309 "&& reload_completed"
4310 [(set (match_dup 0) (const_int 0))
4312 [(set (match_dup 0) (minus:GPR (minus:GPR (match_dup 0) (match_dup 0))
4314 (clobber (reg:CC CC_REGNUM))])
4316 [(set (match_dup 0) (neg:GPR (match_dup 0)))
4317 (clobber (reg:CC CC_REGNUM))])]
4321 (define_expand "s<code>"
4322 [(set (match_operand:SI 0 "register_operand" "")
4323 (SCOND (match_dup 0)
4326 "if (!s390_expand_addcc (<CODE>, s390_compare_op0, s390_compare_op1,
4327 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4329 (define_expand "seq"
4331 [(set (match_operand:SI 0 "register_operand" "=d")
4333 (clobber (reg:CC CC_REGNUM))])
4335 [(set (match_dup 0) (xor:SI (match_dup 0) (const_int 1)))
4336 (clobber (reg:CC CC_REGNUM))])]
4339 if (!s390_compare_emitted || GET_MODE (s390_compare_emitted) != CCZ1mode)
4341 operands[1] = s390_emit_compare (NE, s390_compare_op0, s390_compare_op1);
4342 PUT_MODE (operands[1], SImode);
4345 (define_insn_and_split "*sne"
4346 [(set (match_operand:SI 0 "register_operand" "=d")
4347 (ne:SI (match_operand:CCZ1 1 "register_operand" "0")
4349 (clobber (reg:CC CC_REGNUM))]
4354 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 28)))
4355 (clobber (reg:CC CC_REGNUM))])])
4359 ;;- Multiply instructions.
4363 ; muldi3 instruction pattern(s).
4366 (define_insn "*muldi3_sign"
4367 [(set (match_operand:DI 0 "register_operand" "=d,d")
4368 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4369 (match_operand:DI 1 "register_operand" "0,0")))]
4374 [(set_attr "op_type" "RRE,RXY")
4375 (set_attr "type" "imuldi")])
4377 (define_insn "muldi3"
4378 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4379 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4380 (match_operand:DI 2 "general_operand" "d,K,m")))]
4386 [(set_attr "op_type" "RRE,RI,RXY")
4387 (set_attr "type" "imuldi")])
4390 ; mulsi3 instruction pattern(s).
4393 (define_insn "*mulsi3_sign"
4394 [(set (match_operand:SI 0 "register_operand" "=d")
4395 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4396 (match_operand:SI 1 "register_operand" "0")))]
4399 [(set_attr "op_type" "RX")
4400 (set_attr "type" "imulhi")])
4402 (define_insn "mulsi3"
4403 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4404 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4405 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4412 [(set_attr "op_type" "RRE,RI,RX,RXY")
4413 (set_attr "type" "imulsi,imulhi,imulsi,imulsi")])
4416 ; mulsidi3 instruction pattern(s).
4419 (define_insn "mulsidi3"
4420 [(set (match_operand:DI 0 "register_operand" "=d,d")
4421 (mult:DI (sign_extend:DI
4422 (match_operand:SI 1 "register_operand" "%0,0"))
4424 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4429 [(set_attr "op_type" "RR,RX")
4430 (set_attr "type" "imulsi")])
4433 ; umulsidi3 instruction pattern(s).
4436 (define_insn "umulsidi3"
4437 [(set (match_operand:DI 0 "register_operand" "=d,d")
4438 (mult:DI (zero_extend:DI
4439 (match_operand:SI 1 "register_operand" "%0,0"))
4441 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4442 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4446 [(set_attr "op_type" "RRE,RXY")
4447 (set_attr "type" "imulsi")])
4450 ; mul(df|sf)3 instruction pattern(s).
4453 (define_expand "mul<mode>3"
4454 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4455 (mult:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
4456 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
4460 (define_insn "*mul<mode>3"
4461 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4462 (mult:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
4463 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
4464 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4468 [(set_attr "op_type" "RRE,RXE")
4469 (set_attr "type" "fmul<mode>")])
4471 (define_insn "*mul<mode>3_ibm"
4472 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4473 (mult:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
4474 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
4475 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4479 [(set_attr "op_type" "<RRe>,<RXe>")
4480 (set_attr "type" "fmul<mode>")])
4482 (define_insn "*fmadd<mode>"
4483 [(set (match_operand:DSF 0 "register_operand" "=f,f")
4484 (plus:DSF (mult:DSF (match_operand:DSF 1 "register_operand" "%f,f")
4485 (match_operand:DSF 2 "nonimmediate_operand" "f,R"))
4486 (match_operand:DSF 3 "register_operand" "0,0")))]
4487 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4491 [(set_attr "op_type" "RRE,RXE")
4492 (set_attr "type" "fmul<mode>")])
4494 (define_insn "*fmsub<mode>"
4495 [(set (match_operand:DSF 0 "register_operand" "=f,f")
4496 (minus:DSF (mult:DSF (match_operand:DSF 1 "register_operand" "f,f")
4497 (match_operand:DSF 2 "nonimmediate_operand" "f,R"))
4498 (match_operand:DSF 3 "register_operand" "0,0")))]
4499 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4503 [(set_attr "op_type" "RRE,RXE")
4504 (set_attr "type" "fmul<mode>")])
4507 ;;- Divide and modulo instructions.
4511 ; divmoddi4 instruction pattern(s).
4514 (define_expand "divmoddi4"
4515 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4516 (div:DI (match_operand:DI 1 "register_operand" "")
4517 (match_operand:DI 2 "general_operand" "")))
4518 (set (match_operand:DI 3 "general_operand" "")
4519 (mod:DI (match_dup 1) (match_dup 2)))])
4520 (clobber (match_dup 4))]
4523 rtx insn, div_equal, mod_equal;
4525 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4526 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4528 operands[4] = gen_reg_rtx(TImode);
4529 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4531 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4533 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4535 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4537 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4542 (define_insn "divmodtidi3"
4543 [(set (match_operand:TI 0 "register_operand" "=d,d")
4547 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4548 (match_operand:DI 2 "general_operand" "d,m")))
4550 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
4555 [(set_attr "op_type" "RRE,RXY")
4556 (set_attr "type" "idiv")])
4558 (define_insn "divmodtisi3"
4559 [(set (match_operand:TI 0 "register_operand" "=d,d")
4563 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4565 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4568 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
4573 [(set_attr "op_type" "RRE,RXY")
4574 (set_attr "type" "idiv")])
4577 ; udivmoddi4 instruction pattern(s).
4580 (define_expand "udivmoddi4"
4581 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4582 (udiv:DI (match_operand:DI 1 "general_operand" "")
4583 (match_operand:DI 2 "nonimmediate_operand" "")))
4584 (set (match_operand:DI 3 "general_operand" "")
4585 (umod:DI (match_dup 1) (match_dup 2)))])
4586 (clobber (match_dup 4))]
4589 rtx insn, div_equal, mod_equal, equal;
4591 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4592 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4593 equal = gen_rtx_IOR (TImode,
4594 gen_rtx_ASHIFT (TImode,
4595 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4597 gen_rtx_ZERO_EXTEND (TImode, div_equal));
4599 operands[4] = gen_reg_rtx(TImode);
4600 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4601 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4602 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4603 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4605 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4607 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4609 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4611 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4613 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4618 (define_insn "udivmodtidi3"
4619 [(set (match_operand:TI 0 "register_operand" "=d,d")
4624 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
4626 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4630 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
4635 [(set_attr "op_type" "RRE,RXY")
4636 (set_attr "type" "idiv")])
4639 ; divmodsi4 instruction pattern(s).
4642 (define_expand "divmodsi4"
4643 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4644 (div:SI (match_operand:SI 1 "general_operand" "")
4645 (match_operand:SI 2 "nonimmediate_operand" "")))
4646 (set (match_operand:SI 3 "general_operand" "")
4647 (mod:SI (match_dup 1) (match_dup 2)))])
4648 (clobber (match_dup 4))]
4651 rtx insn, div_equal, mod_equal, equal;
4653 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4654 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4655 equal = gen_rtx_IOR (DImode,
4656 gen_rtx_ASHIFT (DImode,
4657 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4659 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4661 operands[4] = gen_reg_rtx(DImode);
4662 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4663 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4665 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4667 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4669 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4671 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4673 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4678 (define_insn "divmoddisi3"
4679 [(set (match_operand:DI 0 "register_operand" "=d,d")
4684 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4686 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4690 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
4695 [(set_attr "op_type" "RR,RX")
4696 (set_attr "type" "idiv")])
4699 ; udivsi3 and umodsi3 instruction pattern(s).
4702 (define_expand "udivmodsi4"
4703 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4704 (udiv:SI (match_operand:SI 1 "general_operand" "")
4705 (match_operand:SI 2 "nonimmediate_operand" "")))
4706 (set (match_operand:SI 3 "general_operand" "")
4707 (umod:SI (match_dup 1) (match_dup 2)))])
4708 (clobber (match_dup 4))]
4709 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4711 rtx insn, div_equal, mod_equal, equal;
4713 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4714 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4715 equal = gen_rtx_IOR (DImode,
4716 gen_rtx_ASHIFT (DImode,
4717 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4719 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4721 operands[4] = gen_reg_rtx(DImode);
4722 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4723 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4724 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4725 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4727 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4729 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4731 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4733 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4735 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4740 (define_insn "udivmoddisi3"
4741 [(set (match_operand:DI 0 "register_operand" "=d,d")
4746 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
4748 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4752 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
4753 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4757 [(set_attr "op_type" "RRE,RXY")
4758 (set_attr "type" "idiv")])
4760 (define_expand "udivsi3"
4761 [(set (match_operand:SI 0 "register_operand" "=d")
4762 (udiv:SI (match_operand:SI 1 "general_operand" "")
4763 (match_operand:SI 2 "general_operand" "")))
4764 (clobber (match_dup 3))]
4765 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4767 rtx insn, udiv_equal, umod_equal, equal;
4769 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4770 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4771 equal = gen_rtx_IOR (DImode,
4772 gen_rtx_ASHIFT (DImode,
4773 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4775 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4777 operands[3] = gen_reg_rtx (DImode);
4779 if (CONSTANT_P (operands[2]))
4781 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4783 rtx label1 = gen_label_rtx ();
4785 operands[1] = make_safe_from (operands[1], operands[0]);
4786 emit_move_insn (operands[0], const0_rtx);
4787 emit_insn (gen_cmpsi (operands[1], operands[2]));
4788 emit_jump_insn (gen_bltu (label1));
4789 emit_move_insn (operands[0], const1_rtx);
4790 emit_label (label1);
4794 operands[2] = force_reg (SImode, operands[2]);
4795 operands[2] = make_safe_from (operands[2], operands[0]);
4797 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4798 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4801 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4803 insn = emit_move_insn (operands[0],
4804 gen_lowpart (SImode, operands[3]));
4806 gen_rtx_EXPR_LIST (REG_EQUAL,
4807 udiv_equal, REG_NOTES (insn));
4812 rtx label1 = gen_label_rtx ();
4813 rtx label2 = gen_label_rtx ();
4814 rtx label3 = gen_label_rtx ();
4816 operands[1] = force_reg (SImode, operands[1]);
4817 operands[1] = make_safe_from (operands[1], operands[0]);
4818 operands[2] = force_reg (SImode, operands[2]);
4819 operands[2] = make_safe_from (operands[2], operands[0]);
4821 emit_move_insn (operands[0], const0_rtx);
4822 emit_insn (gen_cmpsi (operands[2], operands[1]));
4823 emit_jump_insn (gen_bgtu (label3));
4824 emit_insn (gen_cmpsi (operands[2], const0_rtx));
4825 emit_jump_insn (gen_blt (label2));
4826 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4827 emit_jump_insn (gen_beq (label1));
4828 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4829 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4832 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4834 insn = emit_move_insn (operands[0],
4835 gen_lowpart (SImode, operands[3]));
4837 gen_rtx_EXPR_LIST (REG_EQUAL,
4838 udiv_equal, REG_NOTES (insn));
4840 emit_label (label1);
4841 emit_move_insn (operands[0], operands[1]);
4843 emit_label (label2);
4844 emit_move_insn (operands[0], const1_rtx);
4845 emit_label (label3);
4847 emit_move_insn (operands[0], operands[0]);
4851 (define_expand "umodsi3"
4852 [(set (match_operand:SI 0 "register_operand" "=d")
4853 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4854 (match_operand:SI 2 "nonimmediate_operand" "")))
4855 (clobber (match_dup 3))]
4856 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4858 rtx insn, udiv_equal, umod_equal, equal;
4860 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4861 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4862 equal = gen_rtx_IOR (DImode,
4863 gen_rtx_ASHIFT (DImode,
4864 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4866 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4868 operands[3] = gen_reg_rtx (DImode);
4870 if (CONSTANT_P (operands[2]))
4872 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4874 rtx label1 = gen_label_rtx ();
4876 operands[1] = make_safe_from (operands[1], operands[0]);
4877 emit_move_insn (operands[0], operands[1]);
4878 emit_insn (gen_cmpsi (operands[0], operands[2]));
4879 emit_jump_insn (gen_bltu (label1));
4880 emit_insn (gen_abssi2 (operands[0], operands[2]));
4881 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4882 emit_label (label1);
4886 operands[2] = force_reg (SImode, operands[2]);
4887 operands[2] = make_safe_from (operands[2], operands[0]);
4889 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4890 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4893 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4895 insn = emit_move_insn (operands[0],
4896 gen_highpart (SImode, operands[3]));
4898 gen_rtx_EXPR_LIST (REG_EQUAL,
4899 umod_equal, REG_NOTES (insn));
4904 rtx label1 = gen_label_rtx ();
4905 rtx label2 = gen_label_rtx ();
4906 rtx label3 = gen_label_rtx ();
4908 operands[1] = force_reg (SImode, operands[1]);
4909 operands[1] = make_safe_from (operands[1], operands[0]);
4910 operands[2] = force_reg (SImode, operands[2]);
4911 operands[2] = make_safe_from (operands[2], operands[0]);
4913 emit_move_insn(operands[0], operands[1]);
4914 emit_insn (gen_cmpsi (operands[2], operands[1]));
4915 emit_jump_insn (gen_bgtu (label3));
4916 emit_insn (gen_cmpsi (operands[2], const0_rtx));
4917 emit_jump_insn (gen_blt (label2));
4918 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4919 emit_jump_insn (gen_beq (label1));
4920 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4921 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4924 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4926 insn = emit_move_insn (operands[0],
4927 gen_highpart (SImode, operands[3]));
4929 gen_rtx_EXPR_LIST (REG_EQUAL,
4930 umod_equal, REG_NOTES (insn));
4932 emit_label (label1);
4933 emit_move_insn (operands[0], const0_rtx);
4935 emit_label (label2);
4936 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4937 emit_label (label3);
4943 ; div(df|sf)3 instruction pattern(s).
4946 (define_expand "div<mode>3"
4947 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4948 (div:FPR (match_operand:FPR 1 "register_operand" "0,0")
4949 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
4953 (define_insn "*div<mode>3"
4954 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4955 (div:FPR (match_operand:FPR 1 "register_operand" "0,0")
4956 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
4957 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4961 [(set_attr "op_type" "RRE,RXE")
4962 (set_attr "type" "fdiv<mode>")])
4964 (define_insn "*div<mode>3_ibm"
4965 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4966 (div:FPR (match_operand:FPR 1 "register_operand" "0,0")
4967 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
4968 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4972 [(set_attr "op_type" "<RRe>,<RXe>")
4973 (set_attr "type" "fdiv<mode>")])
4977 ;;- And instructions.
4980 (define_expand "and<mode>3"
4981 [(set (match_operand:INT 0 "nonimmediate_operand" "")
4982 (and:INT (match_operand:INT 1 "nonimmediate_operand" "")
4983 (match_operand:INT 2 "general_operand" "")))
4984 (clobber (reg:CC CC_REGNUM))]
4986 "s390_expand_logical_operator (AND, <MODE>mode, operands); DONE;")
4989 ; anddi3 instruction pattern(s).
4992 (define_insn "*anddi3_cc"
4993 [(set (reg CC_REGNUM)
4994 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4995 (match_operand:DI 2 "general_operand" "d,m"))
4997 (set (match_operand:DI 0 "register_operand" "=d,d")
4998 (and:DI (match_dup 1) (match_dup 2)))]
4999 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5003 [(set_attr "op_type" "RRE,RXY")])
5005 (define_insn "*anddi3_cconly"
5006 [(set (reg CC_REGNUM)
5007 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5008 (match_operand:DI 2 "general_operand" "d,m"))
5010 (clobber (match_scratch:DI 0 "=d,d"))]
5011 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
5012 /* Do not steal TM patterns. */
5013 && s390_single_part (operands[2], DImode, HImode, 0) < 0"
5017 [(set_attr "op_type" "RRE,RXY")])
5019 (define_insn "*anddi3_extimm"
5020 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,d,d,AQ,Q")
5021 (and:DI (match_operand:DI 1 "nonimmediate_operand"
5022 "%d,o,0,0,0,0,0,0,0,0,0,0")
5023 (match_operand:DI 2 "general_operand"
5024 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,N0SDF,N1SDF,d,m,NxQDF,Q")))
5025 (clobber (reg:CC CC_REGNUM))]
5026 "TARGET_64BIT && TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5040 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RIL,RIL,RRE,RXY,SI,SS")])
5042 (define_insn "*anddi3"
5043 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q")
5044 (and:DI (match_operand:DI 1 "nonimmediate_operand"
5045 "%d,o,0,0,0,0,0,0,0,0")
5046 (match_operand:DI 2 "general_operand"
5047 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m,NxQDF,Q")))
5048 (clobber (reg:CC CC_REGNUM))]
5049 "TARGET_64BIT && !TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5061 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY,SI,SS")])
5064 [(set (match_operand:DI 0 "s_operand" "")
5065 (and:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5066 (clobber (reg:CC CC_REGNUM))]
5069 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5070 (clobber (reg:CC CC_REGNUM))])]
5071 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5075 ; andsi3 instruction pattern(s).
5078 (define_insn "*andsi3_cc"
5079 [(set (reg CC_REGNUM)
5080 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5081 (match_operand:SI 2 "general_operand" "Os,d,R,T"))
5083 (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
5084 (and:SI (match_dup 1) (match_dup 2)))]
5085 "s390_match_ccmode(insn, CCTmode)"
5091 [(set_attr "op_type" "RIL,RR,RX,RXY")])
5093 (define_insn "*andsi3_cconly"
5094 [(set (reg CC_REGNUM)
5095 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5096 (match_operand:SI 2 "general_operand" "Os,d,R,T"))
5098 (clobber (match_scratch:SI 0 "=d,d,d,d"))]
5099 "s390_match_ccmode(insn, CCTmode)
5100 /* Do not steal TM patterns. */
5101 && s390_single_part (operands[2], SImode, HImode, 0) < 0"
5107 [(set_attr "op_type" "RIL,RR,RX,RXY")])
5109 (define_insn "*andsi3_zarch"
5110 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q")
5111 (and:SI (match_operand:SI 1 "nonimmediate_operand"
5112 "%d,o,0,0,0,0,0,0,0,0")
5113 (match_operand:SI 2 "general_operand"
5114 "M,M,N0HSF,N1HSF,Os,d,R,T,NxQSF,Q")))
5115 (clobber (reg:CC CC_REGNUM))]
5116 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5128 [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RX,RXY,SI,SS")])
5130 (define_insn "*andsi3_esa"
5131 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5132 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5133 (match_operand:SI 2 "general_operand" "d,R,NxQSF,Q")))
5134 (clobber (reg:CC CC_REGNUM))]
5135 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5141 [(set_attr "op_type" "RR,RX,SI,SS")])
5144 [(set (match_operand:SI 0 "s_operand" "")
5145 (and:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5146 (clobber (reg:CC CC_REGNUM))]
5149 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5150 (clobber (reg:CC CC_REGNUM))])]
5151 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5154 ; andhi3 instruction pattern(s).
5157 (define_insn "*andhi3_zarch"
5158 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5159 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0,0")
5160 (match_operand:HI 2 "general_operand" "d,n,NxQHF,Q")))
5161 (clobber (reg:CC CC_REGNUM))]
5162 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5168 [(set_attr "op_type" "RR,RI,SI,SS")])
5170 (define_insn "*andhi3_esa"
5171 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
5172 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
5173 (match_operand:HI 2 "general_operand" "d,NxQHF,Q")))
5174 (clobber (reg:CC CC_REGNUM))]
5175 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5180 [(set_attr "op_type" "RR,SI,SS")])
5183 [(set (match_operand:HI 0 "s_operand" "")
5184 (and:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
5185 (clobber (reg:CC CC_REGNUM))]
5188 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5189 (clobber (reg:CC CC_REGNUM))])]
5190 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5193 ; andqi3 instruction pattern(s).
5196 (define_insn "*andqi3_zarch"
5197 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,Q,S,Q")
5198 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0,0")
5199 (match_operand:QI 2 "general_operand" "d,n,n,n,Q")))
5200 (clobber (reg:CC CC_REGNUM))]
5201 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5208 [(set_attr "op_type" "RR,RI,SI,SIY,SS")])
5210 (define_insn "*andqi3_esa"
5211 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
5212 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
5213 (match_operand:QI 2 "general_operand" "d,n,Q")))
5214 (clobber (reg:CC CC_REGNUM))]
5215 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5220 [(set_attr "op_type" "RR,SI,SS")])
5223 ; Block and (NC) patterns.
5227 [(set (match_operand:BLK 0 "memory_operand" "=Q")
5228 (and:BLK (match_dup 0)
5229 (match_operand:BLK 1 "memory_operand" "Q")))
5230 (use (match_operand 2 "const_int_operand" "n"))
5231 (clobber (reg:CC CC_REGNUM))]
5232 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
5233 "nc\t%O0(%2,%R0),%S1"
5234 [(set_attr "op_type" "SS")])
5237 [(set (match_operand 0 "memory_operand" "")
5239 (match_operand 1 "memory_operand" "")))
5240 (clobber (reg:CC CC_REGNUM))]
5242 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5243 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
5245 [(set (match_dup 0) (and:BLK (match_dup 0) (match_dup 1)))
5247 (clobber (reg:CC CC_REGNUM))])]
5249 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
5250 operands[0] = adjust_address (operands[0], BLKmode, 0);
5251 operands[1] = adjust_address (operands[1], BLKmode, 0);
5256 [(set (match_operand:BLK 0 "memory_operand" "")
5257 (and:BLK (match_dup 0)
5258 (match_operand:BLK 1 "memory_operand" "")))
5259 (use (match_operand 2 "const_int_operand" ""))
5260 (clobber (reg:CC CC_REGNUM))])
5262 [(set (match_operand:BLK 3 "memory_operand" "")
5263 (and:BLK (match_dup 3)
5264 (match_operand:BLK 4 "memory_operand" "")))
5265 (use (match_operand 5 "const_int_operand" ""))
5266 (clobber (reg:CC CC_REGNUM))])]
5267 "s390_offset_p (operands[0], operands[3], operands[2])
5268 && s390_offset_p (operands[1], operands[4], operands[2])
5269 && !s390_overlap_p (operands[0], operands[1],
5270 INTVAL (operands[2]) + INTVAL (operands[5]))
5271 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
5273 [(set (match_dup 6) (and:BLK (match_dup 6) (match_dup 7)))
5275 (clobber (reg:CC CC_REGNUM))])]
5276 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
5277 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
5278 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
5282 ;;- Bit set (inclusive or) instructions.
5285 (define_expand "ior<mode>3"
5286 [(set (match_operand:INT 0 "nonimmediate_operand" "")
5287 (ior:INT (match_operand:INT 1 "nonimmediate_operand" "")
5288 (match_operand:INT 2 "general_operand" "")))
5289 (clobber (reg:CC CC_REGNUM))]
5291 "s390_expand_logical_operator (IOR, <MODE>mode, operands); DONE;")
5294 ; iordi3 instruction pattern(s).
5297 (define_insn "*iordi3_cc"
5298 [(set (reg CC_REGNUM)
5299 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5300 (match_operand:DI 2 "general_operand" "d,m"))
5302 (set (match_operand:DI 0 "register_operand" "=d,d")
5303 (ior:DI (match_dup 1) (match_dup 2)))]
5304 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5308 [(set_attr "op_type" "RRE,RXY")])
5310 (define_insn "*iordi3_cconly"
5311 [(set (reg CC_REGNUM)
5312 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5313 (match_operand:DI 2 "general_operand" "d,m"))
5315 (clobber (match_scratch:DI 0 "=d,d"))]
5316 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5320 [(set_attr "op_type" "RRE,RXY")])
5322 (define_insn "*iordi3_extimm"
5323 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q")
5324 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0,0,0,0,0,0,0")
5325 (match_operand:DI 2 "general_operand"
5326 "N0HD0,N1HD0,N2HD0,N3HD0,N0SD0,N1SD0,d,m,NxQD0,Q")))
5327 (clobber (reg:CC CC_REGNUM))]
5328 "TARGET_64BIT && TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5340 [(set_attr "op_type" "RI,RI,RI,RI,RIL,RIL,RRE,RXY,SI,SS")])
5342 (define_insn "*iordi3"
5343 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,AQ,Q")
5344 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0,0,0,0,0")
5345 (match_operand:DI 2 "general_operand"
5346 "N0HD0,N1HD0,N2HD0,N3HD0,d,m,NxQD0,Q")))
5347 (clobber (reg:CC CC_REGNUM))]
5348 "TARGET_64BIT && !TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5358 [(set_attr "op_type" "RI,RI,RI,RI,RRE,RXY,SI,SS")])
5361 [(set (match_operand:DI 0 "s_operand" "")
5362 (ior:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5363 (clobber (reg:CC CC_REGNUM))]
5366 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5367 (clobber (reg:CC CC_REGNUM))])]
5368 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5371 ; iorsi3 instruction pattern(s).
5374 (define_insn "*iorsi3_cc"
5375 [(set (reg CC_REGNUM)
5376 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5377 (match_operand:SI 2 "general_operand" "Os,d,R,T"))
5379 (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
5380 (ior:SI (match_dup 1) (match_dup 2)))]
5381 "s390_match_ccmode(insn, CCTmode)"
5387 [(set_attr "op_type" "RIL,RR,RX,RXY")])
5389 (define_insn "*iorsi3_cconly"
5390 [(set (reg CC_REGNUM)
5391 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5392 (match_operand:SI 2 "general_operand" "Os,d,R,T"))
5394 (clobber (match_scratch:SI 0 "=d,d,d,d"))]
5395 "s390_match_ccmode(insn, CCTmode)"
5401 [(set_attr "op_type" "RIL,RR,RX,RXY")])
5403 (define_insn "*iorsi3_zarch"
5404 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,AQ,Q")
5405 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0,0,0,0")
5406 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,Os,d,R,T,NxQS0,Q")))
5407 (clobber (reg:CC CC_REGNUM))]
5408 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5418 [(set_attr "op_type" "RI,RI,RIL,RR,RX,RXY,SI,SS")])
5420 (define_insn "*iorsi3_esa"
5421 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5422 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5423 (match_operand:SI 2 "general_operand" "d,R,NxQS0,Q")))
5424 (clobber (reg:CC CC_REGNUM))]
5425 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5431 [(set_attr "op_type" "RR,RX,SI,SS")])
5434 [(set (match_operand:SI 0 "s_operand" "")
5435 (ior:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5436 (clobber (reg:CC CC_REGNUM))]
5439 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5440 (clobber (reg:CC CC_REGNUM))])]
5441 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5444 ; iorhi3 instruction pattern(s).
5447 (define_insn "*iorhi3_zarch"
5448 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5449 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0,0")
5450 (match_operand:HI 2 "general_operand" "d,n,NxQH0,Q")))
5451 (clobber (reg:CC CC_REGNUM))]
5452 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5458 [(set_attr "op_type" "RR,RI,SI,SS")])
5460 (define_insn "*iorhi3_esa"
5461 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
5462 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
5463 (match_operand:HI 2 "general_operand" "d,NxQH0,Q")))
5464 (clobber (reg:CC CC_REGNUM))]
5465 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5470 [(set_attr "op_type" "RR,SI,SS")])
5473 [(set (match_operand:HI 0 "s_operand" "")
5474 (ior:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
5475 (clobber (reg:CC CC_REGNUM))]
5478 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5479 (clobber (reg:CC CC_REGNUM))])]
5480 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5483 ; iorqi3 instruction pattern(s).
5486 (define_insn "*iorqi3_zarch"
5487 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,Q,S,Q")
5488 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0,0")
5489 (match_operand:QI 2 "general_operand" "d,n,n,n,Q")))
5490 (clobber (reg:CC CC_REGNUM))]
5491 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5498 [(set_attr "op_type" "RR,RI,SI,SIY,SS")])
5500 (define_insn "*iorqi3_esa"
5501 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
5502 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
5503 (match_operand:QI 2 "general_operand" "d,n,Q")))
5504 (clobber (reg:CC CC_REGNUM))]
5505 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5510 [(set_attr "op_type" "RR,SI,SS")])
5513 ; Block inclusive or (OC) patterns.
5517 [(set (match_operand:BLK 0 "memory_operand" "=Q")
5518 (ior:BLK (match_dup 0)
5519 (match_operand:BLK 1 "memory_operand" "Q")))
5520 (use (match_operand 2 "const_int_operand" "n"))
5521 (clobber (reg:CC CC_REGNUM))]
5522 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
5523 "oc\t%O0(%2,%R0),%S1"
5524 [(set_attr "op_type" "SS")])
5527 [(set (match_operand 0 "memory_operand" "")
5529 (match_operand 1 "memory_operand" "")))
5530 (clobber (reg:CC CC_REGNUM))]
5532 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5533 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
5535 [(set (match_dup 0) (ior:BLK (match_dup 0) (match_dup 1)))
5537 (clobber (reg:CC CC_REGNUM))])]
5539 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
5540 operands[0] = adjust_address (operands[0], BLKmode, 0);
5541 operands[1] = adjust_address (operands[1], BLKmode, 0);
5546 [(set (match_operand:BLK 0 "memory_operand" "")
5547 (ior:BLK (match_dup 0)
5548 (match_operand:BLK 1 "memory_operand" "")))
5549 (use (match_operand 2 "const_int_operand" ""))
5550 (clobber (reg:CC CC_REGNUM))])
5552 [(set (match_operand:BLK 3 "memory_operand" "")
5553 (ior:BLK (match_dup 3)
5554 (match_operand:BLK 4 "memory_operand" "")))
5555 (use (match_operand 5 "const_int_operand" ""))
5556 (clobber (reg:CC CC_REGNUM))])]
5557 "s390_offset_p (operands[0], operands[3], operands[2])
5558 && s390_offset_p (operands[1], operands[4], operands[2])
5559 && !s390_overlap_p (operands[0], operands[1],
5560 INTVAL (operands[2]) + INTVAL (operands[5]))
5561 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
5563 [(set (match_dup 6) (ior:BLK (match_dup 6) (match_dup 7)))
5565 (clobber (reg:CC CC_REGNUM))])]
5566 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
5567 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
5568 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
5572 ;;- Xor instructions.
5575 (define_expand "xor<mode>3"
5576 [(set (match_operand:INT 0 "nonimmediate_operand" "")
5577 (xor:INT (match_operand:INT 1 "nonimmediate_operand" "")
5578 (match_operand:INT 2 "general_operand" "")))
5579 (clobber (reg:CC CC_REGNUM))]
5581 "s390_expand_logical_operator (XOR, <MODE>mode, operands); DONE;")
5584 ; xordi3 instruction pattern(s).
5587 (define_insn "*xordi3_cc"
5588 [(set (reg CC_REGNUM)
5589 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5590 (match_operand:DI 2 "general_operand" "d,m"))
5592 (set (match_operand:DI 0 "register_operand" "=d,d")
5593 (xor:DI (match_dup 1) (match_dup 2)))]
5594 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5598 [(set_attr "op_type" "RRE,RXY")])
5600 (define_insn "*xordi3_cconly"
5601 [(set (reg CC_REGNUM)
5602 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5603 (match_operand:DI 2 "general_operand" "d,m"))
5605 (clobber (match_scratch:DI 0 "=d,d"))]
5606 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5610 [(set_attr "op_type" "RRE,RXY")])
5612 (define_insn "*xordi3_extimm"
5613 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,AQ,Q")
5614 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0,0,0")
5615 (match_operand:DI 2 "general_operand" "N0SD0,N1SD0,d,m,NxQD0,Q")))
5616 (clobber (reg:CC CC_REGNUM))]
5617 "TARGET_64BIT && TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5625 [(set_attr "op_type" "RIL,RIL,RRE,RXY,SI,SS")])
5627 (define_insn "*xordi3"
5628 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5629 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
5630 (match_operand:DI 2 "general_operand" "d,m,NxQD0,Q")))
5631 (clobber (reg:CC CC_REGNUM))]
5632 "TARGET_64BIT && !TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5638 [(set_attr "op_type" "RRE,RXY,SI,SS")])
5641 [(set (match_operand:DI 0 "s_operand" "")
5642 (xor:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5643 (clobber (reg:CC CC_REGNUM))]
5646 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
5647 (clobber (reg:CC CC_REGNUM))])]
5648 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
5651 ; xorsi3 instruction pattern(s).
5654 (define_insn "*xorsi3_cc"
5655 [(set (reg CC_REGNUM)
5656 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5657 (match_operand:SI 2 "general_operand" "Os,d,R,T"))
5659 (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
5660 (xor:SI (match_dup 1) (match_dup 2)))]
5661 "s390_match_ccmode(insn, CCTmode)"
5667 [(set_attr "op_type" "RIL,RR,RX,RXY")])
5669 (define_insn "*xorsi3_cconly"
5670 [(set (reg CC_REGNUM)
5671 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5672 (match_operand:SI 2 "general_operand" "Os,d,R,T"))
5674 (clobber (match_scratch:SI 0 "=d,d,d,d"))]
5675 "s390_match_ccmode(insn, CCTmode)"
5681 [(set_attr "op_type" "RIL,RR,RX,RXY")])
5683 (define_insn "*xorsi3"
5684 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,AQ,Q")
5685 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0,0")
5686 (match_operand:SI 2 "general_operand" "Os,d,R,T,NxQS0,Q")))
5687 (clobber (reg:CC CC_REGNUM))]
5688 "s390_logical_operator_ok_p (operands)"
5696 [(set_attr "op_type" "RIL,RR,RX,RXY,SI,SS")])
5699 [(set (match_operand:SI 0 "s_operand" "")
5700 (xor:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5701 (clobber (reg:CC CC_REGNUM))]
5704 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
5705 (clobber (reg:CC CC_REGNUM))])]
5706 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
5709 ; xorhi3 instruction pattern(s).
5712 (define_insn "*xorhi3"
5713 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5714 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0,0")
5715 (match_operand:HI 2 "general_operand" "Os,d,NxQH0,Q")))
5716 (clobber (reg:CC CC_REGNUM))]
5717 "s390_logical_operator_ok_p (operands)"
5723 [(set_attr "op_type" "RIL,RR,SI,SS")])
5726 [(set (match_operand:HI 0 "s_operand" "")
5727 (xor:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
5728 (clobber (reg:CC CC_REGNUM))]
5731 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
5732 (clobber (reg:CC CC_REGNUM))])]
5733 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
5736 ; xorqi3 instruction pattern(s).
5739 (define_insn "*xorqi3"
5740 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,Q,S,Q")
5741 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0,0")
5742 (match_operand:QI 2 "general_operand" "Os,d,n,n,Q")))
5743 (clobber (reg:CC CC_REGNUM))]
5744 "s390_logical_operator_ok_p (operands)"
5751 [(set_attr "op_type" "RIL,RR,SI,SIY,SS")])
5754 ; Block exclusive or (XC) patterns.
5758 [(set (match_operand:BLK 0 "memory_operand" "=Q")
5759 (xor:BLK (match_dup 0)
5760 (match_operand:BLK 1 "memory_operand" "Q")))
5761 (use (match_operand 2 "const_int_operand" "n"))
5762 (clobber (reg:CC CC_REGNUM))]
5763 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
5764 "xc\t%O0(%2,%R0),%S1"
5765 [(set_attr "op_type" "SS")])
5768 [(set (match_operand 0 "memory_operand" "")
5770 (match_operand 1 "memory_operand" "")))
5771 (clobber (reg:CC CC_REGNUM))]
5773 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5774 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
5776 [(set (match_dup 0) (xor:BLK (match_dup 0) (match_dup 1)))
5778 (clobber (reg:CC CC_REGNUM))])]
5780 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
5781 operands[0] = adjust_address (operands[0], BLKmode, 0);
5782 operands[1] = adjust_address (operands[1], BLKmode, 0);
5787 [(set (match_operand:BLK 0 "memory_operand" "")
5788 (xor:BLK (match_dup 0)
5789 (match_operand:BLK 1 "memory_operand" "")))
5790 (use (match_operand 2 "const_int_operand" ""))
5791 (clobber (reg:CC CC_REGNUM))])
5793 [(set (match_operand:BLK 3 "memory_operand" "")
5794 (xor:BLK (match_dup 3)
5795 (match_operand:BLK 4 "memory_operand" "")))
5796 (use (match_operand 5 "const_int_operand" ""))
5797 (clobber (reg:CC CC_REGNUM))])]
5798 "s390_offset_p (operands[0], operands[3], operands[2])
5799 && s390_offset_p (operands[1], operands[4], operands[2])
5800 && !s390_overlap_p (operands[0], operands[1],
5801 INTVAL (operands[2]) + INTVAL (operands[5]))
5802 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
5804 [(set (match_dup 6) (xor:BLK (match_dup 6) (match_dup 7)))
5806 (clobber (reg:CC CC_REGNUM))])]
5807 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
5808 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
5809 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
5812 ; Block xor (XC) patterns with src == dest.
5815 (define_insn "*xc_zero"
5816 [(set (match_operand:BLK 0 "memory_operand" "=Q")
5818 (use (match_operand 1 "const_int_operand" "n"))
5819 (clobber (reg:CC CC_REGNUM))]
5820 "INTVAL (operands[1]) >= 1 && INTVAL (operands[1]) <= 256"
5821 "xc\t%O0(%1,%R0),%S0"
5822 [(set_attr "op_type" "SS")])
5826 [(set (match_operand:BLK 0 "memory_operand" "")
5828 (use (match_operand 1 "const_int_operand" ""))
5829 (clobber (reg:CC CC_REGNUM))])
5831 [(set (match_operand:BLK 2 "memory_operand" "")
5833 (use (match_operand 3 "const_int_operand" ""))
5834 (clobber (reg:CC CC_REGNUM))])]
5835 "s390_offset_p (operands[0], operands[2], operands[1])
5836 && INTVAL (operands[1]) + INTVAL (operands[3]) <= 256"
5838 [(set (match_dup 4) (const_int 0))
5840 (clobber (reg:CC CC_REGNUM))])]
5841 "operands[4] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
5842 operands[5] = GEN_INT (INTVAL (operands[1]) + INTVAL (operands[3]));")
5846 ;;- Negate instructions.
5850 ; neg(di|si)2 instruction pattern(s).
5853 (define_expand "neg<mode>2"
5855 [(set (match_operand:DSI 0 "register_operand" "=d")
5856 (neg:DSI (match_operand:DSI 1 "register_operand" "d")))
5857 (clobber (reg:CC CC_REGNUM))])]
5861 (define_insn "*negdi2_sign_cc"
5862 [(set (reg CC_REGNUM)
5863 (compare (neg:DI (ashiftrt:DI (ashift:DI (subreg:DI
5864 (match_operand:SI 1 "register_operand" "d") 0)
5865 (const_int 32)) (const_int 32)))
5867 (set (match_operand:DI 0 "register_operand" "=d")
5868 (neg:DI (sign_extend:DI (match_dup 1))))]
5869 "TARGET_64BIT && s390_match_ccmode (insn, CCAmode)"
5871 [(set_attr "op_type" "RRE")])
5873 (define_insn "*negdi2_sign"
5874 [(set (match_operand:DI 0 "register_operand" "=d")
5875 (neg:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
5876 (clobber (reg:CC CC_REGNUM))]
5879 [(set_attr "op_type" "RRE")])
5881 (define_insn "*neg<mode>2_cc"
5882 [(set (reg CC_REGNUM)
5883 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
5885 (set (match_operand:GPR 0 "register_operand" "=d")
5886 (neg:GPR (match_dup 1)))]
5887 "s390_match_ccmode (insn, CCAmode)"
5889 [(set_attr "op_type" "RR<E>")])
5891 (define_insn "*neg<mode>2_cconly"
5892 [(set (reg CC_REGNUM)
5893 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
5895 (clobber (match_scratch:GPR 0 "=d"))]
5896 "s390_match_ccmode (insn, CCAmode)"
5898 [(set_attr "op_type" "RR<E>")])
5900 (define_insn "*neg<mode>2"
5901 [(set (match_operand:GPR 0 "register_operand" "=d")
5902 (neg:GPR (match_operand:GPR 1 "register_operand" "d")))
5903 (clobber (reg:CC CC_REGNUM))]
5906 [(set_attr "op_type" "RR<E>")])
5908 (define_insn_and_split "*negdi2_31"
5909 [(set (match_operand:DI 0 "register_operand" "=d")
5910 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5911 (clobber (reg:CC CC_REGNUM))]
5914 "&& reload_completed"
5916 [(set (match_dup 2) (neg:SI (match_dup 3)))
5917 (clobber (reg:CC CC_REGNUM))])
5919 [(set (reg:CCAP CC_REGNUM)
5920 (compare:CCAP (neg:SI (match_dup 5)) (const_int 0)))
5921 (set (match_dup 4) (neg:SI (match_dup 5)))])
5923 (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
5925 (label_ref (match_dup 6))))
5927 [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
5928 (clobber (reg:CC CC_REGNUM))])
5930 "operands[2] = operand_subword (operands[0], 0, 0, DImode);
5931 operands[3] = operand_subword (operands[1], 0, 0, DImode);
5932 operands[4] = operand_subword (operands[0], 1, 0, DImode);
5933 operands[5] = operand_subword (operands[1], 1, 0, DImode);
5934 operands[6] = gen_label_rtx ();")
5937 ; neg(df|sf)2 instruction pattern(s).
5940 (define_expand "neg<mode>2"
5942 [(set (match_operand:FPR 0 "register_operand" "=f")
5943 (neg:FPR (match_operand:FPR 1 "register_operand" "f")))
5944 (clobber (reg:CC CC_REGNUM))])]
5948 (define_insn "*neg<mode>2_cc"
5949 [(set (reg CC_REGNUM)
5950 (compare (neg:FPR (match_operand:FPR 1 "register_operand" "f"))
5951 (match_operand:FPR 2 "const0_operand" "")))
5952 (set (match_operand:FPR 0 "register_operand" "=f")
5953 (neg:FPR (match_dup 1)))]
5954 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5956 [(set_attr "op_type" "RRE")
5957 (set_attr "type" "fsimp<mode>")])
5959 (define_insn "*neg<mode>2_cconly"
5960 [(set (reg CC_REGNUM)
5961 (compare (neg:FPR (match_operand:FPR 1 "register_operand" "f"))
5962 (match_operand:FPR 2 "const0_operand" "")))
5963 (clobber (match_scratch:FPR 0 "=f"))]
5964 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5966 [(set_attr "op_type" "RRE")
5967 (set_attr "type" "fsimp<mode>")])
5969 (define_insn "*neg<mode>2"
5970 [(set (match_operand:FPR 0 "register_operand" "=f")
5971 (neg:FPR (match_operand:FPR 1 "register_operand" "f")))
5972 (clobber (reg:CC CC_REGNUM))]
5973 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5975 [(set_attr "op_type" "RRE")
5976 (set_attr "type" "fsimp<mode>")])
5978 (define_insn "*neg<mode>2_ibm"
5979 [(set (match_operand:FPR 0 "register_operand" "=f")
5980 (neg:FPR (match_operand:FPR 1 "register_operand" "f")))
5981 (clobber (reg:CC CC_REGNUM))]
5982 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5984 [(set_attr "op_type" "<RRe>")
5985 (set_attr "type" "fsimp<mode>")])
5989 ;;- Absolute value instructions.
5993 ; abs(di|si)2 instruction pattern(s).
5996 (define_insn "*absdi2_sign_cc"
5997 [(set (reg CC_REGNUM)
5998 (compare (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
5999 (match_operand:SI 1 "register_operand" "d") 0)
6000 (const_int 32)) (const_int 32)))
6002 (set (match_operand:DI 0 "register_operand" "=d")
6003 (abs:DI (sign_extend:DI (match_dup 1))))]
6004 "TARGET_64BIT && s390_match_ccmode (insn, CCAmode)"
6006 [(set_attr "op_type" "RRE")])
6008 (define_insn "*absdi2_sign"
6009 [(set (match_operand:DI 0 "register_operand" "=d")
6010 (abs:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
6011 (clobber (reg:CC CC_REGNUM))]
6014 [(set_attr "op_type" "RRE")])
6016 (define_insn "*abs<mode>2_cc"
6017 [(set (reg CC_REGNUM)
6018 (compare (abs:GPR (match_operand:DI 1 "register_operand" "d"))
6020 (set (match_operand:GPR 0 "register_operand" "=d")
6021 (abs:GPR (match_dup 1)))]
6022 "s390_match_ccmode (insn, CCAmode)"
6024 [(set_attr "op_type" "RR<E>")])
6026 (define_insn "*abs<mode>2_cconly"
6027 [(set (reg CC_REGNUM)
6028 (compare (abs:GPR (match_operand:GPR 1 "register_operand" "d"))
6030 (clobber (match_scratch:GPR 0 "=d"))]
6031 "s390_match_ccmode (insn, CCAmode)"
6033 [(set_attr "op_type" "RR<E>")])
6035 (define_insn "abs<mode>2"
6036 [(set (match_operand:GPR 0 "register_operand" "=d")
6037 (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
6038 (clobber (reg:CC CC_REGNUM))]
6041 [(set_attr "op_type" "RR<E>")])
6044 ; abs(df|sf)2 instruction pattern(s).
6047 (define_expand "abs<mode>2"
6049 [(set (match_operand:FPR 0 "register_operand" "=f")
6050 (abs:FPR (match_operand:FPR 1 "register_operand" "f")))
6051 (clobber (reg:CC CC_REGNUM))])]
6055 (define_insn "*abs<mode>2_cc"
6056 [(set (reg CC_REGNUM)
6057 (compare (abs:FPR (match_operand:FPR 1 "register_operand" "f"))
6058 (match_operand:FPR 2 "const0_operand" "")))
6059 (set (match_operand:FPR 0 "register_operand" "=f")
6060 (abs:FPR (match_dup 1)))]
6061 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6063 [(set_attr "op_type" "RRE")
6064 (set_attr "type" "fsimp<mode>")])
6066 (define_insn "*abs<mode>2_cconly"
6067 [(set (reg CC_REGNUM)
6068 (compare (abs:FPR (match_operand:FPR 1 "register_operand" "f"))
6069 (match_operand:FPR 2 "const0_operand" "")))
6070 (clobber (match_scratch:FPR 0 "=f"))]
6071 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6073 [(set_attr "op_type" "RRE")
6074 (set_attr "type" "fsimp<mode>")])
6076 (define_insn "*abs<mode>2"
6077 [(set (match_operand:FPR 0 "register_operand" "=f")
6078 (abs:FPR (match_operand:FPR 1 "register_operand" "f")))
6079 (clobber (reg:CC CC_REGNUM))]
6080 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6082 [(set_attr "op_type" "RRE")
6083 (set_attr "type" "fsimp<mode>")])
6085 (define_insn "*abs<mode>2_ibm"
6086 [(set (match_operand:FPR 0 "register_operand" "=f")
6087 (abs:FPR (match_operand:FPR 1 "register_operand" "f")))
6088 (clobber (reg:CC CC_REGNUM))]
6089 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6091 [(set_attr "op_type" "<RRe>")
6092 (set_attr "type" "fsimp<mode>")])
6095 ;;- Negated absolute value instructions
6102 (define_insn "*negabsdi2_sign_cc"
6103 [(set (reg CC_REGNUM)
6104 (compare (neg:DI (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
6105 (match_operand:SI 1 "register_operand" "d") 0)
6106 (const_int 32)) (const_int 32))))
6108 (set (match_operand:DI 0 "register_operand" "=d")
6109 (neg:DI (abs:DI (sign_extend:DI (match_dup 1)))))]
6110 "TARGET_64BIT && s390_match_ccmode (insn, CCAmode)"
6112 [(set_attr "op_type" "RRE")])
6114 (define_insn "*negabsdi2_sign"
6115 [(set (match_operand:DI 0 "register_operand" "=d")
6116 (neg:DI (abs:DI (sign_extend:DI
6117 (match_operand:SI 1 "register_operand" "d")))))
6118 (clobber (reg:CC CC_REGNUM))]
6121 [(set_attr "op_type" "RRE")])
6123 (define_insn "*negabs<mode>2_cc"
6124 [(set (reg CC_REGNUM)
6125 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
6127 (set (match_operand:GPR 0 "register_operand" "=d")
6128 (neg:GPR (abs:GPR (match_dup 1))))]
6129 "s390_match_ccmode (insn, CCAmode)"
6131 [(set_attr "op_type" "RR<E>")])
6133 (define_insn "*negabs<mode>2_cconly"
6134 [(set (reg CC_REGNUM)
6135 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
6137 (clobber (match_scratch:GPR 0 "=d"))]
6138 "s390_match_ccmode (insn, CCAmode)"
6140 [(set_attr "op_type" "RR<E>")])
6142 (define_insn "*negabs<mode>2"
6143 [(set (match_operand:GPR 0 "register_operand" "=d")
6144 (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d"))))
6145 (clobber (reg:CC CC_REGNUM))]
6148 [(set_attr "op_type" "RR<E>")])
6154 (define_insn "*negabs<mode>2_cc"
6155 [(set (reg CC_REGNUM)
6156 (compare (neg:FPR (abs:FPR (match_operand:FPR 1 "register_operand" "f")))
6157 (match_operand:FPR 2 "const0_operand" "")))
6158 (set (match_operand:FPR 0 "register_operand" "=f")
6159 (neg:FPR (abs:FPR (match_dup 1))))]
6160 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6162 [(set_attr "op_type" "RRE")
6163 (set_attr "type" "fsimp<mode>")])
6165 (define_insn "*negabs<mode>2_cconly"
6166 [(set (reg CC_REGNUM)
6167 (compare (neg:FPR (abs:FPR (match_operand:FPR 1 "register_operand" "f")))
6168 (match_operand:FPR 2 "const0_operand" "")))
6169 (clobber (match_scratch:FPR 0 "=f"))]
6170 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6172 [(set_attr "op_type" "RRE")
6173 (set_attr "type" "fsimp<mode>")])
6175 (define_insn "*negabs<mode>2"
6176 [(set (match_operand:FPR 0 "register_operand" "=f")
6177 (neg:FPR (abs:FPR (match_operand:FPR 1 "register_operand" "f"))))
6178 (clobber (reg:CC CC_REGNUM))]
6179 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6181 [(set_attr "op_type" "RRE")
6182 (set_attr "type" "fsimp<mode>")])
6185 ;;- Square root instructions.
6189 ; sqrt(df|sf)2 instruction pattern(s).
6192 (define_insn "sqrt<mode>2"
6193 [(set (match_operand:FPR 0 "register_operand" "=f,f")
6194 (sqrt:FPR (match_operand:FPR 1 "general_operand" "f,<Rf>")))]
6195 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6199 [(set_attr "op_type" "RRE,RXE")
6200 (set_attr "type" "fsqrt<mode>")])
6204 ;;- One complement instructions.
6208 ; one_cmpl(di|si|hi|qi)2 instruction pattern(s).
6211 (define_expand "one_cmpl<mode>2"
6213 [(set (match_operand:INT 0 "register_operand" "")
6214 (xor:INT (match_operand:INT 1 "register_operand" "")
6216 (clobber (reg:CC CC_REGNUM))])]
6222 ;; Find leftmost bit instructions.
6225 (define_expand "clzdi2"
6226 [(set (match_operand:DI 0 "register_operand" "=d")
6227 (clz:DI (match_operand:DI 1 "register_operand" "d")))]
6228 "TARGET_EXTIMM && TARGET_64BIT"
6230 rtx insn, clz_equal;
6231 rtx wide_reg = gen_reg_rtx (TImode);
6232 rtx msb = gen_rtx_CONST_INT (DImode, (unsigned HOST_WIDE_INT) 1 << 63);
6234 clz_equal = gen_rtx_CLZ (DImode, operands[1]);
6236 emit_insn (gen_clztidi2 (wide_reg, operands[1], msb));
6238 insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg));
6240 gen_rtx_EXPR_LIST (REG_EQUAL, clz_equal, REG_NOTES (insn));
6245 (define_insn "clztidi2"
6246 [(set (match_operand:TI 0 "register_operand" "=d")
6250 (xor:DI (match_operand:DI 1 "register_operand" "d")
6251 (lshiftrt (match_operand:DI 2 "const_int_operand" "")
6252 (subreg:SI (clz:DI (match_dup 1)) 4))))
6255 (zero_extend:TI (clz:DI (match_dup 1)))))
6256 (clobber (reg:CC CC_REGNUM))]
6257 "(unsigned HOST_WIDE_INT) INTVAL (operands[2])
6258 == (unsigned HOST_WIDE_INT) 1 << 63
6259 && TARGET_EXTIMM && TARGET_64BIT"
6261 [(set_attr "op_type" "RRE")])
6265 ;;- Rotate instructions.
6269 ; rotl(di|si)3 instruction pattern(s).
6272 (define_insn "rotl<mode>3"
6273 [(set (match_operand:GPR 0 "register_operand" "=d")
6274 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
6275 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
6278 [(set_attr "op_type" "RSE")
6279 (set_attr "atype" "reg")])
6281 (define_insn "*rotl<mode>3_and"
6282 [(set (match_operand:GPR 0 "register_operand" "=d")
6283 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
6284 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6285 (match_operand:SI 3 "const_int_operand" "n"))))]
6286 "TARGET_CPU_ZARCH && (INTVAL (operands[3]) & 63) == 63"
6288 [(set_attr "op_type" "RSE")
6289 (set_attr "atype" "reg")])
6293 ;;- Shift instructions.
6297 ; (ashl|lshr)(di|si)3 instruction pattern(s).
6300 (define_expand "<shift><mode>3"
6301 [(set (match_operand:DSI 0 "register_operand" "")
6302 (SHIFT:DSI (match_operand:DSI 1 "register_operand" "")
6303 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))]
6307 (define_insn "*<shift>di3_31"
6308 [(set (match_operand:DI 0 "register_operand" "=d")
6309 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
6310 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
6313 [(set_attr "op_type" "RS")
6314 (set_attr "atype" "reg")])
6316 (define_insn "*<shift><mode>3"
6317 [(set (match_operand:GPR 0 "register_operand" "=d")
6318 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>")
6319 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
6321 "s<lr>l<g>\t%0,<1>%Y2"
6322 [(set_attr "op_type" "RS<E>")
6323 (set_attr "atype" "reg")])
6325 (define_insn "*<shift>di3_31_and"
6326 [(set (match_operand:DI 0 "register_operand" "=d")
6327 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
6328 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6329 (match_operand:SI 3 "const_int_operand" "n"))))]
6330 "!TARGET_64BIT && (INTVAL (operands[3]) & 63) == 63"
6332 [(set_attr "op_type" "RS")
6333 (set_attr "atype" "reg")])
6335 (define_insn "*<shift><mode>3_and"
6336 [(set (match_operand:GPR 0 "register_operand" "=d")
6337 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>")
6338 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6339 (match_operand:SI 3 "const_int_operand" "n"))))]
6340 "(INTVAL (operands[3]) & 63) == 63"
6341 "s<lr>l<g>\t%0,<1>%Y2"
6342 [(set_attr "op_type" "RS<E>")
6343 (set_attr "atype" "reg")])
6346 ; ashr(di|si)3 instruction pattern(s).
6349 (define_expand "ashr<mode>3"
6351 [(set (match_operand:DSI 0 "register_operand" "")
6352 (ashiftrt:DSI (match_operand:DSI 1 "register_operand" "")
6353 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))
6354 (clobber (reg:CC CC_REGNUM))])]
6358 (define_insn "*ashrdi3_cc_31"
6359 [(set (reg CC_REGNUM)
6360 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6361 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
6363 (set (match_operand:DI 0 "register_operand" "=d")
6364 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6365 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6367 [(set_attr "op_type" "RS")
6368 (set_attr "atype" "reg")])
6370 (define_insn "*ashrdi3_cconly_31"
6371 [(set (reg CC_REGNUM)
6372 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6373 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
6375 (clobber (match_scratch:DI 0 "=d"))]
6376 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6378 [(set_attr "op_type" "RS")
6379 (set_attr "atype" "reg")])
6381 (define_insn "*ashrdi3_31"
6382 [(set (match_operand:DI 0 "register_operand" "=d")
6383 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6384 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))
6385 (clobber (reg:CC CC_REGNUM))]
6388 [(set_attr "op_type" "RS")
6389 (set_attr "atype" "reg")])
6391 (define_insn "*ashr<mode>3_cc"
6392 [(set (reg CC_REGNUM)
6393 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>")
6394 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
6396 (set (match_operand:GPR 0 "register_operand" "=d")
6397 (ashiftrt:GPR (match_dup 1) (match_dup 2)))]
6398 "s390_match_ccmode(insn, CCSmode)"
6400 [(set_attr "op_type" "RS<E>")
6401 (set_attr "atype" "reg")])
6403 (define_insn "*ashr<mode>3_cconly"
6404 [(set (reg CC_REGNUM)
6405 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>")
6406 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
6408 (clobber (match_scratch:GPR 0 "=d"))]
6409 "s390_match_ccmode(insn, CCSmode)"
6411 [(set_attr "op_type" "RS<E>")
6412 (set_attr "atype" "reg")])
6414 (define_insn "*ashr<mode>3"
6415 [(set (match_operand:GPR 0 "register_operand" "=d")
6416 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>")
6417 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))
6418 (clobber (reg:CC CC_REGNUM))]
6421 [(set_attr "op_type" "RS<E>")
6422 (set_attr "atype" "reg")])
6425 ; shift pattern with implicit ANDs
6427 (define_insn "*ashrdi3_cc_31_and"
6428 [(set (reg CC_REGNUM)
6429 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6430 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6431 (match_operand:SI 3 "const_int_operand" "n")))
6433 (set (match_operand:DI 0 "register_operand" "=d")
6434 (ashiftrt:DI (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
6435 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)
6436 && (INTVAL (operands[3]) & 63) == 63"
6438 [(set_attr "op_type" "RS")
6439 (set_attr "atype" "reg")])
6441 (define_insn "*ashrdi3_cconly_31_and"
6442 [(set (reg CC_REGNUM)
6443 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6444 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6445 (match_operand:SI 3 "const_int_operand" "n")))
6447 (clobber (match_scratch:DI 0 "=d"))]
6448 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)
6449 && (INTVAL (operands[3]) & 63) == 63"
6451 [(set_attr "op_type" "RS")
6452 (set_attr "atype" "reg")])
6454 (define_insn "*ashrdi3_31_and"
6455 [(set (match_operand:DI 0 "register_operand" "=d")
6456 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6457 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6458 (match_operand:SI 3 "const_int_operand" "n"))))
6459 (clobber (reg:CC CC_REGNUM))]
6460 "!TARGET_64BIT && (INTVAL (operands[3]) & 63) == 63"
6462 [(set_attr "op_type" "RS")
6463 (set_attr "atype" "reg")])
6465 (define_insn "*ashr<mode>3_cc_and"
6466 [(set (reg CC_REGNUM)
6467 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>")
6468 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6469 (match_operand:SI 3 "const_int_operand" "n")))
6471 (set (match_operand:GPR 0 "register_operand" "=d")
6472 (ashiftrt:GPR (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
6473 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
6475 [(set_attr "op_type" "RS<E>")
6476 (set_attr "atype" "reg")])
6478 (define_insn "*ashr<mode>3_cconly_and"
6479 [(set (reg CC_REGNUM)
6480 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>")
6481 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6482 (match_operand:SI 3 "const_int_operand" "n")))
6484 (clobber (match_scratch:GPR 0 "=d"))]
6485 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
6487 [(set_attr "op_type" "RS<E>")
6488 (set_attr "atype" "reg")])
6490 (define_insn "*ashr<mode>3_and"
6491 [(set (match_operand:GPR 0 "register_operand" "=d")
6492 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>")
6493 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6494 (match_operand:SI 3 "const_int_operand" "n"))))
6495 (clobber (reg:CC CC_REGNUM))]
6496 "(INTVAL (operands[3]) & 63) == 63"
6498 [(set_attr "op_type" "RS<E>")
6499 (set_attr "atype" "reg")])
6503 ;; Branch instruction patterns.
6506 (define_expand "b<code>"
6508 (if_then_else (COMPARE (match_operand 0 "" "")
6513 "s390_emit_jump (operands[0],
6514 s390_emit_compare (<CODE>, s390_compare_op0, s390_compare_op1)); DONE;")
6518 ;;- Conditional jump instructions.
6521 (define_insn "*cjump_64"
6524 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
6525 (label_ref (match_operand 0 "" ""))
6529 if (get_attr_length (insn) == 4)
6532 return "jg%C1\t%l0";
6534 [(set_attr "op_type" "RI")
6535 (set_attr "type" "branch")
6536 (set (attr "length")
6537 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6538 (const_int 4) (const_int 6)))])
6540 (define_insn "*cjump_31"
6543 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
6544 (label_ref (match_operand 0 "" ""))
6548 gcc_assert (get_attr_length (insn) == 4);
6551 [(set_attr "op_type" "RI")
6552 (set_attr "type" "branch")
6553 (set (attr "length")
6554 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6555 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6556 (const_int 4) (const_int 6))
6557 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6558 (const_int 4) (const_int 8))))])
6560 (define_insn "*cjump_long"
6563 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
6564 (match_operand 0 "address_operand" "U")
6568 if (get_attr_op_type (insn) == OP_TYPE_RR)
6573 [(set (attr "op_type")
6574 (if_then_else (match_operand 0 "register_operand" "")
6575 (const_string "RR") (const_string "RX")))
6576 (set_attr "type" "branch")
6577 (set_attr "atype" "agen")])
6581 ;;- Negated conditional jump instructions.
6584 (define_insn "*icjump_64"
6587 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
6589 (label_ref (match_operand 0 "" ""))))]
6592 if (get_attr_length (insn) == 4)
6595 return "jg%D1\t%l0";
6597 [(set_attr "op_type" "RI")
6598 (set_attr "type" "branch")
6599 (set (attr "length")
6600 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6601 (const_int 4) (const_int 6)))])
6603 (define_insn "*icjump_31"
6606 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
6608 (label_ref (match_operand 0 "" ""))))]
6611 gcc_assert (get_attr_length (insn) == 4);
6614 [(set_attr "op_type" "RI")
6615 (set_attr "type" "branch")
6616 (set (attr "length")
6617 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6618 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6619 (const_int 4) (const_int 6))
6620 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6621 (const_int 4) (const_int 8))))])
6623 (define_insn "*icjump_long"
6626 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
6628 (match_operand 0 "address_operand" "U")))]
6631 if (get_attr_op_type (insn) == OP_TYPE_RR)
6636 [(set (attr "op_type")
6637 (if_then_else (match_operand 0 "register_operand" "")
6638 (const_string "RR") (const_string "RX")))
6639 (set_attr "type" "branch")
6640 (set_attr "atype" "agen")])
6643 ;;- Trap instructions.
6647 [(trap_if (const_int 1) (const_int 0))]
6650 [(set_attr "op_type" "RI")
6651 (set_attr "type" "branch")])
6653 (define_expand "conditional_trap"
6654 [(trap_if (match_operand 0 "comparison_operator" "")
6655 (match_operand 1 "general_operand" ""))]
6658 if (operands[1] != const0_rtx) FAIL;
6659 operands[0] = s390_emit_compare (GET_CODE (operands[0]),
6660 s390_compare_op0, s390_compare_op1);
6663 (define_insn "*trap"
6664 [(trap_if (match_operator 0 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
6668 [(set_attr "op_type" "RI")
6669 (set_attr "type" "branch")])
6672 ;;- Loop instructions.
6674 ;; This is all complicated by the fact that since this is a jump insn
6675 ;; we must handle our own output reloads.
6677 (define_expand "doloop_end"
6678 [(use (match_operand 0 "" "")) ; loop pseudo
6679 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6680 (use (match_operand 2 "" "")) ; max iterations
6681 (use (match_operand 3 "" "")) ; loop level
6682 (use (match_operand 4 "" ""))] ; label
6685 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
6686 emit_jump_insn (gen_doloop_si31 (operands[4], operands[0], operands[0]));
6687 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
6688 emit_jump_insn (gen_doloop_si64 (operands[4], operands[0], operands[0]));
6689 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6690 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6697 (define_insn_and_split "doloop_si64"
6700 (ne (match_operand:SI 1 "register_operand" "d,d")
6702 (label_ref (match_operand 0 "" ""))
6704 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6705 (plus:SI (match_dup 1) (const_int -1)))
6706 (clobber (match_scratch:SI 3 "=X,&1"))
6707 (clobber (reg:CC CC_REGNUM))]
6710 if (which_alternative != 0)
6712 else if (get_attr_length (insn) == 4)
6713 return "brct\t%1,%l0";
6715 return "ahi\t%1,-1\;jgne\t%l0";
6717 "&& reload_completed
6718 && (! REG_P (operands[2])
6719 || ! rtx_equal_p (operands[1], operands[2]))"
6720 [(parallel [(set (reg:CCAN CC_REGNUM)
6721 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6723 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6724 (set (match_dup 2) (match_dup 3))
6725 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
6726 (label_ref (match_dup 0))
6729 [(set_attr "op_type" "RI")
6730 (set_attr "type" "branch")
6731 (set (attr "length")
6732 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6733 (const_int 4) (const_int 10)))])
6735 (define_insn_and_split "doloop_si31"
6738 (ne (match_operand:SI 1 "register_operand" "d,d")
6740 (label_ref (match_operand 0 "" ""))
6742 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6743 (plus:SI (match_dup 1) (const_int -1)))
6744 (clobber (match_scratch:SI 3 "=X,&1"))
6745 (clobber (reg:CC CC_REGNUM))]
6748 if (which_alternative != 0)
6750 else if (get_attr_length (insn) == 4)
6751 return "brct\t%1,%l0";
6755 "&& reload_completed
6756 && (! REG_P (operands[2])
6757 || ! rtx_equal_p (operands[1], operands[2]))"
6758 [(parallel [(set (reg:CCAN CC_REGNUM)
6759 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6761 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6762 (set (match_dup 2) (match_dup 3))
6763 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
6764 (label_ref (match_dup 0))
6767 [(set_attr "op_type" "RI")
6768 (set_attr "type" "branch")
6769 (set (attr "length")
6770 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6771 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6772 (const_int 4) (const_int 6))
6773 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6774 (const_int 4) (const_int 8))))])
6776 (define_insn "*doloop_si_long"
6779 (ne (match_operand:SI 1 "register_operand" "d,d")
6781 (match_operand 0 "address_operand" "U,U")
6783 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6784 (plus:SI (match_dup 1) (const_int -1)))
6785 (clobber (match_scratch:SI 3 "=X,&1"))
6786 (clobber (reg:CC CC_REGNUM))]
6789 if (get_attr_op_type (insn) == OP_TYPE_RR)
6790 return "bctr\t%1,%0";
6792 return "bct\t%1,%a0";
6794 [(set (attr "op_type")
6795 (if_then_else (match_operand 0 "register_operand" "")
6796 (const_string "RR") (const_string "RX")))
6797 (set_attr "type" "branch")
6798 (set_attr "atype" "agen")])
6800 (define_insn_and_split "doloop_di"
6803 (ne (match_operand:DI 1 "register_operand" "d,d")
6805 (label_ref (match_operand 0 "" ""))
6807 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?*m*d")
6808 (plus:DI (match_dup 1) (const_int -1)))
6809 (clobber (match_scratch:DI 3 "=X,&1"))
6810 (clobber (reg:CC CC_REGNUM))]
6813 if (which_alternative != 0)
6815 else if (get_attr_length (insn) == 4)
6816 return "brctg\t%1,%l0";
6818 return "aghi\t%1,-1\;jgne\t%l0";
6820 "&& reload_completed
6821 && (! REG_P (operands[2])
6822 || ! rtx_equal_p (operands[1], operands[2]))"
6823 [(parallel [(set (reg:CCAN CC_REGNUM)
6824 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6826 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6827 (set (match_dup 2) (match_dup 3))
6828 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
6829 (label_ref (match_dup 0))
6832 [(set_attr "op_type" "RI")
6833 (set_attr "type" "branch")
6834 (set (attr "length")
6835 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6836 (const_int 4) (const_int 10)))])
6839 ;;- Unconditional jump instructions.
6843 ; jump instruction pattern(s).
6846 (define_expand "jump"
6847 [(match_operand 0 "" "")]
6849 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
6851 (define_insn "*jump64"
6852 [(set (pc) (label_ref (match_operand 0 "" "")))]
6855 if (get_attr_length (insn) == 4)
6860 [(set_attr "op_type" "RI")
6861 (set_attr "type" "branch")
6862 (set (attr "length")
6863 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6864 (const_int 4) (const_int 6)))])
6866 (define_insn "*jump31"
6867 [(set (pc) (label_ref (match_operand 0 "" "")))]
6870 gcc_assert (get_attr_length (insn) == 4);
6873 [(set_attr "op_type" "RI")
6874 (set_attr "type" "branch")
6875 (set (attr "length")
6876 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6877 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6878 (const_int 4) (const_int 6))
6879 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6880 (const_int 4) (const_int 8))))])
6883 ; indirect-jump instruction pattern(s).
6886 (define_insn "indirect_jump"
6887 [(set (pc) (match_operand 0 "address_operand" "U"))]
6890 if (get_attr_op_type (insn) == OP_TYPE_RR)
6895 [(set (attr "op_type")
6896 (if_then_else (match_operand 0 "register_operand" "")
6897 (const_string "RR") (const_string "RX")))
6898 (set_attr "type" "branch")
6899 (set_attr "atype" "agen")])
6902 ; casesi instruction pattern(s).
6905 (define_insn "casesi_jump"
6906 [(set (pc) (match_operand 0 "address_operand" "U"))
6907 (use (label_ref (match_operand 1 "" "")))]
6910 if (get_attr_op_type (insn) == OP_TYPE_RR)
6915 [(set (attr "op_type")
6916 (if_then_else (match_operand 0 "register_operand" "")
6917 (const_string "RR") (const_string "RX")))
6918 (set_attr "type" "branch")
6919 (set_attr "atype" "agen")])
6921 (define_expand "casesi"
6922 [(match_operand:SI 0 "general_operand" "")
6923 (match_operand:SI 1 "general_operand" "")
6924 (match_operand:SI 2 "general_operand" "")
6925 (label_ref (match_operand 3 "" ""))
6926 (label_ref (match_operand 4 "" ""))]
6929 rtx index = gen_reg_rtx (SImode);
6930 rtx base = gen_reg_rtx (Pmode);
6931 rtx target = gen_reg_rtx (Pmode);
6933 emit_move_insn (index, operands[0]);
6934 emit_insn (gen_subsi3 (index, index, operands[1]));
6935 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6938 if (Pmode != SImode)
6939 index = convert_to_mode (Pmode, index, 1);
6940 if (GET_CODE (index) != REG)
6941 index = copy_to_mode_reg (Pmode, index);
6944 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6946 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
6948 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6950 index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
6951 emit_move_insn (target, index);
6954 target = gen_rtx_PLUS (Pmode, base, target);
6955 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6962 ;;- Jump to subroutine.
6967 ; untyped call instruction pattern(s).
6970 ;; Call subroutine returning any type.
6971 (define_expand "untyped_call"
6972 [(parallel [(call (match_operand 0 "" "")
6974 (match_operand 1 "" "")
6975 (match_operand 2 "" "")])]
6980 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6982 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6984 rtx set = XVECEXP (operands[2], 0, i);
6985 emit_move_insn (SET_DEST (set), SET_SRC (set));
6988 /* The optimizer does not know that the call sets the function value
6989 registers we stored in the result block. We avoid problems by
6990 claiming that all hard registers are used and clobbered at this
6992 emit_insn (gen_blockage ());
6997 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6998 ;; all of memory. This blocks insns from being moved across this point.
7000 (define_insn "blockage"
7001 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
7004 [(set_attr "type" "none")
7005 (set_attr "length" "0")])
7011 (define_expand "sibcall"
7012 [(call (match_operand 0 "" "")
7013 (match_operand 1 "" ""))]
7016 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
7020 (define_insn "*sibcall_br"
7021 [(call (mem:QI (reg SIBCALL_REGNUM))
7022 (match_operand 0 "const_int_operand" "n"))]
7023 "SIBLING_CALL_P (insn)
7024 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
7026 [(set_attr "op_type" "RR")
7027 (set_attr "type" "branch")
7028 (set_attr "atype" "agen")])
7030 (define_insn "*sibcall_brc"
7031 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7032 (match_operand 1 "const_int_operand" "n"))]
7033 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7035 [(set_attr "op_type" "RI")
7036 (set_attr "type" "branch")])
7038 (define_insn "*sibcall_brcl"
7039 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7040 (match_operand 1 "const_int_operand" "n"))]
7041 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7043 [(set_attr "op_type" "RIL")
7044 (set_attr "type" "branch")])
7047 ; sibcall_value patterns
7050 (define_expand "sibcall_value"
7051 [(set (match_operand 0 "" "")
7052 (call (match_operand 1 "" "")
7053 (match_operand 2 "" "")))]
7056 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
7060 (define_insn "*sibcall_value_br"
7061 [(set (match_operand 0 "" "")
7062 (call (mem:QI (reg SIBCALL_REGNUM))
7063 (match_operand 1 "const_int_operand" "n")))]
7064 "SIBLING_CALL_P (insn)
7065 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
7067 [(set_attr "op_type" "RR")
7068 (set_attr "type" "branch")
7069 (set_attr "atype" "agen")])
7071 (define_insn "*sibcall_value_brc"
7072 [(set (match_operand 0 "" "")
7073 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7074 (match_operand 2 "const_int_operand" "n")))]
7075 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7077 [(set_attr "op_type" "RI")
7078 (set_attr "type" "branch")])
7080 (define_insn "*sibcall_value_brcl"
7081 [(set (match_operand 0 "" "")
7082 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7083 (match_operand 2 "const_int_operand" "n")))]
7084 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7086 [(set_attr "op_type" "RIL")
7087 (set_attr "type" "branch")])
7091 ; call instruction pattern(s).
7094 (define_expand "call"
7095 [(call (match_operand 0 "" "")
7096 (match_operand 1 "" ""))
7097 (use (match_operand 2 "" ""))]
7100 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
7101 gen_rtx_REG (Pmode, RETURN_REGNUM));
7105 (define_insn "*bras"
7106 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7107 (match_operand 1 "const_int_operand" "n"))
7108 (clobber (match_operand 2 "register_operand" "=r"))]
7109 "!SIBLING_CALL_P (insn)
7110 && TARGET_SMALL_EXEC
7111 && GET_MODE (operands[2]) == Pmode"
7113 [(set_attr "op_type" "RI")
7114 (set_attr "type" "jsr")])
7116 (define_insn "*brasl"
7117 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7118 (match_operand 1 "const_int_operand" "n"))
7119 (clobber (match_operand 2 "register_operand" "=r"))]
7120 "!SIBLING_CALL_P (insn)
7122 && GET_MODE (operands[2]) == Pmode"
7124 [(set_attr "op_type" "RIL")
7125 (set_attr "type" "jsr")])
7127 (define_insn "*basr"
7128 [(call (mem:QI (match_operand 0 "address_operand" "U"))
7129 (match_operand 1 "const_int_operand" "n"))
7130 (clobber (match_operand 2 "register_operand" "=r"))]
7131 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
7133 if (get_attr_op_type (insn) == OP_TYPE_RR)
7134 return "basr\t%2,%0";
7136 return "bas\t%2,%a0";
7138 [(set (attr "op_type")
7139 (if_then_else (match_operand 0 "register_operand" "")
7140 (const_string "RR") (const_string "RX")))
7141 (set_attr "type" "jsr")
7142 (set_attr "atype" "agen")])
7145 ; call_value instruction pattern(s).
7148 (define_expand "call_value"
7149 [(set (match_operand 0 "" "")
7150 (call (match_operand 1 "" "")
7151 (match_operand 2 "" "")))
7152 (use (match_operand 3 "" ""))]
7155 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
7156 gen_rtx_REG (Pmode, RETURN_REGNUM));
7160 (define_insn "*bras_r"
7161 [(set (match_operand 0 "" "")
7162 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7163 (match_operand:SI 2 "const_int_operand" "n")))
7164 (clobber (match_operand 3 "register_operand" "=r"))]
7165 "!SIBLING_CALL_P (insn)
7166 && TARGET_SMALL_EXEC
7167 && GET_MODE (operands[3]) == Pmode"
7169 [(set_attr "op_type" "RI")
7170 (set_attr "type" "jsr")])
7172 (define_insn "*brasl_r"
7173 [(set (match_operand 0 "" "")
7174 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7175 (match_operand 2 "const_int_operand" "n")))
7176 (clobber (match_operand 3 "register_operand" "=r"))]
7177 "!SIBLING_CALL_P (insn)
7179 && GET_MODE (operands[3]) == Pmode"
7181 [(set_attr "op_type" "RIL")
7182 (set_attr "type" "jsr")])
7184 (define_insn "*basr_r"
7185 [(set (match_operand 0 "" "")
7186 (call (mem:QI (match_operand 1 "address_operand" "U"))
7187 (match_operand 2 "const_int_operand" "n")))
7188 (clobber (match_operand 3 "register_operand" "=r"))]
7189 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7191 if (get_attr_op_type (insn) == OP_TYPE_RR)
7192 return "basr\t%3,%1";
7194 return "bas\t%3,%a1";
7196 [(set (attr "op_type")
7197 (if_then_else (match_operand 1 "register_operand" "")
7198 (const_string "RR") (const_string "RX")))
7199 (set_attr "type" "jsr")
7200 (set_attr "atype" "agen")])
7203 ;;- Thread-local storage support.
7206 (define_expand "get_tp_64"
7207 [(set (match_operand:DI 0 "nonimmediate_operand" "") (reg:DI TP_REGNUM))]
7211 (define_expand "get_tp_31"
7212 [(set (match_operand:SI 0 "nonimmediate_operand" "") (reg:SI TP_REGNUM))]
7216 (define_expand "set_tp_64"
7217 [(set (reg:DI TP_REGNUM) (match_operand:DI 0 "nonimmediate_operand" ""))
7218 (set (reg:DI TP_REGNUM) (unspec_volatile:DI [(reg:DI TP_REGNUM)] UNSPECV_SET_TP))]
7222 (define_expand "set_tp_31"
7223 [(set (reg:SI TP_REGNUM) (match_operand:SI 0 "nonimmediate_operand" ""))
7224 (set (reg:SI TP_REGNUM) (unspec_volatile:SI [(reg:SI TP_REGNUM)] UNSPECV_SET_TP))]
7228 (define_insn "*set_tp"
7229 [(set (reg TP_REGNUM) (unspec_volatile [(reg TP_REGNUM)] UNSPECV_SET_TP))]
7232 [(set_attr "type" "none")
7233 (set_attr "length" "0")])
7235 (define_insn "*tls_load_64"
7236 [(set (match_operand:DI 0 "register_operand" "=d")
7237 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7238 (match_operand:DI 2 "" "")]
7242 [(set_attr "op_type" "RXE")])
7244 (define_insn "*tls_load_31"
7245 [(set (match_operand:SI 0 "register_operand" "=d,d")
7246 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7247 (match_operand:SI 2 "" "")]
7253 [(set_attr "op_type" "RX,RXY")])
7255 (define_insn "*bras_tls"
7256 [(set (match_operand 0 "" "")
7257 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7258 (match_operand 2 "const_int_operand" "n")))
7259 (clobber (match_operand 3 "register_operand" "=r"))
7260 (use (match_operand 4 "" ""))]
7261 "!SIBLING_CALL_P (insn)
7262 && TARGET_SMALL_EXEC
7263 && GET_MODE (operands[3]) == Pmode"
7265 [(set_attr "op_type" "RI")
7266 (set_attr "type" "jsr")])
7268 (define_insn "*brasl_tls"
7269 [(set (match_operand 0 "" "")
7270 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7271 (match_operand 2 "const_int_operand" "n")))
7272 (clobber (match_operand 3 "register_operand" "=r"))
7273 (use (match_operand 4 "" ""))]
7274 "!SIBLING_CALL_P (insn)
7276 && GET_MODE (operands[3]) == Pmode"
7278 [(set_attr "op_type" "RIL")
7279 (set_attr "type" "jsr")])
7281 (define_insn "*basr_tls"
7282 [(set (match_operand 0 "" "")
7283 (call (mem:QI (match_operand 1 "address_operand" "U"))
7284 (match_operand 2 "const_int_operand" "n")))
7285 (clobber (match_operand 3 "register_operand" "=r"))
7286 (use (match_operand 4 "" ""))]
7287 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7289 if (get_attr_op_type (insn) == OP_TYPE_RR)
7290 return "basr\t%3,%1%J4";
7292 return "bas\t%3,%a1%J4";
7294 [(set (attr "op_type")
7295 (if_then_else (match_operand 1 "register_operand" "")
7296 (const_string "RR") (const_string "RX")))
7297 (set_attr "type" "jsr")
7298 (set_attr "atype" "agen")])
7301 ;;- Atomic operations
7305 ; memory barrier pattern.
7308 (define_expand "memory_barrier"
7309 [(set (mem:BLK (match_dup 0))
7310 (unspec_volatile:BLK [(mem:BLK (match_dup 0))] UNSPECV_MB))]
7313 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (DImode));
7314 MEM_VOLATILE_P (operands[0]) = 1;
7317 (define_insn "*memory_barrier"
7318 [(set (match_operand:BLK 0 "" "")
7319 (unspec_volatile:BLK [(match_operand:BLK 1 "" "")] UNSPECV_MB))]
7322 [(set_attr "op_type" "RR")])
7325 ; compare and swap patterns.
7328 (define_expand "sync_compare_and_swap<mode>"
7330 [(set (match_operand:TDSI 0 "register_operand" "")
7331 (match_operand:TDSI 1 "memory_operand" ""))
7333 (unspec_volatile:TDSI
7335 (match_operand:TDSI 2 "register_operand" "")
7336 (match_operand:TDSI 3 "register_operand" "")]
7338 (set (reg:CCZ1 CC_REGNUM)
7339 (compare:CCZ1 (match_dup 1) (match_dup 2)))])]
7342 (define_expand "sync_compare_and_swap<mode>"
7344 [(set (match_operand:HQI 0 "register_operand" "")
7345 (match_operand:HQI 1 "memory_operand" ""))
7347 (unspec_volatile:HQI
7349 (match_operand:HQI 2 "general_operand" "")
7350 (match_operand:HQI 3 "general_operand" "")]
7352 (set (reg:CCZ1 CC_REGNUM)
7353 (compare:CCZ1 (match_dup 1) (match_dup 2)))])]
7355 "s390_expand_cs_hqi (<MODE>mode, operands[0], operands[1],
7356 operands[2], operands[3]); DONE;")
7358 (define_expand "sync_compare_and_swap_cc<mode>"
7360 [(set (match_operand:TDSI 0 "register_operand" "")
7361 (match_operand:TDSI 1 "memory_operand" ""))
7363 (unspec_volatile:TDSI
7365 (match_operand:TDSI 2 "register_operand" "")
7366 (match_operand:TDSI 3 "register_operand" "")]
7369 (compare:CCZ1 (match_dup 1) (match_dup 2)))])]
7372 /* Emulate compare. */
7373 operands[4] = gen_rtx_REG (CCZ1mode, CC_REGNUM);
7374 s390_compare_op0 = operands[1];
7375 s390_compare_op1 = operands[2];
7376 s390_compare_emitted = operands[4];
7379 (define_insn "*sync_compare_and_swap<mode>"
7380 [(set (match_operand:DP 0 "register_operand" "=r")
7381 (match_operand:DP 1 "memory_operand" "+Q"))
7385 (match_operand:DP 2 "register_operand" "0")
7386 (match_operand:DP 3 "register_operand" "r")]
7388 (set (reg:CCZ1 CC_REGNUM)
7389 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
7391 "cds<tg>\t%0,%3,%S1"
7392 [(set_attr "op_type" "RS<TE>")
7393 (set_attr "type" "sem")])
7395 (define_insn "*sync_compare_and_swap<mode>"
7396 [(set (match_operand:GPR 0 "register_operand" "=r")
7397 (match_operand:GPR 1 "memory_operand" "+Q"))
7399 (unspec_volatile:GPR
7401 (match_operand:GPR 2 "register_operand" "0")
7402 (match_operand:GPR 3 "register_operand" "r")]
7404 (set (reg:CCZ1 CC_REGNUM)
7405 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
7408 [(set_attr "op_type" "RS<E>")
7409 (set_attr "type" "sem")])
7413 ; Other atomic instruction patterns.
7416 (define_expand "sync_lock_test_and_set<mode>"
7417 [(match_operand:HQI 0 "register_operand")
7418 (match_operand:HQI 1 "memory_operand")
7419 (match_operand:HQI 2 "general_operand")]
7421 "s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1],
7422 operands[2], false); DONE;")
7424 (define_expand "sync_<atomic><mode>"
7425 [(set (match_operand:HQI 0 "memory_operand")
7426 (ATOMIC:HQI (match_dup 0)
7427 (match_operand:HQI 1 "general_operand")))]
7429 "s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0],
7430 operands[1], false); DONE;")
7432 (define_expand "sync_old_<atomic><mode>"
7433 [(set (match_operand:HQI 0 "register_operand")
7434 (match_operand:HQI 1 "memory_operand"))
7436 (ATOMIC:HQI (match_dup 1)
7437 (match_operand:HQI 2 "general_operand")))]
7439 "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
7440 operands[2], false); DONE;")
7442 (define_expand "sync_new_<atomic><mode>"
7443 [(set (match_operand:HQI 0 "register_operand")
7444 (ATOMIC:HQI (match_operand:HQI 1 "memory_operand")
7445 (match_operand:HQI 2 "general_operand")))
7446 (set (match_dup 1) (ATOMIC:HQI (match_dup 1) (match_dup 2)))]
7448 "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
7449 operands[2], true); DONE;")
7452 ;;- Miscellaneous instructions.
7456 ; allocate stack instruction pattern(s).
7459 (define_expand "allocate_stack"
7460 [(match_operand 0 "general_operand" "")
7461 (match_operand 1 "general_operand" "")]
7464 rtx temp = gen_reg_rtx (Pmode);
7466 emit_move_insn (temp, s390_back_chain_rtx ());
7467 anti_adjust_stack (operands[1]);
7468 emit_move_insn (s390_back_chain_rtx (), temp);
7470 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7476 ; setjmp instruction pattern.
7479 (define_expand "builtin_setjmp_receiver"
7480 [(match_operand 0 "" "")]
7483 emit_insn (s390_load_got ());
7484 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7488 ;; These patterns say how to save and restore the stack pointer. We need not
7489 ;; save the stack pointer at function level since we are careful to
7490 ;; preserve the backchain. At block level, we have to restore the backchain
7491 ;; when we restore the stack pointer.
7493 ;; For nonlocal gotos, we must save both the stack pointer and its
7494 ;; backchain and restore both. Note that in the nonlocal case, the
7495 ;; save area is a memory location.
7497 (define_expand "save_stack_function"
7498 [(match_operand 0 "general_operand" "")
7499 (match_operand 1 "general_operand" "")]
7503 (define_expand "restore_stack_function"
7504 [(match_operand 0 "general_operand" "")
7505 (match_operand 1 "general_operand" "")]
7509 (define_expand "restore_stack_block"
7510 [(match_operand 0 "register_operand" "")
7511 (match_operand 1 "register_operand" "")]
7514 rtx temp = gen_reg_rtx (Pmode);
7516 emit_move_insn (temp, s390_back_chain_rtx ());
7517 emit_move_insn (operands[0], operands[1]);
7518 emit_move_insn (s390_back_chain_rtx (), temp);
7523 (define_expand "save_stack_nonlocal"
7524 [(match_operand 0 "memory_operand" "")
7525 (match_operand 1 "register_operand" "")]
7528 enum machine_mode mode = TARGET_64BIT ? OImode : TImode;
7529 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
7531 /* Copy the backchain to the first word, sp to the second and the
7532 literal pool base to the third. */
7534 if (TARGET_BACKCHAIN)
7536 rtx temp = force_reg (Pmode, s390_back_chain_rtx ());
7537 emit_move_insn (operand_subword (operands[0], 0, 0, mode), temp);
7540 emit_move_insn (operand_subword (operands[0], 1, 0, mode), operands[1]);
7541 emit_move_insn (operand_subword (operands[0], 2, 0, mode), base);
7546 (define_expand "restore_stack_nonlocal"
7547 [(match_operand 0 "register_operand" "")
7548 (match_operand 1 "memory_operand" "")]
7551 enum machine_mode mode = TARGET_64BIT ? OImode : TImode;
7552 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
7553 rtx temp = NULL_RTX;
7555 /* Restore the backchain from the first word, sp from the second and the
7556 literal pool base from the third. */
7558 if (TARGET_BACKCHAIN)
7559 temp = force_reg (Pmode, operand_subword (operands[1], 0, 0, mode));
7561 emit_move_insn (base, operand_subword (operands[1], 2, 0, mode));
7562 emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, mode));
7565 emit_move_insn (s390_back_chain_rtx (), temp);
7567 emit_insn (gen_rtx_USE (VOIDmode, base));
7571 (define_expand "exception_receiver"
7575 s390_set_has_landing_pad_p (true);
7580 ; nop instruction pattern(s).
7587 [(set_attr "op_type" "RR")])
7591 ; Special literal pool access instruction pattern(s).
7594 (define_insn "*pool_entry"
7595 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7596 UNSPECV_POOL_ENTRY)]
7599 enum machine_mode mode = GET_MODE (PATTERN (insn));
7600 unsigned int align = GET_MODE_BITSIZE (mode);
7601 s390_output_pool_entry (operands[0], mode, align);
7604 [(set (attr "length")
7605 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7607 (define_insn "pool_align"
7608 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")]
7609 UNSPECV_POOL_ALIGN)]
7612 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7614 (define_insn "pool_section_start"
7615 [(unspec_volatile [(const_int 1)] UNSPECV_POOL_SECTION)]
7618 [(set_attr "length" "0")])
7620 (define_insn "pool_section_end"
7621 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_SECTION)]
7624 [(set_attr "length" "0")])
7626 (define_insn "main_base_31_small"
7627 [(set (match_operand 0 "register_operand" "=a")
7628 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7629 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7631 [(set_attr "op_type" "RR")
7632 (set_attr "type" "la")])
7634 (define_insn "main_base_31_large"
7635 [(set (match_operand 0 "register_operand" "=a")
7636 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7637 (set (pc) (label_ref (match_operand 2 "" "")))]
7638 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7640 [(set_attr "op_type" "RI")])
7642 (define_insn "main_base_64"
7643 [(set (match_operand 0 "register_operand" "=a")
7644 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7645 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7647 [(set_attr "op_type" "RIL")
7648 (set_attr "type" "larl")])
7650 (define_insn "main_pool"
7651 [(set (match_operand 0 "register_operand" "=a")
7652 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
7653 "GET_MODE (operands[0]) == Pmode"
7658 (if_then_else (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
7659 (const_string "larl") (const_string "la")))])
7661 (define_insn "reload_base_31"
7662 [(set (match_operand 0 "register_operand" "=a")
7663 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7664 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7665 "basr\t%0,0\;la\t%0,%1-.(%0)"
7666 [(set_attr "length" "6")
7667 (set_attr "type" "la")])
7669 (define_insn "reload_base_64"
7670 [(set (match_operand 0 "register_operand" "=a")
7671 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7672 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7674 [(set_attr "op_type" "RIL")
7675 (set_attr "type" "larl")])
7678 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7683 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7686 ;; Insns related to generating the function prologue and epilogue.
7690 (define_expand "prologue"
7691 [(use (const_int 0))]
7693 "s390_emit_prologue (); DONE;")
7695 (define_expand "epilogue"
7696 [(use (const_int 1))]
7698 "s390_emit_epilogue (false); DONE;")
7700 (define_expand "sibcall_epilogue"
7701 [(use (const_int 0))]
7703 "s390_emit_epilogue (true); DONE;")
7705 (define_insn "*return"
7707 (use (match_operand 0 "register_operand" "a"))]
7708 "GET_MODE (operands[0]) == Pmode"
7710 [(set_attr "op_type" "RR")
7711 (set_attr "type" "jsr")
7712 (set_attr "atype" "agen")])
7715 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7716 ;; pointer. This is used for compatibility.
7718 (define_expand "ptr_extend"
7719 [(set (match_operand:DI 0 "register_operand" "=r")
7720 (match_operand:SI 1 "register_operand" "r"))]
7723 emit_insn (gen_anddi3 (operands[0],
7724 gen_lowpart (DImode, operands[1]),
7725 GEN_INT (0x7fffffff)));
7729 ;; Instruction definition to expand eh_return macro to support
7730 ;; swapping in special linkage return addresses.
7732 (define_expand "eh_return"
7733 [(use (match_operand 0 "register_operand" ""))]
7736 s390_emit_tpf_eh_return (operands[0]);
7741 ; Stack Protector Patterns
7744 (define_expand "stack_protect_set"
7745 [(set (match_operand 0 "memory_operand" "")
7746 (match_operand 1 "memory_operand" ""))]
7749 #ifdef TARGET_THREAD_SSP_OFFSET
7751 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
7752 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
7755 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
7757 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
7762 (define_insn "stack_protect_set<mode>"
7763 [(set (match_operand:DSI 0 "memory_operand" "=Q")
7764 (unspec:DSI [(match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_SET))]
7766 "mvc\t%O0(%G0,%R0),%S1"
7767 [(set_attr "op_type" "SS")])
7769 (define_expand "stack_protect_test"
7770 [(set (reg:CC CC_REGNUM)
7771 (compare (match_operand 0 "memory_operand" "")
7772 (match_operand 1 "memory_operand" "")))
7773 (match_operand 2 "" "")]
7776 #ifdef TARGET_THREAD_SSP_OFFSET
7778 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
7779 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
7781 s390_compare_op0 = operands[0];
7782 s390_compare_op1 = operands[1];
7783 s390_compare_emitted = gen_rtx_REG (CCZmode, CC_REGNUM);
7786 emit_insn (gen_stack_protect_testdi (operands[0], operands[1]));
7788 emit_insn (gen_stack_protect_testsi (operands[0], operands[1]));
7790 emit_jump_insn (gen_beq (operands[2]));
7795 (define_insn "stack_protect_test<mode>"
7796 [(set (reg:CCZ CC_REGNUM)
7797 (unspec:CCZ [(match_operand:DSI 0 "memory_operand" "Q")
7798 (match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_TEST))]
7800 "clc\t%O0(%G0,%R0),%S1"
7801 [(set_attr "op_type" "SS")])