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 .. -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 (cond [(eq_attr "op_type" "E") (const_string "reg")
217 (eq_attr "op_type" "RR") (const_string "reg")
218 (eq_attr "op_type" "RX") (const_string "agen")
219 (eq_attr "op_type" "RI") (const_string "reg")
220 (eq_attr "op_type" "RRE") (const_string "reg")
221 (eq_attr "op_type" "RS") (const_string "agen")
222 (eq_attr "op_type" "RSI") (const_string "agen")
223 (eq_attr "op_type" "S") (const_string "agen")
224 (eq_attr "op_type" "SI") (const_string "agen")
225 (eq_attr "op_type" "SS") (const_string "agen")
226 (eq_attr "op_type" "SSE") (const_string "agen")
227 (eq_attr "op_type" "RXE") (const_string "agen")
228 (eq_attr "op_type" "RSE") (const_string "agen")
229 (eq_attr "op_type" "RIL") (const_string "agen")
230 (eq_attr "op_type" "RXY") (const_string "agen")
231 (eq_attr "op_type" "RSY") (const_string "agen")
232 (eq_attr "op_type" "SIY") (const_string "agen")]
233 (const_string "agen")))
237 (define_attr "length" ""
238 (cond [(eq_attr "op_type" "E") (const_int 2)
239 (eq_attr "op_type" "RR") (const_int 2)
240 (eq_attr "op_type" "RX") (const_int 4)
241 (eq_attr "op_type" "RI") (const_int 4)
242 (eq_attr "op_type" "RRE") (const_int 4)
243 (eq_attr "op_type" "RS") (const_int 4)
244 (eq_attr "op_type" "RSI") (const_int 4)
245 (eq_attr "op_type" "S") (const_int 4)
246 (eq_attr "op_type" "SI") (const_int 4)
247 (eq_attr "op_type" "SS") (const_int 6)
248 (eq_attr "op_type" "SSE") (const_int 6)
249 (eq_attr "op_type" "RXE") (const_int 6)
250 (eq_attr "op_type" "RSE") (const_int 6)
251 (eq_attr "op_type" "RIL") (const_int 6)
252 (eq_attr "op_type" "RXY") (const_int 6)
253 (eq_attr "op_type" "RSY") (const_int 6)
254 (eq_attr "op_type" "SIY") (const_int 6)]
258 ;; Processor type. This attribute must exactly match the processor_type
259 ;; enumeration in s390.h. The current machine description does not
260 ;; distinguish between g5 and g6, but there are differences between the two
261 ;; CPUs could in theory be modeled.
263 (define_attr "cpu" "g5,g6,z900,z990,z9_109"
264 (const (symbol_ref "s390_tune")))
266 ;; Pipeline description for z900. For lack of anything better,
267 ;; this description is also used for the g5 and g6.
270 ;; Pipeline description for z990.
274 (include "predicates.md")
281 ;; This mode macro allows floating point patterns to be generated from the
283 (define_mode_macro FPR [TF DF SF])
284 (define_mode_macro DSF [DF SF])
286 ;; These mode macros allow 31-bit and 64-bit TDSI patterns to be generated
287 ;; from the same template.
288 (define_mode_macro TDSI [(TI "TARGET_64BIT") DI SI])
290 ;; These mode macros allow 31-bit and 64-bit GPR patterns to be generated
291 ;; from the same template.
292 (define_mode_macro GPR [(DI "TARGET_64BIT") SI])
293 (define_mode_macro DSI [DI SI])
295 ;; This mode macro allows :P to be used for patterns that operate on
296 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
297 (define_mode_macro DP [(TI "TARGET_64BIT") (DI "!TARGET_64BIT")])
298 (define_mode_macro P [(DI "TARGET_64BIT") (SI "!TARGET_64BIT")])
300 ;; This mode macro allows the QI and HI patterns to be defined from
301 ;; the same template.
302 (define_mode_macro HQI [HI QI])
304 ;; This mode macro allows the integer patterns to be defined from the
306 (define_mode_macro INT [(DI "TARGET_64BIT") SI HI QI])
308 ;; This macro allows to unify all 'bCOND' expander patterns.
309 (define_code_macro COMPARE [eq ne gt gtu lt ltu ge geu le leu unordered
310 ordered uneq unlt ungt unle unge ltgt])
312 ;; This macro allows to unify all 'sCOND' patterns.
313 (define_code_macro SCOND [ltu gtu leu geu])
315 ;; This macro allows some 'ashift' and 'lshiftrt' pattern to be defined from
316 ;; the same template.
317 (define_code_macro SHIFT [ashift lshiftrt])
319 ;; These macros allow to combine most atomic operations.
320 (define_code_macro ATOMIC [and ior xor plus minus mult])
321 (define_code_attr atomic [(and "and") (ior "ior") (xor "xor")
322 (plus "add") (minus "sub") (mult "nand")])
325 ;; In FPR templates, a string like "lt<de>br" will expand to "ltxbr" in TFmode,
326 ;; "ltdbr" in DFmode, and "ltebr" in SFmode.
327 (define_mode_attr xde [(TF "x") (DF "d") (SF "e")])
329 ;; In FPR templates, a string like "m<dee>br" will expand to "mxbr" in TFmode,
330 ;; "mdbr" in DFmode, and "meebr" in SFmode.
331 (define_mode_attr xdee [(TF "x") (DF "d") (SF "ee")])
333 ;; In FPR templates, "<RRe>" will expand to "RRE" in TFmode and "RR" otherwise.
334 ;; Likewise for "<RXe>".
335 (define_mode_attr RRe [(TF "RRE") (DF "RR") (SF "RR")])
336 (define_mode_attr RXe [(TF "RXE") (DF "RX") (SF "RX")])
338 ;; In FPR templates, "<Rf>" will expand to "f" in TFmode and "R" otherwise.
339 ;; This is used to disable the memory alternative in TFmode patterns.
340 (define_mode_attr Rf [(TF "f") (DF "R") (SF "R")])
342 ;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in
343 ;; 'ashift' and "srdl" in 'lshiftrt'.
344 (define_code_attr lr [(ashift "l") (lshiftrt "r")])
346 ;; In SHIFT templates, this attribute holds the correct standard name for the
347 ;; pattern itself and the corresponding function calls.
348 (define_code_attr shift [(ashift "ashl") (lshiftrt "lshr")])
350 ;; This attribute handles differences in the instruction 'type' and will result
351 ;; in "RRE" for DImode and "RR" for SImode.
352 (define_mode_attr E [(DI "E") (SI "")])
354 ;; This attribute handles differences in the instruction 'type' and will result
355 ;; in "RSE" for TImode and "RS" for DImode.
356 (define_mode_attr TE [(TI "E") (DI "")])
358 ;; In GPR templates, a string like "lc<g>r" will expand to "lcgr" in DImode
359 ;; and "lcr" in SImode.
360 (define_mode_attr g [(DI "g") (SI "")])
362 ;; In DP templates, a string like "cds<g>" will expand to "cdsg" in TImode
363 ;; and "cds" in DImode.
364 (define_mode_attr tg [(TI "g") (DI "")])
366 ;; In GPR templates, a string like "c<gf>dbr" will expand to "cgdbr" in DImode
367 ;; and "cfdbr" in SImode.
368 (define_mode_attr gf [(DI "g") (SI "f")])
370 ;; ICM mask required to load MODE value into the lowest subreg
371 ;; of a SImode register.
372 (define_mode_attr icm_lo [(HI "3") (QI "1")])
374 ;; In HQI templates, a string like "llg<hc>" will expand to "llgh" in
375 ;; HImode and "llgc" in QImode.
376 (define_mode_attr hc [(HI "h") (QI "c")])
378 ;; In P templates, the mode <DBL> will expand to "TI" in DImode and "DI"
380 (define_mode_attr DBL [(DI "TI") (SI "DI")])
382 ;; Maximum unsigned integer that fits in MODE.
383 (define_mode_attr max_uint [(HI "65535") (QI "255")])
387 ;;- Compare instructions.
390 (define_expand "cmp<mode>"
391 [(set (reg:CC CC_REGNUM)
392 (compare:CC (match_operand:GPR 0 "register_operand" "")
393 (match_operand:GPR 1 "general_operand" "")))]
396 s390_compare_op0 = operands[0];
397 s390_compare_op1 = operands[1];
401 (define_expand "cmp<mode>"
402 [(set (reg:CC CC_REGNUM)
403 (compare:CC (match_operand:FPR 0 "register_operand" "")
404 (match_operand:FPR 1 "general_operand" "")))]
407 s390_compare_op0 = operands[0];
408 s390_compare_op1 = operands[1];
413 ; Test-under-Mask instructions
415 (define_insn "*tmqi_mem"
416 [(set (reg CC_REGNUM)
417 (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S")
418 (match_operand:QI 1 "immediate_operand" "n,n"))
419 (match_operand:QI 2 "immediate_operand" "n,n")))]
420 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], false))"
424 [(set_attr "op_type" "SI,SIY")])
426 (define_insn "*tmdi_reg"
427 [(set (reg CC_REGNUM)
428 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
429 (match_operand:DI 1 "immediate_operand"
430 "N0HD0,N1HD0,N2HD0,N3HD0"))
431 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
433 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
434 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
440 [(set_attr "op_type" "RI")])
442 (define_insn "*tmsi_reg"
443 [(set (reg CC_REGNUM)
444 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
445 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
446 (match_operand:SI 2 "immediate_operand" "n,n")))]
447 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
448 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
452 [(set_attr "op_type" "RI")])
454 (define_insn "*tm<mode>_full"
455 [(set (reg CC_REGNUM)
456 (compare (match_operand:HQI 0 "register_operand" "d")
457 (match_operand:HQI 1 "immediate_operand" "n")))]
458 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], true))"
460 [(set_attr "op_type" "RI")])
463 ; Load-and-Test instructions
465 (define_insn "*tstdi_sign"
466 [(set (reg CC_REGNUM)
467 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
468 (const_int 32)) (const_int 32))
469 (match_operand:DI 1 "const0_operand" "")))
470 (set (match_operand:DI 2 "register_operand" "=d")
471 (sign_extend:DI (match_dup 0)))]
472 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
474 [(set_attr "op_type" "RRE")])
476 (define_insn "*tstdi_extimm"
477 [(set (reg CC_REGNUM)
478 (compare (match_operand:DI 0 "nonimmediate_operand" "d,m")
479 (match_operand:DI 1 "const0_operand" "")))
480 (set (match_operand:DI 2 "register_operand" "=d,d")
482 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT && TARGET_EXTIMM"
486 [(set_attr "op_type" "RRE,RXY")])
488 (define_insn "*tstdi_cconly_extimm"
489 [(set (reg CC_REGNUM)
490 (compare (match_operand:DI 0 "nonimmediate_operand" "d,m")
491 (match_operand:DI 1 "const0_operand" "")))
492 (clobber (match_scratch:DI 2 "=X,d"))]
493 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT && TARGET_EXTIMM"
497 [(set_attr "op_type" "RRE,RXY")])
499 (define_insn "*tstdi"
500 [(set (reg CC_REGNUM)
501 (compare (match_operand:DI 0 "register_operand" "d")
502 (match_operand:DI 1 "const0_operand" "")))
503 (set (match_operand:DI 2 "register_operand" "=d")
505 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT && !TARGET_EXTIMM"
507 [(set_attr "op_type" "RRE")])
509 (define_insn "*tstdi_cconly"
510 [(set (reg CC_REGNUM)
511 (compare (match_operand:DI 0 "register_operand" "d")
512 (match_operand:DI 1 "const0_operand" "")))]
513 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
515 [(set_attr "op_type" "RRE")])
517 (define_insn "*tstdi_cconly_31"
518 [(set (reg CC_REGNUM)
519 (compare (match_operand:DI 0 "register_operand" "d")
520 (match_operand:DI 1 "const0_operand" "")))]
521 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
523 [(set_attr "op_type" "RS")
524 (set_attr "atype" "reg")])
526 (define_insn "*tstsi_extimm"
527 [(set (reg CC_REGNUM)
528 (compare (match_operand:SI 0 "nonimmediate_operand" "d,m")
529 (match_operand:SI 1 "const0_operand" "")))
530 (set (match_operand:SI 2 "register_operand" "=d,d")
532 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
536 [(set_attr "op_type" "RR,RXY")])
538 (define_insn "*tstsi_cconly_extimm"
539 [(set (reg CC_REGNUM)
540 (compare (match_operand:SI 0 "nonimmediate_operand" "d,m")
541 (match_operand:SI 1 "const0_operand" "")))
542 (clobber (match_scratch:SI 2 "=X,d"))]
543 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
547 [(set_attr "op_type" "RR,RXY")])
549 (define_insn "*tstsi"
550 [(set (reg CC_REGNUM)
551 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
552 (match_operand:SI 1 "const0_operand" "")))
553 (set (match_operand:SI 2 "register_operand" "=d,d,d")
555 "s390_match_ccmode(insn, CCSmode) && !TARGET_EXTIMM"
560 [(set_attr "op_type" "RR,RS,RSY")])
562 (define_insn "*tstsi_cconly"
563 [(set (reg CC_REGNUM)
564 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
565 (match_operand:SI 1 "const0_operand" "")))
566 (clobber (match_scratch:SI 2 "=X,d,d"))]
567 "s390_match_ccmode(insn, CCSmode)"
572 [(set_attr "op_type" "RR,RS,RSY")])
574 (define_insn "*tstsi_cconly2"
575 [(set (reg CC_REGNUM)
576 (compare (match_operand:SI 0 "register_operand" "d")
577 (match_operand:SI 1 "const0_operand" "")))]
578 "s390_match_ccmode(insn, CCSmode)"
580 [(set_attr "op_type" "RR")])
582 (define_insn "*tst<mode>CCT"
583 [(set (reg CC_REGNUM)
584 (compare (match_operand:HQI 0 "nonimmediate_operand" "?Q,?S,d")
585 (match_operand:HQI 1 "const0_operand" "")))
586 (set (match_operand:HQI 2 "register_operand" "=d,d,0")
588 "s390_match_ccmode(insn, CCTmode)"
591 icmy\t%2,<icm_lo>,%S0
593 [(set_attr "op_type" "RS,RSY,RI")])
595 (define_insn "*tsthiCCT_cconly"
596 [(set (reg CC_REGNUM)
597 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
598 (match_operand:HI 1 "const0_operand" "")))
599 (clobber (match_scratch:HI 2 "=d,d,X"))]
600 "s390_match_ccmode(insn, CCTmode)"
605 [(set_attr "op_type" "RS,RSY,RI")])
607 (define_insn "*tstqiCCT_cconly"
608 [(set (reg CC_REGNUM)
609 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
610 (match_operand:QI 1 "const0_operand" "")))]
611 "s390_match_ccmode(insn, CCTmode)"
616 [(set_attr "op_type" "SI,SIY,RI")])
618 (define_insn "*tst<mode>"
619 [(set (reg CC_REGNUM)
620 (compare (match_operand:HQI 0 "s_operand" "Q,S")
621 (match_operand:HQI 1 "const0_operand" "")))
622 (set (match_operand:HQI 2 "register_operand" "=d,d")
624 "s390_match_ccmode(insn, CCSmode)"
627 icmy\t%2,<icm_lo>,%S0"
628 [(set_attr "op_type" "RS,RSY")])
630 (define_insn "*tst<mode>_cconly"
631 [(set (reg CC_REGNUM)
632 (compare (match_operand:HQI 0 "s_operand" "Q,S")
633 (match_operand:HQI 1 "const0_operand" "")))
634 (clobber (match_scratch:HQI 2 "=d,d"))]
635 "s390_match_ccmode(insn, CCSmode)"
638 icmy\t%2,<icm_lo>,%S0"
639 [(set_attr "op_type" "RS,RSY")])
642 ; Compare (equality) instructions
644 (define_insn "*cmpdi_cct"
645 [(set (reg CC_REGNUM)
646 (compare (match_operand:DI 0 "nonimmediate_operand" "%d,d,d,d,Q")
647 (match_operand:DI 1 "general_operand" "d,K,Os,m,BQ")))]
648 "s390_match_ccmode (insn, CCTmode) && TARGET_64BIT"
655 [(set_attr "op_type" "RRE,RI,RIL,RXY,SS")])
657 (define_insn "*cmpsi_cct"
658 [(set (reg CC_REGNUM)
659 (compare (match_operand:SI 0 "nonimmediate_operand" "%d,d,d,d,d,Q")
660 (match_operand:SI 1 "general_operand" "d,K,Os,R,T,BQ")))]
661 "s390_match_ccmode (insn, CCTmode)"
669 [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS")])
672 ; Compare (signed) instructions
674 (define_insn "*cmpdi_ccs_sign"
675 [(set (reg CC_REGNUM)
676 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
677 (match_operand:DI 0 "register_operand" "d,d")))]
678 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
682 [(set_attr "op_type" "RRE,RXY")])
684 (define_insn "*cmpdi_ccs"
685 [(set (reg CC_REGNUM)
686 (compare (match_operand:DI 0 "register_operand" "d,d,d,d")
687 (match_operand:DI 1 "general_operand" "d,K,Os,m")))]
688 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
694 [(set_attr "op_type" "RRE,RI,RIL,RXY")])
696 (define_insn "*cmpsi_ccs_sign"
697 [(set (reg CC_REGNUM)
698 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
699 (match_operand:SI 0 "register_operand" "d,d")))]
700 "s390_match_ccmode(insn, CCSRmode)"
704 [(set_attr "op_type" "RX,RXY")])
706 (define_insn "*cmpsi_ccs"
707 [(set (reg CC_REGNUM)
708 (compare (match_operand:SI 0 "register_operand" "d,d,d,d,d")
709 (match_operand:SI 1 "general_operand" "d,K,Os,R,T")))]
710 "s390_match_ccmode(insn, CCSmode)"
717 [(set_attr "op_type" "RR,RI,RIL,RX,RXY")])
720 ; Compare (unsigned) instructions
722 (define_insn "*cmpdi_ccu_zero"
723 [(set (reg CC_REGNUM)
724 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
725 (match_operand:DI 0 "register_operand" "d,d")))]
726 "s390_match_ccmode (insn, CCURmode) && TARGET_64BIT"
730 [(set_attr "op_type" "RRE,RXY")])
732 (define_insn "*cmpdi_ccu"
733 [(set (reg CC_REGNUM)
734 (compare (match_operand:DI 0 "nonimmediate_operand" "d,d,d,Q,BQ")
735 (match_operand:DI 1 "general_operand" "d,Op,m,BQ,Q")))]
736 "s390_match_ccmode (insn, CCUmode) && TARGET_64BIT"
743 [(set_attr "op_type" "RRE,RIL,RXY,SS,SS")])
745 (define_insn "*cmpsi_ccu"
746 [(set (reg CC_REGNUM)
747 (compare (match_operand:SI 0 "nonimmediate_operand" "d,d,d,d,Q,BQ")
748 (match_operand:SI 1 "general_operand" "d,Os,R,T,BQ,Q")))]
749 "s390_match_ccmode (insn, CCUmode)"
757 [(set_attr "op_type" "RR,RIL,RX,RXY,SS,SS")])
759 (define_insn "*cmphi_ccu"
760 [(set (reg CC_REGNUM)
761 (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,BQ")
762 (match_operand:HI 1 "general_operand" "Q,S,BQ,Q")))]
763 "s390_match_ccmode (insn, CCUmode)
764 && !register_operand (operands[1], HImode)"
770 [(set_attr "op_type" "RS,RSY,SS,SS")])
772 (define_insn "*cmpqi_ccu"
773 [(set (reg CC_REGNUM)
774 (compare (match_operand:QI 0 "nonimmediate_operand" "d,d,Q,S,Q,BQ")
775 (match_operand:QI 1 "general_operand" "Q,S,n,n,BQ,Q")))]
776 "s390_match_ccmode (insn, CCUmode)
777 && !register_operand (operands[1], QImode)"
785 [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS")])
788 ; Block compare (CLC) instruction patterns.
791 [(set (reg CC_REGNUM)
792 (compare (match_operand:BLK 0 "memory_operand" "Q")
793 (match_operand:BLK 1 "memory_operand" "Q")))
794 (use (match_operand 2 "const_int_operand" "n"))]
795 "s390_match_ccmode (insn, CCUmode)
796 && INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
797 "clc\t%O0(%2,%R0),%S1"
798 [(set_attr "op_type" "SS")])
801 [(set (reg CC_REGNUM)
802 (compare (match_operand 0 "memory_operand" "")
803 (match_operand 1 "memory_operand" "")))]
805 && s390_match_ccmode (insn, CCUmode)
806 && GET_MODE (operands[0]) == GET_MODE (operands[1])
807 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
809 [(set (match_dup 0) (match_dup 1))
810 (use (match_dup 2))])]
812 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
813 operands[0] = adjust_address (operands[0], BLKmode, 0);
814 operands[1] = adjust_address (operands[1], BLKmode, 0);
816 operands[1] = gen_rtx_COMPARE (GET_MODE (SET_DEST (PATTERN (curr_insn))),
817 operands[0], operands[1]);
818 operands[0] = SET_DEST (PATTERN (curr_insn));
822 ; (DF|SF) instructions
824 (define_insn "*cmp<mode>_ccs_0"
825 [(set (reg CC_REGNUM)
826 (compare (match_operand:FPR 0 "register_operand" "f")
827 (match_operand:FPR 1 "const0_operand" "")))]
828 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
830 [(set_attr "op_type" "RRE")
831 (set_attr "type" "fsimp<mode>")])
833 (define_insn "*cmp<mode>_ccs_0_ibm"
834 [(set (reg CC_REGNUM)
835 (compare (match_operand:FPR 0 "register_operand" "f")
836 (match_operand:FPR 1 "const0_operand" "")))]
837 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
839 [(set_attr "op_type" "<RRe>")
840 (set_attr "type" "fsimp<mode>")])
842 (define_insn "*cmp<mode>_ccs"
843 [(set (reg CC_REGNUM)
844 (compare (match_operand:FPR 0 "register_operand" "f,f")
845 (match_operand:FPR 1 "general_operand" "f,<Rf>")))]
846 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
850 [(set_attr "op_type" "RRE,RXE")
851 (set_attr "type" "fsimp<mode>")])
853 (define_insn "*cmp<mode>_ccs_ibm"
854 [(set (reg CC_REGNUM)
855 (compare (match_operand:FPR 0 "register_operand" "f,f")
856 (match_operand:FPR 1 "general_operand" "f,<Rf>")))]
857 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
861 [(set_attr "op_type" "<RRe>,<RXe>")
862 (set_attr "type" "fsimp<mode>")])
866 ;;- Move instructions.
870 ; movti instruction pattern(s).
874 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
875 (match_operand:TI 1 "general_operand" "QS,d,dPm,d,Q"))]
883 [(set_attr "op_type" "RSY,RSY,*,*,SS")
884 (set_attr "type" "lm,stm,*,*,*")])
887 [(set (match_operand:TI 0 "nonimmediate_operand" "")
888 (match_operand:TI 1 "general_operand" ""))]
889 "TARGET_64BIT && reload_completed
890 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
891 [(set (match_dup 2) (match_dup 4))
892 (set (match_dup 3) (match_dup 5))]
894 operands[2] = operand_subword (operands[0], 0, 0, TImode);
895 operands[3] = operand_subword (operands[0], 1, 0, TImode);
896 operands[4] = operand_subword (operands[1], 0, 0, TImode);
897 operands[5] = operand_subword (operands[1], 1, 0, TImode);
901 [(set (match_operand:TI 0 "nonimmediate_operand" "")
902 (match_operand:TI 1 "general_operand" ""))]
903 "TARGET_64BIT && reload_completed
904 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
905 [(set (match_dup 2) (match_dup 4))
906 (set (match_dup 3) (match_dup 5))]
908 operands[2] = operand_subword (operands[0], 1, 0, TImode);
909 operands[3] = operand_subword (operands[0], 0, 0, TImode);
910 operands[4] = operand_subword (operands[1], 1, 0, TImode);
911 operands[5] = operand_subword (operands[1], 0, 0, TImode);
915 [(set (match_operand:TI 0 "register_operand" "")
916 (match_operand:TI 1 "memory_operand" ""))]
917 "TARGET_64BIT && reload_completed
918 && !s_operand (operands[1], VOIDmode)"
919 [(set (match_dup 0) (match_dup 1))]
921 rtx addr = operand_subword (operands[0], 1, 0, TImode);
922 s390_load_address (addr, XEXP (operands[1], 0));
923 operands[1] = replace_equiv_address (operands[1], addr);
926 (define_expand "reload_outti"
927 [(parallel [(match_operand:TI 0 "" "")
928 (match_operand:TI 1 "register_operand" "d")
929 (match_operand:DI 2 "register_operand" "=&a")])]
932 gcc_assert (MEM_P (operands[0]));
933 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
934 operands[0] = replace_equiv_address (operands[0], operands[2]);
935 emit_move_insn (operands[0], operands[1]);
940 ; movdi instruction pattern(s).
943 (define_expand "movdi"
944 [(set (match_operand:DI 0 "general_operand" "")
945 (match_operand:DI 1 "general_operand" ""))]
948 /* Handle symbolic constants. */
950 && (SYMBOLIC_CONST (operands[1])
951 || (GET_CODE (operands[1]) == PLUS
952 && XEXP (operands[1], 0) == pic_offset_table_rtx
953 && SYMBOLIC_CONST (XEXP (operands[1], 1)))))
954 emit_symbolic_move (operands);
957 (define_insn "*movdi_larl"
958 [(set (match_operand:DI 0 "register_operand" "=d")
959 (match_operand:DI 1 "larl_operand" "X"))]
961 && !FP_REG_P (operands[0])"
963 [(set_attr "op_type" "RIL")
964 (set_attr "type" "larl")])
966 (define_insn "*movdi_64extimm"
967 [(set (match_operand:DI 0 "nonimmediate_operand"
968 "=d,d,d,d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,d,t,Q,t,?Q")
969 (match_operand:DI 1 "general_operand"
970 "K,N0HD0,N1HD0,N2HD0,N3HD0,Os,N0SD0,N1SD0,L,d,m,d,*f,R,T,*f,*f,t,d,t,Q,?Q"))]
971 "TARGET_64BIT && TARGET_EXTIMM"
995 [(set_attr "op_type" "RI,RI,RI,RI,RI,RIL,RIL,RIL,RXY,RRE,RXY,RXY,
996 RR,RX,RXY,RX,RXY,*,*,RS,RS,SS")
997 (set_attr "type" "*,*,*,*,*,*,*,*,la,lr,load,store,
998 floaddf,floaddf,floaddf,fstoredf,fstoredf,*,*,*,*,*")])
1000 (define_insn "*movdi_64"
1001 [(set (match_operand:DI 0 "nonimmediate_operand"
1002 "=d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,d,t,Q,t,?Q")
1003 (match_operand:DI 1 "general_operand"
1004 "K,N0HD0,N1HD0,N2HD0,N3HD0,L,d,m,d,*f,R,T,*f,*f,t,d,t,Q,?Q"))]
1005 "TARGET_64BIT && !TARGET_EXTIMM"
1026 [(set_attr "op_type" "RI,RI,RI,RI,RI,RXY,RRE,RXY,RXY,
1027 RR,RX,RXY,RX,RXY,*,*,RS,RS,SS")
1028 (set_attr "type" "*,*,*,*,*,la,lr,load,store,
1029 floaddf,floaddf,floaddf,fstoredf,fstoredf,*,*,*,*,*")])
1032 [(set (match_operand:DI 0 "register_operand" "")
1033 (match_operand:DI 1 "register_operand" ""))]
1034 "TARGET_64BIT && ACCESS_REG_P (operands[1])"
1035 [(set (match_dup 2) (match_dup 3))
1036 (set (match_dup 0) (ashift:DI (match_dup 0) (const_int 32)))
1037 (set (strict_low_part (match_dup 2)) (match_dup 4))]
1038 "operands[2] = gen_lowpart (SImode, operands[0]);
1039 s390_split_access_reg (operands[1], &operands[4], &operands[3]);")
1042 [(set (match_operand:DI 0 "register_operand" "")
1043 (match_operand:DI 1 "register_operand" ""))]
1044 "TARGET_64BIT && ACCESS_REG_P (operands[0])
1045 && dead_or_set_p (insn, operands[1])"
1046 [(set (match_dup 3) (match_dup 2))
1047 (set (match_dup 1) (lshiftrt:DI (match_dup 1) (const_int 32)))
1048 (set (match_dup 4) (match_dup 2))]
1049 "operands[2] = gen_lowpart (SImode, operands[1]);
1050 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1053 [(set (match_operand:DI 0 "register_operand" "")
1054 (match_operand:DI 1 "register_operand" ""))]
1055 "TARGET_64BIT && ACCESS_REG_P (operands[0])
1056 && !dead_or_set_p (insn, operands[1])"
1057 [(set (match_dup 3) (match_dup 2))
1058 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))
1059 (set (match_dup 4) (match_dup 2))
1060 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))]
1061 "operands[2] = gen_lowpart (SImode, operands[1]);
1062 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1064 (define_insn "*movdi_31"
1065 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,Q,S,d,o,!*f,!*f,!*f,!R,!T,Q")
1066 (match_operand:DI 1 "general_operand" "Q,S,d,d,dPm,d,*f,R,T,*f,*f,Q"))]
1081 [(set_attr "op_type" "RS,RSY,RS,RSY,*,*,RR,RX,RXY,RX,RXY,SS")
1082 (set_attr "type" "lm,lm,stm,stm,*,*,floaddf,floaddf,floaddf,fstoredf,fstoredf,*")])
1085 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1086 (match_operand:DI 1 "general_operand" ""))]
1087 "!TARGET_64BIT && reload_completed
1088 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1089 [(set (match_dup 2) (match_dup 4))
1090 (set (match_dup 3) (match_dup 5))]
1092 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1093 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1094 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1095 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1099 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1100 (match_operand:DI 1 "general_operand" ""))]
1101 "!TARGET_64BIT && reload_completed
1102 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1103 [(set (match_dup 2) (match_dup 4))
1104 (set (match_dup 3) (match_dup 5))]
1106 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1107 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1108 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1109 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1113 [(set (match_operand:DI 0 "register_operand" "")
1114 (match_operand:DI 1 "memory_operand" ""))]
1115 "!TARGET_64BIT && reload_completed
1116 && !FP_REG_P (operands[0])
1117 && !s_operand (operands[1], VOIDmode)"
1118 [(set (match_dup 0) (match_dup 1))]
1120 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1121 s390_load_address (addr, XEXP (operands[1], 0));
1122 operands[1] = replace_equiv_address (operands[1], addr);
1125 (define_expand "reload_outdi"
1126 [(parallel [(match_operand:DI 0 "" "")
1127 (match_operand:DI 1 "register_operand" "d")
1128 (match_operand:SI 2 "register_operand" "=&a")])]
1131 gcc_assert (MEM_P (operands[0]));
1132 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
1133 operands[0] = replace_equiv_address (operands[0], operands[2]);
1134 emit_move_insn (operands[0], operands[1]);
1139 [(set (match_operand:DI 0 "register_operand" "")
1140 (mem:DI (match_operand 1 "address_operand" "")))]
1142 && !FP_REG_P (operands[0])
1143 && GET_CODE (operands[1]) == SYMBOL_REF
1144 && CONSTANT_POOL_ADDRESS_P (operands[1])
1145 && get_pool_mode (operands[1]) == DImode
1146 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1147 [(set (match_dup 0) (match_dup 2))]
1148 "operands[2] = get_pool_constant (operands[1]);")
1150 (define_insn "*la_64"
1151 [(set (match_operand:DI 0 "register_operand" "=d,d")
1152 (match_operand:QI 1 "address_operand" "U,W"))]
1157 [(set_attr "op_type" "RX,RXY")
1158 (set_attr "type" "la")])
1162 [(set (match_operand:DI 0 "register_operand" "")
1163 (match_operand:QI 1 "address_operand" ""))
1164 (clobber (reg:CC CC_REGNUM))])]
1166 && preferred_la_operand_p (operands[1], const0_rtx)"
1167 [(set (match_dup 0) (match_dup 1))]
1171 [(set (match_operand:DI 0 "register_operand" "")
1172 (match_operand:DI 1 "register_operand" ""))
1175 (plus:DI (match_dup 0)
1176 (match_operand:DI 2 "nonmemory_operand" "")))
1177 (clobber (reg:CC CC_REGNUM))])]
1179 && !reg_overlap_mentioned_p (operands[0], operands[2])
1180 && preferred_la_operand_p (operands[1], operands[2])"
1181 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1184 (define_expand "reload_indi"
1185 [(parallel [(match_operand:DI 0 "register_operand" "=a")
1186 (match_operand:DI 1 "s390_plus_operand" "")
1187 (match_operand:DI 2 "register_operand" "=&a")])]
1190 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1195 ; movsi instruction pattern(s).
1198 (define_expand "movsi"
1199 [(set (match_operand:SI 0 "general_operand" "")
1200 (match_operand:SI 1 "general_operand" ""))]
1203 /* Handle symbolic constants. */
1205 && (SYMBOLIC_CONST (operands[1])
1206 || (GET_CODE (operands[1]) == PLUS
1207 && XEXP (operands[1], 0) == pic_offset_table_rtx
1208 && SYMBOLIC_CONST (XEXP(operands[1], 1)))))
1209 emit_symbolic_move (operands);
1212 (define_insn "*movsi_larl"
1213 [(set (match_operand:SI 0 "register_operand" "=d")
1214 (match_operand:SI 1 "larl_operand" "X"))]
1215 "!TARGET_64BIT && TARGET_CPU_ZARCH
1216 && !FP_REG_P (operands[0])"
1218 [(set_attr "op_type" "RIL")
1219 (set_attr "type" "larl")])
1221 (define_insn "*movsi_zarch"
1222 [(set (match_operand:SI 0 "nonimmediate_operand"
1223 "=d,d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,d,t,Q,t,?Q")
1224 (match_operand:SI 1 "general_operand"
1225 "K,N0HS0,N1HS0,Os,L,d,R,T,d,d,*f,R,T,*f,*f,t,d,t,Q,?Q"))]
1248 [(set_attr "op_type" "RI,RI,RI,RIL,RXY,RR,RX,RXY,RX,RXY,
1249 RR,RX,RXY,RX,RXY,RRE,RRE,RS,RS,SS")
1250 (set_attr "type" "*,*,*,*,la,lr,load,load,store,store,
1251 floadsf,floadsf,floadsf,fstoresf,fstoresf,*,*,*,*,*")])
1253 (define_insn "*movsi_esa"
1254 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,d,t,Q,t,?Q")
1255 (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,t,d,t,Q,?Q"))]
1270 [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,RRE,RRE,RS,RS,SS")
1271 (set_attr "type" "*,lr,load,store,floadsf,floadsf,fstoresf,*,*,*,*,*")])
1274 [(set (match_operand:SI 0 "register_operand" "")
1275 (mem:SI (match_operand 1 "address_operand" "")))]
1276 "!FP_REG_P (operands[0])
1277 && GET_CODE (operands[1]) == SYMBOL_REF
1278 && CONSTANT_POOL_ADDRESS_P (operands[1])
1279 && get_pool_mode (operands[1]) == SImode
1280 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1281 [(set (match_dup 0) (match_dup 2))]
1282 "operands[2] = get_pool_constant (operands[1]);")
1284 (define_insn "*la_31"
1285 [(set (match_operand:SI 0 "register_operand" "=d,d")
1286 (match_operand:QI 1 "address_operand" "U,W"))]
1287 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1291 [(set_attr "op_type" "RX,RXY")
1292 (set_attr "type" "la")])
1296 [(set (match_operand:SI 0 "register_operand" "")
1297 (match_operand:QI 1 "address_operand" ""))
1298 (clobber (reg:CC CC_REGNUM))])]
1300 && preferred_la_operand_p (operands[1], const0_rtx)"
1301 [(set (match_dup 0) (match_dup 1))]
1305 [(set (match_operand:SI 0 "register_operand" "")
1306 (match_operand:SI 1 "register_operand" ""))
1309 (plus:SI (match_dup 0)
1310 (match_operand:SI 2 "nonmemory_operand" "")))
1311 (clobber (reg:CC CC_REGNUM))])]
1313 && !reg_overlap_mentioned_p (operands[0], operands[2])
1314 && preferred_la_operand_p (operands[1], operands[2])"
1315 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1318 (define_insn "*la_31_and"
1319 [(set (match_operand:SI 0 "register_operand" "=d,d")
1320 (and:SI (match_operand:QI 1 "address_operand" "U,W")
1321 (const_int 2147483647)))]
1326 [(set_attr "op_type" "RX,RXY")
1327 (set_attr "type" "la")])
1329 (define_insn_and_split "*la_31_and_cc"
1330 [(set (match_operand:SI 0 "register_operand" "=d")
1331 (and:SI (match_operand:QI 1 "address_operand" "p")
1332 (const_int 2147483647)))
1333 (clobber (reg:CC CC_REGNUM))]
1336 "&& reload_completed"
1338 (and:SI (match_dup 1) (const_int 2147483647)))]
1340 [(set_attr "op_type" "RX")
1341 (set_attr "type" "la")])
1343 (define_insn "force_la_31"
1344 [(set (match_operand:SI 0 "register_operand" "=d,d")
1345 (match_operand:QI 1 "address_operand" "U,W"))
1346 (use (const_int 0))]
1351 [(set_attr "op_type" "RX")
1352 (set_attr "type" "la")])
1354 (define_expand "reload_insi"
1355 [(parallel [(match_operand:SI 0 "register_operand" "=a")
1356 (match_operand:SI 1 "s390_plus_operand" "")
1357 (match_operand:SI 2 "register_operand" "=&a")])]
1360 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1365 ; movhi instruction pattern(s).
1368 (define_expand "movhi"
1369 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1370 (match_operand:HI 1 "general_operand" ""))]
1373 /* Make it explicit that loading a register from memory
1374 always sign-extends (at least) to SImode. */
1375 if (optimize && !no_new_pseudos
1376 && register_operand (operands[0], VOIDmode)
1377 && GET_CODE (operands[1]) == MEM)
1379 rtx tmp = gen_reg_rtx (SImode);
1380 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1381 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1382 operands[1] = gen_lowpart (HImode, tmp);
1386 (define_insn "*movhi"
1387 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1388 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1398 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1399 (set_attr "type" "lr,*,*,*,store,store,*")])
1402 [(set (match_operand:HI 0 "register_operand" "")
1403 (mem:HI (match_operand 1 "address_operand" "")))]
1404 "GET_CODE (operands[1]) == SYMBOL_REF
1405 && CONSTANT_POOL_ADDRESS_P (operands[1])
1406 && get_pool_mode (operands[1]) == HImode
1407 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1408 [(set (match_dup 0) (match_dup 2))]
1409 "operands[2] = get_pool_constant (operands[1]);")
1412 ; movqi instruction pattern(s).
1415 (define_expand "movqi"
1416 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1417 (match_operand:QI 1 "general_operand" ""))]
1420 /* On z/Architecture, zero-extending from memory to register
1421 is just as fast as a QImode load. */
1422 if (TARGET_ZARCH && optimize && !no_new_pseudos
1423 && register_operand (operands[0], VOIDmode)
1424 && GET_CODE (operands[1]) == MEM)
1426 rtx tmp = gen_reg_rtx (word_mode);
1427 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1428 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1429 operands[1] = gen_lowpart (QImode, tmp);
1433 (define_insn "*movqi"
1434 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1435 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1447 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1448 (set_attr "type" "lr,*,*,*,store,store,store,store,*")])
1451 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1452 (mem:QI (match_operand 1 "address_operand" "")))]
1453 "GET_CODE (operands[1]) == SYMBOL_REF
1454 && CONSTANT_POOL_ADDRESS_P (operands[1])
1455 && get_pool_mode (operands[1]) == QImode
1456 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1457 [(set (match_dup 0) (match_dup 2))]
1458 "operands[2] = get_pool_constant (operands[1]);")
1461 ; movstrictqi instruction pattern(s).
1464 (define_insn "*movstrictqi"
1465 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1466 (match_operand:QI 1 "memory_operand" "R,T"))]
1471 [(set_attr "op_type" "RX,RXY")])
1474 ; movstricthi instruction pattern(s).
1477 (define_insn "*movstricthi"
1478 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1479 (match_operand:HI 1 "memory_operand" "Q,S"))
1480 (clobber (reg:CC CC_REGNUM))]
1485 [(set_attr "op_type" "RS,RSY")])
1488 ; movstrictsi instruction pattern(s).
1491 (define_insn "movstrictsi"
1492 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d,d"))
1493 (match_operand:SI 1 "general_operand" "d,R,T,t"))]
1500 [(set_attr "op_type" "RR,RX,RXY,RRE")
1501 (set_attr "type" "lr,load,load,*")])
1504 ; movtf instruction pattern(s).
1507 (define_expand "movtf"
1508 [(set (match_operand:TF 0 "nonimmediate_operand" "")
1509 (match_operand:TF 1 "general_operand" ""))]
1513 (define_insn "*movtf_64"
1514 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,f,f,o,d,QS,d,o,Q")
1515 (match_operand:TF 1 "general_operand" "G,f,o,f,QS,d,dm,d,Q"))]
1527 [(set_attr "op_type" "RRE,RRE,*,*,RSY,RSY,*,*,*")
1528 (set_attr "type" "fsimptf,fsimptf,*,*,lm,stm,*,*,*")])
1530 (define_insn "*movtf_31"
1531 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,f,f,o,Q")
1532 (match_operand:TF 1 "general_operand" "G,f,o,f,Q"))]
1540 [(set_attr "op_type" "RRE,RRE,*,*,*")
1541 (set_attr "type" "fsimptf,fsimptf,*,*,*")])
1543 ; TFmode in GPRs splitters
1546 [(set (match_operand:TF 0 "nonimmediate_operand" "")
1547 (match_operand:TF 1 "general_operand" ""))]
1548 "TARGET_64BIT && reload_completed
1549 && s390_split_ok_p (operands[0], operands[1], TFmode, 0)"
1550 [(set (match_dup 2) (match_dup 4))
1551 (set (match_dup 3) (match_dup 5))]
1553 operands[2] = operand_subword (operands[0], 0, 0, TFmode);
1554 operands[3] = operand_subword (operands[0], 1, 0, TFmode);
1555 operands[4] = operand_subword (operands[1], 0, 0, TFmode);
1556 operands[5] = operand_subword (operands[1], 1, 0, TFmode);
1560 [(set (match_operand:TF 0 "nonimmediate_operand" "")
1561 (match_operand:TF 1 "general_operand" ""))]
1562 "TARGET_64BIT && reload_completed
1563 && s390_split_ok_p (operands[0], operands[1], TFmode, 1)"
1564 [(set (match_dup 2) (match_dup 4))
1565 (set (match_dup 3) (match_dup 5))]
1567 operands[2] = operand_subword (operands[0], 1, 0, TFmode);
1568 operands[3] = operand_subword (operands[0], 0, 0, TFmode);
1569 operands[4] = operand_subword (operands[1], 1, 0, TFmode);
1570 operands[5] = operand_subword (operands[1], 0, 0, TFmode);
1574 [(set (match_operand:TF 0 "register_operand" "")
1575 (match_operand:TF 1 "memory_operand" ""))]
1576 "TARGET_64BIT && reload_completed
1577 && !FP_REG_P (operands[0])
1578 && !s_operand (operands[1], VOIDmode)"
1579 [(set (match_dup 0) (match_dup 1))]
1581 rtx addr = operand_subword (operands[0], 1, 0, TFmode);
1582 s390_load_address (addr, XEXP (operands[1], 0));
1583 operands[1] = replace_equiv_address (operands[1], addr);
1586 ; TFmode in FPRs splitters
1589 [(set (match_operand:TF 0 "register_operand" "")
1590 (match_operand:TF 1 "memory_operand" ""))]
1591 "reload_completed && offsettable_memref_p (operands[1])
1592 && FP_REG_P (operands[0])"
1593 [(set (match_dup 2) (match_dup 4))
1594 (set (match_dup 3) (match_dup 5))]
1596 operands[2] = simplify_gen_subreg (DFmode, operands[0], TFmode, 0);
1597 operands[3] = simplify_gen_subreg (DFmode, operands[0], TFmode, 8);
1598 operands[4] = adjust_address_nv (operands[1], DFmode, 0);
1599 operands[5] = adjust_address_nv (operands[1], DFmode, 8);
1603 [(set (match_operand:TF 0 "memory_operand" "")
1604 (match_operand:TF 1 "register_operand" ""))]
1605 "reload_completed && offsettable_memref_p (operands[0])
1606 && FP_REG_P (operands[1])"
1607 [(set (match_dup 2) (match_dup 4))
1608 (set (match_dup 3) (match_dup 5))]
1610 operands[2] = adjust_address_nv (operands[0], DFmode, 0);
1611 operands[3] = adjust_address_nv (operands[0], DFmode, 8);
1612 operands[4] = simplify_gen_subreg (DFmode, operands[1], TFmode, 0);
1613 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, 8);
1616 (define_expand "reload_outtf"
1617 [(parallel [(match_operand:TF 0 "" "")
1618 (match_operand:TF 1 "register_operand" "f")
1619 (match_operand:SI 2 "register_operand" "=&a")])]
1622 rtx addr = gen_lowpart (Pmode, operands[2]);
1624 gcc_assert (MEM_P (operands[0]));
1625 s390_load_address (addr, find_replacement (&XEXP (operands[0], 0)));
1626 operands[0] = replace_equiv_address (operands[0], addr);
1627 emit_move_insn (operands[0], operands[1]);
1631 (define_expand "reload_intf"
1632 [(parallel [(match_operand:TF 0 "register_operand" "=f")
1633 (match_operand:TF 1 "" "")
1634 (match_operand:SI 2 "register_operand" "=&a")])]
1637 rtx addr = gen_lowpart (Pmode, operands[2]);
1639 gcc_assert (MEM_P (operands[1]));
1640 s390_load_address (addr, find_replacement (&XEXP (operands[1], 0)));
1641 operands[1] = replace_equiv_address (operands[1], addr);
1642 emit_move_insn (operands[0], operands[1]);
1647 ; movdf instruction pattern(s).
1650 (define_expand "movdf"
1651 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1652 (match_operand:DF 1 "general_operand" ""))]
1656 (define_insn "*movdf_64"
1657 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,m,?Q")
1658 (match_operand:DF 1 "general_operand" "G,f,R,T,f,f,d,m,d,?Q"))]
1671 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1672 (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,fstoredf,fstoredf,lr,load,store,*")])
1674 (define_insn "*movdf_31"
1675 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,Q,S,d,o,Q")
1676 (match_operand:DF 1 "general_operand" "G,f,R,T,f,f,Q,S,d,d,dPm,d,Q"))]
1692 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*,SS")
1693 (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,fstoredf,fstoredf,\
1694 lm,lm,stm,stm,*,*,*")])
1697 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1698 (match_operand:DF 1 "general_operand" ""))]
1699 "!TARGET_64BIT && reload_completed
1700 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1701 [(set (match_dup 2) (match_dup 4))
1702 (set (match_dup 3) (match_dup 5))]
1704 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1705 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1706 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1707 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1711 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1712 (match_operand:DF 1 "general_operand" ""))]
1713 "!TARGET_64BIT && reload_completed
1714 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1715 [(set (match_dup 2) (match_dup 4))
1716 (set (match_dup 3) (match_dup 5))]
1718 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1719 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1720 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1721 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1725 [(set (match_operand:DF 0 "register_operand" "")
1726 (match_operand:DF 1 "memory_operand" ""))]
1727 "!TARGET_64BIT && reload_completed
1728 && !FP_REG_P (operands[0])
1729 && !s_operand (operands[1], VOIDmode)"
1730 [(set (match_dup 0) (match_dup 1))]
1732 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1733 s390_load_address (addr, XEXP (operands[1], 0));
1734 operands[1] = replace_equiv_address (operands[1], addr);
1737 (define_expand "reload_outdf"
1738 [(parallel [(match_operand:DF 0 "" "")
1739 (match_operand:DF 1 "register_operand" "d")
1740 (match_operand:SI 2 "register_operand" "=&a")])]
1743 gcc_assert (MEM_P (operands[0]));
1744 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
1745 operands[0] = replace_equiv_address (operands[0], operands[2]);
1746 emit_move_insn (operands[0], operands[1]);
1751 ; movsf instruction pattern(s).
1754 (define_insn "movsf"
1755 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,d,R,T,?Q")
1756 (match_operand:SF 1 "general_operand" "G,f,R,T,f,f,d,R,T,d,d,?Q"))]
1771 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1772 (set_attr "type" "fsimpsf,floadsf,floadsf,floadsf,fstoresf,fstoresf,
1773 lr,load,load,store,store,*")])
1776 ; movcc instruction pattern
1779 (define_insn "movcc"
1780 [(set (match_operand:CC 0 "nonimmediate_operand" "=d,c,d,d,d,R,T")
1781 (match_operand:CC 1 "nonimmediate_operand" "d,d,c,R,T,d,d"))]
1791 [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY")
1792 (set_attr "type" "lr,*,*,store,store,load,load")])
1795 ; Block move (MVC) patterns.
1799 [(set (match_operand:BLK 0 "memory_operand" "=Q")
1800 (match_operand:BLK 1 "memory_operand" "Q"))
1801 (use (match_operand 2 "const_int_operand" "n"))]
1802 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
1803 "mvc\t%O0(%2,%R0),%S1"
1804 [(set_attr "op_type" "SS")])
1807 [(set (match_operand 0 "memory_operand" "")
1808 (match_operand 1 "memory_operand" ""))]
1810 && GET_MODE (operands[0]) == GET_MODE (operands[1])
1811 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
1813 [(set (match_dup 0) (match_dup 1))
1814 (use (match_dup 2))])]
1816 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
1817 operands[0] = adjust_address (operands[0], BLKmode, 0);
1818 operands[1] = adjust_address (operands[1], BLKmode, 0);
1823 [(set (match_operand:BLK 0 "memory_operand" "")
1824 (match_operand:BLK 1 "memory_operand" ""))
1825 (use (match_operand 2 "const_int_operand" ""))])
1827 [(set (match_operand:BLK 3 "memory_operand" "")
1828 (match_operand:BLK 4 "memory_operand" ""))
1829 (use (match_operand 5 "const_int_operand" ""))])]
1830 "s390_offset_p (operands[0], operands[3], operands[2])
1831 && s390_offset_p (operands[1], operands[4], operands[2])
1832 && !s390_overlap_p (operands[0], operands[1],
1833 INTVAL (operands[2]) + INTVAL (operands[5]))
1834 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
1836 [(set (match_dup 6) (match_dup 7))
1837 (use (match_dup 8))])]
1838 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
1839 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
1840 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
1844 ; load_multiple pattern(s).
1846 ; ??? Due to reload problems with replacing registers inside match_parallel
1847 ; we currently support load_multiple/store_multiple only after reload.
1850 (define_expand "load_multiple"
1851 [(match_par_dup 3 [(set (match_operand 0 "" "")
1852 (match_operand 1 "" ""))
1853 (use (match_operand 2 "" ""))])]
1856 enum machine_mode mode;
1862 /* Support only loading a constant number of fixed-point registers from
1863 memory and only bother with this if more than two */
1864 if (GET_CODE (operands[2]) != CONST_INT
1865 || INTVAL (operands[2]) < 2
1866 || INTVAL (operands[2]) > 16
1867 || GET_CODE (operands[1]) != MEM
1868 || GET_CODE (operands[0]) != REG
1869 || REGNO (operands[0]) >= 16)
1872 count = INTVAL (operands[2]);
1873 regno = REGNO (operands[0]);
1874 mode = GET_MODE (operands[0]);
1875 if (mode != SImode && mode != word_mode)
1878 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1881 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1883 from = XEXP (operands[1], 0);
1886 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1887 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1888 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1890 from = XEXP (XEXP (operands[1], 0), 0);
1891 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1898 from = force_reg (Pmode, XEXP (operands[1], 0));
1902 for (i = 0; i < count; i++)
1903 XVECEXP (operands[3], 0, i)
1904 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1905 change_address (operands[1], mode,
1906 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1909 (define_insn "*load_multiple_di"
1910 [(match_parallel 0 "load_multiple_operation"
1911 [(set (match_operand:DI 1 "register_operand" "=r")
1912 (match_operand:DI 2 "s_operand" "QS"))])]
1913 "reload_completed && word_mode == DImode"
1915 int words = XVECLEN (operands[0], 0);
1916 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1917 return "lmg\t%1,%0,%S2";
1919 [(set_attr "op_type" "RSY")
1920 (set_attr "type" "lm")])
1922 (define_insn "*load_multiple_si"
1923 [(match_parallel 0 "load_multiple_operation"
1924 [(set (match_operand:SI 1 "register_operand" "=r,r")
1925 (match_operand:SI 2 "s_operand" "Q,S"))])]
1928 int words = XVECLEN (operands[0], 0);
1929 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1930 return which_alternative == 0 ? "lm\t%1,%0,%S2" : "lmy\t%1,%0,%S2";
1932 [(set_attr "op_type" "RS,RSY")
1933 (set_attr "type" "lm")])
1936 ; store multiple pattern(s).
1939 (define_expand "store_multiple"
1940 [(match_par_dup 3 [(set (match_operand 0 "" "")
1941 (match_operand 1 "" ""))
1942 (use (match_operand 2 "" ""))])]
1945 enum machine_mode mode;
1951 /* Support only storing a constant number of fixed-point registers to
1952 memory and only bother with this if more than two. */
1953 if (GET_CODE (operands[2]) != CONST_INT
1954 || INTVAL (operands[2]) < 2
1955 || INTVAL (operands[2]) > 16
1956 || GET_CODE (operands[0]) != MEM
1957 || GET_CODE (operands[1]) != REG
1958 || REGNO (operands[1]) >= 16)
1961 count = INTVAL (operands[2]);
1962 regno = REGNO (operands[1]);
1963 mode = GET_MODE (operands[1]);
1964 if (mode != SImode && mode != word_mode)
1967 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1971 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1973 to = XEXP (operands[0], 0);
1976 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1977 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1978 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1980 to = XEXP (XEXP (operands[0], 0), 0);
1981 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1988 to = force_reg (Pmode, XEXP (operands[0], 0));
1992 for (i = 0; i < count; i++)
1993 XVECEXP (operands[3], 0, i)
1994 = gen_rtx_SET (VOIDmode,
1995 change_address (operands[0], mode,
1996 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1997 gen_rtx_REG (mode, regno + i));
2000 (define_insn "*store_multiple_di"
2001 [(match_parallel 0 "store_multiple_operation"
2002 [(set (match_operand:DI 1 "s_operand" "=QS")
2003 (match_operand:DI 2 "register_operand" "r"))])]
2004 "reload_completed && word_mode == DImode"
2006 int words = XVECLEN (operands[0], 0);
2007 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
2008 return "stmg\t%2,%0,%S1";
2010 [(set_attr "op_type" "RSY")
2011 (set_attr "type" "stm")])
2014 (define_insn "*store_multiple_si"
2015 [(match_parallel 0 "store_multiple_operation"
2016 [(set (match_operand:SI 1 "s_operand" "=Q,S")
2017 (match_operand:SI 2 "register_operand" "r,r"))])]
2020 int words = XVECLEN (operands[0], 0);
2021 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
2022 return which_alternative == 0 ? "stm\t%2,%0,%S1" : "stmy\t%2,%0,%S1";
2024 [(set_attr "op_type" "RS,RSY")
2025 (set_attr "type" "stm")])
2028 ;; String instructions.
2031 (define_insn "*execute"
2032 [(match_parallel 0 ""
2033 [(unspec [(match_operand 1 "register_operand" "a")
2034 (match_operand:BLK 2 "memory_operand" "R")
2035 (match_operand 3 "" "")] UNSPEC_EXECUTE)])]
2036 "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
2037 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
2039 [(set_attr "op_type" "RX")
2040 (set_attr "type" "cs")])
2044 ; strlenM instruction pattern(s).
2047 (define_expand "strlen<mode>"
2048 [(set (reg:SI 0) (match_operand:SI 2 "immediate_operand" ""))
2051 (unspec:P [(const_int 0)
2052 (match_operand:BLK 1 "memory_operand" "")
2054 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
2055 (clobber (scratch:P))
2056 (clobber (reg:CC CC_REGNUM))])
2058 [(set (match_operand:P 0 "register_operand" "")
2059 (minus:P (match_dup 4) (match_dup 5)))
2060 (clobber (reg:CC CC_REGNUM))])]
2063 operands[4] = gen_reg_rtx (Pmode);
2064 operands[5] = gen_reg_rtx (Pmode);
2065 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
2066 operands[1] = replace_equiv_address (operands[1], operands[5]);
2069 (define_insn "*strlen<mode>"
2070 [(set (match_operand:P 0 "register_operand" "=a")
2071 (unspec:P [(match_operand:P 2 "general_operand" "0")
2072 (mem:BLK (match_operand:P 3 "register_operand" "1"))
2074 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
2075 (clobber (match_scratch:P 1 "=a"))
2076 (clobber (reg:CC CC_REGNUM))]
2078 "srst\t%0,%1\;jo\t.-4"
2079 [(set_attr "length" "8")
2080 (set_attr "type" "vs")])
2083 ; cmpstrM instruction pattern(s).
2086 (define_expand "cmpstrsi"
2087 [(set (reg:SI 0) (const_int 0))
2089 [(clobber (match_operand 3 "" ""))
2090 (clobber (match_dup 4))
2091 (set (reg:CCU CC_REGNUM)
2092 (compare:CCU (match_operand:BLK 1 "memory_operand" "")
2093 (match_operand:BLK 2 "memory_operand" "")))
2096 [(set (match_operand:SI 0 "register_operand" "=d")
2097 (unspec:SI [(reg:CCU CC_REGNUM)] UNSPEC_CMPINT))
2098 (clobber (reg:CC CC_REGNUM))])]
2101 /* As the result of CMPINT is inverted compared to what we need,
2102 we have to swap the operands. */
2103 rtx op1 = operands[2];
2104 rtx op2 = operands[1];
2105 rtx addr1 = gen_reg_rtx (Pmode);
2106 rtx addr2 = gen_reg_rtx (Pmode);
2108 emit_move_insn (addr1, force_operand (XEXP (op1, 0), NULL_RTX));
2109 emit_move_insn (addr2, force_operand (XEXP (op2, 0), NULL_RTX));
2110 operands[1] = replace_equiv_address_nv (op1, addr1);
2111 operands[2] = replace_equiv_address_nv (op2, addr2);
2112 operands[3] = addr1;
2113 operands[4] = addr2;
2116 (define_insn "*cmpstr<mode>"
2117 [(clobber (match_operand:P 0 "register_operand" "=d"))
2118 (clobber (match_operand:P 1 "register_operand" "=d"))
2119 (set (reg:CCU CC_REGNUM)
2120 (compare:CCU (mem:BLK (match_operand:P 2 "register_operand" "0"))
2121 (mem:BLK (match_operand:P 3 "register_operand" "1"))))
2124 "clst\t%0,%1\;jo\t.-4"
2125 [(set_attr "length" "8")
2126 (set_attr "type" "vs")])
2129 ; movstr instruction pattern.
2132 (define_expand "movstr"
2133 [(set (reg:SI 0) (const_int 0))
2135 [(clobber (match_dup 3))
2136 (set (match_operand:BLK 1 "memory_operand" "")
2137 (match_operand:BLK 2 "memory_operand" ""))
2138 (set (match_operand 0 "register_operand" "")
2139 (unspec [(match_dup 1)
2141 (reg:SI 0)] UNSPEC_MVST))
2142 (clobber (reg:CC CC_REGNUM))])]
2145 rtx addr1 = gen_reg_rtx (Pmode);
2146 rtx addr2 = gen_reg_rtx (Pmode);
2148 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2149 emit_move_insn (addr2, force_operand (XEXP (operands[2], 0), NULL_RTX));
2150 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2151 operands[2] = replace_equiv_address_nv (operands[2], addr2);
2152 operands[3] = addr2;
2155 (define_insn "*movstr"
2156 [(clobber (match_operand:P 2 "register_operand" "=d"))
2157 (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
2158 (mem:BLK (match_operand:P 3 "register_operand" "2")))
2159 (set (match_operand:P 0 "register_operand" "=d")
2160 (unspec [(mem:BLK (match_dup 1))
2161 (mem:BLK (match_dup 3))
2162 (reg:SI 0)] UNSPEC_MVST))
2163 (clobber (reg:CC CC_REGNUM))]
2165 "mvst\t%1,%2\;jo\t.-4"
2166 [(set_attr "length" "8")
2167 (set_attr "type" "vs")])
2171 ; movmemM instruction pattern(s).
2174 (define_expand "movmem<mode>"
2175 [(set (match_operand:BLK 0 "memory_operand" "")
2176 (match_operand:BLK 1 "memory_operand" ""))
2177 (use (match_operand:GPR 2 "general_operand" ""))
2178 (match_operand 3 "" "")]
2180 "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
2182 ; Move a block that is up to 256 bytes in length.
2183 ; The block length is taken as (operands[2] % 256) + 1.
2185 (define_expand "movmem_short"
2187 [(set (match_operand:BLK 0 "memory_operand" "")
2188 (match_operand:BLK 1 "memory_operand" ""))
2189 (use (match_operand 2 "nonmemory_operand" ""))
2190 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2191 (clobber (match_dup 3))])]
2193 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2195 (define_insn "*movmem_short"
2196 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q")
2197 (match_operand:BLK 1 "memory_operand" "Q,Q,Q"))
2198 (use (match_operand 2 "nonmemory_operand" "n,a,a"))
2199 (use (match_operand 3 "immediate_operand" "X,R,X"))
2200 (clobber (match_scratch 4 "=X,X,&a"))]
2201 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2202 && GET_MODE (operands[4]) == Pmode"
2204 [(set_attr "type" "cs")])
2207 [(set (match_operand:BLK 0 "memory_operand" "")
2208 (match_operand:BLK 1 "memory_operand" ""))
2209 (use (match_operand 2 "const_int_operand" ""))
2210 (use (match_operand 3 "immediate_operand" ""))
2211 (clobber (scratch))]
2214 [(set (match_dup 0) (match_dup 1))
2215 (use (match_dup 2))])]
2216 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
2219 [(set (match_operand:BLK 0 "memory_operand" "")
2220 (match_operand:BLK 1 "memory_operand" ""))
2221 (use (match_operand 2 "register_operand" ""))
2222 (use (match_operand 3 "memory_operand" ""))
2223 (clobber (scratch))]
2226 [(unspec [(match_dup 2) (match_dup 3)
2227 (const_int 0)] UNSPEC_EXECUTE)
2228 (set (match_dup 0) (match_dup 1))
2229 (use (const_int 1))])]
2233 [(set (match_operand:BLK 0 "memory_operand" "")
2234 (match_operand:BLK 1 "memory_operand" ""))
2235 (use (match_operand 2 "register_operand" ""))
2236 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2237 (clobber (match_operand 3 "register_operand" ""))]
2238 "reload_completed && TARGET_CPU_ZARCH"
2239 [(set (match_dup 3) (label_ref (match_dup 4)))
2241 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
2242 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
2243 (set (match_dup 0) (match_dup 1))
2244 (use (const_int 1))])]
2245 "operands[4] = gen_label_rtx ();")
2247 ; Move a block of arbitrary length.
2249 (define_expand "movmem_long"
2251 [(clobber (match_dup 2))
2252 (clobber (match_dup 3))
2253 (set (match_operand:BLK 0 "memory_operand" "")
2254 (match_operand:BLK 1 "memory_operand" ""))
2255 (use (match_operand 2 "general_operand" ""))
2257 (clobber (reg:CC CC_REGNUM))])]
2260 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2261 rtx reg0 = gen_reg_rtx (dword_mode);
2262 rtx reg1 = gen_reg_rtx (dword_mode);
2263 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2264 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2265 rtx len0 = gen_lowpart (Pmode, reg0);
2266 rtx len1 = gen_lowpart (Pmode, reg1);
2268 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2269 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2270 emit_move_insn (len0, operands[2]);
2272 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2273 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2274 emit_move_insn (len1, operands[2]);
2276 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2277 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2282 (define_insn "*movmem_long"
2283 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
2284 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
2285 (set (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
2286 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0)))
2289 (clobber (reg:CC CC_REGNUM))]
2291 "mvcle\t%0,%1,0\;jo\t.-4"
2292 [(set_attr "length" "8")
2293 (set_attr "type" "vs")])
2296 ; setmemM instruction pattern(s).
2299 (define_expand "setmem<mode>"
2300 [(set (match_operand:BLK 0 "memory_operand" "")
2301 (match_operand:QI 2 "general_operand" ""))
2302 (use (match_operand:GPR 1 "general_operand" ""))
2303 (match_operand 3 "" "")]
2305 "s390_expand_setmem (operands[0], operands[1], operands[2]); DONE;")
2307 ; Clear a block that is up to 256 bytes in length.
2308 ; The block length is taken as (operands[1] % 256) + 1.
2310 (define_expand "clrmem_short"
2312 [(set (match_operand:BLK 0 "memory_operand" "")
2314 (use (match_operand 1 "nonmemory_operand" ""))
2315 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2316 (clobber (match_dup 2))
2317 (clobber (reg:CC CC_REGNUM))])]
2319 "operands[2] = gen_rtx_SCRATCH (Pmode);")
2321 (define_insn "*clrmem_short"
2322 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q")
2324 (use (match_operand 1 "nonmemory_operand" "n,a,a"))
2325 (use (match_operand 2 "immediate_operand" "X,R,X"))
2326 (clobber (match_scratch 3 "=X,X,&a"))
2327 (clobber (reg:CC CC_REGNUM))]
2328 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
2329 && GET_MODE (operands[3]) == Pmode"
2331 [(set_attr "type" "cs")])
2334 [(set (match_operand:BLK 0 "memory_operand" "")
2336 (use (match_operand 1 "const_int_operand" ""))
2337 (use (match_operand 2 "immediate_operand" ""))
2339 (clobber (reg:CC CC_REGNUM))]
2342 [(set (match_dup 0) (const_int 0))
2344 (clobber (reg:CC CC_REGNUM))])]
2345 "operands[1] = GEN_INT ((INTVAL (operands[1]) & 0xff) + 1);")
2348 [(set (match_operand:BLK 0 "memory_operand" "")
2350 (use (match_operand 1 "register_operand" ""))
2351 (use (match_operand 2 "memory_operand" ""))
2353 (clobber (reg:CC CC_REGNUM))]
2356 [(unspec [(match_dup 1) (match_dup 2)
2357 (const_int 0)] UNSPEC_EXECUTE)
2358 (set (match_dup 0) (const_int 0))
2360 (clobber (reg:CC CC_REGNUM))])]
2364 [(set (match_operand:BLK 0 "memory_operand" "")
2366 (use (match_operand 1 "register_operand" ""))
2367 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2368 (clobber (match_operand 2 "register_operand" ""))
2369 (clobber (reg:CC CC_REGNUM))]
2370 "reload_completed && TARGET_CPU_ZARCH"
2371 [(set (match_dup 2) (label_ref (match_dup 3)))
2373 [(unspec [(match_dup 1) (mem:BLK (match_dup 2))
2374 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
2375 (set (match_dup 0) (const_int 0))
2377 (clobber (reg:CC CC_REGNUM))])]
2378 "operands[3] = gen_label_rtx ();")
2380 ; Initialize a block of arbitrary length with (operands[2] % 256).
2382 (define_expand "setmem_long"
2384 [(clobber (match_dup 1))
2385 (set (match_operand:BLK 0 "memory_operand" "")
2386 (match_operand 2 "shift_count_or_setmem_operand" ""))
2387 (use (match_operand 1 "general_operand" ""))
2389 (clobber (reg:CC CC_REGNUM))])]
2392 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2393 rtx reg0 = gen_reg_rtx (dword_mode);
2394 rtx reg1 = gen_reg_rtx (dword_mode);
2395 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2396 rtx len0 = gen_lowpart (Pmode, reg0);
2398 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2399 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2400 emit_move_insn (len0, operands[1]);
2402 emit_move_insn (reg1, const0_rtx);
2404 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2409 (define_insn "*setmem_long"
2410 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
2411 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
2412 (match_operand 2 "shift_count_or_setmem_operand" "Y"))
2414 (use (match_operand:<DBL> 1 "register_operand" "d"))
2415 (clobber (reg:CC CC_REGNUM))]
2417 "mvcle\t%0,%1,%Y2\;jo\t.-4"
2418 [(set_attr "length" "8")
2419 (set_attr "type" "vs")])
2421 (define_insn "*setmem_long_and"
2422 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
2423 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
2424 (and (match_operand 2 "shift_count_or_setmem_operand" "Y")
2425 (match_operand 4 "const_int_operand" "n")))
2427 (use (match_operand:<DBL> 1 "register_operand" "d"))
2428 (clobber (reg:CC CC_REGNUM))]
2429 "(INTVAL (operands[4]) & 255) == 255"
2430 "mvcle\t%0,%1,%Y2\;jo\t.-4"
2431 [(set_attr "length" "8")
2432 (set_attr "type" "vs")])
2434 ; cmpmemM instruction pattern(s).
2437 (define_expand "cmpmemsi"
2438 [(set (match_operand:SI 0 "register_operand" "")
2439 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2440 (match_operand:BLK 2 "memory_operand" "") ) )
2441 (use (match_operand:SI 3 "general_operand" ""))
2442 (use (match_operand:SI 4 "" ""))]
2444 "s390_expand_cmpmem (operands[0], operands[1],
2445 operands[2], operands[3]); DONE;")
2447 ; Compare a block that is up to 256 bytes in length.
2448 ; The block length is taken as (operands[2] % 256) + 1.
2450 (define_expand "cmpmem_short"
2452 [(set (reg:CCU CC_REGNUM)
2453 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2454 (match_operand:BLK 1 "memory_operand" "")))
2455 (use (match_operand 2 "nonmemory_operand" ""))
2456 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2457 (clobber (match_dup 3))])]
2459 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2461 (define_insn "*cmpmem_short"
2462 [(set (reg:CCU CC_REGNUM)
2463 (compare:CCU (match_operand:BLK 0 "memory_operand" "Q,Q,Q")
2464 (match_operand:BLK 1 "memory_operand" "Q,Q,Q")))
2465 (use (match_operand 2 "nonmemory_operand" "n,a,a"))
2466 (use (match_operand 3 "immediate_operand" "X,R,X"))
2467 (clobber (match_scratch 4 "=X,X,&a"))]
2468 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2469 && GET_MODE (operands[4]) == Pmode"
2471 [(set_attr "type" "cs")])
2474 [(set (reg:CCU CC_REGNUM)
2475 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2476 (match_operand:BLK 1 "memory_operand" "")))
2477 (use (match_operand 2 "const_int_operand" ""))
2478 (use (match_operand 3 "immediate_operand" ""))
2479 (clobber (scratch))]
2482 [(set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
2483 (use (match_dup 2))])]
2484 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
2487 [(set (reg:CCU CC_REGNUM)
2488 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2489 (match_operand:BLK 1 "memory_operand" "")))
2490 (use (match_operand 2 "register_operand" ""))
2491 (use (match_operand 3 "memory_operand" ""))
2492 (clobber (scratch))]
2495 [(unspec [(match_dup 2) (match_dup 3)
2496 (const_int 0)] UNSPEC_EXECUTE)
2497 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
2498 (use (const_int 1))])]
2502 [(set (reg:CCU CC_REGNUM)
2503 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2504 (match_operand:BLK 1 "memory_operand" "")))
2505 (use (match_operand 2 "register_operand" ""))
2506 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2507 (clobber (match_operand 3 "register_operand" ""))]
2508 "reload_completed && TARGET_CPU_ZARCH"
2509 [(set (match_dup 3) (label_ref (match_dup 4)))
2511 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
2512 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
2513 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
2514 (use (const_int 1))])]
2515 "operands[4] = gen_label_rtx ();")
2517 ; Compare a block of arbitrary length.
2519 (define_expand "cmpmem_long"
2521 [(clobber (match_dup 2))
2522 (clobber (match_dup 3))
2523 (set (reg:CCU CC_REGNUM)
2524 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
2525 (match_operand:BLK 1 "memory_operand" "")))
2526 (use (match_operand 2 "general_operand" ""))
2527 (use (match_dup 3))])]
2530 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2531 rtx reg0 = gen_reg_rtx (dword_mode);
2532 rtx reg1 = gen_reg_rtx (dword_mode);
2533 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2534 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2535 rtx len0 = gen_lowpart (Pmode, reg0);
2536 rtx len1 = gen_lowpart (Pmode, reg1);
2538 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2539 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2540 emit_move_insn (len0, operands[2]);
2542 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2543 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2544 emit_move_insn (len1, operands[2]);
2546 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2547 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2552 (define_insn "*cmpmem_long"
2553 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
2554 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
2555 (set (reg:CCU CC_REGNUM)
2556 (compare:CCU (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
2557 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0))))
2559 (use (match_dup 3))]
2561 "clcle\t%0,%1,0\;jo\t.-4"
2562 [(set_attr "length" "8")
2563 (set_attr "type" "vs")])
2565 ; Convert CCUmode condition code to integer.
2566 ; Result is zero if EQ, positive if LTU, negative if GTU.
2568 (define_insn_and_split "cmpint"
2569 [(set (match_operand:SI 0 "register_operand" "=d")
2570 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2572 (clobber (reg:CC CC_REGNUM))]
2576 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
2578 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))
2579 (clobber (reg:CC CC_REGNUM))])])
2581 (define_insn_and_split "*cmpint_cc"
2582 [(set (reg CC_REGNUM)
2583 (compare (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2586 (set (match_operand:SI 0 "register_operand" "=d")
2587 (unspec:SI [(match_dup 1)] UNSPEC_CMPINT))]
2588 "s390_match_ccmode (insn, CCSmode)"
2590 "&& reload_completed"
2591 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
2593 [(set (match_dup 2) (match_dup 3))
2594 (set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))])]
2596 rtx result = gen_rtx_ASHIFTRT (SImode, operands[0], GEN_INT (30));
2597 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
2598 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
2601 (define_insn_and_split "*cmpint_sign"
2602 [(set (match_operand:DI 0 "register_operand" "=d")
2603 (sign_extend:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2605 (clobber (reg:CC CC_REGNUM))]
2608 "&& reload_completed"
2609 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
2611 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))
2612 (clobber (reg:CC CC_REGNUM))])])
2614 (define_insn_and_split "*cmpint_sign_cc"
2615 [(set (reg CC_REGNUM)
2616 (compare (ashiftrt:DI (ashift:DI (subreg:DI
2617 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
2619 (const_int 32)) (const_int 32))
2621 (set (match_operand:DI 0 "register_operand" "=d")
2622 (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_CMPINT)))]
2623 "s390_match_ccmode (insn, CCSmode) && TARGET_64BIT"
2625 "&& reload_completed"
2626 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
2628 [(set (match_dup 2) (match_dup 3))
2629 (set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))])]
2631 rtx result = gen_rtx_ASHIFTRT (DImode, operands[0], GEN_INT (62));
2632 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
2633 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
2638 ;;- Conversion instructions.
2641 (define_insn "*sethighpartsi"
2642 [(set (match_operand:SI 0 "register_operand" "=d,d")
2643 (unspec:SI [(match_operand:BLK 1 "s_operand" "Q,S")
2644 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
2645 (clobber (reg:CC CC_REGNUM))]
2650 [(set_attr "op_type" "RS,RSY")])
2652 (define_insn "*sethighpartdi_64"
2653 [(set (match_operand:DI 0 "register_operand" "=d")
2654 (unspec:DI [(match_operand:BLK 1 "s_operand" "QS")
2655 (match_operand 2 "const_int_operand" "n")] UNSPEC_ICM))
2656 (clobber (reg:CC CC_REGNUM))]
2659 [(set_attr "op_type" "RSY")])
2661 (define_insn "*sethighpartdi_31"
2662 [(set (match_operand:DI 0 "register_operand" "=d,d")
2663 (unspec:DI [(match_operand:BLK 1 "s_operand" "Q,S")
2664 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
2665 (clobber (reg:CC CC_REGNUM))]
2670 [(set_attr "op_type" "RS,RSY")])
2672 (define_insn_and_split "*extzv<mode>"
2673 [(set (match_operand:GPR 0 "register_operand" "=d")
2674 (zero_extract:GPR (match_operand:QI 1 "s_operand" "QS")
2675 (match_operand 2 "const_int_operand" "n")
2677 (clobber (reg:CC CC_REGNUM))]
2678 "INTVAL (operands[2]) > 0
2679 && INTVAL (operands[2]) <= GET_MODE_BITSIZE (SImode)"
2681 "&& reload_completed"
2683 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
2684 (clobber (reg:CC CC_REGNUM))])
2685 (set (match_dup 0) (lshiftrt:GPR (match_dup 0) (match_dup 2)))]
2687 int bitsize = INTVAL (operands[2]);
2688 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
2689 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
2691 operands[1] = adjust_address (operands[1], BLKmode, 0);
2692 set_mem_size (operands[1], GEN_INT (size));
2693 operands[2] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - bitsize);
2694 operands[3] = GEN_INT (mask);
2697 (define_insn_and_split "*extv<mode>"
2698 [(set (match_operand:GPR 0 "register_operand" "=d")
2699 (sign_extract:GPR (match_operand:QI 1 "s_operand" "QS")
2700 (match_operand 2 "const_int_operand" "n")
2702 (clobber (reg:CC CC_REGNUM))]
2703 "INTVAL (operands[2]) > 0
2704 && INTVAL (operands[2]) <= GET_MODE_BITSIZE (SImode)"
2706 "&& reload_completed"
2708 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
2709 (clobber (reg:CC CC_REGNUM))])
2711 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
2712 (clobber (reg:CC CC_REGNUM))])]
2714 int bitsize = INTVAL (operands[2]);
2715 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
2716 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
2718 operands[1] = adjust_address (operands[1], BLKmode, 0);
2719 set_mem_size (operands[1], GEN_INT (size));
2720 operands[2] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - bitsize);
2721 operands[3] = GEN_INT (mask);
2725 ; insv instruction patterns
2728 (define_expand "insv"
2729 [(set (zero_extract (match_operand 0 "nonimmediate_operand" "")
2730 (match_operand 1 "const_int_operand" "")
2731 (match_operand 2 "const_int_operand" ""))
2732 (match_operand 3 "general_operand" ""))]
2735 if (s390_expand_insv (operands[0], operands[1], operands[2], operands[3]))
2740 (define_insn "*insv<mode>_mem_reg"
2741 [(set (zero_extract:P (match_operand:QI 0 "memory_operand" "+Q,S")
2742 (match_operand 1 "const_int_operand" "n,n")
2744 (match_operand:P 2 "register_operand" "d,d"))]
2745 "INTVAL (operands[1]) > 0
2746 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
2747 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
2749 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
2751 operands[1] = GEN_INT ((1ul << size) - 1);
2752 return (which_alternative == 0) ? "stcm\t%2,%1,%S0"
2753 : "stcmy\t%2,%1,%S0";
2755 [(set_attr "op_type" "RS,RSY")])
2757 (define_insn "*insvdi_mem_reghigh"
2758 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "+QS")
2759 (match_operand 1 "const_int_operand" "n")
2761 (lshiftrt:DI (match_operand:DI 2 "register_operand" "d")
2764 && INTVAL (operands[1]) > 0
2765 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
2766 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
2768 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
2770 operands[1] = GEN_INT ((1ul << size) - 1);
2771 return "stcmh\t%2,%1,%S0";
2773 [(set_attr "op_type" "RSY")])
2775 (define_insn "*insv<mode>_reg_imm"
2776 [(set (zero_extract:P (match_operand:P 0 "register_operand" "+d")
2778 (match_operand 1 "const_int_operand" "n"))
2779 (match_operand 2 "const_int_operand" "n"))]
2781 && INTVAL (operands[1]) >= 0
2782 && INTVAL (operands[1]) < BITS_PER_WORD
2783 && INTVAL (operands[1]) % 16 == 0"
2785 switch (BITS_PER_WORD - INTVAL (operands[1]))
2787 case 64: return "iihh\t%0,%x2"; break;
2788 case 48: return "iihl\t%0,%x2"; break;
2789 case 32: return "iilh\t%0,%x2"; break;
2790 case 16: return "iill\t%0,%x2"; break;
2791 default: gcc_unreachable();
2794 [(set_attr "op_type" "RI")])
2796 (define_insn "*insv<mode>_reg_extimm"
2797 [(set (zero_extract:P (match_operand:P 0 "register_operand" "+d")
2799 (match_operand 1 "const_int_operand" "n"))
2800 (match_operand 2 "const_int_operand" "n"))]
2802 && INTVAL (operands[1]) >= 0
2803 && INTVAL (operands[1]) < BITS_PER_WORD
2804 && INTVAL (operands[1]) % 32 == 0"
2806 switch (BITS_PER_WORD - INTVAL (operands[1]))
2808 case 64: return "iihf\t%0,%o2"; break;
2809 case 32: return "iilf\t%0,%o2"; break;
2810 default: gcc_unreachable();
2813 [(set_attr "op_type" "RIL")])
2816 ; extendsidi2 instruction pattern(s).
2819 (define_expand "extendsidi2"
2820 [(set (match_operand:DI 0 "register_operand" "")
2821 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2826 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2827 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2828 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2829 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2834 (define_insn "*extendsidi2"
2835 [(set (match_operand:DI 0 "register_operand" "=d,d")
2836 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2841 [(set_attr "op_type" "RRE,RXY")])
2844 ; extend(hi|qi)di2 instruction pattern(s).
2847 (define_expand "extend<mode>di2"
2848 [(set (match_operand:DI 0 "register_operand" "")
2849 (sign_extend:DI (match_operand:HQI 1 "nonimmediate_operand" "")))]
2854 rtx tmp = gen_reg_rtx (SImode);
2855 emit_insn (gen_extend<mode>si2 (tmp, operands[1]));
2856 emit_insn (gen_extendsidi2 (operands[0], tmp));
2859 else if (!TARGET_EXTIMM)
2861 rtx bitcount = GEN_INT (GET_MODE_BITSIZE (DImode) -
2862 GET_MODE_BITSIZE (<MODE>mode));
2863 operands[1] = gen_lowpart (DImode, operands[1]);
2864 emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount));
2865 emit_insn (gen_ashrdi3 (operands[0], operands[0], bitcount));
2870 (define_insn "*extendhidi2_extimm"
2871 [(set (match_operand:DI 0 "register_operand" "=d,d")
2872 (sign_extend:DI (match_operand:HI 1 "nonimmediate_operand" "d,m")))]
2873 "TARGET_64BIT && TARGET_EXTIMM"
2877 [(set_attr "op_type" "RRE,RXY")])
2879 (define_insn "*extendhidi2"
2880 [(set (match_operand:DI 0 "register_operand" "=d")
2881 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2884 [(set_attr "op_type" "RXY")])
2886 (define_insn "*extendqidi2_extimm"
2887 [(set (match_operand:DI 0 "register_operand" "=d,d")
2888 (sign_extend:DI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
2889 "TARGET_64BIT && TARGET_EXTIMM"
2893 [(set_attr "op_type" "RRE,RXY")])
2895 (define_insn "*extendqidi2"
2896 [(set (match_operand:DI 0 "register_operand" "=d")
2897 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2898 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2900 [(set_attr "op_type" "RXY")])
2902 (define_insn_and_split "*extendqidi2_short_displ"
2903 [(set (match_operand:DI 0 "register_operand" "=d")
2904 (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))
2905 (clobber (reg:CC CC_REGNUM))]
2906 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2908 "&& reload_completed"
2910 [(set (match_dup 0) (unspec:DI [(match_dup 1) (const_int 8)] UNSPEC_ICM))
2911 (clobber (reg:CC CC_REGNUM))])
2913 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2914 (clobber (reg:CC CC_REGNUM))])]
2916 operands[1] = adjust_address (operands[1], BLKmode, 0);
2917 set_mem_size (operands[1], GEN_INT (GET_MODE_SIZE (QImode)));
2921 ; extend(hi|qi)si2 instruction pattern(s).
2924 (define_expand "extend<mode>si2"
2925 [(set (match_operand:SI 0 "register_operand" "")
2926 (sign_extend:SI (match_operand:HQI 1 "nonimmediate_operand" "")))]
2931 rtx bitcount = GEN_INT (GET_MODE_BITSIZE(SImode) -
2932 GET_MODE_BITSIZE(<MODE>mode));
2933 operands[1] = gen_lowpart (SImode, operands[1]);
2934 emit_insn (gen_ashlsi3 (operands[0], operands[1], bitcount));
2935 emit_insn (gen_ashrsi3 (operands[0], operands[0], bitcount));
2940 (define_insn "*extendhisi2_extimm"
2941 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
2942 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,R,T")))]
2948 [(set_attr "op_type" "RRE,RX,RXY")])
2950 (define_insn "*extendhisi2"
2951 [(set (match_operand:SI 0 "register_operand" "=d,d")
2952 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2957 [(set_attr "op_type" "RX,RXY")])
2959 (define_insn "*extendqisi2_extimm"
2960 [(set (match_operand:SI 0 "register_operand" "=d,d")
2961 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
2966 [(set_attr "op_type" "RRE,RXY")])
2968 (define_insn "*extendqisi2"
2969 [(set (match_operand:SI 0 "register_operand" "=d")
2970 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2971 "TARGET_LONG_DISPLACEMENT && !TARGET_EXTIMM"
2973 [(set_attr "op_type" "RXY")])
2975 (define_insn_and_split "*extendqisi2_short_displ"
2976 [(set (match_operand:SI 0 "register_operand" "=d")
2977 (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))
2978 (clobber (reg:CC CC_REGNUM))]
2979 "!TARGET_LONG_DISPLACEMENT"
2981 "&& reload_completed"
2983 [(set (match_dup 0) (unspec:SI [(match_dup 1) (const_int 8)] UNSPEC_ICM))
2984 (clobber (reg:CC CC_REGNUM))])
2986 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2987 (clobber (reg:CC CC_REGNUM))])]
2989 operands[1] = adjust_address (operands[1], BLKmode, 0);
2990 set_mem_size (operands[1], GEN_INT (GET_MODE_SIZE (QImode)));
2994 ; extendqihi2 instruction pattern(s).
2999 ; zero_extendsidi2 instruction pattern(s).
3002 (define_expand "zero_extendsidi2"
3003 [(set (match_operand:DI 0 "register_operand" "")
3004 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
3009 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
3010 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
3011 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
3016 (define_insn "*zero_extendsidi2"
3017 [(set (match_operand:DI 0 "register_operand" "=d,d")
3018 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
3023 [(set_attr "op_type" "RRE,RXY")])
3026 ; zero_extend(hi|qi)di2 instruction pattern(s).
3029 (define_expand "zero_extend<mode>di2"
3030 [(set (match_operand:DI 0 "register_operand" "")
3031 (zero_extend:DI (match_operand:HQI 1 "nonimmediate_operand" "")))]
3036 rtx tmp = gen_reg_rtx (SImode);
3037 emit_insn (gen_zero_extend<mode>si2 (tmp, operands[1]));
3038 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
3041 else if (!TARGET_EXTIMM)
3043 rtx bitcount = GEN_INT (GET_MODE_BITSIZE(DImode) -
3044 GET_MODE_BITSIZE(<MODE>mode));
3045 operands[1] = gen_lowpart (DImode, operands[1]);
3046 emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount));
3047 emit_insn (gen_lshrdi3 (operands[0], operands[0], bitcount));
3052 (define_insn "*zero_extend<mode>di2_extimm"
3053 [(set (match_operand:DI 0 "register_operand" "=d,d")
3054 (zero_extend:DI (match_operand:HQI 1 "nonimmediate_operand" "d,m")))]
3055 "TARGET_64BIT && TARGET_EXTIMM"
3059 [(set_attr "op_type" "RRE,RXY")])
3061 (define_insn "*zero_extend<mode>di2"
3062 [(set (match_operand:DI 0 "register_operand" "=d")
3063 (zero_extend:DI (match_operand:HQI 1 "memory_operand" "m")))]
3064 "TARGET_64BIT && !TARGET_EXTIMM"
3066 [(set_attr "op_type" "RXY")])
3069 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
3072 (define_insn "*llgt_sidi"
3073 [(set (match_operand:DI 0 "register_operand" "=d")
3074 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
3075 (const_int 2147483647)))]
3078 [(set_attr "op_type" "RXE")])
3080 (define_insn_and_split "*llgt_sidi_split"
3081 [(set (match_operand:DI 0 "register_operand" "=d")
3082 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
3083 (const_int 2147483647)))
3084 (clobber (reg:CC CC_REGNUM))]
3087 "&& reload_completed"
3089 (and:DI (subreg:DI (match_dup 1) 0)
3090 (const_int 2147483647)))]
3093 (define_insn "*llgt_sisi"
3094 [(set (match_operand:SI 0 "register_operand" "=d,d")
3095 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
3096 (const_int 2147483647)))]
3101 [(set_attr "op_type" "RRE,RXE")])
3103 (define_insn "*llgt_didi"
3104 [(set (match_operand:DI 0 "register_operand" "=d,d")
3105 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
3106 (const_int 2147483647)))]
3111 [(set_attr "op_type" "RRE,RXE")])
3114 [(set (match_operand:GPR 0 "register_operand" "")
3115 (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "")
3116 (const_int 2147483647)))
3117 (clobber (reg:CC CC_REGNUM))]
3118 "TARGET_ZARCH && reload_completed"
3120 (and:GPR (match_dup 1)
3121 (const_int 2147483647)))]
3125 ; zero_extend(hi|qi)si2 instruction pattern(s).
3128 (define_expand "zero_extend<mode>si2"
3129 [(set (match_operand:SI 0 "register_operand" "")
3130 (zero_extend:SI (match_operand:HQI 1 "nonimmediate_operand" "")))]
3135 operands[1] = gen_lowpart (SImode, operands[1]);
3136 emit_insn (gen_andsi3 (operands[0], operands[1],
3137 GEN_INT ((1 << GET_MODE_BITSIZE(<MODE>mode)) - 1)));
3142 (define_insn "*zero_extend<mode>si2_extimm"
3143 [(set (match_operand:SI 0 "register_operand" "=d,d")
3144 (zero_extend:SI (match_operand:HQI 1 "nonimmediate_operand" "d,m")))]
3149 [(set_attr "op_type" "RRE,RXY")])
3151 (define_insn "*zero_extend<mode>si2_64"
3152 [(set (match_operand:SI 0 "register_operand" "=d")
3153 (zero_extend:SI (match_operand:HQI 1 "memory_operand" "m")))]
3154 "TARGET_ZARCH && !TARGET_EXTIMM"
3156 [(set_attr "op_type" "RXY")])
3158 (define_insn_and_split "*zero_extendhisi2_31"
3159 [(set (match_operand:SI 0 "register_operand" "=&d")
3160 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
3161 (clobber (reg:CC CC_REGNUM))]
3164 "&& reload_completed"
3165 [(set (match_dup 0) (const_int 0))
3167 [(set (strict_low_part (match_dup 2)) (match_dup 1))
3168 (clobber (reg:CC CC_REGNUM))])]
3169 "operands[2] = gen_lowpart (HImode, operands[0]);")
3171 (define_insn_and_split "*zero_extendqisi2_31"
3172 [(set (match_operand:SI 0 "register_operand" "=&d")
3173 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
3176 "&& reload_completed"
3177 [(set (match_dup 0) (const_int 0))
3178 (set (strict_low_part (match_dup 2)) (match_dup 1))]
3179 "operands[2] = gen_lowpart (QImode, operands[0]);")
3182 ; zero_extendqihi2 instruction pattern(s).
3185 (define_expand "zero_extendqihi2"
3186 [(set (match_operand:HI 0 "register_operand" "")
3187 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
3188 "TARGET_ZARCH && !TARGET_EXTIMM"
3190 operands[1] = gen_lowpart (HImode, operands[1]);
3191 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
3195 (define_insn "*zero_extendqihi2_64"
3196 [(set (match_operand:HI 0 "register_operand" "=d")
3197 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
3198 "TARGET_ZARCH && !TARGET_EXTIMM"
3200 [(set_attr "op_type" "RXY")])
3202 (define_insn_and_split "*zero_extendqihi2_31"
3203 [(set (match_operand:HI 0 "register_operand" "=&d")
3204 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
3207 "&& reload_completed"
3208 [(set (match_dup 0) (const_int 0))
3209 (set (strict_low_part (match_dup 2)) (match_dup 1))]
3210 "operands[2] = gen_lowpart (QImode, operands[0]);")
3214 ; fixuns_trunc(sf|df)(si|di)2 and fix_trunc(sf|df)(si|di)2 instruction pattern(s).
3217 (define_expand "fixuns_trunc<FPR:mode><GPR:mode>2"
3218 [(set (match_operand:GPR 0 "register_operand" "")
3219 (unsigned_fix:GPR (match_operand:FPR 1 "register_operand" "")))]
3220 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3222 rtx label1 = gen_label_rtx ();
3223 rtx label2 = gen_label_rtx ();
3224 rtx temp = gen_reg_rtx (<FPR:MODE>mode);
3225 REAL_VALUE_TYPE cmp, sub;
3227 operands[1] = force_reg (<FPR:MODE>mode, operands[1]);
3228 real_2expN (&cmp, GET_MODE_BITSIZE(<GPR:MODE>mode) - 1);
3229 real_2expN (&sub, GET_MODE_BITSIZE(<GPR:MODE>mode));
3231 emit_insn (gen_cmp<FPR:mode> (operands[1],
3232 CONST_DOUBLE_FROM_REAL_VALUE (cmp, <FPR:MODE>mode)));
3233 emit_jump_insn (gen_blt (label1));
3234 emit_insn (gen_sub<FPR:mode>3 (temp, operands[1],
3235 CONST_DOUBLE_FROM_REAL_VALUE (sub, <FPR:MODE>mode)));
3236 emit_insn (gen_fix_trunc<FPR:mode><GPR:mode>2_ieee (operands[0], temp,
3240 emit_label (label1);
3241 emit_insn (gen_fix_trunc<FPR:mode><GPR:mode>2_ieee (operands[0],
3242 operands[1], GEN_INT(5)));
3243 emit_label (label2);
3247 (define_expand "fix_trunc<mode>di2"
3248 [(set (match_operand:DI 0 "register_operand" "")
3249 (fix:DI (match_operand:DSF 1 "nonimmediate_operand" "")))]
3250 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3252 operands[1] = force_reg (<MODE>mode, operands[1]);
3253 emit_insn (gen_fix_trunc<mode>di2_ieee (operands[0], operands[1],
3258 (define_insn "fix_trunc<FPR:mode><GPR:mode>2_ieee"
3259 [(set (match_operand:GPR 0 "register_operand" "=d")
3260 (fix:GPR (match_operand:FPR 1 "register_operand" "f")))
3261 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
3262 (clobber (reg:CC CC_REGNUM))]
3263 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3264 "c<GPR:gf><FPR:xde>br\t%0,%h2,%1"
3265 [(set_attr "op_type" "RRE")
3266 (set_attr "type" "ftoi")])
3269 ; fix_trunctf(si|di)2 instruction pattern(s).
3272 (define_expand "fix_trunctf<mode>2"
3273 [(parallel [(set (match_operand:GPR 0 "register_operand" "")
3274 (fix:GPR (match_operand:TF 1 "register_operand" "")))
3275 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
3276 (clobber (reg:CC CC_REGNUM))])]
3277 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3281 ; fix_truncdfsi2 instruction pattern(s).
3284 (define_expand "fix_truncdfsi2"
3285 [(set (match_operand:SI 0 "register_operand" "")
3286 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
3289 if (TARGET_IBM_FLOAT)
3291 /* This is the algorithm from POP chapter A.5.7.2. */
3293 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3294 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
3295 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
3297 operands[1] = force_reg (DFmode, operands[1]);
3298 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
3299 two31r, two32, temp));
3303 operands[1] = force_reg (DFmode, operands[1]);
3304 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3310 (define_insn "fix_truncdfsi2_ibm"
3311 [(set (match_operand:SI 0 "register_operand" "=d")
3312 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
3313 (use (match_operand:DI 2 "immediate_operand" "m"))
3314 (use (match_operand:DI 3 "immediate_operand" "m"))
3315 (use (match_operand:BLK 4 "memory_operand" "m"))
3316 (clobber (reg:CC CC_REGNUM))]
3317 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3319 output_asm_insn ("sd\t%1,%2", operands);
3320 output_asm_insn ("aw\t%1,%3", operands);
3321 output_asm_insn ("std\t%1,%4", operands);
3322 output_asm_insn ("xi\t%N4,128", operands);
3325 [(set_attr "length" "20")])
3328 ; fix_truncsfsi2 instruction pattern(s).
3331 (define_expand "fix_truncsfsi2"
3332 [(set (match_operand:SI 0 "register_operand" "")
3333 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
3336 if (TARGET_IBM_FLOAT)
3338 /* Convert to DFmode and then use the POP algorithm. */
3339 rtx temp = gen_reg_rtx (DFmode);
3340 emit_insn (gen_extendsfdf2 (temp, operands[1]));
3341 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
3345 operands[1] = force_reg (SFmode, operands[1]);
3346 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3353 ; float(si|di)(tf|df|sf)2 instruction pattern(s).
3356 (define_insn "floatdi<mode>2"
3357 [(set (match_operand:FPR 0 "register_operand" "=f")
3358 (float:FPR (match_operand:DI 1 "register_operand" "d")))]
3359 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3361 [(set_attr "op_type" "RRE")
3362 (set_attr "type" "itof" )])
3364 (define_insn "floatsi<mode>2_ieee"
3365 [(set (match_operand:FPR 0 "register_operand" "=f")
3366 (float:FPR (match_operand:SI 1 "register_operand" "d")))]
3367 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3369 [(set_attr "op_type" "RRE")
3370 (set_attr "type" "itof" )])
3374 ; floatsi(tf|df)2 instruction pattern(s).
3377 (define_expand "floatsitf2"
3378 [(set (match_operand:TF 0 "register_operand" "")
3379 (float:TF (match_operand:SI 1 "register_operand" "")))]
3380 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3383 (define_expand "floatsidf2"
3384 [(set (match_operand:DF 0 "register_operand" "")
3385 (float:DF (match_operand:SI 1 "register_operand" "")))]
3388 if (TARGET_IBM_FLOAT)
3390 /* This is the algorithm from POP chapter A.5.7.1. */
3392 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3393 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
3395 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
3400 (define_insn "floatsidf2_ibm"
3401 [(set (match_operand:DF 0 "register_operand" "=f")
3402 (float:DF (match_operand:SI 1 "register_operand" "d")))
3403 (use (match_operand:DI 2 "immediate_operand" "m"))
3404 (use (match_operand:BLK 3 "memory_operand" "m"))
3405 (clobber (reg:CC CC_REGNUM))]
3406 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3408 output_asm_insn ("st\t%1,%N3", operands);
3409 output_asm_insn ("xi\t%N3,128", operands);
3410 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3411 output_asm_insn ("ld\t%0,%3", operands);
3414 [(set_attr "length" "20")])
3417 ; floatsisf2 instruction pattern(s).
3420 (define_expand "floatsisf2"
3421 [(set (match_operand:SF 0 "register_operand" "")
3422 (float:SF (match_operand:SI 1 "register_operand" "")))]
3425 if (TARGET_IBM_FLOAT)
3427 /* Use the POP algorithm to convert to DFmode and then truncate. */
3428 rtx temp = gen_reg_rtx (DFmode);
3429 emit_insn (gen_floatsidf2 (temp, operands[1]));
3430 emit_insn (gen_truncdfsf2 (operands[0], temp));
3436 ; truncdfsf2 instruction pattern(s).
3439 (define_expand "truncdfsf2"
3440 [(set (match_operand:SF 0 "register_operand" "")
3441 (float_truncate:SF (match_operand:DF 1 "register_operand" "")))]
3445 (define_insn "truncdfsf2_ieee"
3446 [(set (match_operand:SF 0 "register_operand" "=f")
3447 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
3448 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3450 [(set_attr "op_type" "RRE")
3451 (set_attr "type" "ftruncdf")])
3453 (define_insn "truncdfsf2_ibm"
3454 [(set (match_operand:SF 0 "register_operand" "=f,f")
3455 (float_truncate:SF (match_operand:DF 1 "nonimmediate_operand" "f,R")))]
3456 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3460 [(set_attr "op_type" "RR,RX")
3461 (set_attr "type" "floadsf")])
3464 ; trunctfdf2 instruction pattern(s).
3467 (define_expand "trunctfdf2"
3469 [(set (match_operand:DF 0 "register_operand" "")
3470 (float_truncate:DF (match_operand:TF 1 "register_operand" "")))
3471 (clobber (match_scratch:TF 2 "=f"))])]
3475 (define_insn "*trunctfdf2_ieee"
3476 [(set (match_operand:DF 0 "register_operand" "=f")
3477 (float_truncate:DF (match_operand:TF 1 "register_operand" "f")))
3478 (clobber (match_scratch:TF 2 "=f"))]
3479 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3480 "ldxbr\t%2,%1\;ldr\t%0,%2"
3481 [(set_attr "length" "6")
3482 (set_attr "type" "ftrunctf")])
3484 (define_insn "*trunctfdf2_ibm"
3485 [(set (match_operand:DF 0 "register_operand" "=f")
3486 (float_truncate:DF (match_operand:TF 1 "register_operand" "f")))
3487 (clobber (match_scratch:TF 2 "=f"))]
3488 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3489 "ldxr\t%2,%1\;ldr\t%0,%2"
3490 [(set_attr "length" "4")
3491 (set_attr "type" "ftrunctf")])
3494 ; trunctfsf2 instruction pattern(s).
3497 (define_expand "trunctfsf2"
3499 [(set (match_operand:SF 0 "register_operand" "=f")
3500 (float_truncate:SF (match_operand:TF 1 "register_operand" "f")))
3501 (clobber (match_scratch:TF 2 "=f"))])]
3505 (define_insn "*trunctfsf2_ieee"
3506 [(set (match_operand:SF 0 "register_operand" "=f")
3507 (float_truncate:SF (match_operand:TF 1 "register_operand" "f")))
3508 (clobber (match_scratch:TF 2 "=f"))]
3509 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3510 "lexbr\t%2,%1\;ler\t%0,%2"
3511 [(set_attr "length" "6")
3512 (set_attr "type" "ftrunctf")])
3514 (define_insn "*trunctfsf2_ibm"
3515 [(set (match_operand:SF 0 "register_operand" "=f")
3516 (float_truncate:SF (match_operand:TF 1 "register_operand" "f")))
3517 (clobber (match_scratch:TF 2 "=f"))]
3518 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3519 "lexr\t%2,%1\;ler\t%0,%2"
3520 [(set_attr "length" "6")
3521 (set_attr "type" "ftrunctf")])
3524 ; extendsfdf2 instruction pattern(s).
3527 (define_expand "extendsfdf2"
3528 [(set (match_operand:DF 0 "register_operand" "")
3529 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3532 if (TARGET_IBM_FLOAT)
3534 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3539 (define_insn "extendsfdf2_ieee"
3540 [(set (match_operand:DF 0 "register_operand" "=f,f")
3541 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3542 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3546 [(set_attr "op_type" "RRE,RXE")
3547 (set_attr "type" "fsimpsf, floadsf")])
3549 (define_insn "extendsfdf2_ibm"
3550 [(set (match_operand:DF 0 "register_operand" "=f,f")
3551 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3552 (clobber (reg:CC CC_REGNUM))]
3553 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3555 sdr\t%0,%0\;ler\t%0,%1
3556 sdr\t%0,%0\;le\t%0,%1"
3557 [(set_attr "length" "4,6")
3558 (set_attr "type" "floadsf")])
3561 ; extenddftf2 instruction pattern(s).
3564 (define_expand "extenddftf2"
3565 [(set (match_operand:TF 0 "register_operand" "")
3566 (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "")))]
3570 (define_insn "*extenddftf2_ieee"
3571 [(set (match_operand:TF 0 "register_operand" "=f,f")
3572 (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "f,R")))]
3573 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3577 [(set_attr "op_type" "RRE,RXE")
3578 (set_attr "type" "fsimptf, floadtf")])
3580 (define_insn "*extenddftf2_ibm"
3581 [(set (match_operand:TF 0 "register_operand" "=f,f")
3582 (float_extend:TF (match_operand:DF 1 "nonimmediate_operand" "f,R")))]
3583 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3587 [(set_attr "op_type" "RRE,RXE")
3588 (set_attr "type" "fsimptf, floadtf")])
3591 ; extendsftf2 instruction pattern(s).
3594 (define_expand "extendsftf2"
3595 [(set (match_operand:TF 0 "register_operand" "")
3596 (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "")))]
3600 (define_insn "*extendsftf2_ieee"
3601 [(set (match_operand:TF 0 "register_operand" "=f,f")
3602 (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3603 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3607 [(set_attr "op_type" "RRE,RXE")
3608 (set_attr "type" "fsimptf, floadtf")])
3610 (define_insn "*extendsftf2_ibm"
3611 [(set (match_operand:TF 0 "register_operand" "=f,f")
3612 (float_extend:TF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3613 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3617 [(set_attr "op_type" "RRE,RXE")
3618 (set_attr "type" "fsimptf, floadtf")])
3622 ;; ARITHMETIC OPERATIONS
3624 ; arithmetic operations set the ConditionCode,
3625 ; because of unpredictable Bits in Register for Halfword and Byte
3626 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3629 ;;- Add instructions.
3633 ; addti3 instruction pattern(s).
3636 (define_insn_and_split "addti3"
3637 [(set (match_operand:TI 0 "register_operand" "=&d")
3638 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
3639 (match_operand:TI 2 "general_operand" "do") ) )
3640 (clobber (reg:CC CC_REGNUM))]
3643 "&& reload_completed"
3645 [(set (reg:CCL1 CC_REGNUM)
3646 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
3648 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
3650 [(set (match_dup 3) (plus:DI (plus:DI (match_dup 4) (match_dup 5))
3651 (ltu:DI (reg:CCL1 CC_REGNUM) (const_int 0))))
3652 (clobber (reg:CC CC_REGNUM))])]
3653 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3654 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3655 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3656 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3657 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3658 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
3661 ; adddi3 instruction pattern(s).
3664 (define_insn "*adddi3_sign"
3665 [(set (match_operand:DI 0 "register_operand" "=d,d")
3666 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3667 (match_operand:DI 1 "register_operand" "0,0")))
3668 (clobber (reg:CC CC_REGNUM))]
3673 [(set_attr "op_type" "RRE,RXY")])
3675 (define_insn "*adddi3_zero_cc"
3676 [(set (reg CC_REGNUM)
3677 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3678 (match_operand:DI 1 "register_operand" "0,0"))
3680 (set (match_operand:DI 0 "register_operand" "=d,d")
3681 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3682 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3686 [(set_attr "op_type" "RRE,RXY")])
3688 (define_insn "*adddi3_zero_cconly"
3689 [(set (reg CC_REGNUM)
3690 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3691 (match_operand:DI 1 "register_operand" "0,0"))
3693 (clobber (match_scratch:DI 0 "=d,d"))]
3694 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3698 [(set_attr "op_type" "RRE,RXY")])
3700 (define_insn "*adddi3_zero"
3701 [(set (match_operand:DI 0 "register_operand" "=d,d")
3702 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3703 (match_operand:DI 1 "register_operand" "0,0")))
3704 (clobber (reg:CC CC_REGNUM))]
3709 [(set_attr "op_type" "RRE,RXY")])
3711 (define_insn "*adddi3_imm_cc"
3712 [(set (reg CC_REGNUM)
3713 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
3714 (match_operand:DI 2 "const_int_operand" "K,Os"))
3716 (set (match_operand:DI 0 "register_operand" "=d,d")
3717 (plus:DI (match_dup 1) (match_dup 2)))]
3719 && s390_match_ccmode (insn, CCAmode)
3720 && (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")
3721 || CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'O', \"Os\"))"
3725 [(set_attr "op_type" "RI,RIL")])
3727 (define_insn "*adddi3_carry1_cc"
3728 [(set (reg CC_REGNUM)
3729 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
3730 (match_operand:DI 2 "general_operand" "d,Op,On,m"))
3732 (set (match_operand:DI 0 "register_operand" "=d,d,d,d")
3733 (plus:DI (match_dup 1) (match_dup 2)))]
3734 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3740 [(set_attr "op_type" "RRE,RIL,RIL,RXY")])
3742 (define_insn "*adddi3_carry1_cconly"
3743 [(set (reg CC_REGNUM)
3744 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3745 (match_operand:DI 2 "general_operand" "d,m"))
3747 (clobber (match_scratch:DI 0 "=d,d"))]
3748 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3752 [(set_attr "op_type" "RRE,RXY")])
3754 (define_insn "*adddi3_carry2_cc"
3755 [(set (reg CC_REGNUM)
3756 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
3757 (match_operand:DI 2 "general_operand" "d,Op,On,m"))
3759 (set (match_operand:DI 0 "register_operand" "=d,d,d,d")
3760 (plus:DI (match_dup 1) (match_dup 2)))]
3761 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3767 [(set_attr "op_type" "RRE,RIL,RIL,RXY")])
3769 (define_insn "*adddi3_carry2_cconly"
3770 [(set (reg CC_REGNUM)
3771 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3772 (match_operand:DI 2 "general_operand" "d,m"))
3774 (clobber (match_scratch:DI 0 "=d,d"))]
3775 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3779 [(set_attr "op_type" "RRE,RXY")])
3781 (define_insn "*adddi3_cc"
3782 [(set (reg CC_REGNUM)
3783 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
3784 (match_operand:DI 2 "general_operand" "d,Op,On,m"))
3786 (set (match_operand:DI 0 "register_operand" "=d,d,d,d")
3787 (plus:DI (match_dup 1) (match_dup 2)))]
3788 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3794 [(set_attr "op_type" "RRE,RIL,RIL,RXY")])
3796 (define_insn "*adddi3_cconly"
3797 [(set (reg CC_REGNUM)
3798 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3799 (match_operand:DI 2 "general_operand" "d,m"))
3801 (clobber (match_scratch:DI 0 "=d,d"))]
3802 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3806 [(set_attr "op_type" "RRE,RXY")])
3808 (define_insn "*adddi3_cconly2"
3809 [(set (reg CC_REGNUM)
3810 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3811 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3812 (clobber (match_scratch:DI 0 "=d,d"))]
3813 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3817 [(set_attr "op_type" "RRE,RXY")])
3819 (define_insn "*adddi3_64"
3820 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d")
3821 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0,0")
3822 (match_operand:DI 2 "general_operand" "d,K,Op,On,m") ) )
3823 (clobber (reg:CC CC_REGNUM))]
3831 [(set_attr "op_type" "RRE,RI,RIL,RIL,RXY")])
3833 (define_insn_and_split "*adddi3_31z"
3834 [(set (match_operand:DI 0 "register_operand" "=&d")
3835 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3836 (match_operand:DI 2 "general_operand" "do") ) )
3837 (clobber (reg:CC CC_REGNUM))]
3838 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3840 "&& reload_completed"
3842 [(set (reg:CCL1 CC_REGNUM)
3843 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3845 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3847 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3848 (ltu:SI (reg:CCL1 CC_REGNUM) (const_int 0))))
3849 (clobber (reg:CC CC_REGNUM))])]
3850 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3851 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3852 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3853 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3854 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3855 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
3857 (define_insn_and_split "*adddi3_31"
3858 [(set (match_operand:DI 0 "register_operand" "=&d")
3859 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3860 (match_operand:DI 2 "general_operand" "do") ) )
3861 (clobber (reg:CC CC_REGNUM))]
3864 "&& reload_completed"
3866 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3867 (clobber (reg:CC CC_REGNUM))])
3869 [(set (reg:CCL1 CC_REGNUM)
3870 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3872 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3874 (if_then_else (ltu (reg:CCL1 CC_REGNUM) (const_int 0))
3876 (label_ref (match_dup 9))))
3878 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3879 (clobber (reg:CC CC_REGNUM))])
3881 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3882 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3883 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3884 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3885 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3886 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3887 operands[9] = gen_label_rtx ();")
3889 (define_expand "adddi3"
3891 [(set (match_operand:DI 0 "register_operand" "")
3892 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3893 (match_operand:DI 2 "general_operand" "")))
3894 (clobber (reg:CC CC_REGNUM))])]
3899 ; addsi3 instruction pattern(s).
3902 (define_insn "*addsi3_imm_cc"
3903 [(set (reg CC_REGNUM)
3904 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
3905 (match_operand:SI 2 "const_int_operand" "K,Os"))
3907 (set (match_operand:SI 0 "register_operand" "=d,d")
3908 (plus:SI (match_dup 1) (match_dup 2)))]
3909 "s390_match_ccmode (insn, CCAmode)
3910 && (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")
3911 || CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'O', \"Os\"))
3912 && INTVAL (operands[2]) != -((HOST_WIDE_INT)1 << 31)"
3916 [(set_attr "op_type" "RI,RIL")])
3918 (define_insn "*addsi3_carry1_cc"
3919 [(set (reg CC_REGNUM)
3920 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3921 (match_operand:SI 2 "general_operand" "d,Os,R,T"))
3923 (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3924 (plus:SI (match_dup 1) (match_dup 2)))]
3925 "s390_match_ccmode (insn, CCL1mode)"
3931 [(set_attr "op_type" "RR,RIL,RX,RXY")])
3933 (define_insn "*addsi3_carry1_cconly"
3934 [(set (reg CC_REGNUM)
3935 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3936 (match_operand:SI 2 "general_operand" "d,R,T"))
3938 (clobber (match_scratch:SI 0 "=d,d,d"))]
3939 "s390_match_ccmode (insn, CCL1mode)"
3944 [(set_attr "op_type" "RR,RX,RXY")])
3946 (define_insn "*addsi3_carry2_cc"
3947 [(set (reg CC_REGNUM)
3948 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3949 (match_operand:SI 2 "general_operand" "d,Os,R,T"))
3951 (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3952 (plus:SI (match_dup 1) (match_dup 2)))]
3953 "s390_match_ccmode (insn, CCL1mode)"
3959 [(set_attr "op_type" "RR,RIL,RX,RXY")])
3961 (define_insn "*addsi3_carry2_cconly"
3962 [(set (reg CC_REGNUM)
3963 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3964 (match_operand:SI 2 "general_operand" "d,R,T"))
3966 (clobber (match_scratch:SI 0 "=d,d,d"))]
3967 "s390_match_ccmode (insn, CCL1mode)"
3972 [(set_attr "op_type" "RR,RX,RXY")])
3974 (define_insn "*addsi3_cc"
3975 [(set (reg CC_REGNUM)
3976 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3977 (match_operand:SI 2 "general_operand" "d,Os,R,T"))
3979 (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3980 (plus:SI (match_dup 1) (match_dup 2)))]
3981 "s390_match_ccmode (insn, CCLmode)"
3987 [(set_attr "op_type" "RR,RIL,RX,RXY")])
3989 (define_insn "*addsi3_cconly"
3990 [(set (reg CC_REGNUM)
3991 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3992 (match_operand:SI 2 "general_operand" "d,R,T"))
3994 (clobber (match_scratch:SI 0 "=d,d,d"))]
3995 "s390_match_ccmode (insn, CCLmode)"
4000 [(set_attr "op_type" "RR,RX,RXY")])
4002 (define_insn "*addsi3_cconly2"
4003 [(set (reg CC_REGNUM)
4004 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
4005 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
4006 (clobber (match_scratch:SI 0 "=d,d,d"))]
4007 "s390_match_ccmode (insn, CCLmode)"
4012 [(set_attr "op_type" "RR,RX,RXY")])
4014 (define_insn "*addsi3_sign"
4015 [(set (match_operand:SI 0 "register_operand" "=d,d")
4016 (plus:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
4017 (match_operand:SI 1 "register_operand" "0,0")))
4018 (clobber (reg:CC CC_REGNUM))]
4023 [(set_attr "op_type" "RX,RXY")])
4025 (define_insn "addsi3"
4026 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
4027 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0")
4028 (match_operand:SI 2 "general_operand" "d,K,Os,R,T")))
4029 (clobber (reg:CC CC_REGNUM))]
4037 [(set_attr "op_type" "RR,RI,RIL,RX,RXY")])
4040 ; add(df|sf)3 instruction pattern(s).
4043 (define_expand "add<mode>3"
4045 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4046 (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
4047 (match_operand:FPR 2 "general_operand" "f,<Rf>")))
4048 (clobber (reg:CC CC_REGNUM))])]
4052 (define_insn "*add<mode>3"
4053 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4054 (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
4055 (match_operand:FPR 2 "general_operand" "f,<Rf>")))
4056 (clobber (reg:CC CC_REGNUM))]
4057 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4061 [(set_attr "op_type" "RRE,RXE")
4062 (set_attr "type" "fsimp<mode>")])
4064 (define_insn "*add<mode>3_cc"
4065 [(set (reg CC_REGNUM)
4066 (compare (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
4067 (match_operand:FPR 2 "general_operand" "f,<Rf>"))
4068 (match_operand:FPR 3 "const0_operand" "")))
4069 (set (match_operand:FPR 0 "register_operand" "=f,f")
4070 (plus:FPR (match_dup 1) (match_dup 2)))]
4071 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4075 [(set_attr "op_type" "RRE,RXE")
4076 (set_attr "type" "fsimp<mode>")])
4078 (define_insn "*add<mode>3_cconly"
4079 [(set (reg CC_REGNUM)
4080 (compare (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
4081 (match_operand:FPR 2 "general_operand" "f,<Rf>"))
4082 (match_operand:FPR 3 "const0_operand" "")))
4083 (clobber (match_scratch:FPR 0 "=f,f"))]
4084 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4088 [(set_attr "op_type" "RRE,RXE")
4089 (set_attr "type" "fsimp<mode>")])
4091 (define_insn "*add<mode>3_ibm"
4092 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4093 (plus:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
4094 (match_operand:FPR 2 "general_operand" "f,<Rf>")))
4095 (clobber (reg:CC CC_REGNUM))]
4096 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4100 [(set_attr "op_type" "<RRe>,<RXe>")
4101 (set_attr "type" "fsimp<mode>")])
4105 ;;- Subtract instructions.
4109 ; subti3 instruction pattern(s).
4112 (define_insn_and_split "subti3"
4113 [(set (match_operand:TI 0 "register_operand" "=&d")
4114 (minus:TI (match_operand:TI 1 "register_operand" "0")
4115 (match_operand:TI 2 "general_operand" "do") ) )
4116 (clobber (reg:CC CC_REGNUM))]
4119 "&& reload_completed"
4121 [(set (reg:CCL2 CC_REGNUM)
4122 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
4124 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
4126 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
4127 (gtu:DI (reg:CCL2 CC_REGNUM) (const_int 0))))
4128 (clobber (reg:CC CC_REGNUM))])]
4129 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
4130 operands[4] = operand_subword (operands[1], 0, 0, TImode);
4131 operands[5] = operand_subword (operands[2], 0, 0, TImode);
4132 operands[6] = operand_subword (operands[0], 1, 0, TImode);
4133 operands[7] = operand_subword (operands[1], 1, 0, TImode);
4134 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
4137 ; subdi3 instruction pattern(s).
4140 (define_insn "*subdi3_sign"
4141 [(set (match_operand:DI 0 "register_operand" "=d,d")
4142 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
4143 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
4144 (clobber (reg:CC CC_REGNUM))]
4149 [(set_attr "op_type" "RRE,RXY")])
4151 (define_insn "*subdi3_zero_cc"
4152 [(set (reg CC_REGNUM)
4153 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
4154 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
4156 (set (match_operand:DI 0 "register_operand" "=d,d")
4157 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
4158 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4162 [(set_attr "op_type" "RRE,RXY")])
4164 (define_insn "*subdi3_zero_cconly"
4165 [(set (reg CC_REGNUM)
4166 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
4167 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
4169 (clobber (match_scratch:DI 0 "=d,d"))]
4170 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4174 [(set_attr "op_type" "RRE,RXY")])
4176 (define_insn "*subdi3_zero"
4177 [(set (match_operand:DI 0 "register_operand" "=d,d")
4178 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
4179 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
4180 (clobber (reg:CC CC_REGNUM))]
4185 [(set_attr "op_type" "RRE,RXY")])
4187 (define_insn "*subdi3_borrow_cc"
4188 [(set (reg CC_REGNUM)
4189 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
4190 (match_operand:DI 2 "general_operand" "d,m"))
4192 (set (match_operand:DI 0 "register_operand" "=d,d")
4193 (minus:DI (match_dup 1) (match_dup 2)))]
4194 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
4198 [(set_attr "op_type" "RRE,RXY")])
4200 (define_insn "*subdi3_borrow_cconly"
4201 [(set (reg CC_REGNUM)
4202 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
4203 (match_operand:DI 2 "general_operand" "d,m"))
4205 (clobber (match_scratch:DI 0 "=d,d"))]
4206 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
4210 [(set_attr "op_type" "RRE,RXY")])
4212 (define_insn "*subdi3_cc"
4213 [(set (reg CC_REGNUM)
4214 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
4215 (match_operand:DI 2 "general_operand" "d,m"))
4217 (set (match_operand:DI 0 "register_operand" "=d,d")
4218 (minus:DI (match_dup 1) (match_dup 2)))]
4219 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4223 [(set_attr "op_type" "RRE,RXY")])
4225 (define_insn "*subdi3_cc2"
4226 [(set (reg CC_REGNUM)
4227 (compare (match_operand:DI 1 "register_operand" "0,0")
4228 (match_operand:DI 2 "general_operand" "d,m")))
4229 (set (match_operand:DI 0 "register_operand" "=d,d")
4230 (minus:DI (match_dup 1) (match_dup 2)))]
4231 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
4235 [(set_attr "op_type" "RRE,RXY")])
4237 (define_insn "*subdi3_cconly"
4238 [(set (reg CC_REGNUM)
4239 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
4240 (match_operand:DI 2 "general_operand" "d,m"))
4242 (clobber (match_scratch:DI 0 "=d,d"))]
4243 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4247 [(set_attr "op_type" "RRE,RXY")])
4249 (define_insn "*subdi3_cconly2"
4250 [(set (reg CC_REGNUM)
4251 (compare (match_operand:DI 1 "register_operand" "0,0")
4252 (match_operand:DI 2 "general_operand" "d,m")))
4253 (clobber (match_scratch:DI 0 "=d,d"))]
4254 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
4258 [(set_attr "op_type" "RRE,RXY")])
4260 (define_insn "*subdi3_64"
4261 [(set (match_operand:DI 0 "register_operand" "=d,d")
4262 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
4263 (match_operand:DI 2 "general_operand" "d,m") ) )
4264 (clobber (reg:CC CC_REGNUM))]
4269 [(set_attr "op_type" "RRE,RRE")])
4271 (define_insn_and_split "*subdi3_31z"
4272 [(set (match_operand:DI 0 "register_operand" "=&d")
4273 (minus:DI (match_operand:DI 1 "register_operand" "0")
4274 (match_operand:DI 2 "general_operand" "do") ) )
4275 (clobber (reg:CC CC_REGNUM))]
4276 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4278 "&& reload_completed"
4280 [(set (reg:CCL2 CC_REGNUM)
4281 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
4283 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
4285 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
4286 (gtu:SI (reg:CCL2 CC_REGNUM) (const_int 0))))
4287 (clobber (reg:CC CC_REGNUM))])]
4288 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
4289 operands[4] = operand_subword (operands[1], 0, 0, DImode);
4290 operands[5] = operand_subword (operands[2], 0, 0, DImode);
4291 operands[6] = operand_subword (operands[0], 1, 0, DImode);
4292 operands[7] = operand_subword (operands[1], 1, 0, DImode);
4293 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
4295 (define_insn_and_split "*subdi3_31"
4296 [(set (match_operand:DI 0 "register_operand" "=&d")
4297 (minus:DI (match_operand:DI 1 "register_operand" "0")
4298 (match_operand:DI 2 "general_operand" "do") ) )
4299 (clobber (reg:CC CC_REGNUM))]
4302 "&& reload_completed"
4304 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
4305 (clobber (reg:CC CC_REGNUM))])
4307 [(set (reg:CCL2 CC_REGNUM)
4308 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
4310 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
4312 (if_then_else (gtu (reg:CCL2 CC_REGNUM) (const_int 0))
4314 (label_ref (match_dup 9))))
4316 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
4317 (clobber (reg:CC CC_REGNUM))])
4319 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
4320 operands[4] = operand_subword (operands[1], 0, 0, DImode);
4321 operands[5] = operand_subword (operands[2], 0, 0, DImode);
4322 operands[6] = operand_subword (operands[0], 1, 0, DImode);
4323 operands[7] = operand_subword (operands[1], 1, 0, DImode);
4324 operands[8] = operand_subword (operands[2], 1, 0, DImode);
4325 operands[9] = gen_label_rtx ();")
4327 (define_expand "subdi3"
4329 [(set (match_operand:DI 0 "register_operand" "")
4330 (minus:DI (match_operand:DI 1 "register_operand" "")
4331 (match_operand:DI 2 "general_operand" "")))
4332 (clobber (reg:CC CC_REGNUM))])]
4337 ; subsi3 instruction pattern(s).
4340 (define_insn "*subsi3_borrow_cc"
4341 [(set (reg CC_REGNUM)
4342 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4343 (match_operand:SI 2 "general_operand" "d,R,T"))
4345 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4346 (minus:SI (match_dup 1) (match_dup 2)))]
4347 "s390_match_ccmode (insn, CCL2mode)"
4352 [(set_attr "op_type" "RR,RX,RXY")])
4354 (define_insn "*subsi3_borrow_cconly"
4355 [(set (reg CC_REGNUM)
4356 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4357 (match_operand:SI 2 "general_operand" "d,R,T"))
4359 (clobber (match_scratch:SI 0 "=d,d,d"))]
4360 "s390_match_ccmode (insn, CCL2mode)"
4365 [(set_attr "op_type" "RR,RX,RXY")])
4367 (define_insn "*subsi3_cc"
4368 [(set (reg CC_REGNUM)
4369 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4370 (match_operand:SI 2 "general_operand" "d,R,T"))
4372 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4373 (minus:SI (match_dup 1) (match_dup 2)))]
4374 "s390_match_ccmode (insn, CCLmode)"
4379 [(set_attr "op_type" "RR,RX,RXY")])
4381 (define_insn "*subsi3_cc2"
4382 [(set (reg CC_REGNUM)
4383 (compare (match_operand:SI 1 "register_operand" "0,0,0")
4384 (match_operand:SI 2 "general_operand" "d,R,T")))
4385 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4386 (minus:SI (match_dup 1) (match_dup 2)))]
4387 "s390_match_ccmode (insn, CCL3mode)"
4392 [(set_attr "op_type" "RR,RX,RXY")])
4394 (define_insn "*subsi3_cconly"
4395 [(set (reg CC_REGNUM)
4396 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4397 (match_operand:SI 2 "general_operand" "d,R,T"))
4399 (clobber (match_scratch:SI 0 "=d,d,d"))]
4400 "s390_match_ccmode (insn, CCLmode)"
4405 [(set_attr "op_type" "RR,RX,RXY")])
4407 (define_insn "*subsi3_cconly2"
4408 [(set (reg CC_REGNUM)
4409 (compare (match_operand:SI 1 "register_operand" "0,0,0")
4410 (match_operand:SI 2 "general_operand" "d,R,T")))
4411 (clobber (match_scratch:SI 0 "=d,d,d"))]
4412 "s390_match_ccmode (insn, CCL3mode)"
4417 [(set_attr "op_type" "RR,RX,RXY")])
4419 (define_insn "*subsi3_sign"
4420 [(set (match_operand:SI 0 "register_operand" "=d,d")
4421 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
4422 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4423 (clobber (reg:CC CC_REGNUM))]
4428 [(set_attr "op_type" "RX,RXY")])
4430 (define_insn "subsi3"
4431 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4432 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4433 (match_operand:SI 2 "general_operand" "d,R,T")))
4434 (clobber (reg:CC CC_REGNUM))]
4440 [(set_attr "op_type" "RR,RX,RXY")])
4444 ; sub(df|sf)3 instruction pattern(s).
4447 (define_expand "sub<mode>3"
4449 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4450 (minus:FPR (match_operand:FPR 1 "register_operand" "0,0")
4451 (match_operand:FPR 2 "general_operand" "f,R")))
4452 (clobber (reg:CC CC_REGNUM))])]
4456 (define_insn "*sub<mode>3"
4457 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4458 (minus:FPR (match_operand:FPR 1 "register_operand" "0,0")
4459 (match_operand:FPR 2 "general_operand" "f,<Rf>")))
4460 (clobber (reg:CC CC_REGNUM))]
4461 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4465 [(set_attr "op_type" "RRE,RXE")
4466 (set_attr "type" "fsimp<mode>")])
4468 (define_insn "*sub<mode>3_cc"
4469 [(set (reg CC_REGNUM)
4470 (compare (minus:FPR (match_operand:FPR 1 "nonimmediate_operand" "0,0")
4471 (match_operand:FPR 2 "general_operand" "f,<Rf>"))
4472 (match_operand:FPR 3 "const0_operand" "")))
4473 (set (match_operand:FPR 0 "register_operand" "=f,f")
4474 (minus:FPR (match_dup 1) (match_dup 2)))]
4475 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4479 [(set_attr "op_type" "RRE,RXE")
4480 (set_attr "type" "fsimp<mode>")])
4482 (define_insn "*sub<mode>3_cconly"
4483 [(set (reg CC_REGNUM)
4484 (compare (minus:FPR (match_operand:FPR 1 "nonimmediate_operand" "0,0")
4485 (match_operand:FPR 2 "general_operand" "f,<Rf>"))
4486 (match_operand:FPR 3 "const0_operand" "")))
4487 (clobber (match_scratch:FPR 0 "=f,f"))]
4488 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4492 [(set_attr "op_type" "RRE,RXE")
4493 (set_attr "type" "fsimp<mode>")])
4495 (define_insn "*sub<mode>3_ibm"
4496 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4497 (minus:FPR (match_operand:FPR 1 "register_operand" "0,0")
4498 (match_operand:FPR 2 "general_operand" "f,<Rf>")))
4499 (clobber (reg:CC CC_REGNUM))]
4500 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4504 [(set_attr "op_type" "<RRe>,<RXe>")
4505 (set_attr "type" "fsimp<mode>")])
4509 ;;- Conditional add/subtract instructions.
4513 ; add(di|si)cc instruction pattern(s).
4516 (define_insn "*add<mode>3_alc_cc"
4517 [(set (reg CC_REGNUM)
4519 (plus:GPR (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0")
4520 (match_operand:GPR 2 "general_operand" "d,m"))
4521 (match_operand:GPR 3 "s390_alc_comparison" ""))
4523 (set (match_operand:GPR 0 "register_operand" "=d,d")
4524 (plus:GPR (plus:GPR (match_dup 1) (match_dup 2)) (match_dup 3)))]
4525 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4529 [(set_attr "op_type" "RRE,RXY")])
4531 (define_insn "*add<mode>3_alc"
4532 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4533 (plus:GPR (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0")
4534 (match_operand:GPR 2 "general_operand" "d,m"))
4535 (match_operand:GPR 3 "s390_alc_comparison" "")))
4536 (clobber (reg:CC CC_REGNUM))]
4541 [(set_attr "op_type" "RRE,RXY")])
4543 (define_insn "*sub<mode>3_slb_cc"
4544 [(set (reg CC_REGNUM)
4546 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
4547 (match_operand:GPR 2 "general_operand" "d,m"))
4548 (match_operand:GPR 3 "s390_slb_comparison" ""))
4550 (set (match_operand:GPR 0 "register_operand" "=d,d")
4551 (minus:GPR (minus:GPR (match_dup 1) (match_dup 2)) (match_dup 3)))]
4552 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4556 [(set_attr "op_type" "RRE,RXY")])
4558 (define_insn "*sub<mode>3_slb"
4559 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4560 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
4561 (match_operand:GPR 2 "general_operand" "d,m"))
4562 (match_operand:GPR 3 "s390_slb_comparison" "")))
4563 (clobber (reg:CC CC_REGNUM))]
4568 [(set_attr "op_type" "RRE,RXY")])
4570 (define_expand "add<mode>cc"
4571 [(match_operand:GPR 0 "register_operand" "")
4572 (match_operand 1 "comparison_operator" "")
4573 (match_operand:GPR 2 "register_operand" "")
4574 (match_operand:GPR 3 "const_int_operand" "")]
4576 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4577 s390_compare_op0, s390_compare_op1,
4578 operands[0], operands[2],
4579 operands[3])) FAIL; DONE;")
4582 ; scond instruction pattern(s).
4585 (define_insn_and_split "*scond<mode>"
4586 [(set (match_operand:GPR 0 "register_operand" "=&d")
4587 (match_operand:GPR 1 "s390_alc_comparison" ""))
4588 (clobber (reg:CC CC_REGNUM))]
4591 "&& reload_completed"
4592 [(set (match_dup 0) (const_int 0))
4594 [(set (match_dup 0) (plus:GPR (plus:GPR (match_dup 0) (match_dup 0))
4596 (clobber (reg:CC CC_REGNUM))])]
4599 (define_insn_and_split "*scond<mode>_neg"
4600 [(set (match_operand:GPR 0 "register_operand" "=&d")
4601 (match_operand:GPR 1 "s390_slb_comparison" ""))
4602 (clobber (reg:CC CC_REGNUM))]
4605 "&& reload_completed"
4606 [(set (match_dup 0) (const_int 0))
4608 [(set (match_dup 0) (minus:GPR (minus:GPR (match_dup 0) (match_dup 0))
4610 (clobber (reg:CC CC_REGNUM))])
4612 [(set (match_dup 0) (neg:GPR (match_dup 0)))
4613 (clobber (reg:CC CC_REGNUM))])]
4617 (define_expand "s<code>"
4618 [(set (match_operand:SI 0 "register_operand" "")
4619 (SCOND (match_dup 0)
4622 "if (!s390_expand_addcc (<CODE>, s390_compare_op0, s390_compare_op1,
4623 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4625 (define_expand "seq"
4627 [(set (match_operand:SI 0 "register_operand" "=d")
4629 (clobber (reg:CC CC_REGNUM))])
4631 [(set (match_dup 0) (xor:SI (match_dup 0) (const_int 1)))
4632 (clobber (reg:CC CC_REGNUM))])]
4635 if (!s390_compare_emitted || GET_MODE (s390_compare_emitted) != CCZ1mode)
4637 operands[1] = s390_emit_compare (NE, s390_compare_op0, s390_compare_op1);
4638 PUT_MODE (operands[1], SImode);
4641 (define_insn_and_split "*sne"
4642 [(set (match_operand:SI 0 "register_operand" "=d")
4643 (ne:SI (match_operand:CCZ1 1 "register_operand" "0")
4645 (clobber (reg:CC CC_REGNUM))]
4650 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 28)))
4651 (clobber (reg:CC CC_REGNUM))])])
4655 ;;- Multiply instructions.
4659 ; muldi3 instruction pattern(s).
4662 (define_insn "*muldi3_sign"
4663 [(set (match_operand:DI 0 "register_operand" "=d,d")
4664 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4665 (match_operand:DI 1 "register_operand" "0,0")))]
4670 [(set_attr "op_type" "RRE,RXY")
4671 (set_attr "type" "imuldi")])
4673 (define_insn "muldi3"
4674 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4675 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4676 (match_operand:DI 2 "general_operand" "d,K,m")))]
4682 [(set_attr "op_type" "RRE,RI,RXY")
4683 (set_attr "type" "imuldi")])
4686 ; mulsi3 instruction pattern(s).
4689 (define_insn "*mulsi3_sign"
4690 [(set (match_operand:SI 0 "register_operand" "=d")
4691 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4692 (match_operand:SI 1 "register_operand" "0")))]
4695 [(set_attr "op_type" "RX")
4696 (set_attr "type" "imulhi")])
4698 (define_insn "mulsi3"
4699 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4700 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4701 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4708 [(set_attr "op_type" "RRE,RI,RX,RXY")
4709 (set_attr "type" "imulsi,imulhi,imulsi,imulsi")])
4712 ; mulsidi3 instruction pattern(s).
4715 (define_insn "mulsidi3"
4716 [(set (match_operand:DI 0 "register_operand" "=d,d")
4717 (mult:DI (sign_extend:DI
4718 (match_operand:SI 1 "register_operand" "%0,0"))
4720 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4725 [(set_attr "op_type" "RR,RX")
4726 (set_attr "type" "imulsi")])
4729 ; umulsidi3 instruction pattern(s).
4732 (define_insn "umulsidi3"
4733 [(set (match_operand:DI 0 "register_operand" "=d,d")
4734 (mult:DI (zero_extend:DI
4735 (match_operand:SI 1 "register_operand" "%0,0"))
4737 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4738 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4742 [(set_attr "op_type" "RRE,RXY")
4743 (set_attr "type" "imulsi")])
4746 ; mul(df|sf)3 instruction pattern(s).
4749 (define_expand "mul<mode>3"
4750 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4751 (mult:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
4752 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
4756 (define_insn "*mul<mode>3"
4757 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4758 (mult:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
4759 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
4760 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4764 [(set_attr "op_type" "RRE,RXE")
4765 (set_attr "type" "fmul<mode>")])
4767 (define_insn "*mul<mode>3_ibm"
4768 [(set (match_operand:FPR 0 "register_operand" "=f,f")
4769 (mult:FPR (match_operand:FPR 1 "nonimmediate_operand" "%0,0")
4770 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
4771 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4775 [(set_attr "op_type" "<RRe>,<RXe>")
4776 (set_attr "type" "fmul<mode>")])
4778 (define_insn "*fmadd<mode>"
4779 [(set (match_operand:DSF 0 "register_operand" "=f,f")
4780 (plus:DSF (mult:DSF (match_operand:DSF 1 "register_operand" "%f,f")
4781 (match_operand:DSF 2 "nonimmediate_operand" "f,R"))
4782 (match_operand:DSF 3 "register_operand" "0,0")))]
4783 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4787 [(set_attr "op_type" "RRE,RXE")
4788 (set_attr "type" "fmul<mode>")])
4790 (define_insn "*fmsub<mode>"
4791 [(set (match_operand:DSF 0 "register_operand" "=f,f")
4792 (minus:DSF (mult:DSF (match_operand:DSF 1 "register_operand" "f,f")
4793 (match_operand:DSF 2 "nonimmediate_operand" "f,R"))
4794 (match_operand:DSF 3 "register_operand" "0,0")))]
4795 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4799 [(set_attr "op_type" "RRE,RXE")
4800 (set_attr "type" "fmul<mode>")])
4803 ;;- Divide and modulo instructions.
4807 ; divmoddi4 instruction pattern(s).
4810 (define_expand "divmoddi4"
4811 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4812 (div:DI (match_operand:DI 1 "register_operand" "")
4813 (match_operand:DI 2 "general_operand" "")))
4814 (set (match_operand:DI 3 "general_operand" "")
4815 (mod:DI (match_dup 1) (match_dup 2)))])
4816 (clobber (match_dup 4))]
4819 rtx insn, div_equal, mod_equal;
4821 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4822 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4824 operands[4] = gen_reg_rtx(TImode);
4825 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4827 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4829 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4831 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4833 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4838 (define_insn "divmodtidi3"
4839 [(set (match_operand:TI 0 "register_operand" "=d,d")
4843 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4844 (match_operand:DI 2 "general_operand" "d,m")))
4846 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
4851 [(set_attr "op_type" "RRE,RXY")
4852 (set_attr "type" "idiv")])
4854 (define_insn "divmodtisi3"
4855 [(set (match_operand:TI 0 "register_operand" "=d,d")
4859 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4861 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4864 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
4869 [(set_attr "op_type" "RRE,RXY")
4870 (set_attr "type" "idiv")])
4873 ; udivmoddi4 instruction pattern(s).
4876 (define_expand "udivmoddi4"
4877 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4878 (udiv:DI (match_operand:DI 1 "general_operand" "")
4879 (match_operand:DI 2 "nonimmediate_operand" "")))
4880 (set (match_operand:DI 3 "general_operand" "")
4881 (umod:DI (match_dup 1) (match_dup 2)))])
4882 (clobber (match_dup 4))]
4885 rtx insn, div_equal, mod_equal, equal;
4887 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4888 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4889 equal = gen_rtx_IOR (TImode,
4890 gen_rtx_ASHIFT (TImode,
4891 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4893 gen_rtx_ZERO_EXTEND (TImode, div_equal));
4895 operands[4] = gen_reg_rtx(TImode);
4896 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4897 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4898 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4899 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4901 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4903 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4905 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4907 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4909 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4914 (define_insn "udivmodtidi3"
4915 [(set (match_operand:TI 0 "register_operand" "=d,d")
4920 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
4922 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4926 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
4931 [(set_attr "op_type" "RRE,RXY")
4932 (set_attr "type" "idiv")])
4935 ; divmodsi4 instruction pattern(s).
4938 (define_expand "divmodsi4"
4939 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4940 (div:SI (match_operand:SI 1 "general_operand" "")
4941 (match_operand:SI 2 "nonimmediate_operand" "")))
4942 (set (match_operand:SI 3 "general_operand" "")
4943 (mod:SI (match_dup 1) (match_dup 2)))])
4944 (clobber (match_dup 4))]
4947 rtx insn, div_equal, mod_equal, equal;
4949 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4950 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4951 equal = gen_rtx_IOR (DImode,
4952 gen_rtx_ASHIFT (DImode,
4953 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4955 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4957 operands[4] = gen_reg_rtx(DImode);
4958 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4959 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4961 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4963 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4965 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4967 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4969 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4974 (define_insn "divmoddisi3"
4975 [(set (match_operand:DI 0 "register_operand" "=d,d")
4980 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4982 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4986 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
4991 [(set_attr "op_type" "RR,RX")
4992 (set_attr "type" "idiv")])
4995 ; udivsi3 and umodsi3 instruction pattern(s).
4998 (define_expand "udivmodsi4"
4999 [(parallel [(set (match_operand:SI 0 "general_operand" "")
5000 (udiv:SI (match_operand:SI 1 "general_operand" "")
5001 (match_operand:SI 2 "nonimmediate_operand" "")))
5002 (set (match_operand:SI 3 "general_operand" "")
5003 (umod:SI (match_dup 1) (match_dup 2)))])
5004 (clobber (match_dup 4))]
5005 "!TARGET_64BIT && TARGET_CPU_ZARCH"
5007 rtx insn, div_equal, mod_equal, equal;
5009 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
5010 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
5011 equal = gen_rtx_IOR (DImode,
5012 gen_rtx_ASHIFT (DImode,
5013 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
5015 gen_rtx_ZERO_EXTEND (DImode, div_equal));
5017 operands[4] = gen_reg_rtx(DImode);
5018 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
5019 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
5020 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
5021 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
5023 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5025 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
5027 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
5029 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
5031 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
5036 (define_insn "udivmoddisi3"
5037 [(set (match_operand:DI 0 "register_operand" "=d,d")
5042 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
5044 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
5048 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
5049 "!TARGET_64BIT && TARGET_CPU_ZARCH"
5053 [(set_attr "op_type" "RRE,RXY")
5054 (set_attr "type" "idiv")])
5056 (define_expand "udivsi3"
5057 [(set (match_operand:SI 0 "register_operand" "=d")
5058 (udiv:SI (match_operand:SI 1 "general_operand" "")
5059 (match_operand:SI 2 "general_operand" "")))
5060 (clobber (match_dup 3))]
5061 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
5063 rtx insn, udiv_equal, umod_equal, equal;
5065 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
5066 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
5067 equal = gen_rtx_IOR (DImode,
5068 gen_rtx_ASHIFT (DImode,
5069 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
5071 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
5073 operands[3] = gen_reg_rtx (DImode);
5075 if (CONSTANT_P (operands[2]))
5077 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
5079 rtx label1 = gen_label_rtx ();
5081 operands[1] = make_safe_from (operands[1], operands[0]);
5082 emit_move_insn (operands[0], const0_rtx);
5083 emit_insn (gen_cmpsi (operands[1], operands[2]));
5084 emit_jump_insn (gen_bltu (label1));
5085 emit_move_insn (operands[0], const1_rtx);
5086 emit_label (label1);
5090 operands[2] = force_reg (SImode, operands[2]);
5091 operands[2] = make_safe_from (operands[2], operands[0]);
5093 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5094 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5097 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5099 insn = emit_move_insn (operands[0],
5100 gen_lowpart (SImode, operands[3]));
5102 gen_rtx_EXPR_LIST (REG_EQUAL,
5103 udiv_equal, REG_NOTES (insn));
5108 rtx label1 = gen_label_rtx ();
5109 rtx label2 = gen_label_rtx ();
5110 rtx label3 = gen_label_rtx ();
5112 operands[1] = force_reg (SImode, operands[1]);
5113 operands[1] = make_safe_from (operands[1], operands[0]);
5114 operands[2] = force_reg (SImode, operands[2]);
5115 operands[2] = make_safe_from (operands[2], operands[0]);
5117 emit_move_insn (operands[0], const0_rtx);
5118 emit_insn (gen_cmpsi (operands[2], operands[1]));
5119 emit_jump_insn (gen_bgtu (label3));
5120 emit_insn (gen_cmpsi (operands[2], const0_rtx));
5121 emit_jump_insn (gen_blt (label2));
5122 emit_insn (gen_cmpsi (operands[2], const1_rtx));
5123 emit_jump_insn (gen_beq (label1));
5124 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5125 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5128 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5130 insn = emit_move_insn (operands[0],
5131 gen_lowpart (SImode, operands[3]));
5133 gen_rtx_EXPR_LIST (REG_EQUAL,
5134 udiv_equal, REG_NOTES (insn));
5136 emit_label (label1);
5137 emit_move_insn (operands[0], operands[1]);
5139 emit_label (label2);
5140 emit_move_insn (operands[0], const1_rtx);
5141 emit_label (label3);
5143 emit_move_insn (operands[0], operands[0]);
5147 (define_expand "umodsi3"
5148 [(set (match_operand:SI 0 "register_operand" "=d")
5149 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
5150 (match_operand:SI 2 "nonimmediate_operand" "")))
5151 (clobber (match_dup 3))]
5152 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
5154 rtx insn, udiv_equal, umod_equal, equal;
5156 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
5157 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
5158 equal = gen_rtx_IOR (DImode,
5159 gen_rtx_ASHIFT (DImode,
5160 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
5162 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
5164 operands[3] = gen_reg_rtx (DImode);
5166 if (CONSTANT_P (operands[2]))
5168 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
5170 rtx label1 = gen_label_rtx ();
5172 operands[1] = make_safe_from (operands[1], operands[0]);
5173 emit_move_insn (operands[0], operands[1]);
5174 emit_insn (gen_cmpsi (operands[0], operands[2]));
5175 emit_jump_insn (gen_bltu (label1));
5176 emit_insn (gen_abssi2 (operands[0], operands[2]));
5177 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
5178 emit_label (label1);
5182 operands[2] = force_reg (SImode, operands[2]);
5183 operands[2] = make_safe_from (operands[2], operands[0]);
5185 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5186 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5189 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5191 insn = emit_move_insn (operands[0],
5192 gen_highpart (SImode, operands[3]));
5194 gen_rtx_EXPR_LIST (REG_EQUAL,
5195 umod_equal, REG_NOTES (insn));
5200 rtx label1 = gen_label_rtx ();
5201 rtx label2 = gen_label_rtx ();
5202 rtx label3 = gen_label_rtx ();
5204 operands[1] = force_reg (SImode, operands[1]);
5205 operands[1] = make_safe_from (operands[1], operands[0]);
5206 operands[2] = force_reg (SImode, operands[2]);
5207 operands[2] = make_safe_from (operands[2], operands[0]);
5209 emit_move_insn(operands[0], operands[1]);
5210 emit_insn (gen_cmpsi (operands[2], operands[1]));
5211 emit_jump_insn (gen_bgtu (label3));
5212 emit_insn (gen_cmpsi (operands[2], const0_rtx));
5213 emit_jump_insn (gen_blt (label2));
5214 emit_insn (gen_cmpsi (operands[2], const1_rtx));
5215 emit_jump_insn (gen_beq (label1));
5216 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5217 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5220 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5222 insn = emit_move_insn (operands[0],
5223 gen_highpart (SImode, operands[3]));
5225 gen_rtx_EXPR_LIST (REG_EQUAL,
5226 umod_equal, REG_NOTES (insn));
5228 emit_label (label1);
5229 emit_move_insn (operands[0], const0_rtx);
5231 emit_label (label2);
5232 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
5233 emit_label (label3);
5239 ; div(df|sf)3 instruction pattern(s).
5242 (define_expand "div<mode>3"
5243 [(set (match_operand:FPR 0 "register_operand" "=f,f")
5244 (div:FPR (match_operand:FPR 1 "register_operand" "0,0")
5245 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
5249 (define_insn "*div<mode>3"
5250 [(set (match_operand:FPR 0 "register_operand" "=f,f")
5251 (div:FPR (match_operand:FPR 1 "register_operand" "0,0")
5252 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
5253 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5257 [(set_attr "op_type" "RRE,RXE")
5258 (set_attr "type" "fdiv<mode>")])
5260 (define_insn "*div<mode>3_ibm"
5261 [(set (match_operand:FPR 0 "register_operand" "=f,f")
5262 (div:FPR (match_operand:FPR 1 "register_operand" "0,0")
5263 (match_operand:FPR 2 "general_operand" "f,<Rf>")))]
5264 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5268 [(set_attr "op_type" "<RRe>,<RXe>")
5269 (set_attr "type" "fdiv<mode>")])
5273 ;;- And instructions.
5276 (define_expand "and<mode>3"
5277 [(set (match_operand:INT 0 "nonimmediate_operand" "")
5278 (and:INT (match_operand:INT 1 "nonimmediate_operand" "")
5279 (match_operand:INT 2 "general_operand" "")))
5280 (clobber (reg:CC CC_REGNUM))]
5282 "s390_expand_logical_operator (AND, <MODE>mode, operands); DONE;")
5285 ; anddi3 instruction pattern(s).
5288 (define_insn "*anddi3_cc"
5289 [(set (reg CC_REGNUM)
5290 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5291 (match_operand:DI 2 "general_operand" "d,m"))
5293 (set (match_operand:DI 0 "register_operand" "=d,d")
5294 (and:DI (match_dup 1) (match_dup 2)))]
5295 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5299 [(set_attr "op_type" "RRE,RXY")])
5301 (define_insn "*anddi3_cconly"
5302 [(set (reg CC_REGNUM)
5303 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5304 (match_operand:DI 2 "general_operand" "d,m"))
5306 (clobber (match_scratch:DI 0 "=d,d"))]
5307 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
5308 /* Do not steal TM patterns. */
5309 && s390_single_part (operands[2], DImode, HImode, 0) < 0"
5313 [(set_attr "op_type" "RRE,RXY")])
5315 (define_insn "*anddi3_extimm"
5316 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,d,d,AQ,Q")
5317 (and:DI (match_operand:DI 1 "nonimmediate_operand"
5318 "%d,o,0,0,0,0,0,0,0,0,0,0")
5319 (match_operand:DI 2 "general_operand"
5320 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,N0SDF,N1SDF,d,m,NxQDF,Q")))
5321 (clobber (reg:CC CC_REGNUM))]
5322 "TARGET_64BIT && TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5336 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RIL,RIL,RRE,RXY,SI,SS")])
5338 (define_insn "*anddi3"
5339 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q")
5340 (and:DI (match_operand:DI 1 "nonimmediate_operand"
5341 "%d,o,0,0,0,0,0,0,0,0")
5342 (match_operand:DI 2 "general_operand"
5343 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m,NxQDF,Q")))
5344 (clobber (reg:CC CC_REGNUM))]
5345 "TARGET_64BIT && !TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5357 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY,SI,SS")])
5360 [(set (match_operand:DI 0 "s_operand" "")
5361 (and:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5362 (clobber (reg:CC CC_REGNUM))]
5365 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5366 (clobber (reg:CC CC_REGNUM))])]
5367 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5371 ; andsi3 instruction pattern(s).
5374 (define_insn "*andsi3_cc"
5375 [(set (reg CC_REGNUM)
5376 (compare (and: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 (and: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 "*andsi3_cconly"
5390 [(set (reg CC_REGNUM)
5391 (compare (and: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)
5396 /* Do not steal TM patterns. */
5397 && s390_single_part (operands[2], SImode, HImode, 0) < 0"
5403 [(set_attr "op_type" "RIL,RR,RX,RXY")])
5405 (define_insn "*andsi3_zarch"
5406 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q")
5407 (and:SI (match_operand:SI 1 "nonimmediate_operand"
5408 "%d,o,0,0,0,0,0,0,0,0")
5409 (match_operand:SI 2 "general_operand"
5410 "M,M,N0HSF,N1HSF,Os,d,R,T,NxQSF,Q")))
5411 (clobber (reg:CC CC_REGNUM))]
5412 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5424 [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RX,RXY,SI,SS")])
5426 (define_insn "*andsi3_esa"
5427 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5428 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5429 (match_operand:SI 2 "general_operand" "d,R,NxQSF,Q")))
5430 (clobber (reg:CC CC_REGNUM))]
5431 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5437 [(set_attr "op_type" "RR,RX,SI,SS")])
5440 [(set (match_operand:SI 0 "s_operand" "")
5441 (and:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5442 (clobber (reg:CC CC_REGNUM))]
5445 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5446 (clobber (reg:CC CC_REGNUM))])]
5447 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5450 ; andhi3 instruction pattern(s).
5453 (define_insn "*andhi3_zarch"
5454 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5455 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0,0")
5456 (match_operand:HI 2 "general_operand" "d,n,NxQHF,Q")))
5457 (clobber (reg:CC CC_REGNUM))]
5458 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5464 [(set_attr "op_type" "RR,RI,SI,SS")])
5466 (define_insn "*andhi3_esa"
5467 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
5468 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
5469 (match_operand:HI 2 "general_operand" "d,NxQHF,Q")))
5470 (clobber (reg:CC CC_REGNUM))]
5471 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5476 [(set_attr "op_type" "RR,SI,SS")])
5479 [(set (match_operand:HI 0 "s_operand" "")
5480 (and:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
5481 (clobber (reg:CC CC_REGNUM))]
5484 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
5485 (clobber (reg:CC CC_REGNUM))])]
5486 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
5489 ; andqi3 instruction pattern(s).
5492 (define_insn "*andqi3_zarch"
5493 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,Q,S,Q")
5494 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0,0")
5495 (match_operand:QI 2 "general_operand" "d,n,n,n,Q")))
5496 (clobber (reg:CC CC_REGNUM))]
5497 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5504 [(set_attr "op_type" "RR,RI,SI,SIY,SS")])
5506 (define_insn "*andqi3_esa"
5507 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
5508 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
5509 (match_operand:QI 2 "general_operand" "d,n,Q")))
5510 (clobber (reg:CC CC_REGNUM))]
5511 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5516 [(set_attr "op_type" "RR,SI,SS")])
5519 ; Block and (NC) patterns.
5523 [(set (match_operand:BLK 0 "memory_operand" "=Q")
5524 (and:BLK (match_dup 0)
5525 (match_operand:BLK 1 "memory_operand" "Q")))
5526 (use (match_operand 2 "const_int_operand" "n"))
5527 (clobber (reg:CC CC_REGNUM))]
5528 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
5529 "nc\t%O0(%2,%R0),%S1"
5530 [(set_attr "op_type" "SS")])
5533 [(set (match_operand 0 "memory_operand" "")
5535 (match_operand 1 "memory_operand" "")))
5536 (clobber (reg:CC CC_REGNUM))]
5538 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5539 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
5541 [(set (match_dup 0) (and:BLK (match_dup 0) (match_dup 1)))
5543 (clobber (reg:CC CC_REGNUM))])]
5545 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
5546 operands[0] = adjust_address (operands[0], BLKmode, 0);
5547 operands[1] = adjust_address (operands[1], BLKmode, 0);
5552 [(set (match_operand:BLK 0 "memory_operand" "")
5553 (and:BLK (match_dup 0)
5554 (match_operand:BLK 1 "memory_operand" "")))
5555 (use (match_operand 2 "const_int_operand" ""))
5556 (clobber (reg:CC CC_REGNUM))])
5558 [(set (match_operand:BLK 3 "memory_operand" "")
5559 (and:BLK (match_dup 3)
5560 (match_operand:BLK 4 "memory_operand" "")))
5561 (use (match_operand 5 "const_int_operand" ""))
5562 (clobber (reg:CC CC_REGNUM))])]
5563 "s390_offset_p (operands[0], operands[3], operands[2])
5564 && s390_offset_p (operands[1], operands[4], operands[2])
5565 && !s390_overlap_p (operands[0], operands[1],
5566 INTVAL (operands[2]) + INTVAL (operands[5]))
5567 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
5569 [(set (match_dup 6) (and:BLK (match_dup 6) (match_dup 7)))
5571 (clobber (reg:CC CC_REGNUM))])]
5572 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
5573 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
5574 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
5578 ;;- Bit set (inclusive or) instructions.
5581 (define_expand "ior<mode>3"
5582 [(set (match_operand:INT 0 "nonimmediate_operand" "")
5583 (ior:INT (match_operand:INT 1 "nonimmediate_operand" "")
5584 (match_operand:INT 2 "general_operand" "")))
5585 (clobber (reg:CC CC_REGNUM))]
5587 "s390_expand_logical_operator (IOR, <MODE>mode, operands); DONE;")
5590 ; iordi3 instruction pattern(s).
5593 (define_insn "*iordi3_cc"
5594 [(set (reg CC_REGNUM)
5595 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5596 (match_operand:DI 2 "general_operand" "d,m"))
5598 (set (match_operand:DI 0 "register_operand" "=d,d")
5599 (ior:DI (match_dup 1) (match_dup 2)))]
5600 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5604 [(set_attr "op_type" "RRE,RXY")])
5606 (define_insn "*iordi3_cconly"
5607 [(set (reg CC_REGNUM)
5608 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5609 (match_operand:DI 2 "general_operand" "d,m"))
5611 (clobber (match_scratch:DI 0 "=d,d"))]
5612 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5616 [(set_attr "op_type" "RRE,RXY")])
5618 (define_insn "*iordi3_extimm"
5619 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q")
5620 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0,0,0,0,0,0,0")
5621 (match_operand:DI 2 "general_operand"
5622 "N0HD0,N1HD0,N2HD0,N3HD0,N0SD0,N1SD0,d,m,NxQD0,Q")))
5623 (clobber (reg:CC CC_REGNUM))]
5624 "TARGET_64BIT && TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5636 [(set_attr "op_type" "RI,RI,RI,RI,RIL,RIL,RRE,RXY,SI,SS")])
5638 (define_insn "*iordi3"
5639 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,AQ,Q")
5640 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0,0,0,0,0")
5641 (match_operand:DI 2 "general_operand"
5642 "N0HD0,N1HD0,N2HD0,N3HD0,d,m,NxQD0,Q")))
5643 (clobber (reg:CC CC_REGNUM))]
5644 "TARGET_64BIT && !TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5654 [(set_attr "op_type" "RI,RI,RI,RI,RRE,RXY,SI,SS")])
5657 [(set (match_operand:DI 0 "s_operand" "")
5658 (ior:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5659 (clobber (reg:CC CC_REGNUM))]
5662 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5663 (clobber (reg:CC CC_REGNUM))])]
5664 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5667 ; iorsi3 instruction pattern(s).
5670 (define_insn "*iorsi3_cc"
5671 [(set (reg CC_REGNUM)
5672 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5673 (match_operand:SI 2 "general_operand" "Os,d,R,T"))
5675 (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
5676 (ior:SI (match_dup 1) (match_dup 2)))]
5677 "s390_match_ccmode(insn, CCTmode)"
5683 [(set_attr "op_type" "RIL,RR,RX,RXY")])
5685 (define_insn "*iorsi3_cconly"
5686 [(set (reg CC_REGNUM)
5687 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5688 (match_operand:SI 2 "general_operand" "Os,d,R,T"))
5690 (clobber (match_scratch:SI 0 "=d,d,d,d"))]
5691 "s390_match_ccmode(insn, CCTmode)"
5697 [(set_attr "op_type" "RIL,RR,RX,RXY")])
5699 (define_insn "*iorsi3_zarch"
5700 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,AQ,Q")
5701 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0,0,0,0")
5702 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,Os,d,R,T,NxQS0,Q")))
5703 (clobber (reg:CC CC_REGNUM))]
5704 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5714 [(set_attr "op_type" "RI,RI,RIL,RR,RX,RXY,SI,SS")])
5716 (define_insn "*iorsi3_esa"
5717 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5718 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5719 (match_operand:SI 2 "general_operand" "d,R,NxQS0,Q")))
5720 (clobber (reg:CC CC_REGNUM))]
5721 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5727 [(set_attr "op_type" "RR,RX,SI,SS")])
5730 [(set (match_operand:SI 0 "s_operand" "")
5731 (ior:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5732 (clobber (reg:CC CC_REGNUM))]
5735 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5736 (clobber (reg:CC CC_REGNUM))])]
5737 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5740 ; iorhi3 instruction pattern(s).
5743 (define_insn "*iorhi3_zarch"
5744 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5745 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0,0")
5746 (match_operand:HI 2 "general_operand" "d,n,NxQH0,Q")))
5747 (clobber (reg:CC CC_REGNUM))]
5748 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5754 [(set_attr "op_type" "RR,RI,SI,SS")])
5756 (define_insn "*iorhi3_esa"
5757 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
5758 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
5759 (match_operand:HI 2 "general_operand" "d,NxQH0,Q")))
5760 (clobber (reg:CC CC_REGNUM))]
5761 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5766 [(set_attr "op_type" "RR,SI,SS")])
5769 [(set (match_operand:HI 0 "s_operand" "")
5770 (ior:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
5771 (clobber (reg:CC CC_REGNUM))]
5774 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
5775 (clobber (reg:CC CC_REGNUM))])]
5776 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
5779 ; iorqi3 instruction pattern(s).
5782 (define_insn "*iorqi3_zarch"
5783 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,Q,S,Q")
5784 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0,0")
5785 (match_operand:QI 2 "general_operand" "d,n,n,n,Q")))
5786 (clobber (reg:CC CC_REGNUM))]
5787 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5794 [(set_attr "op_type" "RR,RI,SI,SIY,SS")])
5796 (define_insn "*iorqi3_esa"
5797 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
5798 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
5799 (match_operand:QI 2 "general_operand" "d,n,Q")))
5800 (clobber (reg:CC CC_REGNUM))]
5801 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
5806 [(set_attr "op_type" "RR,SI,SS")])
5809 ; Block inclusive or (OC) patterns.
5813 [(set (match_operand:BLK 0 "memory_operand" "=Q")
5814 (ior:BLK (match_dup 0)
5815 (match_operand:BLK 1 "memory_operand" "Q")))
5816 (use (match_operand 2 "const_int_operand" "n"))
5817 (clobber (reg:CC CC_REGNUM))]
5818 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
5819 "oc\t%O0(%2,%R0),%S1"
5820 [(set_attr "op_type" "SS")])
5823 [(set (match_operand 0 "memory_operand" "")
5825 (match_operand 1 "memory_operand" "")))
5826 (clobber (reg:CC CC_REGNUM))]
5828 && GET_MODE (operands[0]) == GET_MODE (operands[1])
5829 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
5831 [(set (match_dup 0) (ior:BLK (match_dup 0) (match_dup 1)))
5833 (clobber (reg:CC CC_REGNUM))])]
5835 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
5836 operands[0] = adjust_address (operands[0], BLKmode, 0);
5837 operands[1] = adjust_address (operands[1], BLKmode, 0);
5842 [(set (match_operand:BLK 0 "memory_operand" "")
5843 (ior:BLK (match_dup 0)
5844 (match_operand:BLK 1 "memory_operand" "")))
5845 (use (match_operand 2 "const_int_operand" ""))
5846 (clobber (reg:CC CC_REGNUM))])
5848 [(set (match_operand:BLK 3 "memory_operand" "")
5849 (ior:BLK (match_dup 3)
5850 (match_operand:BLK 4 "memory_operand" "")))
5851 (use (match_operand 5 "const_int_operand" ""))
5852 (clobber (reg:CC CC_REGNUM))])]
5853 "s390_offset_p (operands[0], operands[3], operands[2])
5854 && s390_offset_p (operands[1], operands[4], operands[2])
5855 && !s390_overlap_p (operands[0], operands[1],
5856 INTVAL (operands[2]) + INTVAL (operands[5]))
5857 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
5859 [(set (match_dup 6) (ior:BLK (match_dup 6) (match_dup 7)))
5861 (clobber (reg:CC CC_REGNUM))])]
5862 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
5863 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
5864 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
5868 ;;- Xor instructions.
5871 (define_expand "xor<mode>3"
5872 [(set (match_operand:INT 0 "nonimmediate_operand" "")
5873 (xor:INT (match_operand:INT 1 "nonimmediate_operand" "")
5874 (match_operand:INT 2 "general_operand" "")))
5875 (clobber (reg:CC CC_REGNUM))]
5877 "s390_expand_logical_operator (XOR, <MODE>mode, operands); DONE;")
5880 ; xordi3 instruction pattern(s).
5883 (define_insn "*xordi3_cc"
5884 [(set (reg CC_REGNUM)
5885 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5886 (match_operand:DI 2 "general_operand" "d,m"))
5888 (set (match_operand:DI 0 "register_operand" "=d,d")
5889 (xor:DI (match_dup 1) (match_dup 2)))]
5890 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5894 [(set_attr "op_type" "RRE,RXY")])
5896 (define_insn "*xordi3_cconly"
5897 [(set (reg CC_REGNUM)
5898 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5899 (match_operand:DI 2 "general_operand" "d,m"))
5901 (clobber (match_scratch:DI 0 "=d,d"))]
5902 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5906 [(set_attr "op_type" "RRE,RXY")])
5908 (define_insn "*xordi3_extimm"
5909 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,AQ,Q")
5910 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0,0,0")
5911 (match_operand:DI 2 "general_operand" "N0SD0,N1SD0,d,m,NxQD0,Q")))
5912 (clobber (reg:CC CC_REGNUM))]
5913 "TARGET_64BIT && TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5921 [(set_attr "op_type" "RIL,RIL,RRE,RXY,SI,SS")])
5923 (define_insn "*xordi3"
5924 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,AQ,Q")
5925 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
5926 (match_operand:DI 2 "general_operand" "d,m,NxQD0,Q")))
5927 (clobber (reg:CC CC_REGNUM))]
5928 "TARGET_64BIT && !TARGET_EXTIMM && s390_logical_operator_ok_p (operands)"
5934 [(set_attr "op_type" "RRE,RXY,SI,SS")])
5937 [(set (match_operand:DI 0 "s_operand" "")
5938 (xor:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
5939 (clobber (reg:CC CC_REGNUM))]
5942 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
5943 (clobber (reg:CC CC_REGNUM))])]
5944 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
5947 ; xorsi3 instruction pattern(s).
5950 (define_insn "*xorsi3_cc"
5951 [(set (reg CC_REGNUM)
5952 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5953 (match_operand:SI 2 "general_operand" "Os,d,R,T"))
5955 (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
5956 (xor:SI (match_dup 1) (match_dup 2)))]
5957 "s390_match_ccmode(insn, CCTmode)"
5963 [(set_attr "op_type" "RIL,RR,RX,RXY")])
5965 (define_insn "*xorsi3_cconly"
5966 [(set (reg CC_REGNUM)
5967 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
5968 (match_operand:SI 2 "general_operand" "Os,d,R,T"))
5970 (clobber (match_scratch:SI 0 "=d,d,d,d"))]
5971 "s390_match_ccmode(insn, CCTmode)"
5977 [(set_attr "op_type" "RIL,RR,RX,RXY")])
5979 (define_insn "*xorsi3"
5980 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,AQ,Q")
5981 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0,0")
5982 (match_operand:SI 2 "general_operand" "Os,d,R,T,NxQS0,Q")))
5983 (clobber (reg:CC CC_REGNUM))]
5984 "s390_logical_operator_ok_p (operands)"
5992 [(set_attr "op_type" "RIL,RR,RX,RXY,SI,SS")])
5995 [(set (match_operand:SI 0 "s_operand" "")
5996 (xor:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
5997 (clobber (reg:CC CC_REGNUM))]
6000 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
6001 (clobber (reg:CC CC_REGNUM))])]
6002 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
6005 ; xorhi3 instruction pattern(s).
6008 (define_insn "*xorhi3"
6009 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,AQ,Q")
6010 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0,0")
6011 (match_operand:HI 2 "general_operand" "Os,d,NxQH0,Q")))
6012 (clobber (reg:CC CC_REGNUM))]
6013 "s390_logical_operator_ok_p (operands)"
6019 [(set_attr "op_type" "RIL,RR,SI,SS")])
6022 [(set (match_operand:HI 0 "s_operand" "")
6023 (xor:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
6024 (clobber (reg:CC CC_REGNUM))]
6027 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
6028 (clobber (reg:CC CC_REGNUM))])]
6029 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
6032 ; xorqi3 instruction pattern(s).
6035 (define_insn "*xorqi3"
6036 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,Q,S,Q")
6037 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0,0")
6038 (match_operand:QI 2 "general_operand" "Os,d,n,n,Q")))
6039 (clobber (reg:CC CC_REGNUM))]
6040 "s390_logical_operator_ok_p (operands)"
6047 [(set_attr "op_type" "RIL,RR,SI,SIY,SS")])
6050 ; Block exclusive or (XC) patterns.
6054 [(set (match_operand:BLK 0 "memory_operand" "=Q")
6055 (xor:BLK (match_dup 0)
6056 (match_operand:BLK 1 "memory_operand" "Q")))
6057 (use (match_operand 2 "const_int_operand" "n"))
6058 (clobber (reg:CC CC_REGNUM))]
6059 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
6060 "xc\t%O0(%2,%R0),%S1"
6061 [(set_attr "op_type" "SS")])
6064 [(set (match_operand 0 "memory_operand" "")
6066 (match_operand 1 "memory_operand" "")))
6067 (clobber (reg:CC CC_REGNUM))]
6069 && GET_MODE (operands[0]) == GET_MODE (operands[1])
6070 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
6072 [(set (match_dup 0) (xor:BLK (match_dup 0) (match_dup 1)))
6074 (clobber (reg:CC CC_REGNUM))])]
6076 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
6077 operands[0] = adjust_address (operands[0], BLKmode, 0);
6078 operands[1] = adjust_address (operands[1], BLKmode, 0);
6083 [(set (match_operand:BLK 0 "memory_operand" "")
6084 (xor:BLK (match_dup 0)
6085 (match_operand:BLK 1 "memory_operand" "")))
6086 (use (match_operand 2 "const_int_operand" ""))
6087 (clobber (reg:CC CC_REGNUM))])
6089 [(set (match_operand:BLK 3 "memory_operand" "")
6090 (xor:BLK (match_dup 3)
6091 (match_operand:BLK 4 "memory_operand" "")))
6092 (use (match_operand 5 "const_int_operand" ""))
6093 (clobber (reg:CC CC_REGNUM))])]
6094 "s390_offset_p (operands[0], operands[3], operands[2])
6095 && s390_offset_p (operands[1], operands[4], operands[2])
6096 && !s390_overlap_p (operands[0], operands[1],
6097 INTVAL (operands[2]) + INTVAL (operands[5]))
6098 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
6100 [(set (match_dup 6) (xor:BLK (match_dup 6) (match_dup 7)))
6102 (clobber (reg:CC CC_REGNUM))])]
6103 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
6104 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
6105 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
6108 ; Block xor (XC) patterns with src == dest.
6111 (define_insn "*xc_zero"
6112 [(set (match_operand:BLK 0 "memory_operand" "=Q")
6114 (use (match_operand 1 "const_int_operand" "n"))
6115 (clobber (reg:CC CC_REGNUM))]
6116 "INTVAL (operands[1]) >= 1 && INTVAL (operands[1]) <= 256"
6117 "xc\t%O0(%1,%R0),%S0"
6118 [(set_attr "op_type" "SS")])
6122 [(set (match_operand:BLK 0 "memory_operand" "")
6124 (use (match_operand 1 "const_int_operand" ""))
6125 (clobber (reg:CC CC_REGNUM))])
6127 [(set (match_operand:BLK 2 "memory_operand" "")
6129 (use (match_operand 3 "const_int_operand" ""))
6130 (clobber (reg:CC CC_REGNUM))])]
6131 "s390_offset_p (operands[0], operands[2], operands[1])
6132 && INTVAL (operands[1]) + INTVAL (operands[3]) <= 256"
6134 [(set (match_dup 4) (const_int 0))
6136 (clobber (reg:CC CC_REGNUM))])]
6137 "operands[4] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
6138 operands[5] = GEN_INT (INTVAL (operands[1]) + INTVAL (operands[3]));")
6142 ;;- Negate instructions.
6146 ; neg(di|si)2 instruction pattern(s).
6149 (define_expand "neg<mode>2"
6151 [(set (match_operand:DSI 0 "register_operand" "=d")
6152 (neg:DSI (match_operand:DSI 1 "register_operand" "d")))
6153 (clobber (reg:CC CC_REGNUM))])]
6157 (define_insn "*negdi2_sign_cc"
6158 [(set (reg CC_REGNUM)
6159 (compare (neg:DI (ashiftrt:DI (ashift:DI (subreg:DI
6160 (match_operand:SI 1 "register_operand" "d") 0)
6161 (const_int 32)) (const_int 32)))
6163 (set (match_operand:DI 0 "register_operand" "=d")
6164 (neg:DI (sign_extend:DI (match_dup 1))))]
6165 "TARGET_64BIT && s390_match_ccmode (insn, CCAmode)"
6167 [(set_attr "op_type" "RRE")])
6169 (define_insn "*negdi2_sign"
6170 [(set (match_operand:DI 0 "register_operand" "=d")
6171 (neg:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
6172 (clobber (reg:CC CC_REGNUM))]
6175 [(set_attr "op_type" "RRE")])
6177 (define_insn "*neg<mode>2_cc"
6178 [(set (reg CC_REGNUM)
6179 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
6181 (set (match_operand:GPR 0 "register_operand" "=d")
6182 (neg:GPR (match_dup 1)))]
6183 "s390_match_ccmode (insn, CCAmode)"
6185 [(set_attr "op_type" "RR<E>")])
6187 (define_insn "*neg<mode>2_cconly"
6188 [(set (reg CC_REGNUM)
6189 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
6191 (clobber (match_scratch:GPR 0 "=d"))]
6192 "s390_match_ccmode (insn, CCAmode)"
6194 [(set_attr "op_type" "RR<E>")])
6196 (define_insn "*neg<mode>2"
6197 [(set (match_operand:GPR 0 "register_operand" "=d")
6198 (neg:GPR (match_operand:GPR 1 "register_operand" "d")))
6199 (clobber (reg:CC CC_REGNUM))]
6202 [(set_attr "op_type" "RR<E>")])
6204 (define_insn_and_split "*negdi2_31"
6205 [(set (match_operand:DI 0 "register_operand" "=d")
6206 (neg:DI (match_operand:DI 1 "register_operand" "d")))
6207 (clobber (reg:CC CC_REGNUM))]
6210 "&& reload_completed"
6212 [(set (match_dup 2) (neg:SI (match_dup 3)))
6213 (clobber (reg:CC CC_REGNUM))])
6215 [(set (reg:CCAP CC_REGNUM)
6216 (compare:CCAP (neg:SI (match_dup 5)) (const_int 0)))
6217 (set (match_dup 4) (neg:SI (match_dup 5)))])
6219 (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
6221 (label_ref (match_dup 6))))
6223 [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
6224 (clobber (reg:CC CC_REGNUM))])
6226 "operands[2] = operand_subword (operands[0], 0, 0, DImode);
6227 operands[3] = operand_subword (operands[1], 0, 0, DImode);
6228 operands[4] = operand_subword (operands[0], 1, 0, DImode);
6229 operands[5] = operand_subword (operands[1], 1, 0, DImode);
6230 operands[6] = gen_label_rtx ();")
6233 ; neg(df|sf)2 instruction pattern(s).
6236 (define_expand "neg<mode>2"
6238 [(set (match_operand:FPR 0 "register_operand" "=f")
6239 (neg:FPR (match_operand:FPR 1 "register_operand" "f")))
6240 (clobber (reg:CC CC_REGNUM))])]
6244 (define_insn "*neg<mode>2_cc"
6245 [(set (reg CC_REGNUM)
6246 (compare (neg:FPR (match_operand:FPR 1 "register_operand" "f"))
6247 (match_operand:FPR 2 "const0_operand" "")))
6248 (set (match_operand:FPR 0 "register_operand" "=f")
6249 (neg:FPR (match_dup 1)))]
6250 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6252 [(set_attr "op_type" "RRE")
6253 (set_attr "type" "fsimp<mode>")])
6255 (define_insn "*neg<mode>2_cconly"
6256 [(set (reg CC_REGNUM)
6257 (compare (neg:FPR (match_operand:FPR 1 "register_operand" "f"))
6258 (match_operand:FPR 2 "const0_operand" "")))
6259 (clobber (match_scratch:FPR 0 "=f"))]
6260 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6262 [(set_attr "op_type" "RRE")
6263 (set_attr "type" "fsimp<mode>")])
6265 (define_insn "*neg<mode>2"
6266 [(set (match_operand:FPR 0 "register_operand" "=f")
6267 (neg:FPR (match_operand:FPR 1 "register_operand" "f")))
6268 (clobber (reg:CC CC_REGNUM))]
6269 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6271 [(set_attr "op_type" "RRE")
6272 (set_attr "type" "fsimp<mode>")])
6274 (define_insn "*neg<mode>2_ibm"
6275 [(set (match_operand:FPR 0 "register_operand" "=f")
6276 (neg:FPR (match_operand:FPR 1 "register_operand" "f")))
6277 (clobber (reg:CC CC_REGNUM))]
6278 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6280 [(set_attr "op_type" "<RRe>")
6281 (set_attr "type" "fsimp<mode>")])
6285 ;;- Absolute value instructions.
6289 ; abs(di|si)2 instruction pattern(s).
6292 (define_insn "*absdi2_sign_cc"
6293 [(set (reg CC_REGNUM)
6294 (compare (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
6295 (match_operand:SI 1 "register_operand" "d") 0)
6296 (const_int 32)) (const_int 32)))
6298 (set (match_operand:DI 0 "register_operand" "=d")
6299 (abs:DI (sign_extend:DI (match_dup 1))))]
6300 "TARGET_64BIT && s390_match_ccmode (insn, CCAmode)"
6302 [(set_attr "op_type" "RRE")])
6304 (define_insn "*absdi2_sign"
6305 [(set (match_operand:DI 0 "register_operand" "=d")
6306 (abs:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
6307 (clobber (reg:CC CC_REGNUM))]
6310 [(set_attr "op_type" "RRE")])
6312 (define_insn "*abs<mode>2_cc"
6313 [(set (reg CC_REGNUM)
6314 (compare (abs:GPR (match_operand:DI 1 "register_operand" "d"))
6316 (set (match_operand:GPR 0 "register_operand" "=d")
6317 (abs:GPR (match_dup 1)))]
6318 "s390_match_ccmode (insn, CCAmode)"
6320 [(set_attr "op_type" "RR<E>")])
6322 (define_insn "*abs<mode>2_cconly"
6323 [(set (reg CC_REGNUM)
6324 (compare (abs:GPR (match_operand:GPR 1 "register_operand" "d"))
6326 (clobber (match_scratch:GPR 0 "=d"))]
6327 "s390_match_ccmode (insn, CCAmode)"
6329 [(set_attr "op_type" "RR<E>")])
6331 (define_insn "abs<mode>2"
6332 [(set (match_operand:GPR 0 "register_operand" "=d")
6333 (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
6334 (clobber (reg:CC CC_REGNUM))]
6337 [(set_attr "op_type" "RR<E>")])
6340 ; abs(df|sf)2 instruction pattern(s).
6343 (define_expand "abs<mode>2"
6345 [(set (match_operand:FPR 0 "register_operand" "=f")
6346 (abs:FPR (match_operand:FPR 1 "register_operand" "f")))
6347 (clobber (reg:CC CC_REGNUM))])]
6351 (define_insn "*abs<mode>2_cc"
6352 [(set (reg CC_REGNUM)
6353 (compare (abs:FPR (match_operand:FPR 1 "register_operand" "f"))
6354 (match_operand:FPR 2 "const0_operand" "")))
6355 (set (match_operand:FPR 0 "register_operand" "=f")
6356 (abs:FPR (match_dup 1)))]
6357 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6359 [(set_attr "op_type" "RRE")
6360 (set_attr "type" "fsimp<mode>")])
6362 (define_insn "*abs<mode>2_cconly"
6363 [(set (reg CC_REGNUM)
6364 (compare (abs:FPR (match_operand:FPR 1 "register_operand" "f"))
6365 (match_operand:FPR 2 "const0_operand" "")))
6366 (clobber (match_scratch:FPR 0 "=f"))]
6367 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6369 [(set_attr "op_type" "RRE")
6370 (set_attr "type" "fsimp<mode>")])
6372 (define_insn "*abs<mode>2"
6373 [(set (match_operand:FPR 0 "register_operand" "=f")
6374 (abs:FPR (match_operand:FPR 1 "register_operand" "f")))
6375 (clobber (reg:CC CC_REGNUM))]
6376 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6378 [(set_attr "op_type" "RRE")
6379 (set_attr "type" "fsimp<mode>")])
6381 (define_insn "*abs<mode>2_ibm"
6382 [(set (match_operand:FPR 0 "register_operand" "=f")
6383 (abs:FPR (match_operand:FPR 1 "register_operand" "f")))
6384 (clobber (reg:CC CC_REGNUM))]
6385 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6387 [(set_attr "op_type" "<RRe>")
6388 (set_attr "type" "fsimp<mode>")])
6391 ;;- Negated absolute value instructions
6398 (define_insn "*negabsdi2_sign_cc"
6399 [(set (reg CC_REGNUM)
6400 (compare (neg:DI (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
6401 (match_operand:SI 1 "register_operand" "d") 0)
6402 (const_int 32)) (const_int 32))))
6404 (set (match_operand:DI 0 "register_operand" "=d")
6405 (neg:DI (abs:DI (sign_extend:DI (match_dup 1)))))]
6406 "TARGET_64BIT && s390_match_ccmode (insn, CCAmode)"
6408 [(set_attr "op_type" "RRE")])
6410 (define_insn "*negabsdi2_sign"
6411 [(set (match_operand:DI 0 "register_operand" "=d")
6412 (neg:DI (abs:DI (sign_extend:DI
6413 (match_operand:SI 1 "register_operand" "d")))))
6414 (clobber (reg:CC CC_REGNUM))]
6417 [(set_attr "op_type" "RRE")])
6419 (define_insn "*negabs<mode>2_cc"
6420 [(set (reg CC_REGNUM)
6421 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
6423 (set (match_operand:GPR 0 "register_operand" "=d")
6424 (neg:GPR (abs:GPR (match_dup 1))))]
6425 "s390_match_ccmode (insn, CCAmode)"
6427 [(set_attr "op_type" "RR<E>")])
6429 (define_insn "*negabs<mode>2_cconly"
6430 [(set (reg CC_REGNUM)
6431 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
6433 (clobber (match_scratch:GPR 0 "=d"))]
6434 "s390_match_ccmode (insn, CCAmode)"
6436 [(set_attr "op_type" "RR<E>")])
6438 (define_insn "*negabs<mode>2"
6439 [(set (match_operand:GPR 0 "register_operand" "=d")
6440 (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d"))))
6441 (clobber (reg:CC CC_REGNUM))]
6444 [(set_attr "op_type" "RR<E>")])
6450 (define_insn "*negabs<mode>2_cc"
6451 [(set (reg CC_REGNUM)
6452 (compare (neg:FPR (abs:FPR (match_operand:FPR 1 "register_operand" "f")))
6453 (match_operand:FPR 2 "const0_operand" "")))
6454 (set (match_operand:FPR 0 "register_operand" "=f")
6455 (neg:FPR (abs:FPR (match_dup 1))))]
6456 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6458 [(set_attr "op_type" "RRE")
6459 (set_attr "type" "fsimp<mode>")])
6461 (define_insn "*negabs<mode>2_cconly"
6462 [(set (reg CC_REGNUM)
6463 (compare (neg:FPR (abs:FPR (match_operand:FPR 1 "register_operand" "f")))
6464 (match_operand:FPR 2 "const0_operand" "")))
6465 (clobber (match_scratch:FPR 0 "=f"))]
6466 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6468 [(set_attr "op_type" "RRE")
6469 (set_attr "type" "fsimp<mode>")])
6471 (define_insn "*negabs<mode>2"
6472 [(set (match_operand:FPR 0 "register_operand" "=f")
6473 (neg:FPR (abs:FPR (match_operand:FPR 1 "register_operand" "f"))))
6474 (clobber (reg:CC CC_REGNUM))]
6475 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6477 [(set_attr "op_type" "RRE")
6478 (set_attr "type" "fsimp<mode>")])
6481 ;;- Square root instructions.
6485 ; sqrt(df|sf)2 instruction pattern(s).
6488 (define_insn "sqrt<mode>2"
6489 [(set (match_operand:FPR 0 "register_operand" "=f,f")
6490 (sqrt:FPR (match_operand:FPR 1 "general_operand" "f,<Rf>")))]
6491 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6495 [(set_attr "op_type" "RRE,RXE")
6496 (set_attr "type" "fsqrt<mode>")])
6500 ;;- One complement instructions.
6504 ; one_cmpl(di|si|hi|qi)2 instruction pattern(s).
6507 (define_expand "one_cmpl<mode>2"
6509 [(set (match_operand:INT 0 "register_operand" "")
6510 (xor:INT (match_operand:INT 1 "register_operand" "")
6512 (clobber (reg:CC CC_REGNUM))])]
6518 ;; Find leftmost bit instructions.
6521 (define_expand "clzdi2"
6522 [(set (match_operand:DI 0 "register_operand" "=d")
6523 (clz:DI (match_operand:DI 1 "register_operand" "d")))]
6524 "TARGET_EXTIMM && TARGET_64BIT"
6526 rtx insn, clz_equal;
6527 rtx wide_reg = gen_reg_rtx (TImode);
6528 rtx msb = gen_rtx_CONST_INT (DImode, (unsigned HOST_WIDE_INT) 1 << 63);
6530 clz_equal = gen_rtx_CLZ (DImode, operands[1]);
6532 emit_insn (gen_clztidi2 (wide_reg, operands[1], msb));
6534 insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg));
6536 gen_rtx_EXPR_LIST (REG_EQUAL, clz_equal, REG_NOTES (insn));
6541 (define_insn "clztidi2"
6542 [(set (match_operand:TI 0 "register_operand" "=d")
6546 (xor:DI (match_operand:DI 1 "register_operand" "d")
6547 (lshiftrt (match_operand:DI 2 "const_int_operand" "")
6548 (subreg:SI (clz:DI (match_dup 1)) 4))))
6551 (zero_extend:TI (clz:DI (match_dup 1)))))
6552 (clobber (reg:CC CC_REGNUM))]
6553 "(unsigned HOST_WIDE_INT) INTVAL (operands[2])
6554 == (unsigned HOST_WIDE_INT) 1 << 63
6555 && TARGET_EXTIMM && TARGET_64BIT"
6557 [(set_attr "op_type" "RRE")])
6561 ;;- Rotate instructions.
6565 ; rotl(di|si)3 instruction pattern(s).
6568 (define_insn "rotl<mode>3"
6569 [(set (match_operand:GPR 0 "register_operand" "=d")
6570 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
6571 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
6574 [(set_attr "op_type" "RSE")
6575 (set_attr "atype" "reg")])
6577 (define_insn "*rotl<mode>3_and"
6578 [(set (match_operand:GPR 0 "register_operand" "=d")
6579 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
6580 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6581 (match_operand:SI 3 "const_int_operand" "n"))))]
6582 "TARGET_CPU_ZARCH && (INTVAL (operands[3]) & 63) == 63"
6584 [(set_attr "op_type" "RSE")
6585 (set_attr "atype" "reg")])
6589 ;;- Shift instructions.
6593 ; (ashl|lshr)di3 instruction pattern(s).
6596 (define_expand "<shift>di3"
6597 [(set (match_operand:DI 0 "register_operand" "")
6598 (SHIFT:DI (match_operand:DI 1 "register_operand" "")
6599 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))]
6603 (define_insn "*<shift>di3_31"
6604 [(set (match_operand:DI 0 "register_operand" "=d")
6605 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
6606 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
6609 [(set_attr "op_type" "RS")
6610 (set_attr "atype" "reg")])
6612 (define_insn "*<shift>di3_64"
6613 [(set (match_operand:DI 0 "register_operand" "=d")
6614 (SHIFT:DI (match_operand:DI 1 "register_operand" "d")
6615 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
6617 "s<lr>lg\t%0,%1,%Y2"
6618 [(set_attr "op_type" "RSE")
6619 (set_attr "atype" "reg")])
6621 (define_insn "*<shift>di3_31_and"
6622 [(set (match_operand:DI 0 "register_operand" "=d")
6623 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
6624 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6625 (match_operand:SI 3 "const_int_operand" "n"))))]
6626 "!TARGET_64BIT && (INTVAL (operands[3]) & 63) == 63"
6628 [(set_attr "op_type" "RS")
6629 (set_attr "atype" "reg")])
6631 (define_insn "*<shift>di3_64_and"
6632 [(set (match_operand:DI 0 "register_operand" "=d")
6633 (SHIFT:DI (match_operand:DI 1 "register_operand" "d")
6634 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6635 (match_operand:SI 3 "const_int_operand" "n"))))]
6636 "TARGET_64BIT && (INTVAL (operands[3]) & 63) == 63"
6637 "s<lr>lg\t%0,%1,%Y2"
6638 [(set_attr "op_type" "RSE")
6639 (set_attr "atype" "reg")])
6642 ; ashrdi3 instruction pattern(s).
6645 (define_expand "ashrdi3"
6647 [(set (match_operand:DI 0 "register_operand" "")
6648 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6649 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))
6650 (clobber (reg:CC CC_REGNUM))])]
6654 (define_insn "*ashrdi3_cc_31"
6655 [(set (reg CC_REGNUM)
6656 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6657 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
6659 (set (match_operand:DI 0 "register_operand" "=d")
6660 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6661 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6663 [(set_attr "op_type" "RS")
6664 (set_attr "atype" "reg")])
6666 (define_insn "*ashrdi3_cconly_31"
6667 [(set (reg CC_REGNUM)
6668 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6669 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
6671 (clobber (match_scratch:DI 0 "=d"))]
6672 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6674 [(set_attr "op_type" "RS")
6675 (set_attr "atype" "reg")])
6677 (define_insn "*ashrdi3_31"
6678 [(set (match_operand:DI 0 "register_operand" "=d")
6679 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6680 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))
6681 (clobber (reg:CC CC_REGNUM))]
6684 [(set_attr "op_type" "RS")
6685 (set_attr "atype" "reg")])
6687 (define_insn "*ashrdi3_cc_64"
6688 [(set (reg CC_REGNUM)
6689 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6690 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
6692 (set (match_operand:DI 0 "register_operand" "=d")
6693 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6694 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6696 [(set_attr "op_type" "RSE")
6697 (set_attr "atype" "reg")])
6699 (define_insn "*ashrdi3_cconly_64"
6700 [(set (reg CC_REGNUM)
6701 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6702 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
6704 (clobber (match_scratch:DI 0 "=d"))]
6705 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6707 [(set_attr "op_type" "RSE")
6708 (set_attr "atype" "reg")])
6710 (define_insn "*ashrdi3_64"
6711 [(set (match_operand:DI 0 "register_operand" "=d")
6712 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6713 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))
6714 (clobber (reg:CC CC_REGNUM))]
6717 [(set_attr "op_type" "RSE")
6718 (set_attr "atype" "reg")])
6721 ; shift pattern with implicit ANDs
6723 (define_insn "*ashrdi3_cc_31_and"
6724 [(set (reg CC_REGNUM)
6725 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6726 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6727 (match_operand:SI 3 "const_int_operand" "n")))
6729 (set (match_operand:DI 0 "register_operand" "=d")
6730 (ashiftrt:DI (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
6731 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)
6732 && (INTVAL (operands[3]) & 63) == 63"
6734 [(set_attr "op_type" "RS")
6735 (set_attr "atype" "reg")])
6737 (define_insn "*ashrdi3_cconly_31_and"
6738 [(set (reg CC_REGNUM)
6739 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6740 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6741 (match_operand:SI 3 "const_int_operand" "n")))
6743 (clobber (match_scratch:DI 0 "=d"))]
6744 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)
6745 && (INTVAL (operands[3]) & 63) == 63"
6747 [(set_attr "op_type" "RS")
6748 (set_attr "atype" "reg")])
6750 (define_insn "*ashrdi3_31_and"
6751 [(set (match_operand:DI 0 "register_operand" "=d")
6752 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6753 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6754 (match_operand:SI 3 "const_int_operand" "n"))))
6755 (clobber (reg:CC CC_REGNUM))]
6756 "!TARGET_64BIT && (INTVAL (operands[3]) & 63) == 63"
6758 [(set_attr "op_type" "RS")
6759 (set_attr "atype" "reg")])
6761 (define_insn "*ashrdi3_cc_64_and"
6762 [(set (reg CC_REGNUM)
6763 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6764 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6765 (match_operand:SI 3 "const_int_operand" "n")))
6767 (set (match_operand:DI 0 "register_operand" "=d")
6768 (ashiftrt:DI (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
6769 "TARGET_64BIT && s390_match_ccmode(insn, CCSmode)
6770 && (INTVAL (operands[3]) & 63) == 63"
6772 [(set_attr "op_type" "RSE")
6773 (set_attr "atype" "reg")])
6775 (define_insn "*ashrdi3_cconly_64_and"
6776 [(set (reg CC_REGNUM)
6777 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6778 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6779 (match_operand:SI 3 "const_int_operand" "n")))
6781 (clobber (match_scratch:DI 0 "=d"))]
6782 "TARGET_64BIT && s390_match_ccmode(insn, CCSmode)
6783 && (INTVAL (operands[3]) & 63) == 63"
6785 [(set_attr "op_type" "RSE")
6786 (set_attr "atype" "reg")])
6788 (define_insn "*ashrdi3_64_and"
6789 [(set (match_operand:DI 0 "register_operand" "=d")
6790 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6791 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6792 (match_operand:SI 3 "const_int_operand" "n"))))
6793 (clobber (reg:CC CC_REGNUM))]
6794 "TARGET_64BIT && (INTVAL (operands[3]) & 63) == 63"
6796 [(set_attr "op_type" "RSE")
6797 (set_attr "atype" "reg")])
6800 ; (ashl|lshr)si3 instruction pattern(s).
6803 (define_insn "<shift>si3"
6804 [(set (match_operand:SI 0 "register_operand" "=d")
6805 (SHIFT:SI (match_operand:SI 1 "register_operand" "0")
6806 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
6809 [(set_attr "op_type" "RS")
6810 (set_attr "atype" "reg")])
6812 (define_insn "*<shift>si3_and"
6813 [(set (match_operand:SI 0 "register_operand" "=d")
6814 (SHIFT:SI (match_operand:SI 1 "register_operand" "0")
6815 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6816 (match_operand:SI 3 "const_int_operand" "n"))))]
6817 "(INTVAL (operands[3]) & 63) == 63"
6819 [(set_attr "op_type" "RS")
6820 (set_attr "atype" "reg")])
6823 ; ashrsi3 instruction pattern(s).
6826 (define_insn "*ashrsi3_cc"
6827 [(set (reg CC_REGNUM)
6828 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6829 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
6831 (set (match_operand:SI 0 "register_operand" "=d")
6832 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6833 "s390_match_ccmode(insn, CCSmode)"
6835 [(set_attr "op_type" "RS")
6836 (set_attr "atype" "reg")])
6839 (define_insn "*ashrsi3_cconly"
6840 [(set (reg CC_REGNUM)
6841 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6842 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
6844 (clobber (match_scratch:SI 0 "=d"))]
6845 "s390_match_ccmode(insn, CCSmode)"
6847 [(set_attr "op_type" "RS")
6848 (set_attr "atype" "reg")])
6850 (define_insn "ashrsi3"
6851 [(set (match_operand:SI 0 "register_operand" "=d")
6852 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6853 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))
6854 (clobber (reg:CC CC_REGNUM))]
6857 [(set_attr "op_type" "RS")
6858 (set_attr "atype" "reg")])
6860 ; with implicit ANDs
6862 (define_insn "*ashrsi3_cc_and"
6863 [(set (reg CC_REGNUM)
6864 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6865 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6866 (match_operand:SI 3 "const_int_operand" "n")))
6868 (set (match_operand:SI 0 "register_operand" "=d")
6869 (ashiftrt:SI (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
6870 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
6872 [(set_attr "op_type" "RS")
6873 (set_attr "atype" "reg")])
6876 (define_insn "*ashrsi3_cconly_and"
6877 [(set (reg CC_REGNUM)
6878 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6879 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6880 (match_operand:SI 3 "const_int_operand" "n")))
6882 (clobber (match_scratch:SI 0 "=d"))]
6883 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
6885 [(set_attr "op_type" "RS")
6886 (set_attr "atype" "reg")])
6888 (define_insn "*ashrsi3_and"
6889 [(set (match_operand:SI 0 "register_operand" "=d")
6890 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6891 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
6892 (match_operand:SI 3 "const_int_operand" "n"))))
6893 (clobber (reg:CC CC_REGNUM))]
6894 "(INTVAL (operands[3]) & 63) == 63"
6896 [(set_attr "op_type" "RS")
6897 (set_attr "atype" "reg")])
6901 ;; Branch instruction patterns.
6904 (define_expand "b<code>"
6906 (if_then_else (COMPARE (match_operand 0 "" "")
6911 "s390_emit_jump (operands[0],
6912 s390_emit_compare (<CODE>, s390_compare_op0, s390_compare_op1)); DONE;")
6916 ;;- Conditional jump instructions.
6919 (define_insn "*cjump_64"
6922 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
6923 (label_ref (match_operand 0 "" ""))
6927 if (get_attr_length (insn) == 4)
6930 return "jg%C1\t%l0";
6932 [(set_attr "op_type" "RI")
6933 (set_attr "type" "branch")
6934 (set (attr "length")
6935 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6936 (const_int 4) (const_int 6)))])
6938 (define_insn "*cjump_31"
6941 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
6942 (label_ref (match_operand 0 "" ""))
6946 gcc_assert (get_attr_length (insn) == 4);
6949 [(set_attr "op_type" "RI")
6950 (set_attr "type" "branch")
6951 (set (attr "length")
6952 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6953 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6954 (const_int 4) (const_int 6))
6955 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6956 (const_int 4) (const_int 8))))])
6958 (define_insn "*cjump_long"
6961 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
6962 (match_operand 0 "address_operand" "U")
6966 if (get_attr_op_type (insn) == OP_TYPE_RR)
6971 [(set (attr "op_type")
6972 (if_then_else (match_operand 0 "register_operand" "")
6973 (const_string "RR") (const_string "RX")))
6974 (set_attr "type" "branch")
6975 (set_attr "atype" "agen")])
6979 ;;- Negated conditional jump instructions.
6982 (define_insn "*icjump_64"
6985 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
6987 (label_ref (match_operand 0 "" ""))))]
6990 if (get_attr_length (insn) == 4)
6993 return "jg%D1\t%l0";
6995 [(set_attr "op_type" "RI")
6996 (set_attr "type" "branch")
6997 (set (attr "length")
6998 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6999 (const_int 4) (const_int 6)))])
7001 (define_insn "*icjump_31"
7004 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
7006 (label_ref (match_operand 0 "" ""))))]
7009 gcc_assert (get_attr_length (insn) == 4);
7012 [(set_attr "op_type" "RI")
7013 (set_attr "type" "branch")
7014 (set (attr "length")
7015 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
7016 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7017 (const_int 4) (const_int 6))
7018 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7019 (const_int 4) (const_int 8))))])
7021 (define_insn "*icjump_long"
7024 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
7026 (match_operand 0 "address_operand" "U")))]
7029 if (get_attr_op_type (insn) == OP_TYPE_RR)
7034 [(set (attr "op_type")
7035 (if_then_else (match_operand 0 "register_operand" "")
7036 (const_string "RR") (const_string "RX")))
7037 (set_attr "type" "branch")
7038 (set_attr "atype" "agen")])
7041 ;;- Trap instructions.
7045 [(trap_if (const_int 1) (const_int 0))]
7048 [(set_attr "op_type" "RI")
7049 (set_attr "type" "branch")])
7051 (define_expand "conditional_trap"
7052 [(trap_if (match_operand 0 "comparison_operator" "")
7053 (match_operand 1 "general_operand" ""))]
7056 if (operands[1] != const0_rtx) FAIL;
7057 operands[0] = s390_emit_compare (GET_CODE (operands[0]),
7058 s390_compare_op0, s390_compare_op1);
7061 (define_insn "*trap"
7062 [(trap_if (match_operator 0 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
7066 [(set_attr "op_type" "RI")
7067 (set_attr "type" "branch")])
7070 ;;- Loop instructions.
7072 ;; This is all complicated by the fact that since this is a jump insn
7073 ;; we must handle our own output reloads.
7075 (define_expand "doloop_end"
7076 [(use (match_operand 0 "" "")) ; loop pseudo
7077 (use (match_operand 1 "" "")) ; iterations; zero if unknown
7078 (use (match_operand 2 "" "")) ; max iterations
7079 (use (match_operand 3 "" "")) ; loop level
7080 (use (match_operand 4 "" ""))] ; label
7083 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
7084 emit_jump_insn (gen_doloop_si31 (operands[4], operands[0], operands[0]));
7085 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
7086 emit_jump_insn (gen_doloop_si64 (operands[4], operands[0], operands[0]));
7087 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
7088 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
7095 (define_insn_and_split "doloop_si64"
7098 (ne (match_operand:SI 1 "register_operand" "d,d")
7100 (label_ref (match_operand 0 "" ""))
7102 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
7103 (plus:SI (match_dup 1) (const_int -1)))
7104 (clobber (match_scratch:SI 3 "=X,&1"))
7105 (clobber (reg:CC CC_REGNUM))]
7108 if (which_alternative != 0)
7110 else if (get_attr_length (insn) == 4)
7111 return "brct\t%1,%l0";
7113 return "ahi\t%1,-1\;jgne\t%l0";
7115 "&& reload_completed
7116 && (! REG_P (operands[2])
7117 || ! rtx_equal_p (operands[1], operands[2]))"
7118 [(parallel [(set (reg:CCAN CC_REGNUM)
7119 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
7121 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
7122 (set (match_dup 2) (match_dup 3))
7123 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
7124 (label_ref (match_dup 0))
7127 [(set_attr "op_type" "RI")
7128 (set_attr "type" "branch")
7129 (set (attr "length")
7130 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7131 (const_int 4) (const_int 10)))])
7133 (define_insn_and_split "doloop_si31"
7136 (ne (match_operand:SI 1 "register_operand" "d,d")
7138 (label_ref (match_operand 0 "" ""))
7140 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
7141 (plus:SI (match_dup 1) (const_int -1)))
7142 (clobber (match_scratch:SI 3 "=X,&1"))
7143 (clobber (reg:CC CC_REGNUM))]
7146 if (which_alternative != 0)
7148 else if (get_attr_length (insn) == 4)
7149 return "brct\t%1,%l0";
7153 "&& reload_completed
7154 && (! REG_P (operands[2])
7155 || ! rtx_equal_p (operands[1], operands[2]))"
7156 [(parallel [(set (reg:CCAN CC_REGNUM)
7157 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
7159 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
7160 (set (match_dup 2) (match_dup 3))
7161 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
7162 (label_ref (match_dup 0))
7165 [(set_attr "op_type" "RI")
7166 (set_attr "type" "branch")
7167 (set (attr "length")
7168 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
7169 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7170 (const_int 4) (const_int 6))
7171 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7172 (const_int 4) (const_int 8))))])
7174 (define_insn "*doloop_si_long"
7177 (ne (match_operand:SI 1 "register_operand" "d,d")
7179 (match_operand 0 "address_operand" "U,U")
7181 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
7182 (plus:SI (match_dup 1) (const_int -1)))
7183 (clobber (match_scratch:SI 3 "=X,&1"))
7184 (clobber (reg:CC CC_REGNUM))]
7187 if (get_attr_op_type (insn) == OP_TYPE_RR)
7188 return "bctr\t%1,%0";
7190 return "bct\t%1,%a0";
7192 [(set (attr "op_type")
7193 (if_then_else (match_operand 0 "register_operand" "")
7194 (const_string "RR") (const_string "RX")))
7195 (set_attr "type" "branch")
7196 (set_attr "atype" "agen")])
7198 (define_insn_and_split "doloop_di"
7201 (ne (match_operand:DI 1 "register_operand" "d,d")
7203 (label_ref (match_operand 0 "" ""))
7205 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?*m*d")
7206 (plus:DI (match_dup 1) (const_int -1)))
7207 (clobber (match_scratch:DI 3 "=X,&1"))
7208 (clobber (reg:CC CC_REGNUM))]
7211 if (which_alternative != 0)
7213 else if (get_attr_length (insn) == 4)
7214 return "brctg\t%1,%l0";
7216 return "aghi\t%1,-1\;jgne\t%l0";
7218 "&& reload_completed
7219 && (! REG_P (operands[2])
7220 || ! rtx_equal_p (operands[1], operands[2]))"
7221 [(parallel [(set (reg:CCAN CC_REGNUM)
7222 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
7224 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
7225 (set (match_dup 2) (match_dup 3))
7226 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
7227 (label_ref (match_dup 0))
7230 [(set_attr "op_type" "RI")
7231 (set_attr "type" "branch")
7232 (set (attr "length")
7233 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7234 (const_int 4) (const_int 10)))])
7237 ;;- Unconditional jump instructions.
7241 ; jump instruction pattern(s).
7244 (define_expand "jump"
7245 [(match_operand 0 "" "")]
7247 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
7249 (define_insn "*jump64"
7250 [(set (pc) (label_ref (match_operand 0 "" "")))]
7253 if (get_attr_length (insn) == 4)
7258 [(set_attr "op_type" "RI")
7259 (set_attr "type" "branch")
7260 (set (attr "length")
7261 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7262 (const_int 4) (const_int 6)))])
7264 (define_insn "*jump31"
7265 [(set (pc) (label_ref (match_operand 0 "" "")))]
7268 gcc_assert (get_attr_length (insn) == 4);
7271 [(set_attr "op_type" "RI")
7272 (set_attr "type" "branch")
7273 (set (attr "length")
7274 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
7275 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7276 (const_int 4) (const_int 6))
7277 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
7278 (const_int 4) (const_int 8))))])
7281 ; indirect-jump instruction pattern(s).
7284 (define_insn "indirect_jump"
7285 [(set (pc) (match_operand 0 "address_operand" "U"))]
7288 if (get_attr_op_type (insn) == OP_TYPE_RR)
7293 [(set (attr "op_type")
7294 (if_then_else (match_operand 0 "register_operand" "")
7295 (const_string "RR") (const_string "RX")))
7296 (set_attr "type" "branch")
7297 (set_attr "atype" "agen")])
7300 ; casesi instruction pattern(s).
7303 (define_insn "casesi_jump"
7304 [(set (pc) (match_operand 0 "address_operand" "U"))
7305 (use (label_ref (match_operand 1 "" "")))]
7308 if (get_attr_op_type (insn) == OP_TYPE_RR)
7313 [(set (attr "op_type")
7314 (if_then_else (match_operand 0 "register_operand" "")
7315 (const_string "RR") (const_string "RX")))
7316 (set_attr "type" "branch")
7317 (set_attr "atype" "agen")])
7319 (define_expand "casesi"
7320 [(match_operand:SI 0 "general_operand" "")
7321 (match_operand:SI 1 "general_operand" "")
7322 (match_operand:SI 2 "general_operand" "")
7323 (label_ref (match_operand 3 "" ""))
7324 (label_ref (match_operand 4 "" ""))]
7327 rtx index = gen_reg_rtx (SImode);
7328 rtx base = gen_reg_rtx (Pmode);
7329 rtx target = gen_reg_rtx (Pmode);
7331 emit_move_insn (index, operands[0]);
7332 emit_insn (gen_subsi3 (index, index, operands[1]));
7333 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
7336 if (Pmode != SImode)
7337 index = convert_to_mode (Pmode, index, 1);
7338 if (GET_CODE (index) != REG)
7339 index = copy_to_mode_reg (Pmode, index);
7342 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
7344 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
7346 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
7348 index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
7349 emit_move_insn (target, index);
7352 target = gen_rtx_PLUS (Pmode, base, target);
7353 emit_jump_insn (gen_casesi_jump (target, operands[3]));
7360 ;;- Jump to subroutine.
7365 ; untyped call instruction pattern(s).
7368 ;; Call subroutine returning any type.
7369 (define_expand "untyped_call"
7370 [(parallel [(call (match_operand 0 "" "")
7372 (match_operand 1 "" "")
7373 (match_operand 2 "" "")])]
7378 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
7380 for (i = 0; i < XVECLEN (operands[2], 0); i++)
7382 rtx set = XVECEXP (operands[2], 0, i);
7383 emit_move_insn (SET_DEST (set), SET_SRC (set));
7386 /* The optimizer does not know that the call sets the function value
7387 registers we stored in the result block. We avoid problems by
7388 claiming that all hard registers are used and clobbered at this
7390 emit_insn (gen_blockage ());
7395 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
7396 ;; all of memory. This blocks insns from being moved across this point.
7398 (define_insn "blockage"
7399 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
7402 [(set_attr "type" "none")
7403 (set_attr "length" "0")])
7409 (define_expand "sibcall"
7410 [(call (match_operand 0 "" "")
7411 (match_operand 1 "" ""))]
7414 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
7418 (define_insn "*sibcall_br"
7419 [(call (mem:QI (reg SIBCALL_REGNUM))
7420 (match_operand 0 "const_int_operand" "n"))]
7421 "SIBLING_CALL_P (insn)
7422 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
7424 [(set_attr "op_type" "RR")
7425 (set_attr "type" "branch")
7426 (set_attr "atype" "agen")])
7428 (define_insn "*sibcall_brc"
7429 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7430 (match_operand 1 "const_int_operand" "n"))]
7431 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7433 [(set_attr "op_type" "RI")
7434 (set_attr "type" "branch")])
7436 (define_insn "*sibcall_brcl"
7437 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7438 (match_operand 1 "const_int_operand" "n"))]
7439 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7441 [(set_attr "op_type" "RIL")
7442 (set_attr "type" "branch")])
7445 ; sibcall_value patterns
7448 (define_expand "sibcall_value"
7449 [(set (match_operand 0 "" "")
7450 (call (match_operand 1 "" "")
7451 (match_operand 2 "" "")))]
7454 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
7458 (define_insn "*sibcall_value_br"
7459 [(set (match_operand 0 "" "")
7460 (call (mem:QI (reg SIBCALL_REGNUM))
7461 (match_operand 1 "const_int_operand" "n")))]
7462 "SIBLING_CALL_P (insn)
7463 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
7465 [(set_attr "op_type" "RR")
7466 (set_attr "type" "branch")
7467 (set_attr "atype" "agen")])
7469 (define_insn "*sibcall_value_brc"
7470 [(set (match_operand 0 "" "")
7471 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7472 (match_operand 2 "const_int_operand" "n")))]
7473 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7475 [(set_attr "op_type" "RI")
7476 (set_attr "type" "branch")])
7478 (define_insn "*sibcall_value_brcl"
7479 [(set (match_operand 0 "" "")
7480 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7481 (match_operand 2 "const_int_operand" "n")))]
7482 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7484 [(set_attr "op_type" "RIL")
7485 (set_attr "type" "branch")])
7489 ; call instruction pattern(s).
7492 (define_expand "call"
7493 [(call (match_operand 0 "" "")
7494 (match_operand 1 "" ""))
7495 (use (match_operand 2 "" ""))]
7498 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
7499 gen_rtx_REG (Pmode, RETURN_REGNUM));
7503 (define_insn "*bras"
7504 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7505 (match_operand 1 "const_int_operand" "n"))
7506 (clobber (match_operand 2 "register_operand" "=r"))]
7507 "!SIBLING_CALL_P (insn)
7508 && TARGET_SMALL_EXEC
7509 && GET_MODE (operands[2]) == Pmode"
7511 [(set_attr "op_type" "RI")
7512 (set_attr "type" "jsr")])
7514 (define_insn "*brasl"
7515 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7516 (match_operand 1 "const_int_operand" "n"))
7517 (clobber (match_operand 2 "register_operand" "=r"))]
7518 "!SIBLING_CALL_P (insn)
7520 && GET_MODE (operands[2]) == Pmode"
7522 [(set_attr "op_type" "RIL")
7523 (set_attr "type" "jsr")])
7525 (define_insn "*basr"
7526 [(call (mem:QI (match_operand 0 "address_operand" "U"))
7527 (match_operand 1 "const_int_operand" "n"))
7528 (clobber (match_operand 2 "register_operand" "=r"))]
7529 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
7531 if (get_attr_op_type (insn) == OP_TYPE_RR)
7532 return "basr\t%2,%0";
7534 return "bas\t%2,%a0";
7536 [(set (attr "op_type")
7537 (if_then_else (match_operand 0 "register_operand" "")
7538 (const_string "RR") (const_string "RX")))
7539 (set_attr "type" "jsr")
7540 (set_attr "atype" "agen")])
7543 ; call_value instruction pattern(s).
7546 (define_expand "call_value"
7547 [(set (match_operand 0 "" "")
7548 (call (match_operand 1 "" "")
7549 (match_operand 2 "" "")))
7550 (use (match_operand 3 "" ""))]
7553 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
7554 gen_rtx_REG (Pmode, RETURN_REGNUM));
7558 (define_insn "*bras_r"
7559 [(set (match_operand 0 "" "")
7560 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7561 (match_operand:SI 2 "const_int_operand" "n")))
7562 (clobber (match_operand 3 "register_operand" "=r"))]
7563 "!SIBLING_CALL_P (insn)
7564 && TARGET_SMALL_EXEC
7565 && GET_MODE (operands[3]) == Pmode"
7567 [(set_attr "op_type" "RI")
7568 (set_attr "type" "jsr")])
7570 (define_insn "*brasl_r"
7571 [(set (match_operand 0 "" "")
7572 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7573 (match_operand 2 "const_int_operand" "n")))
7574 (clobber (match_operand 3 "register_operand" "=r"))]
7575 "!SIBLING_CALL_P (insn)
7577 && GET_MODE (operands[3]) == Pmode"
7579 [(set_attr "op_type" "RIL")
7580 (set_attr "type" "jsr")])
7582 (define_insn "*basr_r"
7583 [(set (match_operand 0 "" "")
7584 (call (mem:QI (match_operand 1 "address_operand" "U"))
7585 (match_operand 2 "const_int_operand" "n")))
7586 (clobber (match_operand 3 "register_operand" "=r"))]
7587 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7589 if (get_attr_op_type (insn) == OP_TYPE_RR)
7590 return "basr\t%3,%1";
7592 return "bas\t%3,%a1";
7594 [(set (attr "op_type")
7595 (if_then_else (match_operand 1 "register_operand" "")
7596 (const_string "RR") (const_string "RX")))
7597 (set_attr "type" "jsr")
7598 (set_attr "atype" "agen")])
7601 ;;- Thread-local storage support.
7604 (define_expand "get_tp_64"
7605 [(set (match_operand:DI 0 "nonimmediate_operand" "") (reg:DI TP_REGNUM))]
7609 (define_expand "get_tp_31"
7610 [(set (match_operand:SI 0 "nonimmediate_operand" "") (reg:SI TP_REGNUM))]
7614 (define_expand "set_tp_64"
7615 [(set (reg:DI TP_REGNUM) (match_operand:DI 0 "nonimmediate_operand" ""))
7616 (set (reg:DI TP_REGNUM) (unspec_volatile:DI [(reg:DI TP_REGNUM)] UNSPECV_SET_TP))]
7620 (define_expand "set_tp_31"
7621 [(set (reg:SI TP_REGNUM) (match_operand:SI 0 "nonimmediate_operand" ""))
7622 (set (reg:SI TP_REGNUM) (unspec_volatile:SI [(reg:SI TP_REGNUM)] UNSPECV_SET_TP))]
7626 (define_insn "*set_tp"
7627 [(set (reg TP_REGNUM) (unspec_volatile [(reg TP_REGNUM)] UNSPECV_SET_TP))]
7630 [(set_attr "type" "none")
7631 (set_attr "length" "0")])
7633 (define_insn "*tls_load_64"
7634 [(set (match_operand:DI 0 "register_operand" "=d")
7635 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7636 (match_operand:DI 2 "" "")]
7640 [(set_attr "op_type" "RXE")])
7642 (define_insn "*tls_load_31"
7643 [(set (match_operand:SI 0 "register_operand" "=d,d")
7644 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7645 (match_operand:SI 2 "" "")]
7651 [(set_attr "op_type" "RX,RXY")])
7653 (define_insn "*bras_tls"
7654 [(set (match_operand 0 "" "")
7655 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7656 (match_operand 2 "const_int_operand" "n")))
7657 (clobber (match_operand 3 "register_operand" "=r"))
7658 (use (match_operand 4 "" ""))]
7659 "!SIBLING_CALL_P (insn)
7660 && TARGET_SMALL_EXEC
7661 && GET_MODE (operands[3]) == Pmode"
7663 [(set_attr "op_type" "RI")
7664 (set_attr "type" "jsr")])
7666 (define_insn "*brasl_tls"
7667 [(set (match_operand 0 "" "")
7668 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7669 (match_operand 2 "const_int_operand" "n")))
7670 (clobber (match_operand 3 "register_operand" "=r"))
7671 (use (match_operand 4 "" ""))]
7672 "!SIBLING_CALL_P (insn)
7674 && GET_MODE (operands[3]) == Pmode"
7676 [(set_attr "op_type" "RIL")
7677 (set_attr "type" "jsr")])
7679 (define_insn "*basr_tls"
7680 [(set (match_operand 0 "" "")
7681 (call (mem:QI (match_operand 1 "address_operand" "U"))
7682 (match_operand 2 "const_int_operand" "n")))
7683 (clobber (match_operand 3 "register_operand" "=r"))
7684 (use (match_operand 4 "" ""))]
7685 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7687 if (get_attr_op_type (insn) == OP_TYPE_RR)
7688 return "basr\t%3,%1%J4";
7690 return "bas\t%3,%a1%J4";
7692 [(set (attr "op_type")
7693 (if_then_else (match_operand 1 "register_operand" "")
7694 (const_string "RR") (const_string "RX")))
7695 (set_attr "type" "jsr")
7696 (set_attr "atype" "agen")])
7699 ;;- Atomic operations
7703 ; memory barrier pattern.
7706 (define_expand "memory_barrier"
7707 [(set (mem:BLK (match_dup 0))
7708 (unspec_volatile:BLK [(mem:BLK (match_dup 0))] UNSPECV_MB))]
7711 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (DImode));
7712 MEM_VOLATILE_P (operands[0]) = 1;
7715 (define_insn "*memory_barrier"
7716 [(set (match_operand:BLK 0 "" "")
7717 (unspec_volatile:BLK [(match_operand:BLK 1 "" "")] UNSPECV_MB))]
7720 [(set_attr "op_type" "RR")])
7723 ; compare and swap patterns.
7726 (define_expand "sync_compare_and_swap<mode>"
7728 [(set (match_operand:TDSI 0 "register_operand" "")
7729 (match_operand:TDSI 1 "memory_operand" ""))
7731 (unspec_volatile:TDSI
7733 (match_operand:TDSI 2 "register_operand" "")
7734 (match_operand:TDSI 3 "register_operand" "")]
7736 (set (reg:CCZ1 CC_REGNUM)
7737 (compare:CCZ1 (match_dup 1) (match_dup 2)))])]
7740 (define_expand "sync_compare_and_swap<mode>"
7742 [(set (match_operand:HQI 0 "register_operand" "")
7743 (match_operand:HQI 1 "memory_operand" ""))
7745 (unspec_volatile:HQI
7747 (match_operand:HQI 2 "general_operand" "")
7748 (match_operand:HQI 3 "general_operand" "")]
7750 (set (reg:CCZ1 CC_REGNUM)
7751 (compare:CCZ1 (match_dup 1) (match_dup 2)))])]
7753 "s390_expand_cs_hqi (<MODE>mode, operands[0], operands[1],
7754 operands[2], operands[3]); DONE;")
7756 (define_expand "sync_compare_and_swap_cc<mode>"
7758 [(set (match_operand:TDSI 0 "register_operand" "")
7759 (match_operand:TDSI 1 "memory_operand" ""))
7761 (unspec_volatile:TDSI
7763 (match_operand:TDSI 2 "register_operand" "")
7764 (match_operand:TDSI 3 "register_operand" "")]
7767 (compare:CCZ1 (match_dup 1) (match_dup 2)))])]
7770 /* Emulate compare. */
7771 operands[4] = gen_rtx_REG (CCZ1mode, CC_REGNUM);
7772 s390_compare_op0 = operands[1];
7773 s390_compare_op1 = operands[2];
7774 s390_compare_emitted = operands[4];
7777 (define_insn "*sync_compare_and_swap<mode>"
7778 [(set (match_operand:DP 0 "register_operand" "=r")
7779 (match_operand:DP 1 "memory_operand" "+Q"))
7783 (match_operand:DP 2 "register_operand" "0")
7784 (match_operand:DP 3 "register_operand" "r")]
7786 (set (reg:CCZ1 CC_REGNUM)
7787 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
7789 "cds<tg>\t%0,%3,%S1"
7790 [(set_attr "op_type" "RS<TE>")
7791 (set_attr "type" "sem")])
7793 (define_insn "*sync_compare_and_swap<mode>"
7794 [(set (match_operand:GPR 0 "register_operand" "=r")
7795 (match_operand:GPR 1 "memory_operand" "+Q"))
7797 (unspec_volatile:GPR
7799 (match_operand:GPR 2 "register_operand" "0")
7800 (match_operand:GPR 3 "register_operand" "r")]
7802 (set (reg:CCZ1 CC_REGNUM)
7803 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
7806 [(set_attr "op_type" "RS<E>")
7807 (set_attr "type" "sem")])
7811 ; Other atomic instruction patterns.
7814 (define_expand "sync_lock_test_and_set<mode>"
7815 [(match_operand:HQI 0 "register_operand")
7816 (match_operand:HQI 1 "memory_operand")
7817 (match_operand:HQI 2 "general_operand")]
7819 "s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1],
7820 operands[2], false); DONE;")
7822 (define_expand "sync_<atomic><mode>"
7823 [(set (match_operand:HQI 0 "memory_operand")
7824 (ATOMIC:HQI (match_dup 0)
7825 (match_operand:HQI 1 "general_operand")))]
7827 "s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0],
7828 operands[1], false); DONE;")
7830 (define_expand "sync_old_<atomic><mode>"
7831 [(set (match_operand:HQI 0 "register_operand")
7832 (match_operand:HQI 1 "memory_operand"))
7834 (ATOMIC:HQI (match_dup 1)
7835 (match_operand:HQI 2 "general_operand")))]
7837 "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
7838 operands[2], false); DONE;")
7840 (define_expand "sync_new_<atomic><mode>"
7841 [(set (match_operand:HQI 0 "register_operand")
7842 (ATOMIC:HQI (match_operand:HQI 1 "memory_operand")
7843 (match_operand:HQI 2 "general_operand")))
7844 (set (match_dup 1) (ATOMIC:HQI (match_dup 1) (match_dup 2)))]
7846 "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
7847 operands[2], true); DONE;")
7850 ;;- Miscellaneous instructions.
7854 ; allocate stack instruction pattern(s).
7857 (define_expand "allocate_stack"
7858 [(match_operand 0 "general_operand" "")
7859 (match_operand 1 "general_operand" "")]
7862 rtx temp = gen_reg_rtx (Pmode);
7864 emit_move_insn (temp, s390_back_chain_rtx ());
7865 anti_adjust_stack (operands[1]);
7866 emit_move_insn (s390_back_chain_rtx (), temp);
7868 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7874 ; setjmp instruction pattern.
7877 (define_expand "builtin_setjmp_receiver"
7878 [(match_operand 0 "" "")]
7881 emit_insn (s390_load_got ());
7882 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7886 ;; These patterns say how to save and restore the stack pointer. We need not
7887 ;; save the stack pointer at function level since we are careful to
7888 ;; preserve the backchain. At block level, we have to restore the backchain
7889 ;; when we restore the stack pointer.
7891 ;; For nonlocal gotos, we must save both the stack pointer and its
7892 ;; backchain and restore both. Note that in the nonlocal case, the
7893 ;; save area is a memory location.
7895 (define_expand "save_stack_function"
7896 [(match_operand 0 "general_operand" "")
7897 (match_operand 1 "general_operand" "")]
7901 (define_expand "restore_stack_function"
7902 [(match_operand 0 "general_operand" "")
7903 (match_operand 1 "general_operand" "")]
7907 (define_expand "restore_stack_block"
7908 [(match_operand 0 "register_operand" "")
7909 (match_operand 1 "register_operand" "")]
7912 rtx temp = gen_reg_rtx (Pmode);
7914 emit_move_insn (temp, s390_back_chain_rtx ());
7915 emit_move_insn (operands[0], operands[1]);
7916 emit_move_insn (s390_back_chain_rtx (), temp);
7921 (define_expand "save_stack_nonlocal"
7922 [(match_operand 0 "memory_operand" "")
7923 (match_operand 1 "register_operand" "")]
7926 enum machine_mode mode = TARGET_64BIT ? OImode : TImode;
7927 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
7929 /* Copy the backchain to the first word, sp to the second and the
7930 literal pool base to the third. */
7932 if (TARGET_BACKCHAIN)
7934 rtx temp = force_reg (Pmode, s390_back_chain_rtx ());
7935 emit_move_insn (operand_subword (operands[0], 0, 0, mode), temp);
7938 emit_move_insn (operand_subword (operands[0], 1, 0, mode), operands[1]);
7939 emit_move_insn (operand_subword (operands[0], 2, 0, mode), base);
7944 (define_expand "restore_stack_nonlocal"
7945 [(match_operand 0 "register_operand" "")
7946 (match_operand 1 "memory_operand" "")]
7949 enum machine_mode mode = TARGET_64BIT ? OImode : TImode;
7950 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
7951 rtx temp = NULL_RTX;
7953 /* Restore the backchain from the first word, sp from the second and the
7954 literal pool base from the third. */
7956 if (TARGET_BACKCHAIN)
7957 temp = force_reg (Pmode, operand_subword (operands[1], 0, 0, mode));
7959 emit_move_insn (base, operand_subword (operands[1], 2, 0, mode));
7960 emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, mode));
7963 emit_move_insn (s390_back_chain_rtx (), temp);
7965 emit_insn (gen_rtx_USE (VOIDmode, base));
7969 (define_expand "exception_receiver"
7973 s390_set_has_landing_pad_p (true);
7978 ; nop instruction pattern(s).
7985 [(set_attr "op_type" "RR")])
7989 ; Special literal pool access instruction pattern(s).
7992 (define_insn "*pool_entry"
7993 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7994 UNSPECV_POOL_ENTRY)]
7997 enum machine_mode mode = GET_MODE (PATTERN (insn));
7998 unsigned int align = GET_MODE_BITSIZE (mode);
7999 s390_output_pool_entry (operands[0], mode, align);
8002 [(set (attr "length")
8003 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
8005 (define_insn "pool_align"
8006 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")]
8007 UNSPECV_POOL_ALIGN)]
8010 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
8012 (define_insn "pool_section_start"
8013 [(unspec_volatile [(const_int 1)] UNSPECV_POOL_SECTION)]
8016 [(set_attr "length" "0")])
8018 (define_insn "pool_section_end"
8019 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_SECTION)]
8022 [(set_attr "length" "0")])
8024 (define_insn "main_base_31_small"
8025 [(set (match_operand 0 "register_operand" "=a")
8026 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
8027 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
8029 [(set_attr "op_type" "RR")
8030 (set_attr "type" "la")])
8032 (define_insn "main_base_31_large"
8033 [(set (match_operand 0 "register_operand" "=a")
8034 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
8035 (set (pc) (label_ref (match_operand 2 "" "")))]
8036 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
8038 [(set_attr "op_type" "RI")])
8040 (define_insn "main_base_64"
8041 [(set (match_operand 0 "register_operand" "=a")
8042 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
8043 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
8045 [(set_attr "op_type" "RIL")
8046 (set_attr "type" "larl")])
8048 (define_insn "main_pool"
8049 [(set (match_operand 0 "register_operand" "=a")
8050 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
8051 "GET_MODE (operands[0]) == Pmode"
8056 (if_then_else (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0))
8057 (const_string "larl") (const_string "la")))])
8059 (define_insn "reload_base_31"
8060 [(set (match_operand 0 "register_operand" "=a")
8061 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
8062 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
8063 "basr\t%0,0\;la\t%0,%1-.(%0)"
8064 [(set_attr "length" "6")
8065 (set_attr "type" "la")])
8067 (define_insn "reload_base_64"
8068 [(set (match_operand 0 "register_operand" "=a")
8069 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
8070 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
8072 [(set_attr "op_type" "RIL")
8073 (set_attr "type" "larl")])
8076 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
8081 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
8084 ;; Insns related to generating the function prologue and epilogue.
8088 (define_expand "prologue"
8089 [(use (const_int 0))]
8091 "s390_emit_prologue (); DONE;")
8093 (define_expand "epilogue"
8094 [(use (const_int 1))]
8096 "s390_emit_epilogue (false); DONE;")
8098 (define_expand "sibcall_epilogue"
8099 [(use (const_int 0))]
8101 "s390_emit_epilogue (true); DONE;")
8103 (define_insn "*return"
8105 (use (match_operand 0 "register_operand" "a"))]
8106 "GET_MODE (operands[0]) == Pmode"
8108 [(set_attr "op_type" "RR")
8109 (set_attr "type" "jsr")
8110 (set_attr "atype" "agen")])
8113 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
8114 ;; pointer. This is used for compatibility.
8116 (define_expand "ptr_extend"
8117 [(set (match_operand:DI 0 "register_operand" "=r")
8118 (match_operand:SI 1 "register_operand" "r"))]
8121 emit_insn (gen_anddi3 (operands[0],
8122 gen_lowpart (DImode, operands[1]),
8123 GEN_INT (0x7fffffff)));
8127 ;; Instruction definition to expand eh_return macro to support
8128 ;; swapping in special linkage return addresses.
8130 (define_expand "eh_return"
8131 [(use (match_operand 0 "register_operand" ""))]
8134 s390_emit_tpf_eh_return (operands[0]);
8139 ; Stack Protector Patterns
8142 (define_expand "stack_protect_set"
8143 [(set (match_operand 0 "memory_operand" "")
8144 (match_operand 1 "memory_operand" ""))]
8147 #ifdef TARGET_THREAD_SSP_OFFSET
8149 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
8150 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
8153 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
8155 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
8160 (define_insn "stack_protect_set<mode>"
8161 [(set (match_operand:DSI 0 "memory_operand" "=Q")
8162 (unspec:DSI [(match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_SET))]
8164 "mvc\t%O0(%G0,%R0),%S1"
8165 [(set_attr "op_type" "SS")])
8167 (define_expand "stack_protect_test"
8168 [(set (reg:CC CC_REGNUM)
8169 (compare (match_operand 0 "memory_operand" "")
8170 (match_operand 1 "memory_operand" "")))
8171 (match_operand 2 "" "")]
8174 #ifdef TARGET_THREAD_SSP_OFFSET
8176 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
8177 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
8179 s390_compare_op0 = operands[0];
8180 s390_compare_op1 = operands[1];
8181 s390_compare_emitted = gen_rtx_REG (CCZmode, CC_REGNUM);
8184 emit_insn (gen_stack_protect_testdi (operands[0], operands[1]));
8186 emit_insn (gen_stack_protect_testsi (operands[0], operands[1]));
8188 emit_jump_insn (gen_beq (operands[2]));
8193 (define_insn "stack_protect_test<mode>"
8194 [(set (reg:CCZ CC_REGNUM)
8195 (unspec:CCZ [(match_operand:DSI 0 "memory_operand" "Q")
8196 (match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_TEST))]
8198 "clc\t%O0(%G0,%R0),%S1"
8199 [(set_attr "op_type" "SS")])