1 ;;- Machine description for GNU compiler -- S/390 / zSeries version.
2 ;; Copyright (C) 1999-2014 Free Software Foundation, Inc.
3 ;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and
4 ;; Ulrich Weigand (uweigand@de.ibm.com) and
5 ;; Andreas Krebbel (Andreas.Krebbel@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 3, 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 COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
24 ;; See constraints.md for a description of constraints specific to s390.
27 ;; Special formats used for outputting 390 instructions.
29 ;; %C: print opcode suffix for branch condition.
30 ;; %D: print opcode suffix for inverse branch condition.
31 ;; %J: print tls_load/tls_gdcall/tls_ldcall suffix
32 ;; %G: print the size of the operand in bytes.
33 ;; %O: print only the displacement of a memory reference.
34 ;; %R: print only the base register of a memory reference.
35 ;; %S: print S-type memory reference (base+displacement).
36 ;; %N: print the second word of a DImode operand.
37 ;; %M: print the second word of a TImode operand.
38 ;; %Y: print shift count operand.
40 ;; %b: print integer X as if it's an unsigned byte.
41 ;; %c: print integer X as if it's an signed byte.
42 ;; %x: print integer X as if it's an unsigned halfword.
43 ;; %h: print integer X as if it's a signed halfword.
44 ;; %i: print the first nonzero HImode part of X.
45 ;; %j: print the first HImode part unequal to -1 of X.
46 ;; %k: print the first nonzero SImode part of X.
47 ;; %m: print the first SImode part unequal to -1 of X.
48 ;; %o: print integer X as if it's an unsigned 32bit word.
50 ;; We have a special constraint for pattern matching.
52 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
59 (define_c_enum "unspec" [
65 ; Convert CC into a str comparison result and copy it into an
67 ; cc0->0, cc1->1, cc2->-1, (cc3->-1)
68 UNSPEC_STRCMPCC_TO_INT
70 ; Copy CC as is into the lower 2 bits of an integer register
73 ; GOT/PLT and lt-relative accesses
94 ; TLS relocation specifiers
110 ; Stack Smashing Protector
114 ; Test Data Class (TDC)
126 UNSPEC_FPINT_NEARBYINT
131 ;; UNSPEC_VOLATILE usage
134 (define_c_enum "unspecv" [
156 ; Transactional Execution support
171 ; Registers with special meaning
175 ; Sibling call register.
177 ; Literal pool base register.
179 ; Return address register.
181 ; Condition code register.
183 ; Thread local storage pointer register.
187 ; Hardware register names
191 ; General purpose registers
193 ; Floating point registers.
213 ;; PFPO GPR0 argument format
218 ; PFPO operation type
219 (PFPO_CONVERT 0x1000000)
221 (PFPO_OP_TYPE_SF 0x5)
222 (PFPO_OP_TYPE_DF 0x6)
223 (PFPO_OP_TYPE_TF 0x7)
224 (PFPO_OP_TYPE_SD 0x8)
225 (PFPO_OP_TYPE_DD 0x9)
226 (PFPO_OP_TYPE_TD 0xa)
227 ; Bitposition of operand types
228 (PFPO_OP0_TYPE_SHIFT 16)
229 (PFPO_OP1_TYPE_SHIFT 8)
232 ; Immediate operands for tbegin and tbeginc
233 (define_constants [(TBEGIN_MASK 65292)]) ; 0xff0c
234 (define_constants [(TBEGINC_MASK 65288)]) ; 0xff08
236 ;; Instruction operand type as used in the Principles of Operation.
237 ;; Used to determine defaults for length and other attribute values.
239 (define_attr "op_type"
240 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY,RRF,RRR,SIL,RRS,RIS"
243 ;; Instruction type attribute used for scheduling.
245 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
246 cs,vs,store,sem,idiv,
247 imulhi,imulsi,imuldi,
248 branch,jsr,fsimptf,fsimpdf,fsimpsf,fhex,
249 floadtf,floaddf,floadsf,fstoredf,fstoresf,
250 fmultf,fmuldf,fmulsf,fdivtf,fdivdf,fdivsf,
251 ftoi,fsqrttf,fsqrtdf,fsqrtsf,
253 ftrunctf,ftruncdf, ftruncsd, ftruncdd,
254 itoftf, itofdf, itofsf, itofdd, itoftd,
255 fdivdd, fdivtd, floaddd, floadsd, fmuldd, fmultd,
256 fsimpdd, fsimpsd, fsimptd, fstoredd, fstoresd,
258 (cond [(eq_attr "op_type" "NN") (const_string "other")
259 (eq_attr "op_type" "SS") (const_string "cs")]
260 (const_string "integer")))
262 ;; Another attribute used for scheduling purposes:
263 ;; agen: Instruction uses the address generation unit
264 ;; reg: Instruction does not use the agen unit
266 (define_attr "atype" "agen,reg"
267 (if_then_else (eq_attr "op_type" "E,RR,RI,RRE,RSI,RIL,RIE,RRF,RRR")
269 (const_string "agen")))
271 ;; Properties concerning Z10 execution grouping and value forwarding.
272 ;; z10_super: instruction is superscalar.
273 ;; z10_super_c: instruction is superscalar and meets the condition of z10_c.
274 ;; z10_fwd: The instruction reads the value of an operand and stores it into a
275 ;; target register. It can forward this value to a second instruction that reads
276 ;; the same register if that second instruction is issued in the same group.
277 ;; z10_rec: The instruction is in the T pipeline and reads a register. If the
278 ;; instruction in the S pipe writes to the register, then the T instruction
279 ;; can immediately read the new value.
280 ;; z10_fr: union of Z10_fwd and z10_rec.
281 ;; z10_c: second operand of instruction is a register and read with complemented bits.
283 ;; An additional suffix A1, A3, or E1 indicates the respective AGI bypass.
286 (define_attr "z10prop" "none,
287 z10_super, z10_super_E1, z10_super_A1, z10_super_c, z10_super_c_E1,
288 z10_fwd, z10_fwd_A1, z10_fwd_A3, z10_fwd_E1,
290 z10_fr, z10_fr_A3, z10_fr_E1,
292 (const_string "none"))
294 ;; Properties concerning Z196 decoding
295 ;; z196_alone: must group alone
296 ;; z196_end: ends a group
297 ;; z196_cracked: instruction is cracked or expanded
298 (define_attr "z196prop" "none,
299 z196_alone, z196_ends,
301 (const_string "none"))
303 (define_attr "mnemonic" "bcr_flush,unknown" (const_string "unknown"))
307 (define_attr "length" ""
308 (cond [(eq_attr "op_type" "E,RR") (const_int 2)
309 (eq_attr "op_type" "RX,RI,RRE,RS,RSI,S,SI,RRF,RRR") (const_int 4)]
313 ;; Processor type. This attribute must exactly match the processor_type
314 ;; enumeration in s390.h. The current machine description does not
315 ;; distinguish between g5 and g6, but there are differences between the two
316 ;; CPUs could in theory be modeled.
318 (define_attr "cpu" "g5,g6,z900,z990,z9_109,z9_ec,z10,z196,zEC12"
319 (const (symbol_ref "s390_tune_attr")))
321 (define_attr "cpu_facility"
322 "standard,ieee,zarch,cpu_zarch,longdisp,extimm,dfp,z10,z196,zEC12"
323 (const_string "standard"))
325 (define_attr "enabled" ""
326 (cond [(eq_attr "cpu_facility" "standard")
329 (and (eq_attr "cpu_facility" "ieee")
330 (match_test "TARGET_CPU_IEEE_FLOAT"))
333 (and (eq_attr "cpu_facility" "zarch")
334 (match_test "TARGET_ZARCH"))
337 (and (eq_attr "cpu_facility" "longdisp")
338 (match_test "TARGET_LONG_DISPLACEMENT"))
341 (and (eq_attr "cpu_facility" "extimm")
342 (match_test "TARGET_EXTIMM"))
345 (and (eq_attr "cpu_facility" "dfp")
346 (match_test "TARGET_DFP"))
349 (and (eq_attr "cpu_facility" "cpu_zarch")
350 (match_test "TARGET_CPU_ZARCH"))
353 (and (eq_attr "cpu_facility" "z10")
354 (match_test "TARGET_Z10"))
357 (and (eq_attr "cpu_facility" "z196")
358 (match_test "TARGET_Z196"))
361 (and (eq_attr "cpu_facility" "zEC12")
362 (match_test "TARGET_ZEC12"))
366 ;; Pipeline description for z900. For lack of anything better,
367 ;; this description is also used for the g5 and g6.
370 ;; Pipeline description for z990, z9-109 and z9-ec.
373 ;; Pipeline description for z10
376 ;; Pipeline description for z196
379 ;; Pipeline description for zEC12
383 (include "predicates.md")
385 ;; Constraint definitions
386 (include "constraints.md")
393 ;; These mode iterators allow floating point patterns to be generated from the
395 (define_mode_iterator FP_ALL [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")
396 (SD "TARGET_HARD_DFP")])
397 (define_mode_iterator FP [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")])
398 (define_mode_iterator FPALL [TF DF SF TD DD SD])
399 (define_mode_iterator BFP [TF DF SF])
400 (define_mode_iterator DFP [TD DD])
401 (define_mode_iterator DFP_ALL [TD DD SD])
402 (define_mode_iterator DSF [DF SF])
403 (define_mode_iterator SD_SF [SF SD])
404 (define_mode_iterator DD_DF [DF DD])
405 (define_mode_iterator TD_TF [TF TD])
407 ;; These mode iterators allow 31-bit and 64-bit GPR patterns to be generated
408 ;; from the same template.
409 (define_mode_iterator GPR [(DI "TARGET_ZARCH") SI])
410 (define_mode_iterator DGPR [(TI "TARGET_ZARCH") DI SI])
411 (define_mode_iterator DSI [DI SI])
412 (define_mode_iterator TDI [TI DI])
414 ;; These mode iterators allow :P to be used for patterns that operate on
415 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
416 (define_mode_iterator P [(DI "TARGET_64BIT") (SI "!TARGET_64BIT")])
418 ;; These macros refer to the actual word_mode of the configuration.
419 ;; This is equal to Pmode except on 31-bit machines in zarch mode.
420 (define_mode_iterator DW [(TI "TARGET_ZARCH") (DI "!TARGET_ZARCH")])
421 (define_mode_iterator W [(DI "TARGET_ZARCH") (SI "!TARGET_ZARCH")])
423 ;; Used by the umul pattern to express modes having half the size.
424 (define_mode_attr DWH [(TI "DI") (DI "SI")])
425 (define_mode_attr dwh [(TI "di") (DI "si")])
427 ;; This mode iterator allows the QI and HI patterns to be defined from
428 ;; the same template.
429 (define_mode_iterator HQI [HI QI])
431 ;; This mode iterator allows the integer patterns to be defined from the
433 (define_mode_iterator INT [(DI "TARGET_ZARCH") SI HI QI])
434 (define_mode_iterator INTALL [TI DI SI HI QI])
435 (define_mode_iterator DINT [(TI "TARGET_ZARCH") DI SI HI QI])
437 ;; This iterator allows some 'ashift' and 'lshiftrt' pattern to be defined from
438 ;; the same template.
439 (define_code_iterator SHIFT [ashift lshiftrt])
441 ;; This iterator allows r[ox]sbg to be defined with the same template
442 (define_code_iterator IXOR [ior xor])
444 ;; This iterator is used to expand the patterns for the nearest
445 ;; integer functions.
446 (define_int_iterator FPINT [UNSPEC_FPINT_FLOOR UNSPEC_FPINT_BTRUNC
447 UNSPEC_FPINT_ROUND UNSPEC_FPINT_CEIL
448 UNSPEC_FPINT_NEARBYINT])
449 (define_int_attr fpint_name [(UNSPEC_FPINT_FLOOR "floor")
450 (UNSPEC_FPINT_BTRUNC "btrunc")
451 (UNSPEC_FPINT_ROUND "round")
452 (UNSPEC_FPINT_CEIL "ceil")
453 (UNSPEC_FPINT_NEARBYINT "nearbyint")])
454 (define_int_attr fpint_roundingmode [(UNSPEC_FPINT_FLOOR "7")
455 (UNSPEC_FPINT_BTRUNC "5")
456 (UNSPEC_FPINT_ROUND "1")
457 (UNSPEC_FPINT_CEIL "6")
458 (UNSPEC_FPINT_NEARBYINT "0")])
460 ;; This iterator and attribute allow to combine most atomic operations.
461 (define_code_iterator ATOMIC [and ior xor plus minus mult])
462 (define_code_iterator ATOMIC_Z196 [and ior xor plus])
463 (define_code_attr atomic [(and "and") (ior "ior") (xor "xor")
464 (plus "add") (minus "sub") (mult "nand")])
465 (define_code_attr noxa [(and "n") (ior "o") (xor "x") (plus "a")])
467 ;; In FP templates, a string like "lt<de>br" will expand to "ltxbr" in
468 ;; TF/TDmode, "ltdbr" in DF/DDmode, and "ltebr" in SF/SDmode.
469 (define_mode_attr xde [(TF "x") (DF "d") (SF "e") (TD "x") (DD "d") (SD "e")])
471 ;; In FP templates, a <dee> in "m<dee><bt>r" will expand to "mx<bt>r" in
472 ;; TF/TDmode, "md<bt>r" in DF/DDmode, "mee<bt>r" in SFmode and "me<bt>r in
474 (define_mode_attr xdee [(TF "x") (DF "d") (SF "ee") (TD "x") (DD "d") (SD "e")])
476 ;; In FP templates, "<RRe>" will expand to "RRE" in TFmode and "RR" otherwise.
477 ;; Likewise for "<RXe>".
478 (define_mode_attr RRe [(TF "RRE") (DF "RR") (SF "RR")])
479 (define_mode_attr RXe [(TF "RXE") (DF "RX") (SF "RX")])
481 ;; The decimal floating point variants of add, sub, div and mul support 3
482 ;; fp register operands. The following attributes allow to merge the bfp and
483 ;; dfp variants in a single insn definition.
485 ;; This attribute is used to set op_type accordingly.
486 (define_mode_attr RRer [(TF "RRE") (DF "RRE") (SF "RRE") (TD "RRR")
487 (DD "RRR") (SD "RRR")])
489 ;; This attribute is used in the operand constraint list in order to have the
490 ;; first and the second operand match for bfp modes.
491 (define_mode_attr f0 [(TF "0") (DF "0") (SF "0") (TD "f") (DD "f") (DD "f")])
493 ;; This attribute is used in the operand list of the instruction to have an
494 ;; additional operand for the dfp instructions.
495 (define_mode_attr op1 [(TF "") (DF "") (SF "")
496 (TD "%1,") (DD "%1,") (SD "%1,")])
499 ;; This attribute is used in the operand constraint list
500 ;; for instructions dealing with the sign bit of 32 or 64bit fp values.
501 ;; TFmode values are represented by a fp register pair. Since the
502 ;; sign bit instructions only handle single source and target fp registers
503 ;; these instructions can only be used for TFmode values if the source and
504 ;; target operand uses the same fp register.
505 (define_mode_attr fT0 [(TF "0") (DF "f") (SF "f")])
507 ;; In FP templates, "<Rf>" will expand to "f" in TFmode and "R" otherwise.
508 ;; This is used to disable the memory alternative in TFmode patterns.
509 (define_mode_attr Rf [(TF "f") (DF "R") (SF "R") (TD "f") (DD "f") (SD "f")])
511 ;; This attribute adds b for bfp instructions and t for dfp instructions and is used
512 ;; within instruction mnemonics.
513 (define_mode_attr bt [(TF "b") (DF "b") (SF "b") (TD "t") (DD "t") (SD "t")])
515 ;; This attribute is used within instruction mnemonics. It evaluates to d for dfp
516 ;; modes and to an empty string for bfp modes.
517 (define_mode_attr _d [(TF "") (DF "") (SF "") (TD "d") (DD "d") (SD "d")])
519 ;; In GPR and P templates, a constraint like "<d0>" will expand to "d" in DImode
520 ;; and "0" in SImode. This allows to combine instructions of which the 31bit
521 ;; version only operates on one register.
522 (define_mode_attr d0 [(DI "d") (SI "0")])
524 ;; In combination with d0 this allows to combine instructions of which the 31bit
525 ;; version only operates on one register. The DImode version needs an additional
526 ;; register for the assembler output.
527 (define_mode_attr 1 [(DI "%1,") (SI "")])
529 ;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in
530 ;; 'ashift' and "srdl" in 'lshiftrt'.
531 (define_code_attr lr [(ashift "l") (lshiftrt "r")])
533 ;; In SHIFT templates, this attribute holds the correct standard name for the
534 ;; pattern itself and the corresponding function calls.
535 (define_code_attr shift [(ashift "ashl") (lshiftrt "lshr")])
537 ;; This attribute handles differences in the instruction 'type' and will result
538 ;; in "RRE" for DImode and "RR" for SImode.
539 (define_mode_attr E [(DI "E") (SI "")])
541 ;; This attribute handles differences in the instruction 'type' and makes RX<Y>
542 ;; to result in "RXY" for DImode and "RX" for SImode.
543 (define_mode_attr Y [(DI "Y") (SI "")])
545 ;; This attribute handles differences in the instruction 'type' and will result
546 ;; in "RSE" for TImode and "RS" for DImode.
547 (define_mode_attr TE [(TI "E") (DI "")])
549 ;; In GPR templates, a string like "lc<g>r" will expand to "lcgr" in DImode
550 ;; and "lcr" in SImode.
551 (define_mode_attr g [(DI "g") (SI "")])
553 ;; In GPR templates, a string like "sl<y>" will expand to "slg" in DImode
554 ;; and "sly" in SImode. This is useful because on 64bit the ..g instructions
555 ;; were enhanced with long displacements whereas 31bit instructions got a ..y
556 ;; variant for long displacements.
557 (define_mode_attr y [(DI "g") (SI "y")])
559 ;; In DW templates, a string like "cds<g>" will expand to "cdsg" in TImode
560 ;; and "cds" in DImode.
561 (define_mode_attr tg [(TI "g") (DI "")])
563 ;; In TDI templates, a string like "c<d>sg".
564 (define_mode_attr td [(TI "d") (DI "")])
566 ;; In GPR templates, a string like "c<gf>dbr" will expand to "cgdbr" in DImode
567 ;; and "cfdbr" in SImode.
568 (define_mode_attr gf [(DI "g") (SI "f")])
570 ;; In GPR templates, a string like sll<gk> will expand to sllg for DI
571 ;; and sllk for SI. This way it is possible to merge the new z196 SI
572 ;; 3 operands shift instructions into the existing patterns.
573 (define_mode_attr gk [(DI "g") (SI "k")])
575 ;; ICM mask required to load MODE value into the lowest subreg
576 ;; of a SImode register.
577 (define_mode_attr icm_lo [(HI "3") (QI "1")])
579 ;; In HQI templates, a string like "llg<hc>" will expand to "llgh" in
580 ;; HImode and "llgc" in QImode.
581 (define_mode_attr hc [(HI "h") (QI "c")])
583 ;; In P templates, the mode <DBL> will expand to "TI" in DImode and "DI"
585 (define_mode_attr DBL [(DI "TI") (SI "DI")])
587 ;; This attribute expands to DF for TFmode and to DD for TDmode . It is
588 ;; used for Txmode splitters splitting a Txmode copy into 2 Dxmode copies.
589 (define_mode_attr HALF_TMODE [(TF "DF") (TD "DD")])
591 ;; Maximum unsigned integer that fits in MODE.
592 (define_mode_attr max_uint [(HI "65535") (QI "255")])
594 ;; Start and end field computations for RISBG et al.
595 (define_mode_attr bfstart [(DI "s") (SI "t")])
596 (define_mode_attr bfend [(DI "e") (SI "f")])
598 ;; In place of GET_MODE_BITSIZE (<MODE>mode)
599 (define_mode_attr bitsize [(DI "64") (SI "32") (HI "16") (QI "8")])
602 ;;- Compare instructions.
605 ; Test-under-Mask instructions
607 (define_insn "*tmqi_mem"
608 [(set (reg CC_REGNUM)
609 (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S")
610 (match_operand:QI 1 "immediate_operand" "n,n"))
611 (match_operand:QI 2 "immediate_operand" "n,n")))]
612 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], false))"
616 [(set_attr "op_type" "SI,SIY")
617 (set_attr "z10prop" "z10_super,z10_super")])
619 (define_insn "*tmdi_reg"
620 [(set (reg CC_REGNUM)
621 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
622 (match_operand:DI 1 "immediate_operand"
623 "N0HD0,N1HD0,N2HD0,N3HD0"))
624 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
626 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
627 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
633 [(set_attr "op_type" "RI")
634 (set_attr "z10prop" "z10_super,z10_super,z10_super,z10_super")])
636 (define_insn "*tmsi_reg"
637 [(set (reg CC_REGNUM)
638 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
639 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
640 (match_operand:SI 2 "immediate_operand" "n,n")))]
641 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
642 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
646 [(set_attr "op_type" "RI")
647 (set_attr "z10prop" "z10_super,z10_super")])
649 (define_insn "*tm<mode>_full"
650 [(set (reg CC_REGNUM)
651 (compare (match_operand:HQI 0 "register_operand" "d")
652 (match_operand:HQI 1 "immediate_operand" "n")))]
653 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], true))"
655 [(set_attr "op_type" "RI")
656 (set_attr "z10prop" "z10_super")])
660 ; Load-and-Test instructions
663 ; tst(di|si) instruction pattern(s).
665 (define_insn "*tstdi_sign"
666 [(set (reg CC_REGNUM)
670 (subreg:DI (match_operand:SI 0 "nonimmediate_operand" "d,RT") 0)
671 (const_int 32)) (const_int 32))
672 (match_operand:DI 1 "const0_operand" "")))
673 (set (match_operand:DI 2 "register_operand" "=d,d")
674 (sign_extend:DI (match_dup 0)))]
675 "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH"
678 [(set_attr "op_type" "RRE,RXY")
679 (set_attr "cpu_facility" "*,z10")
680 (set_attr "z10prop" "z10_super_E1,z10_super_E1") ])
683 (define_insn "*tst<mode>_extimm"
684 [(set (reg CC_REGNUM)
685 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,RT")
686 (match_operand:GPR 1 "const0_operand" "")))
687 (set (match_operand:GPR 2 "register_operand" "=d,d")
689 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
693 [(set_attr "op_type" "RR<E>,RXY")
694 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3") ])
697 (define_insn "*tst<mode>_cconly_extimm"
698 [(set (reg CC_REGNUM)
699 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,RT")
700 (match_operand:GPR 1 "const0_operand" "")))
701 (clobber (match_scratch:GPR 2 "=X,d"))]
702 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
706 [(set_attr "op_type" "RR<E>,RXY")
707 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3")])
709 (define_insn "*tstdi"
710 [(set (reg CC_REGNUM)
711 (compare (match_operand:DI 0 "register_operand" "d")
712 (match_operand:DI 1 "const0_operand" "")))
713 (set (match_operand:DI 2 "register_operand" "=d")
715 "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH && !TARGET_EXTIMM"
717 [(set_attr "op_type" "RRE")
718 (set_attr "z10prop" "z10_fr_E1")])
720 (define_insn "*tstsi"
721 [(set (reg CC_REGNUM)
722 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
723 (match_operand:SI 1 "const0_operand" "")))
724 (set (match_operand:SI 2 "register_operand" "=d,d,d")
726 "s390_match_ccmode(insn, CCSmode) && !TARGET_EXTIMM"
731 [(set_attr "op_type" "RR,RS,RSY")
732 (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
734 (define_insn "*tstsi_cconly"
735 [(set (reg CC_REGNUM)
736 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
737 (match_operand:SI 1 "const0_operand" "")))
738 (clobber (match_scratch:SI 2 "=X,d,d"))]
739 "s390_match_ccmode(insn, CCSmode)"
744 [(set_attr "op_type" "RR,RS,RSY")
745 (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
747 (define_insn "*tstdi_cconly_31"
748 [(set (reg CC_REGNUM)
749 (compare (match_operand:DI 0 "register_operand" "d")
750 (match_operand:DI 1 "const0_operand" "")))]
751 "s390_match_ccmode(insn, CCSmode) && !TARGET_ZARCH"
753 [(set_attr "op_type" "RS")
754 (set_attr "atype" "reg")])
757 (define_insn "*tst<mode>_cconly2"
758 [(set (reg CC_REGNUM)
759 (compare (match_operand:GPR 0 "register_operand" "d")
760 (match_operand:GPR 1 "const0_operand" "")))]
761 "s390_match_ccmode(insn, CCSmode)"
763 [(set_attr "op_type" "RR<E>")
764 (set_attr "z10prop" "z10_fr_E1")])
766 ; tst(hi|qi) instruction pattern(s).
768 (define_insn "*tst<mode>CCT"
769 [(set (reg CC_REGNUM)
770 (compare (match_operand:HQI 0 "nonimmediate_operand" "?Q,?S,d")
771 (match_operand:HQI 1 "const0_operand" "")))
772 (set (match_operand:HQI 2 "register_operand" "=d,d,0")
774 "s390_match_ccmode(insn, CCTmode)"
777 icmy\t%2,<icm_lo>,%S0
779 [(set_attr "op_type" "RS,RSY,RI")
780 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
782 (define_insn "*tsthiCCT_cconly"
783 [(set (reg CC_REGNUM)
784 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
785 (match_operand:HI 1 "const0_operand" "")))
786 (clobber (match_scratch:HI 2 "=d,d,X"))]
787 "s390_match_ccmode(insn, CCTmode)"
792 [(set_attr "op_type" "RS,RSY,RI")
793 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
795 (define_insn "*tstqiCCT_cconly"
796 [(set (reg CC_REGNUM)
797 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
798 (match_operand:QI 1 "const0_operand" "")))]
799 "s390_match_ccmode(insn, CCTmode)"
804 [(set_attr "op_type" "SI,SIY,RI")
805 (set_attr "z10prop" "z10_super,z10_super,z10_super")])
807 (define_insn "*tst<mode>"
808 [(set (reg CC_REGNUM)
809 (compare (match_operand:HQI 0 "s_operand" "Q,S")
810 (match_operand:HQI 1 "const0_operand" "")))
811 (set (match_operand:HQI 2 "register_operand" "=d,d")
813 "s390_match_ccmode(insn, CCSmode)"
816 icmy\t%2,<icm_lo>,%S0"
817 [(set_attr "op_type" "RS,RSY")
818 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
820 (define_insn "*tst<mode>_cconly"
821 [(set (reg CC_REGNUM)
822 (compare (match_operand:HQI 0 "s_operand" "Q,S")
823 (match_operand:HQI 1 "const0_operand" "")))
824 (clobber (match_scratch:HQI 2 "=d,d"))]
825 "s390_match_ccmode(insn, CCSmode)"
828 icmy\t%2,<icm_lo>,%S0"
829 [(set_attr "op_type" "RS,RSY")
830 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
833 ; Compare (equality) instructions
835 (define_insn "*cmpdi_cct"
836 [(set (reg CC_REGNUM)
837 (compare (match_operand:DI 0 "nonimmediate_operand" "%d,d,d,d,Q")
838 (match_operand:DI 1 "general_operand" "d,K,Os,RT,BQ")))]
839 "s390_match_ccmode (insn, CCTmode) && TARGET_ZARCH"
846 [(set_attr "op_type" "RRE,RI,RIL,RXY,SS")
847 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,*")])
849 (define_insn "*cmpsi_cct"
850 [(set (reg CC_REGNUM)
851 (compare (match_operand:SI 0 "nonimmediate_operand" "%d,d,d,d,d,Q")
852 (match_operand:SI 1 "general_operand" "d,K,Os,R,T,BQ")))]
853 "s390_match_ccmode (insn, CCTmode)"
861 [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS")
862 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*")])
864 ; Compare (signed) instructions
866 (define_insn "*cmpdi_ccs_sign"
867 [(set (reg CC_REGNUM)
868 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand"
870 (match_operand:DI 0 "register_operand" "d, d,d")))]
871 "s390_match_ccmode(insn, CCSRmode) && TARGET_ZARCH"
876 [(set_attr "op_type" "RRE,RXY,RIL")
877 (set_attr "z10prop" "z10_c,*,*")
878 (set_attr "type" "*,*,larl")])
882 (define_insn "*cmpsi_ccs_sign"
883 [(set (reg CC_REGNUM)
884 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T,b"))
885 (match_operand:SI 0 "register_operand" "d,d,d")))]
886 "s390_match_ccmode(insn, CCSRmode)"
891 [(set_attr "op_type" "RX,RXY,RIL")
892 (set_attr "cpu_facility" "*,*,z10")
893 (set_attr "type" "*,*,larl")
894 (set_attr "z196prop" "z196_cracked,z196_cracked,z196_cracked")])
896 (define_insn "*cmphi_ccs_z10"
897 [(set (reg CC_REGNUM)
898 (compare (match_operand:HI 0 "s_operand" "Q")
899 (match_operand:HI 1 "immediate_operand" "K")))]
900 "s390_match_ccmode(insn, CCSmode) && TARGET_Z10"
902 [(set_attr "op_type" "SIL")
903 (set_attr "z196prop" "z196_cracked")])
905 (define_insn "*cmpdi_ccs_signhi_rl"
906 [(set (reg CC_REGNUM)
907 (compare (sign_extend:DI (match_operand:HI 1 "memory_operand" "RT,b"))
908 (match_operand:GPR 0 "register_operand" "d,d")))]
909 "s390_match_ccmode(insn, CCSRmode) && TARGET_Z10"
913 [(set_attr "op_type" "RXY,RIL")
914 (set_attr "type" "*,larl")])
916 ; cr, chi, cfi, c, cy, cgr, cghi, cgfi, cg, chsi, cghsi, crl, cgrl
917 (define_insn "*cmp<mode>_ccs"
918 [(set (reg CC_REGNUM)
919 (compare (match_operand:GPR 0 "nonimmediate_operand"
921 (match_operand:GPR 1 "general_operand"
923 "s390_match_ccmode(insn, CCSmode)"
932 [(set_attr "op_type" "RR<E>,RI,SIL,RIL,RX<Y>,RXY,RIL")
933 (set_attr "cpu_facility" "*,*,z10,extimm,*,*,z10")
934 (set_attr "type" "*,*,*,*,*,*,larl")
935 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,z10_super")])
938 ; Compare (unsigned) instructions
940 (define_insn "*cmpsi_ccu_zerohi_rlsi"
941 [(set (reg CC_REGNUM)
942 (compare (zero_extend:SI (mem:HI (match_operand:SI 1
943 "larl_operand" "X")))
944 (match_operand:SI 0 "register_operand" "d")))]
945 "s390_match_ccmode(insn, CCURmode) && TARGET_Z10"
947 [(set_attr "op_type" "RIL")
948 (set_attr "type" "larl")
949 (set_attr "z10prop" "z10_super")])
952 (define_insn "*cmp<GPR:mode>_ccu_zerohi_rldi"
953 [(set (reg CC_REGNUM)
954 (compare (zero_extend:GPR (mem:HI (match_operand:DI 1
955 "larl_operand" "X")))
956 (match_operand:GPR 0 "register_operand" "d")))]
957 "s390_match_ccmode(insn, CCURmode) && TARGET_Z10"
959 [(set_attr "op_type" "RIL")
960 (set_attr "type" "larl")
961 (set_attr "z10prop" "z10_super")])
963 (define_insn "*cmpdi_ccu_zero"
964 [(set (reg CC_REGNUM)
965 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand"
967 (match_operand:DI 0 "register_operand" "d, d,d")))]
968 "s390_match_ccmode (insn, CCURmode) && TARGET_ZARCH"
973 [(set_attr "op_type" "RRE,RXY,RIL")
974 (set_attr "cpu_facility" "*,*,z10")
975 (set_attr "type" "*,*,larl")
976 (set_attr "z10prop" "z10_super_c,z10_super_E1,z10_super")])
978 (define_insn "*cmpdi_ccu"
979 [(set (reg CC_REGNUM)
980 (compare (match_operand:DI 0 "nonimmediate_operand"
982 (match_operand:DI 1 "general_operand"
983 "d,Op,b,D,RT,BQ,Q")))]
984 "s390_match_ccmode (insn, CCUmode) && TARGET_ZARCH"
993 [(set_attr "op_type" "RRE,RIL,RIL,SIL,RXY,SS,SS")
994 (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*")
995 (set_attr "type" "*,*,larl,*,*,*,*")
996 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*,*")])
998 (define_insn "*cmpsi_ccu"
999 [(set (reg CC_REGNUM)
1000 (compare (match_operand:SI 0 "nonimmediate_operand" "d, d,d,Q,d,d, Q,BQ")
1001 (match_operand:SI 1 "general_operand" "d,Os,b,D,R,T,BQ, Q")))]
1002 "s390_match_ccmode (insn, CCUmode)"
1012 [(set_attr "op_type" "RR,RIL,RIL,SIL,RX,RXY,SS,SS")
1013 (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*,*")
1014 (set_attr "type" "*,*,larl,*,*,*,*,*")
1015 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,*,*")])
1017 (define_insn "*cmphi_ccu"
1018 [(set (reg CC_REGNUM)
1019 (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,Q,BQ")
1020 (match_operand:HI 1 "general_operand" "Q,S,D,BQ,Q")))]
1021 "s390_match_ccmode (insn, CCUmode)
1022 && !register_operand (operands[1], HImode)"
1029 [(set_attr "op_type" "RS,RSY,SIL,SS,SS")
1030 (set_attr "cpu_facility" "*,*,z10,*,*")
1031 (set_attr "z10prop" "*,*,z10_super,*,*")])
1033 (define_insn "*cmpqi_ccu"
1034 [(set (reg CC_REGNUM)
1035 (compare (match_operand:QI 0 "nonimmediate_operand" "d,d,Q,S,Q,BQ")
1036 (match_operand:QI 1 "general_operand" "Q,S,n,n,BQ,Q")))]
1037 "s390_match_ccmode (insn, CCUmode)
1038 && !register_operand (operands[1], QImode)"
1046 [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS")
1047 (set_attr "z10prop" "*,*,z10_super,z10_super,*,*")])
1050 ; Block compare (CLC) instruction patterns.
1053 [(set (reg CC_REGNUM)
1054 (compare (match_operand:BLK 0 "memory_operand" "Q")
1055 (match_operand:BLK 1 "memory_operand" "Q")))
1056 (use (match_operand 2 "const_int_operand" "n"))]
1057 "s390_match_ccmode (insn, CCUmode)
1058 && INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
1059 "clc\t%O0(%2,%R0),%S1"
1060 [(set_attr "op_type" "SS")])
1063 [(set (reg CC_REGNUM)
1064 (compare (match_operand 0 "memory_operand" "")
1065 (match_operand 1 "memory_operand" "")))]
1067 && s390_match_ccmode (insn, CCUmode)
1068 && GET_MODE (operands[0]) == GET_MODE (operands[1])
1069 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
1071 [(set (match_dup 0) (match_dup 1))
1072 (use (match_dup 2))])]
1074 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
1075 operands[0] = adjust_address (operands[0], BLKmode, 0);
1076 operands[1] = adjust_address (operands[1], BLKmode, 0);
1078 operands[1] = gen_rtx_COMPARE (GET_MODE (SET_DEST (PATTERN (curr_insn))),
1079 operands[0], operands[1]);
1080 operands[0] = SET_DEST (PATTERN (curr_insn));
1084 ; (TF|DF|SF|TD|DD|SD) instructions
1086 ; ltxbr, ltdbr, ltebr, ltxtr, ltdtr
1087 (define_insn "*cmp<mode>_ccs_0"
1088 [(set (reg CC_REGNUM)
1089 (compare (match_operand:FP 0 "register_operand" "f")
1090 (match_operand:FP 1 "const0_operand" "")))]
1091 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
1092 "lt<xde><bt>r\t%0,%0"
1093 [(set_attr "op_type" "RRE")
1094 (set_attr "type" "fsimp<mode>")])
1096 ; cxtr, cxbr, cdtr, cdbr, cebr, cdb, ceb
1097 (define_insn "*cmp<mode>_ccs"
1098 [(set (reg CC_REGNUM)
1099 (compare (match_operand:FP 0 "register_operand" "f,f")
1100 (match_operand:FP 1 "general_operand" "f,<Rf>")))]
1101 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
1105 [(set_attr "op_type" "RRE,RXE")
1106 (set_attr "type" "fsimp<mode>")])
1109 ; Compare and Branch instructions
1111 ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
1112 ; The following instructions do a complementary access of their second
1113 ; operand (z01 only): crj_c, cgrjc, cr, cgr
1114 (define_insn "*cmp_and_br_signed_<mode>"
1116 (if_then_else (match_operator 0 "s390_signed_integer_comparison"
1117 [(match_operand:GPR 1 "register_operand" "d,d")
1118 (match_operand:GPR 2 "nonmemory_operand" "d,C")])
1119 (label_ref (match_operand 3 "" ""))
1121 (clobber (reg:CC CC_REGNUM))]
1122 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1124 if (get_attr_length (insn) == 6)
1125 return which_alternative ?
1126 "c<g>ij%C0\t%1,%c2,%l3" : "c<g>rj%C0\t%1,%2,%l3";
1128 return which_alternative ?
1129 "c<g>fi\t%1,%c2\;jg%C0\t%l3" : "c<g>r\t%1,%2\;jg%C0\t%l3";
1131 [(set_attr "op_type" "RIE")
1132 (set_attr "type" "branch")
1133 (set_attr "z10prop" "z10_super_c,z10_super")
1134 (set (attr "length")
1135 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1136 (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg
1137 ; 10 byte for cgr/jg
1139 ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr
1140 ; The following instructions do a complementary access of their second
1141 ; operand (z10 only): clrj, clgrj, clr, clgr
1142 (define_insn "*cmp_and_br_unsigned_<mode>"
1144 (if_then_else (match_operator 0 "s390_unsigned_integer_comparison"
1145 [(match_operand:GPR 1 "register_operand" "d,d")
1146 (match_operand:GPR 2 "nonmemory_operand" "d,I")])
1147 (label_ref (match_operand 3 "" ""))
1149 (clobber (reg:CC CC_REGNUM))]
1150 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1152 if (get_attr_length (insn) == 6)
1153 return which_alternative ?
1154 "cl<g>ij%C0\t%1,%b2,%l3" : "cl<g>rj%C0\t%1,%2,%l3";
1156 return which_alternative ?
1157 "cl<g>fi\t%1,%b2\;jg%C0\t%l3" : "cl<g>r\t%1,%2\;jg%C0\t%l3";
1159 [(set_attr "op_type" "RIE")
1160 (set_attr "type" "branch")
1161 (set_attr "z10prop" "z10_super_c,z10_super")
1162 (set (attr "length")
1163 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1164 (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg
1165 ; 10 byte for clgr/jg
1167 ; And now the same two patterns as above but with a negated CC mask.
1169 ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
1170 ; The following instructions do a complementary access of their second
1171 ; operand (z01 only): crj_c, cgrjc, cr, cgr
1172 (define_insn "*icmp_and_br_signed_<mode>"
1174 (if_then_else (match_operator 0 "s390_signed_integer_comparison"
1175 [(match_operand:GPR 1 "register_operand" "d,d")
1176 (match_operand:GPR 2 "nonmemory_operand" "d,C")])
1178 (label_ref (match_operand 3 "" ""))))
1179 (clobber (reg:CC CC_REGNUM))]
1180 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1182 if (get_attr_length (insn) == 6)
1183 return which_alternative ?
1184 "c<g>ij%D0\t%1,%c2,%l3" : "c<g>rj%D0\t%1,%2,%l3";
1186 return which_alternative ?
1187 "c<g>fi\t%1,%c2\;jg%D0\t%l3" : "c<g>r\t%1,%2\;jg%D0\t%l3";
1189 [(set_attr "op_type" "RIE")
1190 (set_attr "type" "branch")
1191 (set_attr "z10prop" "z10_super_c,z10_super")
1192 (set (attr "length")
1193 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1194 (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg
1195 ; 10 byte for cgr/jg
1197 ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr
1198 ; The following instructions do a complementary access of their second
1199 ; operand (z10 only): clrj, clgrj, clr, clgr
1200 (define_insn "*icmp_and_br_unsigned_<mode>"
1202 (if_then_else (match_operator 0 "s390_unsigned_integer_comparison"
1203 [(match_operand:GPR 1 "register_operand" "d,d")
1204 (match_operand:GPR 2 "nonmemory_operand" "d,I")])
1206 (label_ref (match_operand 3 "" ""))))
1207 (clobber (reg:CC CC_REGNUM))]
1208 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1210 if (get_attr_length (insn) == 6)
1211 return which_alternative ?
1212 "cl<g>ij%D0\t%1,%b2,%l3" : "cl<g>rj%D0\t%1,%2,%l3";
1214 return which_alternative ?
1215 "cl<g>fi\t%1,%b2\;jg%D0\t%l3" : "cl<g>r\t%1,%2\;jg%D0\t%l3";
1217 [(set_attr "op_type" "RIE")
1218 (set_attr "type" "branch")
1219 (set_attr "z10prop" "z10_super_c,z10_super")
1220 (set (attr "length")
1221 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1222 (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg
1223 ; 10 byte for clgr/jg
1226 ;;- Move instructions.
1230 ; movti instruction pattern(s).
1233 (define_insn "movti"
1234 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o")
1235 (match_operand:TI 1 "general_operand" "QS,d,dPRT,d"))]
1242 [(set_attr "op_type" "RSY,RSY,*,*")
1243 (set_attr "type" "lm,stm,*,*")])
1246 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1247 (match_operand:TI 1 "general_operand" ""))]
1248 "TARGET_ZARCH && reload_completed
1249 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
1250 [(set (match_dup 2) (match_dup 4))
1251 (set (match_dup 3) (match_dup 5))]
1253 operands[2] = operand_subword (operands[0], 0, 0, TImode);
1254 operands[3] = operand_subword (operands[0], 1, 0, TImode);
1255 operands[4] = operand_subword (operands[1], 0, 0, TImode);
1256 operands[5] = operand_subword (operands[1], 1, 0, TImode);
1260 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1261 (match_operand:TI 1 "general_operand" ""))]
1262 "TARGET_ZARCH && reload_completed
1263 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
1264 [(set (match_dup 2) (match_dup 4))
1265 (set (match_dup 3) (match_dup 5))]
1267 operands[2] = operand_subword (operands[0], 1, 0, TImode);
1268 operands[3] = operand_subword (operands[0], 0, 0, TImode);
1269 operands[4] = operand_subword (operands[1], 1, 0, TImode);
1270 operands[5] = operand_subword (operands[1], 0, 0, TImode);
1274 [(set (match_operand:TI 0 "register_operand" "")
1275 (match_operand:TI 1 "memory_operand" ""))]
1276 "TARGET_ZARCH && reload_completed
1277 && !s_operand (operands[1], VOIDmode)"
1278 [(set (match_dup 0) (match_dup 1))]
1280 rtx addr = operand_subword (operands[0], 1, 0, TImode);
1281 addr = gen_lowpart (Pmode, addr);
1282 s390_load_address (addr, XEXP (operands[1], 0));
1283 operands[1] = replace_equiv_address (operands[1], addr);
1288 ; Patterns used for secondary reloads
1291 ; z10 provides move instructions accepting larl memory operands.
1292 ; Unfortunately there is no such variant for QI, TI and FP mode moves.
1293 ; These patterns are also used for unaligned SI and DI accesses.
1295 (define_expand "reload<INTALL:mode><P:mode>_tomem_z10"
1296 [(parallel [(match_operand:INTALL 0 "memory_operand" "")
1297 (match_operand:INTALL 1 "register_operand" "=d")
1298 (match_operand:P 2 "register_operand" "=&a")])]
1301 s390_reload_symref_address (operands[1], operands[0], operands[2], 1);
1305 (define_expand "reload<INTALL:mode><P:mode>_toreg_z10"
1306 [(parallel [(match_operand:INTALL 0 "register_operand" "=d")
1307 (match_operand:INTALL 1 "memory_operand" "")
1308 (match_operand:P 2 "register_operand" "=a")])]
1311 s390_reload_symref_address (operands[0], operands[1], operands[2], 0);
1315 (define_expand "reload<FPALL:mode><P:mode>_tomem_z10"
1316 [(parallel [(match_operand:FPALL 0 "memory_operand" "")
1317 (match_operand:FPALL 1 "register_operand" "=d")
1318 (match_operand:P 2 "register_operand" "=&a")])]
1321 s390_reload_symref_address (operands[1], operands[0], operands[2], 1);
1325 (define_expand "reload<FPALL:mode><P:mode>_toreg_z10"
1326 [(parallel [(match_operand:FPALL 0 "register_operand" "=d")
1327 (match_operand:FPALL 1 "memory_operand" "")
1328 (match_operand:P 2 "register_operand" "=a")])]
1331 s390_reload_symref_address (operands[0], operands[1], operands[2], 0);
1335 (define_expand "reload<P:mode>_larl_odd_addend_z10"
1336 [(parallel [(match_operand:P 0 "register_operand" "=d")
1337 (match_operand:P 1 "larl_operand" "")
1338 (match_operand:P 2 "register_operand" "=a")])]
1341 s390_reload_larl_operand (operands[0], operands[1], operands[2]);
1345 ; Handles loading a PLUS (load address) expression
1347 (define_expand "reload<mode>_plus"
1348 [(parallel [(match_operand:P 0 "register_operand" "=a")
1349 (match_operand:P 1 "s390_plus_operand" "")
1350 (match_operand:P 2 "register_operand" "=&a")])]
1353 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1357 ; Handles assessing a non-offsetable memory address
1359 (define_expand "reload<mode>_nonoffmem_in"
1360 [(parallel [(match_operand 0 "register_operand" "")
1361 (match_operand 1 "" "")
1362 (match_operand:P 2 "register_operand" "=&a")])]
1365 gcc_assert (MEM_P (operands[1]));
1366 s390_load_address (operands[2], find_replacement (&XEXP (operands[1], 0)));
1367 operands[1] = replace_equiv_address (operands[1], operands[2]);
1368 emit_move_insn (operands[0], operands[1]);
1372 (define_expand "reload<mode>_nonoffmem_out"
1373 [(parallel [(match_operand 0 "" "")
1374 (match_operand 1 "register_operand" "")
1375 (match_operand:P 2 "register_operand" "=&a")])]
1378 gcc_assert (MEM_P (operands[0]));
1379 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
1380 operands[0] = replace_equiv_address (operands[0], operands[2]);
1381 emit_move_insn (operands[0], operands[1]);
1385 (define_expand "reload<mode>_PIC_addr"
1386 [(parallel [(match_operand 0 "register_operand" "=d")
1387 (match_operand 1 "larl_operand" "")
1388 (match_operand:P 2 "register_operand" "=a")])]
1391 rtx new_rtx = legitimize_pic_address (operands[1], operands[2]);
1392 emit_move_insn (operands[0], new_rtx);
1396 ; movdi instruction pattern(s).
1399 (define_expand "movdi"
1400 [(set (match_operand:DI 0 "general_operand" "")
1401 (match_operand:DI 1 "general_operand" ""))]
1404 /* Handle symbolic constants. */
1406 && (SYMBOLIC_CONST (operands[1])
1407 || (GET_CODE (operands[1]) == PLUS
1408 && XEXP (operands[1], 0) == pic_offset_table_rtx
1409 && SYMBOLIC_CONST (XEXP (operands[1], 1)))))
1410 emit_symbolic_move (operands);
1413 (define_insn "*movdi_larl"
1414 [(set (match_operand:DI 0 "register_operand" "=d")
1415 (match_operand:DI 1 "larl_operand" "X"))]
1417 && !FP_REG_P (operands[0])"
1419 [(set_attr "op_type" "RIL")
1420 (set_attr "type" "larl")
1421 (set_attr "z10prop" "z10_super_A1")])
1423 (define_insn "*movdi_64"
1424 [(set (match_operand:DI 0 "nonimmediate_operand"
1425 "=d,d,d,d,d,d,d,d,f,d,d,d,d,d,
1426 RT,!*f,!*f,!*f,!R,!T,b,Q,d,t,Q,t")
1427 (match_operand:DI 1 "general_operand"
1428 "K,N0HD0,N1HD0,N2HD0,N3HD0,Os,N0SD0,N1SD0,d,f,L,b,d,RT,
1429 d,*f,R,T,*f,*f,d,K,t,d,t,Q"))]
1458 [(set_attr "op_type" "RI,RI,RI,RI,RI,RIL,RIL,RIL,RRE,RRE,RXY,RIL,RRE,RXY,
1459 RXY,RR,RX,RXY,RX,RXY,RIL,SIL,*,*,RS,RS")
1460 (set_attr "type" "*,*,*,*,*,*,*,*,floaddf,floaddf,la,larl,lr,load,store,
1461 floaddf,floaddf,floaddf,fstoredf,fstoredf,larl,*,*,*,
1463 (set_attr "cpu_facility" "*,*,*,*,*,extimm,extimm,extimm,dfp,dfp,longdisp,
1464 z10,*,*,*,*,*,longdisp,*,longdisp,
1466 (set_attr "z10prop" "z10_fwd_A1,
1495 [(set (match_operand:DI 0 "register_operand" "")
1496 (match_operand:DI 1 "register_operand" ""))]
1497 "TARGET_ZARCH && ACCESS_REG_P (operands[1])"
1498 [(set (match_dup 2) (match_dup 3))
1499 (set (match_dup 0) (ashift:DI (match_dup 0) (const_int 32)))
1500 (set (strict_low_part (match_dup 2)) (match_dup 4))]
1501 "operands[2] = gen_lowpart (SImode, operands[0]);
1502 s390_split_access_reg (operands[1], &operands[4], &operands[3]);")
1505 [(set (match_operand:DI 0 "register_operand" "")
1506 (match_operand:DI 1 "register_operand" ""))]
1507 "TARGET_ZARCH && ACCESS_REG_P (operands[0])
1508 && dead_or_set_p (insn, operands[1])"
1509 [(set (match_dup 3) (match_dup 2))
1510 (set (match_dup 1) (lshiftrt:DI (match_dup 1) (const_int 32)))
1511 (set (match_dup 4) (match_dup 2))]
1512 "operands[2] = gen_lowpart (SImode, operands[1]);
1513 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1516 [(set (match_operand:DI 0 "register_operand" "")
1517 (match_operand:DI 1 "register_operand" ""))]
1518 "TARGET_ZARCH && ACCESS_REG_P (operands[0])
1519 && !dead_or_set_p (insn, operands[1])"
1520 [(set (match_dup 3) (match_dup 2))
1521 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))
1522 (set (match_dup 4) (match_dup 2))
1523 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))]
1524 "operands[2] = gen_lowpart (SImode, operands[1]);
1525 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1527 (define_insn "*movdi_31"
1528 [(set (match_operand:DI 0 "nonimmediate_operand"
1529 "=d,d,Q,S,d ,o,!*f,!*f,!*f,!R,!T,d")
1530 (match_operand:DI 1 "general_operand"
1531 " Q,S,d,d,dPRT,d, *f, R, T,*f,*f,b"))]
1546 [(set_attr "op_type" "RS,RSY,RS,RSY,*,*,RR,RX,RXY,RX,RXY,*")
1547 (set_attr "type" "lm,lm,stm,stm,*,*,floaddf,floaddf,floaddf,fstoredf,fstoredf,*")
1548 (set_attr "cpu_facility" "*,*,*,*,*,*,*,*,*,*,*,z10")])
1550 ; For a load from a symbol ref we can use one of the target registers
1551 ; together with larl to load the address.
1553 [(set (match_operand:DI 0 "register_operand" "")
1554 (match_operand:DI 1 "memory_operand" ""))]
1555 "!TARGET_ZARCH && reload_completed && TARGET_Z10
1556 && larl_operand (XEXP (operands[1], 0), SImode)"
1557 [(set (match_dup 2) (match_dup 3))
1558 (set (match_dup 0) (match_dup 1))]
1560 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1561 operands[3] = XEXP (operands[1], 0);
1562 operands[1] = replace_equiv_address (operands[1], operands[2]);
1566 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1567 (match_operand:DI 1 "general_operand" ""))]
1568 "!TARGET_ZARCH && reload_completed
1569 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1570 [(set (match_dup 2) (match_dup 4))
1571 (set (match_dup 3) (match_dup 5))]
1573 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1574 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1575 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1576 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1580 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1581 (match_operand:DI 1 "general_operand" ""))]
1582 "!TARGET_ZARCH && reload_completed
1583 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1584 [(set (match_dup 2) (match_dup 4))
1585 (set (match_dup 3) (match_dup 5))]
1587 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1588 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1589 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1590 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1594 [(set (match_operand:DI 0 "register_operand" "")
1595 (match_operand:DI 1 "memory_operand" ""))]
1596 "!TARGET_ZARCH && reload_completed
1597 && !FP_REG_P (operands[0])
1598 && !s_operand (operands[1], VOIDmode)"
1599 [(set (match_dup 0) (match_dup 1))]
1601 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1602 s390_load_address (addr, XEXP (operands[1], 0));
1603 operands[1] = replace_equiv_address (operands[1], addr);
1607 [(set (match_operand:DI 0 "register_operand" "")
1608 (mem:DI (match_operand 1 "address_operand" "")))]
1610 && !FP_REG_P (operands[0])
1611 && GET_CODE (operands[1]) == SYMBOL_REF
1612 && CONSTANT_POOL_ADDRESS_P (operands[1])
1613 && get_pool_mode (operands[1]) == DImode
1614 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1615 [(set (match_dup 0) (match_dup 2))]
1616 "operands[2] = get_pool_constant (operands[1]);")
1618 (define_insn "*la_64"
1619 [(set (match_operand:DI 0 "register_operand" "=d,d")
1620 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))]
1625 [(set_attr "op_type" "RX,RXY")
1626 (set_attr "type" "la")
1627 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
1631 [(set (match_operand:DI 0 "register_operand" "")
1632 (match_operand:QI 1 "address_operand" ""))
1633 (clobber (reg:CC CC_REGNUM))])]
1635 && preferred_la_operand_p (operands[1], const0_rtx)"
1636 [(set (match_dup 0) (match_dup 1))]
1640 [(set (match_operand:DI 0 "register_operand" "")
1641 (match_operand:DI 1 "register_operand" ""))
1644 (plus:DI (match_dup 0)
1645 (match_operand:DI 2 "nonmemory_operand" "")))
1646 (clobber (reg:CC CC_REGNUM))])]
1648 && !reg_overlap_mentioned_p (operands[0], operands[2])
1649 && preferred_la_operand_p (operands[1], operands[2])"
1650 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1654 ; movsi instruction pattern(s).
1657 (define_expand "movsi"
1658 [(set (match_operand:SI 0 "general_operand" "")
1659 (match_operand:SI 1 "general_operand" ""))]
1662 /* Handle symbolic constants. */
1664 && (SYMBOLIC_CONST (operands[1])
1665 || (GET_CODE (operands[1]) == PLUS
1666 && XEXP (operands[1], 0) == pic_offset_table_rtx
1667 && SYMBOLIC_CONST (XEXP(operands[1], 1)))))
1668 emit_symbolic_move (operands);
1671 (define_insn "*movsi_larl"
1672 [(set (match_operand:SI 0 "register_operand" "=d")
1673 (match_operand:SI 1 "larl_operand" "X"))]
1674 "!TARGET_64BIT && TARGET_CPU_ZARCH
1675 && !FP_REG_P (operands[0])"
1677 [(set_attr "op_type" "RIL")
1678 (set_attr "type" "larl")
1679 (set_attr "z10prop" "z10_fwd_A1")])
1681 (define_insn "*movsi_zarch"
1682 [(set (match_operand:SI 0 "nonimmediate_operand"
1683 "=d,d,d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,d,t,Q,b,Q,t")
1684 (match_operand:SI 1 "general_operand"
1685 "K,N0HS0,N1HS0,Os,L,b,d,R,T,d,d,*f,R,T,*f,*f,t,d,t,d,K,Q"))]
1710 [(set_attr "op_type" "RI,RI,RI,RIL,RXY,RIL,RR,RX,RXY,RX,RXY,
1711 RR,RX,RXY,RX,RXY,RRE,RRE,RS,RIL,SIL,RS")
1712 (set_attr "type" "*,
1734 (set_attr "cpu_facility" "*,*,*,extimm,longdisp,z10,*,*,longdisp,*,longdisp,
1735 *,*,longdisp,*,longdisp,*,*,*,z10,z10,*")
1736 (set_attr "z10prop" "z10_fwd_A1,
1759 (define_insn "*movsi_esa"
1760 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,d,t,Q,t")
1761 (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,t,d,t,Q"))]
1775 [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,RRE,RRE,RS,RS")
1776 (set_attr "type" "*,lr,load,store,floadsf,floadsf,fstoresf,*,*,*,*")
1777 (set_attr "z10prop" "z10_fwd_A1,
1791 [(set (match_operand:SI 0 "register_operand" "")
1792 (mem:SI (match_operand 1 "address_operand" "")))]
1793 "!FP_REG_P (operands[0])
1794 && GET_CODE (operands[1]) == SYMBOL_REF
1795 && CONSTANT_POOL_ADDRESS_P (operands[1])
1796 && get_pool_mode (operands[1]) == SImode
1797 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1798 [(set (match_dup 0) (match_dup 2))]
1799 "operands[2] = get_pool_constant (operands[1]);")
1801 (define_insn "*la_31"
1802 [(set (match_operand:SI 0 "register_operand" "=d,d")
1803 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))]
1804 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1808 [(set_attr "op_type" "RX,RXY")
1809 (set_attr "type" "la")
1810 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
1814 [(set (match_operand:SI 0 "register_operand" "")
1815 (match_operand:QI 1 "address_operand" ""))
1816 (clobber (reg:CC CC_REGNUM))])]
1818 && preferred_la_operand_p (operands[1], const0_rtx)"
1819 [(set (match_dup 0) (match_dup 1))]
1823 [(set (match_operand:SI 0 "register_operand" "")
1824 (match_operand:SI 1 "register_operand" ""))
1827 (plus:SI (match_dup 0)
1828 (match_operand:SI 2 "nonmemory_operand" "")))
1829 (clobber (reg:CC CC_REGNUM))])]
1831 && !reg_overlap_mentioned_p (operands[0], operands[2])
1832 && preferred_la_operand_p (operands[1], operands[2])"
1833 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1836 (define_insn "*la_31_and"
1837 [(set (match_operand:SI 0 "register_operand" "=d,d")
1838 (and:SI (match_operand:QI 1 "address_operand" "ZQZR,ZSZT")
1839 (const_int 2147483647)))]
1844 [(set_attr "op_type" "RX,RXY")
1845 (set_attr "type" "la")
1846 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
1848 (define_insn_and_split "*la_31_and_cc"
1849 [(set (match_operand:SI 0 "register_operand" "=d")
1850 (and:SI (match_operand:QI 1 "address_operand" "p")
1851 (const_int 2147483647)))
1852 (clobber (reg:CC CC_REGNUM))]
1855 "&& reload_completed"
1857 (and:SI (match_dup 1) (const_int 2147483647)))]
1859 [(set_attr "op_type" "RX")
1860 (set_attr "type" "la")])
1862 (define_insn "force_la_31"
1863 [(set (match_operand:SI 0 "register_operand" "=d,d")
1864 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))
1865 (use (const_int 0))]
1870 [(set_attr "op_type" "RX")
1871 (set_attr "type" "la")
1872 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
1875 ; movhi instruction pattern(s).
1878 (define_expand "movhi"
1879 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1880 (match_operand:HI 1 "general_operand" ""))]
1883 /* Make it explicit that loading a register from memory
1884 always sign-extends (at least) to SImode. */
1885 if (optimize && can_create_pseudo_p ()
1886 && register_operand (operands[0], VOIDmode)
1887 && GET_CODE (operands[1]) == MEM)
1889 rtx tmp = gen_reg_rtx (SImode);
1890 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1891 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1892 operands[1] = gen_lowpart (HImode, tmp);
1896 (define_insn "*movhi"
1897 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,d,R,T,b,Q")
1898 (match_operand:HI 1 "general_operand" " d,n,R,T,b,d,d,d,K"))]
1910 [(set_attr "op_type" "RR,RI,RX,RXY,RIL,RX,RXY,RIL,SIL")
1911 (set_attr "type" "lr,*,*,*,larl,store,store,store,*")
1912 (set_attr "cpu_facility" "*,*,*,*,z10,*,*,z10,z10")
1913 (set_attr "z10prop" "z10_fr_E1,
1924 [(set (match_operand:HI 0 "register_operand" "")
1925 (mem:HI (match_operand 1 "address_operand" "")))]
1926 "GET_CODE (operands[1]) == SYMBOL_REF
1927 && CONSTANT_POOL_ADDRESS_P (operands[1])
1928 && get_pool_mode (operands[1]) == HImode
1929 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1930 [(set (match_dup 0) (match_dup 2))]
1931 "operands[2] = get_pool_constant (operands[1]);")
1934 ; movqi instruction pattern(s).
1937 (define_expand "movqi"
1938 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1939 (match_operand:QI 1 "general_operand" ""))]
1942 /* On z/Architecture, zero-extending from memory to register
1943 is just as fast as a QImode load. */
1944 if (TARGET_ZARCH && optimize && can_create_pseudo_p ()
1945 && register_operand (operands[0], VOIDmode)
1946 && GET_CODE (operands[1]) == MEM)
1948 rtx tmp = gen_reg_rtx (DImode);
1949 rtx ext = gen_rtx_ZERO_EXTEND (DImode, operands[1]);
1950 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1951 operands[1] = gen_lowpart (QImode, tmp);
1955 (define_insn "*movqi"
1956 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1957 (match_operand:QI 1 "general_operand" " d,n,R,T,d,d,n,n,?Q"))]
1969 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1970 (set_attr "type" "lr,*,*,*,store,store,store,store,*")
1971 (set_attr "z10prop" "z10_fr_E1,
1982 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1983 (mem:QI (match_operand 1 "address_operand" "")))]
1984 "GET_CODE (operands[1]) == SYMBOL_REF
1985 && CONSTANT_POOL_ADDRESS_P (operands[1])
1986 && get_pool_mode (operands[1]) == QImode
1987 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1988 [(set (match_dup 0) (match_dup 2))]
1989 "operands[2] = get_pool_constant (operands[1]);")
1992 ; movstrictqi instruction pattern(s).
1995 (define_insn "*movstrictqi"
1996 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1997 (match_operand:QI 1 "memory_operand" "R,T"))]
2002 [(set_attr "op_type" "RX,RXY")
2003 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
2006 ; movstricthi instruction pattern(s).
2009 (define_insn "*movstricthi"
2010 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
2011 (match_operand:HI 1 "memory_operand" "Q,S"))
2012 (clobber (reg:CC CC_REGNUM))]
2017 [(set_attr "op_type" "RS,RSY")
2018 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
2021 ; movstrictsi instruction pattern(s).
2024 (define_insn "movstrictsi"
2025 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d,d"))
2026 (match_operand:SI 1 "general_operand" "d,R,T,t"))]
2033 [(set_attr "op_type" "RR,RX,RXY,RRE")
2034 (set_attr "type" "lr,load,load,*")
2035 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_super_E1")])
2038 ; mov(tf|td) instruction pattern(s).
2041 (define_expand "mov<mode>"
2042 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2043 (match_operand:TD_TF 1 "general_operand" ""))]
2047 (define_insn "*mov<mode>_64"
2048 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o, d,QS, d,o")
2049 (match_operand:TD_TF 1 "general_operand" " G,f,o,f,QS, d,dRT,d"))]
2060 [(set_attr "op_type" "RRE,RRE,*,*,RSY,RSY,*,*")
2061 (set_attr "type" "fsimptf,fsimptf,*,*,lm,stm,*,*")
2062 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*")])
2064 (define_insn "*mov<mode>_31"
2065 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o")
2066 (match_operand:TD_TF 1 "general_operand" " G,f,o,f"))]
2073 [(set_attr "op_type" "RRE,RRE,*,*")
2074 (set_attr "type" "fsimptf,fsimptf,*,*")
2075 (set_attr "cpu_facility" "z196,*,*,*")])
2077 ; TFmode in GPRs splitters
2080 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2081 (match_operand:TD_TF 1 "general_operand" ""))]
2082 "TARGET_ZARCH && reload_completed
2083 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)"
2084 [(set (match_dup 2) (match_dup 4))
2085 (set (match_dup 3) (match_dup 5))]
2087 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
2088 operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode);
2089 operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode);
2090 operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode);
2094 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2095 (match_operand:TD_TF 1 "general_operand" ""))]
2096 "TARGET_ZARCH && reload_completed
2097 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)"
2098 [(set (match_dup 2) (match_dup 4))
2099 (set (match_dup 3) (match_dup 5))]
2101 operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode);
2102 operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode);
2103 operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode);
2104 operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode);
2108 [(set (match_operand:TD_TF 0 "register_operand" "")
2109 (match_operand:TD_TF 1 "memory_operand" ""))]
2110 "TARGET_ZARCH && reload_completed
2111 && !FP_REG_P (operands[0])
2112 && !s_operand (operands[1], VOIDmode)"
2113 [(set (match_dup 0) (match_dup 1))]
2115 rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode);
2116 addr = gen_lowpart (Pmode, addr);
2117 s390_load_address (addr, XEXP (operands[1], 0));
2118 operands[1] = replace_equiv_address (operands[1], addr);
2121 ; TFmode in BFPs splitters
2124 [(set (match_operand:TD_TF 0 "register_operand" "")
2125 (match_operand:TD_TF 1 "memory_operand" ""))]
2126 "reload_completed && offsettable_memref_p (operands[1])
2127 && FP_REG_P (operands[0])"
2128 [(set (match_dup 2) (match_dup 4))
2129 (set (match_dup 3) (match_dup 5))]
2131 operands[2] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0],
2133 operands[3] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0],
2135 operands[4] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 0);
2136 operands[5] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 8);
2140 [(set (match_operand:TD_TF 0 "memory_operand" "")
2141 (match_operand:TD_TF 1 "register_operand" ""))]
2142 "reload_completed && offsettable_memref_p (operands[0])
2143 && FP_REG_P (operands[1])"
2144 [(set (match_dup 2) (match_dup 4))
2145 (set (match_dup 3) (match_dup 5))]
2147 operands[2] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 0);
2148 operands[3] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 8);
2149 operands[4] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1],
2151 operands[5] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1],
2156 ; mov(df|dd) instruction pattern(s).
2159 (define_expand "mov<mode>"
2160 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2161 (match_operand:DD_DF 1 "general_operand" ""))]
2165 (define_insn "*mov<mode>_64dfp"
2166 [(set (match_operand:DD_DF 0 "nonimmediate_operand"
2167 "=f,f,f,d,f,f,R,T,d,d, d,RT")
2168 (match_operand:DD_DF 1 "general_operand"
2169 " G,f,d,f,R,T,f,f,G,d,RT, d"))]
2184 [(set_attr "op_type" "RRE,RR,RRE,RRE,RX,RXY,RX,RXY,RI,RRE,RXY,RXY")
2185 (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,floaddf,floaddf,
2186 fstoredf,fstoredf,*,lr,load,store")
2187 (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_rec")
2188 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*,*,*")])
2190 (define_insn "*mov<mode>_64"
2191 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d, d,RT")
2192 (match_operand:DD_DF 1 "general_operand" " G,f,R,T,f,f,G,d,RT, d"))]
2205 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RI,RRE,RXY,RXY")
2206 (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>,
2207 fstore<mode>,fstore<mode>,*,lr,load,store")
2208 (set_attr "z10prop" "*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_rec")
2209 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*")])
2211 (define_insn "*mov<mode>_31"
2212 [(set (match_operand:DD_DF 0 "nonimmediate_operand"
2213 "=f,f,f,f,R,T,d,d,Q,S, d,o")
2214 (match_operand:DD_DF 1 "general_operand"
2215 " G,f,R,T,f,f,Q,S,d,d,dPRT,d"))]
2230 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*")
2231 (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>,
2232 fstore<mode>,fstore<mode>,lm,lm,stm,stm,*,*")
2233 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*,*,*")])
2236 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2237 (match_operand:DD_DF 1 "general_operand" ""))]
2238 "!TARGET_ZARCH && reload_completed
2239 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)"
2240 [(set (match_dup 2) (match_dup 4))
2241 (set (match_dup 3) (match_dup 5))]
2243 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
2244 operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode);
2245 operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode);
2246 operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode);
2250 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2251 (match_operand:DD_DF 1 "general_operand" ""))]
2252 "!TARGET_ZARCH && reload_completed
2253 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)"
2254 [(set (match_dup 2) (match_dup 4))
2255 (set (match_dup 3) (match_dup 5))]
2257 operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode);
2258 operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode);
2259 operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode);
2260 operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode);
2264 [(set (match_operand:DD_DF 0 "register_operand" "")
2265 (match_operand:DD_DF 1 "memory_operand" ""))]
2266 "!TARGET_ZARCH && reload_completed
2267 && !FP_REG_P (operands[0])
2268 && !s_operand (operands[1], VOIDmode)"
2269 [(set (match_dup 0) (match_dup 1))]
2271 rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode);
2272 s390_load_address (addr, XEXP (operands[1], 0));
2273 operands[1] = replace_equiv_address (operands[1], addr);
2277 ; mov(sf|sd) instruction pattern(s).
2280 (define_insn "mov<mode>"
2281 [(set (match_operand:SD_SF 0 "nonimmediate_operand"
2282 "=f,f,f,f,R,T,d,d,d,d,R,T")
2283 (match_operand:SD_SF 1 "general_operand"
2284 " G,f,R,T,f,f,G,d,R,T,d,d"))]
2299 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RI,RR,RX,RXY,RX,RXY")
2300 (set_attr "type" "fsimpsf,fload<mode>,fload<mode>,fload<mode>,
2301 fstore<mode>,fstore<mode>,*,lr,load,load,store,store")
2302 (set_attr "z10prop" "*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec")
2303 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*,*,*")])
2306 ; movcc instruction pattern
2309 (define_insn "movcc"
2310 [(set (match_operand:CC 0 "nonimmediate_operand" "=d,c,d,d,d,R,T")
2311 (match_operand:CC 1 "nonimmediate_operand" " d,d,c,R,T,d,d"))]
2321 [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY")
2322 (set_attr "type" "lr,*,*,load,load,store,store")
2323 (set_attr "z10prop" "z10_fr_E1,z10_super,*,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec")
2324 (set_attr "z196prop" "*,*,z196_ends,*,*,*,*")])
2327 ; Block move (MVC) patterns.
2331 [(set (match_operand:BLK 0 "memory_operand" "=Q")
2332 (match_operand:BLK 1 "memory_operand" "Q"))
2333 (use (match_operand 2 "const_int_operand" "n"))]
2334 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
2335 "mvc\t%O0(%2,%R0),%S1"
2336 [(set_attr "op_type" "SS")])
2338 ; This splitter converts a QI to QI mode copy into a BLK mode copy in
2339 ; order to have it implemented with mvc.
2342 [(set (match_operand:QI 0 "memory_operand" "")
2343 (match_operand:QI 1 "memory_operand" ""))]
2346 [(set (match_dup 0) (match_dup 1))
2347 (use (const_int 1))])]
2349 operands[0] = adjust_address (operands[0], BLKmode, 0);
2350 operands[1] = adjust_address (operands[1], BLKmode, 0);
2356 [(set (match_operand:BLK 0 "memory_operand" "")
2357 (match_operand:BLK 1 "memory_operand" ""))
2358 (use (match_operand 2 "const_int_operand" ""))])
2360 [(set (match_operand:BLK 3 "memory_operand" "")
2361 (match_operand:BLK 4 "memory_operand" ""))
2362 (use (match_operand 5 "const_int_operand" ""))])]
2363 "s390_offset_p (operands[0], operands[3], operands[2])
2364 && s390_offset_p (operands[1], operands[4], operands[2])
2365 && !s390_overlap_p (operands[0], operands[1],
2366 INTVAL (operands[2]) + INTVAL (operands[5]))
2367 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
2369 [(set (match_dup 6) (match_dup 7))
2370 (use (match_dup 8))])]
2371 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
2372 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
2373 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
2377 ; load_multiple pattern(s).
2379 ; ??? Due to reload problems with replacing registers inside match_parallel
2380 ; we currently support load_multiple/store_multiple only after reload.
2383 (define_expand "load_multiple"
2384 [(match_par_dup 3 [(set (match_operand 0 "" "")
2385 (match_operand 1 "" ""))
2386 (use (match_operand 2 "" ""))])]
2389 enum machine_mode mode;
2395 /* Support only loading a constant number of fixed-point registers from
2396 memory and only bother with this if more than two */
2397 if (GET_CODE (operands[2]) != CONST_INT
2398 || INTVAL (operands[2]) < 2
2399 || INTVAL (operands[2]) > 16
2400 || GET_CODE (operands[1]) != MEM
2401 || GET_CODE (operands[0]) != REG
2402 || REGNO (operands[0]) >= 16)
2405 count = INTVAL (operands[2]);
2406 regno = REGNO (operands[0]);
2407 mode = GET_MODE (operands[0]);
2408 if (mode != SImode && (!TARGET_ZARCH || mode != DImode))
2411 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2412 if (!can_create_pseudo_p ())
2414 if (GET_CODE (XEXP (operands[1], 0)) == REG)
2416 from = XEXP (operands[1], 0);
2419 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
2420 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
2421 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
2423 from = XEXP (XEXP (operands[1], 0), 0);
2424 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
2431 from = force_reg (Pmode, XEXP (operands[1], 0));
2435 for (i = 0; i < count; i++)
2436 XVECEXP (operands[3], 0, i)
2437 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
2438 change_address (operands[1], mode,
2439 plus_constant (Pmode, from,
2440 off + i * GET_MODE_SIZE (mode))));
2443 (define_insn "*load_multiple_di"
2444 [(match_parallel 0 "load_multiple_operation"
2445 [(set (match_operand:DI 1 "register_operand" "=r")
2446 (match_operand:DI 2 "s_operand" "QS"))])]
2447 "reload_completed && TARGET_ZARCH"
2449 int words = XVECLEN (operands[0], 0);
2450 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
2451 return "lmg\t%1,%0,%S2";
2453 [(set_attr "op_type" "RSY")
2454 (set_attr "type" "lm")])
2456 (define_insn "*load_multiple_si"
2457 [(match_parallel 0 "load_multiple_operation"
2458 [(set (match_operand:SI 1 "register_operand" "=r,r")
2459 (match_operand:SI 2 "s_operand" "Q,S"))])]
2462 int words = XVECLEN (operands[0], 0);
2463 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
2464 return which_alternative == 0 ? "lm\t%1,%0,%S2" : "lmy\t%1,%0,%S2";
2466 [(set_attr "op_type" "RS,RSY")
2467 (set_attr "type" "lm")])
2470 ; store multiple pattern(s).
2473 (define_expand "store_multiple"
2474 [(match_par_dup 3 [(set (match_operand 0 "" "")
2475 (match_operand 1 "" ""))
2476 (use (match_operand 2 "" ""))])]
2479 enum machine_mode mode;
2485 /* Support only storing a constant number of fixed-point registers to
2486 memory and only bother with this if more than two. */
2487 if (GET_CODE (operands[2]) != CONST_INT
2488 || INTVAL (operands[2]) < 2
2489 || INTVAL (operands[2]) > 16
2490 || GET_CODE (operands[0]) != MEM
2491 || GET_CODE (operands[1]) != REG
2492 || REGNO (operands[1]) >= 16)
2495 count = INTVAL (operands[2]);
2496 regno = REGNO (operands[1]);
2497 mode = GET_MODE (operands[1]);
2498 if (mode != SImode && (!TARGET_ZARCH || mode != DImode))
2501 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2503 if (!can_create_pseudo_p ())
2505 if (GET_CODE (XEXP (operands[0], 0)) == REG)
2507 to = XEXP (operands[0], 0);
2510 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
2511 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
2512 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
2514 to = XEXP (XEXP (operands[0], 0), 0);
2515 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
2522 to = force_reg (Pmode, XEXP (operands[0], 0));
2526 for (i = 0; i < count; i++)
2527 XVECEXP (operands[3], 0, i)
2528 = gen_rtx_SET (VOIDmode,
2529 change_address (operands[0], mode,
2530 plus_constant (Pmode, to,
2531 off + i * GET_MODE_SIZE (mode))),
2532 gen_rtx_REG (mode, regno + i));
2535 (define_insn "*store_multiple_di"
2536 [(match_parallel 0 "store_multiple_operation"
2537 [(set (match_operand:DI 1 "s_operand" "=QS")
2538 (match_operand:DI 2 "register_operand" "r"))])]
2539 "reload_completed && TARGET_ZARCH"
2541 int words = XVECLEN (operands[0], 0);
2542 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
2543 return "stmg\t%2,%0,%S1";
2545 [(set_attr "op_type" "RSY")
2546 (set_attr "type" "stm")])
2549 (define_insn "*store_multiple_si"
2550 [(match_parallel 0 "store_multiple_operation"
2551 [(set (match_operand:SI 1 "s_operand" "=Q,S")
2552 (match_operand:SI 2 "register_operand" "r,r"))])]
2555 int words = XVECLEN (operands[0], 0);
2556 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
2557 return which_alternative == 0 ? "stm\t%2,%0,%S1" : "stmy\t%2,%0,%S1";
2559 [(set_attr "op_type" "RS,RSY")
2560 (set_attr "type" "stm")])
2563 ;; String instructions.
2566 (define_insn "*execute_rl"
2567 [(match_parallel 0 "execute_operation"
2568 [(unspec [(match_operand 1 "register_operand" "a")
2569 (match_operand 2 "" "")
2570 (match_operand:SI 3 "larl_operand" "X")] UNSPEC_EXECUTE)])]
2571 "TARGET_Z10 && GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
2572 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
2574 [(set_attr "op_type" "RIL")
2575 (set_attr "type" "cs")])
2577 (define_insn "*execute"
2578 [(match_parallel 0 "execute_operation"
2579 [(unspec [(match_operand 1 "register_operand" "a")
2580 (match_operand:BLK 2 "memory_operand" "R")
2581 (match_operand 3 "" "")] UNSPEC_EXECUTE)])]
2582 "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
2583 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
2585 [(set_attr "op_type" "RX")
2586 (set_attr "type" "cs")])
2590 ; strlenM instruction pattern(s).
2593 (define_expand "strlen<mode>"
2594 [(set (reg:SI 0) (match_operand:SI 2 "immediate_operand" ""))
2597 (unspec:P [(const_int 0)
2598 (match_operand:BLK 1 "memory_operand" "")
2600 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
2601 (clobber (scratch:P))
2602 (clobber (reg:CC CC_REGNUM))])
2604 [(set (match_operand:P 0 "register_operand" "")
2605 (minus:P (match_dup 4) (match_dup 5)))
2606 (clobber (reg:CC CC_REGNUM))])]
2609 operands[4] = gen_reg_rtx (Pmode);
2610 operands[5] = gen_reg_rtx (Pmode);
2611 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
2612 operands[1] = replace_equiv_address (operands[1], operands[5]);
2615 (define_insn "*strlen<mode>"
2616 [(set (match_operand:P 0 "register_operand" "=a")
2617 (unspec:P [(match_operand:P 2 "general_operand" "0")
2618 (mem:BLK (match_operand:P 3 "register_operand" "1"))
2620 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
2621 (clobber (match_scratch:P 1 "=a"))
2622 (clobber (reg:CC CC_REGNUM))]
2624 "srst\t%0,%1\;jo\t.-4"
2625 [(set_attr "length" "8")
2626 (set_attr "type" "vs")])
2629 ; cmpstrM instruction pattern(s).
2632 (define_expand "cmpstrsi"
2633 [(set (reg:SI 0) (const_int 0))
2635 [(clobber (match_operand 3 "" ""))
2636 (clobber (match_dup 4))
2637 (set (reg:CCU CC_REGNUM)
2638 (compare:CCU (match_operand:BLK 1 "memory_operand" "")
2639 (match_operand:BLK 2 "memory_operand" "")))
2642 [(set (match_operand:SI 0 "register_operand" "=d")
2643 (unspec:SI [(reg:CCU CC_REGNUM)] UNSPEC_STRCMPCC_TO_INT))
2644 (clobber (reg:CC CC_REGNUM))])]
2647 /* As the result of CMPINT is inverted compared to what we need,
2648 we have to swap the operands. */
2649 rtx op1 = operands[2];
2650 rtx op2 = operands[1];
2651 rtx addr1 = gen_reg_rtx (Pmode);
2652 rtx addr2 = gen_reg_rtx (Pmode);
2654 emit_move_insn (addr1, force_operand (XEXP (op1, 0), NULL_RTX));
2655 emit_move_insn (addr2, force_operand (XEXP (op2, 0), NULL_RTX));
2656 operands[1] = replace_equiv_address_nv (op1, addr1);
2657 operands[2] = replace_equiv_address_nv (op2, addr2);
2658 operands[3] = addr1;
2659 operands[4] = addr2;
2662 (define_insn "*cmpstr<mode>"
2663 [(clobber (match_operand:P 0 "register_operand" "=d"))
2664 (clobber (match_operand:P 1 "register_operand" "=d"))
2665 (set (reg:CCU CC_REGNUM)
2666 (compare:CCU (mem:BLK (match_operand:P 2 "register_operand" "0"))
2667 (mem:BLK (match_operand:P 3 "register_operand" "1"))))
2670 "clst\t%0,%1\;jo\t.-4"
2671 [(set_attr "length" "8")
2672 (set_attr "type" "vs")])
2675 ; movstr instruction pattern.
2678 (define_expand "movstr"
2679 [(set (reg:SI 0) (const_int 0))
2681 [(clobber (match_dup 3))
2682 (set (match_operand:BLK 1 "memory_operand" "")
2683 (match_operand:BLK 2 "memory_operand" ""))
2684 (set (match_operand 0 "register_operand" "")
2685 (unspec [(match_dup 1)
2687 (reg:SI 0)] UNSPEC_MVST))
2688 (clobber (reg:CC CC_REGNUM))])]
2691 rtx addr1 = gen_reg_rtx (Pmode);
2692 rtx addr2 = gen_reg_rtx (Pmode);
2694 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2695 emit_move_insn (addr2, force_operand (XEXP (operands[2], 0), NULL_RTX));
2696 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2697 operands[2] = replace_equiv_address_nv (operands[2], addr2);
2698 operands[3] = addr2;
2701 (define_insn "*movstr"
2702 [(clobber (match_operand:P 2 "register_operand" "=d"))
2703 (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
2704 (mem:BLK (match_operand:P 3 "register_operand" "2")))
2705 (set (match_operand:P 0 "register_operand" "=d")
2706 (unspec [(mem:BLK (match_dup 1))
2707 (mem:BLK (match_dup 3))
2708 (reg:SI 0)] UNSPEC_MVST))
2709 (clobber (reg:CC CC_REGNUM))]
2711 "mvst\t%1,%2\;jo\t.-4"
2712 [(set_attr "length" "8")
2713 (set_attr "type" "vs")])
2717 ; movmemM instruction pattern(s).
2720 (define_expand "movmem<mode>"
2721 [(set (match_operand:BLK 0 "memory_operand" "") ; destination
2722 (match_operand:BLK 1 "memory_operand" "")) ; source
2723 (use (match_operand:GPR 2 "general_operand" "")) ; count
2724 (match_operand 3 "" "")]
2727 if (s390_expand_movmem (operands[0], operands[1], operands[2]))
2733 ; Move a block that is up to 256 bytes in length.
2734 ; The block length is taken as (operands[2] % 256) + 1.
2736 (define_expand "movmem_short"
2738 [(set (match_operand:BLK 0 "memory_operand" "")
2739 (match_operand:BLK 1 "memory_operand" ""))
2740 (use (match_operand 2 "nonmemory_operand" ""))
2741 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2742 (clobber (match_dup 3))])]
2744 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2746 (define_insn "*movmem_short"
2747 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q")
2748 (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q"))
2749 (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
2750 (use (match_operand 3 "immediate_operand" "X,R,X,X"))
2751 (clobber (match_scratch:P 4 "=X,X,X,&a"))]
2752 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
2754 [(set_attr "type" "cs")
2755 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
2758 [(set (match_operand:BLK 0 "memory_operand" "")
2759 (match_operand:BLK 1 "memory_operand" ""))
2760 (use (match_operand 2 "const_int_operand" ""))
2761 (use (match_operand 3 "immediate_operand" ""))
2762 (clobber (scratch))]
2765 [(set (match_dup 0) (match_dup 1))
2766 (use (match_dup 2))])]
2767 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
2770 [(set (match_operand:BLK 0 "memory_operand" "")
2771 (match_operand:BLK 1 "memory_operand" ""))
2772 (use (match_operand 2 "register_operand" ""))
2773 (use (match_operand 3 "memory_operand" ""))
2774 (clobber (scratch))]
2777 [(unspec [(match_dup 2) (match_dup 3)
2778 (const_int 0)] UNSPEC_EXECUTE)
2779 (set (match_dup 0) (match_dup 1))
2780 (use (const_int 1))])]
2784 [(set (match_operand:BLK 0 "memory_operand" "")
2785 (match_operand:BLK 1 "memory_operand" ""))
2786 (use (match_operand 2 "register_operand" ""))
2787 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2788 (clobber (scratch))]
2789 "TARGET_Z10 && reload_completed"
2791 [(unspec [(match_dup 2) (const_int 0)
2792 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
2793 (set (match_dup 0) (match_dup 1))
2794 (use (const_int 1))])]
2795 "operands[3] = gen_label_rtx ();")
2798 [(set (match_operand:BLK 0 "memory_operand" "")
2799 (match_operand:BLK 1 "memory_operand" ""))
2800 (use (match_operand 2 "register_operand" ""))
2801 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2802 (clobber (match_operand 3 "register_operand" ""))]
2803 "reload_completed && TARGET_CPU_ZARCH"
2804 [(set (match_dup 3) (label_ref (match_dup 4)))
2806 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
2807 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
2808 (set (match_dup 0) (match_dup 1))
2809 (use (const_int 1))])]
2810 "operands[4] = gen_label_rtx ();")
2812 ; Move a block of arbitrary length.
2814 (define_expand "movmem_long"
2816 [(clobber (match_dup 2))
2817 (clobber (match_dup 3))
2818 (set (match_operand:BLK 0 "memory_operand" "")
2819 (match_operand:BLK 1 "memory_operand" ""))
2820 (use (match_operand 2 "general_operand" ""))
2822 (clobber (reg:CC CC_REGNUM))])]
2825 enum machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
2826 enum machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
2827 rtx reg0 = gen_reg_rtx (dreg_mode);
2828 rtx reg1 = gen_reg_rtx (dreg_mode);
2829 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
2830 rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1));
2831 rtx len0 = gen_lowpart (Pmode, reg0);
2832 rtx len1 = gen_lowpart (Pmode, reg1);
2834 emit_clobber (reg0);
2835 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2836 emit_move_insn (len0, operands[2]);
2838 emit_clobber (reg1);
2839 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2840 emit_move_insn (len1, operands[2]);
2842 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2843 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2848 (define_insn "*movmem_long"
2849 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
2850 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
2851 (set (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
2852 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0)))
2855 (clobber (reg:CC CC_REGNUM))]
2856 "TARGET_64BIT || !TARGET_ZARCH"
2857 "mvcle\t%0,%1,0\;jo\t.-4"
2858 [(set_attr "length" "8")
2859 (set_attr "type" "vs")])
2861 (define_insn "*movmem_long_31z"
2862 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2863 (clobber (match_operand:TI 1 "register_operand" "=d"))
2864 (set (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4))
2865 (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4)))
2868 (clobber (reg:CC CC_REGNUM))]
2869 "!TARGET_64BIT && TARGET_ZARCH"
2870 "mvcle\t%0,%1,0\;jo\t.-4"
2871 [(set_attr "length" "8")
2872 (set_attr "type" "vs")])
2879 (define_expand "signbit<mode>2"
2880 [(set (reg:CCZ CC_REGNUM)
2881 (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
2884 (set (match_operand:SI 0 "register_operand" "=d")
2885 (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))]
2888 operands[2] = GEN_INT (S390_TDC_SIGNBIT_SET);
2891 (define_expand "isinf<mode>2"
2892 [(set (reg:CCZ CC_REGNUM)
2893 (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
2896 (set (match_operand:SI 0 "register_operand" "=d")
2897 (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))]
2900 operands[2] = GEN_INT (S390_TDC_INFINITY);
2903 (define_insn_and_split "*cc_to_int"
2904 [(set (match_operand:SI 0 "register_operand" "=d")
2905 (unspec:SI [(match_operand 1 "register_operand" "0")]
2910 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 28)))])
2912 ; This insn is used to generate all variants of the Test Data Class
2913 ; instruction, namely tcxb, tcdb, and tceb. The insn's first operand
2914 ; is the register to be tested and the second one is the bit mask
2915 ; specifying the required test(s).
2917 ; tcxb, tcdb, tceb, tdcxt, tdcdt, tdcet
2918 (define_insn "*TDC_insn_<mode>"
2919 [(set (reg:CCZ CC_REGNUM)
2920 (unspec:CCZ [(match_operand:FP_ALL 0 "register_operand" "f")
2921 (match_operand:SI 1 "const_int_operand")] UNSPEC_TDC_INSN))]
2923 "t<_d>c<xde><bt>\t%0,%1"
2924 [(set_attr "op_type" "RXE")
2925 (set_attr "type" "fsimp<mode>")])
2930 ; setmemM instruction pattern(s).
2933 (define_expand "setmem<mode>"
2934 [(set (match_operand:BLK 0 "memory_operand" "")
2935 (match_operand:QI 2 "general_operand" ""))
2936 (use (match_operand:GPR 1 "general_operand" ""))
2937 (match_operand 3 "" "")]
2939 "s390_expand_setmem (operands[0], operands[1], operands[2]); DONE;")
2941 ; Clear a block that is up to 256 bytes in length.
2942 ; The block length is taken as (operands[1] % 256) + 1.
2944 (define_expand "clrmem_short"
2946 [(set (match_operand:BLK 0 "memory_operand" "")
2948 (use (match_operand 1 "nonmemory_operand" ""))
2949 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2950 (clobber (match_dup 2))
2951 (clobber (reg:CC CC_REGNUM))])]
2953 "operands[2] = gen_rtx_SCRATCH (Pmode);")
2955 (define_insn "*clrmem_short"
2956 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q")
2958 (use (match_operand 1 "nonmemory_operand" "n,a,a,a"))
2959 (use (match_operand 2 "immediate_operand" "X,R,X,X"))
2960 (clobber (match_scratch:P 3 "=X,X,X,&a"))
2961 (clobber (reg:CC CC_REGNUM))]
2962 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)"
2964 [(set_attr "type" "cs")
2965 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
2968 [(set (match_operand:BLK 0 "memory_operand" "")
2970 (use (match_operand 1 "const_int_operand" ""))
2971 (use (match_operand 2 "immediate_operand" ""))
2973 (clobber (reg:CC CC_REGNUM))]
2976 [(set (match_dup 0) (const_int 0))
2978 (clobber (reg:CC CC_REGNUM))])]
2979 "operands[1] = GEN_INT ((INTVAL (operands[1]) & 0xff) + 1);")
2982 [(set (match_operand:BLK 0 "memory_operand" "")
2984 (use (match_operand 1 "register_operand" ""))
2985 (use (match_operand 2 "memory_operand" ""))
2987 (clobber (reg:CC CC_REGNUM))]
2990 [(unspec [(match_dup 1) (match_dup 2)
2991 (const_int 0)] UNSPEC_EXECUTE)
2992 (set (match_dup 0) (const_int 0))
2994 (clobber (reg:CC CC_REGNUM))])]
2998 [(set (match_operand:BLK 0 "memory_operand" "")
3000 (use (match_operand 1 "register_operand" ""))
3001 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3003 (clobber (reg:CC CC_REGNUM))]
3004 "TARGET_Z10 && reload_completed"
3006 [(unspec [(match_dup 1) (const_int 0)
3007 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3008 (set (match_dup 0) (const_int 0))
3010 (clobber (reg:CC CC_REGNUM))])]
3011 "operands[3] = gen_label_rtx ();")
3014 [(set (match_operand:BLK 0 "memory_operand" "")
3016 (use (match_operand 1 "register_operand" ""))
3017 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3018 (clobber (match_operand 2 "register_operand" ""))
3019 (clobber (reg:CC CC_REGNUM))]
3020 "reload_completed && TARGET_CPU_ZARCH"
3021 [(set (match_dup 2) (label_ref (match_dup 3)))
3023 [(unspec [(match_dup 1) (mem:BLK (match_dup 2))
3024 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3025 (set (match_dup 0) (const_int 0))
3027 (clobber (reg:CC CC_REGNUM))])]
3028 "operands[3] = gen_label_rtx ();")
3030 ; Initialize a block of arbitrary length with (operands[2] % 256).
3032 (define_expand "setmem_long"
3034 [(clobber (match_dup 1))
3035 (set (match_operand:BLK 0 "memory_operand" "")
3036 (match_operand 2 "shift_count_or_setmem_operand" ""))
3037 (use (match_operand 1 "general_operand" ""))
3039 (clobber (reg:CC CC_REGNUM))])]
3042 enum machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3043 enum machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3044 rtx reg0 = gen_reg_rtx (dreg_mode);
3045 rtx reg1 = gen_reg_rtx (dreg_mode);
3046 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3047 rtx len0 = gen_lowpart (Pmode, reg0);
3049 emit_clobber (reg0);
3050 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3051 emit_move_insn (len0, operands[1]);
3053 emit_move_insn (reg1, const0_rtx);
3055 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3060 (define_insn "*setmem_long"
3061 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3062 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
3063 (match_operand 2 "shift_count_or_setmem_operand" "Y"))
3065 (use (match_operand:<DBL> 1 "register_operand" "d"))
3066 (clobber (reg:CC CC_REGNUM))]
3067 "TARGET_64BIT || !TARGET_ZARCH"
3068 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3069 [(set_attr "length" "8")
3070 (set_attr "type" "vs")])
3072 (define_insn "*setmem_long_and"
3073 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3074 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
3075 (and (match_operand 2 "shift_count_or_setmem_operand" "Y")
3076 (match_operand 4 "const_int_operand" "n")))
3078 (use (match_operand:<DBL> 1 "register_operand" "d"))
3079 (clobber (reg:CC CC_REGNUM))]
3080 "(TARGET_64BIT || !TARGET_ZARCH) &&
3081 (INTVAL (operands[4]) & 255) == 255"
3082 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3083 [(set_attr "length" "8")
3084 (set_attr "type" "vs")])
3086 (define_insn "*setmem_long_31z"
3087 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3088 (set (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "0") 4))
3089 (match_operand 2 "shift_count_or_setmem_operand" "Y"))
3091 (use (match_operand:TI 1 "register_operand" "d"))
3092 (clobber (reg:CC CC_REGNUM))]
3093 "!TARGET_64BIT && TARGET_ZARCH"
3094 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3095 [(set_attr "length" "8")
3096 (set_attr "type" "vs")])
3099 ; cmpmemM instruction pattern(s).
3102 (define_expand "cmpmemsi"
3103 [(set (match_operand:SI 0 "register_operand" "")
3104 (compare:SI (match_operand:BLK 1 "memory_operand" "")
3105 (match_operand:BLK 2 "memory_operand" "") ) )
3106 (use (match_operand:SI 3 "general_operand" ""))
3107 (use (match_operand:SI 4 "" ""))]
3110 if (s390_expand_cmpmem (operands[0], operands[1],
3111 operands[2], operands[3]))
3117 ; Compare a block that is up to 256 bytes in length.
3118 ; The block length is taken as (operands[2] % 256) + 1.
3120 (define_expand "cmpmem_short"
3122 [(set (reg:CCU CC_REGNUM)
3123 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3124 (match_operand:BLK 1 "memory_operand" "")))
3125 (use (match_operand 2 "nonmemory_operand" ""))
3126 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3127 (clobber (match_dup 3))])]
3129 "operands[3] = gen_rtx_SCRATCH (Pmode);")
3131 (define_insn "*cmpmem_short"
3132 [(set (reg:CCU CC_REGNUM)
3133 (compare:CCU (match_operand:BLK 0 "memory_operand" "Q,Q,Q,Q")
3134 (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q")))
3135 (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
3136 (use (match_operand 3 "immediate_operand" "X,R,X,X"))
3137 (clobber (match_scratch:P 4 "=X,X,X,&a"))]
3138 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
3140 [(set_attr "type" "cs")
3141 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3144 [(set (reg:CCU CC_REGNUM)
3145 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3146 (match_operand:BLK 1 "memory_operand" "")))
3147 (use (match_operand 2 "const_int_operand" ""))
3148 (use (match_operand 3 "immediate_operand" ""))
3149 (clobber (scratch))]
3152 [(set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3153 (use (match_dup 2))])]
3154 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
3157 [(set (reg:CCU CC_REGNUM)
3158 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3159 (match_operand:BLK 1 "memory_operand" "")))
3160 (use (match_operand 2 "register_operand" ""))
3161 (use (match_operand 3 "memory_operand" ""))
3162 (clobber (scratch))]
3165 [(unspec [(match_dup 2) (match_dup 3)
3166 (const_int 0)] UNSPEC_EXECUTE)
3167 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3168 (use (const_int 1))])]
3172 [(set (reg:CCU CC_REGNUM)
3173 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3174 (match_operand:BLK 1 "memory_operand" "")))
3175 (use (match_operand 2 "register_operand" ""))
3176 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3177 (clobber (scratch))]
3178 "TARGET_Z10 && reload_completed"
3180 [(unspec [(match_dup 2) (const_int 0)
3181 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3182 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3183 (use (const_int 1))])]
3184 "operands[4] = gen_label_rtx ();")
3187 [(set (reg:CCU CC_REGNUM)
3188 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3189 (match_operand:BLK 1 "memory_operand" "")))
3190 (use (match_operand 2 "register_operand" ""))
3191 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3192 (clobber (match_operand 3 "register_operand" ""))]
3193 "reload_completed && TARGET_CPU_ZARCH"
3194 [(set (match_dup 3) (label_ref (match_dup 4)))
3196 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
3197 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3198 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3199 (use (const_int 1))])]
3200 "operands[4] = gen_label_rtx ();")
3202 ; Compare a block of arbitrary length.
3204 (define_expand "cmpmem_long"
3206 [(clobber (match_dup 2))
3207 (clobber (match_dup 3))
3208 (set (reg:CCU CC_REGNUM)
3209 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3210 (match_operand:BLK 1 "memory_operand" "")))
3211 (use (match_operand 2 "general_operand" ""))
3212 (use (match_dup 3))])]
3215 enum machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3216 enum machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3217 rtx reg0 = gen_reg_rtx (dreg_mode);
3218 rtx reg1 = gen_reg_rtx (dreg_mode);
3219 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3220 rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1));
3221 rtx len0 = gen_lowpart (Pmode, reg0);
3222 rtx len1 = gen_lowpart (Pmode, reg1);
3224 emit_clobber (reg0);
3225 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3226 emit_move_insn (len0, operands[2]);
3228 emit_clobber (reg1);
3229 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
3230 emit_move_insn (len1, operands[2]);
3232 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3233 operands[1] = replace_equiv_address_nv (operands[1], addr1);
3238 (define_insn "*cmpmem_long"
3239 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3240 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
3241 (set (reg:CCU CC_REGNUM)
3242 (compare:CCU (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
3243 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0))))
3245 (use (match_dup 3))]
3246 "TARGET_64BIT || !TARGET_ZARCH"
3247 "clcle\t%0,%1,0\;jo\t.-4"
3248 [(set_attr "length" "8")
3249 (set_attr "type" "vs")])
3251 (define_insn "*cmpmem_long_31z"
3252 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3253 (clobber (match_operand:TI 1 "register_operand" "=d"))
3254 (set (reg:CCU CC_REGNUM)
3255 (compare:CCU (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4))
3256 (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4))))
3258 (use (match_dup 3))]
3259 "!TARGET_64BIT && TARGET_ZARCH"
3260 "clcle\t%0,%1,0\;jo\t.-4"
3261 [(set_attr "op_type" "NN")
3262 (set_attr "type" "vs")
3263 (set_attr "length" "8")])
3265 ; Convert CCUmode condition code to integer.
3266 ; Result is zero if EQ, positive if LTU, negative if GTU.
3268 (define_insn_and_split "cmpint"
3269 [(set (match_operand:SI 0 "register_operand" "=d")
3270 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3271 UNSPEC_STRCMPCC_TO_INT))
3272 (clobber (reg:CC CC_REGNUM))]
3276 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
3278 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))
3279 (clobber (reg:CC CC_REGNUM))])])
3281 (define_insn_and_split "*cmpint_cc"
3282 [(set (reg CC_REGNUM)
3283 (compare (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3284 UNSPEC_STRCMPCC_TO_INT)
3286 (set (match_operand:SI 0 "register_operand" "=d")
3287 (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT))]
3288 "s390_match_ccmode (insn, CCSmode)"
3290 "&& reload_completed"
3291 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
3293 [(set (match_dup 2) (match_dup 3))
3294 (set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))])]
3296 rtx result = gen_rtx_ASHIFTRT (SImode, operands[0], GEN_INT (30));
3297 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
3298 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
3301 (define_insn_and_split "*cmpint_sign"
3302 [(set (match_operand:DI 0 "register_operand" "=d")
3303 (sign_extend:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3304 UNSPEC_STRCMPCC_TO_INT)))
3305 (clobber (reg:CC CC_REGNUM))]
3308 "&& reload_completed"
3309 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
3311 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))
3312 (clobber (reg:CC CC_REGNUM))])])
3314 (define_insn_and_split "*cmpint_sign_cc"
3315 [(set (reg CC_REGNUM)
3316 (compare (ashiftrt:DI (ashift:DI (subreg:DI
3317 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3318 UNSPEC_STRCMPCC_TO_INT) 0)
3319 (const_int 32)) (const_int 32))
3321 (set (match_operand:DI 0 "register_operand" "=d")
3322 (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT)))]
3323 "s390_match_ccmode (insn, CCSmode) && TARGET_ZARCH"
3325 "&& reload_completed"
3326 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
3328 [(set (match_dup 2) (match_dup 3))
3329 (set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))])]
3331 rtx result = gen_rtx_ASHIFTRT (DImode, operands[0], GEN_INT (62));
3332 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
3333 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
3338 ;;- Conversion instructions.
3341 (define_insn "*sethighpartsi"
3342 [(set (match_operand:SI 0 "register_operand" "=d,d")
3343 (unspec:SI [(match_operand:BLK 1 "s_operand" "Q,S")
3344 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
3345 (clobber (reg:CC CC_REGNUM))]
3350 [(set_attr "op_type" "RS,RSY")
3351 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3353 (define_insn "*sethighpartdi_64"
3354 [(set (match_operand:DI 0 "register_operand" "=d")
3355 (unspec:DI [(match_operand:BLK 1 "s_operand" "QS")
3356 (match_operand 2 "const_int_operand" "n")] UNSPEC_ICM))
3357 (clobber (reg:CC CC_REGNUM))]
3360 [(set_attr "op_type" "RSY")
3361 (set_attr "z10prop" "z10_super")])
3363 (define_insn "*sethighpartdi_31"
3364 [(set (match_operand:DI 0 "register_operand" "=d,d")
3365 (unspec:DI [(match_operand:BLK 1 "s_operand" "Q,S")
3366 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
3367 (clobber (reg:CC CC_REGNUM))]
3372 [(set_attr "op_type" "RS,RSY")
3373 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3376 ; extv instruction patterns
3379 ; FIXME: This expander needs to be converted from DI to GPR as well
3380 ; after resolving some issues with it.
3382 (define_expand "extzv"
3384 [(set (match_operand:DI 0 "register_operand" "=d")
3386 (match_operand:DI 1 "register_operand" "d")
3387 (match_operand 2 "const_int_operand" "") ; size
3388 (match_operand 3 "const_int_operand" ""))) ; start
3389 (clobber (reg:CC CC_REGNUM))])]
3392 /* Starting with zEC12 there is risbgn not clobbering CC. */
3395 emit_move_insn (operands[0],
3396 gen_rtx_ZERO_EXTRACT (DImode,
3404 (define_insn "*extzv<mode>_zEC12"
3405 [(set (match_operand:GPR 0 "register_operand" "=d")
3407 (match_operand:GPR 1 "register_operand" "d")
3408 (match_operand 2 "const_int_operand" "") ; size
3409 (match_operand 3 "const_int_operand" "")))] ; start]
3411 "risbgn\t%0,%1,64-%2,128+63,<bitsize>+%3+%2" ; dst, src, start, end, shift
3412 [(set_attr "op_type" "RIE")])
3414 (define_insn "*extzv<mode>_z10"
3415 [(set (match_operand:GPR 0 "register_operand" "=d")
3417 (match_operand:GPR 1 "register_operand" "d")
3418 (match_operand 2 "const_int_operand" "") ; size
3419 (match_operand 3 "const_int_operand" ""))) ; start
3420 (clobber (reg:CC CC_REGNUM))]
3422 "risbg\t%0,%1,64-%2,128+63,<bitsize>+%3+%2" ; dst, src, start, end, shift
3423 [(set_attr "op_type" "RIE")
3424 (set_attr "z10prop" "z10_super_E1")])
3426 (define_insn_and_split "*pre_z10_extzv<mode>"
3427 [(set (match_operand:GPR 0 "register_operand" "=d")
3428 (zero_extract:GPR (match_operand:QI 1 "s_operand" "QS")
3429 (match_operand 2 "nonzero_shift_count_operand" "")
3431 (clobber (reg:CC CC_REGNUM))]
3434 "&& reload_completed"
3436 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
3437 (clobber (reg:CC CC_REGNUM))])
3438 (set (match_dup 0) (lshiftrt:GPR (match_dup 0) (match_dup 2)))]
3440 int bitsize = INTVAL (operands[2]);
3441 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
3442 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
3444 operands[1] = adjust_address (operands[1], BLKmode, 0);
3445 set_mem_size (operands[1], size);
3446 operands[2] = GEN_INT (<GPR:bitsize> - bitsize);
3447 operands[3] = GEN_INT (mask);
3450 (define_insn_and_split "*pre_z10_extv<mode>"
3451 [(set (match_operand:GPR 0 "register_operand" "=d")
3452 (sign_extract:GPR (match_operand:QI 1 "s_operand" "QS")
3453 (match_operand 2 "nonzero_shift_count_operand" "")
3455 (clobber (reg:CC CC_REGNUM))]
3458 "&& reload_completed"
3460 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
3461 (clobber (reg:CC CC_REGNUM))])
3463 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
3464 (clobber (reg:CC CC_REGNUM))])]
3466 int bitsize = INTVAL (operands[2]);
3467 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
3468 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
3470 operands[1] = adjust_address (operands[1], BLKmode, 0);
3471 set_mem_size (operands[1], size);
3472 operands[2] = GEN_INT (<GPR:bitsize> - bitsize);
3473 operands[3] = GEN_INT (mask);
3477 ; insv instruction patterns
3480 (define_expand "insv"
3481 [(set (zero_extract (match_operand 0 "nonimmediate_operand" "")
3482 (match_operand 1 "const_int_operand" "")
3483 (match_operand 2 "const_int_operand" ""))
3484 (match_operand 3 "general_operand" ""))]
3487 if (s390_expand_insv (operands[0], operands[1], operands[2], operands[3]))
3493 ; The normal RTL expansion will never generate a zero_extract where
3494 ; the location operand isn't word mode. However, we do this in the
3495 ; back-end when generating atomic operations. See s390_two_part_insv.
3496 (define_insn "*insv<mode>_zEC12"
3497 [(set (zero_extract:GPR (match_operand:GPR 0 "nonimmediate_operand" "+d")
3498 (match_operand 1 "const_int_operand" "I") ; size
3499 (match_operand 2 "const_int_operand" "I")) ; pos
3500 (match_operand:GPR 3 "nonimmediate_operand" "d"))]
3502 && (INTVAL (operands[1]) + INTVAL (operands[2])) <= <bitsize>"
3503 "risbgn\t%0,%3,64-<bitsize>+%2,64-<bitsize>+%2+%1-1,<bitsize>-%2-%1"
3504 [(set_attr "op_type" "RIE")])
3506 (define_insn "*insv<mode>_z10"
3507 [(set (zero_extract:GPR (match_operand:GPR 0 "nonimmediate_operand" "+d")
3508 (match_operand 1 "const_int_operand" "I") ; size
3509 (match_operand 2 "const_int_operand" "I")) ; pos
3510 (match_operand:GPR 3 "nonimmediate_operand" "d"))
3511 (clobber (reg:CC CC_REGNUM))]
3513 && (INTVAL (operands[1]) + INTVAL (operands[2])) <= <bitsize>"
3514 "risbg\t%0,%3,64-<bitsize>+%2,64-<bitsize>+%2+%1-1,<bitsize>-%2-%1"
3515 [(set_attr "op_type" "RIE")
3516 (set_attr "z10prop" "z10_super_E1")])
3518 ; and op1 with a mask being 1 for the selected bits and 0 for the rest
3519 ; and op3=op0 with a mask being 0 for the selected bits and 1 for the rest
3520 (define_insn "*insv<mode>_zEC12_noshift"
3521 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3522 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3523 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3524 (and:GPR (match_operand:GPR 3 "nonimmediate_operand" "0")
3525 (match_operand:GPR 4 "const_int_operand" ""))))]
3526 "TARGET_ZEC12 && INTVAL (operands[2]) == ~INTVAL (operands[4])"
3527 "risbgn\t%0,%1,%<bfstart>2,%<bfend>2,0"
3528 [(set_attr "op_type" "RIE")])
3530 (define_insn "*insv<mode>_z10_noshift"
3531 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3532 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3533 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3534 (and:GPR (match_operand:GPR 3 "nonimmediate_operand" "0")
3535 (match_operand:GPR 4 "const_int_operand" ""))))
3536 (clobber (reg:CC CC_REGNUM))]
3537 "TARGET_Z10 && INTVAL (operands[2]) == ~INTVAL (operands[4])"
3538 "risbg\t%0,%1,%<bfstart>2,%<bfend>2,0"
3539 [(set_attr "op_type" "RIE")
3540 (set_attr "z10prop" "z10_super_E1")])
3542 (define_insn "*r<noxa>sbg_<mode>_noshift"
3543 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3545 (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3546 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3547 (match_operand:GPR 3 "nonimmediate_operand" "0")))
3548 (clobber (reg:CC CC_REGNUM))]
3550 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,0"
3551 [(set_attr "op_type" "RIE")])
3553 (define_insn "*r<noxa>sbg_di_rotl"
3554 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
3558 (match_operand:DI 1 "nonimmediate_operand" "d")
3559 (match_operand:DI 3 "const_int_operand" ""))
3560 (match_operand:DI 2 "contiguous_bitmask_operand" ""))
3561 (match_operand:DI 4 "nonimmediate_operand" "0")))
3562 (clobber (reg:CC CC_REGNUM))]
3564 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%b3"
3565 [(set_attr "op_type" "RIE")])
3567 (define_insn "*r<noxa>sbg_<mode>_srl"
3568 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3572 (match_operand:GPR 1 "nonimmediate_operand" "d")
3573 (match_operand:GPR 3 "nonzero_shift_count_operand" ""))
3574 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3575 (match_operand:GPR 4 "nonimmediate_operand" "0")))
3576 (clobber (reg:CC CC_REGNUM))]
3578 && s390_extzv_shift_ok (<bitsize>, 64 - INTVAL (operands[3]),
3579 INTVAL (operands[2]))"
3580 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,64-%3"
3581 [(set_attr "op_type" "RIE")])
3583 (define_insn "*r<noxa>sbg_<mode>_sll"
3584 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3588 (match_operand:GPR 1 "nonimmediate_operand" "d")
3589 (match_operand:GPR 3 "nonzero_shift_count_operand" ""))
3590 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3591 (match_operand:GPR 4 "nonimmediate_operand" "0")))
3592 (clobber (reg:CC CC_REGNUM))]
3594 && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[3]),
3595 INTVAL (operands[2]))"
3596 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%3"
3597 [(set_attr "op_type" "RIE")])
3599 ;; These two are generated by combine for s.bf &= val.
3600 ;; ??? For bitfields smaller than 32-bits, we wind up with SImode
3601 ;; shifts and ands, which results in some truly awful patterns
3602 ;; including subregs of operations. Rather unnecessisarily, IMO.
3605 ;; (set (zero_extract:DI (reg/v:DI 50 [ s ])
3606 ;; (const_int 24 [0x18])
3607 ;; (const_int 0 [0]))
3608 ;; (subreg:DI (and:SI (subreg:SI (lshiftrt:DI (reg/v:DI 50 [ s ])
3609 ;; (const_int 40 [0x28])) 4)
3610 ;; (reg:SI 4 %r4 [ y+4 ])) 0))
3612 ;; we should instead generate
3614 ;; (set (zero_extract:DI (reg/v:DI 50 [ s ])
3615 ;; (const_int 24 [0x18])
3616 ;; (const_int 0 [0]))
3617 ;; (and:DI (lshiftrt:DI (reg/v:DI 50 [ s ])
3618 ;; (const_int 40 [0x28]))
3619 ;; (subreg:DI (reg:SI 4 %r4 [ y+4 ]) 0)))
3621 ;; by noticing that we can push down the outer paradoxical subreg
3622 ;; into the operation.
3624 (define_insn "*insv_rnsbg_noshift"
3625 [(set (zero_extract:DI
3626 (match_operand:DI 0 "nonimmediate_operand" "+d")
3627 (match_operand 1 "const_int_operand" "")
3628 (match_operand 2 "const_int_operand" ""))
3631 (match_operand:DI 3 "nonimmediate_operand" "d")))
3632 (clobber (reg:CC CC_REGNUM))]
3634 && INTVAL (operands[1]) + INTVAL (operands[2]) == 64"
3635 "rnsbg\t%0,%3,%2,63,0"
3636 [(set_attr "op_type" "RIE")])
3638 (define_insn "*insv_rnsbg_srl"
3639 [(set (zero_extract:DI
3640 (match_operand:DI 0 "nonimmediate_operand" "+d")
3641 (match_operand 1 "const_int_operand" "")
3642 (match_operand 2 "const_int_operand" ""))
3646 (match_operand 3 "const_int_operand" ""))
3647 (match_operand:DI 4 "nonimmediate_operand" "d")))
3648 (clobber (reg:CC CC_REGNUM))]
3650 && INTVAL (operands[3]) == 64 - INTVAL (operands[1]) - INTVAL (operands[2])"
3651 "rnsbg\t%0,%4,%2,%2+%1-1,%3"
3652 [(set_attr "op_type" "RIE")])
3654 (define_insn "*insv<mode>_mem_reg"
3655 [(set (zero_extract:W (match_operand:QI 0 "memory_operand" "+Q,S")
3656 (match_operand 1 "const_int_operand" "n,n")
3658 (match_operand:W 2 "register_operand" "d,d"))]
3659 "INTVAL (operands[1]) > 0
3660 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
3661 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
3663 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
3665 operands[1] = GEN_INT ((1ul << size) - 1);
3666 return (which_alternative == 0) ? "stcm\t%2,%1,%S0"
3667 : "stcmy\t%2,%1,%S0";
3669 [(set_attr "op_type" "RS,RSY")
3670 (set_attr "z10prop" "z10_super,z10_super")])
3672 (define_insn "*insvdi_mem_reghigh"
3673 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "+QS")
3674 (match_operand 1 "const_int_operand" "n")
3676 (lshiftrt:DI (match_operand:DI 2 "register_operand" "d")
3679 && INTVAL (operands[1]) > 0
3680 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
3681 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
3683 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
3685 operands[1] = GEN_INT ((1ul << size) - 1);
3686 return "stcmh\t%2,%1,%S0";
3688 [(set_attr "op_type" "RSY")
3689 (set_attr "z10prop" "z10_super")])
3691 (define_insn "*insvdi_reg_imm"
3692 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
3694 (match_operand 1 "const_int_operand" "n"))
3695 (match_operand:DI 2 "const_int_operand" "n"))]
3697 && INTVAL (operands[1]) >= 0
3698 && INTVAL (operands[1]) < BITS_PER_WORD
3699 && INTVAL (operands[1]) % 16 == 0"
3701 switch (BITS_PER_WORD - INTVAL (operands[1]))
3703 case 64: return "iihh\t%0,%x2"; break;
3704 case 48: return "iihl\t%0,%x2"; break;
3705 case 32: return "iilh\t%0,%x2"; break;
3706 case 16: return "iill\t%0,%x2"; break;
3707 default: gcc_unreachable();
3710 [(set_attr "op_type" "RI")
3711 (set_attr "z10prop" "z10_super_E1")])
3713 ; Update the left-most 32 bit of a DI.
3714 (define_insn "*insv_h_di_reg_extimm"
3715 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
3718 (match_operand:DI 1 "const_int_operand" "n"))]
3721 [(set_attr "op_type" "RIL")
3722 (set_attr "z10prop" "z10_fwd_E1")])
3724 ; Update the right-most 32 bit of a DI.
3725 (define_insn "*insv_l_di_reg_extimm"
3726 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
3729 (match_operand:DI 1 "const_int_operand" "n"))]
3732 [(set_attr "op_type" "RIL")
3733 (set_attr "z10prop" "z10_fwd_A1")])
3736 ; extendsidi2 instruction pattern(s).
3739 (define_expand "extendsidi2"
3740 [(set (match_operand:DI 0 "register_operand" "")
3741 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
3746 emit_clobber (operands[0]);
3747 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
3748 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
3749 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
3754 (define_insn "*extendsidi2"
3755 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3756 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,RT,b")))]
3762 [(set_attr "op_type" "RRE,RXY,RIL")
3763 (set_attr "type" "*,*,larl")
3764 (set_attr "cpu_facility" "*,*,z10")
3765 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
3768 ; extend(hi|qi)(si|di)2 instruction pattern(s).
3771 (define_expand "extend<HQI:mode><DSI:mode>2"
3772 [(set (match_operand:DSI 0 "register_operand" "")
3773 (sign_extend:DSI (match_operand:HQI 1 "nonimmediate_operand" "")))]
3776 if (<DSI:MODE>mode == DImode && !TARGET_ZARCH)
3778 rtx tmp = gen_reg_rtx (SImode);
3779 emit_insn (gen_extend<HQI:mode>si2 (tmp, operands[1]));
3780 emit_insn (gen_extendsidi2 (operands[0], tmp));
3783 else if (!TARGET_EXTIMM)
3785 rtx bitcount = GEN_INT (<DSI:bitsize> - <HQI:bitsize>);
3787 operands[1] = gen_lowpart (<DSI:MODE>mode, operands[1]);
3788 emit_insn (gen_ashl<DSI:mode>3 (operands[0], operands[1], bitcount));
3789 emit_insn (gen_ashr<DSI:mode>3 (operands[0], operands[0], bitcount));
3795 ; extendhidi2 instruction pattern(s).
3798 (define_insn "*extendhidi2_extimm"
3799 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3800 (sign_extend:DI (match_operand:HI 1 "general_operand" "d,RT,b")))]
3801 "TARGET_ZARCH && TARGET_EXTIMM"
3806 [(set_attr "op_type" "RRE,RXY,RIL")
3807 (set_attr "type" "*,*,larl")
3808 (set_attr "cpu_facility" "extimm,extimm,z10")
3809 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
3811 (define_insn "*extendhidi2"
3812 [(set (match_operand:DI 0 "register_operand" "=d")
3813 (sign_extend:DI (match_operand:HI 1 "memory_operand" "RT")))]
3816 [(set_attr "op_type" "RXY")
3817 (set_attr "z10prop" "z10_super_E1")])
3820 ; extendhisi2 instruction pattern(s).
3823 (define_insn "*extendhisi2_extimm"
3824 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3825 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" " d,R,T,b")))]
3832 [(set_attr "op_type" "RRE,RX,RXY,RIL")
3833 (set_attr "type" "*,*,*,larl")
3834 (set_attr "cpu_facility" "extimm,extimm,extimm,z10")
3835 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
3837 (define_insn "*extendhisi2"
3838 [(set (match_operand:SI 0 "register_operand" "=d,d")
3839 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
3844 [(set_attr "op_type" "RX,RXY")
3845 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3848 ; extendqi(si|di)2 instruction pattern(s).
3851 ; lbr, lgbr, lb, lgb
3852 (define_insn "*extendqi<mode>2_extimm"
3853 [(set (match_operand:GPR 0 "register_operand" "=d,d")
3854 (sign_extend:GPR (match_operand:QI 1 "nonimmediate_operand" "d,RT")))]
3859 [(set_attr "op_type" "RRE,RXY")
3860 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3863 (define_insn "*extendqi<mode>2"
3864 [(set (match_operand:GPR 0 "register_operand" "=d")
3865 (sign_extend:GPR (match_operand:QI 1 "memory_operand" "RT")))]
3866 "!TARGET_EXTIMM && TARGET_LONG_DISPLACEMENT"
3868 [(set_attr "op_type" "RXY")
3869 (set_attr "z10prop" "z10_super_E1")])
3871 (define_insn_and_split "*extendqi<mode>2_short_displ"
3872 [(set (match_operand:GPR 0 "register_operand" "=d")
3873 (sign_extend:GPR (match_operand:QI 1 "s_operand" "Q")))
3874 (clobber (reg:CC CC_REGNUM))]
3875 "!TARGET_EXTIMM && !TARGET_LONG_DISPLACEMENT"
3877 "&& reload_completed"
3879 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (const_int 8)] UNSPEC_ICM))
3880 (clobber (reg:CC CC_REGNUM))])
3882 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
3883 (clobber (reg:CC CC_REGNUM))])]
3885 operands[1] = adjust_address (operands[1], BLKmode, 0);
3886 set_mem_size (operands[1], GET_MODE_SIZE (QImode));
3887 operands[2] = GEN_INT (<GPR:bitsize> - BITS_PER_UNIT);
3891 ; zero_extendsidi2 instruction pattern(s).
3894 (define_expand "zero_extendsidi2"
3895 [(set (match_operand:DI 0 "register_operand" "")
3896 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
3901 emit_clobber (operands[0]);
3902 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
3903 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
3908 (define_insn "*zero_extendsidi2"
3909 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3910 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,RT,b")))]
3916 [(set_attr "op_type" "RRE,RXY,RIL")
3917 (set_attr "type" "*,*,larl")
3918 (set_attr "cpu_facility" "*,*,z10")
3919 (set_attr "z10prop" "z10_fwd_E1,z10_fwd_A3,z10_fwd_A3")])
3922 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
3925 (define_insn "*llgt_sidi"
3926 [(set (match_operand:DI 0 "register_operand" "=d")
3927 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "RT") 0)
3928 (const_int 2147483647)))]
3931 [(set_attr "op_type" "RXE")
3932 (set_attr "z10prop" "z10_super_E1")])
3934 (define_insn_and_split "*llgt_sidi_split"
3935 [(set (match_operand:DI 0 "register_operand" "=d")
3936 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "RT") 0)
3937 (const_int 2147483647)))
3938 (clobber (reg:CC CC_REGNUM))]
3941 "&& reload_completed"
3943 (and:DI (subreg:DI (match_dup 1) 0)
3944 (const_int 2147483647)))]
3947 (define_insn "*llgt_sisi"
3948 [(set (match_operand:SI 0 "register_operand" "=d,d")
3949 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,RT")
3950 (const_int 2147483647)))]
3955 [(set_attr "op_type" "RRE,RXE")
3956 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3958 (define_insn "*llgt_didi"
3959 [(set (match_operand:DI 0 "register_operand" "=d,d")
3960 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
3961 (const_int 2147483647)))]
3966 [(set_attr "op_type" "RRE,RXE")
3967 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3970 [(set (match_operand:DSI 0 "register_operand" "")
3971 (and:DSI (match_operand:DSI 1 "nonimmediate_operand" "")
3972 (const_int 2147483647)))
3973 (clobber (reg:CC CC_REGNUM))]
3974 "TARGET_ZARCH && reload_completed"
3976 (and:DSI (match_dup 1)
3977 (const_int 2147483647)))]
3981 ; zero_extend(hi|qi)(si|di)2 instruction pattern(s).
3984 (define_expand "zero_extend<mode>di2"
3985 [(set (match_operand:DI 0 "register_operand" "")
3986 (zero_extend:DI (match_operand:HQI 1 "nonimmediate_operand" "")))]
3991 rtx tmp = gen_reg_rtx (SImode);
3992 emit_insn (gen_zero_extend<mode>si2 (tmp, operands[1]));
3993 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
3996 else if (!TARGET_EXTIMM)
3998 rtx bitcount = GEN_INT (64 - <HQI:bitsize>);
3999 operands[1] = gen_lowpart (DImode, operands[1]);
4000 emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount));
4001 emit_insn (gen_lshrdi3 (operands[0], operands[0], bitcount));
4006 (define_expand "zero_extend<mode>si2"
4007 [(set (match_operand:SI 0 "register_operand" "")
4008 (zero_extend:SI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4013 operands[1] = gen_lowpart (SImode, operands[1]);
4014 emit_insn (gen_andsi3 (operands[0], operands[1],
4015 GEN_INT ((1 << <HQI:bitsize>) - 1)));
4021 (define_insn "*zero_extendhi<mode>2_z10"
4022 [(set (match_operand:GPR 0 "register_operand" "=d,d,d")
4023 (zero_extend:GPR (match_operand:HI 1 "nonimmediate_operand" "d,RT,b")))]
4029 [(set_attr "op_type" "RXY,RRE,RIL")
4030 (set_attr "type" "*,*,larl")
4031 (set_attr "cpu_facility" "*,*,z10")
4032 (set_attr "z10prop" "z10_super_E1,z10_fwd_A3,z10_fwd_A3")])
4034 ; llhr, llcr, llghr, llgcr, llh, llc, llgh, llgc
4035 (define_insn "*zero_extend<HQI:mode><GPR:mode>2_extimm"
4036 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4037 (zero_extend:GPR (match_operand:HQI 1 "nonimmediate_operand" "d,RT")))]
4042 [(set_attr "op_type" "RRE,RXY")
4043 (set_attr "z10prop" "z10_super_E1,z10_fwd_A3")])
4046 (define_insn "*zero_extend<HQI:mode><GPR:mode>2"
4047 [(set (match_operand:GPR 0 "register_operand" "=d")
4048 (zero_extend:GPR (match_operand:HQI 1 "memory_operand" "RT")))]
4049 "TARGET_ZARCH && !TARGET_EXTIMM"
4051 [(set_attr "op_type" "RXY")
4052 (set_attr "z10prop" "z10_fwd_A3")])
4054 (define_insn_and_split "*zero_extendhisi2_31"
4055 [(set (match_operand:SI 0 "register_operand" "=&d")
4056 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
4057 (clobber (reg:CC CC_REGNUM))]
4060 "&& reload_completed"
4061 [(set (match_dup 0) (const_int 0))
4063 [(set (strict_low_part (match_dup 2)) (match_dup 1))
4064 (clobber (reg:CC CC_REGNUM))])]
4065 "operands[2] = gen_lowpart (HImode, operands[0]);")
4067 (define_insn_and_split "*zero_extendqisi2_31"
4068 [(set (match_operand:SI 0 "register_operand" "=&d")
4069 (zero_extend:SI (match_operand:QI 1 "memory_operand" "RT")))]
4072 "&& reload_completed"
4073 [(set (match_dup 0) (const_int 0))
4074 (set (strict_low_part (match_dup 2)) (match_dup 1))]
4075 "operands[2] = gen_lowpart (QImode, operands[0]);")
4078 ; zero_extendqihi2 instruction pattern(s).
4081 (define_expand "zero_extendqihi2"
4082 [(set (match_operand:HI 0 "register_operand" "")
4083 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
4084 "TARGET_ZARCH && !TARGET_EXTIMM"
4086 operands[1] = gen_lowpart (HImode, operands[1]);
4087 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
4091 (define_insn "*zero_extendqihi2_64"
4092 [(set (match_operand:HI 0 "register_operand" "=d")
4093 (zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))]
4094 "TARGET_ZARCH && !TARGET_EXTIMM"
4096 [(set_attr "op_type" "RXY")
4097 (set_attr "z10prop" "z10_fwd_A3")])
4099 (define_insn_and_split "*zero_extendqihi2_31"
4100 [(set (match_operand:HI 0 "register_operand" "=&d")
4101 (zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))]
4104 "&& reload_completed"
4105 [(set (match_dup 0) (const_int 0))
4106 (set (strict_low_part (match_dup 2)) (match_dup 1))]
4107 "operands[2] = gen_lowpart (QImode, operands[0]);")
4110 ; fixuns_trunc(dd|td)di2 instruction pattern(s).
4113 (define_expand "fixuns_truncdddi2"
4115 [(set (match_operand:DI 0 "register_operand" "")
4116 (unsigned_fix:DI (match_operand:DD 1 "register_operand" "")))
4117 (unspec:DI [(const_int 5)] UNSPEC_ROUND)
4118 (clobber (reg:CC CC_REGNUM))])]
4124 rtx label1 = gen_label_rtx ();
4125 rtx label2 = gen_label_rtx ();
4126 rtx temp = gen_reg_rtx (TDmode);
4127 REAL_VALUE_TYPE cmp, sub;
4129 decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */
4130 decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
4132 /* 2^63 can't be represented as 64bit DFP number with full precision. The
4133 solution is doing the check and the subtraction in TD mode and using a
4134 TD -> DI convert afterwards. */
4135 emit_insn (gen_extendddtd2 (temp, operands[1]));
4136 temp = force_reg (TDmode, temp);
4137 emit_cmp_and_jump_insns (temp,
4138 CONST_DOUBLE_FROM_REAL_VALUE (cmp, TDmode),
4139 LT, NULL_RTX, VOIDmode, 0, label1);
4140 emit_insn (gen_subtd3 (temp, temp,
4141 CONST_DOUBLE_FROM_REAL_VALUE (sub, TDmode)));
4142 emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, GEN_INT (11)));
4145 emit_label (label1);
4146 emit_insn (gen_fix_truncdddi2_dfp (operands[0], operands[1], GEN_INT (9)));
4147 emit_label (label2);
4152 (define_expand "fixuns_trunctddi2"
4154 [(set (match_operand:DI 0 "register_operand" "")
4155 (unsigned_fix:DI (match_operand:TD 1 "register_operand" "")))
4156 (unspec:DI [(const_int 5)] UNSPEC_ROUND)
4157 (clobber (reg:CC CC_REGNUM))])]
4163 rtx label1 = gen_label_rtx ();
4164 rtx label2 = gen_label_rtx ();
4165 rtx temp = gen_reg_rtx (TDmode);
4166 REAL_VALUE_TYPE cmp, sub;
4168 operands[1] = force_reg (TDmode, operands[1]);
4169 decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */
4170 decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
4172 emit_cmp_and_jump_insns (operands[1],
4173 CONST_DOUBLE_FROM_REAL_VALUE (cmp, TDmode),
4174 LT, NULL_RTX, VOIDmode, 0, label1);
4175 emit_insn (gen_subtd3 (temp, operands[1],
4176 CONST_DOUBLE_FROM_REAL_VALUE (sub, TDmode)));
4177 emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, GEN_INT (11)));
4180 emit_label (label1);
4181 emit_insn (gen_fix_trunctddi2_dfp (operands[0], operands[1], GEN_INT (9)));
4182 emit_label (label2);
4188 ; fixuns_trunc(sf|df|tf)(si|di)2 and fix_trunc(sf|df|tf)(si|di)2
4189 ; instruction pattern(s).
4192 (define_expand "fixuns_trunc<BFP:mode><GPR:mode>2"
4194 [(set (match_operand:GPR 0 "register_operand" "")
4195 (unsigned_fix:GPR (match_operand:BFP 1 "register_operand" "")))
4196 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
4197 (clobber (reg:CC CC_REGNUM))])]
4202 rtx label1 = gen_label_rtx ();
4203 rtx label2 = gen_label_rtx ();
4204 rtx temp = gen_reg_rtx (<BFP:MODE>mode);
4205 REAL_VALUE_TYPE cmp, sub;
4207 operands[1] = force_reg (<BFP:MODE>mode, operands[1]);
4208 real_2expN (&cmp, <GPR:bitsize> - 1, <BFP:MODE>mode);
4209 real_2expN (&sub, <GPR:bitsize>, <BFP:MODE>mode);
4211 emit_cmp_and_jump_insns (operands[1],
4212 CONST_DOUBLE_FROM_REAL_VALUE (cmp, <BFP:MODE>mode),
4213 LT, NULL_RTX, VOIDmode, 0, label1);
4214 emit_insn (gen_sub<BFP:mode>3 (temp, operands[1],
4215 CONST_DOUBLE_FROM_REAL_VALUE (sub, <BFP:MODE>mode)));
4216 emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0], temp,
4220 emit_label (label1);
4221 emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0],
4222 operands[1], GEN_INT (5)));
4223 emit_label (label2);
4228 ; fixuns_trunc(td|dd)si2 expander
4229 (define_expand "fixuns_trunc<mode>si2"
4231 [(set (match_operand:SI 0 "register_operand" "")
4232 (unsigned_fix:SI (match_operand:DFP 1 "register_operand" "")))
4233 (unspec:SI [(const_int 5)] UNSPEC_ROUND)
4234 (clobber (reg:CC CC_REGNUM))])]
4235 "TARGET_Z196 && TARGET_HARD_DFP"
4238 ; fixuns_trunc(tf|df|sf|td|dd)(di|si)2 instruction patterns.
4240 ; clfebr, clfdbr, clfxbr, clgebr, clgdbr, clgxbr
4241 ; clfdtr, clfxtr, clgdtr, clgxtr
4242 (define_insn "*fixuns_trunc<FP:mode><GPR:mode>2_z196"
4243 [(set (match_operand:GPR 0 "register_operand" "=r")
4244 (unsigned_fix:GPR (match_operand:FP 1 "register_operand" "f")))
4245 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4246 (clobber (reg:CC CC_REGNUM))]
4248 "cl<GPR:gf><FP:xde><FP:bt>r\t%0,%h2,%1,0"
4249 [(set_attr "op_type" "RRF")
4250 (set_attr "type" "ftoi")])
4252 (define_expand "fix_trunc<DSF:mode><GPR:mode>2"
4253 [(set (match_operand:GPR 0 "register_operand" "")
4254 (fix:GPR (match_operand:DSF 1 "register_operand" "")))]
4257 emit_insn (gen_fix_trunc<DSF:mode><GPR:mode>2_bfp (operands[0], operands[1],
4262 ; cgxbr, cgdbr, cgebr, cfxbr, cfdbr, cfebr
4263 (define_insn "fix_trunc<BFP:mode><GPR:mode>2_bfp"
4264 [(set (match_operand:GPR 0 "register_operand" "=d")
4265 (fix:GPR (match_operand:BFP 1 "register_operand" "f")))
4266 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4267 (clobber (reg:CC CC_REGNUM))]
4269 "c<GPR:gf><BFP:xde>br\t%0,%h2,%1"
4270 [(set_attr "op_type" "RRE")
4271 (set_attr "type" "ftoi")])
4275 ; fix_trunc(td|dd)di2 instruction pattern(s).
4278 (define_expand "fix_trunc<mode>di2"
4279 [(set (match_operand:DI 0 "register_operand" "")
4280 (fix:DI (match_operand:DFP 1 "nonimmediate_operand" "")))]
4281 "TARGET_ZARCH && TARGET_HARD_DFP"
4283 operands[1] = force_reg (<MODE>mode, operands[1]);
4284 emit_insn (gen_fix_trunc<mode>di2_dfp (operands[0], operands[1],
4290 (define_insn "fix_trunc<DFP:mode>di2_dfp"
4291 [(set (match_operand:DI 0 "register_operand" "=d")
4292 (fix:DI (match_operand:DFP 1 "register_operand" "f")))
4293 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
4294 (clobber (reg:CC CC_REGNUM))]
4295 "TARGET_ZARCH && TARGET_HARD_DFP"
4296 "cg<DFP:xde>tr\t%0,%h2,%1"
4297 [(set_attr "op_type" "RRF")
4298 (set_attr "type" "ftoidfp")])
4302 ; fix_trunctf(si|di)2 instruction pattern(s).
4305 (define_expand "fix_trunctf<mode>2"
4306 [(parallel [(set (match_operand:GPR 0 "register_operand" "")
4307 (fix:GPR (match_operand:TF 1 "register_operand" "")))
4308 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
4309 (clobber (reg:CC CC_REGNUM))])]
4315 ; float(si|di)(tf|df|sf|td|dd)2 instruction pattern(s).
4318 ; cxgbr, cdgbr, cegbr, cxgtr, cdgtr
4319 (define_insn "floatdi<mode>2"
4320 [(set (match_operand:FP 0 "register_operand" "=f")
4321 (float:FP (match_operand:DI 1 "register_operand" "d")))]
4322 "TARGET_ZARCH && TARGET_HARD_FLOAT"
4323 "c<xde>g<bt>r\t%0,%1"
4324 [(set_attr "op_type" "RRE")
4325 (set_attr "type" "itof<mode>" )])
4327 ; cxfbr, cdfbr, cefbr
4328 (define_insn "floatsi<mode>2"
4329 [(set (match_operand:BFP 0 "register_operand" "=f")
4330 (float:BFP (match_operand:SI 1 "register_operand" "d")))]
4333 [(set_attr "op_type" "RRE")
4334 (set_attr "type" "itof<mode>" )])
4337 (define_insn "floatsi<mode>2"
4338 [(set (match_operand:DFP 0 "register_operand" "=f")
4339 (float:DFP (match_operand:SI 1 "register_operand" "d")))]
4340 "TARGET_Z196 && TARGET_HARD_FLOAT"
4341 "c<xde>ftr\t%0,0,%1,0"
4342 [(set_attr "op_type" "RRE")
4343 (set_attr "type" "itof<mode>" )])
4346 ; floatuns(si|di)(tf|df|sf|td|dd)2 instruction pattern(s).
4349 ; cxlgbr, cdlgbr, celgbr, cxlgtr, cdlgtr
4350 ; cxlfbr, cdlfbr, celfbr, cxlftr, cdlftr
4351 (define_insn "floatuns<GPR:mode><FP:mode>2"
4352 [(set (match_operand:FP 0 "register_operand" "=f")
4353 (unsigned_float:FP (match_operand:GPR 1 "register_operand" "d")))]
4354 "TARGET_Z196 && TARGET_HARD_FLOAT"
4355 "c<FP:xde>l<GPR:gf><FP:bt>r\t%0,0,%1,0"
4356 [(set_attr "op_type" "RRE")
4357 (set_attr "type" "itof<FP:mode>" )])
4360 ; truncdfsf2 instruction pattern(s).
4363 (define_insn "truncdfsf2"
4364 [(set (match_operand:SF 0 "register_operand" "=f")
4365 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
4368 [(set_attr "op_type" "RRE")
4369 (set_attr "type" "ftruncdf")])
4372 ; trunctf(df|sf)2 instruction pattern(s).
4376 (define_insn "trunctf<mode>2"
4377 [(set (match_operand:DSF 0 "register_operand" "=f")
4378 (float_truncate:DSF (match_operand:TF 1 "register_operand" "f")))
4379 (clobber (match_scratch:TF 2 "=f"))]
4381 "l<xde>xbr\t%2,%1\;l<xde>r\t%0,%2"
4382 [(set_attr "length" "6")
4383 (set_attr "type" "ftrunctf")])
4386 ; trunctddd2 and truncddsd2 instruction pattern(s).
4389 (define_insn "trunctddd2"
4390 [(set (match_operand:DD 0 "register_operand" "=f")
4391 (float_truncate:DD (match_operand:TD 1 "register_operand" "f")))
4392 (clobber (match_scratch:TD 2 "=f"))]
4394 "ldxtr\t%2,0,%1,0\;ldr\t%0,%2"
4395 [(set_attr "length" "6")
4396 (set_attr "type" "ftruncdd")])
4398 (define_insn "truncddsd2"
4399 [(set (match_operand:SD 0 "register_operand" "=f")
4400 (float_truncate:SD (match_operand:DD 1 "register_operand" "f")))]
4403 [(set_attr "op_type" "RRF")
4404 (set_attr "type" "ftruncsd")])
4407 ; extend(sf|df)(df|tf)2 instruction pattern(s).
4410 ; ldebr, ldeb, lxdbr, lxdb, lxebr, lxeb
4411 (define_insn "extend<DSF:mode><BFP:mode>2"
4412 [(set (match_operand:BFP 0 "register_operand" "=f,f")
4413 (float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "f,R")))]
4415 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DSF:MODE>mode)"
4417 l<BFP:xde><DSF:xde>br\t%0,%1
4418 l<BFP:xde><DSF:xde>b\t%0,%1"
4419 [(set_attr "op_type" "RRE,RXE")
4420 (set_attr "type" "fsimp<BFP:mode>, fload<BFP:mode>")])
4423 ; extendddtd2 and extendsddd2 instruction pattern(s).
4426 (define_insn "extendddtd2"
4427 [(set (match_operand:TD 0 "register_operand" "=f")
4428 (float_extend:TD (match_operand:DD 1 "register_operand" "f")))]
4431 [(set_attr "op_type" "RRF")
4432 (set_attr "type" "fsimptf")])
4434 (define_insn "extendsddd2"
4435 [(set (match_operand:DD 0 "register_operand" "=f")
4436 (float_extend:DD (match_operand:SD 1 "register_operand" "f")))]
4439 [(set_attr "op_type" "RRF")
4440 (set_attr "type" "fsimptf")])
4442 ; Binary Floating Point - load fp integer
4444 ; Expanders for: floor, btrunc, round, ceil, and nearbyint
4445 ; For all of them the inexact exceptions are suppressed.
4447 ; fiebra, fidbra, fixbra
4448 (define_insn "<FPINT:fpint_name><BFP:mode>2"
4449 [(set (match_operand:BFP 0 "register_operand" "=f")
4450 (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
4453 "fi<BFP:xde>bra\t%0,<FPINT:fpint_roundingmode>,%1,4"
4454 [(set_attr "op_type" "RRF")
4455 (set_attr "type" "fsimp<BFP:mode>")])
4457 ; rint is supposed to raise an inexact exception so we can use the
4458 ; older instructions.
4460 ; fiebr, fidbr, fixbr
4461 (define_insn "rint<BFP:mode>2"
4462 [(set (match_operand:BFP 0 "register_operand" "=f")
4463 (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
4464 UNSPEC_FPINT_RINT))]
4466 "fi<BFP:xde>br\t%0,0,%1"
4467 [(set_attr "op_type" "RRF")
4468 (set_attr "type" "fsimp<BFP:mode>")])
4471 ; Decimal Floating Point - load fp integer
4474 (define_insn "<FPINT:fpint_name><DFP:mode>2"
4475 [(set (match_operand:DFP 0 "register_operand" "=f")
4476 (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")]
4479 "fi<DFP:xde>tr\t%0,<FPINT:fpint_roundingmode>,%1,4"
4480 [(set_attr "op_type" "RRF")
4481 (set_attr "type" "fsimp<DFP:mode>")])
4484 (define_insn "rint<DFP:mode>2"
4485 [(set (match_operand:DFP 0 "register_operand" "=f")
4486 (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")]
4487 UNSPEC_FPINT_RINT))]
4489 "fi<DFP:xde>tr\t%0,0,%1,0"
4490 [(set_attr "op_type" "RRF")
4491 (set_attr "type" "fsimp<DFP:mode>")])
4494 ; Binary <-> Decimal floating point trunc patterns
4497 (define_insn "*trunc<BFP:mode><DFP_ALL:mode>2"
4498 [(set (reg:DFP_ALL FPR0_REGNUM)
4499 (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM)))
4500 (use (reg:SI GPR0_REGNUM))
4501 (clobber (reg:CC CC_REGNUM))]
4505 (define_insn "*trunc<DFP_ALL:mode><BFP:mode>2"
4506 [(set (reg:BFP FPR0_REGNUM)
4507 (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM)))
4508 (use (reg:SI GPR0_REGNUM))
4509 (clobber (reg:CC CC_REGNUM))]
4513 (define_expand "trunc<BFP:mode><DFP_ALL:mode>2"
4514 [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
4515 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4517 [(set (reg:DFP_ALL FPR0_REGNUM)
4518 (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM)))
4519 (use (reg:SI GPR0_REGNUM))
4520 (clobber (reg:CC CC_REGNUM))])
4521 (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "")
4522 (reg:DFP_ALL FPR0_REGNUM))]
4524 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DFP_ALL:MODE>mode)"
4526 HOST_WIDE_INT flags;
4528 flags = (PFPO_CONVERT |
4529 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT |
4530 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT);
4532 operands[2] = GEN_INT (flags);
4535 (define_expand "trunc<DFP_ALL:mode><BFP:mode>2"
4536 [(set (reg:DFP_ALL FPR4_REGNUM)
4537 (match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
4538 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4540 [(set (reg:BFP FPR0_REGNUM) (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM)))
4541 (use (reg:SI GPR0_REGNUM))
4542 (clobber (reg:CC CC_REGNUM))])
4543 (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))]
4545 && GET_MODE_SIZE (<DFP_ALL:MODE>mode) >= GET_MODE_SIZE (<BFP:MODE>mode)"
4547 HOST_WIDE_INT flags;
4549 flags = (PFPO_CONVERT |
4550 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT |
4551 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT);
4553 operands[2] = GEN_INT (flags);
4557 ; Binary <-> Decimal floating point extend patterns
4560 (define_insn "*extend<BFP:mode><DFP_ALL:mode>2"
4561 [(set (reg:DFP_ALL FPR0_REGNUM) (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM)))
4562 (use (reg:SI GPR0_REGNUM))
4563 (clobber (reg:CC CC_REGNUM))]
4567 (define_insn "*extend<DFP_ALL:mode><BFP:mode>2"
4568 [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM)))
4569 (use (reg:SI GPR0_REGNUM))
4570 (clobber (reg:CC CC_REGNUM))]
4574 (define_expand "extend<BFP:mode><DFP_ALL:mode>2"
4575 [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
4576 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4578 [(set (reg:DFP_ALL FPR0_REGNUM)
4579 (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM)))
4580 (use (reg:SI GPR0_REGNUM))
4581 (clobber (reg:CC CC_REGNUM))])
4582 (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "")
4583 (reg:DFP_ALL FPR0_REGNUM))]
4585 && GET_MODE_SIZE (<BFP:MODE>mode) <= GET_MODE_SIZE (<DFP_ALL:MODE>mode)"
4587 HOST_WIDE_INT flags;
4589 flags = (PFPO_CONVERT |
4590 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT |
4591 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT);
4593 operands[2] = GEN_INT (flags);
4596 (define_expand "extend<DFP_ALL:mode><BFP:mode>2"
4597 [(set (reg:DFP_ALL FPR4_REGNUM)
4598 (match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
4599 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4601 [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM)))
4602 (use (reg:SI GPR0_REGNUM))
4603 (clobber (reg:CC CC_REGNUM))])
4604 (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))]
4606 && GET_MODE_SIZE (<DFP_ALL:MODE>mode) < GET_MODE_SIZE (<BFP:MODE>mode)"
4608 HOST_WIDE_INT flags;
4610 flags = (PFPO_CONVERT |
4611 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT |
4612 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT);
4614 operands[2] = GEN_INT (flags);
4619 ;; ARITHMETIC OPERATIONS
4621 ; arithmetic operations set the ConditionCode,
4622 ; because of unpredictable Bits in Register for Halfword and Byte
4623 ; the ConditionCode can be set wrong in operations for Halfword and Byte
4626 ;;- Add instructions.
4630 ; addti3 instruction pattern(s).
4633 (define_insn_and_split "addti3"
4634 [(set (match_operand:TI 0 "register_operand" "=&d")
4635 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
4636 (match_operand:TI 2 "general_operand" "do") ) )
4637 (clobber (reg:CC CC_REGNUM))]
4640 "&& reload_completed"
4642 [(set (reg:CCL1 CC_REGNUM)
4643 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
4645 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
4647 [(set (match_dup 3) (plus:DI
4648 (plus:DI (ltu:DI (reg:CCL1 CC_REGNUM) (const_int 0))
4649 (match_dup 4)) (match_dup 5)))
4650 (clobber (reg:CC CC_REGNUM))])]
4651 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
4652 operands[4] = operand_subword (operands[1], 0, 0, TImode);
4653 operands[5] = operand_subword (operands[2], 0, 0, TImode);
4654 operands[6] = operand_subword (operands[0], 1, 0, TImode);
4655 operands[7] = operand_subword (operands[1], 1, 0, TImode);
4656 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
4659 ; adddi3 instruction pattern(s).
4662 (define_expand "adddi3"
4664 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4665 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
4666 (match_operand:DI 2 "general_operand" "")))
4667 (clobber (reg:CC CC_REGNUM))])]
4671 (define_insn "*adddi3_sign"
4672 [(set (match_operand:DI 0 "register_operand" "=d,d")
4673 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
4674 (match_operand:DI 1 "register_operand" "0,0")))
4675 (clobber (reg:CC CC_REGNUM))]
4680 [(set_attr "op_type" "RRE,RXY")
4681 (set_attr "z196prop" "z196_cracked,z196_cracked")])
4683 (define_insn "*adddi3_zero_cc"
4684 [(set (reg CC_REGNUM)
4685 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
4686 (match_operand:DI 1 "register_operand" "0,0"))
4688 (set (match_operand:DI 0 "register_operand" "=d,d")
4689 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
4690 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
4694 [(set_attr "op_type" "RRE,RXY")
4695 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4697 (define_insn "*adddi3_zero_cconly"
4698 [(set (reg CC_REGNUM)
4699 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
4700 (match_operand:DI 1 "register_operand" "0,0"))
4702 (clobber (match_scratch:DI 0 "=d,d"))]
4703 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
4707 [(set_attr "op_type" "RRE,RXY")
4708 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4710 (define_insn "*adddi3_zero"
4711 [(set (match_operand:DI 0 "register_operand" "=d,d")
4712 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
4713 (match_operand:DI 1 "register_operand" "0,0")))
4714 (clobber (reg:CC CC_REGNUM))]
4719 [(set_attr "op_type" "RRE,RXY")
4720 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4722 (define_insn_and_split "*adddi3_31z"
4723 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
4724 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
4725 (match_operand:DI 2 "general_operand" "do") ) )
4726 (clobber (reg:CC CC_REGNUM))]
4727 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
4729 "&& reload_completed"
4731 [(set (reg:CCL1 CC_REGNUM)
4732 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
4734 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
4736 [(set (match_dup 3) (plus:SI
4737 (plus:SI (ltu:SI (reg:CCL1 CC_REGNUM) (const_int 0))
4738 (match_dup 4)) (match_dup 5)))
4739 (clobber (reg:CC CC_REGNUM))])]
4740 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
4741 operands[4] = operand_subword (operands[1], 0, 0, DImode);
4742 operands[5] = operand_subword (operands[2], 0, 0, DImode);
4743 operands[6] = operand_subword (operands[0], 1, 0, DImode);
4744 operands[7] = operand_subword (operands[1], 1, 0, DImode);
4745 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
4747 (define_insn_and_split "*adddi3_31"
4748 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
4749 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
4750 (match_operand:DI 2 "general_operand" "do") ) )
4751 (clobber (reg:CC CC_REGNUM))]
4754 "&& reload_completed"
4756 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
4757 (clobber (reg:CC CC_REGNUM))])
4759 [(set (reg:CCL1 CC_REGNUM)
4760 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
4762 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
4764 (if_then_else (ltu (reg:CCL1 CC_REGNUM) (const_int 0))
4766 (label_ref (match_dup 9))))
4768 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
4769 (clobber (reg:CC CC_REGNUM))])
4771 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
4772 operands[4] = operand_subword (operands[1], 0, 0, DImode);
4773 operands[5] = operand_subword (operands[2], 0, 0, DImode);
4774 operands[6] = operand_subword (operands[0], 1, 0, DImode);
4775 operands[7] = operand_subword (operands[1], 1, 0, DImode);
4776 operands[8] = operand_subword (operands[2], 1, 0, DImode);
4777 operands[9] = gen_label_rtx ();")
4780 ; addsi3 instruction pattern(s).
4783 (define_expand "addsi3"
4785 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4786 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "")
4787 (match_operand:SI 2 "general_operand" "")))
4788 (clobber (reg:CC CC_REGNUM))])]
4792 (define_insn "*addsi3_sign"
4793 [(set (match_operand:SI 0 "register_operand" "=d,d")
4794 (plus:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
4795 (match_operand:SI 1 "register_operand" "0,0")))
4796 (clobber (reg:CC CC_REGNUM))]
4801 [(set_attr "op_type" "RX,RXY")
4802 (set_attr "z196prop" "z196_cracked,z196_cracked")])
4805 ; add(di|si)3 instruction pattern(s).
4808 ; ark, agrk, ar, ahi, ahik, aghik, alfi, slfi, a, ay, agr, aghi, algfi, slgfi, ag, asi, agsi
4809 (define_insn "*add<mode>3"
4810 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d,d,d, d, d,d,d,QS")
4811 (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,d, 0, 0,0,0, 0")
4812 (match_operand:GPR 2 "general_operand" " d,d,K,K,Op,On,R,T, C") ) )
4813 (clobber (reg:CC CC_REGNUM))]
4825 [(set_attr "op_type" "RR<E>,RRF,RI,RIE,RIL,RIL,RX<Y>,RXY,SIY")
4826 (set_attr "cpu_facility" "*,z196,*,z196,extimm,extimm,*,*,z10")
4827 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,z10_super_E1,z10_super_E1,
4828 z10_super_E1,z10_super_E1,z10_super_E1")])
4830 ; alr, alfi, slfi, al, aly, alrk, alhsik, algr, algfi, slgfi, alg, alsi, algsi, algrk, alghsik
4831 (define_insn "*add<mode>3_carry1_cc"
4832 [(set (reg CC_REGNUM)
4833 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0,0")
4834 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T,C"))
4836 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,d")
4837 (plus:GPR (match_dup 1) (match_dup 2)))]
4838 "s390_match_ccmode (insn, CCL1mode)"
4844 al<g>hsik\t%0,%1,%h2
4848 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
4849 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
4850 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*,
4851 z10_super_E1,z10_super_E1,z10_super_E1")])
4853 ; alr, al, aly, algr, alg, alrk, algrk
4854 (define_insn "*add<mode>3_carry1_cconly"
4855 [(set (reg CC_REGNUM)
4856 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
4857 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
4859 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
4860 "s390_match_ccmode (insn, CCL1mode)"
4866 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
4867 (set_attr "cpu_facility" "*,z196,*,*")
4868 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
4870 ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik
4871 (define_insn "*add<mode>3_carry2_cc"
4872 [(set (reg CC_REGNUM)
4873 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0, 0")
4874 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T, C"))
4876 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,RS")
4877 (plus:GPR (match_dup 1) (match_dup 2)))]
4878 "s390_match_ccmode (insn, CCL1mode)"
4884 al<g>hsik\t%0,%1,%h2
4888 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
4889 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
4890 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*,
4891 z10_super_E1,z10_super_E1,z10_super_E1")])
4893 ; alr, al, aly, algr, alg, alrk, algrk
4894 (define_insn "*add<mode>3_carry2_cconly"
4895 [(set (reg CC_REGNUM)
4896 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
4897 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
4899 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
4900 "s390_match_ccmode (insn, CCL1mode)"
4906 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
4907 (set_attr "cpu_facility" "*,z196,*,*")
4908 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
4910 ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik
4911 (define_insn "*add<mode>3_cc"
4912 [(set (reg CC_REGNUM)
4913 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0, 0")
4914 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T, C"))
4916 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,RS")
4917 (plus:GPR (match_dup 1) (match_dup 2)))]
4918 "s390_match_ccmode (insn, CCLmode)"
4924 al<g>hsik\t%0,%1,%h2
4928 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
4929 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
4930 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,
4931 *,z10_super_E1,z10_super_E1,z10_super_E1")])
4933 ; alr, al, aly, algr, alg, alrk, algrk
4934 (define_insn "*add<mode>3_cconly"
4935 [(set (reg CC_REGNUM)
4936 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
4937 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
4939 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
4940 "s390_match_ccmode (insn, CCLmode)"
4946 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
4947 (set_attr "cpu_facility" "*,z196,*,*")
4948 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
4950 ; alr, al, aly, algr, alg, alrk, algrk
4951 (define_insn "*add<mode>3_cconly2"
4952 [(set (reg CC_REGNUM)
4953 (compare (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
4954 (neg:GPR (match_operand:GPR 2 "general_operand" "d,d,R,T"))))
4955 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
4956 "s390_match_ccmode(insn, CCLmode)"
4962 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
4963 (set_attr "cpu_facility" "*,z196,*,*")
4964 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
4966 ; ahi, afi, aghi, agfi, asi, agsi
4967 (define_insn "*add<mode>3_imm_cc"
4968 [(set (reg CC_REGNUM)
4969 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" " 0, d,0, 0")
4970 (match_operand:GPR 2 "const_int_operand" " K, K,Os, C"))
4972 (set (match_operand:GPR 0 "nonimmediate_operand" "=d, d,d,QS")
4973 (plus:GPR (match_dup 1) (match_dup 2)))]
4974 "s390_match_ccmode (insn, CCAmode)
4975 && (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")
4976 || (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'O', \"Os\")
4977 /* Avoid INT32_MIN on 32 bit. */
4978 && (!TARGET_ZARCH || INTVAL (operands[2]) != -0x7fffffff - 1)))"
4984 [(set_attr "op_type" "RI,RIE,RIL,SIY")
4985 (set_attr "cpu_facility" "*,z196,extimm,z10")
4986 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
4989 ; add(tf|df|sf|td|dd)3 instruction pattern(s).
4992 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
4993 (define_insn "add<mode>3"
4994 [(set (match_operand:FP 0 "register_operand" "=f, f")
4995 (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
4996 (match_operand:FP 2 "general_operand" " f,<Rf>")))
4997 (clobber (reg:CC CC_REGNUM))]
5000 a<xde><bt>r\t%0,<op1>%2
5002 [(set_attr "op_type" "<RRer>,RXE")
5003 (set_attr "type" "fsimp<mode>")])
5005 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5006 (define_insn "*add<mode>3_cc"
5007 [(set (reg CC_REGNUM)
5008 (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
5009 (match_operand:FP 2 "general_operand" " f,<Rf>"))
5010 (match_operand:FP 3 "const0_operand" "")))
5011 (set (match_operand:FP 0 "register_operand" "=f,f")
5012 (plus:FP (match_dup 1) (match_dup 2)))]
5013 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5015 a<xde><bt>r\t%0,<op1>%2
5017 [(set_attr "op_type" "<RRer>,RXE")
5018 (set_attr "type" "fsimp<mode>")])
5020 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5021 (define_insn "*add<mode>3_cconly"
5022 [(set (reg CC_REGNUM)
5023 (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
5024 (match_operand:FP 2 "general_operand" " f,<Rf>"))
5025 (match_operand:FP 3 "const0_operand" "")))
5026 (clobber (match_scratch:FP 0 "=f,f"))]
5027 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5029 a<xde><bt>r\t%0,<op1>%2
5031 [(set_attr "op_type" "<RRer>,RXE")
5032 (set_attr "type" "fsimp<mode>")])
5036 ;;- Subtract instructions.
5040 ; subti3 instruction pattern(s).
5043 (define_insn_and_split "subti3"
5044 [(set (match_operand:TI 0 "register_operand" "=&d")
5045 (minus:TI (match_operand:TI 1 "register_operand" "0")
5046 (match_operand:TI 2 "general_operand" "do") ) )
5047 (clobber (reg:CC CC_REGNUM))]
5050 "&& reload_completed"
5052 [(set (reg:CCL2 CC_REGNUM)
5053 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
5055 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
5057 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
5058 (gtu:DI (reg:CCL2 CC_REGNUM) (const_int 0))))
5059 (clobber (reg:CC CC_REGNUM))])]
5060 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
5061 operands[4] = operand_subword (operands[1], 0, 0, TImode);
5062 operands[5] = operand_subword (operands[2], 0, 0, TImode);
5063 operands[6] = operand_subword (operands[0], 1, 0, TImode);
5064 operands[7] = operand_subword (operands[1], 1, 0, TImode);
5065 operands[8] = operand_subword (operands[2], 1, 0, TImode);")
5068 ; subdi3 instruction pattern(s).
5071 (define_expand "subdi3"
5073 [(set (match_operand:DI 0 "register_operand" "")
5074 (minus:DI (match_operand:DI 1 "register_operand" "")
5075 (match_operand:DI 2 "general_operand" "")))
5076 (clobber (reg:CC CC_REGNUM))])]
5080 (define_insn "*subdi3_sign"
5081 [(set (match_operand:DI 0 "register_operand" "=d,d")
5082 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5083 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))))
5084 (clobber (reg:CC CC_REGNUM))]
5089 [(set_attr "op_type" "RRE,RXY")
5090 (set_attr "z10prop" "z10_c,*")
5091 (set_attr "z196prop" "z196_cracked")])
5093 (define_insn "*subdi3_zero_cc"
5094 [(set (reg CC_REGNUM)
5095 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5096 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT")))
5098 (set (match_operand:DI 0 "register_operand" "=d,d")
5099 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
5100 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5104 [(set_attr "op_type" "RRE,RXY")
5105 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5107 (define_insn "*subdi3_zero_cconly"
5108 [(set (reg CC_REGNUM)
5109 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5110 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT")))
5112 (clobber (match_scratch:DI 0 "=d,d"))]
5113 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5117 [(set_attr "op_type" "RRE,RXY")
5118 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5120 (define_insn "*subdi3_zero"
5121 [(set (match_operand:DI 0 "register_operand" "=d,d")
5122 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5123 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))))
5124 (clobber (reg:CC CC_REGNUM))]
5129 [(set_attr "op_type" "RRE,RXY")
5130 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5132 (define_insn_and_split "*subdi3_31z"
5133 [(set (match_operand:DI 0 "register_operand" "=&d")
5134 (minus:DI (match_operand:DI 1 "register_operand" "0")
5135 (match_operand:DI 2 "general_operand" "do") ) )
5136 (clobber (reg:CC CC_REGNUM))]
5137 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
5139 "&& reload_completed"
5141 [(set (reg:CCL2 CC_REGNUM)
5142 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
5144 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
5146 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
5147 (gtu:SI (reg:CCL2 CC_REGNUM) (const_int 0))))
5148 (clobber (reg:CC CC_REGNUM))])]
5149 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5150 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5151 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5152 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5153 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5154 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
5156 (define_insn_and_split "*subdi3_31"
5157 [(set (match_operand:DI 0 "register_operand" "=&d")
5158 (minus:DI (match_operand:DI 1 "register_operand" "0")
5159 (match_operand:DI 2 "general_operand" "do") ) )
5160 (clobber (reg:CC CC_REGNUM))]
5163 "&& reload_completed"
5165 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
5166 (clobber (reg:CC CC_REGNUM))])
5168 [(set (reg:CCL2 CC_REGNUM)
5169 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
5171 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
5173 (if_then_else (gtu (reg:CCL2 CC_REGNUM) (const_int 0))
5175 (label_ref (match_dup 9))))
5177 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
5178 (clobber (reg:CC CC_REGNUM))])
5180 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5181 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5182 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5183 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5184 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5185 operands[8] = operand_subword (operands[2], 1, 0, DImode);
5186 operands[9] = gen_label_rtx ();")
5189 ; subsi3 instruction pattern(s).
5192 (define_expand "subsi3"
5194 [(set (match_operand:SI 0 "register_operand" "")
5195 (minus:SI (match_operand:SI 1 "register_operand" "")
5196 (match_operand:SI 2 "general_operand" "")))
5197 (clobber (reg:CC CC_REGNUM))])]
5201 (define_insn "*subsi3_sign"
5202 [(set (match_operand:SI 0 "register_operand" "=d,d")
5203 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
5204 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
5205 (clobber (reg:CC CC_REGNUM))]
5210 [(set_attr "op_type" "RX,RXY")
5211 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5214 ; sub(di|si)3 instruction pattern(s).
5217 ; sr, s, sy, sgr, sg, srk, sgrk
5218 (define_insn "*sub<mode>3"
5219 [(set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5220 (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5221 (match_operand:GPR 2 "general_operand" "d,d,R,T") ) )
5222 (clobber (reg:CC CC_REGNUM))]
5229 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5230 (set_attr "cpu_facility" "*,z196,*,*")
5231 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5233 ; slr, sl, sly, slgr, slg, slrk, slgrk
5234 (define_insn "*sub<mode>3_borrow_cc"
5235 [(set (reg CC_REGNUM)
5236 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5237 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5239 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5240 (minus:GPR (match_dup 1) (match_dup 2)))]
5241 "s390_match_ccmode (insn, CCL2mode)"
5247 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5248 (set_attr "cpu_facility" "*,z196,*,*")
5249 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5251 ; slr, sl, sly, slgr, slg, slrk, slgrk
5252 (define_insn "*sub<mode>3_borrow_cconly"
5253 [(set (reg CC_REGNUM)
5254 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5255 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5257 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5258 "s390_match_ccmode (insn, CCL2mode)"
5264 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5265 (set_attr "cpu_facility" "*,z196,*,*")
5266 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5268 ; slr, sl, sly, slgr, slg, slrk, slgrk
5269 (define_insn "*sub<mode>3_cc"
5270 [(set (reg CC_REGNUM)
5271 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5272 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5274 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5275 (minus:GPR (match_dup 1) (match_dup 2)))]
5276 "s390_match_ccmode (insn, CCLmode)"
5282 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5283 (set_attr "cpu_facility" "*,z196,*,*")
5284 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5286 ; slr, sl, sly, slgr, slg, slrk, slgrk
5287 (define_insn "*sub<mode>3_cc2"
5288 [(set (reg CC_REGNUM)
5289 (compare (match_operand:GPR 1 "register_operand" "0,d,0,0")
5290 (match_operand:GPR 2 "general_operand" "d,d,R,T")))
5291 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5292 (minus:GPR (match_dup 1) (match_dup 2)))]
5293 "s390_match_ccmode (insn, CCL3mode)"
5299 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5300 (set_attr "cpu_facility" "*,z196,*,*")
5301 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5303 ; slr, sl, sly, slgr, slg, slrk, slgrk
5304 (define_insn "*sub<mode>3_cconly"
5305 [(set (reg CC_REGNUM)
5306 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5307 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5309 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5310 "s390_match_ccmode (insn, CCLmode)"
5316 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5317 (set_attr "cpu_facility" "*,z196,*,*")
5318 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5321 ; slr, sl, sly, slgr, slg, slrk, slgrk
5322 (define_insn "*sub<mode>3_cconly2"
5323 [(set (reg CC_REGNUM)
5324 (compare (match_operand:GPR 1 "register_operand" "0,d,0,0")
5325 (match_operand:GPR 2 "general_operand" "d,d,R,T")))
5326 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5327 "s390_match_ccmode (insn, CCL3mode)"
5333 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5334 (set_attr "cpu_facility" "*,z196,*,*")
5335 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5339 ; sub(tf|df|sf|td|dd)3 instruction pattern(s).
5342 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5343 (define_insn "sub<mode>3"
5344 [(set (match_operand:FP 0 "register_operand" "=f, f")
5345 (minus:FP (match_operand:FP 1 "register_operand" "<f0>,0")
5346 (match_operand:FP 2 "general_operand" "f,<Rf>")))
5347 (clobber (reg:CC CC_REGNUM))]
5350 s<xde><bt>r\t%0,<op1>%2
5352 [(set_attr "op_type" "<RRer>,RXE")
5353 (set_attr "type" "fsimp<mode>")])
5355 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5356 (define_insn "*sub<mode>3_cc"
5357 [(set (reg CC_REGNUM)
5358 (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "<f0>,0")
5359 (match_operand:FP 2 "general_operand" "f,<Rf>"))
5360 (match_operand:FP 3 "const0_operand" "")))
5361 (set (match_operand:FP 0 "register_operand" "=f,f")
5362 (minus:FP (match_dup 1) (match_dup 2)))]
5363 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5365 s<xde><bt>r\t%0,<op1>%2
5367 [(set_attr "op_type" "<RRer>,RXE")
5368 (set_attr "type" "fsimp<mode>")])
5370 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5371 (define_insn "*sub<mode>3_cconly"
5372 [(set (reg CC_REGNUM)
5373 (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "<f0>,0")
5374 (match_operand:FP 2 "general_operand" "f,<Rf>"))
5375 (match_operand:FP 3 "const0_operand" "")))
5376 (clobber (match_scratch:FP 0 "=f,f"))]
5377 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5379 s<xde><bt>r\t%0,<op1>%2
5381 [(set_attr "op_type" "<RRer>,RXE")
5382 (set_attr "type" "fsimp<mode>")])
5386 ;;- Conditional add/subtract instructions.
5390 ; add(di|si)cc instruction pattern(s).
5393 ; the following 4 patterns are used when the result of an add with
5394 ; carry is checked for an overflow condition
5396 ; op1 + op2 + c < op1
5398 ; alcr, alc, alcgr, alcg
5399 (define_insn "*add<mode>3_alc_carry1_cc"
5400 [(set (reg CC_REGNUM)
5402 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5403 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5404 (match_operand:GPR 2 "general_operand" "d,RT"))
5406 (set (match_operand:GPR 0 "register_operand" "=d,d")
5407 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5408 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5412 [(set_attr "op_type" "RRE,RXY")
5413 (set_attr "z196prop" "z196_alone,z196_alone")])
5415 ; alcr, alc, alcgr, alcg
5416 (define_insn "*add<mode>3_alc_carry1_cconly"
5417 [(set (reg CC_REGNUM)
5419 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5420 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5421 (match_operand:GPR 2 "general_operand" "d,RT"))
5423 (clobber (match_scratch:GPR 0 "=d,d"))]
5424 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5428 [(set_attr "op_type" "RRE,RXY")
5429 (set_attr "z196prop" "z196_alone,z196_alone")])
5431 ; op1 + op2 + c < op2
5433 ; alcr, alc, alcgr, alcg
5434 (define_insn "*add<mode>3_alc_carry2_cc"
5435 [(set (reg CC_REGNUM)
5437 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5438 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5439 (match_operand:GPR 2 "general_operand" "d,RT"))
5441 (set (match_operand:GPR 0 "register_operand" "=d,d")
5442 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5443 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5447 [(set_attr "op_type" "RRE,RXY")])
5449 ; alcr, alc, alcgr, alcg
5450 (define_insn "*add<mode>3_alc_carry2_cconly"
5451 [(set (reg CC_REGNUM)
5453 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5454 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5455 (match_operand:GPR 2 "general_operand" "d,RT"))
5457 (clobber (match_scratch:GPR 0 "=d,d"))]
5458 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5462 [(set_attr "op_type" "RRE,RXY")])
5464 ; alcr, alc, alcgr, alcg
5465 (define_insn "*add<mode>3_alc_cc"
5466 [(set (reg CC_REGNUM)
5468 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5469 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5470 (match_operand:GPR 2 "general_operand" "d,RT"))
5472 (set (match_operand:GPR 0 "register_operand" "=d,d")
5473 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5474 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
5478 [(set_attr "op_type" "RRE,RXY")])
5480 ; alcr, alc, alcgr, alcg
5481 (define_insn "*add<mode>3_alc"
5482 [(set (match_operand:GPR 0 "register_operand" "=d,d")
5483 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5484 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5485 (match_operand:GPR 2 "general_operand" "d,RT")))
5486 (clobber (reg:CC CC_REGNUM))]
5491 [(set_attr "op_type" "RRE,RXY")])
5493 ; slbr, slb, slbgr, slbg
5494 (define_insn "*sub<mode>3_slb_cc"
5495 [(set (reg CC_REGNUM)
5497 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
5498 (match_operand:GPR 2 "general_operand" "d,RT"))
5499 (match_operand:GPR 3 "s390_slb_comparison" ""))
5501 (set (match_operand:GPR 0 "register_operand" "=d,d")
5502 (minus:GPR (minus:GPR (match_dup 1) (match_dup 2)) (match_dup 3)))]
5503 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
5507 [(set_attr "op_type" "RRE,RXY")
5508 (set_attr "z10prop" "z10_c,*")])
5510 ; slbr, slb, slbgr, slbg
5511 (define_insn "*sub<mode>3_slb"
5512 [(set (match_operand:GPR 0 "register_operand" "=d,d")
5513 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
5514 (match_operand:GPR 2 "general_operand" "d,RT"))
5515 (match_operand:GPR 3 "s390_slb_comparison" "")))
5516 (clobber (reg:CC CC_REGNUM))]
5521 [(set_attr "op_type" "RRE,RXY")
5522 (set_attr "z10prop" "z10_c,*")])
5524 (define_expand "add<mode>cc"
5525 [(match_operand:GPR 0 "register_operand" "")
5526 (match_operand 1 "comparison_operator" "")
5527 (match_operand:GPR 2 "register_operand" "")
5528 (match_operand:GPR 3 "const_int_operand" "")]
5530 "if (!s390_expand_addcc (GET_CODE (operands[1]),
5531 XEXP (operands[1], 0), XEXP (operands[1], 1),
5532 operands[0], operands[2],
5533 operands[3])) FAIL; DONE;")
5536 ; scond instruction pattern(s).
5539 (define_insn_and_split "*scond<mode>"
5540 [(set (match_operand:GPR 0 "register_operand" "=&d")
5541 (match_operand:GPR 1 "s390_alc_comparison" ""))
5542 (clobber (reg:CC CC_REGNUM))]
5545 "&& reload_completed"
5546 [(set (match_dup 0) (const_int 0))
5548 [(set (match_dup 0) (plus:GPR (plus:GPR (match_dup 1) (match_dup 0))
5550 (clobber (reg:CC CC_REGNUM))])]
5553 (define_insn_and_split "*scond<mode>_neg"
5554 [(set (match_operand:GPR 0 "register_operand" "=&d")
5555 (match_operand:GPR 1 "s390_slb_comparison" ""))
5556 (clobber (reg:CC CC_REGNUM))]
5559 "&& reload_completed"
5560 [(set (match_dup 0) (const_int 0))
5562 [(set (match_dup 0) (minus:GPR (minus:GPR (match_dup 0) (match_dup 0))
5564 (clobber (reg:CC CC_REGNUM))])
5566 [(set (match_dup 0) (neg:GPR (match_dup 0)))
5567 (clobber (reg:CC CC_REGNUM))])]
5571 (define_expand "cstore<mode>4"
5572 [(set (match_operand:SI 0 "register_operand" "")
5573 (match_operator:SI 1 "s390_scond_operator"
5574 [(match_operand:GPR 2 "register_operand" "")
5575 (match_operand:GPR 3 "general_operand" "")]))]
5577 "if (!s390_expand_addcc (GET_CODE (operands[1]), operands[2], operands[3],
5578 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
5580 (define_expand "cstorecc4"
5582 [(set (match_operand:SI 0 "register_operand" "")
5583 (match_operator:SI 1 "s390_eqne_operator"
5584 [(match_operand:CCZ1 2 "register_operand")
5585 (match_operand 3 "const0_operand")]))
5586 (clobber (reg:CC CC_REGNUM))])]
5588 "emit_insn (gen_sne (operands[0], operands[2]));
5589 if (GET_CODE (operands[1]) == EQ)
5590 emit_insn (gen_xorsi3 (operands[0], operands[0], const1_rtx));
5593 (define_insn_and_split "sne"
5594 [(set (match_operand:SI 0 "register_operand" "=d")
5595 (ne:SI (match_operand:CCZ1 1 "register_operand" "0")
5597 (clobber (reg:CC CC_REGNUM))]
5602 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 28)))
5603 (clobber (reg:CC CC_REGNUM))])])
5607 ;; - Conditional move instructions (introduced with z196)
5610 (define_expand "mov<mode>cc"
5611 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
5612 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
5613 (match_operand:GPR 2 "nonimmediate_operand" "")
5614 (match_operand:GPR 3 "nonimmediate_operand" "")))]
5616 "operands[1] = s390_emit_compare (GET_CODE (operands[1]),
5617 XEXP (operands[1], 0), XEXP (operands[1], 1));")
5619 ; locr, loc, stoc, locgr, locg, stocg
5620 (define_insn_and_split "*mov<mode>cc"
5621 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,QS,QS,&d")
5623 (match_operator 1 "s390_comparison"
5624 [(match_operand 2 "cc_reg_operand" " c,c, c, c, c, c, c")
5625 (match_operand 5 "const_int_operand" "")])
5626 (match_operand:GPR 3 "nonimmediate_operand" " d,0,QS, 0, d, 0,QS")
5627 (match_operand:GPR 4 "nonimmediate_operand" " 0,d, 0,QS, 0, d,QS")))]
5637 "&& reload_completed
5638 && MEM_P (operands[3]) && MEM_P (operands[4])"
5641 (match_op_dup 1 [(match_dup 2) (const_int 0)])
5646 (match_op_dup 1 [(match_dup 2) (const_int 0)])
5650 [(set_attr "op_type" "RRF,RRF,RSY,RSY,RSY,RSY,*")])
5653 ;;- Multiply instructions.
5657 ; muldi3 instruction pattern(s).
5660 (define_insn "*muldi3_sign"
5661 [(set (match_operand:DI 0 "register_operand" "=d,d")
5662 (mult:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5663 (match_operand:DI 1 "register_operand" "0,0")))]
5668 [(set_attr "op_type" "RRE,RXY")
5669 (set_attr "type" "imuldi")])
5671 (define_insn "muldi3"
5672 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d")
5673 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
5674 (match_operand:DI 2 "general_operand" "d,K,RT,Os")))]
5681 [(set_attr "op_type" "RRE,RI,RXY,RIL")
5682 (set_attr "type" "imuldi")
5683 (set_attr "cpu_facility" "*,*,*,z10")])
5686 ; mulsi3 instruction pattern(s).
5689 (define_insn "*mulsi3_sign"
5690 [(set (match_operand:SI 0 "register_operand" "=d,d")
5691 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
5692 (match_operand:SI 1 "register_operand" "0,0")))]
5697 [(set_attr "op_type" "RX,RXY")
5698 (set_attr "type" "imulhi")
5699 (set_attr "cpu_facility" "*,z10")])
5701 (define_insn "mulsi3"
5702 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
5703 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0")
5704 (match_operand:SI 2 "general_operand" "d,K,R,T,Os")))]
5712 [(set_attr "op_type" "RRE,RI,RX,RXY,RIL")
5713 (set_attr "type" "imulsi,imulhi,imulsi,imulsi,imulsi")
5714 (set_attr "cpu_facility" "*,*,*,*,z10")])
5717 ; mulsidi3 instruction pattern(s).
5720 (define_insn "mulsidi3"
5721 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
5722 (mult:DI (sign_extend:DI
5723 (match_operand:SI 1 "register_operand" "%0,0,0"))
5725 (match_operand:SI 2 "nonimmediate_operand" "d,R,T"))))]
5731 [(set_attr "op_type" "RR,RX,RXY")
5732 (set_attr "type" "imulsi")
5733 (set_attr "cpu_facility" "*,*,z10")])
5736 ; umul instruction pattern(s).
5739 ; mlr, ml, mlgr, mlg
5740 (define_insn "umul<dwh><mode>3"
5741 [(set (match_operand:DW 0 "register_operand" "=d, d")
5742 (mult:DW (zero_extend:DW
5743 (match_operand:<DWH> 1 "register_operand" "%0, 0"))
5745 (match_operand:<DWH> 2 "nonimmediate_operand" " d,RT"))))]
5750 [(set_attr "op_type" "RRE,RXY")
5751 (set_attr "type" "imul<dwh>")])
5754 ; mul(tf|df|sf|td|dd)3 instruction pattern(s).
5757 ; mxbr, mdbr, meebr, mxb, mxb, meeb, mdtr, mxtr
5758 (define_insn "mul<mode>3"
5759 [(set (match_operand:FP 0 "register_operand" "=f,f")
5760 (mult:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
5761 (match_operand:FP 2 "general_operand" "f,<Rf>")))]
5764 m<xdee><bt>r\t%0,<op1>%2
5766 [(set_attr "op_type" "<RRer>,RXE")
5767 (set_attr "type" "fmul<mode>")])
5769 ; madbr, maebr, maxb, madb, maeb
5770 (define_insn "fma<mode>4"
5771 [(set (match_operand:DSF 0 "register_operand" "=f,f")
5772 (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f")
5773 (match_operand:DSF 2 "nonimmediate_operand" "f,R")
5774 (match_operand:DSF 3 "register_operand" "0,0")))]
5779 [(set_attr "op_type" "RRE,RXE")
5780 (set_attr "type" "fmadd<mode>")])
5782 ; msxbr, msdbr, msebr, msxb, msdb, mseb
5783 (define_insn "fms<mode>4"
5784 [(set (match_operand:DSF 0 "register_operand" "=f,f")
5785 (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f")
5786 (match_operand:DSF 2 "nonimmediate_operand" "f,R")
5787 (neg:DSF (match_operand:DSF 3 "register_operand" "0,0"))))]
5792 [(set_attr "op_type" "RRE,RXE")
5793 (set_attr "type" "fmadd<mode>")])
5796 ;;- Divide and modulo instructions.
5800 ; divmoddi4 instruction pattern(s).
5803 (define_expand "divmoddi4"
5804 [(parallel [(set (match_operand:DI 0 "general_operand" "")
5805 (div:DI (match_operand:DI 1 "register_operand" "")
5806 (match_operand:DI 2 "general_operand" "")))
5807 (set (match_operand:DI 3 "general_operand" "")
5808 (mod:DI (match_dup 1) (match_dup 2)))])
5809 (clobber (match_dup 4))]
5812 rtx insn, div_equal, mod_equal;
5814 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
5815 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
5817 operands[4] = gen_reg_rtx(TImode);
5818 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
5820 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
5821 set_unique_reg_note (insn, REG_EQUAL, div_equal);
5823 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
5824 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
5829 (define_insn "divmodtidi3"
5830 [(set (match_operand:TI 0 "register_operand" "=d,d")
5834 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
5835 (match_operand:DI 2 "general_operand" "d,RT")))
5837 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
5842 [(set_attr "op_type" "RRE,RXY")
5843 (set_attr "type" "idiv")])
5845 (define_insn "divmodtisi3"
5846 [(set (match_operand:TI 0 "register_operand" "=d,d")
5850 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
5852 (match_operand:SI 2 "nonimmediate_operand" "d,RT"))))
5855 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
5860 [(set_attr "op_type" "RRE,RXY")
5861 (set_attr "type" "idiv")])
5864 ; udivmoddi4 instruction pattern(s).
5867 (define_expand "udivmoddi4"
5868 [(parallel [(set (match_operand:DI 0 "general_operand" "")
5869 (udiv:DI (match_operand:DI 1 "general_operand" "")
5870 (match_operand:DI 2 "nonimmediate_operand" "")))
5871 (set (match_operand:DI 3 "general_operand" "")
5872 (umod:DI (match_dup 1) (match_dup 2)))])
5873 (clobber (match_dup 4))]
5876 rtx insn, div_equal, mod_equal, equal;
5878 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
5879 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
5880 equal = gen_rtx_IOR (TImode,
5881 gen_rtx_ASHIFT (TImode,
5882 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
5884 gen_rtx_ZERO_EXTEND (TImode, div_equal));
5886 operands[4] = gen_reg_rtx(TImode);
5887 emit_clobber (operands[4]);
5888 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
5889 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
5891 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
5892 set_unique_reg_note (insn, REG_EQUAL, equal);
5894 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
5895 set_unique_reg_note (insn, REG_EQUAL, div_equal);
5897 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
5898 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
5903 (define_insn "udivmodtidi3"
5904 [(set (match_operand:TI 0 "register_operand" "=d,d")
5909 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
5911 (match_operand:DI 2 "nonimmediate_operand" "d,RT")))))
5915 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
5920 [(set_attr "op_type" "RRE,RXY")
5921 (set_attr "type" "idiv")])
5924 ; divmodsi4 instruction pattern(s).
5927 (define_expand "divmodsi4"
5928 [(parallel [(set (match_operand:SI 0 "general_operand" "")
5929 (div:SI (match_operand:SI 1 "general_operand" "")
5930 (match_operand:SI 2 "nonimmediate_operand" "")))
5931 (set (match_operand:SI 3 "general_operand" "")
5932 (mod:SI (match_dup 1) (match_dup 2)))])
5933 (clobber (match_dup 4))]
5936 rtx insn, div_equal, mod_equal, equal;
5938 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
5939 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
5940 equal = gen_rtx_IOR (DImode,
5941 gen_rtx_ASHIFT (DImode,
5942 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
5944 gen_rtx_ZERO_EXTEND (DImode, div_equal));
5946 operands[4] = gen_reg_rtx(DImode);
5947 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
5949 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
5950 set_unique_reg_note (insn, REG_EQUAL, equal);
5952 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
5953 set_unique_reg_note (insn, REG_EQUAL, div_equal);
5955 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
5956 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
5961 (define_insn "divmoddisi3"
5962 [(set (match_operand:DI 0 "register_operand" "=d,d")
5967 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
5969 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
5973 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
5978 [(set_attr "op_type" "RR,RX")
5979 (set_attr "type" "idiv")])
5982 ; udivsi3 and umodsi3 instruction pattern(s).
5985 (define_expand "udivmodsi4"
5986 [(parallel [(set (match_operand:SI 0 "general_operand" "")
5987 (udiv:SI (match_operand:SI 1 "general_operand" "")
5988 (match_operand:SI 2 "nonimmediate_operand" "")))
5989 (set (match_operand:SI 3 "general_operand" "")
5990 (umod:SI (match_dup 1) (match_dup 2)))])
5991 (clobber (match_dup 4))]
5992 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
5994 rtx insn, div_equal, mod_equal, equal;
5996 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
5997 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
5998 equal = gen_rtx_IOR (DImode,
5999 gen_rtx_ASHIFT (DImode,
6000 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
6002 gen_rtx_ZERO_EXTEND (DImode, div_equal));
6004 operands[4] = gen_reg_rtx(DImode);
6005 emit_clobber (operands[4]);
6006 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
6007 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
6009 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
6010 set_unique_reg_note (insn, REG_EQUAL, equal);
6012 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
6013 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6015 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
6016 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6021 (define_insn "udivmoddisi3"
6022 [(set (match_operand:DI 0 "register_operand" "=d,d")
6027 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
6029 (match_operand:SI 2 "nonimmediate_operand" "d,RT")))))
6033 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
6034 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
6038 [(set_attr "op_type" "RRE,RXY")
6039 (set_attr "type" "idiv")])
6041 (define_expand "udivsi3"
6042 [(set (match_operand:SI 0 "register_operand" "=d")
6043 (udiv:SI (match_operand:SI 1 "general_operand" "")
6044 (match_operand:SI 2 "general_operand" "")))
6045 (clobber (match_dup 3))]
6046 "!TARGET_ZARCH && !TARGET_CPU_ZARCH"
6048 rtx insn, udiv_equal, umod_equal, equal;
6050 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6051 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6052 equal = gen_rtx_IOR (DImode,
6053 gen_rtx_ASHIFT (DImode,
6054 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
6056 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
6058 operands[3] = gen_reg_rtx (DImode);
6060 if (CONSTANT_P (operands[2]))
6062 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
6064 rtx label1 = gen_label_rtx ();
6066 operands[1] = make_safe_from (operands[1], operands[0]);
6067 emit_move_insn (operands[0], const0_rtx);
6068 emit_cmp_and_jump_insns (operands[1], operands[2], LT, NULL_RTX,
6070 emit_move_insn (operands[0], const1_rtx);
6071 emit_label (label1);
6075 operands[2] = force_reg (SImode, operands[2]);
6076 operands[2] = make_safe_from (operands[2], operands[0]);
6078 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6079 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6081 set_unique_reg_note (insn, REG_EQUAL, equal);
6083 insn = emit_move_insn (operands[0],
6084 gen_lowpart (SImode, operands[3]));
6085 set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
6090 rtx label1 = gen_label_rtx ();
6091 rtx label2 = gen_label_rtx ();
6092 rtx label3 = gen_label_rtx ();
6094 operands[1] = force_reg (SImode, operands[1]);
6095 operands[1] = make_safe_from (operands[1], operands[0]);
6096 operands[2] = force_reg (SImode, operands[2]);
6097 operands[2] = make_safe_from (operands[2], operands[0]);
6099 emit_move_insn (operands[0], const0_rtx);
6100 emit_cmp_and_jump_insns (operands[2], operands[1], GT, NULL_RTX,
6102 emit_cmp_and_jump_insns (operands[2], const0_rtx, LT, NULL_RTX,
6104 emit_cmp_and_jump_insns (operands[2], const1_rtx, EQ, NULL_RTX,
6106 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6107 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6109 set_unique_reg_note (insn, REG_EQUAL, equal);
6111 insn = emit_move_insn (operands[0],
6112 gen_lowpart (SImode, operands[3]));
6113 set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
6116 emit_label (label1);
6117 emit_move_insn (operands[0], operands[1]);
6119 emit_label (label2);
6120 emit_move_insn (operands[0], const1_rtx);
6121 emit_label (label3);
6123 emit_move_insn (operands[0], operands[0]);
6127 (define_expand "umodsi3"
6128 [(set (match_operand:SI 0 "register_operand" "=d")
6129 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
6130 (match_operand:SI 2 "nonimmediate_operand" "")))
6131 (clobber (match_dup 3))]
6132 "!TARGET_ZARCH && !TARGET_CPU_ZARCH"
6134 rtx insn, udiv_equal, umod_equal, equal;
6136 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6137 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6138 equal = gen_rtx_IOR (DImode,
6139 gen_rtx_ASHIFT (DImode,
6140 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
6142 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
6144 operands[3] = gen_reg_rtx (DImode);
6146 if (CONSTANT_P (operands[2]))
6148 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
6150 rtx label1 = gen_label_rtx ();
6152 operands[1] = make_safe_from (operands[1], operands[0]);
6153 emit_move_insn (operands[0], operands[1]);
6154 emit_cmp_and_jump_insns (operands[0], operands[2], LT, NULL_RTX,
6156 emit_insn (gen_abssi2 (operands[0], operands[2]));
6157 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
6158 emit_label (label1);
6162 operands[2] = force_reg (SImode, operands[2]);
6163 operands[2] = make_safe_from (operands[2], operands[0]);
6165 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6166 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6168 set_unique_reg_note (insn, REG_EQUAL, equal);
6170 insn = emit_move_insn (operands[0],
6171 gen_highpart (SImode, operands[3]));
6172 set_unique_reg_note (insn, REG_EQUAL, umod_equal);
6177 rtx label1 = gen_label_rtx ();
6178 rtx label2 = gen_label_rtx ();
6179 rtx label3 = gen_label_rtx ();
6181 operands[1] = force_reg (SImode, operands[1]);
6182 operands[1] = make_safe_from (operands[1], operands[0]);
6183 operands[2] = force_reg (SImode, operands[2]);
6184 operands[2] = make_safe_from (operands[2], operands[0]);
6186 emit_move_insn(operands[0], operands[1]);
6187 emit_cmp_and_jump_insns (operands[2], operands[1], GT, NULL_RTX,
6189 emit_cmp_and_jump_insns (operands[2], const0_rtx, LT, NULL_RTX,
6191 emit_cmp_and_jump_insns (operands[2], const1_rtx, EQ, NULL_RTX,
6193 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6194 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6196 set_unique_reg_note (insn, REG_EQUAL, equal);
6198 insn = emit_move_insn (operands[0],
6199 gen_highpart (SImode, operands[3]));
6200 set_unique_reg_note (insn, REG_EQUAL, umod_equal);
6203 emit_label (label1);
6204 emit_move_insn (operands[0], const0_rtx);
6206 emit_label (label2);
6207 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
6208 emit_label (label3);
6214 ; div(df|sf)3 instruction pattern(s).
6217 ; dxbr, ddbr, debr, dxb, ddb, deb, ddtr, dxtr
6218 (define_insn "div<mode>3"
6219 [(set (match_operand:FP 0 "register_operand" "=f,f")
6220 (div:FP (match_operand:FP 1 "register_operand" "<f0>,0")
6221 (match_operand:FP 2 "general_operand" "f,<Rf>")))]
6224 d<xde><bt>r\t%0,<op1>%2
6226 [(set_attr "op_type" "<RRer>,RXE")
6227 (set_attr "type" "fdiv<mode>")])
6231 ;;- And instructions.
6234 (define_expand "and<mode>3"
6235 [(set (match_operand:INT 0 "nonimmediate_operand" "")
6236 (and:INT (match_operand:INT 1 "nonimmediate_operand" "")
6237 (match_operand:INT 2 "general_operand" "")))
6238 (clobber (reg:CC CC_REGNUM))]
6240 "s390_expand_logical_operator (AND, <MODE>mode, operands); DONE;")
6243 ; anddi3 instruction pattern(s).
6246 (define_insn "*anddi3_cc"
6247 [(set (reg CC_REGNUM)
6249 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0, d")
6250 (match_operand:DI 2 "general_operand" " d,d,RT,NxxDq"))
6252 (set (match_operand:DI 0 "register_operand" "=d,d, d, d")
6253 (and:DI (match_dup 1) (match_dup 2)))]
6254 "TARGET_ZARCH && s390_match_ccmode(insn, CCTmode)"
6259 risbg\t%0,%1,%s2,128+%e2,0"
6260 [(set_attr "op_type" "RRE,RRF,RXY,RIE")
6261 (set_attr "cpu_facility" "*,z196,*,z10")
6262 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
6264 (define_insn "*anddi3_cconly"
6265 [(set (reg CC_REGNUM)
6267 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0, d")
6268 (match_operand:DI 2 "general_operand" " d,d,RT,NxxDq"))
6270 (clobber (match_scratch:DI 0 "=d,d, d, d"))]
6272 && s390_match_ccmode(insn, CCTmode)
6273 /* Do not steal TM patterns. */
6274 && s390_single_part (operands[2], DImode, HImode, 0) < 0"
6279 risbg\t%0,%1,%s2,128+%e2,0"
6280 [(set_attr "op_type" "RRE,RRF,RXY,RIE")
6281 (set_attr "cpu_facility" "*,z196,*,z10")
6282 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
6284 (define_insn "*anddi3"
6285 [(set (match_operand:DI 0 "nonimmediate_operand"
6286 "=d,d, d, d, d, d, d, d,d,d, d, d, AQ,Q")
6288 (match_operand:DI 1 "nonimmediate_operand"
6289 "%d,o, 0, 0, 0, 0, 0, 0,0,d, 0, d, 0,0")
6290 (match_operand:DI 2 "general_operand"
6291 "M, M,N0HDF,N1HDF,N2HDF,N3HDF,N0SDF,N1SDF,d,d,RT,NxxDq,NxQDF,Q")))
6292 (clobber (reg:CC CC_REGNUM))]
6293 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6306 risbg\t%0,%1,%s2,128+%e2,0
6309 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,RIE,SI,SS")
6310 (set_attr "cpu_facility" "*,*,*,*,*,*,extimm,extimm,*,z196,*,z10,*,*")
6311 (set_attr "z10prop" "*,
6327 [(set (match_operand:DI 0 "s_operand" "")
6328 (and:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
6329 (clobber (reg:CC CC_REGNUM))]
6332 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
6333 (clobber (reg:CC CC_REGNUM))])]
6334 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
6336 ;; These two are what combine generates for (ashift (zero_extract)).
6337 (define_insn "*extzv_<mode>_srl"
6338 [(set (match_operand:GPR 0 "register_operand" "=d")
6339 (and:GPR (lshiftrt:GPR
6340 (match_operand:GPR 1 "register_operand" "d")
6341 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
6342 (match_operand:GPR 3 "contiguous_bitmask_operand" "")))
6343 (clobber (reg:CC CC_REGNUM))]
6345 /* Note that even for the SImode pattern, the rotate is always DImode. */
6346 && s390_extzv_shift_ok (<bitsize>, -INTVAL (operands[2]),
6347 INTVAL (operands[3]))"
6348 "risbg\t%0,%1,%<bfstart>3,128+%<bfend>3,64-%2"
6349 [(set_attr "op_type" "RIE")
6350 (set_attr "z10prop" "z10_super_E1")])
6352 (define_insn "*extzv_<mode>_sll"
6353 [(set (match_operand:GPR 0 "register_operand" "=d")
6354 (and:GPR (ashift:GPR
6355 (match_operand:GPR 1 "register_operand" "d")
6356 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
6357 (match_operand:GPR 3 "contiguous_bitmask_operand" "")))
6358 (clobber (reg:CC CC_REGNUM))]
6360 && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[2]),
6361 INTVAL (operands[3]))"
6362 "risbg\t%0,%1,%<bfstart>3,128+%<bfend>3,%2"
6363 [(set_attr "op_type" "RIE")
6364 (set_attr "z10prop" "z10_super_E1")])
6368 ; andsi3 instruction pattern(s).
6371 (define_insn "*andsi3_cc"
6372 [(set (reg CC_REGNUM)
6375 (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d")
6376 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq"))
6378 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d, d")
6379 (and:SI (match_dup 1) (match_dup 2)))]
6380 "s390_match_ccmode(insn, CCTmode)"
6387 risbg\t%0,%1,%t2,128+%f2,0"
6388 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE")
6389 (set_attr "cpu_facility" "*,*,z196,*,*,z10")
6390 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
6391 z10_super_E1,z10_super_E1,z10_super_E1")])
6393 (define_insn "*andsi3_cconly"
6394 [(set (reg CC_REGNUM)
6397 (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d")
6398 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq"))
6400 (clobber (match_scratch:SI 0 "=d,d,d,d,d, d"))]
6401 "s390_match_ccmode(insn, CCTmode)
6402 /* Do not steal TM patterns. */
6403 && s390_single_part (operands[2], SImode, HImode, 0) < 0"
6410 risbg\t%0,%1,%t2,128+%f2,0"
6411 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE")
6412 (set_attr "cpu_facility" "*,*,z196,*,*,z10")
6413 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
6414 z10_super_E1,z10_super_E1,z10_super_E1")])
6416 (define_insn "*andsi3_zarch"
6417 [(set (match_operand:SI 0 "nonimmediate_operand"
6418 "=d,d, d, d, d,d,d,d,d, d, AQ,Q")
6419 (and:SI (match_operand:SI 1 "nonimmediate_operand"
6420 "%d,o, 0, 0, 0,0,d,0,0, d, 0,0")
6421 (match_operand:SI 2 "general_operand"
6422 " M,M,N0HSF,N1HSF,Os,d,d,R,T,NxxSq,NxQSF,Q")))
6423 (clobber (reg:CC CC_REGNUM))]
6424 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6435 risbg\t%0,%1,%t2,128+%f2,0
6438 [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RRF,RX,RXY,RIE,SI,SS")
6439 (set_attr "cpu_facility" "*,*,*,*,*,*,z196,*,*,z10,*,*")
6440 (set_attr "z10prop" "*,
6453 (define_insn "*andsi3_esa"
6454 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d, AQ,Q")
6455 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0, 0,0")
6456 (match_operand:SI 2 "general_operand" " d,R,NxQSF,Q")))
6457 (clobber (reg:CC CC_REGNUM))]
6458 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6464 [(set_attr "op_type" "RR,RX,SI,SS")
6465 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
6469 [(set (match_operand:SI 0 "s_operand" "")
6470 (and:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
6471 (clobber (reg:CC CC_REGNUM))]
6474 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
6475 (clobber (reg:CC CC_REGNUM))])]
6476 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
6479 ; andhi3 instruction pattern(s).
6482 (define_insn "*andhi3_zarch"
6483 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
6484 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0")
6485 (match_operand:HI 2 "general_operand" " d,d,n,NxQHF,Q")))
6486 (clobber (reg:CC CC_REGNUM))]
6487 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6494 [(set_attr "op_type" "RR,RRF,RI,SI,SS")
6495 (set_attr "cpu_facility" "*,z196,*,*,*")
6496 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*")
6499 (define_insn "*andhi3_esa"
6500 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
6501 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
6502 (match_operand:HI 2 "general_operand" "d,NxQHF,Q")))
6503 (clobber (reg:CC CC_REGNUM))]
6504 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6509 [(set_attr "op_type" "RR,SI,SS")
6510 (set_attr "z10prop" "z10_super_E1,*,*")
6514 [(set (match_operand:HI 0 "s_operand" "")
6515 (and:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
6516 (clobber (reg:CC CC_REGNUM))]
6519 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
6520 (clobber (reg:CC CC_REGNUM))])]
6521 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
6524 ; andqi3 instruction pattern(s).
6527 (define_insn "*andqi3_zarch"
6528 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
6529 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0")
6530 (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q")))
6531 (clobber (reg:CC CC_REGNUM))]
6532 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6540 [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS")
6541 (set_attr "cpu_facility" "*,z196,*,*,*,*")
6542 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super,z10_super,*")])
6544 (define_insn "*andqi3_esa"
6545 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
6546 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
6547 (match_operand:QI 2 "general_operand" "d,n,Q")))
6548 (clobber (reg:CC CC_REGNUM))]
6549 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6554 [(set_attr "op_type" "RR,SI,SS")
6555 (set_attr "z10prop" "z10_super_E1,z10_super,*")])
6558 ; Block and (NC) patterns.
6562 [(set (match_operand:BLK 0 "memory_operand" "=Q")
6563 (and:BLK (match_dup 0)
6564 (match_operand:BLK 1 "memory_operand" "Q")))
6565 (use (match_operand 2 "const_int_operand" "n"))
6566 (clobber (reg:CC CC_REGNUM))]
6567 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
6568 "nc\t%O0(%2,%R0),%S1"
6569 [(set_attr "op_type" "SS")
6570 (set_attr "z196prop" "z196_cracked")])
6573 [(set (match_operand 0 "memory_operand" "")
6575 (match_operand 1 "memory_operand" "")))
6576 (clobber (reg:CC CC_REGNUM))]
6578 && GET_MODE (operands[0]) == GET_MODE (operands[1])
6579 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
6581 [(set (match_dup 0) (and:BLK (match_dup 0) (match_dup 1)))
6583 (clobber (reg:CC CC_REGNUM))])]
6585 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
6586 operands[0] = adjust_address (operands[0], BLKmode, 0);
6587 operands[1] = adjust_address (operands[1], BLKmode, 0);
6592 [(set (match_operand:BLK 0 "memory_operand" "")
6593 (and:BLK (match_dup 0)
6594 (match_operand:BLK 1 "memory_operand" "")))
6595 (use (match_operand 2 "const_int_operand" ""))
6596 (clobber (reg:CC CC_REGNUM))])
6598 [(set (match_operand:BLK 3 "memory_operand" "")
6599 (and:BLK (match_dup 3)
6600 (match_operand:BLK 4 "memory_operand" "")))
6601 (use (match_operand 5 "const_int_operand" ""))
6602 (clobber (reg:CC CC_REGNUM))])]
6603 "s390_offset_p (operands[0], operands[3], operands[2])
6604 && s390_offset_p (operands[1], operands[4], operands[2])
6605 && !s390_overlap_p (operands[0], operands[1],
6606 INTVAL (operands[2]) + INTVAL (operands[5]))
6607 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
6609 [(set (match_dup 6) (and:BLK (match_dup 6) (match_dup 7)))
6611 (clobber (reg:CC CC_REGNUM))])]
6612 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
6613 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
6614 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
6618 ;;- Bit set (inclusive or) instructions.
6621 (define_expand "ior<mode>3"
6622 [(set (match_operand:INT 0 "nonimmediate_operand" "")
6623 (ior:INT (match_operand:INT 1 "nonimmediate_operand" "")
6624 (match_operand:INT 2 "general_operand" "")))
6625 (clobber (reg:CC CC_REGNUM))]
6627 "s390_expand_logical_operator (IOR, <MODE>mode, operands); DONE;")
6630 ; iordi3 instruction pattern(s).
6633 (define_insn "*iordi3_cc"
6634 [(set (reg CC_REGNUM)
6635 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
6636 (match_operand:DI 2 "general_operand" " d,d,RT"))
6638 (set (match_operand:DI 0 "register_operand" "=d,d, d")
6639 (ior:DI (match_dup 1) (match_dup 2)))]
6640 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
6645 [(set_attr "op_type" "RRE,RRF,RXY")
6646 (set_attr "cpu_facility" "*,z196,*")
6647 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
6649 (define_insn "*iordi3_cconly"
6650 [(set (reg CC_REGNUM)
6651 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0")
6652 (match_operand:DI 2 "general_operand" " d,d,RT"))
6654 (clobber (match_scratch:DI 0 "=d,d,d"))]
6655 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
6660 [(set_attr "op_type" "RRE,RRF,RXY")
6661 (set_attr "cpu_facility" "*,z196,*")
6662 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
6664 (define_insn "*iordi3"
6665 [(set (match_operand:DI 0 "nonimmediate_operand"
6666 "=d, d, d, d, d, d,d,d, d, AQ,Q")
6667 (ior:DI (match_operand:DI 1 "nonimmediate_operand"
6668 " %0, 0, 0, 0, 0, 0,0,d, 0, 0,0")
6669 (match_operand:DI 2 "general_operand"
6670 "N0HD0,N1HD0,N2HD0,N3HD0,N0SD0,N1SD0,d,d,RT,NxQD0,Q")))
6671 (clobber (reg:CC CC_REGNUM))]
6672 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6685 [(set_attr "op_type" "RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,SI,SS")
6686 (set_attr "cpu_facility" "*,*,*,*,extimm,extimm,*,z196,*,*,*")
6687 (set_attr "z10prop" "z10_super_E1,
6700 [(set (match_operand:DI 0 "s_operand" "")
6701 (ior:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
6702 (clobber (reg:CC CC_REGNUM))]
6705 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
6706 (clobber (reg:CC CC_REGNUM))])]
6707 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
6710 ; iorsi3 instruction pattern(s).
6713 (define_insn "*iorsi3_cc"
6714 [(set (reg CC_REGNUM)
6715 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
6716 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
6718 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
6719 (ior:SI (match_dup 1) (match_dup 2)))]
6720 "s390_match_ccmode(insn, CCTmode)"
6727 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
6728 (set_attr "cpu_facility" "*,*,z196,*,*")
6729 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")])
6731 (define_insn "*iorsi3_cconly"
6732 [(set (reg CC_REGNUM)
6733 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
6734 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
6736 (clobber (match_scratch:SI 0 "=d,d,d,d,d"))]
6737 "s390_match_ccmode(insn, CCTmode)"
6744 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
6745 (set_attr "cpu_facility" "*,*,z196,*,*")
6746 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")])
6748 (define_insn "*iorsi3_zarch"
6749 [(set (match_operand:SI 0 "nonimmediate_operand" "=d, d, d,d,d,d,d, AQ,Q")
6750 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0, 0, 0,0,d,0,0, 0,0")
6751 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,Os,d,d,R,T,NxQS0,Q")))
6752 (clobber (reg:CC CC_REGNUM))]
6753 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6764 [(set_attr "op_type" "RI,RI,RIL,RR,RRF,RX,RXY,SI,SS")
6765 (set_attr "cpu_facility" "*,*,*,*,z196,*,*,*,*")
6766 (set_attr "z10prop" "z10_super_E1,
6776 (define_insn "*iorsi3_esa"
6777 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
6778 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
6779 (match_operand:SI 2 "general_operand" "d,R,NxQS0,Q")))
6780 (clobber (reg:CC CC_REGNUM))]
6781 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6787 [(set_attr "op_type" "RR,RX,SI,SS")
6788 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
6791 [(set (match_operand:SI 0 "s_operand" "")
6792 (ior:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
6793 (clobber (reg:CC CC_REGNUM))]
6796 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
6797 (clobber (reg:CC CC_REGNUM))])]
6798 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
6801 ; iorhi3 instruction pattern(s).
6804 (define_insn "*iorhi3_zarch"
6805 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
6806 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0")
6807 (match_operand:HI 2 "general_operand" " d,d,n,NxQH0,Q")))
6808 (clobber (reg:CC CC_REGNUM))]
6809 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6816 [(set_attr "op_type" "RR,RRF,RI,SI,SS")
6817 (set_attr "cpu_facility" "*,z196,*,*,*")
6818 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*")])
6820 (define_insn "*iorhi3_esa"
6821 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
6822 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
6823 (match_operand:HI 2 "general_operand" "d,NxQH0,Q")))
6824 (clobber (reg:CC CC_REGNUM))]
6825 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6830 [(set_attr "op_type" "RR,SI,SS")
6831 (set_attr "z10prop" "z10_super_E1,*,*")])
6834 [(set (match_operand:HI 0 "s_operand" "")
6835 (ior:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
6836 (clobber (reg:CC CC_REGNUM))]
6839 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
6840 (clobber (reg:CC CC_REGNUM))])]
6841 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
6844 ; iorqi3 instruction pattern(s).
6847 (define_insn "*iorqi3_zarch"
6848 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
6849 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0")
6850 (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q")))
6851 (clobber (reg:CC CC_REGNUM))]
6852 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6860 [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS")
6861 (set_attr "cpu_facility" "*,z196,*,*,*,*")
6862 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,
6863 z10_super,z10_super,*")])
6865 (define_insn "*iorqi3_esa"
6866 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
6867 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
6868 (match_operand:QI 2 "general_operand" "d,n,Q")))
6869 (clobber (reg:CC CC_REGNUM))]
6870 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6875 [(set_attr "op_type" "RR,SI,SS")
6876 (set_attr "z10prop" "z10_super_E1,z10_super,*")])
6879 ; Block inclusive or (OC) patterns.
6883 [(set (match_operand:BLK 0 "memory_operand" "=Q")
6884 (ior:BLK (match_dup 0)
6885 (match_operand:BLK 1 "memory_operand" "Q")))
6886 (use (match_operand 2 "const_int_operand" "n"))
6887 (clobber (reg:CC CC_REGNUM))]
6888 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
6889 "oc\t%O0(%2,%R0),%S1"
6890 [(set_attr "op_type" "SS")
6891 (set_attr "z196prop" "z196_cracked")])
6894 [(set (match_operand 0 "memory_operand" "")
6896 (match_operand 1 "memory_operand" "")))
6897 (clobber (reg:CC CC_REGNUM))]
6899 && GET_MODE (operands[0]) == GET_MODE (operands[1])
6900 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
6902 [(set (match_dup 0) (ior:BLK (match_dup 0) (match_dup 1)))
6904 (clobber (reg:CC CC_REGNUM))])]
6906 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
6907 operands[0] = adjust_address (operands[0], BLKmode, 0);
6908 operands[1] = adjust_address (operands[1], BLKmode, 0);
6913 [(set (match_operand:BLK 0 "memory_operand" "")
6914 (ior:BLK (match_dup 0)
6915 (match_operand:BLK 1 "memory_operand" "")))
6916 (use (match_operand 2 "const_int_operand" ""))
6917 (clobber (reg:CC CC_REGNUM))])
6919 [(set (match_operand:BLK 3 "memory_operand" "")
6920 (ior:BLK (match_dup 3)
6921 (match_operand:BLK 4 "memory_operand" "")))
6922 (use (match_operand 5 "const_int_operand" ""))
6923 (clobber (reg:CC CC_REGNUM))])]
6924 "s390_offset_p (operands[0], operands[3], operands[2])
6925 && s390_offset_p (operands[1], operands[4], operands[2])
6926 && !s390_overlap_p (operands[0], operands[1],
6927 INTVAL (operands[2]) + INTVAL (operands[5]))
6928 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
6930 [(set (match_dup 6) (ior:BLK (match_dup 6) (match_dup 7)))
6932 (clobber (reg:CC CC_REGNUM))])]
6933 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
6934 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
6935 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
6939 ;;- Xor instructions.
6942 (define_expand "xor<mode>3"
6943 [(set (match_operand:INT 0 "nonimmediate_operand" "")
6944 (xor:INT (match_operand:INT 1 "nonimmediate_operand" "")
6945 (match_operand:INT 2 "general_operand" "")))
6946 (clobber (reg:CC CC_REGNUM))]
6948 "s390_expand_logical_operator (XOR, <MODE>mode, operands); DONE;")
6951 ; xordi3 instruction pattern(s).
6954 (define_insn "*xordi3_cc"
6955 [(set (reg CC_REGNUM)
6956 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
6957 (match_operand:DI 2 "general_operand" " d,d,RT"))
6959 (set (match_operand:DI 0 "register_operand" "=d,d, d")
6960 (xor:DI (match_dup 1) (match_dup 2)))]
6961 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
6966 [(set_attr "op_type" "RRE,RRF,RXY")
6967 (set_attr "cpu_facility" "*,z196,*")
6968 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
6970 (define_insn "*xordi3_cconly"
6971 [(set (reg CC_REGNUM)
6972 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
6973 (match_operand:DI 2 "general_operand" " d,d,RT"))
6975 (clobber (match_scratch:DI 0 "=d,d, d"))]
6976 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
6981 [(set_attr "op_type" "RRE,RRF,RXY")
6982 (set_attr "cpu_facility" "*,z196,*")
6983 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
6985 (define_insn "*xordi3"
6986 [(set (match_operand:DI 0 "nonimmediate_operand" "=d, d,d,d, d, AQ,Q")
6987 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0, 0,0,d, 0, 0,0")
6988 (match_operand:DI 2 "general_operand" "N0SD0,N1SD0,d,d,RT,NxQD0,Q")))
6989 (clobber (reg:CC CC_REGNUM))]
6990 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6999 [(set_attr "op_type" "RIL,RIL,RRE,RRF,RXY,SI,SS")
7000 (set_attr "cpu_facility" "extimm,extimm,*,z196,*,*,*")
7001 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,
7002 *,z10_super_E1,*,*")])
7005 [(set (match_operand:DI 0 "s_operand" "")
7006 (xor:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
7007 (clobber (reg:CC CC_REGNUM))]
7010 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7011 (clobber (reg:CC CC_REGNUM))])]
7012 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7015 ; xorsi3 instruction pattern(s).
7018 (define_insn "*xorsi3_cc"
7019 [(set (reg CC_REGNUM)
7020 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7021 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7023 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
7024 (xor:SI (match_dup 1) (match_dup 2)))]
7025 "s390_match_ccmode(insn, CCTmode)"
7032 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7033 (set_attr "cpu_facility" "*,*,z196,*,*")
7034 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7035 z10_super_E1,z10_super_E1")])
7037 (define_insn "*xorsi3_cconly"
7038 [(set (reg CC_REGNUM)
7039 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7040 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7042 (clobber (match_scratch:SI 0 "=d,d,d,d,d"))]
7043 "s390_match_ccmode(insn, CCTmode)"
7050 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7051 (set_attr "cpu_facility" "*,*,z196,*,*")
7052 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7053 z10_super_E1,z10_super_E1")])
7055 (define_insn "*xorsi3"
7056 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d, AQ,Q")
7057 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, 0,0")
7058 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxQS0,Q")))
7059 (clobber (reg:CC CC_REGNUM))]
7060 "s390_logical_operator_ok_p (operands)"
7069 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,SI,SS")
7070 (set_attr "cpu_facility" "*,*,z196,*,*,*,*")
7071 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7072 z10_super_E1,z10_super_E1,*,*")])
7075 [(set (match_operand:SI 0 "s_operand" "")
7076 (xor:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7077 (clobber (reg:CC CC_REGNUM))]
7080 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7081 (clobber (reg:CC CC_REGNUM))])]
7082 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7085 ; xorhi3 instruction pattern(s).
7088 (define_insn "*xorhi3"
7089 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7090 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,d, 0,0")
7091 (match_operand:HI 2 "general_operand" "Os,d,d,NxQH0,Q")))
7092 (clobber (reg:CC CC_REGNUM))]
7093 "s390_logical_operator_ok_p (operands)"
7100 [(set_attr "op_type" "RIL,RR,RRF,SI,SS")
7101 (set_attr "cpu_facility" "*,*,z196,*,*")
7102 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*,*")])
7105 [(set (match_operand:HI 0 "s_operand" "")
7106 (xor:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7107 (clobber (reg:CC CC_REGNUM))]
7110 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7111 (clobber (reg:CC CC_REGNUM))])]
7112 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7115 ; xorqi3 instruction pattern(s).
7118 (define_insn "*xorqi3"
7119 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7120 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,d,0,0,0")
7121 (match_operand:QI 2 "general_operand" "Os,d,d,n,n,Q")))
7122 (clobber (reg:CC CC_REGNUM))]
7123 "s390_logical_operator_ok_p (operands)"
7131 [(set_attr "op_type" "RIL,RR,RRF,SI,SIY,SS")
7132 (set_attr "cpu_facility" "*,*,z196,*,*,*")
7133 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super,z10_super,*")])
7137 ; Block exclusive or (XC) patterns.
7141 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7142 (xor:BLK (match_dup 0)
7143 (match_operand:BLK 1 "memory_operand" "Q")))
7144 (use (match_operand 2 "const_int_operand" "n"))
7145 (clobber (reg:CC CC_REGNUM))]
7146 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7147 "xc\t%O0(%2,%R0),%S1"
7148 [(set_attr "op_type" "SS")])
7151 [(set (match_operand 0 "memory_operand" "")
7153 (match_operand 1 "memory_operand" "")))
7154 (clobber (reg:CC CC_REGNUM))]
7156 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7157 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7159 [(set (match_dup 0) (xor:BLK (match_dup 0) (match_dup 1)))
7161 (clobber (reg:CC CC_REGNUM))])]
7163 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7164 operands[0] = adjust_address (operands[0], BLKmode, 0);
7165 operands[1] = adjust_address (operands[1], BLKmode, 0);
7170 [(set (match_operand:BLK 0 "memory_operand" "")
7171 (xor:BLK (match_dup 0)
7172 (match_operand:BLK 1 "memory_operand" "")))
7173 (use (match_operand 2 "const_int_operand" ""))
7174 (clobber (reg:CC CC_REGNUM))])
7176 [(set (match_operand:BLK 3 "memory_operand" "")
7177 (xor:BLK (match_dup 3)
7178 (match_operand:BLK 4 "memory_operand" "")))
7179 (use (match_operand 5 "const_int_operand" ""))
7180 (clobber (reg:CC CC_REGNUM))])]
7181 "s390_offset_p (operands[0], operands[3], operands[2])
7182 && s390_offset_p (operands[1], operands[4], operands[2])
7183 && !s390_overlap_p (operands[0], operands[1],
7184 INTVAL (operands[2]) + INTVAL (operands[5]))
7185 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7187 [(set (match_dup 6) (xor:BLK (match_dup 6) (match_dup 7)))
7189 (clobber (reg:CC CC_REGNUM))])]
7190 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7191 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7192 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7195 ; Block xor (XC) patterns with src == dest.
7198 (define_insn "*xc_zero"
7199 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7201 (use (match_operand 1 "const_int_operand" "n"))
7202 (clobber (reg:CC CC_REGNUM))]
7203 "INTVAL (operands[1]) >= 1 && INTVAL (operands[1]) <= 256"
7204 "xc\t%O0(%1,%R0),%S0"
7205 [(set_attr "op_type" "SS")
7206 (set_attr "z196prop" "z196_cracked")])
7210 [(set (match_operand:BLK 0 "memory_operand" "")
7212 (use (match_operand 1 "const_int_operand" ""))
7213 (clobber (reg:CC CC_REGNUM))])
7215 [(set (match_operand:BLK 2 "memory_operand" "")
7217 (use (match_operand 3 "const_int_operand" ""))
7218 (clobber (reg:CC CC_REGNUM))])]
7219 "s390_offset_p (operands[0], operands[2], operands[1])
7220 && INTVAL (operands[1]) + INTVAL (operands[3]) <= 256"
7222 [(set (match_dup 4) (const_int 0))
7224 (clobber (reg:CC CC_REGNUM))])]
7225 "operands[4] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7226 operands[5] = GEN_INT (INTVAL (operands[1]) + INTVAL (operands[3]));")
7230 ;;- Negate instructions.
7234 ; neg(di|si)2 instruction pattern(s).
7237 (define_expand "neg<mode>2"
7239 [(set (match_operand:DSI 0 "register_operand" "=d")
7240 (neg:DSI (match_operand:DSI 1 "register_operand" "d")))
7241 (clobber (reg:CC CC_REGNUM))])]
7245 (define_insn "*negdi2_sign_cc"
7246 [(set (reg CC_REGNUM)
7247 (compare (neg:DI (ashiftrt:DI (ashift:DI (subreg:DI
7248 (match_operand:SI 1 "register_operand" "d") 0)
7249 (const_int 32)) (const_int 32)))
7251 (set (match_operand:DI 0 "register_operand" "=d")
7252 (neg:DI (sign_extend:DI (match_dup 1))))]
7253 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
7255 [(set_attr "op_type" "RRE")
7256 (set_attr "z10prop" "z10_c")])
7258 (define_insn "*negdi2_sign"
7259 [(set (match_operand:DI 0 "register_operand" "=d")
7260 (neg:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
7261 (clobber (reg:CC CC_REGNUM))]
7264 [(set_attr "op_type" "RRE")
7265 (set_attr "z10prop" "z10_c")])
7268 (define_insn "*neg<mode>2_cc"
7269 [(set (reg CC_REGNUM)
7270 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
7272 (set (match_operand:GPR 0 "register_operand" "=d")
7273 (neg:GPR (match_dup 1)))]
7274 "s390_match_ccmode (insn, CCAmode)"
7276 [(set_attr "op_type" "RR<E>")
7277 (set_attr "z10prop" "z10_super_c_E1")])
7280 (define_insn "*neg<mode>2_cconly"
7281 [(set (reg CC_REGNUM)
7282 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
7284 (clobber (match_scratch:GPR 0 "=d"))]
7285 "s390_match_ccmode (insn, CCAmode)"
7287 [(set_attr "op_type" "RR<E>")
7288 (set_attr "z10prop" "z10_super_c_E1")])
7291 (define_insn "*neg<mode>2"
7292 [(set (match_operand:GPR 0 "register_operand" "=d")
7293 (neg:GPR (match_operand:GPR 1 "register_operand" "d")))
7294 (clobber (reg:CC CC_REGNUM))]
7297 [(set_attr "op_type" "RR<E>")
7298 (set_attr "z10prop" "z10_super_c_E1")])
7300 (define_insn_and_split "*negdi2_31"
7301 [(set (match_operand:DI 0 "register_operand" "=d")
7302 (neg:DI (match_operand:DI 1 "register_operand" "d")))
7303 (clobber (reg:CC CC_REGNUM))]
7306 "&& reload_completed"
7308 [(set (match_dup 2) (neg:SI (match_dup 3)))
7309 (clobber (reg:CC CC_REGNUM))])
7311 [(set (reg:CCAP CC_REGNUM)
7312 (compare:CCAP (neg:SI (match_dup 5)) (const_int 0)))
7313 (set (match_dup 4) (neg:SI (match_dup 5)))])
7315 (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
7317 (label_ref (match_dup 6))))
7319 [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
7320 (clobber (reg:CC CC_REGNUM))])
7322 "operands[2] = operand_subword (operands[0], 0, 0, DImode);
7323 operands[3] = operand_subword (operands[1], 0, 0, DImode);
7324 operands[4] = operand_subword (operands[0], 1, 0, DImode);
7325 operands[5] = operand_subword (operands[1], 1, 0, DImode);
7326 operands[6] = gen_label_rtx ();")
7329 ; neg(df|sf)2 instruction pattern(s).
7332 (define_expand "neg<mode>2"
7334 [(set (match_operand:BFP 0 "register_operand" "=f")
7335 (neg:BFP (match_operand:BFP 1 "register_operand" "f")))
7336 (clobber (reg:CC CC_REGNUM))])]
7340 ; lcxbr, lcdbr, lcebr
7341 (define_insn "*neg<mode>2_cc"
7342 [(set (reg CC_REGNUM)
7343 (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f"))
7344 (match_operand:BFP 2 "const0_operand" "")))
7345 (set (match_operand:BFP 0 "register_operand" "=f")
7346 (neg:BFP (match_dup 1)))]
7347 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7349 [(set_attr "op_type" "RRE")
7350 (set_attr "type" "fsimp<mode>")])
7352 ; lcxbr, lcdbr, lcebr
7353 (define_insn "*neg<mode>2_cconly"
7354 [(set (reg CC_REGNUM)
7355 (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f"))
7356 (match_operand:BFP 2 "const0_operand" "")))
7357 (clobber (match_scratch:BFP 0 "=f"))]
7358 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7360 [(set_attr "op_type" "RRE")
7361 (set_attr "type" "fsimp<mode>")])
7364 (define_insn "*neg<mode>2_nocc"
7365 [(set (match_operand:FP 0 "register_operand" "=f")
7366 (neg:FP (match_operand:FP 1 "register_operand" "<fT0>")))]
7369 [(set_attr "op_type" "RRE")
7370 (set_attr "type" "fsimp<mode>")])
7372 ; lcxbr, lcdbr, lcebr
7373 (define_insn "*neg<mode>2"
7374 [(set (match_operand:BFP 0 "register_operand" "=f")
7375 (neg:BFP (match_operand:BFP 1 "register_operand" "f")))
7376 (clobber (reg:CC CC_REGNUM))]
7379 [(set_attr "op_type" "RRE")
7380 (set_attr "type" "fsimp<mode>")])
7384 ;;- Absolute value instructions.
7388 ; abs(di|si)2 instruction pattern(s).
7391 (define_insn "*absdi2_sign_cc"
7392 [(set (reg CC_REGNUM)
7393 (compare (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
7394 (match_operand:SI 1 "register_operand" "d") 0)
7395 (const_int 32)) (const_int 32)))
7397 (set (match_operand:DI 0 "register_operand" "=d")
7398 (abs:DI (sign_extend:DI (match_dup 1))))]
7399 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
7401 [(set_attr "op_type" "RRE")
7402 (set_attr "z10prop" "z10_c")])
7404 (define_insn "*absdi2_sign"
7405 [(set (match_operand:DI 0 "register_operand" "=d")
7406 (abs:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
7407 (clobber (reg:CC CC_REGNUM))]
7410 [(set_attr "op_type" "RRE")
7411 (set_attr "z10prop" "z10_c")])
7414 (define_insn "*abs<mode>2_cc"
7415 [(set (reg CC_REGNUM)
7416 (compare (abs:GPR (match_operand:DI 1 "register_operand" "d"))
7418 (set (match_operand:GPR 0 "register_operand" "=d")
7419 (abs:GPR (match_dup 1)))]
7420 "s390_match_ccmode (insn, CCAmode)"
7422 [(set_attr "op_type" "RR<E>")
7423 (set_attr "z10prop" "z10_c")])
7426 (define_insn "*abs<mode>2_cconly"
7427 [(set (reg CC_REGNUM)
7428 (compare (abs:GPR (match_operand:GPR 1 "register_operand" "d"))
7430 (clobber (match_scratch:GPR 0 "=d"))]
7431 "s390_match_ccmode (insn, CCAmode)"
7433 [(set_attr "op_type" "RR<E>")
7434 (set_attr "z10prop" "z10_c")])
7437 (define_insn "abs<mode>2"
7438 [(set (match_operand:GPR 0 "register_operand" "=d")
7439 (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
7440 (clobber (reg:CC CC_REGNUM))]
7443 [(set_attr "op_type" "RR<E>")
7444 (set_attr "z10prop" "z10_c")])
7447 ; abs(df|sf)2 instruction pattern(s).
7450 (define_expand "abs<mode>2"
7452 [(set (match_operand:BFP 0 "register_operand" "=f")
7453 (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
7454 (clobber (reg:CC CC_REGNUM))])]
7458 ; lpxbr, lpdbr, lpebr
7459 (define_insn "*abs<mode>2_cc"
7460 [(set (reg CC_REGNUM)
7461 (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f"))
7462 (match_operand:BFP 2 "const0_operand" "")))
7463 (set (match_operand:BFP 0 "register_operand" "=f")
7464 (abs:BFP (match_dup 1)))]
7465 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7467 [(set_attr "op_type" "RRE")
7468 (set_attr "type" "fsimp<mode>")])
7470 ; lpxbr, lpdbr, lpebr
7471 (define_insn "*abs<mode>2_cconly"
7472 [(set (reg CC_REGNUM)
7473 (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f"))
7474 (match_operand:BFP 2 "const0_operand" "")))
7475 (clobber (match_scratch:BFP 0 "=f"))]
7476 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7478 [(set_attr "op_type" "RRE")
7479 (set_attr "type" "fsimp<mode>")])
7482 (define_insn "*abs<mode>2_nocc"
7483 [(set (match_operand:FP 0 "register_operand" "=f")
7484 (abs:FP (match_operand:FP 1 "register_operand" "<fT0>")))]
7487 [(set_attr "op_type" "RRE")
7488 (set_attr "type" "fsimp<mode>")])
7490 ; lpxbr, lpdbr, lpebr
7491 (define_insn "*abs<mode>2"
7492 [(set (match_operand:BFP 0 "register_operand" "=f")
7493 (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
7494 (clobber (reg:CC CC_REGNUM))]
7497 [(set_attr "op_type" "RRE")
7498 (set_attr "type" "fsimp<mode>")])
7502 ;;- Negated absolute value instructions
7509 (define_insn "*negabsdi2_sign_cc"
7510 [(set (reg CC_REGNUM)
7511 (compare (neg:DI (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
7512 (match_operand:SI 1 "register_operand" "d") 0)
7513 (const_int 32)) (const_int 32))))
7515 (set (match_operand:DI 0 "register_operand" "=d")
7516 (neg:DI (abs:DI (sign_extend:DI (match_dup 1)))))]
7517 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
7519 [(set_attr "op_type" "RRE")
7520 (set_attr "z10prop" "z10_c")])
7522 (define_insn "*negabsdi2_sign"
7523 [(set (match_operand:DI 0 "register_operand" "=d")
7524 (neg:DI (abs:DI (sign_extend:DI
7525 (match_operand:SI 1 "register_operand" "d")))))
7526 (clobber (reg:CC CC_REGNUM))]
7529 [(set_attr "op_type" "RRE")
7530 (set_attr "z10prop" "z10_c")])
7533 (define_insn "*negabs<mode>2_cc"
7534 [(set (reg CC_REGNUM)
7535 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
7537 (set (match_operand:GPR 0 "register_operand" "=d")
7538 (neg:GPR (abs:GPR (match_dup 1))))]
7539 "s390_match_ccmode (insn, CCAmode)"
7541 [(set_attr "op_type" "RR<E>")
7542 (set_attr "z10prop" "z10_c")])
7545 (define_insn "*negabs<mode>2_cconly"
7546 [(set (reg CC_REGNUM)
7547 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
7549 (clobber (match_scratch:GPR 0 "=d"))]
7550 "s390_match_ccmode (insn, CCAmode)"
7552 [(set_attr "op_type" "RR<E>")
7553 (set_attr "z10prop" "z10_c")])
7556 (define_insn "*negabs<mode>2"
7557 [(set (match_operand:GPR 0 "register_operand" "=d")
7558 (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d"))))
7559 (clobber (reg:CC CC_REGNUM))]
7562 [(set_attr "op_type" "RR<E>")
7563 (set_attr "z10prop" "z10_c")])
7569 ; lnxbr, lndbr, lnebr
7570 (define_insn "*negabs<mode>2_cc"
7571 [(set (reg CC_REGNUM)
7572 (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
7573 (match_operand:BFP 2 "const0_operand" "")))
7574 (set (match_operand:BFP 0 "register_operand" "=f")
7575 (neg:BFP (abs:BFP (match_dup 1))))]
7576 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7578 [(set_attr "op_type" "RRE")
7579 (set_attr "type" "fsimp<mode>")])
7581 ; lnxbr, lndbr, lnebr
7582 (define_insn "*negabs<mode>2_cconly"
7583 [(set (reg CC_REGNUM)
7584 (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
7585 (match_operand:BFP 2 "const0_operand" "")))
7586 (clobber (match_scratch:BFP 0 "=f"))]
7587 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7589 [(set_attr "op_type" "RRE")
7590 (set_attr "type" "fsimp<mode>")])
7593 (define_insn "*negabs<mode>2_nocc"
7594 [(set (match_operand:FP 0 "register_operand" "=f")
7595 (neg:FP (abs:FP (match_operand:BFP 1 "register_operand" "<fT0>"))))]
7598 [(set_attr "op_type" "RRE")
7599 (set_attr "type" "fsimp<mode>")])
7601 ; lnxbr, lndbr, lnebr
7602 (define_insn "*negabs<mode>2"
7603 [(set (match_operand:BFP 0 "register_operand" "=f")
7604 (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f"))))
7605 (clobber (reg:CC CC_REGNUM))]
7608 [(set_attr "op_type" "RRE")
7609 (set_attr "type" "fsimp<mode>")])
7612 ;;- Square root instructions.
7616 ; sqrt(df|sf)2 instruction pattern(s).
7619 ; sqxbr, sqdbr, sqebr, sqdb, sqeb
7620 (define_insn "sqrt<mode>2"
7621 [(set (match_operand:BFP 0 "register_operand" "=f,f")
7622 (sqrt:BFP (match_operand:BFP 1 "general_operand" "f,<Rf>")))]
7627 [(set_attr "op_type" "RRE,RXE")
7628 (set_attr "type" "fsqrt<mode>")])
7632 ;;- One complement instructions.
7636 ; one_cmpl(di|si|hi|qi)2 instruction pattern(s).
7639 (define_expand "one_cmpl<mode>2"
7641 [(set (match_operand:INT 0 "register_operand" "")
7642 (xor:INT (match_operand:INT 1 "register_operand" "")
7644 (clobber (reg:CC CC_REGNUM))])]
7650 ;; Find leftmost bit instructions.
7653 (define_expand "clzdi2"
7654 [(set (match_operand:DI 0 "register_operand" "=d")
7655 (clz:DI (match_operand:DI 1 "register_operand" "d")))]
7656 "TARGET_EXTIMM && TARGET_ZARCH"
7658 rtx insn, clz_equal;
7659 rtx wide_reg = gen_reg_rtx (TImode);
7660 rtx msb = gen_rtx_CONST_INT (DImode, (unsigned HOST_WIDE_INT) 1 << 63);
7662 clz_equal = gen_rtx_CLZ (DImode, operands[1]);
7664 emit_insn (gen_clztidi2 (wide_reg, operands[1], msb));
7666 insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg));
7667 set_unique_reg_note (insn, REG_EQUAL, clz_equal);
7672 (define_insn "clztidi2"
7673 [(set (match_operand:TI 0 "register_operand" "=d")
7677 (xor:DI (match_operand:DI 1 "register_operand" "d")
7678 (lshiftrt (match_operand:DI 2 "const_int_operand" "")
7679 (subreg:SI (clz:DI (match_dup 1)) 4))))
7682 (zero_extend:TI (clz:DI (match_dup 1)))))
7683 (clobber (reg:CC CC_REGNUM))]
7684 "(unsigned HOST_WIDE_INT) INTVAL (operands[2])
7685 == (unsigned HOST_WIDE_INT) 1 << 63
7686 && TARGET_EXTIMM && TARGET_ZARCH"
7688 [(set_attr "op_type" "RRE")])
7692 ;;- Rotate instructions.
7696 ; rotl(di|si)3 instruction pattern(s).
7700 (define_insn "rotl<mode>3"
7701 [(set (match_operand:GPR 0 "register_operand" "=d")
7702 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
7703 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
7706 [(set_attr "op_type" "RSE")
7707 (set_attr "atype" "reg")
7708 (set_attr "z10prop" "z10_super_E1")])
7711 (define_insn "*rotl<mode>3_and"
7712 [(set (match_operand:GPR 0 "register_operand" "=d")
7713 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
7714 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
7715 (match_operand:SI 3 "const_int_operand" "n"))))]
7716 "TARGET_CPU_ZARCH && (INTVAL (operands[3]) & 63) == 63"
7718 [(set_attr "op_type" "RSE")
7719 (set_attr "atype" "reg")
7720 (set_attr "z10prop" "z10_super_E1")])
7724 ;;- Shift instructions.
7728 ; (ashl|lshr)(di|si)3 instruction pattern(s).
7729 ; Left shifts and logical right shifts
7731 (define_expand "<shift><mode>3"
7732 [(set (match_operand:DSI 0 "register_operand" "")
7733 (SHIFT:DSI (match_operand:DSI 1 "register_operand" "")
7734 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))]
7739 (define_insn "*<shift>di3_31"
7740 [(set (match_operand:DI 0 "register_operand" "=d")
7741 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
7742 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
7745 [(set_attr "op_type" "RS")
7746 (set_attr "atype" "reg")
7747 (set_attr "z196prop" "z196_cracked")])
7749 ; sll, srl, sllg, srlg, sllk, srlk
7750 (define_insn "*<shift><mode>3"
7751 [(set (match_operand:GPR 0 "register_operand" "=d,d")
7752 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
7753 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")))]
7756 s<lr>l<g>\t%0,<1>%Y2
7757 s<lr>l<gk>\t%0,%1,%Y2"
7758 [(set_attr "op_type" "RS<E>,RSY")
7759 (set_attr "atype" "reg,reg")
7760 (set_attr "cpu_facility" "*,z196")
7761 (set_attr "z10prop" "z10_super_E1,*")])
7764 (define_insn "*<shift>di3_31_and"
7765 [(set (match_operand:DI 0 "register_operand" "=d")
7766 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
7767 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
7768 (match_operand:SI 3 "const_int_operand" "n"))))]
7769 "!TARGET_ZARCH && (INTVAL (operands[3]) & 63) == 63"
7771 [(set_attr "op_type" "RS")
7772 (set_attr "atype" "reg")])
7774 ; sll, srl, sllg, srlg, sllk, srlk
7775 (define_insn "*<shift><mode>3_and"
7776 [(set (match_operand:GPR 0 "register_operand" "=d,d")
7777 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
7778 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
7779 (match_operand:SI 3 "const_int_operand" "n,n"))))]
7780 "(INTVAL (operands[3]) & 63) == 63"
7782 s<lr>l<g>\t%0,<1>%Y2
7783 s<lr>l<gk>\t%0,%1,%Y2"
7784 [(set_attr "op_type" "RS<E>,RSY")
7785 (set_attr "atype" "reg,reg")
7786 (set_attr "cpu_facility" "*,z196")
7787 (set_attr "z10prop" "z10_super_E1,*")])
7790 ; ashr(di|si)3 instruction pattern(s).
7791 ; Arithmetic right shifts
7793 (define_expand "ashr<mode>3"
7795 [(set (match_operand:DSI 0 "register_operand" "")
7796 (ashiftrt:DSI (match_operand:DSI 1 "register_operand" "")
7797 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))
7798 (clobber (reg:CC CC_REGNUM))])]
7802 (define_insn "*ashrdi3_cc_31"
7803 [(set (reg CC_REGNUM)
7804 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
7805 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
7807 (set (match_operand:DI 0 "register_operand" "=d")
7808 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7809 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)"
7811 [(set_attr "op_type" "RS")
7812 (set_attr "atype" "reg")])
7814 (define_insn "*ashrdi3_cconly_31"
7815 [(set (reg CC_REGNUM)
7816 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
7817 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
7819 (clobber (match_scratch:DI 0 "=d"))]
7820 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)"
7822 [(set_attr "op_type" "RS")
7823 (set_attr "atype" "reg")])
7825 (define_insn "*ashrdi3_31"
7826 [(set (match_operand:DI 0 "register_operand" "=d")
7827 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
7828 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))
7829 (clobber (reg:CC CC_REGNUM))]
7832 [(set_attr "op_type" "RS")
7833 (set_attr "atype" "reg")])
7836 (define_insn "*ashr<mode>3_cc"
7837 [(set (reg CC_REGNUM)
7838 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
7839 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y"))
7841 (set (match_operand:GPR 0 "register_operand" "=d,d")
7842 (ashiftrt:GPR (match_dup 1) (match_dup 2)))]
7843 "s390_match_ccmode(insn, CCSmode)"
7847 [(set_attr "op_type" "RS<E>,RSY")
7848 (set_attr "atype" "reg,reg")
7849 (set_attr "cpu_facility" "*,z196")
7850 (set_attr "z10prop" "z10_super_E1,*")])
7853 (define_insn "*ashr<mode>3_cconly"
7854 [(set (reg CC_REGNUM)
7855 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
7856 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y"))
7858 (clobber (match_scratch:GPR 0 "=d,d"))]
7859 "s390_match_ccmode(insn, CCSmode)"
7863 [(set_attr "op_type" "RS<E>,RSY")
7864 (set_attr "atype" "reg,reg")
7865 (set_attr "cpu_facility" "*,z196")
7866 (set_attr "z10prop" "z10_super_E1,*")])
7869 (define_insn "*ashr<mode>3"
7870 [(set (match_operand:GPR 0 "register_operand" "=d,d")
7871 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
7872 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")))
7873 (clobber (reg:CC CC_REGNUM))]
7878 [(set_attr "op_type" "RS<E>,RSY")
7879 (set_attr "atype" "reg,reg")
7880 (set_attr "cpu_facility" "*,z196")
7881 (set_attr "z10prop" "z10_super_E1,*")])
7884 ; shift pattern with implicit ANDs
7886 (define_insn "*ashrdi3_cc_31_and"
7887 [(set (reg CC_REGNUM)
7888 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
7889 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
7890 (match_operand:SI 3 "const_int_operand" "n")))
7892 (set (match_operand:DI 0 "register_operand" "=d")
7893 (ashiftrt:DI (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
7894 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)
7895 && (INTVAL (operands[3]) & 63) == 63"
7897 [(set_attr "op_type" "RS")
7898 (set_attr "atype" "reg")])
7900 (define_insn "*ashrdi3_cconly_31_and"
7901 [(set (reg CC_REGNUM)
7902 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
7903 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
7904 (match_operand:SI 3 "const_int_operand" "n")))
7906 (clobber (match_scratch:DI 0 "=d"))]
7907 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)
7908 && (INTVAL (operands[3]) & 63) == 63"
7910 [(set_attr "op_type" "RS")
7911 (set_attr "atype" "reg")])
7913 (define_insn "*ashrdi3_31_and"
7914 [(set (match_operand:DI 0 "register_operand" "=d")
7915 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
7916 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
7917 (match_operand:SI 3 "const_int_operand" "n"))))
7918 (clobber (reg:CC CC_REGNUM))]
7919 "!TARGET_ZARCH && (INTVAL (operands[3]) & 63) == 63"
7921 [(set_attr "op_type" "RS")
7922 (set_attr "atype" "reg")])
7925 (define_insn "*ashr<mode>3_cc_and"
7926 [(set (reg CC_REGNUM)
7927 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
7928 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
7929 (match_operand:SI 3 "const_int_operand" "n,n")))
7931 (set (match_operand:GPR 0 "register_operand" "=d,d")
7932 (ashiftrt:GPR (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
7933 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
7937 [(set_attr "op_type" "RS<E>,RSY")
7938 (set_attr "atype" "reg,reg")
7939 (set_attr "cpu_facility" "*,z196")
7940 (set_attr "z10prop" "z10_super_E1,*")])
7943 (define_insn "*ashr<mode>3_cconly_and"
7944 [(set (reg CC_REGNUM)
7945 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
7946 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
7947 (match_operand:SI 3 "const_int_operand" "n,n")))
7949 (clobber (match_scratch:GPR 0 "=d,d"))]
7950 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
7954 [(set_attr "op_type" "RS<E>,RSY")
7955 (set_attr "atype" "reg,reg")
7956 (set_attr "cpu_facility" "*,z196")
7957 (set_attr "z10prop" "z10_super_E1,*")])
7960 (define_insn "*ashr<mode>3_and"
7961 [(set (match_operand:GPR 0 "register_operand" "=d,d")
7962 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
7963 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
7964 (match_operand:SI 3 "const_int_operand" "n,n"))))
7965 (clobber (reg:CC CC_REGNUM))]
7966 "(INTVAL (operands[3]) & 63) == 63"
7970 [(set_attr "op_type" "RS<E>,RSY")
7971 (set_attr "atype" "reg,reg")
7972 (set_attr "cpu_facility" "*,z196")
7973 (set_attr "z10prop" "z10_super_E1,*")])
7977 ;; Branch instruction patterns.
7980 (define_expand "cbranch<mode>4"
7982 (if_then_else (match_operator 0 "comparison_operator"
7983 [(match_operand:GPR 1 "register_operand" "")
7984 (match_operand:GPR 2 "general_operand" "")])
7985 (label_ref (match_operand 3 "" ""))
7988 "s390_emit_jump (operands[3],
7989 s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2]));
7992 (define_expand "cbranch<mode>4"
7994 (if_then_else (match_operator 0 "comparison_operator"
7995 [(match_operand:FP 1 "register_operand" "")
7996 (match_operand:FP 2 "general_operand" "")])
7997 (label_ref (match_operand 3 "" ""))
8000 "s390_emit_jump (operands[3],
8001 s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2]));
8004 (define_expand "cbranchcc4"
8006 (if_then_else (match_operator 0 "s390_eqne_operator"
8007 [(match_operand 1 "cc_reg_operand" "")
8008 (match_operand 2 "const0_operand" "")])
8009 (label_ref (match_operand 3 "" ""))
8012 "s390_emit_jump (operands[3],
8013 s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2]));
8019 ;;- Conditional jump instructions.
8022 (define_insn "*cjump_64"
8025 (match_operator 1 "s390_comparison" [(reg CC_REGNUM)
8026 (match_operand 2 "const_int_operand" "")])
8027 (label_ref (match_operand 0 "" ""))
8031 if (get_attr_length (insn) == 4)
8034 return "jg%C1\t%l0";
8036 [(set_attr "op_type" "RI")
8037 (set_attr "type" "branch")
8038 (set (attr "length")
8039 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8040 (const_int 4) (const_int 6)))])
8042 (define_insn "*cjump_31"
8045 (match_operator 1 "s390_comparison" [(reg CC_REGNUM)
8046 (match_operand 2 "const_int_operand" "")])
8047 (label_ref (match_operand 0 "" ""))
8051 gcc_assert (get_attr_length (insn) == 4);
8054 [(set_attr "op_type" "RI")
8055 (set_attr "type" "branch")
8056 (set (attr "length")
8057 (if_then_else (not (match_test "flag_pic"))
8058 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8059 (const_int 4) (const_int 6))
8060 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8061 (const_int 4) (const_int 8))))])
8063 (define_insn "*cjump_long"
8066 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8067 (match_operand 0 "address_operand" "ZQZR")
8071 if (get_attr_op_type (insn) == OP_TYPE_RR)
8076 [(set (attr "op_type")
8077 (if_then_else (match_operand 0 "register_operand" "")
8078 (const_string "RR") (const_string "RX")))
8079 (set_attr "type" "branch")
8080 (set_attr "atype" "agen")])
8084 ;;- Negated conditional jump instructions.
8087 (define_insn "*icjump_64"
8090 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8092 (label_ref (match_operand 0 "" ""))))]
8095 if (get_attr_length (insn) == 4)
8098 return "jg%D1\t%l0";
8100 [(set_attr "op_type" "RI")
8101 (set_attr "type" "branch")
8102 (set (attr "length")
8103 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8104 (const_int 4) (const_int 6)))])
8106 (define_insn "*icjump_31"
8109 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8111 (label_ref (match_operand 0 "" ""))))]
8114 gcc_assert (get_attr_length (insn) == 4);
8117 [(set_attr "op_type" "RI")
8118 (set_attr "type" "branch")
8119 (set (attr "length")
8120 (if_then_else (not (match_test "flag_pic"))
8121 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8122 (const_int 4) (const_int 6))
8123 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8124 (const_int 4) (const_int 8))))])
8126 (define_insn "*icjump_long"
8129 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8131 (match_operand 0 "address_operand" "ZQZR")))]
8134 if (get_attr_op_type (insn) == OP_TYPE_RR)
8139 [(set (attr "op_type")
8140 (if_then_else (match_operand 0 "register_operand" "")
8141 (const_string "RR") (const_string "RX")))
8142 (set_attr "type" "branch")
8143 (set_attr "atype" "agen")])
8146 ;;- Trap instructions.
8150 [(trap_if (const_int 1) (const_int 0))]
8153 [(set_attr "op_type" "RI")
8154 (set_attr "type" "branch")])
8156 (define_expand "ctrap<mode>4"
8157 [(trap_if (match_operator 0 "comparison_operator"
8158 [(match_operand:GPR 1 "register_operand" "")
8159 (match_operand:GPR 2 "general_operand" "")])
8160 (match_operand 3 "const0_operand" ""))]
8163 rtx cond = s390_emit_compare (GET_CODE (operands[0]),
8164 operands[1], operands[2]);
8165 emit_insn (gen_condtrap (cond, XEXP (cond, 0)));
8169 (define_expand "ctrap<mode>4"
8170 [(trap_if (match_operator 0 "comparison_operator"
8171 [(match_operand:FP 1 "register_operand" "")
8172 (match_operand:FP 2 "general_operand" "")])
8173 (match_operand 3 "const0_operand" ""))]
8176 rtx cond = s390_emit_compare (GET_CODE (operands[0]),
8177 operands[1], operands[2]);
8178 emit_insn (gen_condtrap (cond, XEXP (cond, 0)));
8182 (define_insn "condtrap"
8183 [(trap_if (match_operator 0 "s390_comparison"
8184 [(match_operand 1 "cc_reg_operand" "c")
8189 [(set_attr "op_type" "RI")
8190 (set_attr "type" "branch")])
8192 ; crt, cgrt, cit, cgit
8193 (define_insn "*cmp_and_trap_signed_int<mode>"
8194 [(trap_if (match_operator 0 "s390_signed_integer_comparison"
8195 [(match_operand:GPR 1 "register_operand" "d,d")
8196 (match_operand:GPR 2 "nonmemory_operand" "d,K")])
8202 [(set_attr "op_type" "RRF,RIE")
8203 (set_attr "type" "branch")
8204 (set_attr "z10prop" "z10_super_c,z10_super")])
8206 ; clrt, clgrt, clfit, clgit, clt, clgt
8207 (define_insn "*cmp_and_trap_unsigned_int<mode>"
8208 [(trap_if (match_operator 0 "s390_unsigned_integer_comparison"
8209 [(match_operand:GPR 1 "register_operand" "d,d, d")
8210 (match_operand:GPR 2 "general_operand" "d,D,RT")])
8217 [(set_attr "op_type" "RRF,RIE,RSY")
8218 (set_attr "type" "branch")
8219 (set_attr "z10prop" "z10_super_c,z10_super,*")
8220 (set_attr "cpu_facility" "z10,z10,zEC12")])
8223 (define_insn "*load_and_trap<mode>"
8224 [(trap_if (eq (match_operand:GPR 0 "memory_operand" "RT")
8227 (set (match_operand:GPR 1 "register_operand" "=d")
8231 [(set_attr "op_type" "RXY")])
8235 ;;- Loop instructions.
8237 ;; This is all complicated by the fact that since this is a jump insn
8238 ;; we must handle our own output reloads.
8242 ; This splitter will be matched by combine and has to add the 2 moves
8243 ; necessary to load the compare and the increment values into a
8244 ; register pair as needed by brxle.
8246 (define_insn_and_split "*brx_stage1_<GPR:mode>"
8249 (match_operator 6 "s390_brx_operator"
8250 [(plus:GPR (match_operand:GPR 1 "register_operand" "")
8251 (match_operand:GPR 2 "general_operand" ""))
8252 (match_operand:GPR 3 "register_operand" "")])
8253 (label_ref (match_operand 0 "" ""))
8255 (set (match_operand:GPR 4 "nonimmediate_operand" "")
8256 (plus:GPR (match_dup 1) (match_dup 2)))
8257 (clobber (match_scratch:GPR 5 ""))]
8260 "!reload_completed && !reload_in_progress"
8261 [(set (match_dup 7) (match_dup 2)) ; the increment
8262 (set (match_dup 8) (match_dup 3)) ; the comparison value
8263 (parallel [(set (pc)
8266 [(plus:GPR (match_dup 1) (match_dup 7))
8268 (label_ref (match_dup 0))
8271 (plus:GPR (match_dup 1) (match_dup 7)))
8272 (clobber (match_dup 5))
8273 (clobber (reg:CC CC_REGNUM))])]
8275 rtx dreg = gen_reg_rtx (word_mode == DImode ? TImode : DImode);
8276 operands[7] = gen_lowpart (<GPR:MODE>mode,
8277 gen_highpart (word_mode, dreg));
8278 operands[8] = gen_lowpart (<GPR:MODE>mode,
8279 gen_lowpart (word_mode, dreg));
8284 (define_insn_and_split "*brxg_64bit"
8287 (match_operator 5 "s390_brx_operator"
8288 [(plus:DI (match_operand:DI 1 "register_operand" "d,d,d")
8289 (subreg:DI (match_operand:TI 2 "register_operand" "d,d,d") 0))
8290 (subreg:DI (match_dup 2) 8)])
8291 (label_ref (match_operand 0 "" ""))
8293 (set (match_operand:DI 3 "nonimmediate_operand" "=1,?X,?X")
8294 (plus:DI (match_dup 1)
8295 (subreg:DI (match_dup 2) 0)))
8296 (clobber (match_scratch:DI 4 "=X,&1,&?d"))
8297 (clobber (reg:CC CC_REGNUM))]
8300 if (which_alternative != 0)
8302 else if (get_attr_length (insn) == 6)
8303 return "brx%E5g\t%1,%2,%l0";
8305 return "agr\t%1,%2\;cgr\t%1,%M2\;jg%C5\t%l0";
8307 "&& reload_completed
8308 && (!REG_P (operands[3])
8309 || !rtx_equal_p (operands[1], operands[3]))"
8310 [(set (match_dup 4) (match_dup 1))
8311 (parallel [(set (match_dup 4) (plus:DI (match_dup 4) (subreg:DI (match_dup 2) 0)))
8312 (clobber (reg:CC CC_REGNUM))])
8313 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:DI (match_dup 2) 8)))
8314 (set (match_dup 3) (match_dup 4))
8315 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
8316 (label_ref (match_dup 0))
8319 [(set_attr "op_type" "RIE")
8320 (set_attr "type" "branch")
8321 (set (attr "length")
8322 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8323 (const_int 6) (const_int 16)))])
8327 (define_insn_and_split "*brx_64bit"
8330 (match_operator 5 "s390_brx_operator"
8331 [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d")
8332 (subreg:SI (match_operand:TI 2 "register_operand" "d,d,d") 4))
8333 (subreg:SI (match_dup 2) 12)])
8334 (label_ref (match_operand 0 "" ""))
8336 (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X")
8337 (plus:SI (match_dup 1)
8338 (subreg:SI (match_dup 2) 4)))
8339 (clobber (match_scratch:SI 4 "=X,&1,&?d"))
8340 (clobber (reg:CC CC_REGNUM))]
8343 if (which_alternative != 0)
8345 else if (get_attr_length (insn) == 6)
8346 return "brx%C5\t%1,%2,%l0";
8348 return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0";
8350 "&& reload_completed
8351 && (!REG_P (operands[3])
8352 || !rtx_equal_p (operands[1], operands[3]))"
8353 [(set (match_dup 4) (match_dup 1))
8354 (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 4)))
8355 (clobber (reg:CC CC_REGNUM))])
8356 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 12)))
8357 (set (match_dup 3) (match_dup 4))
8358 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
8359 (label_ref (match_dup 0))
8362 [(set_attr "op_type" "RSI")
8363 (set_attr "type" "branch")
8364 (set (attr "length")
8365 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8366 (const_int 6) (const_int 14)))])
8370 (define_insn_and_split "*brx_31bit"
8373 (match_operator 5 "s390_brx_operator"
8374 [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d")
8375 (subreg:SI (match_operand:DI 2 "register_operand" "d,d,d") 0))
8376 (subreg:SI (match_dup 2) 4)])
8377 (label_ref (match_operand 0 "" ""))
8379 (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X")
8380 (plus:SI (match_dup 1)
8381 (subreg:SI (match_dup 2) 0)))
8382 (clobber (match_scratch:SI 4 "=X,&1,&?d"))
8383 (clobber (reg:CC CC_REGNUM))]
8384 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
8386 if (which_alternative != 0)
8388 else if (get_attr_length (insn) == 6)
8389 return "brx%C5\t%1,%2,%l0";
8391 return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0";
8393 "&& reload_completed
8394 && (!REG_P (operands[3])
8395 || !rtx_equal_p (operands[1], operands[3]))"
8396 [(set (match_dup 4) (match_dup 1))
8397 (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 0)))
8398 (clobber (reg:CC CC_REGNUM))])
8399 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 4)))
8400 (set (match_dup 3) (match_dup 4))
8401 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
8402 (label_ref (match_dup 0))
8405 [(set_attr "op_type" "RSI")
8406 (set_attr "type" "branch")
8407 (set (attr "length")
8408 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8409 (const_int 6) (const_int 14)))])
8414 (define_expand "doloop_end"
8415 [(use (match_operand 0 "" "")) ; loop pseudo
8416 (use (match_operand 1 "" ""))] ; label
8419 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
8420 emit_jump_insn (gen_doloop_si31 (operands[1], operands[0], operands[0]));
8421 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
8422 emit_jump_insn (gen_doloop_si64 (operands[1], operands[0], operands[0]));
8423 else if (GET_MODE (operands[0]) == DImode && TARGET_ZARCH)
8424 emit_jump_insn (gen_doloop_di (operands[1], operands[0], operands[0]));
8431 (define_insn_and_split "doloop_si64"
8434 (ne (match_operand:SI 1 "register_operand" "d,d,d")
8436 (label_ref (match_operand 0 "" ""))
8438 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?X,?X")
8439 (plus:SI (match_dup 1) (const_int -1)))
8440 (clobber (match_scratch:SI 3 "=X,&1,&?d"))
8441 (clobber (reg:CC CC_REGNUM))]
8444 if (which_alternative != 0)
8446 else if (get_attr_length (insn) == 4)
8447 return "brct\t%1,%l0";
8449 return "ahi\t%1,-1\;jgne\t%l0";
8451 "&& reload_completed
8452 && (! REG_P (operands[2])
8453 || ! rtx_equal_p (operands[1], operands[2]))"
8454 [(set (match_dup 3) (match_dup 1))
8455 (parallel [(set (reg:CCAN CC_REGNUM)
8456 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
8458 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
8459 (set (match_dup 2) (match_dup 3))
8460 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
8461 (label_ref (match_dup 0))
8464 [(set_attr "op_type" "RI")
8465 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
8466 ; hurt us in the (rare) case of ahi.
8467 (set_attr "z10prop" "z10_super_E1")
8468 (set_attr "type" "branch")
8469 (set (attr "length")
8470 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8471 (const_int 4) (const_int 10)))])
8473 (define_insn_and_split "doloop_si31"
8476 (ne (match_operand:SI 1 "register_operand" "d,d,d")
8478 (label_ref (match_operand 0 "" ""))
8480 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?X,?X")
8481 (plus:SI (match_dup 1) (const_int -1)))
8482 (clobber (match_scratch:SI 3 "=X,&1,&?d"))
8483 (clobber (reg:CC CC_REGNUM))]
8486 if (which_alternative != 0)
8488 else if (get_attr_length (insn) == 4)
8489 return "brct\t%1,%l0";
8493 "&& reload_completed
8494 && (! REG_P (operands[2])
8495 || ! rtx_equal_p (operands[1], operands[2]))"
8496 [(set (match_dup 3) (match_dup 1))
8497 (parallel [(set (reg:CCAN CC_REGNUM)
8498 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
8500 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
8501 (set (match_dup 2) (match_dup 3))
8502 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
8503 (label_ref (match_dup 0))
8506 [(set_attr "op_type" "RI")
8507 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
8508 ; hurt us in the (rare) case of ahi.
8509 (set_attr "z10prop" "z10_super_E1")
8510 (set_attr "type" "branch")
8511 (set (attr "length")
8512 (if_then_else (not (match_test "flag_pic"))
8513 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8514 (const_int 4) (const_int 6))
8515 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8516 (const_int 4) (const_int 8))))])
8518 (define_insn "*doloop_si_long"
8521 (ne (match_operand:SI 1 "register_operand" "d")
8523 (match_operand 0 "address_operand" "ZQZR")
8525 (set (match_operand:SI 2 "register_operand" "=1")
8526 (plus:SI (match_dup 1) (const_int -1)))
8527 (clobber (match_scratch:SI 3 "=X"))
8528 (clobber (reg:CC CC_REGNUM))]
8531 if (get_attr_op_type (insn) == OP_TYPE_RR)
8532 return "bctr\t%1,%0";
8534 return "bct\t%1,%a0";
8536 [(set (attr "op_type")
8537 (if_then_else (match_operand 0 "register_operand" "")
8538 (const_string "RR") (const_string "RX")))
8539 (set_attr "type" "branch")
8540 (set_attr "atype" "agen")
8541 (set_attr "z10prop" "z10_c")
8542 (set_attr "z196prop" "z196_cracked")])
8544 (define_insn_and_split "doloop_di"
8547 (ne (match_operand:DI 1 "register_operand" "d,d,d")
8549 (label_ref (match_operand 0 "" ""))
8551 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?X,?X")
8552 (plus:DI (match_dup 1) (const_int -1)))
8553 (clobber (match_scratch:DI 3 "=X,&1,&?d"))
8554 (clobber (reg:CC CC_REGNUM))]
8557 if (which_alternative != 0)
8559 else if (get_attr_length (insn) == 4)
8560 return "brctg\t%1,%l0";
8562 return "aghi\t%1,-1\;jgne\t%l0";
8564 "&& reload_completed
8565 && (! REG_P (operands[2])
8566 || ! rtx_equal_p (operands[1], operands[2]))"
8567 [(set (match_dup 3) (match_dup 1))
8568 (parallel [(set (reg:CCAN CC_REGNUM)
8569 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
8571 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
8572 (set (match_dup 2) (match_dup 3))
8573 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
8574 (label_ref (match_dup 0))
8577 [(set_attr "op_type" "RI")
8578 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
8579 ; hurt us in the (rare) case of ahi.
8580 (set_attr "z10prop" "z10_super_E1")
8581 (set_attr "type" "branch")
8582 (set (attr "length")
8583 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8584 (const_int 4) (const_int 10)))])
8587 ;;- Unconditional jump instructions.
8591 ; jump instruction pattern(s).
8594 (define_expand "jump"
8595 [(match_operand 0 "" "")]
8597 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
8599 (define_insn "*jump64"
8600 [(set (pc) (label_ref (match_operand 0 "" "")))]
8603 if (get_attr_length (insn) == 4)
8608 [(set_attr "op_type" "RI")
8609 (set_attr "type" "branch")
8610 (set (attr "length")
8611 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8612 (const_int 4) (const_int 6)))])
8614 (define_insn "*jump31"
8615 [(set (pc) (label_ref (match_operand 0 "" "")))]
8618 gcc_assert (get_attr_length (insn) == 4);
8621 [(set_attr "op_type" "RI")
8622 (set_attr "type" "branch")
8623 (set (attr "length")
8624 (if_then_else (not (match_test "flag_pic"))
8625 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8626 (const_int 4) (const_int 6))
8627 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8628 (const_int 4) (const_int 8))))])
8631 ; indirect-jump instruction pattern(s).
8634 (define_insn "indirect_jump"
8635 [(set (pc) (match_operand 0 "address_operand" "ZQZR"))]
8638 if (get_attr_op_type (insn) == OP_TYPE_RR)
8643 [(set (attr "op_type")
8644 (if_then_else (match_operand 0 "register_operand" "")
8645 (const_string "RR") (const_string "RX")))
8646 (set_attr "type" "branch")
8647 (set_attr "atype" "agen")])
8650 ; casesi instruction pattern(s).
8653 (define_insn "casesi_jump"
8654 [(set (pc) (match_operand 0 "address_operand" "ZQZR"))
8655 (use (label_ref (match_operand 1 "" "")))]
8658 if (get_attr_op_type (insn) == OP_TYPE_RR)
8663 [(set (attr "op_type")
8664 (if_then_else (match_operand 0 "register_operand" "")
8665 (const_string "RR") (const_string "RX")))
8666 (set_attr "type" "branch")
8667 (set_attr "atype" "agen")])
8669 (define_expand "casesi"
8670 [(match_operand:SI 0 "general_operand" "")
8671 (match_operand:SI 1 "general_operand" "")
8672 (match_operand:SI 2 "general_operand" "")
8673 (label_ref (match_operand 3 "" ""))
8674 (label_ref (match_operand 4 "" ""))]
8677 rtx index = gen_reg_rtx (SImode);
8678 rtx base = gen_reg_rtx (Pmode);
8679 rtx target = gen_reg_rtx (Pmode);
8681 emit_move_insn (index, operands[0]);
8682 emit_insn (gen_subsi3 (index, index, operands[1]));
8683 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
8686 if (Pmode != SImode)
8687 index = convert_to_mode (Pmode, index, 1);
8688 if (GET_CODE (index) != REG)
8689 index = copy_to_mode_reg (Pmode, index);
8692 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
8694 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
8696 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
8698 index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
8699 emit_move_insn (target, index);
8702 target = gen_rtx_PLUS (Pmode, base, target);
8703 emit_jump_insn (gen_casesi_jump (target, operands[3]));
8710 ;;- Jump to subroutine.
8715 ; untyped call instruction pattern(s).
8718 ;; Call subroutine returning any type.
8719 (define_expand "untyped_call"
8720 [(parallel [(call (match_operand 0 "" "")
8722 (match_operand 1 "" "")
8723 (match_operand 2 "" "")])]
8728 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
8730 for (i = 0; i < XVECLEN (operands[2], 0); i++)
8732 rtx set = XVECEXP (operands[2], 0, i);
8733 emit_move_insn (SET_DEST (set), SET_SRC (set));
8736 /* The optimizer does not know that the call sets the function value
8737 registers we stored in the result block. We avoid problems by
8738 claiming that all hard registers are used and clobbered at this
8740 emit_insn (gen_blockage ());
8745 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
8746 ;; all of memory. This blocks insns from being moved across this point.
8748 (define_insn "blockage"
8749 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
8752 [(set_attr "type" "none")
8753 (set_attr "length" "0")])
8759 (define_expand "sibcall"
8760 [(call (match_operand 0 "" "")
8761 (match_operand 1 "" ""))]
8764 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
8768 (define_insn "*sibcall_br"
8769 [(call (mem:QI (reg SIBCALL_REGNUM))
8770 (match_operand 0 "const_int_operand" "n"))]
8771 "SIBLING_CALL_P (insn)
8772 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
8774 [(set_attr "op_type" "RR")
8775 (set_attr "type" "branch")
8776 (set_attr "atype" "agen")])
8778 (define_insn "*sibcall_brc"
8779 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
8780 (match_operand 1 "const_int_operand" "n"))]
8781 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
8783 [(set_attr "op_type" "RI")
8784 (set_attr "type" "branch")])
8786 (define_insn "*sibcall_brcl"
8787 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
8788 (match_operand 1 "const_int_operand" "n"))]
8789 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
8791 [(set_attr "op_type" "RIL")
8792 (set_attr "type" "branch")])
8795 ; sibcall_value patterns
8798 (define_expand "sibcall_value"
8799 [(set (match_operand 0 "" "")
8800 (call (match_operand 1 "" "")
8801 (match_operand 2 "" "")))]
8804 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
8808 (define_insn "*sibcall_value_br"
8809 [(set (match_operand 0 "" "")
8810 (call (mem:QI (reg SIBCALL_REGNUM))
8811 (match_operand 1 "const_int_operand" "n")))]
8812 "SIBLING_CALL_P (insn)
8813 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
8815 [(set_attr "op_type" "RR")
8816 (set_attr "type" "branch")
8817 (set_attr "atype" "agen")])
8819 (define_insn "*sibcall_value_brc"
8820 [(set (match_operand 0 "" "")
8821 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
8822 (match_operand 2 "const_int_operand" "n")))]
8823 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
8825 [(set_attr "op_type" "RI")
8826 (set_attr "type" "branch")])
8828 (define_insn "*sibcall_value_brcl"
8829 [(set (match_operand 0 "" "")
8830 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
8831 (match_operand 2 "const_int_operand" "n")))]
8832 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
8834 [(set_attr "op_type" "RIL")
8835 (set_attr "type" "branch")])
8839 ; call instruction pattern(s).
8842 (define_expand "call"
8843 [(call (match_operand 0 "" "")
8844 (match_operand 1 "" ""))
8845 (use (match_operand 2 "" ""))]
8848 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
8849 gen_rtx_REG (Pmode, RETURN_REGNUM));
8853 (define_insn "*bras"
8854 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
8855 (match_operand 1 "const_int_operand" "n"))
8856 (clobber (match_operand 2 "register_operand" "=r"))]
8857 "!SIBLING_CALL_P (insn)
8858 && TARGET_SMALL_EXEC
8859 && GET_MODE (operands[2]) == Pmode"
8861 [(set_attr "op_type" "RI")
8862 (set_attr "type" "jsr")
8863 (set_attr "z196prop" "z196_cracked")])
8865 (define_insn "*brasl"
8866 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
8867 (match_operand 1 "const_int_operand" "n"))
8868 (clobber (match_operand 2 "register_operand" "=r"))]
8869 "!SIBLING_CALL_P (insn)
8871 && GET_MODE (operands[2]) == Pmode"
8873 [(set_attr "op_type" "RIL")
8874 (set_attr "type" "jsr")
8875 (set_attr "z196prop" "z196_cracked")])
8877 (define_insn "*basr"
8878 [(call (mem:QI (match_operand 0 "address_operand" "ZQZR"))
8879 (match_operand 1 "const_int_operand" "n"))
8880 (clobber (match_operand 2 "register_operand" "=r"))]
8881 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
8883 if (get_attr_op_type (insn) == OP_TYPE_RR)
8884 return "basr\t%2,%0";
8886 return "bas\t%2,%a0";
8888 [(set (attr "op_type")
8889 (if_then_else (match_operand 0 "register_operand" "")
8890 (const_string "RR") (const_string "RX")))
8891 (set_attr "type" "jsr")
8892 (set_attr "atype" "agen")
8893 (set_attr "z196prop" "z196_cracked")])
8896 ; call_value instruction pattern(s).
8899 (define_expand "call_value"
8900 [(set (match_operand 0 "" "")
8901 (call (match_operand 1 "" "")
8902 (match_operand 2 "" "")))
8903 (use (match_operand 3 "" ""))]
8906 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
8907 gen_rtx_REG (Pmode, RETURN_REGNUM));
8911 (define_insn "*bras_r"
8912 [(set (match_operand 0 "" "")
8913 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
8914 (match_operand:SI 2 "const_int_operand" "n")))
8915 (clobber (match_operand 3 "register_operand" "=r"))]
8916 "!SIBLING_CALL_P (insn)
8917 && TARGET_SMALL_EXEC
8918 && GET_MODE (operands[3]) == Pmode"
8920 [(set_attr "op_type" "RI")
8921 (set_attr "type" "jsr")
8922 (set_attr "z196prop" "z196_cracked")])
8924 (define_insn "*brasl_r"
8925 [(set (match_operand 0 "" "")
8926 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
8927 (match_operand 2 "const_int_operand" "n")))
8928 (clobber (match_operand 3 "register_operand" "=r"))]
8929 "!SIBLING_CALL_P (insn)
8931 && GET_MODE (operands[3]) == Pmode"
8933 [(set_attr "op_type" "RIL")
8934 (set_attr "type" "jsr")
8935 (set_attr "z196prop" "z196_cracked")])
8937 (define_insn "*basr_r"
8938 [(set (match_operand 0 "" "")
8939 (call (mem:QI (match_operand 1 "address_operand" "ZQZR"))
8940 (match_operand 2 "const_int_operand" "n")))
8941 (clobber (match_operand 3 "register_operand" "=r"))]
8942 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
8944 if (get_attr_op_type (insn) == OP_TYPE_RR)
8945 return "basr\t%3,%1";
8947 return "bas\t%3,%a1";
8949 [(set (attr "op_type")
8950 (if_then_else (match_operand 1 "register_operand" "")
8951 (const_string "RR") (const_string "RX")))
8952 (set_attr "type" "jsr")
8953 (set_attr "atype" "agen")
8954 (set_attr "z196prop" "z196_cracked")])
8957 ;;- Thread-local storage support.
8960 (define_expand "get_thread_pointer<mode>"
8961 [(set (match_operand:P 0 "nonimmediate_operand" "") (reg:P TP_REGNUM))]
8965 (define_expand "set_thread_pointer<mode>"
8966 [(set (reg:P TP_REGNUM) (match_operand:P 0 "nonimmediate_operand" ""))
8967 (set (reg:P TP_REGNUM) (unspec_volatile:P [(reg:P TP_REGNUM)] UNSPECV_SET_TP))]
8971 (define_insn "*set_tp"
8972 [(set (reg TP_REGNUM) (unspec_volatile [(reg TP_REGNUM)] UNSPECV_SET_TP))]
8975 [(set_attr "type" "none")
8976 (set_attr "length" "0")])
8978 (define_insn "*tls_load_64"
8979 [(set (match_operand:DI 0 "register_operand" "=d")
8980 (unspec:DI [(match_operand:DI 1 "memory_operand" "RT")
8981 (match_operand:DI 2 "" "")]
8985 [(set_attr "op_type" "RXE")
8986 (set_attr "z10prop" "z10_fwd_A3")])
8988 (define_insn "*tls_load_31"
8989 [(set (match_operand:SI 0 "register_operand" "=d,d")
8990 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
8991 (match_operand:SI 2 "" "")]
8997 [(set_attr "op_type" "RX,RXY")
8998 (set_attr "type" "load")
8999 (set_attr "z10prop" "z10_fwd_A3,z10_fwd_A3")])
9001 (define_insn "*bras_tls"
9002 [(set (match_operand 0 "" "")
9003 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9004 (match_operand 2 "const_int_operand" "n")))
9005 (clobber (match_operand 3 "register_operand" "=r"))
9006 (use (match_operand 4 "" ""))]
9007 "!SIBLING_CALL_P (insn)
9008 && TARGET_SMALL_EXEC
9009 && GET_MODE (operands[3]) == Pmode"
9011 [(set_attr "op_type" "RI")
9012 (set_attr "type" "jsr")
9013 (set_attr "z196prop" "z196_cracked")])
9015 (define_insn "*brasl_tls"
9016 [(set (match_operand 0 "" "")
9017 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9018 (match_operand 2 "const_int_operand" "n")))
9019 (clobber (match_operand 3 "register_operand" "=r"))
9020 (use (match_operand 4 "" ""))]
9021 "!SIBLING_CALL_P (insn)
9023 && GET_MODE (operands[3]) == Pmode"
9025 [(set_attr "op_type" "RIL")
9026 (set_attr "type" "jsr")
9027 (set_attr "z196prop" "z196_cracked")])
9029 (define_insn "*basr_tls"
9030 [(set (match_operand 0 "" "")
9031 (call (mem:QI (match_operand 1 "address_operand" "ZQZR"))
9032 (match_operand 2 "const_int_operand" "n")))
9033 (clobber (match_operand 3 "register_operand" "=r"))
9034 (use (match_operand 4 "" ""))]
9035 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
9037 if (get_attr_op_type (insn) == OP_TYPE_RR)
9038 return "basr\t%3,%1%J4";
9040 return "bas\t%3,%a1%J4";
9042 [(set (attr "op_type")
9043 (if_then_else (match_operand 1 "register_operand" "")
9044 (const_string "RR") (const_string "RX")))
9045 (set_attr "type" "jsr")
9046 (set_attr "atype" "agen")
9047 (set_attr "z196prop" "z196_cracked")])
9050 ;;- Atomic operations
9054 ; memory barrier patterns.
9057 (define_expand "mem_signal_fence"
9058 [(match_operand:SI 0 "const_int_operand")] ;; model
9061 /* The s390 memory model is strong enough not to require any
9062 barrier in order to synchronize a thread with itself. */
9066 (define_expand "mem_thread_fence"
9067 [(match_operand:SI 0 "const_int_operand")] ;; model
9070 /* Unless this is a SEQ_CST fence, the s390 memory model is strong
9071 enough not to require barriers of any kind. */
9072 if (INTVAL (operands[0]) == MEMMODEL_SEQ_CST)
9074 rtx mem = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
9075 MEM_VOLATILE_P (mem) = 1;
9076 emit_insn (gen_mem_thread_fence_1 (mem));
9081 ; Although bcr is superscalar on Z10, this variant will never
9082 ; become part of an execution group.
9083 ; With z196 we can make use of the fast-BCR-serialization facility.
9084 ; This allows for a slightly faster sync which is sufficient for our
9086 (define_insn "mem_thread_fence_1"
9087 [(set (match_operand:BLK 0 "" "")
9088 (unspec:BLK [(match_dup 0)] UNSPEC_MB))]
9096 [(set_attr "op_type" "RR")
9097 (set_attr "mnemonic" "bcr_flush")
9098 (set_attr "z196prop" "z196_alone")])
9101 ; atomic load/store operations
9104 ; Atomic loads need not examine the memory model at all.
9105 (define_expand "atomic_load<mode>"
9106 [(match_operand:DINT 0 "register_operand") ;; output
9107 (match_operand:DINT 1 "memory_operand") ;; memory
9108 (match_operand:SI 2 "const_int_operand")] ;; model
9111 if (<MODE>mode == TImode)
9112 emit_insn (gen_atomic_loadti_1 (operands[0], operands[1]));
9113 else if (<MODE>mode == DImode && !TARGET_ZARCH)
9114 emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1]));
9116 emit_move_insn (operands[0], operands[1]);
9120 ; Different from movdi_31 in that we want no splitters.
9121 (define_insn "atomic_loaddi_1"
9122 [(set (match_operand:DI 0 "register_operand" "=d,d,!*f,!*f")
9123 (unspec:DI [(match_operand:DI 1 "memory_operand" "Q,S,R,T")]
9131 [(set_attr "op_type" "RS,RSY,RS,RSY")
9132 (set_attr "type" "lm,lm,floaddf,floaddf")])
9134 (define_insn "atomic_loadti_1"
9135 [(set (match_operand:TI 0 "register_operand" "=r")
9136 (unspec:TI [(match_operand:TI 1 "memory_operand" "RT")]
9140 [(set_attr "op_type" "RXY")
9141 (set_attr "type" "other")])
9143 ; Atomic stores must(?) enforce sequential consistency.
9144 (define_expand "atomic_store<mode>"
9145 [(match_operand:DINT 0 "memory_operand") ;; memory
9146 (match_operand:DINT 1 "register_operand") ;; input
9147 (match_operand:SI 2 "const_int_operand")] ;; model
9150 enum memmodel model = (enum memmodel) INTVAL (operands[2]);
9152 if (<MODE>mode == TImode)
9153 emit_insn (gen_atomic_storeti_1 (operands[0], operands[1]));
9154 else if (<MODE>mode == DImode && !TARGET_ZARCH)
9155 emit_insn (gen_atomic_storedi_1 (operands[0], operands[1]));
9157 emit_move_insn (operands[0], operands[1]);
9158 if (model == MEMMODEL_SEQ_CST)
9159 emit_insn (gen_mem_thread_fence (operands[2]));
9163 ; Different from movdi_31 in that we want no splitters.
9164 (define_insn "atomic_storedi_1"
9165 [(set (match_operand:DI 0 "memory_operand" "=Q,S,R,T")
9166 (unspec:DI [(match_operand:DI 1 "register_operand" "d,d,!*f,!*f")]
9174 [(set_attr "op_type" "RS,RSY,RS,RSY")
9175 (set_attr "type" "stm,stm,fstoredf,fstoredf")])
9177 (define_insn "atomic_storeti_1"
9178 [(set (match_operand:TI 0 "memory_operand" "=RT")
9179 (unspec:TI [(match_operand:TI 1 "register_operand" "r")]
9183 [(set_attr "op_type" "RXY")
9184 (set_attr "type" "other")])
9187 ; compare and swap patterns.
9190 (define_expand "atomic_compare_and_swap<mode>"
9191 [(match_operand:SI 0 "register_operand") ;; bool success output
9192 (match_operand:DGPR 1 "nonimmediate_operand");; oldval output
9193 (match_operand:DGPR 2 "memory_operand") ;; memory
9194 (match_operand:DGPR 3 "register_operand") ;; expected intput
9195 (match_operand:DGPR 4 "register_operand") ;; newval intput
9196 (match_operand:SI 5 "const_int_operand") ;; is_weak
9197 (match_operand:SI 6 "const_int_operand") ;; success model
9198 (match_operand:SI 7 "const_int_operand")] ;; failure model
9201 rtx cc, cmp, output = operands[1];
9203 if (!register_operand (output, <MODE>mode))
9204 output = gen_reg_rtx (<MODE>mode);
9206 emit_insn (gen_atomic_compare_and_swap<mode>_internal
9207 (output, operands[2], operands[3], operands[4]));
9209 /* We deliberately accept non-register operands in the predicate
9210 to ensure the write back to the output operand happens *before*
9211 the store-flags code below. This makes it easier for combine
9212 to merge the store-flags code with a potential test-and-branch
9213 pattern following (immediately!) afterwards. */
9214 if (output != operands[1])
9215 emit_move_insn (operands[1], output);
9217 cc = gen_rtx_REG (CCZ1mode, CC_REGNUM);
9218 cmp = gen_rtx_EQ (SImode, cc, const0_rtx);
9219 emit_insn (gen_cstorecc4 (operands[0], cmp, cc, const0_rtx));
9223 (define_expand "atomic_compare_and_swap<mode>"
9224 [(match_operand:SI 0 "register_operand") ;; bool success output
9225 (match_operand:HQI 1 "nonimmediate_operand") ;; oldval output
9226 (match_operand:HQI 2 "memory_operand") ;; memory
9227 (match_operand:HQI 3 "general_operand") ;; expected intput
9228 (match_operand:HQI 4 "general_operand") ;; newval intput
9229 (match_operand:SI 5 "const_int_operand") ;; is_weak
9230 (match_operand:SI 6 "const_int_operand") ;; success model
9231 (match_operand:SI 7 "const_int_operand")] ;; failure model
9234 s390_expand_cs_hqi (<MODE>mode, operands[0], operands[1], operands[2],
9235 operands[3], operands[4], INTVAL (operands[5]));
9239 (define_expand "atomic_compare_and_swap<mode>_internal"
9241 [(set (match_operand:DGPR 0 "register_operand")
9242 (match_operand:DGPR 1 "memory_operand"))
9244 (unspec_volatile:DGPR
9246 (match_operand:DGPR 2 "register_operand")
9247 (match_operand:DGPR 3 "register_operand")]
9249 (set (reg:CCZ1 CC_REGNUM)
9250 (compare:CCZ1 (match_dup 1) (match_dup 2)))])]
9254 (define_insn "*atomic_compare_and_swap<mode>_1"
9255 [(set (match_operand:TDI 0 "register_operand" "=r")
9256 (match_operand:TDI 1 "memory_operand" "+QS"))
9258 (unspec_volatile:TDI
9260 (match_operand:TDI 2 "register_operand" "0")
9261 (match_operand:TDI 3 "register_operand" "r")]
9263 (set (reg:CCZ1 CC_REGNUM)
9264 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9266 "c<td>sg\t%0,%3,%S1"
9267 [(set_attr "op_type" "RSY")
9268 (set_attr "type" "sem")])
9271 (define_insn "*atomic_compare_and_swapdi_2"
9272 [(set (match_operand:DI 0 "register_operand" "=r,r")
9273 (match_operand:DI 1 "memory_operand" "+Q,S"))
9277 (match_operand:DI 2 "register_operand" "0,0")
9278 (match_operand:DI 3 "register_operand" "r,r")]
9280 (set (reg:CCZ1 CC_REGNUM)
9281 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9286 [(set_attr "op_type" "RS,RSY")
9287 (set_attr "type" "sem")])
9290 (define_insn "*atomic_compare_and_swapsi_3"
9291 [(set (match_operand:SI 0 "register_operand" "=r,r")
9292 (match_operand:SI 1 "memory_operand" "+Q,S"))
9296 (match_operand:SI 2 "register_operand" "0,0")
9297 (match_operand:SI 3 "register_operand" "r,r")]
9299 (set (reg:CCZ1 CC_REGNUM)
9300 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9305 [(set_attr "op_type" "RS,RSY")
9306 (set_attr "type" "sem")])
9309 ; Other atomic instruction patterns.
9312 ; z196 load and add, xor, or and and instructions
9314 (define_expand "atomic_fetch_<atomic><mode>"
9315 [(match_operand:GPR 0 "register_operand") ;; val out
9317 (match_operand:GPR 1 "memory_operand") ;; memory
9318 (match_operand:GPR 2 "register_operand")) ;; val in
9319 (match_operand:SI 3 "const_int_operand")] ;; model
9322 emit_insn (gen_atomic_fetch_<atomic><mode>_iaf
9323 (operands[0], operands[1], operands[2]));
9327 ; lan, lang, lao, laog, lax, laxg, laa, laag
9328 (define_insn "atomic_fetch_<atomic><mode>_iaf"
9329 [(set (match_operand:GPR 0 "register_operand" "=d")
9330 (match_operand:GPR 1 "memory_operand" "+QS"))
9332 (unspec_volatile:GPR
9333 [(ATOMIC_Z196:GPR (match_dup 1)
9334 (match_operand:GPR 2 "general_operand" "d"))]
9336 (clobber (reg:CC CC_REGNUM))]
9338 "la<noxa><g>\t%0,%2,%1"
9339 [(set_attr "op_type" "RSY")
9340 (set_attr "type" "sem")])
9342 ;; For SImode and larger, the optabs.c code will do just fine in
9343 ;; expanding a compare-and-swap loop. For QI/HImode, we can do
9344 ;; better by expanding our own loop.
9346 (define_expand "atomic_<atomic><mode>"
9348 (match_operand:HQI 0 "memory_operand") ;; memory
9349 (match_operand:HQI 1 "general_operand")) ;; val in
9350 (match_operand:SI 2 "const_int_operand")] ;; model
9353 s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0],
9354 operands[1], false);
9358 (define_expand "atomic_fetch_<atomic><mode>"
9359 [(match_operand:HQI 0 "register_operand") ;; val out
9361 (match_operand:HQI 1 "memory_operand") ;; memory
9362 (match_operand:HQI 2 "general_operand")) ;; val in
9363 (match_operand:SI 3 "const_int_operand")] ;; model
9366 s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
9367 operands[2], false);
9371 (define_expand "atomic_<atomic>_fetch<mode>"
9372 [(match_operand:HQI 0 "register_operand") ;; val out
9374 (match_operand:HQI 1 "memory_operand") ;; memory
9375 (match_operand:HQI 2 "general_operand")) ;; val in
9376 (match_operand:SI 3 "const_int_operand")] ;; model
9379 s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
9384 (define_expand "atomic_exchange<mode>"
9385 [(match_operand:HQI 0 "register_operand") ;; val out
9386 (match_operand:HQI 1 "memory_operand") ;; memory
9387 (match_operand:HQI 2 "general_operand") ;; val in
9388 (match_operand:SI 3 "const_int_operand")] ;; model
9391 s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1],
9392 operands[2], false);
9397 ;;- Miscellaneous instructions.
9401 ; allocate stack instruction pattern(s).
9404 (define_expand "allocate_stack"
9405 [(match_operand 0 "general_operand" "")
9406 (match_operand 1 "general_operand" "")]
9409 rtx temp = gen_reg_rtx (Pmode);
9411 emit_move_insn (temp, s390_back_chain_rtx ());
9412 anti_adjust_stack (operands[1]);
9413 emit_move_insn (s390_back_chain_rtx (), temp);
9415 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9421 ; setjmp instruction pattern.
9424 (define_expand "builtin_setjmp_receiver"
9425 [(match_operand 0 "" "")]
9428 emit_insn (s390_load_got ());
9429 emit_use (pic_offset_table_rtx);
9433 ;; These patterns say how to save and restore the stack pointer. We need not
9434 ;; save the stack pointer at function level since we are careful to
9435 ;; preserve the backchain. At block level, we have to restore the backchain
9436 ;; when we restore the stack pointer.
9438 ;; For nonlocal gotos, we must save both the stack pointer and its
9439 ;; backchain and restore both. Note that in the nonlocal case, the
9440 ;; save area is a memory location.
9442 (define_expand "save_stack_function"
9443 [(match_operand 0 "general_operand" "")
9444 (match_operand 1 "general_operand" "")]
9448 (define_expand "restore_stack_function"
9449 [(match_operand 0 "general_operand" "")
9450 (match_operand 1 "general_operand" "")]
9454 (define_expand "restore_stack_block"
9455 [(match_operand 0 "register_operand" "")
9456 (match_operand 1 "register_operand" "")]
9459 rtx temp = gen_reg_rtx (Pmode);
9461 emit_move_insn (temp, s390_back_chain_rtx ());
9462 emit_move_insn (operands[0], operands[1]);
9463 emit_move_insn (s390_back_chain_rtx (), temp);
9468 (define_expand "save_stack_nonlocal"
9469 [(match_operand 0 "memory_operand" "")
9470 (match_operand 1 "register_operand" "")]
9473 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
9475 /* Copy the backchain to the first word, sp to the second and the
9476 literal pool base to the third. */
9478 rtx save_bc = adjust_address (operands[0], Pmode, 0);
9479 rtx save_sp = adjust_address (operands[0], Pmode, GET_MODE_SIZE (Pmode));
9480 rtx save_bp = adjust_address (operands[0], Pmode, 2 * GET_MODE_SIZE (Pmode));
9482 if (TARGET_BACKCHAIN)
9483 emit_move_insn (save_bc, force_reg (Pmode, s390_back_chain_rtx ()));
9485 emit_move_insn (save_sp, operands[1]);
9486 emit_move_insn (save_bp, base);
9491 (define_expand "restore_stack_nonlocal"
9492 [(match_operand 0 "register_operand" "")
9493 (match_operand 1 "memory_operand" "")]
9496 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
9497 rtx temp = NULL_RTX;
9499 /* Restore the backchain from the first word, sp from the second and the
9500 literal pool base from the third. */
9502 rtx save_bc = adjust_address (operands[1], Pmode, 0);
9503 rtx save_sp = adjust_address (operands[1], Pmode, GET_MODE_SIZE (Pmode));
9504 rtx save_bp = adjust_address (operands[1], Pmode, 2 * GET_MODE_SIZE (Pmode));
9506 if (TARGET_BACKCHAIN)
9507 temp = force_reg (Pmode, save_bc);
9509 emit_move_insn (base, save_bp);
9510 emit_move_insn (operands[0], save_sp);
9513 emit_move_insn (s390_back_chain_rtx (), temp);
9519 (define_expand "exception_receiver"
9523 s390_set_has_landing_pad_p (true);
9528 ; nop instruction pattern(s).
9535 [(set_attr "op_type" "RR")
9536 (set_attr "z10prop" "z10_fr_E1")])
9542 [(set_attr "op_type" "RR")])
9546 ; Special literal pool access instruction pattern(s).
9549 (define_insn "*pool_entry"
9550 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
9551 UNSPECV_POOL_ENTRY)]
9554 enum machine_mode mode = GET_MODE (PATTERN (insn));
9555 unsigned int align = GET_MODE_BITSIZE (mode);
9556 s390_output_pool_entry (operands[0], mode, align);
9559 [(set (attr "length")
9560 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
9562 (define_insn "pool_align"
9563 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")]
9564 UNSPECV_POOL_ALIGN)]
9567 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
9569 (define_insn "pool_section_start"
9570 [(unspec_volatile [(const_int 1)] UNSPECV_POOL_SECTION)]
9573 [(set_attr "length" "0")])
9575 (define_insn "pool_section_end"
9576 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_SECTION)]
9579 [(set_attr "length" "0")])
9581 (define_insn "main_base_31_small"
9582 [(set (match_operand 0 "register_operand" "=a")
9583 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
9584 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
9586 [(set_attr "op_type" "RR")
9587 (set_attr "type" "la")
9588 (set_attr "z196prop" "z196_cracked")])
9590 (define_insn "main_base_31_large"
9591 [(set (match_operand 0 "register_operand" "=a")
9592 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
9593 (set (pc) (label_ref (match_operand 2 "" "")))]
9594 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
9596 [(set_attr "op_type" "RI")
9597 (set_attr "z196prop" "z196_cracked")])
9599 (define_insn "main_base_64"
9600 [(set (match_operand 0 "register_operand" "=a")
9601 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
9602 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
9604 [(set_attr "op_type" "RIL")
9605 (set_attr "type" "larl")
9606 (set_attr "z10prop" "z10_fwd_A1")])
9608 (define_insn "main_pool"
9609 [(set (match_operand 0 "register_operand" "=a")
9610 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
9611 "GET_MODE (operands[0]) == Pmode"
9616 (if_then_else (match_test "TARGET_CPU_ZARCH")
9617 (const_string "larl") (const_string "la")))])
9619 (define_insn "reload_base_31"
9620 [(set (match_operand 0 "register_operand" "=a")
9621 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
9622 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
9623 "basr\t%0,0\;la\t%0,%1-.(%0)"
9624 [(set_attr "length" "6")
9625 (set_attr "type" "la")
9626 (set_attr "z196prop" "z196_cracked")])
9628 (define_insn "reload_base_64"
9629 [(set (match_operand 0 "register_operand" "=a")
9630 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
9631 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
9633 [(set_attr "op_type" "RIL")
9634 (set_attr "type" "larl")
9635 (set_attr "z10prop" "z10_fwd_A1")])
9638 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
9643 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
9646 ;; Insns related to generating the function prologue and epilogue.
9650 (define_expand "prologue"
9651 [(use (const_int 0))]
9653 "s390_emit_prologue (); DONE;")
9655 (define_expand "epilogue"
9656 [(use (const_int 1))]
9658 "s390_emit_epilogue (false); DONE;")
9660 (define_expand "sibcall_epilogue"
9661 [(use (const_int 0))]
9663 "s390_emit_epilogue (true); DONE;")
9665 (define_insn "*return"
9667 (use (match_operand 0 "register_operand" "a"))]
9668 "GET_MODE (operands[0]) == Pmode"
9670 [(set_attr "op_type" "RR")
9671 (set_attr "type" "jsr")
9672 (set_attr "atype" "agen")])
9675 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
9676 ;; pointer. This is used for compatibility.
9678 (define_expand "ptr_extend"
9679 [(set (match_operand:DI 0 "register_operand" "=r")
9680 (match_operand:SI 1 "register_operand" "r"))]
9683 emit_insn (gen_anddi3 (operands[0],
9684 gen_lowpart (DImode, operands[1]),
9685 GEN_INT (0x7fffffff)));
9689 ;; Instruction definition to expand eh_return macro to support
9690 ;; swapping in special linkage return addresses.
9692 (define_expand "eh_return"
9693 [(use (match_operand 0 "register_operand" ""))]
9696 s390_emit_tpf_eh_return (operands[0]);
9701 ; Stack Protector Patterns
9704 (define_expand "stack_protect_set"
9705 [(set (match_operand 0 "memory_operand" "")
9706 (match_operand 1 "memory_operand" ""))]
9709 #ifdef TARGET_THREAD_SSP_OFFSET
9711 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
9712 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
9715 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
9717 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
9722 (define_insn "stack_protect_set<mode>"
9723 [(set (match_operand:DSI 0 "memory_operand" "=Q")
9724 (unspec:DSI [(match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_SET))]
9726 "mvc\t%O0(%G0,%R0),%S1"
9727 [(set_attr "op_type" "SS")])
9729 (define_expand "stack_protect_test"
9730 [(set (reg:CC CC_REGNUM)
9731 (compare (match_operand 0 "memory_operand" "")
9732 (match_operand 1 "memory_operand" "")))
9733 (match_operand 2 "" "")]
9737 #ifdef TARGET_THREAD_SSP_OFFSET
9739 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
9740 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
9743 emit_insn (gen_stack_protect_testdi (operands[0], operands[1]));
9745 emit_insn (gen_stack_protect_testsi (operands[0], operands[1]));
9747 cc_reg = gen_rtx_REG (CCZmode, CC_REGNUM);
9748 test = gen_rtx_EQ (VOIDmode, cc_reg, const0_rtx);
9749 emit_jump_insn (gen_cbranchcc4 (test, cc_reg, const0_rtx, operands[2]));
9753 (define_insn "stack_protect_test<mode>"
9754 [(set (reg:CCZ CC_REGNUM)
9755 (unspec:CCZ [(match_operand:DSI 0 "memory_operand" "Q")
9756 (match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_TEST))]
9758 "clc\t%O0(%G0,%R0),%S1"
9759 [(set_attr "op_type" "SS")])
9761 ; This is used in s390_emit_prologue in order to prevent insns
9762 ; adjusting the stack pointer to be moved over insns writing stack
9763 ; slots using a copy of the stack pointer in a different register.
9764 (define_insn "stack_tie"
9765 [(set (match_operand:BLK 0 "memory_operand" "+m")
9766 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
9769 [(set_attr "length" "0")])
9773 ; Data prefetch patterns
9776 (define_insn "prefetch"
9777 [(prefetch (match_operand 0 "address_operand" "ZQZRZSZT,X")
9778 (match_operand:SI 1 "const_int_operand" " n,n")
9779 (match_operand:SI 2 "const_int_operand" " n,n"))]
9782 switch (which_alternative)
9785 return INTVAL (operands[1]) == 1 ? "pfd\t2,%a0" : "pfd\t1,%a0";
9787 if (larl_operand (operands[0], Pmode))
9788 return INTVAL (operands[1]) == 1 ? "pfdrl\t2,%a0" : "pfdrl\t1,%a0";
9791 /* This might be reached for symbolic operands with an odd
9792 addend. We simply omit the prefetch for such rare cases. */
9797 [(set_attr "type" "load,larl")
9798 (set_attr "op_type" "RXY,RIL")
9799 (set_attr "z10prop" "z10_super")
9800 (set_attr "z196prop" "z196_alone")])
9804 ; Byte swap instructions
9807 (define_insn "bswap<mode>2"
9808 [(set (match_operand:GPR 0 "register_operand" "=d, d")
9809 (bswap:GPR (match_operand:GPR 1 "nonimmediate_operand" " d,RT")))]
9814 [(set_attr "type" "*,load")
9815 (set_attr "op_type" "RRE,RXY")
9816 (set_attr "z10prop" "z10_super")])
9820 ; Population count instruction
9823 ; The S/390 popcount instruction counts the bits of op1 in 8 byte
9824 ; portions and stores the result in the corresponding bytes in op0.
9825 (define_insn "*popcount<mode>"
9826 [(set (match_operand:INT 0 "register_operand" "=d")
9827 (unspec:INT [(match_operand:INT 1 "register_operand" "d")] UNSPEC_POPCNT))
9828 (clobber (reg:CC CC_REGNUM))]
9831 [(set_attr "op_type" "RRE")])
9833 (define_expand "popcountdi2"
9835 (parallel [(set (match_operand:DI 0 "register_operand" "")
9836 (unspec:DI [(match_operand:DI 1 "register_operand")]
9838 (clobber (reg:CC CC_REGNUM))])
9840 (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 32)))
9842 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
9843 (clobber (reg:CC CC_REGNUM))])
9846 (ashift:DI (match_dup 0) (const_int 16)))
9848 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
9849 (clobber (reg:CC CC_REGNUM))])
9851 (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 8)))
9853 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
9854 (clobber (reg:CC CC_REGNUM))])
9856 (set (match_dup 0) (lshiftrt:DI (match_dup 0) (const_int 56)))]
9857 "TARGET_Z196 && TARGET_64BIT"
9858 "operands[2] = gen_reg_rtx (DImode);")
9860 (define_expand "popcountsi2"
9862 (parallel [(set (match_operand:SI 0 "register_operand" "")
9863 (unspec:SI [(match_operand:SI 1 "register_operand")]
9865 (clobber (reg:CC CC_REGNUM))])
9868 (ashift:SI (match_dup 0) (const_int 16)))
9870 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
9871 (clobber (reg:CC CC_REGNUM))])
9873 (set (match_dup 2) (ashift:SI (match_dup 0) (const_int 8)))
9875 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
9876 (clobber (reg:CC CC_REGNUM))])
9878 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 24)))]
9880 "operands[2] = gen_reg_rtx (SImode);")
9882 (define_expand "popcounthi2"
9884 (parallel [(set (match_operand:HI 0 "register_operand" "")
9885 (unspec:HI [(match_operand:HI 1 "register_operand")]
9887 (clobber (reg:CC CC_REGNUM))])
9890 (ashift:SI (match_dup 0) (const_int 8)))
9892 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
9893 (clobber (reg:CC CC_REGNUM))])
9895 (set (match_dup 0) (lshiftrt:HI (match_dup 0) (const_int 8)))]
9897 "operands[2] = gen_reg_rtx (SImode);")
9899 (define_expand "popcountqi2"
9901 (parallel [(set (match_operand:QI 0 "register_operand" "")
9902 (unspec:QI [(match_operand:QI 1 "register_operand")]
9904 (clobber (reg:CC CC_REGNUM))])]
9909 ;;- Copy sign instructions
9912 (define_insn "copysign<mode>3"
9913 [(set (match_operand:FP 0 "register_operand" "=f")
9914 (unspec:FP [(match_operand:FP 1 "register_operand" "<fT0>")
9915 (match_operand:FP 2 "register_operand" "f")]
9919 [(set_attr "op_type" "RRF")
9920 (set_attr "type" "fsimp<mode>")])
9924 ;;- Transactional execution instructions
9927 ; This splitter helps combine to make use of CC directly when
9928 ; comparing the integer result of a tbegin builtin with a constant.
9929 ; The unspec is already removed by canonicalize_comparison. So this
9930 ; splitters only job is to turn the PARALLEL into separate insns
9931 ; again. Unfortunately this only works with the very first cc/int
9932 ; compare since combine is not able to deal with data flow across
9933 ; basic block boundaries.
9935 ; It needs to be an insn pattern as well since combine does not apply
9936 ; the splitter directly. Combine would only use it if it actually
9937 ; would reduce the number of instructions.
9938 (define_insn_and_split "*ccraw_to_int"
9941 (match_operator 0 "s390_eqne_operator"
9942 [(reg:CCRAW CC_REGNUM)
9943 (match_operand 1 "const_int_operand" "")])
9944 (label_ref (match_operand 2 "" ""))
9946 (set (match_operand:SI 3 "register_operand" "=d")
9947 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
9952 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))
9954 (if_then_else (match_op_dup 0 [(reg:CCRAW CC_REGNUM) (match_dup 1)])
9955 (label_ref (match_dup 2))
9959 ; Non-constrained transaction begin
9961 (define_expand "tbegin"
9962 [(match_operand:SI 0 "register_operand" "")
9963 (match_operand:BLK 1 "memory_operand" "")]
9966 s390_expand_tbegin (operands[0], operands[1], NULL_RTX, true);
9970 (define_expand "tbegin_nofloat"
9971 [(match_operand:SI 0 "register_operand" "")
9972 (match_operand:BLK 1 "memory_operand" "")]
9975 s390_expand_tbegin (operands[0], operands[1], NULL_RTX, false);
9979 (define_expand "tbegin_retry"
9980 [(match_operand:SI 0 "register_operand" "")
9981 (match_operand:BLK 1 "memory_operand" "")
9982 (match_operand:SI 2 "general_operand" "")]
9985 s390_expand_tbegin (operands[0], operands[1], operands[2], true);
9989 (define_expand "tbegin_retry_nofloat"
9990 [(match_operand:SI 0 "register_operand" "")
9991 (match_operand:BLK 1 "memory_operand" "")
9992 (match_operand:SI 2 "general_operand" "")]
9995 s390_expand_tbegin (operands[0], operands[1], operands[2], false);
9999 (define_insn "tbegin_1"
10000 [(set (reg:CCRAW CC_REGNUM)
10001 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10003 (set (match_operand:BLK 1 "memory_operand" "=Q")
10004 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))
10005 (clobber (reg:DF 16))
10006 (clobber (reg:DF 17))
10007 (clobber (reg:DF 18))
10008 (clobber (reg:DF 19))
10009 (clobber (reg:DF 20))
10010 (clobber (reg:DF 21))
10011 (clobber (reg:DF 22))
10012 (clobber (reg:DF 23))
10013 (clobber (reg:DF 24))
10014 (clobber (reg:DF 25))
10015 (clobber (reg:DF 26))
10016 (clobber (reg:DF 27))
10017 (clobber (reg:DF 28))
10018 (clobber (reg:DF 29))
10019 (clobber (reg:DF 30))
10020 (clobber (reg:DF 31))]
10021 ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is
10022 ; not supposed to be used for immediates (see genpreds.c).
10023 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10025 [(set_attr "op_type" "SIL")])
10027 ; Same as above but without the FPR clobbers
10028 (define_insn "tbegin_nofloat_1"
10029 [(set (reg:CCRAW CC_REGNUM)
10030 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10032 (set (match_operand:BLK 1 "memory_operand" "=Q")
10033 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))]
10034 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10036 [(set_attr "op_type" "SIL")])
10039 ; Constrained transaction begin
10041 (define_expand "tbeginc"
10042 [(set (reg:CCRAW CC_REGNUM)
10043 (unspec_volatile:CCRAW [(const_int TBEGINC_MASK)]
10048 (define_insn "*tbeginc_1"
10049 [(set (reg:CCRAW CC_REGNUM)
10050 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" " D")]
10052 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10054 [(set_attr "op_type" "SIL")])
10058 (define_expand "tend"
10059 [(set (reg:CCRAW CC_REGNUM)
10060 (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))
10061 (set (match_operand:SI 0 "register_operand" "")
10062 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
10066 (define_insn "*tend_1"
10067 [(set (reg:CCRAW CC_REGNUM)
10068 (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))]
10071 [(set_attr "op_type" "S")])
10073 ; Transaction abort
10075 (define_expand "tabort"
10076 [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "")]
10078 "TARGET_HTM && operands != NULL"
10080 if (CONST_INT_P (operands[0])
10081 && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 255)
10083 error ("Invalid transaction abort code: " HOST_WIDE_INT_PRINT_DEC
10084 ". Values in range 0 through 255 are reserved.",
10085 INTVAL (operands[0]));
10090 (define_insn "*tabort_1"
10091 [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "Y")]
10093 "TARGET_HTM && operands != NULL"
10095 [(set_attr "op_type" "S")])
10097 ; Transaction extract nesting depth
10099 (define_insn "etnd"
10100 [(set (match_operand:SI 0 "register_operand" "=d")
10101 (unspec_volatile:SI [(const_int 0)] UNSPECV_ETND))]
10104 [(set_attr "op_type" "RRE")])
10106 ; Non-transactional store
10108 (define_insn "ntstg"
10109 [(set (match_operand:DI 0 "memory_operand" "=RT")
10110 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "d")]
10114 [(set_attr "op_type" "RXY")])
10116 ; Transaction perform processor assist
10118 (define_expand "tx_assist"
10119 [(unspec_volatile [(match_operand:SI 0 "register_operand" "")
10120 (reg:SI GPR0_REGNUM)
10126 (define_insn "*ppa"
10127 [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")
10128 (match_operand:SI 1 "register_operand" "d")
10129 (match_operand 2 "const_int_operand" "I")]
10131 "TARGET_HTM && INTVAL (operands[2]) < 16"
10133 [(set_attr "op_type" "RRF")])