1 ;;- Machine description for GNU compiler -- S/390 / zSeries version.
2 ;; Copyright (C) 1999-2016 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 ; The right hand side of an setmem
76 ; GOT/PLT and lt-relative accesses
97 ; TLS relocation specifiers
113 ; Stack Smashing Protector
117 ; Test Data Class (TDC)
129 UNSPEC_FPINT_NEARBYINT
138 UNSPEC_VEC_SMULT_EVEN
139 UNSPEC_VEC_UMULT_EVEN
153 UNSPEC_VEC_INSERT_AND_ZERO
154 UNSPEC_VEC_LOAD_BNDRY
159 UNSPEC_VEC_PACK_SATURATE
160 UNSPEC_VEC_PACK_SATURATE_CC
161 UNSPEC_VEC_PACK_SATURATE_GENCC
162 UNSPEC_VEC_PACK_UNSIGNED_SATURATE
163 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_CC
164 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_GENCC
176 UNSPEC_VEC_ADDEC_U128
181 UNSPEC_VEC_GFMSUM_128
182 UNSPEC_VEC_GFMSUM_ACCUM
183 UNSPEC_VEC_GFMSUM_ACCUM_128
202 UNSPEC_VEC_SUBEC_U128
236 ;; UNSPEC_VOLATILE usage
239 (define_c_enum "unspecv" [
261 ; Hotpatching (unremovable NOPs)
266 ; Transactional Execution support
276 ; Set and get floating point control register
285 ; Registers with special meaning
289 ; Sibling call register.
291 ; Literal pool base register.
293 ; Return address register.
295 ; Condition code register.
297 ; Thread local storage pointer register.
301 ; Hardware register names
305 ; General purpose registers
310 ; Floating point registers.
335 ;; PFPO GPR0 argument format
340 ; PFPO operation type
341 (PFPO_CONVERT 0x1000000)
343 (PFPO_OP_TYPE_SF 0x5)
344 (PFPO_OP_TYPE_DF 0x6)
345 (PFPO_OP_TYPE_TF 0x7)
346 (PFPO_OP_TYPE_SD 0x8)
347 (PFPO_OP_TYPE_DD 0x9)
348 (PFPO_OP_TYPE_TD 0xa)
349 ; Bitposition of operand types
350 (PFPO_OP0_TYPE_SHIFT 16)
351 (PFPO_OP1_TYPE_SHIFT 8)
354 ; Immediate operands for tbegin and tbeginc
355 (define_constants [(TBEGIN_MASK 65292)]) ; 0xff0c
356 (define_constants [(TBEGINC_MASK 65288)]) ; 0xff08
358 ;; Instruction operand type as used in the Principles of Operation.
359 ;; Used to determine defaults for length and other attribute values.
361 (define_attr "op_type"
362 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY,RRF,RRR,SIL,RRS,RIS,VRI,VRR,VRS,VRV,VRX"
365 ;; Instruction type attribute used for scheduling.
367 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
368 cs,vs,store,sem,idiv,
369 imulhi,imulsi,imuldi,
370 branch,jsr,fsimptf,fsimpdf,fsimpsf,fhex,
371 floadtf,floaddf,floadsf,fstoredf,fstoresf,
372 fmultf,fmuldf,fmulsf,fdivtf,fdivdf,fdivsf,
373 ftoi,fsqrttf,fsqrtdf,fsqrtsf,
375 ftrunctf,ftruncdf, ftruncsd, ftruncdd,
376 itoftf, itofdf, itofsf, itofdd, itoftd,
377 fdivdd, fdivtd, floaddd, floadsd, fmuldd, fmultd,
378 fsimpdd, fsimpsd, fsimptd, fstoredd, fstoresd,
380 (cond [(eq_attr "op_type" "NN") (const_string "other")
381 (eq_attr "op_type" "SS") (const_string "cs")]
382 (const_string "integer")))
384 ;; Another attribute used for scheduling purposes:
385 ;; agen: Instruction uses the address generation unit
386 ;; reg: Instruction does not use the agen unit
388 (define_attr "atype" "agen,reg"
389 (if_then_else (eq_attr "op_type" "E,RR,RI,RRE,RSI,RIL,RIE,RRF,RRR")
391 (const_string "agen")))
393 ;; Properties concerning Z10 execution grouping and value forwarding.
394 ;; z10_super: instruction is superscalar.
395 ;; z10_super_c: instruction is superscalar and meets the condition of z10_c.
396 ;; z10_fwd: The instruction reads the value of an operand and stores it into a
397 ;; target register. It can forward this value to a second instruction that reads
398 ;; the same register if that second instruction is issued in the same group.
399 ;; z10_rec: The instruction is in the T pipeline and reads a register. If the
400 ;; instruction in the S pipe writes to the register, then the T instruction
401 ;; can immediately read the new value.
402 ;; z10_fr: union of Z10_fwd and z10_rec.
403 ;; z10_c: second operand of instruction is a register and read with complemented bits.
405 ;; An additional suffix A1, A3, or E1 indicates the respective AGI bypass.
408 (define_attr "z10prop" "none,
409 z10_super, z10_super_E1, z10_super_A1, z10_super_c, z10_super_c_E1,
410 z10_fwd, z10_fwd_A1, z10_fwd_A3, z10_fwd_E1,
412 z10_fr, z10_fr_A3, z10_fr_E1,
414 (const_string "none"))
416 ;; Properties concerning Z196 decoding
417 ;; z196_alone: must group alone
418 ;; z196_end: ends a group
419 ;; z196_cracked: instruction is cracked or expanded
420 (define_attr "z196prop" "none,
421 z196_alone, z196_ends,
423 (const_string "none"))
425 (define_attr "mnemonic" "bcr_flush,unknown" (const_string "unknown"))
429 (define_attr "length" ""
430 (cond [(eq_attr "op_type" "E,RR") (const_int 2)
431 (eq_attr "op_type" "RX,RI,RRE,RS,RSI,S,SI,RRF,RRR") (const_int 4)]
435 ;; Processor type. This attribute must exactly match the processor_type
436 ;; enumeration in s390.h. The current machine description does not
437 ;; distinguish between g5 and g6, but there are differences between the two
438 ;; CPUs could in theory be modeled.
440 (define_attr "cpu" "g5,g6,z900,z990,z9_109,z9_ec,z10,z196,zEC12,z13"
441 (const (symbol_ref "s390_tune_attr")))
443 (define_attr "cpu_facility"
444 "standard,ieee,zarch,cpu_zarch,longdisp,extimm,dfp,z10,z196,zEC12,vec"
445 (const_string "standard"))
447 (define_attr "enabled" ""
448 (cond [(eq_attr "cpu_facility" "standard")
451 (and (eq_attr "cpu_facility" "ieee")
452 (match_test "TARGET_CPU_IEEE_FLOAT"))
455 (and (eq_attr "cpu_facility" "zarch")
456 (match_test "TARGET_ZARCH"))
459 (and (eq_attr "cpu_facility" "longdisp")
460 (match_test "TARGET_LONG_DISPLACEMENT"))
463 (and (eq_attr "cpu_facility" "extimm")
464 (match_test "TARGET_EXTIMM"))
467 (and (eq_attr "cpu_facility" "dfp")
468 (match_test "TARGET_DFP"))
471 (and (eq_attr "cpu_facility" "cpu_zarch")
472 (match_test "TARGET_CPU_ZARCH"))
475 (and (eq_attr "cpu_facility" "z10")
476 (match_test "TARGET_Z10"))
479 (and (eq_attr "cpu_facility" "z196")
480 (match_test "TARGET_Z196"))
483 (and (eq_attr "cpu_facility" "zEC12")
484 (match_test "TARGET_ZEC12"))
487 (and (eq_attr "cpu_facility" "vec")
488 (match_test "TARGET_VX"))
492 ;; Pipeline description for z900. For lack of anything better,
493 ;; this description is also used for the g5 and g6.
496 ;; Pipeline description for z990, z9-109 and z9-ec.
499 ;; Pipeline description for z10
502 ;; Pipeline description for z196
505 ;; Pipeline description for zEC12
509 (include "predicates.md")
511 ;; Constraint definitions
512 (include "constraints.md")
519 (define_mode_iterator ALL [TI DI SI HI QI TF DF SF TD DD SD V1QI V2QI V4QI V8QI V16QI V1HI V2HI V4HI V8HI V1SI V2SI V4SI V1DI V2DI V1SF V2SF V4SF V1TI V1DF V2DF V1TF])
521 ;; These mode iterators allow floating point patterns to be generated from the
523 (define_mode_iterator FP_ALL [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")
524 (SD "TARGET_HARD_DFP")])
525 (define_mode_iterator FP [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")])
526 (define_mode_iterator BFP [TF DF SF])
527 (define_mode_iterator DFP [TD DD])
528 (define_mode_iterator DFP_ALL [TD DD SD])
529 (define_mode_iterator DSF [DF SF])
530 (define_mode_iterator SD_SF [SF SD])
531 (define_mode_iterator DD_DF [DF DD])
532 (define_mode_iterator TD_TF [TF TD])
534 ;; These mode iterators allow 31-bit and 64-bit GPR patterns to be generated
535 ;; from the same template.
536 (define_mode_iterator GPR [(DI "TARGET_ZARCH") SI])
537 (define_mode_iterator DGPR [(TI "TARGET_ZARCH") DI SI])
538 (define_mode_iterator DSI [DI SI])
539 (define_mode_iterator TDI [TI DI])
541 ;; These mode iterators allow :P to be used for patterns that operate on
542 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
543 (define_mode_iterator P [(DI "TARGET_64BIT") (SI "!TARGET_64BIT")])
545 ;; These macros refer to the actual word_mode of the configuration.
546 ;; This is equal to Pmode except on 31-bit machines in zarch mode.
547 (define_mode_iterator DW [(TI "TARGET_ZARCH") (DI "!TARGET_ZARCH")])
548 (define_mode_iterator W [(DI "TARGET_ZARCH") (SI "!TARGET_ZARCH")])
550 ;; Used by the umul pattern to express modes having half the size.
551 (define_mode_attr DWH [(TI "DI") (DI "SI")])
552 (define_mode_attr dwh [(TI "di") (DI "si")])
554 ;; This mode iterator allows the QI and HI patterns to be defined from
555 ;; the same template.
556 (define_mode_iterator HQI [HI QI])
558 ;; This mode iterator allows the integer patterns to be defined from the
560 (define_mode_iterator INT [(DI "TARGET_ZARCH") SI HI QI])
561 (define_mode_iterator DINT [(TI "TARGET_ZARCH") DI SI HI QI])
563 ;; This iterator allows some 'ashift' and 'lshiftrt' pattern to be defined from
564 ;; the same template.
565 (define_code_iterator SHIFT [ashift lshiftrt])
567 ;; This iterator allows r[ox]sbg to be defined with the same template
568 (define_code_iterator IXOR [ior xor])
570 ;; This iterator is used to expand the patterns for the nearest
571 ;; integer functions.
572 (define_int_iterator FPINT [UNSPEC_FPINT_FLOOR UNSPEC_FPINT_BTRUNC
573 UNSPEC_FPINT_ROUND UNSPEC_FPINT_CEIL
574 UNSPEC_FPINT_NEARBYINT])
575 (define_int_attr fpint_name [(UNSPEC_FPINT_FLOOR "floor")
576 (UNSPEC_FPINT_BTRUNC "btrunc")
577 (UNSPEC_FPINT_ROUND "round")
578 (UNSPEC_FPINT_CEIL "ceil")
579 (UNSPEC_FPINT_NEARBYINT "nearbyint")])
580 (define_int_attr fpint_roundingmode [(UNSPEC_FPINT_FLOOR "7")
581 (UNSPEC_FPINT_BTRUNC "5")
582 (UNSPEC_FPINT_ROUND "1")
583 (UNSPEC_FPINT_CEIL "6")
584 (UNSPEC_FPINT_NEARBYINT "0")])
586 ;; This iterator and attribute allow to combine most atomic operations.
587 (define_code_iterator ATOMIC [and ior xor plus minus mult])
588 (define_code_iterator ATOMIC_Z196 [and ior xor plus])
589 (define_code_attr atomic [(and "and") (ior "or") (xor "xor")
590 (plus "add") (minus "sub") (mult "nand")])
591 (define_code_attr noxa [(and "n") (ior "o") (xor "x") (plus "a")])
593 ;; In FP templates, a string like "lt<de>br" will expand to "ltxbr" in
594 ;; TF/TDmode, "ltdbr" in DF/DDmode, and "ltebr" in SF/SDmode.
595 (define_mode_attr xde [(TF "x") (DF "d") (SF "e") (TD "x") (DD "d") (SD "e")])
597 ;; In FP templates, a <dee> in "m<dee><bt>r" will expand to "mx<bt>r" in
598 ;; TF/TDmode, "md<bt>r" in DF/DDmode, "mee<bt>r" in SFmode and "me<bt>r in
600 (define_mode_attr xdee [(TF "x") (DF "d") (SF "ee") (TD "x") (DD "d") (SD "e")])
602 ;; In FP templates, "<RRe>" will expand to "RRE" in TFmode and "RR" otherwise.
603 ;; Likewise for "<RXe>".
604 (define_mode_attr RRe [(TF "RRE") (DF "RR") (SF "RR")])
605 (define_mode_attr RXe [(TF "RXE") (DF "RX") (SF "RX")])
607 ;; The decimal floating point variants of add, sub, div and mul support 3
608 ;; fp register operands. The following attributes allow to merge the bfp and
609 ;; dfp variants in a single insn definition.
611 ;; This attribute is used to set op_type accordingly.
612 (define_mode_attr RRer [(TF "RRE") (DF "RRE") (SF "RRE") (TD "RRR")
613 (DD "RRR") (SD "RRR")])
615 ;; This attribute is used in the operand constraint list in order to have the
616 ;; first and the second operand match for bfp modes.
617 (define_mode_attr f0 [(TF "0") (DF "0") (SF "0") (TD "f") (DD "f") (DD "f")])
619 ;; This attribute is used to merge the scalar vector instructions into
620 ;; the FP patterns. For non-supported modes (all but DF) it expands
621 ;; to constraints which are supposed to be matched by an earlier
623 (define_mode_attr v0 [(TF "0") (DF "v") (SF "0") (TD "0") (DD "0") (DD "0") (TI "0") (DI "v") (SI "0")])
624 (define_mode_attr vf [(TF "f") (DF "v") (SF "f") (TD "f") (DD "f") (DD "f") (TI "f") (DI "v") (SI "f")])
625 (define_mode_attr vd [(TF "d") (DF "v") (SF "d") (TD "d") (DD "d") (DD "d") (TI "d") (DI "v") (SI "d")])
627 ;; This attribute is used in the operand list of the instruction to have an
628 ;; additional operand for the dfp instructions.
629 (define_mode_attr op1 [(TF "") (DF "") (SF "")
630 (TD "%1,") (DD "%1,") (SD "%1,")])
633 ;; This attribute is used in the operand constraint list
634 ;; for instructions dealing with the sign bit of 32 or 64bit fp values.
635 ;; TFmode values are represented by a fp register pair. Since the
636 ;; sign bit instructions only handle single source and target fp registers
637 ;; these instructions can only be used for TFmode values if the source and
638 ;; target operand uses the same fp register.
639 (define_mode_attr fT0 [(TF "0") (DF "f") (SF "f")])
641 ;; In FP templates, "<Rf>" will expand to "f" in TFmode and "R" otherwise.
642 ;; This is used to disable the memory alternative in TFmode patterns.
643 (define_mode_attr Rf [(TF "f") (DF "R") (SF "R") (TD "f") (DD "f") (SD "f")])
645 ;; This attribute adds b for bfp instructions and t for dfp instructions and is used
646 ;; within instruction mnemonics.
647 (define_mode_attr bt [(TF "b") (DF "b") (SF "b") (TD "t") (DD "t") (SD "t")])
649 ;; This attribute is used within instruction mnemonics. It evaluates to d for dfp
650 ;; modes and to an empty string for bfp modes.
651 (define_mode_attr _d [(TF "") (DF "") (SF "") (TD "d") (DD "d") (SD "d")])
653 ;; In GPR and P templates, a constraint like "<d0>" will expand to "d" in DImode
654 ;; and "0" in SImode. This allows to combine instructions of which the 31bit
655 ;; version only operates on one register.
656 (define_mode_attr d0 [(DI "d") (SI "0")])
658 ;; In combination with d0 this allows to combine instructions of which the 31bit
659 ;; version only operates on one register. The DImode version needs an additional
660 ;; register for the assembler output.
661 (define_mode_attr 1 [(DI "%1,") (SI "")])
663 ;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in
664 ;; 'ashift' and "srdl" in 'lshiftrt'.
665 (define_code_attr lr [(ashift "l") (lshiftrt "r")])
667 ;; In SHIFT templates, this attribute holds the correct standard name for the
668 ;; pattern itself and the corresponding function calls.
669 (define_code_attr shift [(ashift "ashl") (lshiftrt "lshr")])
671 ;; This attribute handles differences in the instruction 'type' and will result
672 ;; in "RRE" for DImode and "RR" for SImode.
673 (define_mode_attr E [(DI "E") (SI "")])
675 ;; This attribute handles differences in the instruction 'type' and makes RX<Y>
676 ;; to result in "RXY" for DImode and "RX" for SImode.
677 (define_mode_attr Y [(DI "Y") (SI "")])
679 ;; This attribute handles differences in the instruction 'type' and will result
680 ;; in "RSE" for TImode and "RS" for DImode.
681 (define_mode_attr TE [(TI "E") (DI "")])
683 ;; In GPR templates, a string like "lc<g>r" will expand to "lcgr" in DImode
684 ;; and "lcr" in SImode.
685 (define_mode_attr g [(DI "g") (SI "")])
687 ;; In GPR templates, a string like "sl<y>" will expand to "slg" in DImode
688 ;; and "sly" in SImode. This is useful because on 64bit the ..g instructions
689 ;; were enhanced with long displacements whereas 31bit instructions got a ..y
690 ;; variant for long displacements.
691 (define_mode_attr y [(DI "g") (SI "y")])
693 ;; In DW templates, a string like "cds<g>" will expand to "cdsg" in TImode
694 ;; and "cds" in DImode.
695 (define_mode_attr tg [(TI "g") (DI "")])
697 ;; In TDI templates, a string like "c<d>sg".
698 (define_mode_attr td [(TI "d") (DI "")])
700 ;; In GPR templates, a string like "c<gf>dbr" will expand to "cgdbr" in DImode
701 ;; and "cfdbr" in SImode.
702 (define_mode_attr gf [(DI "g") (SI "f")])
704 ;; In GPR templates, a string like sll<gk> will expand to sllg for DI
705 ;; and sllk for SI. This way it is possible to merge the new z196 SI
706 ;; 3 operands shift instructions into the existing patterns.
707 (define_mode_attr gk [(DI "g") (SI "k")])
709 ;; ICM mask required to load MODE value into the lowest subreg
710 ;; of a SImode register.
711 (define_mode_attr icm_lo [(HI "3") (QI "1")])
713 ;; In HQI templates, a string like "llg<hc>" will expand to "llgh" in
714 ;; HImode and "llgc" in QImode.
715 (define_mode_attr hc [(HI "h") (QI "c")])
717 ;; In P templates, the mode <DBL> will expand to "TI" in DImode and "DI"
719 (define_mode_attr DBL [(DI "TI") (SI "DI")])
721 ;; This attribute expands to DF for TFmode and to DD for TDmode . It is
722 ;; used for Txmode splitters splitting a Txmode copy into 2 Dxmode copies.
723 (define_mode_attr HALF_TMODE [(TF "DF") (TD "DD")])
725 ;; Maximum unsigned integer that fits in MODE.
726 (define_mode_attr max_uint [(HI "65535") (QI "255")])
728 ;; Start and end field computations for RISBG et al.
729 (define_mode_attr bfstart [(DI "s") (SI "t")])
730 (define_mode_attr bfend [(DI "e") (SI "f")])
732 ;; In place of GET_MODE_BITSIZE (<MODE>mode)
733 (define_mode_attr bitsize [(DI "64") (SI "32") (HI "16") (QI "8")])
735 ;; In place of GET_MODE_SIZE (<MODE>mode)
736 (define_mode_attr modesize [(DI "8") (SI "4")])
738 ;; Allow return and simple_return to be defined from a single template.
739 (define_code_iterator ANY_RETURN [return simple_return])
743 ; Condition code modes generated by vector fp comparisons. These will
744 ; be used also in single element mode.
745 (define_mode_iterator VFCMP [CCVEQ CCVFH CCVFHE])
746 ; Used with VFCMP to expand part of the mnemonic
747 ; For fp we have a mismatch: eq in the insn name - e in asm
748 (define_mode_attr asm_fcmp [(CCVEQ "e") (CCVFH "h") (CCVFHE "he")])
749 (define_mode_attr insn_cmp [(CCVEQ "eq") (CCVH "h") (CCVHU "hl") (CCVFH "h") (CCVFHE "he")])
752 (include "vector.md")
755 ;;- Compare instructions.
758 ; Test-under-Mask instructions
760 (define_insn "*tmqi_mem"
761 [(set (reg CC_REGNUM)
762 (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S")
763 (match_operand:QI 1 "immediate_operand" "n,n"))
764 (match_operand:QI 2 "immediate_operand" "n,n")))]
765 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], false))"
769 [(set_attr "op_type" "SI,SIY")
770 (set_attr "z10prop" "z10_super,z10_super")])
772 (define_insn "*tmdi_reg"
773 [(set (reg CC_REGNUM)
774 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
775 (match_operand:DI 1 "immediate_operand"
776 "N0HD0,N1HD0,N2HD0,N3HD0"))
777 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
779 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
780 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
786 [(set_attr "op_type" "RI")
787 (set_attr "z10prop" "z10_super,z10_super,z10_super,z10_super")])
789 (define_insn "*tmsi_reg"
790 [(set (reg CC_REGNUM)
791 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
792 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
793 (match_operand:SI 2 "immediate_operand" "n,n")))]
794 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
795 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
799 [(set_attr "op_type" "RI")
800 (set_attr "z10prop" "z10_super,z10_super")])
802 (define_insn "*tm<mode>_full"
803 [(set (reg CC_REGNUM)
804 (compare (match_operand:HQI 0 "register_operand" "d")
805 (match_operand:HQI 1 "immediate_operand" "n")))]
806 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], true))"
808 [(set_attr "op_type" "RI")
809 (set_attr "z10prop" "z10_super")])
813 ; Load-and-Test instructions
816 ; tst(di|si) instruction pattern(s).
818 (define_insn "*tstdi_sign"
819 [(set (reg CC_REGNUM)
823 (subreg:DI (match_operand:SI 0 "nonimmediate_operand" "d,RT") 0)
824 (const_int 32)) (const_int 32))
825 (match_operand:DI 1 "const0_operand" "")))
826 (set (match_operand:DI 2 "register_operand" "=d,d")
827 (sign_extend:DI (match_dup 0)))]
828 "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH"
831 [(set_attr "op_type" "RRE,RXY")
832 (set_attr "cpu_facility" "*,z10")
833 (set_attr "z10prop" "z10_super_E1,z10_super_E1") ])
836 (define_insn "*tst<mode>_extimm"
837 [(set (reg CC_REGNUM)
838 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,RT")
839 (match_operand:GPR 1 "const0_operand" "")))
840 (set (match_operand:GPR 2 "register_operand" "=d,d")
842 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
846 [(set_attr "op_type" "RR<E>,RXY")
847 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3") ])
850 (define_insn "*tst<mode>_cconly_extimm"
851 [(set (reg CC_REGNUM)
852 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,RT")
853 (match_operand:GPR 1 "const0_operand" "")))
854 (clobber (match_scratch:GPR 2 "=X,d"))]
855 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
859 [(set_attr "op_type" "RR<E>,RXY")
860 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3")])
862 (define_insn "*tstdi"
863 [(set (reg CC_REGNUM)
864 (compare (match_operand:DI 0 "register_operand" "d")
865 (match_operand:DI 1 "const0_operand" "")))
866 (set (match_operand:DI 2 "register_operand" "=d")
868 "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH && !TARGET_EXTIMM"
870 [(set_attr "op_type" "RRE")
871 (set_attr "z10prop" "z10_fr_E1")])
873 (define_insn "*tstsi"
874 [(set (reg CC_REGNUM)
875 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
876 (match_operand:SI 1 "const0_operand" "")))
877 (set (match_operand:SI 2 "register_operand" "=d,d,d")
879 "s390_match_ccmode(insn, CCSmode) && !TARGET_EXTIMM"
884 [(set_attr "op_type" "RR,RS,RSY")
885 (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
887 (define_insn "*tstsi_cconly"
888 [(set (reg CC_REGNUM)
889 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
890 (match_operand:SI 1 "const0_operand" "")))
891 (clobber (match_scratch:SI 2 "=X,d,d"))]
892 "s390_match_ccmode(insn, CCSmode)"
897 [(set_attr "op_type" "RR,RS,RSY")
898 (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
900 (define_insn "*tstdi_cconly_31"
901 [(set (reg CC_REGNUM)
902 (compare (match_operand:DI 0 "register_operand" "d")
903 (match_operand:DI 1 "const0_operand" "")))]
904 "s390_match_ccmode(insn, CCSmode) && !TARGET_ZARCH"
906 [(set_attr "op_type" "RS")
907 (set_attr "atype" "reg")])
910 (define_insn "*tst<mode>_cconly2"
911 [(set (reg CC_REGNUM)
912 (compare (match_operand:GPR 0 "register_operand" "d")
913 (match_operand:GPR 1 "const0_operand" "")))]
914 "s390_match_ccmode(insn, CCSmode)"
916 [(set_attr "op_type" "RR<E>")
917 (set_attr "z10prop" "z10_fr_E1")])
919 ; tst(hi|qi) instruction pattern(s).
921 (define_insn "*tst<mode>CCT"
922 [(set (reg CC_REGNUM)
923 (compare (match_operand:HQI 0 "nonimmediate_operand" "?Q,?S,d")
924 (match_operand:HQI 1 "const0_operand" "")))
925 (set (match_operand:HQI 2 "register_operand" "=d,d,0")
927 "s390_match_ccmode(insn, CCTmode)"
930 icmy\t%2,<icm_lo>,%S0
932 [(set_attr "op_type" "RS,RSY,RI")
933 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
935 (define_insn "*tsthiCCT_cconly"
936 [(set (reg CC_REGNUM)
937 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
938 (match_operand:HI 1 "const0_operand" "")))
939 (clobber (match_scratch:HI 2 "=d,d,X"))]
940 "s390_match_ccmode(insn, CCTmode)"
945 [(set_attr "op_type" "RS,RSY,RI")
946 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
948 (define_insn "*tstqiCCT_cconly"
949 [(set (reg CC_REGNUM)
950 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
951 (match_operand:QI 1 "const0_operand" "")))]
952 "s390_match_ccmode(insn, CCTmode)"
957 [(set_attr "op_type" "SI,SIY,RI")
958 (set_attr "z10prop" "z10_super,z10_super,z10_super")])
960 (define_insn "*tst<mode>"
961 [(set (reg CC_REGNUM)
962 (compare (match_operand:HQI 0 "s_operand" "Q,S")
963 (match_operand:HQI 1 "const0_operand" "")))
964 (set (match_operand:HQI 2 "register_operand" "=d,d")
966 "s390_match_ccmode(insn, CCSmode)"
969 icmy\t%2,<icm_lo>,%S0"
970 [(set_attr "op_type" "RS,RSY")
971 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
973 (define_insn "*tst<mode>_cconly"
974 [(set (reg CC_REGNUM)
975 (compare (match_operand:HQI 0 "s_operand" "Q,S")
976 (match_operand:HQI 1 "const0_operand" "")))
977 (clobber (match_scratch:HQI 2 "=d,d"))]
978 "s390_match_ccmode(insn, CCSmode)"
981 icmy\t%2,<icm_lo>,%S0"
982 [(set_attr "op_type" "RS,RSY")
983 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
986 ; Compare (equality) instructions
988 (define_insn "*cmpdi_cct"
989 [(set (reg CC_REGNUM)
990 (compare (match_operand:DI 0 "nonimmediate_operand" "%d,d,d,d,Q")
991 (match_operand:DI 1 "general_operand" "d,K,Os,RT,BQ")))]
992 "s390_match_ccmode (insn, CCTmode) && TARGET_ZARCH"
999 [(set_attr "op_type" "RRE,RI,RIL,RXY,SS")
1000 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,*")])
1002 (define_insn "*cmpsi_cct"
1003 [(set (reg CC_REGNUM)
1004 (compare (match_operand:SI 0 "nonimmediate_operand" "%d,d,d,d,d,Q")
1005 (match_operand:SI 1 "general_operand" "d,K,Os,R,T,BQ")))]
1006 "s390_match_ccmode (insn, CCTmode)"
1014 [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS")
1015 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*")])
1017 ; Compare (signed) instructions
1019 (define_insn "*cmpdi_ccs_sign"
1020 [(set (reg CC_REGNUM)
1021 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand"
1023 (match_operand:DI 0 "register_operand" "d, d,d")))]
1024 "s390_match_ccmode(insn, CCSRmode) && TARGET_ZARCH"
1029 [(set_attr "op_type" "RRE,RXY,RIL")
1030 (set_attr "z10prop" "z10_c,*,*")
1031 (set_attr "type" "*,*,larl")])
1035 (define_insn "*cmpsi_ccs_sign"
1036 [(set (reg CC_REGNUM)
1037 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T,b"))
1038 (match_operand:SI 0 "register_operand" "d,d,d")))]
1039 "s390_match_ccmode(insn, CCSRmode)"
1044 [(set_attr "op_type" "RX,RXY,RIL")
1045 (set_attr "cpu_facility" "*,*,z10")
1046 (set_attr "type" "*,*,larl")
1047 (set_attr "z196prop" "z196_cracked,z196_cracked,z196_cracked")])
1049 (define_insn "*cmphi_ccs_z10"
1050 [(set (reg CC_REGNUM)
1051 (compare (match_operand:HI 0 "s_operand" "Q")
1052 (match_operand:HI 1 "immediate_operand" "K")))]
1053 "s390_match_ccmode(insn, CCSmode) && TARGET_Z10"
1055 [(set_attr "op_type" "SIL")
1056 (set_attr "z196prop" "z196_cracked")])
1058 (define_insn "*cmpdi_ccs_signhi_rl"
1059 [(set (reg CC_REGNUM)
1060 (compare (sign_extend:DI (match_operand:HI 1 "memory_operand" "RT,b"))
1061 (match_operand:GPR 0 "register_operand" "d,d")))]
1062 "s390_match_ccmode(insn, CCSRmode) && TARGET_Z10"
1066 [(set_attr "op_type" "RXY,RIL")
1067 (set_attr "type" "*,larl")])
1069 ; cr, chi, cfi, c, cy, cgr, cghi, cgfi, cg, chsi, cghsi, crl, cgrl
1070 (define_insn "*cmp<mode>_ccs"
1071 [(set (reg CC_REGNUM)
1072 (compare (match_operand:GPR 0 "nonimmediate_operand"
1074 (match_operand:GPR 1 "general_operand"
1075 "d,K,K,Os,R,T,b")))]
1076 "s390_match_ccmode(insn, CCSmode)"
1085 [(set_attr "op_type" "RR<E>,RI,SIL,RIL,RX<Y>,RXY,RIL")
1086 (set_attr "cpu_facility" "*,*,z10,extimm,*,*,z10")
1087 (set_attr "type" "*,*,*,*,*,*,larl")
1088 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,z10_super")])
1091 ; Compare (unsigned) instructions
1093 (define_insn "*cmpsi_ccu_zerohi_rlsi"
1094 [(set (reg CC_REGNUM)
1095 (compare (zero_extend:SI (mem:HI (match_operand:SI 1
1096 "larl_operand" "X")))
1097 (match_operand:SI 0 "register_operand" "d")))]
1098 "s390_match_ccmode(insn, CCURmode) && TARGET_Z10"
1100 [(set_attr "op_type" "RIL")
1101 (set_attr "type" "larl")
1102 (set_attr "z10prop" "z10_super")])
1105 (define_insn "*cmp<GPR:mode>_ccu_zerohi_rldi"
1106 [(set (reg CC_REGNUM)
1107 (compare (zero_extend:GPR (mem:HI (match_operand:DI 1
1108 "larl_operand" "X")))
1109 (match_operand:GPR 0 "register_operand" "d")))]
1110 "s390_match_ccmode(insn, CCURmode) && TARGET_Z10"
1112 [(set_attr "op_type" "RIL")
1113 (set_attr "type" "larl")
1114 (set_attr "z10prop" "z10_super")])
1116 (define_insn "*cmpdi_ccu_zero"
1117 [(set (reg CC_REGNUM)
1118 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand"
1120 (match_operand:DI 0 "register_operand" "d, d,d")))]
1121 "s390_match_ccmode (insn, CCURmode) && TARGET_ZARCH"
1126 [(set_attr "op_type" "RRE,RXY,RIL")
1127 (set_attr "cpu_facility" "*,*,z10")
1128 (set_attr "type" "*,*,larl")
1129 (set_attr "z10prop" "z10_super_c,z10_super_E1,z10_super")])
1131 (define_insn "*cmpdi_ccu"
1132 [(set (reg CC_REGNUM)
1133 (compare (match_operand:DI 0 "nonimmediate_operand"
1134 "d, d,d,Q, d, Q,BQ")
1135 (match_operand:DI 1 "general_operand"
1136 "d,Op,b,D,RT,BQ,Q")))]
1137 "s390_match_ccmode (insn, CCUmode) && TARGET_ZARCH"
1146 [(set_attr "op_type" "RRE,RIL,RIL,SIL,RXY,SS,SS")
1147 (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*")
1148 (set_attr "type" "*,*,larl,*,*,*,*")
1149 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*,*")])
1151 (define_insn "*cmpsi_ccu"
1152 [(set (reg CC_REGNUM)
1153 (compare (match_operand:SI 0 "nonimmediate_operand" "d, d,d,Q,d,d, Q,BQ")
1154 (match_operand:SI 1 "general_operand" "d,Os,b,D,R,T,BQ, Q")))]
1155 "s390_match_ccmode (insn, CCUmode)"
1165 [(set_attr "op_type" "RR,RIL,RIL,SIL,RX,RXY,SS,SS")
1166 (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*,*")
1167 (set_attr "type" "*,*,larl,*,*,*,*,*")
1168 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,*,*")])
1170 (define_insn "*cmphi_ccu"
1171 [(set (reg CC_REGNUM)
1172 (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,Q,BQ")
1173 (match_operand:HI 1 "general_operand" "Q,S,D,BQ,Q")))]
1174 "s390_match_ccmode (insn, CCUmode)
1175 && !register_operand (operands[1], HImode)"
1182 [(set_attr "op_type" "RS,RSY,SIL,SS,SS")
1183 (set_attr "cpu_facility" "*,*,z10,*,*")
1184 (set_attr "z10prop" "*,*,z10_super,*,*")])
1186 (define_insn "*cmpqi_ccu"
1187 [(set (reg CC_REGNUM)
1188 (compare (match_operand:QI 0 "nonimmediate_operand" "d,d,Q,S,Q,BQ")
1189 (match_operand:QI 1 "general_operand" "Q,S,n,n,BQ,Q")))]
1190 "s390_match_ccmode (insn, CCUmode)
1191 && !register_operand (operands[1], QImode)"
1199 [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS")
1200 (set_attr "z10prop" "*,*,z10_super,z10_super,*,*")])
1203 ; Block compare (CLC) instruction patterns.
1206 [(set (reg CC_REGNUM)
1207 (compare (match_operand:BLK 0 "memory_operand" "Q")
1208 (match_operand:BLK 1 "memory_operand" "Q")))
1209 (use (match_operand 2 "const_int_operand" "n"))]
1210 "s390_match_ccmode (insn, CCUmode)
1211 && INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
1212 "clc\t%O0(%2,%R0),%S1"
1213 [(set_attr "op_type" "SS")])
1216 [(set (reg CC_REGNUM)
1217 (compare (match_operand 0 "memory_operand" "")
1218 (match_operand 1 "memory_operand" "")))]
1220 && s390_match_ccmode (insn, CCUmode)
1221 && GET_MODE (operands[0]) == GET_MODE (operands[1])
1222 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
1224 [(set (match_dup 0) (match_dup 1))
1225 (use (match_dup 2))])]
1227 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
1228 operands[0] = adjust_address (operands[0], BLKmode, 0);
1229 operands[1] = adjust_address (operands[1], BLKmode, 0);
1231 operands[1] = gen_rtx_COMPARE (GET_MODE (SET_DEST (PATTERN (curr_insn))),
1232 operands[0], operands[1]);
1233 operands[0] = SET_DEST (PATTERN (curr_insn));
1237 ; (TF|DF|SF|TD|DD|SD) instructions
1239 ; ltxbr, ltdbr, ltebr, ltxtr, ltdtr
1240 (define_insn "*cmp<mode>_ccs_0"
1241 [(set (reg CC_REGNUM)
1242 (compare (match_operand:FP 0 "register_operand" "f")
1243 (match_operand:FP 1 "const0_operand" "")))]
1244 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
1245 "lt<xde><bt>r\t%0,%0"
1246 [(set_attr "op_type" "RRE")
1247 (set_attr "type" "fsimp<mode>")])
1249 ; cxtr, cxbr, cdtr, cdbr, cebr, cdb, ceb
1250 (define_insn "*cmp<mode>_ccs"
1251 [(set (reg CC_REGNUM)
1252 (compare (match_operand:FP 0 "register_operand" "f,f")
1253 (match_operand:FP 1 "general_operand" "f,<Rf>")))]
1254 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
1258 [(set_attr "op_type" "RRE,RXE")
1259 (set_attr "type" "fsimp<mode>")])
1261 ; wfcedbs, wfchdbs, wfchedbs
1262 (define_insn "*vec_cmp<insn_cmp>df_cconly"
1263 [(set (reg:VFCMP CC_REGNUM)
1264 (compare:VFCMP (match_operand:DF 0 "register_operand" "v")
1265 (match_operand:DF 1 "register_operand" "v")))
1266 (clobber (match_scratch:V2DI 2 "=v"))]
1267 "TARGET_Z13 && TARGET_HARD_FLOAT"
1268 "wfc<asm_fcmp>dbs\t%v2,%v0,%v1"
1269 [(set_attr "op_type" "VRR")])
1271 ; Compare and Branch instructions
1273 ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
1274 ; The following instructions do a complementary access of their second
1275 ; operand (z01 only): crj_c, cgrjc, cr, cgr
1276 (define_insn "*cmp_and_br_signed_<mode>"
1278 (if_then_else (match_operator 0 "s390_signed_integer_comparison"
1279 [(match_operand:GPR 1 "register_operand" "d,d")
1280 (match_operand:GPR 2 "nonmemory_operand" "d,C")])
1281 (label_ref (match_operand 3 "" ""))
1283 (clobber (reg:CC CC_REGNUM))]
1284 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1286 if (get_attr_length (insn) == 6)
1287 return which_alternative ?
1288 "c<g>ij%C0\t%1,%c2,%l3" : "c<g>rj%C0\t%1,%2,%l3";
1290 return which_alternative ?
1291 "c<g>fi\t%1,%c2\;jg%C0\t%l3" : "c<g>r\t%1,%2\;jg%C0\t%l3";
1293 [(set_attr "op_type" "RIE")
1294 (set_attr "type" "branch")
1295 (set_attr "z10prop" "z10_super_c,z10_super")
1296 (set (attr "length")
1297 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1298 (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg
1299 ; 10 byte for cgr/jg
1301 ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr
1302 ; The following instructions do a complementary access of their second
1303 ; operand (z10 only): clrj, clgrj, clr, clgr
1304 (define_insn "*cmp_and_br_unsigned_<mode>"
1306 (if_then_else (match_operator 0 "s390_unsigned_integer_comparison"
1307 [(match_operand:GPR 1 "register_operand" "d,d")
1308 (match_operand:GPR 2 "nonmemory_operand" "d,I")])
1309 (label_ref (match_operand 3 "" ""))
1311 (clobber (reg:CC CC_REGNUM))]
1312 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1314 if (get_attr_length (insn) == 6)
1315 return which_alternative ?
1316 "cl<g>ij%C0\t%1,%b2,%l3" : "cl<g>rj%C0\t%1,%2,%l3";
1318 return which_alternative ?
1319 "cl<g>fi\t%1,%b2\;jg%C0\t%l3" : "cl<g>r\t%1,%2\;jg%C0\t%l3";
1321 [(set_attr "op_type" "RIE")
1322 (set_attr "type" "branch")
1323 (set_attr "z10prop" "z10_super_c,z10_super")
1324 (set (attr "length")
1325 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1326 (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg
1327 ; 10 byte for clgr/jg
1329 ; And now the same two patterns as above but with a negated CC mask.
1331 ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
1332 ; The following instructions do a complementary access of their second
1333 ; operand (z01 only): crj_c, cgrjc, cr, cgr
1334 (define_insn "*icmp_and_br_signed_<mode>"
1336 (if_then_else (match_operator 0 "s390_signed_integer_comparison"
1337 [(match_operand:GPR 1 "register_operand" "d,d")
1338 (match_operand:GPR 2 "nonmemory_operand" "d,C")])
1340 (label_ref (match_operand 3 "" ""))))
1341 (clobber (reg:CC CC_REGNUM))]
1342 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1344 if (get_attr_length (insn) == 6)
1345 return which_alternative ?
1346 "c<g>ij%D0\t%1,%c2,%l3" : "c<g>rj%D0\t%1,%2,%l3";
1348 return which_alternative ?
1349 "c<g>fi\t%1,%c2\;jg%D0\t%l3" : "c<g>r\t%1,%2\;jg%D0\t%l3";
1351 [(set_attr "op_type" "RIE")
1352 (set_attr "type" "branch")
1353 (set_attr "z10prop" "z10_super_c,z10_super")
1354 (set (attr "length")
1355 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1356 (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg
1357 ; 10 byte for cgr/jg
1359 ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr
1360 ; The following instructions do a complementary access of their second
1361 ; operand (z10 only): clrj, clgrj, clr, clgr
1362 (define_insn "*icmp_and_br_unsigned_<mode>"
1364 (if_then_else (match_operator 0 "s390_unsigned_integer_comparison"
1365 [(match_operand:GPR 1 "register_operand" "d,d")
1366 (match_operand:GPR 2 "nonmemory_operand" "d,I")])
1368 (label_ref (match_operand 3 "" ""))))
1369 (clobber (reg:CC CC_REGNUM))]
1370 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1372 if (get_attr_length (insn) == 6)
1373 return which_alternative ?
1374 "cl<g>ij%D0\t%1,%b2,%l3" : "cl<g>rj%D0\t%1,%2,%l3";
1376 return which_alternative ?
1377 "cl<g>fi\t%1,%b2\;jg%D0\t%l3" : "cl<g>r\t%1,%2\;jg%D0\t%l3";
1379 [(set_attr "op_type" "RIE")
1380 (set_attr "type" "branch")
1381 (set_attr "z10prop" "z10_super_c,z10_super")
1382 (set (attr "length")
1383 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1384 (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg
1385 ; 10 byte for clgr/jg
1388 ;;- Move instructions.
1392 ; movti instruction pattern(s).
1395 ; FIXME: More constants are possible by enabling jxx, jyy constraints
1396 ; for TImode (use double-int for the calculations)
1397 (define_insn "movti"
1398 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,v, v, v,v,d, v,QR, d,o")
1399 (match_operand:TI 1 "general_operand" "QS, d,v,j00,jm1,d,v,QR, v,dPRT,d"))]
1413 [(set_attr "op_type" "RSY,RSY,VRR,VRI,VRI,VRR,*,VRX,VRX,*,*")
1414 (set_attr "type" "lm,stm,*,*,*,*,*,*,*,*,*")
1415 (set_attr "cpu_facility" "*,*,vec,vec,vec,vec,vec,vec,vec,*,*")])
1418 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1419 (match_operand:TI 1 "general_operand" ""))]
1420 "TARGET_ZARCH && reload_completed
1421 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
1422 [(set (match_dup 2) (match_dup 4))
1423 (set (match_dup 3) (match_dup 5))]
1425 operands[2] = operand_subword (operands[0], 0, 0, TImode);
1426 operands[3] = operand_subword (operands[0], 1, 0, TImode);
1427 operands[4] = operand_subword (operands[1], 0, 0, TImode);
1428 operands[5] = operand_subword (operands[1], 1, 0, TImode);
1432 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1433 (match_operand:TI 1 "general_operand" ""))]
1434 "TARGET_ZARCH && reload_completed
1435 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
1436 [(set (match_dup 2) (match_dup 4))
1437 (set (match_dup 3) (match_dup 5))]
1439 operands[2] = operand_subword (operands[0], 1, 0, TImode);
1440 operands[3] = operand_subword (operands[0], 0, 0, TImode);
1441 operands[4] = operand_subword (operands[1], 1, 0, TImode);
1442 operands[5] = operand_subword (operands[1], 0, 0, TImode);
1445 ; Use part of the TImode target reg to perform the address
1446 ; calculation. If the TImode value is supposed to be copied into a VR
1447 ; this splitter is not necessary.
1449 [(set (match_operand:TI 0 "register_operand" "")
1450 (match_operand:TI 1 "memory_operand" ""))]
1451 "TARGET_ZARCH && reload_completed
1452 && !VECTOR_REG_P (operands[0])
1453 && !s_operand (operands[1], VOIDmode)"
1454 [(set (match_dup 0) (match_dup 1))]
1456 rtx addr = operand_subword (operands[0], 1, 0, TImode);
1457 addr = gen_lowpart (Pmode, addr);
1458 s390_load_address (addr, XEXP (operands[1], 0));
1459 operands[1] = replace_equiv_address (operands[1], addr);
1463 ; Split a VR -> GPR TImode move into 2 vector load GR from VR element.
1464 ; For the higher order bits we do simply a DImode move while the
1465 ; second part is done via vec extract. Both will end up as vlgvg.
1467 [(set (match_operand:TI 0 "register_operand" "")
1468 (match_operand:TI 1 "register_operand" ""))]
1469 "TARGET_VX && reload_completed
1470 && GENERAL_REG_P (operands[0])
1471 && VECTOR_REG_P (operands[1])"
1472 [(set (match_dup 2) (match_dup 4))
1473 (set (match_dup 3) (unspec:DI [(match_dup 5) (const_int 1)]
1474 UNSPEC_VEC_EXTRACT))]
1476 operands[2] = operand_subword (operands[0], 0, 0, TImode);
1477 operands[3] = operand_subword (operands[0], 1, 0, TImode);
1478 operands[4] = gen_rtx_REG (DImode, REGNO (operands[1]));
1479 operands[5] = gen_rtx_REG (V2DImode, REGNO (operands[1]));
1483 ; Patterns used for secondary reloads
1486 ; z10 provides move instructions accepting larl memory operands.
1487 ; Unfortunately there is no such variant for QI, TI and FP mode moves.
1488 ; These patterns are also used for unaligned SI and DI accesses.
1490 (define_expand "reload<ALL:mode><P:mode>_tomem_z10"
1491 [(parallel [(match_operand:ALL 0 "memory_operand" "")
1492 (match_operand:ALL 1 "register_operand" "=d")
1493 (match_operand:P 2 "register_operand" "=&a")])]
1496 s390_reload_symref_address (operands[1], operands[0], operands[2], 1);
1500 (define_expand "reload<ALL:mode><P:mode>_toreg_z10"
1501 [(parallel [(match_operand:ALL 0 "register_operand" "=d")
1502 (match_operand:ALL 1 "memory_operand" "")
1503 (match_operand:P 2 "register_operand" "=a")])]
1506 s390_reload_symref_address (operands[0], operands[1], operands[2], 0);
1510 (define_expand "reload<P:mode>_larl_odd_addend_z10"
1511 [(parallel [(match_operand:P 0 "register_operand" "=d")
1512 (match_operand:P 1 "larl_operand" "")
1513 (match_operand:P 2 "register_operand" "=a")])]
1516 s390_reload_larl_operand (operands[0], operands[1], operands[2]);
1520 ; Handles loading a PLUS (load address) expression
1522 (define_expand "reload<mode>_plus"
1523 [(parallel [(match_operand:P 0 "register_operand" "=a")
1524 (match_operand:P 1 "s390_plus_operand" "")
1525 (match_operand:P 2 "register_operand" "=&a")])]
1528 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1532 ; Not all the indirect memory access instructions support the full
1533 ; format (long disp + index + base). So whenever a move from/to such
1534 ; an address is required and the instruction cannot deal with it we do
1535 ; a load address into a scratch register first and use this as the new
1537 ; This in particular is used for:
1538 ; - non-offsetable memory accesses for multiword moves
1539 ; - full vector reg moves with long displacements
1541 (define_expand "reload<mode>_la_in"
1542 [(parallel [(match_operand 0 "register_operand" "")
1543 (match_operand 1 "" "")
1544 (match_operand:P 2 "register_operand" "=&a")])]
1547 gcc_assert (MEM_P (operands[1]));
1548 s390_load_address (operands[2], find_replacement (&XEXP (operands[1], 0)));
1549 operands[1] = replace_equiv_address (operands[1], operands[2]);
1550 emit_move_insn (operands[0], operands[1]);
1554 (define_expand "reload<mode>_la_out"
1555 [(parallel [(match_operand 0 "" "")
1556 (match_operand 1 "register_operand" "")
1557 (match_operand:P 2 "register_operand" "=&a")])]
1560 gcc_assert (MEM_P (operands[0]));
1561 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
1562 operands[0] = replace_equiv_address (operands[0], operands[2]);
1563 emit_move_insn (operands[0], operands[1]);
1567 (define_expand "reload<mode>_PIC_addr"
1568 [(parallel [(match_operand 0 "register_operand" "=d")
1569 (match_operand 1 "larl_operand" "")
1570 (match_operand:P 2 "register_operand" "=a")])]
1573 rtx new_rtx = legitimize_pic_address (operands[1], operands[2]);
1574 emit_move_insn (operands[0], new_rtx);
1578 ; movdi instruction pattern(s).
1581 (define_expand "movdi"
1582 [(set (match_operand:DI 0 "general_operand" "")
1583 (match_operand:DI 1 "general_operand" ""))]
1586 /* Handle symbolic constants. */
1588 && (SYMBOLIC_CONST (operands[1])
1589 || (GET_CODE (operands[1]) == PLUS
1590 && XEXP (operands[1], 0) == pic_offset_table_rtx
1591 && SYMBOLIC_CONST (XEXP (operands[1], 1)))))
1592 emit_symbolic_move (operands);
1595 (define_insn "*movdi_larl"
1596 [(set (match_operand:DI 0 "register_operand" "=d")
1597 (match_operand:DI 1 "larl_operand" "X"))]
1599 && !FP_REG_P (operands[0])"
1601 [(set_attr "op_type" "RIL")
1602 (set_attr "type" "larl")
1603 (set_attr "z10prop" "z10_super_A1")])
1605 (define_insn "*movdi_64"
1606 [(set (match_operand:DI 0 "nonimmediate_operand"
1607 "=d, d, d, d, d, d, d, d,f,d,d,d,d, d,RT,!*f,!*f,!*f,!R,!T,b,Q,d,t,Q,t,v,v,v,d, v,QR")
1608 (match_operand:DI 1 "general_operand"
1609 " K,N0HD0,N1HD0,N2HD0,N3HD0,Os,N0SD0,N1SD0,d,f,L,b,d,RT, d, *f, R, T,*f,*f,d,K,t,d,t,Q,K,v,d,v,QR, v"))]
1644 [(set_attr "op_type" "RI,RI,RI,RI,RI,RIL,RIL,RIL,RRE,RRE,RXY,RIL,RRE,RXY,
1645 RXY,RR,RX,RXY,RX,RXY,RIL,SIL,*,*,RS,RS,VRI,VRR,VRS,VRS,VRX,VRX")
1646 (set_attr "type" "*,*,*,*,*,*,*,*,floaddf,floaddf,la,larl,lr,load,store,
1647 floaddf,floaddf,floaddf,fstoredf,fstoredf,larl,*,*,*,*,
1649 (set_attr "cpu_facility" "*,*,*,*,*,extimm,extimm,extimm,dfp,dfp,longdisp,
1650 z10,*,*,*,*,*,longdisp,*,longdisp,
1651 z10,z10,*,*,*,*,vec,vec,vec,vec,vec,vec")
1652 (set_attr "z10prop" "z10_fwd_A1,
1681 [(set (match_operand:DI 0 "register_operand" "")
1682 (match_operand:DI 1 "register_operand" ""))]
1683 "TARGET_ZARCH && ACCESS_REG_P (operands[1])"
1684 [(set (match_dup 2) (match_dup 3))
1685 (set (match_dup 0) (ashift:DI (match_dup 0) (const_int 32)))
1686 (set (strict_low_part (match_dup 2)) (match_dup 4))]
1687 "operands[2] = gen_lowpart (SImode, operands[0]);
1688 s390_split_access_reg (operands[1], &operands[4], &operands[3]);")
1691 [(set (match_operand:DI 0 "register_operand" "")
1692 (match_operand:DI 1 "register_operand" ""))]
1693 "TARGET_ZARCH && ACCESS_REG_P (operands[0])
1694 && dead_or_set_p (insn, operands[1])"
1695 [(set (match_dup 3) (match_dup 2))
1696 (set (match_dup 1) (lshiftrt:DI (match_dup 1) (const_int 32)))
1697 (set (match_dup 4) (match_dup 2))]
1698 "operands[2] = gen_lowpart (SImode, operands[1]);
1699 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1702 [(set (match_operand:DI 0 "register_operand" "")
1703 (match_operand:DI 1 "register_operand" ""))]
1704 "TARGET_ZARCH && ACCESS_REG_P (operands[0])
1705 && !dead_or_set_p (insn, operands[1])"
1706 [(set (match_dup 3) (match_dup 2))
1707 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))
1708 (set (match_dup 4) (match_dup 2))
1709 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))]
1710 "operands[2] = gen_lowpart (SImode, operands[1]);
1711 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1713 (define_insn "*movdi_31"
1714 [(set (match_operand:DI 0 "nonimmediate_operand"
1715 "=d,d,Q,S,d ,o,!*f,!*f,!*f,!R,!T,d")
1716 (match_operand:DI 1 "general_operand"
1717 " Q,S,d,d,dPRT,d, *f, R, T,*f,*f,b"))]
1732 [(set_attr "op_type" "RS,RSY,RS,RSY,*,*,RR,RX,RXY,RX,RXY,*")
1733 (set_attr "type" "lm,lm,stm,stm,*,*,floaddf,floaddf,floaddf,fstoredf,fstoredf,*")
1734 (set_attr "cpu_facility" "*,*,*,*,*,*,*,*,*,*,*,z10")])
1736 ; For a load from a symbol ref we can use one of the target registers
1737 ; together with larl to load the address.
1739 [(set (match_operand:DI 0 "register_operand" "")
1740 (match_operand:DI 1 "memory_operand" ""))]
1741 "!TARGET_ZARCH && reload_completed && TARGET_Z10
1742 && larl_operand (XEXP (operands[1], 0), SImode)"
1743 [(set (match_dup 2) (match_dup 3))
1744 (set (match_dup 0) (match_dup 1))]
1746 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1747 operands[3] = XEXP (operands[1], 0);
1748 operands[1] = replace_equiv_address (operands[1], operands[2]);
1752 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1753 (match_operand:DI 1 "general_operand" ""))]
1754 "!TARGET_ZARCH && reload_completed
1755 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1756 [(set (match_dup 2) (match_dup 4))
1757 (set (match_dup 3) (match_dup 5))]
1759 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1760 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1761 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1762 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1766 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1767 (match_operand:DI 1 "general_operand" ""))]
1768 "!TARGET_ZARCH && reload_completed
1769 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1770 [(set (match_dup 2) (match_dup 4))
1771 (set (match_dup 3) (match_dup 5))]
1773 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1774 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1775 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1776 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1780 [(set (match_operand:DI 0 "register_operand" "")
1781 (match_operand:DI 1 "memory_operand" ""))]
1782 "!TARGET_ZARCH && reload_completed
1783 && !FP_REG_P (operands[0])
1784 && !s_operand (operands[1], VOIDmode)"
1785 [(set (match_dup 0) (match_dup 1))]
1787 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1788 s390_load_address (addr, XEXP (operands[1], 0));
1789 operands[1] = replace_equiv_address (operands[1], addr);
1793 [(set (match_operand:DI 0 "register_operand" "")
1794 (mem:DI (match_operand 1 "address_operand" "")))]
1796 && !FP_REG_P (operands[0])
1797 && GET_CODE (operands[1]) == SYMBOL_REF
1798 && CONSTANT_POOL_ADDRESS_P (operands[1])
1799 && get_pool_mode (operands[1]) == DImode
1800 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1801 [(set (match_dup 0) (match_dup 2))]
1802 "operands[2] = get_pool_constant (operands[1]);")
1804 (define_insn "*la_64"
1805 [(set (match_operand:DI 0 "register_operand" "=d,d")
1806 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))]
1811 [(set_attr "op_type" "RX,RXY")
1812 (set_attr "type" "la")
1813 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
1817 [(set (match_operand:DI 0 "register_operand" "")
1818 (match_operand:QI 1 "address_operand" ""))
1819 (clobber (reg:CC CC_REGNUM))])]
1821 && preferred_la_operand_p (operands[1], const0_rtx)"
1822 [(set (match_dup 0) (match_dup 1))]
1826 [(set (match_operand:DI 0 "register_operand" "")
1827 (match_operand:DI 1 "register_operand" ""))
1830 (plus:DI (match_dup 0)
1831 (match_operand:DI 2 "nonmemory_operand" "")))
1832 (clobber (reg:CC CC_REGNUM))])]
1834 && !reg_overlap_mentioned_p (operands[0], operands[2])
1835 && preferred_la_operand_p (operands[1], operands[2])"
1836 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1840 ; movsi instruction pattern(s).
1843 (define_expand "movsi"
1844 [(set (match_operand:SI 0 "general_operand" "")
1845 (match_operand:SI 1 "general_operand" ""))]
1848 /* Handle symbolic constants. */
1850 && (SYMBOLIC_CONST (operands[1])
1851 || (GET_CODE (operands[1]) == PLUS
1852 && XEXP (operands[1], 0) == pic_offset_table_rtx
1853 && SYMBOLIC_CONST (XEXP(operands[1], 1)))))
1854 emit_symbolic_move (operands);
1857 (define_insn "*movsi_larl"
1858 [(set (match_operand:SI 0 "register_operand" "=d")
1859 (match_operand:SI 1 "larl_operand" "X"))]
1860 "!TARGET_64BIT && TARGET_CPU_ZARCH
1861 && !FP_REG_P (operands[0])"
1863 [(set_attr "op_type" "RIL")
1864 (set_attr "type" "larl")
1865 (set_attr "z10prop" "z10_fwd_A1")])
1867 (define_insn "*movsi_zarch"
1868 [(set (match_operand:SI 0 "nonimmediate_operand"
1869 "=d, d, d, d,d,d,d,d,d,R,T,!*f,!*f,!*f,!*f,!*f,!R,!T,d,t,Q,b,Q,t,v,v,v,d, v,QR")
1870 (match_operand:SI 1 "general_operand"
1871 " K,N0HS0,N1HS0,Os,L,b,d,R,T,d,d, *f, *f, R, R, T,*f,*f,t,d,t,d,K,Q,K,v,d,v,QR, v"))]
1904 [(set_attr "op_type" "RI,RI,RI,RIL,RXY,RIL,RR,RX,RXY,RX,RXY,
1905 RRE,RR,RXE,RX,RXY,RX,RXY,RRE,RRE,RS,RIL,SIL,RS,VRI,VRR,VRS,VRS,VRX,VRX")
1906 (set_attr "type" "*,
1930 (set_attr "cpu_facility" "*,*,*,extimm,longdisp,z10,*,*,longdisp,*,longdisp,
1931 vec,*,vec,*,longdisp,*,longdisp,*,*,*,z10,z10,*,vec,vec,vec,vec,vec,vec")
1932 (set_attr "z10prop" "z10_fwd_A1,
1957 (define_insn "*movsi_esa"
1958 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!*f,!*f,!R,d,t,Q,t")
1959 (match_operand:SI 1 "general_operand" "K,d,R,d, *f, *f, R, R,*f,t,d,t,Q"))]
1975 [(set_attr "op_type" "RI,RR,RX,RX,RRE,RR,RXE,RX,RX,RRE,RRE,RS,RS")
1976 (set_attr "type" "*,lr,load,store,floadsf,floadsf,floadsf,floadsf,fstoresf,*,*,*,*")
1977 (set_attr "z10prop" "z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_rec,*,*,*,*,*,z10_super_E1,
1979 (set_attr "cpu_facility" "*,*,*,*,vec,*,vec,*,*,*,*,*,*")
1983 [(set (match_operand:SI 0 "register_operand" "")
1984 (mem:SI (match_operand 1 "address_operand" "")))]
1985 "!FP_REG_P (operands[0])
1986 && GET_CODE (operands[1]) == SYMBOL_REF
1987 && CONSTANT_POOL_ADDRESS_P (operands[1])
1988 && get_pool_mode (operands[1]) == SImode
1989 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1990 [(set (match_dup 0) (match_dup 2))]
1991 "operands[2] = get_pool_constant (operands[1]);")
1993 (define_insn "*la_31"
1994 [(set (match_operand:SI 0 "register_operand" "=d,d")
1995 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))]
1996 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
2000 [(set_attr "op_type" "RX,RXY")
2001 (set_attr "type" "la")
2002 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
2006 [(set (match_operand:SI 0 "register_operand" "")
2007 (match_operand:QI 1 "address_operand" ""))
2008 (clobber (reg:CC CC_REGNUM))])]
2010 && preferred_la_operand_p (operands[1], const0_rtx)"
2011 [(set (match_dup 0) (match_dup 1))]
2015 [(set (match_operand:SI 0 "register_operand" "")
2016 (match_operand:SI 1 "register_operand" ""))
2019 (plus:SI (match_dup 0)
2020 (match_operand:SI 2 "nonmemory_operand" "")))
2021 (clobber (reg:CC CC_REGNUM))])]
2023 && !reg_overlap_mentioned_p (operands[0], operands[2])
2024 && preferred_la_operand_p (operands[1], operands[2])"
2025 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
2028 (define_insn "*la_31_and"
2029 [(set (match_operand:SI 0 "register_operand" "=d,d")
2030 (and:SI (match_operand:QI 1 "address_operand" "ZQZR,ZSZT")
2031 (const_int 2147483647)))]
2036 [(set_attr "op_type" "RX,RXY")
2037 (set_attr "type" "la")
2038 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
2040 (define_insn_and_split "*la_31_and_cc"
2041 [(set (match_operand:SI 0 "register_operand" "=d")
2042 (and:SI (match_operand:QI 1 "address_operand" "p")
2043 (const_int 2147483647)))
2044 (clobber (reg:CC CC_REGNUM))]
2047 "&& reload_completed"
2049 (and:SI (match_dup 1) (const_int 2147483647)))]
2051 [(set_attr "op_type" "RX")
2052 (set_attr "type" "la")])
2054 (define_insn "force_la_31"
2055 [(set (match_operand:SI 0 "register_operand" "=d,d")
2056 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))
2057 (use (const_int 0))]
2062 [(set_attr "op_type" "RX")
2063 (set_attr "type" "la")
2064 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
2067 ; movhi instruction pattern(s).
2070 (define_expand "movhi"
2071 [(set (match_operand:HI 0 "nonimmediate_operand" "")
2072 (match_operand:HI 1 "general_operand" ""))]
2075 /* Make it explicit that loading a register from memory
2076 always sign-extends (at least) to SImode. */
2077 if (optimize && can_create_pseudo_p ()
2078 && register_operand (operands[0], VOIDmode)
2079 && GET_CODE (operands[1]) == MEM)
2081 rtx tmp = gen_reg_rtx (SImode);
2082 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
2083 emit_insn (gen_rtx_SET (tmp, ext));
2084 operands[1] = gen_lowpart (HImode, tmp);
2088 (define_insn "*movhi"
2089 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,d,R,T,b,Q,v,v,v,d, v,QR")
2090 (match_operand:HI 1 "general_operand" " d,n,R,T,b,d,d,d,K,K,v,d,v,QR, v"))]
2108 [(set_attr "op_type" "RR,RI,RX,RXY,RIL,RX,RXY,RIL,SIL,VRI,VRR,VRS,VRS,VRX,VRX")
2109 (set_attr "type" "lr,*,*,*,larl,store,store,store,*,*,*,*,*,*,*")
2110 (set_attr "cpu_facility" "*,*,*,*,z10,*,*,z10,z10,vec,vec,vec,vec,vec,vec")
2111 (set_attr "z10prop" "z10_fr_E1,
2119 z10_super,*,*,*,*,*,*")])
2122 [(set (match_operand:HI 0 "register_operand" "")
2123 (mem:HI (match_operand 1 "address_operand" "")))]
2124 "GET_CODE (operands[1]) == SYMBOL_REF
2125 && CONSTANT_POOL_ADDRESS_P (operands[1])
2126 && get_pool_mode (operands[1]) == HImode
2127 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
2128 [(set (match_dup 0) (match_dup 2))]
2129 "operands[2] = get_pool_constant (operands[1]);")
2132 ; movqi instruction pattern(s).
2135 (define_expand "movqi"
2136 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2137 (match_operand:QI 1 "general_operand" ""))]
2140 /* On z/Architecture, zero-extending from memory to register
2141 is just as fast as a QImode load. */
2142 if (TARGET_ZARCH && optimize && can_create_pseudo_p ()
2143 && register_operand (operands[0], VOIDmode)
2144 && GET_CODE (operands[1]) == MEM)
2146 rtx tmp = gen_reg_rtx (DImode);
2147 rtx ext = gen_rtx_ZERO_EXTEND (DImode, operands[1]);
2148 emit_insn (gen_rtx_SET (tmp, ext));
2149 operands[1] = gen_lowpart (QImode, tmp);
2153 (define_insn "*movqi"
2154 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q,v,v,v,d, v,QR")
2155 (match_operand:QI 1 "general_operand" " d,n,R,T,d,d,n,n,?Q,K,v,d,v,QR, v"))]
2173 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS,VRI,VRR,VRS,VRS,VRX,VRX")
2174 (set_attr "type" "lr,*,*,*,store,store,store,store,*,*,*,*,*,*,*")
2175 (set_attr "cpu_facility" "*,*,*,*,*,*,*,*,*,vec,vec,vec,vec,vec,vec")
2176 (set_attr "z10prop" "z10_fr_E1,
2187 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2188 (mem:QI (match_operand 1 "address_operand" "")))]
2189 "GET_CODE (operands[1]) == SYMBOL_REF
2190 && CONSTANT_POOL_ADDRESS_P (operands[1])
2191 && get_pool_mode (operands[1]) == QImode
2192 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
2193 [(set (match_dup 0) (match_dup 2))]
2194 "operands[2] = get_pool_constant (operands[1]);")
2197 ; movstrictqi instruction pattern(s).
2200 (define_insn "*movstrictqi"
2201 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
2202 (match_operand:QI 1 "memory_operand" "R,T"))]
2207 [(set_attr "op_type" "RX,RXY")
2208 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
2211 ; movstricthi instruction pattern(s).
2214 (define_insn "*movstricthi"
2215 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
2216 (match_operand:HI 1 "memory_operand" "Q,S"))
2217 (clobber (reg:CC CC_REGNUM))]
2222 [(set_attr "op_type" "RS,RSY")
2223 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
2226 ; movstrictsi instruction pattern(s).
2229 (define_insn "movstrictsi"
2230 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d,d"))
2231 (match_operand:SI 1 "general_operand" "d,R,T,t"))]
2238 [(set_attr "op_type" "RR,RX,RXY,RRE")
2239 (set_attr "type" "lr,load,load,*")
2240 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_super_E1")])
2243 ; mov(tf|td) instruction pattern(s).
2246 (define_expand "mov<mode>"
2247 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2248 (match_operand:TD_TF 1 "general_operand" ""))]
2252 (define_insn "*mov<mode>_64"
2253 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o, d,QS, d,o")
2254 (match_operand:TD_TF 1 "general_operand" " G,f,o,f,QS, d,dRT,d"))]
2265 [(set_attr "op_type" "RRE,RRE,*,*,RSY,RSY,*,*")
2266 (set_attr "type" "fsimptf,fsimptf,*,*,lm,stm,*,*")
2267 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*")])
2269 (define_insn "*mov<mode>_31"
2270 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o")
2271 (match_operand:TD_TF 1 "general_operand" " G,f,o,f"))]
2278 [(set_attr "op_type" "RRE,RRE,*,*")
2279 (set_attr "type" "fsimptf,fsimptf,*,*")
2280 (set_attr "cpu_facility" "z196,*,*,*")])
2282 ; TFmode in GPRs splitters
2285 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2286 (match_operand:TD_TF 1 "general_operand" ""))]
2287 "TARGET_ZARCH && reload_completed
2288 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)"
2289 [(set (match_dup 2) (match_dup 4))
2290 (set (match_dup 3) (match_dup 5))]
2292 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
2293 operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode);
2294 operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode);
2295 operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode);
2299 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2300 (match_operand:TD_TF 1 "general_operand" ""))]
2301 "TARGET_ZARCH && reload_completed
2302 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)"
2303 [(set (match_dup 2) (match_dup 4))
2304 (set (match_dup 3) (match_dup 5))]
2306 operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode);
2307 operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode);
2308 operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode);
2309 operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode);
2313 [(set (match_operand:TD_TF 0 "register_operand" "")
2314 (match_operand:TD_TF 1 "memory_operand" ""))]
2315 "TARGET_ZARCH && reload_completed
2316 && GENERAL_REG_P (operands[0])
2317 && !s_operand (operands[1], VOIDmode)"
2318 [(set (match_dup 0) (match_dup 1))]
2320 rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode);
2321 addr = gen_lowpart (Pmode, addr);
2322 s390_load_address (addr, XEXP (operands[1], 0));
2323 operands[1] = replace_equiv_address (operands[1], addr);
2326 ; TFmode in BFPs splitters
2329 [(set (match_operand:TD_TF 0 "register_operand" "")
2330 (match_operand:TD_TF 1 "memory_operand" ""))]
2331 "reload_completed && offsettable_memref_p (operands[1])
2332 && FP_REG_P (operands[0])"
2333 [(set (match_dup 2) (match_dup 4))
2334 (set (match_dup 3) (match_dup 5))]
2336 operands[2] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0],
2338 operands[3] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0],
2340 operands[4] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 0);
2341 operands[5] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 8);
2345 [(set (match_operand:TD_TF 0 "memory_operand" "")
2346 (match_operand:TD_TF 1 "register_operand" ""))]
2347 "reload_completed && offsettable_memref_p (operands[0])
2348 && FP_REG_P (operands[1])"
2349 [(set (match_dup 2) (match_dup 4))
2350 (set (match_dup 3) (match_dup 5))]
2352 operands[2] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 0);
2353 operands[3] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 8);
2354 operands[4] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1],
2356 operands[5] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1],
2361 ; mov(df|dd) instruction pattern(s).
2364 (define_expand "mov<mode>"
2365 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2366 (match_operand:DD_DF 1 "general_operand" ""))]
2370 (define_insn "*mov<mode>_64dfp"
2371 [(set (match_operand:DD_DF 0 "nonimmediate_operand"
2372 "=f,f,f,d,f,f,R,T,d,d,d, d,b,RT,v,v,d,v,QR")
2373 (match_operand:DD_DF 1 "general_operand"
2374 " G,f,d,f,R,T,f,f,G,d,b,RT,d, d,v,d,v,QR,v"))]
2396 [(set_attr "op_type" "RRE,RR,RRE,RRE,RX,RXY,RX,RXY,RI,RRE,RIL,RXY,RIL,RXY,VRR,VRS,VRS,VRX,VRX")
2397 (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,floaddf,floaddf,
2398 fstoredf,fstoredf,*,lr,load,load,store,store,*,*,*,load,store")
2399 (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,*,*,*,*,*")
2400 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*,z10,*,z10,*,vec,vec,vec,vec,vec")])
2402 (define_insn "*mov<mode>_64"
2403 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,d, d,b,RT,v,v,QR")
2404 (match_operand:DD_DF 1 "general_operand" " G,f,R,T,f,f,G,d,b,RT,d, d,v,QR,v"))]
2422 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RI,RRE,RIL,RXY,RIL,RXY,VRR,VRX,VRX")
2423 (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>,
2424 fstore<mode>,fstore<mode>,*,lr,load,load,store,store,*,load,store")
2425 (set_attr "z10prop" "*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,*,*,*")
2426 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,z10,*,z10,*,vec,vec,vec")])
2428 (define_insn "*mov<mode>_31"
2429 [(set (match_operand:DD_DF 0 "nonimmediate_operand"
2430 "=f,f,f,f,R,T,d,d,Q,S, d,o")
2431 (match_operand:DD_DF 1 "general_operand"
2432 " G,f,R,T,f,f,Q,S,d,d,dPRT,d"))]
2447 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*")
2448 (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>,
2449 fstore<mode>,fstore<mode>,lm,lm,stm,stm,*,*")
2450 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*,*,*")])
2453 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2454 (match_operand:DD_DF 1 "general_operand" ""))]
2455 "!TARGET_ZARCH && reload_completed
2456 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)"
2457 [(set (match_dup 2) (match_dup 4))
2458 (set (match_dup 3) (match_dup 5))]
2460 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
2461 operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode);
2462 operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode);
2463 operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode);
2467 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2468 (match_operand:DD_DF 1 "general_operand" ""))]
2469 "!TARGET_ZARCH && reload_completed
2470 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)"
2471 [(set (match_dup 2) (match_dup 4))
2472 (set (match_dup 3) (match_dup 5))]
2474 operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode);
2475 operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode);
2476 operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode);
2477 operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode);
2481 [(set (match_operand:DD_DF 0 "register_operand" "")
2482 (match_operand:DD_DF 1 "memory_operand" ""))]
2483 "!TARGET_ZARCH && reload_completed
2484 && !FP_REG_P (operands[0])
2485 && !s_operand (operands[1], VOIDmode)"
2486 [(set (match_dup 0) (match_dup 1))]
2488 rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode);
2489 s390_load_address (addr, XEXP (operands[1], 0));
2490 operands[1] = replace_equiv_address (operands[1], addr);
2494 ; mov(sf|sd) instruction pattern(s).
2497 (define_insn "mov<mode>"
2498 [(set (match_operand:SD_SF 0 "nonimmediate_operand"
2499 "=f,f,f,f,f,f,R,T,d,d,d,d,d,b,R,T,v,v,v,d,v,QR")
2500 (match_operand:SD_SF 1 "general_operand"
2501 " G,f,f,R,R,T,f,f,G,d,b,R,T,d,d,d,v,G,d,v,QR,v"))]
2526 [(set_attr "op_type" "RRE,RRE,RR,RXE,RX,RXY,RX,RXY,RI,RR,RIL,RX,RXY,RIL,RX,RXY,VRR,VRI,VRS,VRS,VRX,VRX")
2527 (set_attr "type" "fsimpsf,fsimpsf,fload<mode>,fload<mode>,fload<mode>,fload<mode>,
2528 fstore<mode>,fstore<mode>,*,lr,load,load,load,store,store,store,*,*,*,*,load,store")
2529 (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,z10_rec,*,*,*,*,*,*")
2530 (set_attr "cpu_facility" "z196,vec,*,vec,*,*,*,*,*,*,z10,*,*,z10,*,*,vec,vec,vec,vec,vec,vec")])
2533 ; movcc instruction pattern
2536 (define_insn "movcc"
2537 [(set (match_operand:CC 0 "nonimmediate_operand" "=d,c,d,d,d,R,T")
2538 (match_operand:CC 1 "nonimmediate_operand" " d,d,c,R,T,d,d"))]
2548 [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY")
2549 (set_attr "type" "lr,*,*,load,load,store,store")
2550 (set_attr "z10prop" "z10_fr_E1,z10_super,*,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec")
2551 (set_attr "z196prop" "*,*,z196_ends,*,*,*,*")])
2554 ; Block move (MVC) patterns.
2558 [(set (match_operand:BLK 0 "memory_operand" "=Q")
2559 (match_operand:BLK 1 "memory_operand" "Q"))
2560 (use (match_operand 2 "const_int_operand" "n"))]
2561 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
2562 "mvc\t%O0(%2,%R0),%S1"
2563 [(set_attr "op_type" "SS")])
2565 ; This splitter converts a QI to QI mode copy into a BLK mode copy in
2566 ; order to have it implemented with mvc.
2569 [(set (match_operand:QI 0 "memory_operand" "")
2570 (match_operand:QI 1 "memory_operand" ""))]
2573 [(set (match_dup 0) (match_dup 1))
2574 (use (const_int 1))])]
2576 operands[0] = adjust_address (operands[0], BLKmode, 0);
2577 operands[1] = adjust_address (operands[1], BLKmode, 0);
2583 [(set (match_operand:BLK 0 "memory_operand" "")
2584 (match_operand:BLK 1 "memory_operand" ""))
2585 (use (match_operand 2 "const_int_operand" ""))])
2587 [(set (match_operand:BLK 3 "memory_operand" "")
2588 (match_operand:BLK 4 "memory_operand" ""))
2589 (use (match_operand 5 "const_int_operand" ""))])]
2590 "s390_offset_p (operands[0], operands[3], operands[2])
2591 && s390_offset_p (operands[1], operands[4], operands[2])
2592 && !s390_overlap_p (operands[0], operands[1],
2593 INTVAL (operands[2]) + INTVAL (operands[5]))
2594 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
2596 [(set (match_dup 6) (match_dup 7))
2597 (use (match_dup 8))])]
2598 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
2599 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
2600 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
2604 ; load_multiple pattern(s).
2606 ; ??? Due to reload problems with replacing registers inside match_parallel
2607 ; we currently support load_multiple/store_multiple only after reload.
2610 (define_expand "load_multiple"
2611 [(match_par_dup 3 [(set (match_operand 0 "" "")
2612 (match_operand 1 "" ""))
2613 (use (match_operand 2 "" ""))])]
2622 /* Support only loading a constant number of fixed-point registers from
2623 memory and only bother with this if more than two */
2624 if (GET_CODE (operands[2]) != CONST_INT
2625 || INTVAL (operands[2]) < 2
2626 || INTVAL (operands[2]) > 16
2627 || GET_CODE (operands[1]) != MEM
2628 || GET_CODE (operands[0]) != REG
2629 || REGNO (operands[0]) >= 16)
2632 count = INTVAL (operands[2]);
2633 regno = REGNO (operands[0]);
2634 mode = GET_MODE (operands[0]);
2635 if (mode != SImode && (!TARGET_ZARCH || mode != DImode))
2638 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2639 if (!can_create_pseudo_p ())
2641 if (GET_CODE (XEXP (operands[1], 0)) == REG)
2643 from = XEXP (operands[1], 0);
2646 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
2647 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
2648 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
2650 from = XEXP (XEXP (operands[1], 0), 0);
2651 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
2658 from = force_reg (Pmode, XEXP (operands[1], 0));
2662 for (i = 0; i < count; i++)
2663 XVECEXP (operands[3], 0, i)
2664 = gen_rtx_SET (gen_rtx_REG (mode, regno + i),
2665 change_address (operands[1], mode,
2666 plus_constant (Pmode, from,
2667 off + i * GET_MODE_SIZE (mode))));
2670 (define_insn "*load_multiple_di"
2671 [(match_parallel 0 "load_multiple_operation"
2672 [(set (match_operand:DI 1 "register_operand" "=r")
2673 (match_operand:DI 2 "s_operand" "QS"))])]
2674 "reload_completed && TARGET_ZARCH"
2676 int words = XVECLEN (operands[0], 0);
2677 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
2678 return "lmg\t%1,%0,%S2";
2680 [(set_attr "op_type" "RSY")
2681 (set_attr "type" "lm")])
2683 (define_insn "*load_multiple_si"
2684 [(match_parallel 0 "load_multiple_operation"
2685 [(set (match_operand:SI 1 "register_operand" "=r,r")
2686 (match_operand:SI 2 "s_operand" "Q,S"))])]
2689 int words = XVECLEN (operands[0], 0);
2690 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
2691 return which_alternative == 0 ? "lm\t%1,%0,%S2" : "lmy\t%1,%0,%S2";
2693 [(set_attr "op_type" "RS,RSY")
2694 (set_attr "type" "lm")])
2697 ; store multiple pattern(s).
2700 (define_expand "store_multiple"
2701 [(match_par_dup 3 [(set (match_operand 0 "" "")
2702 (match_operand 1 "" ""))
2703 (use (match_operand 2 "" ""))])]
2712 /* Support only storing a constant number of fixed-point registers to
2713 memory and only bother with this if more than two. */
2714 if (GET_CODE (operands[2]) != CONST_INT
2715 || INTVAL (operands[2]) < 2
2716 || INTVAL (operands[2]) > 16
2717 || GET_CODE (operands[0]) != MEM
2718 || GET_CODE (operands[1]) != REG
2719 || REGNO (operands[1]) >= 16)
2722 count = INTVAL (operands[2]);
2723 regno = REGNO (operands[1]);
2724 mode = GET_MODE (operands[1]);
2725 if (mode != SImode && (!TARGET_ZARCH || mode != DImode))
2728 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2730 if (!can_create_pseudo_p ())
2732 if (GET_CODE (XEXP (operands[0], 0)) == REG)
2734 to = XEXP (operands[0], 0);
2737 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
2738 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
2739 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
2741 to = XEXP (XEXP (operands[0], 0), 0);
2742 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
2749 to = force_reg (Pmode, XEXP (operands[0], 0));
2753 for (i = 0; i < count; i++)
2754 XVECEXP (operands[3], 0, i)
2755 = gen_rtx_SET (change_address (operands[0], mode,
2756 plus_constant (Pmode, to,
2757 off + i * GET_MODE_SIZE (mode))),
2758 gen_rtx_REG (mode, regno + i));
2761 (define_insn "*store_multiple_di"
2762 [(match_parallel 0 "store_multiple_operation"
2763 [(set (match_operand:DI 1 "s_operand" "=QS")
2764 (match_operand:DI 2 "register_operand" "r"))])]
2765 "reload_completed && TARGET_ZARCH"
2767 int words = XVECLEN (operands[0], 0);
2768 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
2769 return "stmg\t%2,%0,%S1";
2771 [(set_attr "op_type" "RSY")
2772 (set_attr "type" "stm")])
2775 (define_insn "*store_multiple_si"
2776 [(match_parallel 0 "store_multiple_operation"
2777 [(set (match_operand:SI 1 "s_operand" "=Q,S")
2778 (match_operand:SI 2 "register_operand" "r,r"))])]
2781 int words = XVECLEN (operands[0], 0);
2782 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
2783 return which_alternative == 0 ? "stm\t%2,%0,%S1" : "stmy\t%2,%0,%S1";
2785 [(set_attr "op_type" "RS,RSY")
2786 (set_attr "type" "stm")])
2789 ;; String instructions.
2792 (define_insn "*execute_rl"
2793 [(match_parallel 0 "execute_operation"
2794 [(unspec [(match_operand 1 "register_operand" "a")
2795 (match_operand 2 "" "")
2796 (match_operand:SI 3 "larl_operand" "X")] UNSPEC_EXECUTE)])]
2797 "TARGET_Z10 && GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
2798 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
2800 [(set_attr "op_type" "RIL")
2801 (set_attr "type" "cs")])
2803 (define_insn "*execute"
2804 [(match_parallel 0 "execute_operation"
2805 [(unspec [(match_operand 1 "register_operand" "a")
2806 (match_operand:BLK 2 "memory_operand" "R")
2807 (match_operand 3 "" "")] UNSPEC_EXECUTE)])]
2808 "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
2809 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
2811 [(set_attr "op_type" "RX")
2812 (set_attr "type" "cs")])
2816 ; strlenM instruction pattern(s).
2819 (define_expand "strlen<mode>"
2820 [(match_operand:P 0 "register_operand" "") ; result
2821 (match_operand:BLK 1 "memory_operand" "") ; input string
2822 (match_operand:SI 2 "immediate_operand" "") ; search character
2823 (match_operand:SI 3 "immediate_operand" "")] ; known alignment
2826 if (!TARGET_VX || operands[2] != const0_rtx)
2827 emit_insn (gen_strlen_srst<mode> (operands[0], operands[1],
2828 operands[2], operands[3]));
2830 s390_expand_vec_strlen (operands[0], operands[1], operands[3]);
2835 (define_expand "strlen_srst<mode>"
2836 [(set (reg:SI 0) (match_operand:SI 2 "immediate_operand" ""))
2839 (unspec:P [(const_int 0)
2840 (match_operand:BLK 1 "memory_operand" "")
2842 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
2843 (clobber (scratch:P))
2844 (clobber (reg:CC CC_REGNUM))])
2846 [(set (match_operand:P 0 "register_operand" "")
2847 (minus:P (match_dup 4) (match_dup 5)))
2848 (clobber (reg:CC CC_REGNUM))])]
2851 operands[4] = gen_reg_rtx (Pmode);
2852 operands[5] = gen_reg_rtx (Pmode);
2853 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
2854 operands[1] = replace_equiv_address (operands[1], operands[5]);
2857 (define_insn "*strlen<mode>"
2858 [(set (match_operand:P 0 "register_operand" "=a")
2859 (unspec:P [(match_operand:P 2 "general_operand" "0")
2860 (mem:BLK (match_operand:P 3 "register_operand" "1"))
2862 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
2863 (clobber (match_scratch:P 1 "=a"))
2864 (clobber (reg:CC CC_REGNUM))]
2866 "srst\t%0,%1\;jo\t.-4"
2867 [(set_attr "length" "8")
2868 (set_attr "type" "vs")])
2871 ; cmpstrM instruction pattern(s).
2874 (define_expand "cmpstrsi"
2875 [(set (reg:SI 0) (const_int 0))
2877 [(clobber (match_operand 3 "" ""))
2878 (clobber (match_dup 4))
2879 (set (reg:CCU CC_REGNUM)
2880 (compare:CCU (match_operand:BLK 1 "memory_operand" "")
2881 (match_operand:BLK 2 "memory_operand" "")))
2884 [(set (match_operand:SI 0 "register_operand" "=d")
2885 (unspec:SI [(reg:CCU CC_REGNUM)] UNSPEC_STRCMPCC_TO_INT))
2886 (clobber (reg:CC CC_REGNUM))])]
2889 /* As the result of CMPINT is inverted compared to what we need,
2890 we have to swap the operands. */
2891 rtx op1 = operands[2];
2892 rtx op2 = operands[1];
2893 rtx addr1 = gen_reg_rtx (Pmode);
2894 rtx addr2 = gen_reg_rtx (Pmode);
2896 emit_move_insn (addr1, force_operand (XEXP (op1, 0), NULL_RTX));
2897 emit_move_insn (addr2, force_operand (XEXP (op2, 0), NULL_RTX));
2898 operands[1] = replace_equiv_address_nv (op1, addr1);
2899 operands[2] = replace_equiv_address_nv (op2, addr2);
2900 operands[3] = addr1;
2901 operands[4] = addr2;
2904 (define_insn "*cmpstr<mode>"
2905 [(clobber (match_operand:P 0 "register_operand" "=d"))
2906 (clobber (match_operand:P 1 "register_operand" "=d"))
2907 (set (reg:CCU CC_REGNUM)
2908 (compare:CCU (mem:BLK (match_operand:P 2 "register_operand" "0"))
2909 (mem:BLK (match_operand:P 3 "register_operand" "1"))))
2912 "clst\t%0,%1\;jo\t.-4"
2913 [(set_attr "length" "8")
2914 (set_attr "type" "vs")])
2917 ; movstr instruction pattern.
2920 (define_expand "movstr"
2921 [(match_operand 0 "register_operand" "")
2922 (match_operand 1 "memory_operand" "")
2923 (match_operand 2 "memory_operand" "")]
2927 emit_insn (gen_movstrdi (operands[0], operands[1], operands[2]));
2929 emit_insn (gen_movstrsi (operands[0], operands[1], operands[2]));
2933 (define_expand "movstr<P:mode>"
2934 [(set (reg:SI 0) (const_int 0))
2936 [(clobber (match_dup 3))
2937 (set (match_operand:BLK 1 "memory_operand" "")
2938 (match_operand:BLK 2 "memory_operand" ""))
2939 (set (match_operand:P 0 "register_operand" "")
2940 (unspec:P [(match_dup 1)
2942 (reg:SI 0)] UNSPEC_MVST))
2943 (clobber (reg:CC CC_REGNUM))])]
2946 rtx addr1 = gen_reg_rtx (Pmode);
2947 rtx addr2 = gen_reg_rtx (Pmode);
2949 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2950 emit_move_insn (addr2, force_operand (XEXP (operands[2], 0), NULL_RTX));
2951 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2952 operands[2] = replace_equiv_address_nv (operands[2], addr2);
2953 operands[3] = addr2;
2956 (define_insn "*movstr"
2957 [(clobber (match_operand:P 2 "register_operand" "=d"))
2958 (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
2959 (mem:BLK (match_operand:P 3 "register_operand" "2")))
2960 (set (match_operand:P 0 "register_operand" "=d")
2961 (unspec:P [(mem:BLK (match_dup 1))
2962 (mem:BLK (match_dup 3))
2963 (reg:SI 0)] UNSPEC_MVST))
2964 (clobber (reg:CC CC_REGNUM))]
2966 "mvst\t%1,%2\;jo\t.-4"
2967 [(set_attr "length" "8")
2968 (set_attr "type" "vs")])
2972 ; movmemM instruction pattern(s).
2975 (define_expand "movmem<mode>"
2976 [(set (match_operand:BLK 0 "memory_operand" "") ; destination
2977 (match_operand:BLK 1 "memory_operand" "")) ; source
2978 (use (match_operand:GPR 2 "general_operand" "")) ; count
2979 (match_operand 3 "" "")]
2982 if (s390_expand_movmem (operands[0], operands[1], operands[2]))
2988 ; Move a block that is up to 256 bytes in length.
2989 ; The block length is taken as (operands[2] % 256) + 1.
2991 (define_expand "movmem_short"
2993 [(set (match_operand:BLK 0 "memory_operand" "")
2994 (match_operand:BLK 1 "memory_operand" ""))
2995 (use (match_operand 2 "nonmemory_operand" ""))
2996 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2997 (clobber (match_dup 3))])]
2999 "operands[3] = gen_rtx_SCRATCH (Pmode);")
3001 (define_insn "*movmem_short"
3002 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q")
3003 (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q"))
3004 (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
3005 (use (match_operand 3 "immediate_operand" "X,R,X,X"))
3006 (clobber (match_scratch:P 4 "=X,X,X,&a"))]
3007 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
3009 [(set_attr "type" "cs")
3010 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3013 [(set (match_operand:BLK 0 "memory_operand" "")
3014 (match_operand:BLK 1 "memory_operand" ""))
3015 (use (match_operand 2 "const_int_operand" ""))
3016 (use (match_operand 3 "immediate_operand" ""))
3017 (clobber (scratch))]
3020 [(set (match_dup 0) (match_dup 1))
3021 (use (match_dup 2))])]
3022 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
3025 [(set (match_operand:BLK 0 "memory_operand" "")
3026 (match_operand:BLK 1 "memory_operand" ""))
3027 (use (match_operand 2 "register_operand" ""))
3028 (use (match_operand 3 "memory_operand" ""))
3029 (clobber (scratch))]
3032 [(unspec [(match_dup 2) (match_dup 3)
3033 (const_int 0)] UNSPEC_EXECUTE)
3034 (set (match_dup 0) (match_dup 1))
3035 (use (const_int 1))])]
3039 [(set (match_operand:BLK 0 "memory_operand" "")
3040 (match_operand:BLK 1 "memory_operand" ""))
3041 (use (match_operand 2 "register_operand" ""))
3042 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3043 (clobber (scratch))]
3044 "TARGET_Z10 && reload_completed"
3046 [(unspec [(match_dup 2) (const_int 0)
3047 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3048 (set (match_dup 0) (match_dup 1))
3049 (use (const_int 1))])]
3050 "operands[3] = gen_label_rtx ();")
3053 [(set (match_operand:BLK 0 "memory_operand" "")
3054 (match_operand:BLK 1 "memory_operand" ""))
3055 (use (match_operand 2 "register_operand" ""))
3056 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3057 (clobber (match_operand 3 "register_operand" ""))]
3058 "reload_completed && TARGET_CPU_ZARCH"
3059 [(set (match_dup 3) (label_ref (match_dup 4)))
3061 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
3062 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3063 (set (match_dup 0) (match_dup 1))
3064 (use (const_int 1))])]
3065 "operands[4] = gen_label_rtx ();")
3067 ; Move a block of arbitrary length.
3069 (define_expand "movmem_long"
3071 [(clobber (match_dup 2))
3072 (clobber (match_dup 3))
3073 (set (match_operand:BLK 0 "memory_operand" "")
3074 (match_operand:BLK 1 "memory_operand" ""))
3075 (use (match_operand 2 "general_operand" ""))
3077 (clobber (reg:CC CC_REGNUM))])]
3080 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3081 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3082 rtx reg0 = gen_reg_rtx (dreg_mode);
3083 rtx reg1 = gen_reg_rtx (dreg_mode);
3084 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3085 rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1));
3086 rtx len0 = gen_lowpart (Pmode, reg0);
3087 rtx len1 = gen_lowpart (Pmode, reg1);
3089 emit_clobber (reg0);
3090 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3091 emit_move_insn (len0, operands[2]);
3093 emit_clobber (reg1);
3094 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
3095 emit_move_insn (len1, operands[2]);
3097 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3098 operands[1] = replace_equiv_address_nv (operands[1], addr1);
3103 (define_insn "*movmem_long"
3104 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3105 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
3106 (set (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
3107 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0)))
3110 (clobber (reg:CC CC_REGNUM))]
3111 "TARGET_64BIT || !TARGET_ZARCH"
3112 "mvcle\t%0,%1,0\;jo\t.-4"
3113 [(set_attr "length" "8")
3114 (set_attr "type" "vs")])
3116 (define_insn "*movmem_long_31z"
3117 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3118 (clobber (match_operand:TI 1 "register_operand" "=d"))
3119 (set (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4))
3120 (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4)))
3123 (clobber (reg:CC CC_REGNUM))]
3124 "!TARGET_64BIT && TARGET_ZARCH"
3125 "mvcle\t%0,%1,0\;jo\t.-4"
3126 [(set_attr "length" "8")
3127 (set_attr "type" "vs")])
3134 (define_expand "signbit<mode>2"
3135 [(set (reg:CCZ CC_REGNUM)
3136 (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
3139 (set (match_operand:SI 0 "register_operand" "=d")
3140 (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))]
3143 operands[2] = GEN_INT (S390_TDC_SIGNBIT_SET);
3146 (define_expand "isinf<mode>2"
3147 [(set (reg:CCZ CC_REGNUM)
3148 (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
3151 (set (match_operand:SI 0 "register_operand" "=d")
3152 (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))]
3155 operands[2] = GEN_INT (S390_TDC_INFINITY);
3158 ; This extracts CC into a GPR properly shifted. The actual IPM
3159 ; instruction will be issued by reload. The constraint of operand 1
3160 ; forces reload to use a GPR. So reload will issue a movcc insn for
3161 ; copying CC into a GPR first.
3162 (define_insn_and_split "*cc_to_int"
3163 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3164 (unspec:SI [(match_operand 1 "register_operand" "0")]
3169 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 28)))])
3171 ; This insn is used to generate all variants of the Test Data Class
3172 ; instruction, namely tcxb, tcdb, and tceb. The insn's first operand
3173 ; is the register to be tested and the second one is the bit mask
3174 ; specifying the required test(s).
3176 ; tcxb, tcdb, tceb, tdcxt, tdcdt, tdcet
3177 (define_insn "*TDC_insn_<mode>"
3178 [(set (reg:CCZ CC_REGNUM)
3179 (unspec:CCZ [(match_operand:FP_ALL 0 "register_operand" "f")
3180 (match_operand:SI 1 "const_int_operand")] UNSPEC_TDC_INSN))]
3182 "t<_d>c<xde><bt>\t%0,%1"
3183 [(set_attr "op_type" "RXE")
3184 (set_attr "type" "fsimp<mode>")])
3189 ; setmemM instruction pattern(s).
3192 (define_expand "setmem<mode>"
3193 [(set (match_operand:BLK 0 "memory_operand" "")
3194 (match_operand:QI 2 "general_operand" ""))
3195 (use (match_operand:GPR 1 "general_operand" ""))
3196 (match_operand 3 "" "")]
3198 "s390_expand_setmem (operands[0], operands[1], operands[2]); DONE;")
3200 ; Clear a block that is up to 256 bytes in length.
3201 ; The block length is taken as (operands[1] % 256) + 1.
3203 (define_expand "clrmem_short"
3205 [(set (match_operand:BLK 0 "memory_operand" "")
3207 (use (match_operand 1 "nonmemory_operand" ""))
3208 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3209 (clobber (match_dup 2))
3210 (clobber (reg:CC CC_REGNUM))])]
3212 "operands[2] = gen_rtx_SCRATCH (Pmode);")
3214 (define_insn "*clrmem_short"
3215 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q")
3217 (use (match_operand 1 "nonmemory_operand" "n,a,a,a"))
3218 (use (match_operand 2 "immediate_operand" "X,R,X,X"))
3219 (clobber (match_scratch:P 3 "=X,X,X,&a"))
3220 (clobber (reg:CC CC_REGNUM))]
3221 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)"
3223 [(set_attr "type" "cs")
3224 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3227 [(set (match_operand:BLK 0 "memory_operand" "")
3229 (use (match_operand 1 "const_int_operand" ""))
3230 (use (match_operand 2 "immediate_operand" ""))
3232 (clobber (reg:CC CC_REGNUM))]
3235 [(set (match_dup 0) (const_int 0))
3237 (clobber (reg:CC CC_REGNUM))])]
3238 "operands[1] = GEN_INT ((INTVAL (operands[1]) & 0xff) + 1);")
3241 [(set (match_operand:BLK 0 "memory_operand" "")
3243 (use (match_operand 1 "register_operand" ""))
3244 (use (match_operand 2 "memory_operand" ""))
3246 (clobber (reg:CC CC_REGNUM))]
3249 [(unspec [(match_dup 1) (match_dup 2)
3250 (const_int 0)] UNSPEC_EXECUTE)
3251 (set (match_dup 0) (const_int 0))
3253 (clobber (reg:CC CC_REGNUM))])]
3257 [(set (match_operand:BLK 0 "memory_operand" "")
3259 (use (match_operand 1 "register_operand" ""))
3260 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3262 (clobber (reg:CC CC_REGNUM))]
3263 "TARGET_Z10 && reload_completed"
3265 [(unspec [(match_dup 1) (const_int 0)
3266 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3267 (set (match_dup 0) (const_int 0))
3269 (clobber (reg:CC CC_REGNUM))])]
3270 "operands[3] = gen_label_rtx ();")
3273 [(set (match_operand:BLK 0 "memory_operand" "")
3275 (use (match_operand 1 "register_operand" ""))
3276 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3277 (clobber (match_operand 2 "register_operand" ""))
3278 (clobber (reg:CC CC_REGNUM))]
3279 "reload_completed && TARGET_CPU_ZARCH"
3280 [(set (match_dup 2) (label_ref (match_dup 3)))
3282 [(unspec [(match_dup 1) (mem:BLK (match_dup 2))
3283 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3284 (set (match_dup 0) (const_int 0))
3286 (clobber (reg:CC CC_REGNUM))])]
3287 "operands[3] = gen_label_rtx ();")
3289 ; Initialize a block of arbitrary length with (operands[2] % 256).
3291 (define_expand "setmem_long_<P:mode>"
3293 [(clobber (match_dup 1))
3294 (set (match_operand:BLK 0 "memory_operand" "")
3295 (unspec:BLK [(match_operand:P 2 "shift_count_or_setmem_operand" "")
3296 (match_dup 4)] UNSPEC_REPLICATE_BYTE))
3298 (clobber (reg:CC CC_REGNUM))])]
3301 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3302 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3303 rtx reg0 = gen_reg_rtx (dreg_mode);
3304 rtx reg1 = gen_reg_rtx (dreg_mode);
3305 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3306 rtx len0 = gen_lowpart (Pmode, reg0);
3308 emit_clobber (reg0);
3309 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3310 emit_move_insn (len0, operands[1]);
3312 emit_move_insn (reg1, const0_rtx);
3314 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3317 operands[4] = gen_lowpart (Pmode, operands[1]);
3320 ; Patterns for 31 bit + Esa and 64 bit + Zarch.
3322 (define_insn "*setmem_long"
3323 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3324 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
3325 (unspec:BLK [(match_operand:P 2 "shift_count_or_setmem_operand" "Y")
3326 (subreg:P (match_dup 3) <modesize>)]
3327 UNSPEC_REPLICATE_BYTE))
3328 (use (match_operand:<DBL> 1 "register_operand" "d"))
3329 (clobber (reg:CC CC_REGNUM))]
3330 "TARGET_64BIT || !TARGET_ZARCH"
3331 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3332 [(set_attr "length" "8")
3333 (set_attr "type" "vs")])
3335 (define_insn "*setmem_long_and"
3336 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3337 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
3339 (match_operand:P 2 "shift_count_or_setmem_operand" "Y")
3340 (match_operand:P 4 "const_int_operand" "n"))
3341 (subreg:P (match_dup 3) <modesize>)]
3342 UNSPEC_REPLICATE_BYTE))
3343 (use (match_operand:<DBL> 1 "register_operand" "d"))
3344 (clobber (reg:CC CC_REGNUM))]
3345 "(TARGET_64BIT || !TARGET_ZARCH) &&
3346 (INTVAL (operands[4]) & 255) == 255"
3347 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3348 [(set_attr "length" "8")
3349 (set_attr "type" "vs")])
3351 ; Variants for 31 bit + Zarch, necessary because of the odd in-register offsets
3352 ; of the SImode subregs.
3354 (define_insn "*setmem_long_31z"
3355 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3356 (set (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "0") 4))
3357 (unspec:BLK [(match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
3358 (subreg:SI (match_dup 3) 12)] UNSPEC_REPLICATE_BYTE))
3359 (use (match_operand:TI 1 "register_operand" "d"))
3360 (clobber (reg:CC CC_REGNUM))]
3361 "!TARGET_64BIT && TARGET_ZARCH"
3362 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3363 [(set_attr "length" "8")
3364 (set_attr "type" "vs")])
3366 (define_insn "*setmem_long_and_31z"
3367 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3368 (set (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "0") 4))
3369 (unspec:BLK [(and:SI
3370 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
3371 (match_operand:SI 4 "const_int_operand" "n"))
3372 (subreg:SI (match_dup 3) 12)] UNSPEC_REPLICATE_BYTE))
3373 (use (match_operand:TI 1 "register_operand" "d"))
3374 (clobber (reg:CC CC_REGNUM))]
3375 "(!TARGET_64BIT && TARGET_ZARCH) &&
3376 (INTVAL (operands[4]) & 255) == 255"
3377 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3378 [(set_attr "length" "8")
3379 (set_attr "type" "vs")])
3382 ; cmpmemM instruction pattern(s).
3385 (define_expand "cmpmemsi"
3386 [(set (match_operand:SI 0 "register_operand" "")
3387 (compare:SI (match_operand:BLK 1 "memory_operand" "")
3388 (match_operand:BLK 2 "memory_operand" "") ) )
3389 (use (match_operand:SI 3 "general_operand" ""))
3390 (use (match_operand:SI 4 "" ""))]
3393 if (s390_expand_cmpmem (operands[0], operands[1],
3394 operands[2], operands[3]))
3400 ; Compare a block that is up to 256 bytes in length.
3401 ; The block length is taken as (operands[2] % 256) + 1.
3403 (define_expand "cmpmem_short"
3405 [(set (reg:CCU CC_REGNUM)
3406 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3407 (match_operand:BLK 1 "memory_operand" "")))
3408 (use (match_operand 2 "nonmemory_operand" ""))
3409 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3410 (clobber (match_dup 3))])]
3412 "operands[3] = gen_rtx_SCRATCH (Pmode);")
3414 (define_insn "*cmpmem_short"
3415 [(set (reg:CCU CC_REGNUM)
3416 (compare:CCU (match_operand:BLK 0 "memory_operand" "Q,Q,Q,Q")
3417 (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q")))
3418 (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
3419 (use (match_operand 3 "immediate_operand" "X,R,X,X"))
3420 (clobber (match_scratch:P 4 "=X,X,X,&a"))]
3421 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
3423 [(set_attr "type" "cs")
3424 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3427 [(set (reg:CCU CC_REGNUM)
3428 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3429 (match_operand:BLK 1 "memory_operand" "")))
3430 (use (match_operand 2 "const_int_operand" ""))
3431 (use (match_operand 3 "immediate_operand" ""))
3432 (clobber (scratch))]
3435 [(set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3436 (use (match_dup 2))])]
3437 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
3440 [(set (reg:CCU CC_REGNUM)
3441 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3442 (match_operand:BLK 1 "memory_operand" "")))
3443 (use (match_operand 2 "register_operand" ""))
3444 (use (match_operand 3 "memory_operand" ""))
3445 (clobber (scratch))]
3448 [(unspec [(match_dup 2) (match_dup 3)
3449 (const_int 0)] UNSPEC_EXECUTE)
3450 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3451 (use (const_int 1))])]
3455 [(set (reg:CCU CC_REGNUM)
3456 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3457 (match_operand:BLK 1 "memory_operand" "")))
3458 (use (match_operand 2 "register_operand" ""))
3459 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3460 (clobber (scratch))]
3461 "TARGET_Z10 && reload_completed"
3463 [(unspec [(match_dup 2) (const_int 0)
3464 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3465 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3466 (use (const_int 1))])]
3467 "operands[4] = gen_label_rtx ();")
3470 [(set (reg:CCU CC_REGNUM)
3471 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3472 (match_operand:BLK 1 "memory_operand" "")))
3473 (use (match_operand 2 "register_operand" ""))
3474 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3475 (clobber (match_operand 3 "register_operand" ""))]
3476 "reload_completed && TARGET_CPU_ZARCH"
3477 [(set (match_dup 3) (label_ref (match_dup 4)))
3479 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
3480 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3481 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3482 (use (const_int 1))])]
3483 "operands[4] = gen_label_rtx ();")
3485 ; Compare a block of arbitrary length.
3487 (define_expand "cmpmem_long"
3489 [(clobber (match_dup 2))
3490 (clobber (match_dup 3))
3491 (set (reg:CCU CC_REGNUM)
3492 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3493 (match_operand:BLK 1 "memory_operand" "")))
3494 (use (match_operand 2 "general_operand" ""))
3495 (use (match_dup 3))])]
3498 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3499 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3500 rtx reg0 = gen_reg_rtx (dreg_mode);
3501 rtx reg1 = gen_reg_rtx (dreg_mode);
3502 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3503 rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1));
3504 rtx len0 = gen_lowpart (Pmode, reg0);
3505 rtx len1 = gen_lowpart (Pmode, reg1);
3507 emit_clobber (reg0);
3508 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3509 emit_move_insn (len0, operands[2]);
3511 emit_clobber (reg1);
3512 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
3513 emit_move_insn (len1, operands[2]);
3515 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3516 operands[1] = replace_equiv_address_nv (operands[1], addr1);
3521 (define_insn "*cmpmem_long"
3522 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3523 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
3524 (set (reg:CCU CC_REGNUM)
3525 (compare:CCU (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
3526 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0))))
3528 (use (match_dup 3))]
3529 "TARGET_64BIT || !TARGET_ZARCH"
3530 "clcle\t%0,%1,0\;jo\t.-4"
3531 [(set_attr "length" "8")
3532 (set_attr "type" "vs")])
3534 (define_insn "*cmpmem_long_31z"
3535 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3536 (clobber (match_operand:TI 1 "register_operand" "=d"))
3537 (set (reg:CCU CC_REGNUM)
3538 (compare:CCU (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4))
3539 (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4))))
3541 (use (match_dup 3))]
3542 "!TARGET_64BIT && TARGET_ZARCH"
3543 "clcle\t%0,%1,0\;jo\t.-4"
3544 [(set_attr "op_type" "NN")
3545 (set_attr "type" "vs")
3546 (set_attr "length" "8")])
3548 ; Convert CCUmode condition code to integer.
3549 ; Result is zero if EQ, positive if LTU, negative if GTU.
3551 (define_insn_and_split "cmpint"
3552 [(set (match_operand:SI 0 "register_operand" "=d")
3553 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3554 UNSPEC_STRCMPCC_TO_INT))
3555 (clobber (reg:CC CC_REGNUM))]
3559 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
3561 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))
3562 (clobber (reg:CC CC_REGNUM))])])
3564 (define_insn_and_split "*cmpint_cc"
3565 [(set (reg CC_REGNUM)
3566 (compare (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3567 UNSPEC_STRCMPCC_TO_INT)
3569 (set (match_operand:SI 0 "register_operand" "=d")
3570 (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT))]
3571 "s390_match_ccmode (insn, CCSmode)"
3573 "&& reload_completed"
3574 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
3576 [(set (match_dup 2) (match_dup 3))
3577 (set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))])]
3579 rtx result = gen_rtx_ASHIFTRT (SImode, operands[0], GEN_INT (30));
3580 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
3581 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
3584 (define_insn_and_split "*cmpint_sign"
3585 [(set (match_operand:DI 0 "register_operand" "=d")
3586 (sign_extend:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3587 UNSPEC_STRCMPCC_TO_INT)))
3588 (clobber (reg:CC CC_REGNUM))]
3591 "&& reload_completed"
3592 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
3594 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))
3595 (clobber (reg:CC CC_REGNUM))])])
3597 (define_insn_and_split "*cmpint_sign_cc"
3598 [(set (reg CC_REGNUM)
3599 (compare (ashiftrt:DI (ashift:DI (subreg:DI
3600 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3601 UNSPEC_STRCMPCC_TO_INT) 0)
3602 (const_int 32)) (const_int 32))
3604 (set (match_operand:DI 0 "register_operand" "=d")
3605 (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT)))]
3606 "s390_match_ccmode (insn, CCSmode) && TARGET_ZARCH"
3608 "&& reload_completed"
3609 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
3611 [(set (match_dup 2) (match_dup 3))
3612 (set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))])]
3614 rtx result = gen_rtx_ASHIFTRT (DImode, operands[0], GEN_INT (62));
3615 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
3616 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
3621 ;;- Conversion instructions.
3624 (define_insn "*sethighpartsi"
3625 [(set (match_operand:SI 0 "register_operand" "=d,d")
3626 (unspec:SI [(match_operand:BLK 1 "s_operand" "Q,S")
3627 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
3628 (clobber (reg:CC CC_REGNUM))]
3633 [(set_attr "op_type" "RS,RSY")
3634 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3636 (define_insn "*sethighpartdi_64"
3637 [(set (match_operand:DI 0 "register_operand" "=d")
3638 (unspec:DI [(match_operand:BLK 1 "s_operand" "QS")
3639 (match_operand 2 "const_int_operand" "n")] UNSPEC_ICM))
3640 (clobber (reg:CC CC_REGNUM))]
3643 [(set_attr "op_type" "RSY")
3644 (set_attr "z10prop" "z10_super")])
3646 (define_insn "*sethighpartdi_31"
3647 [(set (match_operand:DI 0 "register_operand" "=d,d")
3648 (unspec:DI [(match_operand:BLK 1 "s_operand" "Q,S")
3649 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
3650 (clobber (reg:CC CC_REGNUM))]
3655 [(set_attr "op_type" "RS,RSY")
3656 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3659 ; extv instruction patterns
3662 ; FIXME: This expander needs to be converted from DI to GPR as well
3663 ; after resolving some issues with it.
3665 (define_expand "extzv"
3667 [(set (match_operand:DI 0 "register_operand" "=d")
3669 (match_operand:DI 1 "register_operand" "d")
3670 (match_operand 2 "const_int_operand" "") ; size
3671 (match_operand 3 "const_int_operand" ""))) ; start
3672 (clobber (reg:CC CC_REGNUM))])]
3675 /* Starting with zEC12 there is risbgn not clobbering CC. */
3678 emit_move_insn (operands[0],
3679 gen_rtx_ZERO_EXTRACT (DImode,
3687 (define_insn "*extzv<mode>_zEC12"
3688 [(set (match_operand:GPR 0 "register_operand" "=d")
3690 (match_operand:GPR 1 "register_operand" "d")
3691 (match_operand 2 "const_int_operand" "") ; size
3692 (match_operand 3 "const_int_operand" "")))] ; start]
3694 "risbgn\t%0,%1,64-%2,128+63,<bitsize>+%3+%2" ; dst, src, start, end, shift
3695 [(set_attr "op_type" "RIE")])
3697 (define_insn "*extzv<mode>_z10"
3698 [(set (match_operand:GPR 0 "register_operand" "=d")
3700 (match_operand:GPR 1 "register_operand" "d")
3701 (match_operand 2 "const_int_operand" "") ; size
3702 (match_operand 3 "const_int_operand" ""))) ; start
3703 (clobber (reg:CC CC_REGNUM))]
3705 "risbg\t%0,%1,64-%2,128+63,<bitsize>+%3+%2" ; dst, src, start, end, shift
3706 [(set_attr "op_type" "RIE")
3707 (set_attr "z10prop" "z10_super_E1")])
3709 (define_insn_and_split "*pre_z10_extzv<mode>"
3710 [(set (match_operand:GPR 0 "register_operand" "=d")
3711 (zero_extract:GPR (match_operand:QI 1 "s_operand" "QS")
3712 (match_operand 2 "nonzero_shift_count_operand" "")
3714 (clobber (reg:CC CC_REGNUM))]
3717 "&& reload_completed"
3719 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
3720 (clobber (reg:CC CC_REGNUM))])
3721 (set (match_dup 0) (lshiftrt:GPR (match_dup 0) (match_dup 2)))]
3723 int bitsize = INTVAL (operands[2]);
3724 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
3725 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
3727 operands[1] = adjust_address (operands[1], BLKmode, 0);
3728 set_mem_size (operands[1], size);
3729 operands[2] = GEN_INT (<GPR:bitsize> - bitsize);
3730 operands[3] = GEN_INT (mask);
3733 (define_insn_and_split "*pre_z10_extv<mode>"
3734 [(set (match_operand:GPR 0 "register_operand" "=d")
3735 (sign_extract:GPR (match_operand:QI 1 "s_operand" "QS")
3736 (match_operand 2 "nonzero_shift_count_operand" "")
3738 (clobber (reg:CC CC_REGNUM))]
3741 "&& reload_completed"
3743 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
3744 (clobber (reg:CC CC_REGNUM))])
3746 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
3747 (clobber (reg:CC CC_REGNUM))])]
3749 int bitsize = INTVAL (operands[2]);
3750 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
3751 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
3753 operands[1] = adjust_address (operands[1], BLKmode, 0);
3754 set_mem_size (operands[1], size);
3755 operands[2] = GEN_INT (<GPR:bitsize> - bitsize);
3756 operands[3] = GEN_INT (mask);
3760 ; insv instruction patterns
3763 (define_expand "insv"
3764 [(set (zero_extract (match_operand 0 "nonimmediate_operand" "")
3765 (match_operand 1 "const_int_operand" "")
3766 (match_operand 2 "const_int_operand" ""))
3767 (match_operand 3 "general_operand" ""))]
3770 if (s390_expand_insv (operands[0], operands[1], operands[2], operands[3]))
3776 ; The normal RTL expansion will never generate a zero_extract where
3777 ; the location operand isn't word mode. However, we do this in the
3778 ; back-end when generating atomic operations. See s390_two_part_insv.
3779 (define_insn "*insv<mode>_zEC12"
3780 [(set (zero_extract:GPR (match_operand:GPR 0 "nonimmediate_operand" "+d")
3781 (match_operand 1 "const_int_operand" "I") ; size
3782 (match_operand 2 "const_int_operand" "I")) ; pos
3783 (match_operand:GPR 3 "nonimmediate_operand" "d"))]
3785 && (INTVAL (operands[1]) + INTVAL (operands[2])) <= <bitsize>"
3786 "risbgn\t%0,%3,64-<bitsize>+%2,64-<bitsize>+%2+%1-1,<bitsize>-%2-%1"
3787 [(set_attr "op_type" "RIE")])
3789 (define_insn "*insv<mode>_z10"
3790 [(set (zero_extract:GPR (match_operand:GPR 0 "nonimmediate_operand" "+d")
3791 (match_operand 1 "const_int_operand" "I") ; size
3792 (match_operand 2 "const_int_operand" "I")) ; pos
3793 (match_operand:GPR 3 "nonimmediate_operand" "d"))
3794 (clobber (reg:CC CC_REGNUM))]
3796 && (INTVAL (operands[1]) + INTVAL (operands[2])) <= <bitsize>"
3797 "risbg\t%0,%3,64-<bitsize>+%2,64-<bitsize>+%2+%1-1,<bitsize>-%2-%1"
3798 [(set_attr "op_type" "RIE")
3799 (set_attr "z10prop" "z10_super_E1")])
3801 ; and op1 with a mask being 1 for the selected bits and 0 for the rest
3802 ; and op3=op0 with a mask being 0 for the selected bits and 1 for the rest
3803 (define_insn "*insv<mode>_zEC12_noshift"
3804 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3805 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3806 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3807 (and:GPR (match_operand:GPR 3 "nonimmediate_operand" "0")
3808 (match_operand:GPR 4 "const_int_operand" ""))))]
3809 "TARGET_ZEC12 && INTVAL (operands[2]) == ~INTVAL (operands[4])"
3810 "risbgn\t%0,%1,%<bfstart>2,%<bfend>2,0"
3811 [(set_attr "op_type" "RIE")])
3813 (define_insn "*insv<mode>_z10_noshift"
3814 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3815 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3816 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3817 (and:GPR (match_operand:GPR 3 "nonimmediate_operand" "0")
3818 (match_operand:GPR 4 "const_int_operand" ""))))
3819 (clobber (reg:CC CC_REGNUM))]
3820 "TARGET_Z10 && INTVAL (operands[2]) == ~INTVAL (operands[4])"
3821 "risbg\t%0,%1,%<bfstart>2,%<bfend>2,0"
3822 [(set_attr "op_type" "RIE")
3823 (set_attr "z10prop" "z10_super_E1")])
3825 ; Implement appending Y on the left of S bits of X
3826 ; x = (y << s) | (x & ((1 << s) - 1))
3827 (define_insn "*insv<mode>_zEC12_appendbitsleft"
3828 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3829 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "0")
3830 (match_operand:GPR 2 "immediate_operand" ""))
3831 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "d")
3832 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))]
3833 "TARGET_ZEC12 && UINTVAL (operands[2]) == (1UL << UINTVAL (operands[4])) - 1"
3834 "risbgn\t%0,%3,64-<bitsize>,64-%4-1,%4"
3835 [(set_attr "op_type" "RIE")
3836 (set_attr "z10prop" "z10_super_E1")])
3838 (define_insn "*insv<mode>_z10_appendbitsleft"
3839 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3840 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "0")
3841 (match_operand:GPR 2 "immediate_operand" ""))
3842 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "d")
3843 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))
3844 (clobber (reg:CC CC_REGNUM))]
3845 "TARGET_Z10 && !TARGET_ZEC12 && UINTVAL (operands[2]) == (1UL << UINTVAL (operands[4])) - 1"
3846 "risbg\t%0,%3,64-<bitsize>,64-%4-1,%4"
3847 [(set_attr "op_type" "RIE")
3848 (set_attr "z10prop" "z10_super_E1")])
3850 ; z = (x << c) | (y >> d) with (x << c) and (y >> d) not overlapping after shifting
3851 ; -> z = y >> d; z = (x << c) | (z & ((1 << c) - 1))
3852 ; -> z = y >> d; z = risbg;
3855 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
3856 (ior:GPR (lshiftrt:GPR (match_operand:GPR 1 "nonimmediate_operand" "")
3857 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
3858 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "")
3859 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))]
3860 "TARGET_ZEC12 && UINTVAL (operands[2]) + UINTVAL (operands[4]) >= <bitsize>"
3862 (lshiftrt:GPR (match_dup 1) (match_dup 2)))
3864 (ior:GPR (and:GPR (match_dup 0) (match_dup 5))
3865 (ashift:GPR (match_dup 3) (match_dup 4))))]
3867 operands[5] = GEN_INT ((1UL << UINTVAL (operands[4])) - 1);
3872 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
3873 (ior:GPR (lshiftrt:GPR (match_operand:GPR 1 "nonimmediate_operand" "")
3874 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
3875 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "")
3876 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))
3877 (clobber (reg:CC CC_REGNUM))])]
3878 "TARGET_Z10 && !TARGET_ZEC12 && UINTVAL (operands[2]) + UINTVAL (operands[4]) >= <bitsize>"
3880 (lshiftrt:GPR (match_dup 1) (match_dup 2)))
3883 (ior:GPR (and:GPR (match_dup 0) (match_dup 5))
3884 (ashift:GPR (match_dup 3) (match_dup 4))))
3885 (clobber (reg:CC CC_REGNUM))])]
3887 operands[5] = GEN_INT ((1UL << UINTVAL (operands[4])) - 1);
3890 (define_insn "*r<noxa>sbg_<mode>_noshift"
3891 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3893 (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3894 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3895 (match_operand:GPR 3 "nonimmediate_operand" "0")))
3896 (clobber (reg:CC CC_REGNUM))]
3898 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,0"
3899 [(set_attr "op_type" "RIE")])
3901 (define_insn "*r<noxa>sbg_di_rotl"
3902 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
3906 (match_operand:DI 1 "nonimmediate_operand" "d")
3907 (match_operand:DI 3 "const_int_operand" ""))
3908 (match_operand:DI 2 "contiguous_bitmask_operand" ""))
3909 (match_operand:DI 4 "nonimmediate_operand" "0")))
3910 (clobber (reg:CC CC_REGNUM))]
3912 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%b3"
3913 [(set_attr "op_type" "RIE")])
3915 (define_insn "*r<noxa>sbg_<mode>_srl"
3916 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3920 (match_operand:GPR 1 "nonimmediate_operand" "d")
3921 (match_operand:GPR 3 "nonzero_shift_count_operand" ""))
3922 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3923 (match_operand:GPR 4 "nonimmediate_operand" "0")))
3924 (clobber (reg:CC CC_REGNUM))]
3926 && s390_extzv_shift_ok (<bitsize>, 64 - INTVAL (operands[3]),
3927 INTVAL (operands[2]))"
3928 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,64-%3"
3929 [(set_attr "op_type" "RIE")])
3931 (define_insn "*r<noxa>sbg_<mode>_sll"
3932 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3936 (match_operand:GPR 1 "nonimmediate_operand" "d")
3937 (match_operand:GPR 3 "nonzero_shift_count_operand" ""))
3938 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3939 (match_operand:GPR 4 "nonimmediate_operand" "0")))
3940 (clobber (reg:CC CC_REGNUM))]
3942 && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[3]),
3943 INTVAL (operands[2]))"
3944 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%3"
3945 [(set_attr "op_type" "RIE")])
3947 ;; These two are generated by combine for s.bf &= val.
3948 ;; ??? For bitfields smaller than 32-bits, we wind up with SImode
3949 ;; shifts and ands, which results in some truly awful patterns
3950 ;; including subregs of operations. Rather unnecessisarily, IMO.
3953 ;; (set (zero_extract:DI (reg/v:DI 50 [ s ])
3954 ;; (const_int 24 [0x18])
3955 ;; (const_int 0 [0]))
3956 ;; (subreg:DI (and:SI (subreg:SI (lshiftrt:DI (reg/v:DI 50 [ s ])
3957 ;; (const_int 40 [0x28])) 4)
3958 ;; (reg:SI 4 %r4 [ y+4 ])) 0))
3960 ;; we should instead generate
3962 ;; (set (zero_extract:DI (reg/v:DI 50 [ s ])
3963 ;; (const_int 24 [0x18])
3964 ;; (const_int 0 [0]))
3965 ;; (and:DI (lshiftrt:DI (reg/v:DI 50 [ s ])
3966 ;; (const_int 40 [0x28]))
3967 ;; (subreg:DI (reg:SI 4 %r4 [ y+4 ]) 0)))
3969 ;; by noticing that we can push down the outer paradoxical subreg
3970 ;; into the operation.
3972 (define_insn "*insv_rnsbg_noshift"
3973 [(set (zero_extract:DI
3974 (match_operand:DI 0 "nonimmediate_operand" "+d")
3975 (match_operand 1 "const_int_operand" "")
3976 (match_operand 2 "const_int_operand" ""))
3979 (match_operand:DI 3 "nonimmediate_operand" "d")))
3980 (clobber (reg:CC CC_REGNUM))]
3982 && INTVAL (operands[1]) + INTVAL (operands[2]) == 64"
3983 "rnsbg\t%0,%3,%2,63,0"
3984 [(set_attr "op_type" "RIE")])
3986 (define_insn "*insv_rnsbg_srl"
3987 [(set (zero_extract:DI
3988 (match_operand:DI 0 "nonimmediate_operand" "+d")
3989 (match_operand 1 "const_int_operand" "")
3990 (match_operand 2 "const_int_operand" ""))
3994 (match_operand 3 "const_int_operand" ""))
3995 (match_operand:DI 4 "nonimmediate_operand" "d")))
3996 (clobber (reg:CC CC_REGNUM))]
3998 && INTVAL (operands[3]) == 64 - INTVAL (operands[1]) - INTVAL (operands[2])"
3999 "rnsbg\t%0,%4,%2,%2+%1-1,%3"
4000 [(set_attr "op_type" "RIE")])
4002 (define_insn "*insv<mode>_mem_reg"
4003 [(set (zero_extract:W (match_operand:QI 0 "memory_operand" "+Q,S")
4004 (match_operand 1 "const_int_operand" "n,n")
4006 (match_operand:W 2 "register_operand" "d,d"))]
4007 "INTVAL (operands[1]) > 0
4008 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
4009 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
4011 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
4013 operands[1] = GEN_INT ((1ul << size) - 1);
4014 return (which_alternative == 0) ? "stcm\t%2,%1,%S0"
4015 : "stcmy\t%2,%1,%S0";
4017 [(set_attr "op_type" "RS,RSY")
4018 (set_attr "z10prop" "z10_super,z10_super")])
4020 (define_insn "*insvdi_mem_reghigh"
4021 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "+QS")
4022 (match_operand 1 "const_int_operand" "n")
4024 (lshiftrt:DI (match_operand:DI 2 "register_operand" "d")
4027 && INTVAL (operands[1]) > 0
4028 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
4029 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
4031 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
4033 operands[1] = GEN_INT ((1ul << size) - 1);
4034 return "stcmh\t%2,%1,%S0";
4036 [(set_attr "op_type" "RSY")
4037 (set_attr "z10prop" "z10_super")])
4039 (define_insn "*insvdi_reg_imm"
4040 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4042 (match_operand 1 "const_int_operand" "n"))
4043 (match_operand:DI 2 "const_int_operand" "n"))]
4045 && INTVAL (operands[1]) >= 0
4046 && INTVAL (operands[1]) < BITS_PER_WORD
4047 && INTVAL (operands[1]) % 16 == 0"
4049 switch (BITS_PER_WORD - INTVAL (operands[1]))
4051 case 64: return "iihh\t%0,%x2"; break;
4052 case 48: return "iihl\t%0,%x2"; break;
4053 case 32: return "iilh\t%0,%x2"; break;
4054 case 16: return "iill\t%0,%x2"; break;
4055 default: gcc_unreachable();
4058 [(set_attr "op_type" "RI")
4059 (set_attr "z10prop" "z10_super_E1")])
4061 ; Update the left-most 32 bit of a DI.
4062 (define_insn "*insv_h_di_reg_extimm"
4063 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4066 (match_operand:DI 1 "const_int_operand" "n"))]
4069 [(set_attr "op_type" "RIL")
4070 (set_attr "z10prop" "z10_fwd_E1")])
4072 ; Update the right-most 32 bit of a DI.
4073 (define_insn "*insv_l_di_reg_extimm"
4074 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4077 (match_operand:DI 1 "const_int_operand" "n"))]
4080 [(set_attr "op_type" "RIL")
4081 (set_attr "z10prop" "z10_fwd_A1")])
4084 ; extendsidi2 instruction pattern(s).
4087 (define_expand "extendsidi2"
4088 [(set (match_operand:DI 0 "register_operand" "")
4089 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
4094 emit_clobber (operands[0]);
4095 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
4096 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
4097 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
4102 (define_insn "*extendsidi2"
4103 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4104 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,RT,b")))]
4110 [(set_attr "op_type" "RRE,RXY,RIL")
4111 (set_attr "type" "*,*,larl")
4112 (set_attr "cpu_facility" "*,*,z10")
4113 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
4116 ; extend(hi|qi)(si|di)2 instruction pattern(s).
4119 (define_expand "extend<HQI:mode><DSI:mode>2"
4120 [(set (match_operand:DSI 0 "register_operand" "")
4121 (sign_extend:DSI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4124 if (<DSI:MODE>mode == DImode && !TARGET_ZARCH)
4126 rtx tmp = gen_reg_rtx (SImode);
4127 emit_insn (gen_extend<HQI:mode>si2 (tmp, operands[1]));
4128 emit_insn (gen_extendsidi2 (operands[0], tmp));
4131 else if (!TARGET_EXTIMM)
4133 rtx bitcount = GEN_INT (<DSI:bitsize> - <HQI:bitsize>);
4135 operands[1] = gen_lowpart (<DSI:MODE>mode, operands[1]);
4136 emit_insn (gen_ashl<DSI:mode>3 (operands[0], operands[1], bitcount));
4137 emit_insn (gen_ashr<DSI:mode>3 (operands[0], operands[0], bitcount));
4143 ; extendhidi2 instruction pattern(s).
4146 (define_insn "*extendhidi2_extimm"
4147 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4148 (sign_extend:DI (match_operand:HI 1 "general_operand" "d,RT,b")))]
4149 "TARGET_ZARCH && TARGET_EXTIMM"
4154 [(set_attr "op_type" "RRE,RXY,RIL")
4155 (set_attr "type" "*,*,larl")
4156 (set_attr "cpu_facility" "extimm,extimm,z10")
4157 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
4159 (define_insn "*extendhidi2"
4160 [(set (match_operand:DI 0 "register_operand" "=d")
4161 (sign_extend:DI (match_operand:HI 1 "memory_operand" "RT")))]
4164 [(set_attr "op_type" "RXY")
4165 (set_attr "z10prop" "z10_super_E1")])
4168 ; extendhisi2 instruction pattern(s).
4171 (define_insn "*extendhisi2_extimm"
4172 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4173 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" " d,R,T,b")))]
4180 [(set_attr "op_type" "RRE,RX,RXY,RIL")
4181 (set_attr "type" "*,*,*,larl")
4182 (set_attr "cpu_facility" "extimm,extimm,extimm,z10")
4183 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
4185 (define_insn "*extendhisi2"
4186 [(set (match_operand:SI 0 "register_operand" "=d,d")
4187 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
4192 [(set_attr "op_type" "RX,RXY")
4193 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4196 ; extendqi(si|di)2 instruction pattern(s).
4199 ; lbr, lgbr, lb, lgb
4200 (define_insn "*extendqi<mode>2_extimm"
4201 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4202 (sign_extend:GPR (match_operand:QI 1 "nonimmediate_operand" "d,RT")))]
4207 [(set_attr "op_type" "RRE,RXY")
4208 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4211 (define_insn "*extendqi<mode>2"
4212 [(set (match_operand:GPR 0 "register_operand" "=d")
4213 (sign_extend:GPR (match_operand:QI 1 "memory_operand" "RT")))]
4214 "!TARGET_EXTIMM && TARGET_LONG_DISPLACEMENT"
4216 [(set_attr "op_type" "RXY")
4217 (set_attr "z10prop" "z10_super_E1")])
4219 (define_insn_and_split "*extendqi<mode>2_short_displ"
4220 [(set (match_operand:GPR 0 "register_operand" "=d")
4221 (sign_extend:GPR (match_operand:QI 1 "s_operand" "Q")))
4222 (clobber (reg:CC CC_REGNUM))]
4223 "!TARGET_EXTIMM && !TARGET_LONG_DISPLACEMENT"
4225 "&& reload_completed"
4227 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (const_int 8)] UNSPEC_ICM))
4228 (clobber (reg:CC CC_REGNUM))])
4230 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
4231 (clobber (reg:CC CC_REGNUM))])]
4233 operands[1] = adjust_address (operands[1], BLKmode, 0);
4234 set_mem_size (operands[1], GET_MODE_SIZE (QImode));
4235 operands[2] = GEN_INT (<GPR:bitsize> - BITS_PER_UNIT);
4239 ; zero_extendsidi2 instruction pattern(s).
4242 (define_expand "zero_extendsidi2"
4243 [(set (match_operand:DI 0 "register_operand" "")
4244 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
4249 emit_clobber (operands[0]);
4250 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
4251 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
4256 (define_insn "*zero_extendsidi2"
4257 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4258 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,RT,b")))]
4264 [(set_attr "op_type" "RRE,RXY,RIL")
4265 (set_attr "type" "*,*,larl")
4266 (set_attr "cpu_facility" "*,*,z10")
4267 (set_attr "z10prop" "z10_fwd_E1,z10_fwd_A3,z10_fwd_A3")])
4270 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
4273 (define_insn "*llgt_sidi"
4274 [(set (match_operand:DI 0 "register_operand" "=d")
4275 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "RT") 0)
4276 (const_int 2147483647)))]
4279 [(set_attr "op_type" "RXE")
4280 (set_attr "z10prop" "z10_super_E1")])
4282 (define_insn_and_split "*llgt_sidi_split"
4283 [(set (match_operand:DI 0 "register_operand" "=d")
4284 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "RT") 0)
4285 (const_int 2147483647)))
4286 (clobber (reg:CC CC_REGNUM))]
4289 "&& reload_completed"
4291 (and:DI (subreg:DI (match_dup 1) 0)
4292 (const_int 2147483647)))]
4295 (define_insn "*llgt_sisi"
4296 [(set (match_operand:SI 0 "register_operand" "=d,d")
4297 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,RT")
4298 (const_int 2147483647)))]
4303 [(set_attr "op_type" "RRE,RXE")
4304 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4306 (define_insn "*llgt_didi"
4307 [(set (match_operand:DI 0 "register_operand" "=d,d")
4308 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
4309 (const_int 2147483647)))]
4314 [(set_attr "op_type" "RRE,RXE")
4315 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4318 [(set (match_operand:DSI 0 "register_operand" "")
4319 (and:DSI (match_operand:DSI 1 "nonimmediate_operand" "")
4320 (const_int 2147483647)))
4321 (clobber (reg:CC CC_REGNUM))]
4322 "TARGET_ZARCH && reload_completed"
4324 (and:DSI (match_dup 1)
4325 (const_int 2147483647)))]
4329 ; zero_extend(hi|qi)(si|di)2 instruction pattern(s).
4332 (define_expand "zero_extend<mode>di2"
4333 [(set (match_operand:DI 0 "register_operand" "")
4334 (zero_extend:DI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4339 rtx tmp = gen_reg_rtx (SImode);
4340 emit_insn (gen_zero_extend<mode>si2 (tmp, operands[1]));
4341 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
4344 else if (!TARGET_EXTIMM)
4346 rtx bitcount = GEN_INT (64 - <HQI:bitsize>);
4347 operands[1] = gen_lowpart (DImode, operands[1]);
4348 emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount));
4349 emit_insn (gen_lshrdi3 (operands[0], operands[0], bitcount));
4354 (define_expand "zero_extend<mode>si2"
4355 [(set (match_operand:SI 0 "register_operand" "")
4356 (zero_extend:SI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4361 operands[1] = gen_lowpart (SImode, operands[1]);
4362 emit_insn (gen_andsi3 (operands[0], operands[1],
4363 GEN_INT ((1 << <HQI:bitsize>) - 1)));
4369 (define_insn "*zero_extendhi<mode>2_z10"
4370 [(set (match_operand:GPR 0 "register_operand" "=d,d,d")
4371 (zero_extend:GPR (match_operand:HI 1 "nonimmediate_operand" "d,RT,b")))]
4377 [(set_attr "op_type" "RXY,RRE,RIL")
4378 (set_attr "type" "*,*,larl")
4379 (set_attr "cpu_facility" "*,*,z10")
4380 (set_attr "z10prop" "z10_super_E1,z10_fwd_A3,z10_fwd_A3")])
4382 ; llhr, llcr, llghr, llgcr, llh, llc, llgh, llgc
4383 (define_insn "*zero_extend<HQI:mode><GPR:mode>2_extimm"
4384 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4385 (zero_extend:GPR (match_operand:HQI 1 "nonimmediate_operand" "d,RT")))]
4390 [(set_attr "op_type" "RRE,RXY")
4391 (set_attr "z10prop" "z10_super_E1,z10_fwd_A3")])
4394 (define_insn "*zero_extend<HQI:mode><GPR:mode>2"
4395 [(set (match_operand:GPR 0 "register_operand" "=d")
4396 (zero_extend:GPR (match_operand:HQI 1 "memory_operand" "RT")))]
4397 "TARGET_ZARCH && !TARGET_EXTIMM"
4399 [(set_attr "op_type" "RXY")
4400 (set_attr "z10prop" "z10_fwd_A3")])
4402 (define_insn_and_split "*zero_extendhisi2_31"
4403 [(set (match_operand:SI 0 "register_operand" "=&d")
4404 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
4405 (clobber (reg:CC CC_REGNUM))]
4408 "&& reload_completed"
4409 [(set (match_dup 0) (const_int 0))
4411 [(set (strict_low_part (match_dup 2)) (match_dup 1))
4412 (clobber (reg:CC CC_REGNUM))])]
4413 "operands[2] = gen_lowpart (HImode, operands[0]);")
4415 (define_insn_and_split "*zero_extendqisi2_31"
4416 [(set (match_operand:SI 0 "register_operand" "=&d")
4417 (zero_extend:SI (match_operand:QI 1 "memory_operand" "RT")))]
4420 "&& reload_completed"
4421 [(set (match_dup 0) (const_int 0))
4422 (set (strict_low_part (match_dup 2)) (match_dup 1))]
4423 "operands[2] = gen_lowpart (QImode, operands[0]);")
4426 ; zero_extendqihi2 instruction pattern(s).
4429 (define_expand "zero_extendqihi2"
4430 [(set (match_operand:HI 0 "register_operand" "")
4431 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
4432 "TARGET_ZARCH && !TARGET_EXTIMM"
4434 operands[1] = gen_lowpart (HImode, operands[1]);
4435 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
4439 (define_insn "*zero_extendqihi2_64"
4440 [(set (match_operand:HI 0 "register_operand" "=d")
4441 (zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))]
4442 "TARGET_ZARCH && !TARGET_EXTIMM"
4444 [(set_attr "op_type" "RXY")
4445 (set_attr "z10prop" "z10_fwd_A3")])
4447 (define_insn_and_split "*zero_extendqihi2_31"
4448 [(set (match_operand:HI 0 "register_operand" "=&d")
4449 (zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))]
4452 "&& reload_completed"
4453 [(set (match_dup 0) (const_int 0))
4454 (set (strict_low_part (match_dup 2)) (match_dup 1))]
4455 "operands[2] = gen_lowpart (QImode, operands[0]);")
4458 ; fixuns_trunc(dd|td)di2 instruction pattern(s).
4461 (define_expand "fixuns_truncdddi2"
4463 [(set (match_operand:DI 0 "register_operand" "")
4464 (unsigned_fix:DI (match_operand:DD 1 "register_operand" "")))
4465 (unspec:DI [(const_int 5)] UNSPEC_ROUND)
4466 (clobber (reg:CC CC_REGNUM))])]
4472 rtx_code_label *label1 = gen_label_rtx ();
4473 rtx_code_label *label2 = gen_label_rtx ();
4474 rtx temp = gen_reg_rtx (TDmode);
4475 REAL_VALUE_TYPE cmp, sub;
4477 decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */
4478 decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
4480 /* 2^63 can't be represented as 64bit DFP number with full precision. The
4481 solution is doing the check and the subtraction in TD mode and using a
4482 TD -> DI convert afterwards. */
4483 emit_insn (gen_extendddtd2 (temp, operands[1]));
4484 temp = force_reg (TDmode, temp);
4485 emit_cmp_and_jump_insns (temp,
4486 const_double_from_real_value (cmp, TDmode),
4487 LT, NULL_RTX, VOIDmode, 0, label1);
4488 emit_insn (gen_subtd3 (temp, temp,
4489 const_double_from_real_value (sub, TDmode)));
4490 emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, GEN_INT (11)));
4493 emit_label (label1);
4494 emit_insn (gen_fix_truncdddi2_dfp (operands[0], operands[1], GEN_INT (9)));
4495 emit_label (label2);
4500 (define_expand "fixuns_trunctddi2"
4502 [(set (match_operand:DI 0 "register_operand" "")
4503 (unsigned_fix:DI (match_operand:TD 1 "register_operand" "")))
4504 (unspec:DI [(const_int 5)] UNSPEC_ROUND)
4505 (clobber (reg:CC CC_REGNUM))])]
4511 rtx_code_label *label1 = gen_label_rtx ();
4512 rtx_code_label *label2 = gen_label_rtx ();
4513 rtx temp = gen_reg_rtx (TDmode);
4514 REAL_VALUE_TYPE cmp, sub;
4516 operands[1] = force_reg (TDmode, operands[1]);
4517 decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */
4518 decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
4520 emit_cmp_and_jump_insns (operands[1],
4521 const_double_from_real_value (cmp, TDmode),
4522 LT, NULL_RTX, VOIDmode, 0, label1);
4523 emit_insn (gen_subtd3 (temp, operands[1],
4524 const_double_from_real_value (sub, TDmode)));
4525 emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, GEN_INT (11)));
4528 emit_label (label1);
4529 emit_insn (gen_fix_trunctddi2_dfp (operands[0], operands[1], GEN_INT (9)));
4530 emit_label (label2);
4536 ; fixuns_trunc(sf|df|tf)(si|di)2 and fix_trunc(sf|df|tf)(si|di)2
4537 ; instruction pattern(s).
4540 (define_expand "fixuns_trunc<BFP:mode><GPR:mode>2"
4542 [(set (match_operand:GPR 0 "register_operand" "")
4543 (unsigned_fix:GPR (match_operand:BFP 1 "register_operand" "")))
4544 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
4545 (clobber (reg:CC CC_REGNUM))])]
4550 rtx_code_label *label1 = gen_label_rtx ();
4551 rtx_code_label *label2 = gen_label_rtx ();
4552 rtx temp = gen_reg_rtx (<BFP:MODE>mode);
4553 REAL_VALUE_TYPE cmp, sub;
4555 operands[1] = force_reg (<BFP:MODE>mode, operands[1]);
4556 real_2expN (&cmp, <GPR:bitsize> - 1, <BFP:MODE>mode);
4557 real_2expN (&sub, <GPR:bitsize>, <BFP:MODE>mode);
4559 emit_cmp_and_jump_insns (operands[1],
4560 const_double_from_real_value (cmp, <BFP:MODE>mode),
4561 LT, NULL_RTX, VOIDmode, 0, label1);
4562 emit_insn (gen_sub<BFP:mode>3 (temp, operands[1],
4563 const_double_from_real_value (sub, <BFP:MODE>mode)));
4564 emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0], temp,
4568 emit_label (label1);
4569 emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0],
4570 operands[1], GEN_INT (5)));
4571 emit_label (label2);
4576 ; fixuns_trunc(td|dd)si2 expander
4577 (define_expand "fixuns_trunc<mode>si2"
4579 [(set (match_operand:SI 0 "register_operand" "")
4580 (unsigned_fix:SI (match_operand:DFP 1 "register_operand" "")))
4581 (unspec:SI [(const_int 5)] UNSPEC_ROUND)
4582 (clobber (reg:CC CC_REGNUM))])]
4583 "TARGET_Z196 && TARGET_HARD_DFP"
4586 ; fixuns_trunc(tf|df|sf|td|dd)(di|si)2 instruction patterns.
4588 (define_insn "*fixuns_truncdfdi2_z13"
4589 [(set (match_operand:DI 0 "register_operand" "=d,v")
4590 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "f,v")))
4591 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND)
4592 (clobber (reg:CC CC_REGNUM))]
4593 "TARGET_Z13 && TARGET_HARD_FLOAT"
4596 wclgdb\t%v0,%v1,0,%h2"
4597 [(set_attr "op_type" "RRF,VRR")
4598 (set_attr "type" "ftoi")])
4600 ; clfebr, clfdbr, clfxbr, clgebr, clgdbr, clgxbr
4601 ; clfdtr, clfxtr, clgdtr, clgxtr
4602 (define_insn "*fixuns_trunc<FP:mode><GPR:mode>2_z196"
4603 [(set (match_operand:GPR 0 "register_operand" "=d")
4604 (unsigned_fix:GPR (match_operand:FP 1 "register_operand" "f")))
4605 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4606 (clobber (reg:CC CC_REGNUM))]
4607 "TARGET_Z196 && TARGET_HARD_FLOAT
4608 && (!TARGET_Z13 || <GPR:MODE>mode != DImode || <FP:MODE>mode != DFmode)"
4609 "cl<GPR:gf><FP:xde><FP:bt>r\t%0,%h2,%1,0"
4610 [(set_attr "op_type" "RRF")
4611 (set_attr "type" "ftoi")])
4613 (define_expand "fix_trunc<DSF:mode><GPR:mode>2"
4614 [(set (match_operand:GPR 0 "register_operand" "")
4615 (fix:GPR (match_operand:DSF 1 "register_operand" "")))]
4618 emit_insn (gen_fix_trunc<DSF:mode><GPR:mode>2_bfp (operands[0], operands[1],
4623 (define_insn "*fix_truncdfdi2_bfp_z13"
4624 [(set (match_operand:DI 0 "register_operand" "=d,v")
4625 (fix:DI (match_operand:DF 1 "register_operand" "f,v")))
4626 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND)
4627 (clobber (reg:CC CC_REGNUM))]
4628 "TARGET_Z13 && TARGET_HARD_FLOAT"
4631 wcgdb\t%v0,%v1,0,%h2"
4632 [(set_attr "op_type" "RRE,VRR")
4633 (set_attr "type" "ftoi")])
4635 ; cgxbr, cgdbr, cgebr, cfxbr, cfdbr, cfebr
4636 (define_insn "*fix_trunc<BFP:mode><GPR:mode>2_bfp"
4637 [(set (match_operand:GPR 0 "register_operand" "=d")
4638 (fix:GPR (match_operand:BFP 1 "register_operand" "f")))
4639 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4640 (clobber (reg:CC CC_REGNUM))]
4642 && (!TARGET_VX || <GPR:MODE>mode != DImode || <BFP:MODE>mode != DFmode)"
4643 "c<GPR:gf><BFP:xde>br\t%0,%h2,%1"
4644 [(set_attr "op_type" "RRE")
4645 (set_attr "type" "ftoi")])
4647 (define_expand "fix_trunc<BFP:mode><GPR:mode>2_bfp"
4649 [(set (match_operand:GPR 0 "register_operand" "=d")
4650 (fix:GPR (match_operand:BFP 1 "register_operand" "f")))
4651 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4652 (clobber (reg:CC CC_REGNUM))])]
4653 "TARGET_HARD_FLOAT")
4655 ; fix_trunc(td|dd)di2 instruction pattern(s).
4658 (define_expand "fix_trunc<mode>di2"
4659 [(set (match_operand:DI 0 "register_operand" "")
4660 (fix:DI (match_operand:DFP 1 "nonimmediate_operand" "")))]
4661 "TARGET_ZARCH && TARGET_HARD_DFP"
4663 operands[1] = force_reg (<MODE>mode, operands[1]);
4664 emit_insn (gen_fix_trunc<mode>di2_dfp (operands[0], operands[1],
4670 (define_insn "fix_trunc<DFP:mode>di2_dfp"
4671 [(set (match_operand:DI 0 "register_operand" "=d")
4672 (fix:DI (match_operand:DFP 1 "register_operand" "f")))
4673 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
4674 (clobber (reg:CC CC_REGNUM))]
4675 "TARGET_ZARCH && TARGET_HARD_DFP"
4676 "cg<DFP:xde>tr\t%0,%h2,%1"
4677 [(set_attr "op_type" "RRF")
4678 (set_attr "type" "ftoidfp")])
4682 ; fix_trunctf(si|di)2 instruction pattern(s).
4685 (define_expand "fix_trunctf<mode>2"
4686 [(parallel [(set (match_operand:GPR 0 "register_operand" "")
4687 (fix:GPR (match_operand:TF 1 "register_operand" "")))
4688 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
4689 (clobber (reg:CC CC_REGNUM))])]
4695 ; float(si|di)(tf|df|sf|td|dd)2 instruction pattern(s).
4698 ; cxgbr, cdgbr, cegbr, cxgtr, cdgtr
4699 (define_insn "floatdi<mode>2"
4700 [(set (match_operand:FP 0 "register_operand" "=f,<vf>")
4701 (float:FP (match_operand:DI 1 "register_operand" "d,<vd>")))]
4702 "TARGET_ZARCH && TARGET_HARD_FLOAT"
4706 [(set_attr "op_type" "RRE,VRR")
4707 (set_attr "type" "itof<mode>" )
4708 (set_attr "cpu_facility" "*,vec")])
4710 ; cxfbr, cdfbr, cefbr
4711 (define_insn "floatsi<mode>2"
4712 [(set (match_operand:BFP 0 "register_operand" "=f")
4713 (float:BFP (match_operand:SI 1 "register_operand" "d")))]
4716 [(set_attr "op_type" "RRE")
4717 (set_attr "type" "itof<mode>" )])
4720 (define_insn "floatsi<mode>2"
4721 [(set (match_operand:DFP 0 "register_operand" "=f")
4722 (float:DFP (match_operand:SI 1 "register_operand" "d")))]
4723 "TARGET_Z196 && TARGET_HARD_FLOAT"
4724 "c<xde>ftr\t%0,0,%1,0"
4725 [(set_attr "op_type" "RRE")
4726 (set_attr "type" "itof<mode>" )])
4729 ; floatuns(si|di)(tf|df|sf|td|dd)2 instruction pattern(s).
4732 (define_insn "*floatunsdidf2_z13"
4733 [(set (match_operand:DF 0 "register_operand" "=f,v")
4734 (unsigned_float:DF (match_operand:DI 1 "register_operand" "d,v")))]
4735 "TARGET_Z13 && TARGET_HARD_FLOAT"
4738 wcdlgb\t%v0,%v1,0,0"
4739 [(set_attr "op_type" "RRE,VRR")
4740 (set_attr "type" "itofdf")])
4742 ; cxlgbr, cdlgbr, celgbr, cxlgtr, cdlgtr
4743 ; cxlfbr, cdlfbr, celfbr, cxlftr, cdlftr
4744 (define_insn "*floatuns<GPR:mode><FP:mode>2"
4745 [(set (match_operand:FP 0 "register_operand" "=f")
4746 (unsigned_float:FP (match_operand:GPR 1 "register_operand" "d")))]
4747 "TARGET_Z196 && TARGET_HARD_FLOAT
4748 && (!TARGET_VX || <FP:MODE>mode != DFmode || <GPR:MODE>mode != DImode)"
4749 "c<FP:xde>l<GPR:gf><FP:bt>r\t%0,0,%1,0"
4750 [(set_attr "op_type" "RRE")
4751 (set_attr "type" "itof<FP:mode>")])
4753 (define_expand "floatuns<GPR:mode><FP:mode>2"
4754 [(set (match_operand:FP 0 "register_operand" "")
4755 (unsigned_float:FP (match_operand:GPR 1 "register_operand" "")))]
4756 "TARGET_Z196 && TARGET_HARD_FLOAT")
4759 ; truncdfsf2 instruction pattern(s).
4762 (define_insn "truncdfsf2"
4763 [(set (match_operand:SF 0 "register_operand" "=f,v")
4764 (float_truncate:SF (match_operand:DF 1 "register_operand" "f,v")))]
4768 wledb\t%v0,%v1,0,0" ; IEEE inexact exception not suppressed
4769 ; According to BFP rounding mode
4770 [(set_attr "op_type" "RRE,VRR")
4771 (set_attr "type" "ftruncdf")
4772 (set_attr "cpu_facility" "*,vec")])
4775 ; trunctf(df|sf)2 instruction pattern(s).
4779 (define_insn "trunctf<mode>2"
4780 [(set (match_operand:DSF 0 "register_operand" "=f")
4781 (float_truncate:DSF (match_operand:TF 1 "register_operand" "f")))
4782 (clobber (match_scratch:TF 2 "=f"))]
4784 "l<xde>xbr\t%2,%1\;l<xde>r\t%0,%2"
4785 [(set_attr "length" "6")
4786 (set_attr "type" "ftrunctf")])
4789 ; trunctddd2 and truncddsd2 instruction pattern(s).
4792 (define_insn "trunctddd2"
4793 [(set (match_operand:DD 0 "register_operand" "=f")
4794 (float_truncate:DD (match_operand:TD 1 "register_operand" "f")))
4795 (clobber (match_scratch:TD 2 "=f"))]
4797 "ldxtr\t%2,0,%1,0\;ldr\t%0,%2"
4798 [(set_attr "length" "6")
4799 (set_attr "type" "ftruncdd")])
4801 (define_insn "truncddsd2"
4802 [(set (match_operand:SD 0 "register_operand" "=f")
4803 (float_truncate:SD (match_operand:DD 1 "register_operand" "f")))]
4806 [(set_attr "op_type" "RRF")
4807 (set_attr "type" "ftruncsd")])
4809 (define_expand "trunctdsd2"
4812 (float_truncate:DD (match_operand:TD 1 "register_operand" "")))
4813 (clobber (match_scratch:TD 2 ""))])
4814 (set (match_operand:SD 0 "register_operand" "")
4815 (float_truncate:SD (match_dup 3)))]
4818 operands[3] = gen_reg_rtx (DDmode);
4822 ; extend(sf|df)(df|tf)2 instruction pattern(s).
4825 (define_insn "*extendsfdf2_z13"
4826 [(set (match_operand:DF 0 "register_operand" "=f,f,v")
4827 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R,v")))]
4828 "TARGET_Z13 && TARGET_HARD_FLOAT"
4833 [(set_attr "op_type" "RRE,RXE,VRR")
4834 (set_attr "type" "fsimpdf, floaddf,fsimpdf")])
4836 ; ldebr, ldeb, lxdbr, lxdb, lxebr, lxeb
4837 (define_insn "*extend<DSF:mode><BFP:mode>2"
4838 [(set (match_operand:BFP 0 "register_operand" "=f,f")
4839 (float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "f,R")))]
4841 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DSF:MODE>mode)
4842 && (!TARGET_VX || <BFP:MODE>mode != DFmode || <DSF:MODE>mode != SFmode)"
4844 l<BFP:xde><DSF:xde>br\t%0,%1
4845 l<BFP:xde><DSF:xde>b\t%0,%1"
4846 [(set_attr "op_type" "RRE,RXE")
4847 (set_attr "type" "fsimp<BFP:mode>, fload<BFP:mode>")])
4849 (define_expand "extend<DSF:mode><BFP:mode>2"
4850 [(set (match_operand:BFP 0 "register_operand" "")
4851 (float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "")))]
4853 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DSF:MODE>mode)")
4856 ; extendddtd2 and extendsddd2 instruction pattern(s).
4859 (define_insn "extendddtd2"
4860 [(set (match_operand:TD 0 "register_operand" "=f")
4861 (float_extend:TD (match_operand:DD 1 "register_operand" "f")))]
4864 [(set_attr "op_type" "RRF")
4865 (set_attr "type" "fsimptf")])
4867 (define_insn "extendsddd2"
4868 [(set (match_operand:DD 0 "register_operand" "=f")
4869 (float_extend:DD (match_operand:SD 1 "register_operand" "f")))]
4872 [(set_attr "op_type" "RRF")
4873 (set_attr "type" "fsimptf")])
4875 (define_expand "extendsdtd2"
4877 (float_extend:DD (match_operand:SD 1 "register_operand" "")))
4878 (set (match_operand:TD 0 "register_operand" "")
4879 (float_extend:TD (match_dup 2)))]
4882 operands[2] = gen_reg_rtx (DDmode);
4885 ; Binary Floating Point - load fp integer
4887 ; Expanders for: floor, btrunc, round, ceil, and nearbyint
4888 ; For all of them the inexact exceptions are suppressed.
4890 ; fiebra, fidbra, fixbra
4891 (define_insn "<FPINT:fpint_name><BFP:mode>2"
4892 [(set (match_operand:BFP 0 "register_operand" "=f")
4893 (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
4896 "fi<BFP:xde>bra\t%0,<FPINT:fpint_roundingmode>,%1,4"
4897 [(set_attr "op_type" "RRF")
4898 (set_attr "type" "fsimp<BFP:mode>")])
4900 ; rint is supposed to raise an inexact exception so we can use the
4901 ; older instructions.
4903 ; fiebr, fidbr, fixbr
4904 (define_insn "rint<BFP:mode>2"
4905 [(set (match_operand:BFP 0 "register_operand" "=f")
4906 (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
4907 UNSPEC_FPINT_RINT))]
4909 "fi<BFP:xde>br\t%0,0,%1"
4910 [(set_attr "op_type" "RRF")
4911 (set_attr "type" "fsimp<BFP:mode>")])
4914 ; Decimal Floating Point - load fp integer
4917 (define_insn "<FPINT:fpint_name><DFP:mode>2"
4918 [(set (match_operand:DFP 0 "register_operand" "=f")
4919 (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")]
4922 "fi<DFP:xde>tr\t%0,<FPINT:fpint_roundingmode>,%1,4"
4923 [(set_attr "op_type" "RRF")
4924 (set_attr "type" "fsimp<DFP:mode>")])
4927 (define_insn "rint<DFP:mode>2"
4928 [(set (match_operand:DFP 0 "register_operand" "=f")
4929 (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")]
4930 UNSPEC_FPINT_RINT))]
4932 "fi<DFP:xde>tr\t%0,0,%1,0"
4933 [(set_attr "op_type" "RRF")
4934 (set_attr "type" "fsimp<DFP:mode>")])
4937 ; Binary <-> Decimal floating point trunc patterns
4940 (define_insn "*trunc<BFP:mode><DFP_ALL:mode>2"
4941 [(set (reg:DFP_ALL FPR0_REGNUM)
4942 (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM)))
4943 (use (reg:SI GPR0_REGNUM))
4944 (clobber (reg:CC CC_REGNUM))
4945 (clobber (reg:SI GPR1_REGNUM))]
4949 (define_insn "*trunc<DFP_ALL:mode><BFP:mode>2"
4950 [(set (reg:BFP FPR0_REGNUM)
4951 (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM)))
4952 (use (reg:SI GPR0_REGNUM))
4953 (clobber (reg:CC CC_REGNUM))
4954 (clobber (reg:SI GPR1_REGNUM))]
4958 (define_expand "trunc<BFP:mode><DFP_ALL:mode>2"
4959 [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
4960 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4962 [(set (reg:DFP_ALL FPR0_REGNUM)
4963 (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM)))
4964 (use (reg:SI GPR0_REGNUM))
4965 (clobber (reg:CC CC_REGNUM))
4966 (clobber (reg:SI GPR1_REGNUM))])
4967 (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "")
4968 (reg:DFP_ALL FPR0_REGNUM))]
4970 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DFP_ALL:MODE>mode)"
4972 HOST_WIDE_INT flags;
4974 flags = (PFPO_CONVERT |
4975 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT |
4976 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT);
4978 operands[2] = GEN_INT (flags);
4981 (define_expand "trunc<DFP_ALL:mode><BFP:mode>2"
4982 [(set (reg:DFP_ALL FPR4_REGNUM)
4983 (match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
4984 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4986 [(set (reg:BFP FPR0_REGNUM) (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM)))
4987 (use (reg:SI GPR0_REGNUM))
4988 (clobber (reg:CC CC_REGNUM))
4989 (clobber (reg:SI GPR1_REGNUM))])
4990 (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))]
4992 && GET_MODE_SIZE (<DFP_ALL:MODE>mode) >= GET_MODE_SIZE (<BFP:MODE>mode)"
4994 HOST_WIDE_INT flags;
4996 flags = (PFPO_CONVERT |
4997 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT |
4998 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT);
5000 operands[2] = GEN_INT (flags);
5004 ; Binary <-> Decimal floating point extend patterns
5007 (define_insn "*extend<BFP:mode><DFP_ALL:mode>2"
5008 [(set (reg:DFP_ALL FPR0_REGNUM) (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM)))
5009 (use (reg:SI GPR0_REGNUM))
5010 (clobber (reg:CC CC_REGNUM))
5011 (clobber (reg:SI GPR1_REGNUM))]
5015 (define_insn "*extend<DFP_ALL:mode><BFP:mode>2"
5016 [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM)))
5017 (use (reg:SI GPR0_REGNUM))
5018 (clobber (reg:CC CC_REGNUM))
5019 (clobber (reg:SI GPR1_REGNUM))]
5023 (define_expand "extend<BFP:mode><DFP_ALL:mode>2"
5024 [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
5025 (set (reg:SI GPR0_REGNUM) (match_dup 2))
5027 [(set (reg:DFP_ALL FPR0_REGNUM)
5028 (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM)))
5029 (use (reg:SI GPR0_REGNUM))
5030 (clobber (reg:CC CC_REGNUM))
5031 (clobber (reg:SI GPR1_REGNUM))])
5032 (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "")
5033 (reg:DFP_ALL FPR0_REGNUM))]
5035 && GET_MODE_SIZE (<BFP:MODE>mode) <= GET_MODE_SIZE (<DFP_ALL:MODE>mode)"
5037 HOST_WIDE_INT flags;
5039 flags = (PFPO_CONVERT |
5040 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT |
5041 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT);
5043 operands[2] = GEN_INT (flags);
5046 (define_expand "extend<DFP_ALL:mode><BFP:mode>2"
5047 [(set (reg:DFP_ALL FPR4_REGNUM)
5048 (match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
5049 (set (reg:SI GPR0_REGNUM) (match_dup 2))
5051 [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM)))
5052 (use (reg:SI GPR0_REGNUM))
5053 (clobber (reg:CC CC_REGNUM))
5054 (clobber (reg:SI GPR1_REGNUM))])
5055 (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))]
5057 && GET_MODE_SIZE (<DFP_ALL:MODE>mode) < GET_MODE_SIZE (<BFP:MODE>mode)"
5059 HOST_WIDE_INT flags;
5061 flags = (PFPO_CONVERT |
5062 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT |
5063 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT);
5065 operands[2] = GEN_INT (flags);
5070 ;; ARITHMETIC OPERATIONS
5072 ; arithmetic operations set the ConditionCode,
5073 ; because of unpredictable Bits in Register for Halfword and Byte
5074 ; the ConditionCode can be set wrong in operations for Halfword and Byte
5077 ;;- Add instructions.
5081 ; addti3 instruction pattern(s).
5084 (define_expand "addti3"
5086 [(set (match_operand:TI 0 "register_operand" "")
5087 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "")
5088 (match_operand:TI 2 "general_operand" "") ) )
5089 (clobber (reg:CC CC_REGNUM))])]
5092 /* For z13 we have vaq which doesn't set CC. */
5095 emit_insn (gen_rtx_SET (operands[0],
5096 gen_rtx_PLUS (TImode,
5097 copy_to_mode_reg (TImode, operands[1]),
5098 copy_to_mode_reg (TImode, operands[2]))));
5103 (define_insn_and_split "*addti3"
5104 [(set (match_operand:TI 0 "register_operand" "=&d")
5105 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
5106 (match_operand:TI 2 "general_operand" "do") ) )
5107 (clobber (reg:CC CC_REGNUM))]
5110 "&& reload_completed"
5112 [(set (reg:CCL1 CC_REGNUM)
5113 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
5115 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
5117 [(set (match_dup 3) (plus:DI
5118 (plus:DI (ltu:DI (reg:CCL1 CC_REGNUM) (const_int 0))
5119 (match_dup 4)) (match_dup 5)))
5120 (clobber (reg:CC CC_REGNUM))])]
5121 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
5122 operands[4] = operand_subword (operands[1], 0, 0, TImode);
5123 operands[5] = operand_subword (operands[2], 0, 0, TImode);
5124 operands[6] = operand_subword (operands[0], 1, 0, TImode);
5125 operands[7] = operand_subword (operands[1], 1, 0, TImode);
5126 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
5127 [(set_attr "op_type" "*")
5128 (set_attr "cpu_facility" "*")])
5131 ; adddi3 instruction pattern(s).
5134 (define_expand "adddi3"
5136 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5137 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
5138 (match_operand:DI 2 "general_operand" "")))
5139 (clobber (reg:CC CC_REGNUM))])]
5143 (define_insn "*adddi3_sign"
5144 [(set (match_operand:DI 0 "register_operand" "=d,d")
5145 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5146 (match_operand:DI 1 "register_operand" "0,0")))
5147 (clobber (reg:CC CC_REGNUM))]
5152 [(set_attr "op_type" "RRE,RXY")
5153 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5155 (define_insn "*adddi3_zero_cc"
5156 [(set (reg CC_REGNUM)
5157 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5158 (match_operand:DI 1 "register_operand" "0,0"))
5160 (set (match_operand:DI 0 "register_operand" "=d,d")
5161 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
5162 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5166 [(set_attr "op_type" "RRE,RXY")
5167 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5169 (define_insn "*adddi3_zero_cconly"
5170 [(set (reg CC_REGNUM)
5171 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5172 (match_operand:DI 1 "register_operand" "0,0"))
5174 (clobber (match_scratch:DI 0 "=d,d"))]
5175 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5179 [(set_attr "op_type" "RRE,RXY")
5180 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5182 (define_insn "*adddi3_zero"
5183 [(set (match_operand:DI 0 "register_operand" "=d,d")
5184 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5185 (match_operand:DI 1 "register_operand" "0,0")))
5186 (clobber (reg:CC CC_REGNUM))]
5191 [(set_attr "op_type" "RRE,RXY")
5192 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5194 (define_insn_and_split "*adddi3_31z"
5195 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
5196 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5197 (match_operand:DI 2 "general_operand" "do") ) )
5198 (clobber (reg:CC CC_REGNUM))]
5199 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
5201 "&& reload_completed"
5203 [(set (reg:CCL1 CC_REGNUM)
5204 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
5206 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
5208 [(set (match_dup 3) (plus:SI
5209 (plus:SI (ltu:SI (reg:CCL1 CC_REGNUM) (const_int 0))
5210 (match_dup 4)) (match_dup 5)))
5211 (clobber (reg:CC CC_REGNUM))])]
5212 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5213 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5214 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5215 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5216 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5217 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
5219 (define_insn_and_split "*adddi3_31"
5220 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
5221 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5222 (match_operand:DI 2 "general_operand" "do") ) )
5223 (clobber (reg:CC CC_REGNUM))]
5226 "&& reload_completed"
5228 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
5229 (clobber (reg:CC CC_REGNUM))])
5231 [(set (reg:CCL1 CC_REGNUM)
5232 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
5234 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
5236 (if_then_else (ltu (reg:CCL1 CC_REGNUM) (const_int 0))
5238 (label_ref (match_dup 9))))
5240 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
5241 (clobber (reg:CC CC_REGNUM))])
5243 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5244 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5245 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5246 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5247 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5248 operands[8] = operand_subword (operands[2], 1, 0, DImode);
5249 operands[9] = gen_label_rtx ();")
5252 ; addsi3 instruction pattern(s).
5255 (define_expand "addsi3"
5257 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5258 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "")
5259 (match_operand:SI 2 "general_operand" "")))
5260 (clobber (reg:CC CC_REGNUM))])]
5264 (define_insn "*addsi3_sign"
5265 [(set (match_operand:SI 0 "register_operand" "=d,d")
5266 (plus:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
5267 (match_operand:SI 1 "register_operand" "0,0")))
5268 (clobber (reg:CC CC_REGNUM))]
5273 [(set_attr "op_type" "RX,RXY")
5274 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5277 ; add(di|si)3 instruction pattern(s).
5280 ; ark, agrk, ar, ahi, ahik, aghik, alfi, slfi, a, ay, agr, aghi, algfi, slgfi, ag, asi, agsi
5281 (define_insn "*add<mode>3"
5282 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d,d,d, d, d,d,d,QS")
5283 (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,d, 0, 0,0,0, 0")
5284 (match_operand:GPR 2 "general_operand" " d,d,K,K,Op,On,R,T, C") ) )
5285 (clobber (reg:CC CC_REGNUM))]
5297 [(set_attr "op_type" "RR<E>,RRF,RI,RIE,RIL,RIL,RX<Y>,RXY,SIY")
5298 (set_attr "cpu_facility" "*,z196,*,z196,extimm,extimm,*,*,z10")
5299 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,z10_super_E1,z10_super_E1,
5300 z10_super_E1,z10_super_E1,z10_super_E1")])
5302 ; alr, alfi, slfi, al, aly, alrk, alhsik, algr, algfi, slgfi, alg, alsi, algsi, algrk, alghsik
5303 (define_insn "*add<mode>3_carry1_cc"
5304 [(set (reg CC_REGNUM)
5305 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0,0")
5306 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T,C"))
5308 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,d")
5309 (plus:GPR (match_dup 1) (match_dup 2)))]
5310 "s390_match_ccmode (insn, CCL1mode)"
5316 al<g>hsik\t%0,%1,%h2
5320 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5321 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5322 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*,
5323 z10_super_E1,z10_super_E1,z10_super_E1")])
5325 ; alr, al, aly, algr, alg, alrk, algrk
5326 (define_insn "*add<mode>3_carry1_cconly"
5327 [(set (reg CC_REGNUM)
5328 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5329 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5331 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5332 "s390_match_ccmode (insn, CCL1mode)"
5338 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5339 (set_attr "cpu_facility" "*,z196,*,*")
5340 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5342 ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik
5343 (define_insn "*add<mode>3_carry2_cc"
5344 [(set (reg CC_REGNUM)
5345 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0, 0")
5346 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T, C"))
5348 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,RS")
5349 (plus:GPR (match_dup 1) (match_dup 2)))]
5350 "s390_match_ccmode (insn, CCL1mode)"
5356 al<g>hsik\t%0,%1,%h2
5360 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5361 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5362 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*,
5363 z10_super_E1,z10_super_E1,z10_super_E1")])
5365 ; alr, al, aly, algr, alg, alrk, algrk
5366 (define_insn "*add<mode>3_carry2_cconly"
5367 [(set (reg CC_REGNUM)
5368 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5369 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5371 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5372 "s390_match_ccmode (insn, CCL1mode)"
5378 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5379 (set_attr "cpu_facility" "*,z196,*,*")
5380 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5382 ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik
5383 (define_insn "*add<mode>3_cc"
5384 [(set (reg CC_REGNUM)
5385 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0, 0")
5386 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T, C"))
5388 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,RS")
5389 (plus:GPR (match_dup 1) (match_dup 2)))]
5390 "s390_match_ccmode (insn, CCLmode)"
5396 al<g>hsik\t%0,%1,%h2
5400 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5401 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5402 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,
5403 *,z10_super_E1,z10_super_E1,z10_super_E1")])
5405 ; alr, al, aly, algr, alg, alrk, algrk
5406 (define_insn "*add<mode>3_cconly"
5407 [(set (reg CC_REGNUM)
5408 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5409 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5411 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5412 "s390_match_ccmode (insn, CCLmode)"
5418 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5419 (set_attr "cpu_facility" "*,z196,*,*")
5420 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5422 ; alr, al, aly, algr, alg, alrk, algrk
5423 (define_insn "*add<mode>3_cconly2"
5424 [(set (reg CC_REGNUM)
5425 (compare (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5426 (neg:GPR (match_operand:GPR 2 "general_operand" "d,d,R,T"))))
5427 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5428 "s390_match_ccmode(insn, CCLmode)"
5434 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5435 (set_attr "cpu_facility" "*,z196,*,*")
5436 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5438 ; ahi, afi, aghi, agfi, asi, agsi
5439 (define_insn "*add<mode>3_imm_cc"
5440 [(set (reg CC_REGNUM)
5441 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" " 0, d,0, 0")
5442 (match_operand:GPR 2 "const_int_operand" " K, K,Os, C"))
5444 (set (match_operand:GPR 0 "nonimmediate_operand" "=d, d,d,QS")
5445 (plus:GPR (match_dup 1) (match_dup 2)))]
5446 "s390_match_ccmode (insn, CCAmode)
5447 && (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")
5448 || (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'O', \"Os\")
5449 /* Avoid INT32_MIN on 32 bit. */
5450 && (!TARGET_ZARCH || INTVAL (operands[2]) != -0x7fffffff - 1)))"
5456 [(set_attr "op_type" "RI,RIE,RIL,SIY")
5457 (set_attr "cpu_facility" "*,z196,extimm,z10")
5458 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5461 ; add(tf|df|sf|td|dd)3 instruction pattern(s).
5464 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5465 ; FIXME: wfadb does not clobber cc
5466 (define_insn "add<mode>3"
5467 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
5468 (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>, 0,<v0>")
5469 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))
5470 (clobber (reg:CC CC_REGNUM))]
5473 a<xde><bt>r\t%0,<op1>%2
5476 [(set_attr "op_type" "<RRer>,RXE,VRR")
5477 (set_attr "type" "fsimp<mode>")
5478 (set_attr "cpu_facility" "*,*,vec")])
5480 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5481 (define_insn "*add<mode>3_cc"
5482 [(set (reg CC_REGNUM)
5483 (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
5484 (match_operand:FP 2 "general_operand" " f,<Rf>"))
5485 (match_operand:FP 3 "const0_operand" "")))
5486 (set (match_operand:FP 0 "register_operand" "=f,f")
5487 (plus:FP (match_dup 1) (match_dup 2)))]
5488 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5490 a<xde><bt>r\t%0,<op1>%2
5492 [(set_attr "op_type" "<RRer>,RXE")
5493 (set_attr "type" "fsimp<mode>")])
5495 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5496 (define_insn "*add<mode>3_cconly"
5497 [(set (reg CC_REGNUM)
5498 (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
5499 (match_operand:FP 2 "general_operand" " f,<Rf>"))
5500 (match_operand:FP 3 "const0_operand" "")))
5501 (clobber (match_scratch:FP 0 "=f,f"))]
5502 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5504 a<xde><bt>r\t%0,<op1>%2
5506 [(set_attr "op_type" "<RRer>,RXE")
5507 (set_attr "type" "fsimp<mode>")])
5510 ; Pointer add instruction patterns
5513 ; This will match "*la_64"
5514 (define_expand "addptrdi3"
5515 [(set (match_operand:DI 0 "register_operand" "")
5516 (plus:DI (match_operand:DI 1 "register_operand" "")
5517 (match_operand:DI 2 "nonmemory_operand" "")))]
5520 if (GET_CODE (operands[2]) == CONST_INT)
5522 HOST_WIDE_INT c = INTVAL (operands[2]);
5524 if (!CONST_OK_FOR_CONSTRAINT_P (c, 'K', "K")
5525 && !CONST_OK_FOR_CONSTRAINT_P (c, 'O', "Os"))
5527 operands[2] = force_const_mem (DImode, operands[2]);
5528 operands[2] = force_reg (DImode, operands[2]);
5530 else if (!DISP_IN_RANGE (INTVAL (operands[2])))
5531 operands[2] = force_reg (DImode, operands[2]);
5535 ; For 31 bit we have to prevent the generated pattern from matching
5536 ; normal ADDs since la only does a 31 bit add. This is supposed to
5537 ; match "force_la_31".
5538 (define_expand "addptrsi3"
5540 [(set (match_operand:SI 0 "register_operand" "")
5541 (plus:SI (match_operand:SI 1 "register_operand" "")
5542 (match_operand:SI 2 "nonmemory_operand" "")))
5543 (use (const_int 0))])]
5546 if (GET_CODE (operands[2]) == CONST_INT)
5548 HOST_WIDE_INT c = INTVAL (operands[2]);
5550 if (!CONST_OK_FOR_CONSTRAINT_P (c, 'K', "K")
5551 && !CONST_OK_FOR_CONSTRAINT_P (c, 'O', "Os"))
5553 operands[2] = force_const_mem (SImode, operands[2]);
5554 operands[2] = force_reg (SImode, operands[2]);
5556 else if (!DISP_IN_RANGE (INTVAL (operands[2])))
5557 operands[2] = force_reg (SImode, operands[2]);
5562 ;;- Subtract instructions.
5566 ; subti3 instruction pattern(s).
5569 (define_expand "subti3"
5571 [(set (match_operand:TI 0 "register_operand" "")
5572 (minus:TI (match_operand:TI 1 "register_operand" "")
5573 (match_operand:TI 2 "general_operand" "") ) )
5574 (clobber (reg:CC CC_REGNUM))])]
5577 /* For z13 we have vaq which doesn't set CC. */
5580 emit_insn (gen_rtx_SET (operands[0],
5581 gen_rtx_MINUS (TImode,
5583 copy_to_mode_reg (TImode, operands[2]))));
5588 (define_insn_and_split "*subti3"
5589 [(set (match_operand:TI 0 "register_operand" "=&d")
5590 (minus:TI (match_operand:TI 1 "register_operand" "0")
5591 (match_operand:TI 2 "general_operand" "do") ) )
5592 (clobber (reg:CC CC_REGNUM))]
5595 "&& reload_completed"
5597 [(set (reg:CCL2 CC_REGNUM)
5598 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
5600 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
5602 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
5603 (gtu:DI (reg:CCL2 CC_REGNUM) (const_int 0))))
5604 (clobber (reg:CC CC_REGNUM))])]
5605 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
5606 operands[4] = operand_subword (operands[1], 0, 0, TImode);
5607 operands[5] = operand_subword (operands[2], 0, 0, TImode);
5608 operands[6] = operand_subword (operands[0], 1, 0, TImode);
5609 operands[7] = operand_subword (operands[1], 1, 0, TImode);
5610 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
5611 [(set_attr "op_type" "*")
5612 (set_attr "cpu_facility" "*")])
5615 ; subdi3 instruction pattern(s).
5618 (define_expand "subdi3"
5620 [(set (match_operand:DI 0 "register_operand" "")
5621 (minus:DI (match_operand:DI 1 "register_operand" "")
5622 (match_operand:DI 2 "general_operand" "")))
5623 (clobber (reg:CC CC_REGNUM))])]
5627 (define_insn "*subdi3_sign"
5628 [(set (match_operand:DI 0 "register_operand" "=d,d")
5629 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5630 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))))
5631 (clobber (reg:CC CC_REGNUM))]
5636 [(set_attr "op_type" "RRE,RXY")
5637 (set_attr "z10prop" "z10_c,*")
5638 (set_attr "z196prop" "z196_cracked")])
5640 (define_insn "*subdi3_zero_cc"
5641 [(set (reg CC_REGNUM)
5642 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5643 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT")))
5645 (set (match_operand:DI 0 "register_operand" "=d,d")
5646 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
5647 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5651 [(set_attr "op_type" "RRE,RXY")
5652 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5654 (define_insn "*subdi3_zero_cconly"
5655 [(set (reg CC_REGNUM)
5656 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5657 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT")))
5659 (clobber (match_scratch:DI 0 "=d,d"))]
5660 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5664 [(set_attr "op_type" "RRE,RXY")
5665 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5667 (define_insn "*subdi3_zero"
5668 [(set (match_operand:DI 0 "register_operand" "=d,d")
5669 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5670 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))))
5671 (clobber (reg:CC CC_REGNUM))]
5676 [(set_attr "op_type" "RRE,RXY")
5677 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5679 (define_insn_and_split "*subdi3_31z"
5680 [(set (match_operand:DI 0 "register_operand" "=&d")
5681 (minus:DI (match_operand:DI 1 "register_operand" "0")
5682 (match_operand:DI 2 "general_operand" "do") ) )
5683 (clobber (reg:CC CC_REGNUM))]
5684 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
5686 "&& reload_completed"
5688 [(set (reg:CCL2 CC_REGNUM)
5689 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
5691 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
5693 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
5694 (gtu:SI (reg:CCL2 CC_REGNUM) (const_int 0))))
5695 (clobber (reg:CC CC_REGNUM))])]
5696 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5697 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5698 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5699 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5700 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5701 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
5703 (define_insn_and_split "*subdi3_31"
5704 [(set (match_operand:DI 0 "register_operand" "=&d")
5705 (minus:DI (match_operand:DI 1 "register_operand" "0")
5706 (match_operand:DI 2 "general_operand" "do") ) )
5707 (clobber (reg:CC CC_REGNUM))]
5710 "&& reload_completed"
5712 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
5713 (clobber (reg:CC CC_REGNUM))])
5715 [(set (reg:CCL2 CC_REGNUM)
5716 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
5718 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
5720 (if_then_else (gtu (reg:CCL2 CC_REGNUM) (const_int 0))
5722 (label_ref (match_dup 9))))
5724 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
5725 (clobber (reg:CC CC_REGNUM))])
5727 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5728 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5729 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5730 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5731 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5732 operands[8] = operand_subword (operands[2], 1, 0, DImode);
5733 operands[9] = gen_label_rtx ();")
5736 ; subsi3 instruction pattern(s).
5739 (define_expand "subsi3"
5741 [(set (match_operand:SI 0 "register_operand" "")
5742 (minus:SI (match_operand:SI 1 "register_operand" "")
5743 (match_operand:SI 2 "general_operand" "")))
5744 (clobber (reg:CC CC_REGNUM))])]
5748 (define_insn "*subsi3_sign"
5749 [(set (match_operand:SI 0 "register_operand" "=d,d")
5750 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
5751 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
5752 (clobber (reg:CC CC_REGNUM))]
5757 [(set_attr "op_type" "RX,RXY")
5758 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5761 ; sub(di|si)3 instruction pattern(s).
5764 ; sr, s, sy, sgr, sg, srk, sgrk
5765 (define_insn "*sub<mode>3"
5766 [(set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5767 (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5768 (match_operand:GPR 2 "general_operand" "d,d,R,T") ) )
5769 (clobber (reg:CC CC_REGNUM))]
5776 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5777 (set_attr "cpu_facility" "*,z196,*,*")
5778 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5780 ; slr, sl, sly, slgr, slg, slrk, slgrk
5781 (define_insn "*sub<mode>3_borrow_cc"
5782 [(set (reg CC_REGNUM)
5783 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5784 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5786 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5787 (minus:GPR (match_dup 1) (match_dup 2)))]
5788 "s390_match_ccmode (insn, CCL2mode)"
5794 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5795 (set_attr "cpu_facility" "*,z196,*,*")
5796 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5798 ; slr, sl, sly, slgr, slg, slrk, slgrk
5799 (define_insn "*sub<mode>3_borrow_cconly"
5800 [(set (reg CC_REGNUM)
5801 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5802 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5804 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5805 "s390_match_ccmode (insn, CCL2mode)"
5811 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5812 (set_attr "cpu_facility" "*,z196,*,*")
5813 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5815 ; slr, sl, sly, slgr, slg, slrk, slgrk
5816 (define_insn "*sub<mode>3_cc"
5817 [(set (reg CC_REGNUM)
5818 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5819 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5821 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5822 (minus:GPR (match_dup 1) (match_dup 2)))]
5823 "s390_match_ccmode (insn, CCLmode)"
5829 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5830 (set_attr "cpu_facility" "*,z196,*,*")
5831 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5833 ; slr, sl, sly, slgr, slg, slrk, slgrk
5834 (define_insn "*sub<mode>3_cc2"
5835 [(set (reg CC_REGNUM)
5836 (compare (match_operand:GPR 1 "register_operand" "0,d,0,0")
5837 (match_operand:GPR 2 "general_operand" "d,d,R,T")))
5838 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5839 (minus:GPR (match_dup 1) (match_dup 2)))]
5840 "s390_match_ccmode (insn, CCL3mode)"
5846 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5847 (set_attr "cpu_facility" "*,z196,*,*")
5848 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5850 ; slr, sl, sly, slgr, slg, slrk, slgrk
5851 (define_insn "*sub<mode>3_cconly"
5852 [(set (reg CC_REGNUM)
5853 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5854 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5856 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5857 "s390_match_ccmode (insn, CCLmode)"
5863 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5864 (set_attr "cpu_facility" "*,z196,*,*")
5865 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5868 ; slr, sl, sly, slgr, slg, slrk, slgrk
5869 (define_insn "*sub<mode>3_cconly2"
5870 [(set (reg CC_REGNUM)
5871 (compare (match_operand:GPR 1 "register_operand" "0,d,0,0")
5872 (match_operand:GPR 2 "general_operand" "d,d,R,T")))
5873 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5874 "s390_match_ccmode (insn, CCL3mode)"
5880 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5881 (set_attr "cpu_facility" "*,z196,*,*")
5882 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5886 ; sub(tf|df|sf|td|dd)3 instruction pattern(s).
5889 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5890 (define_insn "sub<mode>3"
5891 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
5892 (minus:FP (match_operand:FP 1 "register_operand" "<f0>, 0,<v0>")
5893 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))
5894 (clobber (reg:CC CC_REGNUM))]
5897 s<xde><bt>r\t%0,<op1>%2
5900 [(set_attr "op_type" "<RRer>,RXE,VRR")
5901 (set_attr "type" "fsimp<mode>")
5902 (set_attr "cpu_facility" "*,*,vec")])
5904 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5905 (define_insn "*sub<mode>3_cc"
5906 [(set (reg CC_REGNUM)
5907 (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "<f0>,0")
5908 (match_operand:FP 2 "general_operand" "f,<Rf>"))
5909 (match_operand:FP 3 "const0_operand" "")))
5910 (set (match_operand:FP 0 "register_operand" "=f,f")
5911 (minus:FP (match_dup 1) (match_dup 2)))]
5912 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5914 s<xde><bt>r\t%0,<op1>%2
5916 [(set_attr "op_type" "<RRer>,RXE")
5917 (set_attr "type" "fsimp<mode>")])
5919 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5920 (define_insn "*sub<mode>3_cconly"
5921 [(set (reg CC_REGNUM)
5922 (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "<f0>,0")
5923 (match_operand:FP 2 "general_operand" "f,<Rf>"))
5924 (match_operand:FP 3 "const0_operand" "")))
5925 (clobber (match_scratch:FP 0 "=f,f"))]
5926 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5928 s<xde><bt>r\t%0,<op1>%2
5930 [(set_attr "op_type" "<RRer>,RXE")
5931 (set_attr "type" "fsimp<mode>")])
5935 ;;- Conditional add/subtract instructions.
5939 ; add(di|si)cc instruction pattern(s).
5942 ; the following 4 patterns are used when the result of an add with
5943 ; carry is checked for an overflow condition
5945 ; op1 + op2 + c < op1
5947 ; alcr, alc, alcgr, alcg
5948 (define_insn "*add<mode>3_alc_carry1_cc"
5949 [(set (reg CC_REGNUM)
5951 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5952 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5953 (match_operand:GPR 2 "general_operand" "d,RT"))
5955 (set (match_operand:GPR 0 "register_operand" "=d,d")
5956 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5957 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5961 [(set_attr "op_type" "RRE,RXY")
5962 (set_attr "z196prop" "z196_alone,z196_alone")])
5964 ; alcr, alc, alcgr, alcg
5965 (define_insn "*add<mode>3_alc_carry1_cconly"
5966 [(set (reg CC_REGNUM)
5968 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5969 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5970 (match_operand:GPR 2 "general_operand" "d,RT"))
5972 (clobber (match_scratch:GPR 0 "=d,d"))]
5973 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5977 [(set_attr "op_type" "RRE,RXY")
5978 (set_attr "z196prop" "z196_alone,z196_alone")])
5980 ; op1 + op2 + c < op2
5982 ; alcr, alc, alcgr, alcg
5983 (define_insn "*add<mode>3_alc_carry2_cc"
5984 [(set (reg CC_REGNUM)
5986 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5987 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5988 (match_operand:GPR 2 "general_operand" "d,RT"))
5990 (set (match_operand:GPR 0 "register_operand" "=d,d")
5991 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5992 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5996 [(set_attr "op_type" "RRE,RXY")])
5998 ; alcr, alc, alcgr, alcg
5999 (define_insn "*add<mode>3_alc_carry2_cconly"
6000 [(set (reg CC_REGNUM)
6002 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
6003 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
6004 (match_operand:GPR 2 "general_operand" "d,RT"))
6006 (clobber (match_scratch:GPR 0 "=d,d"))]
6007 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
6011 [(set_attr "op_type" "RRE,RXY")])
6013 ; alcr, alc, alcgr, alcg
6014 (define_insn "*add<mode>3_alc_cc"
6015 [(set (reg CC_REGNUM)
6017 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
6018 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
6019 (match_operand:GPR 2 "general_operand" "d,RT"))
6021 (set (match_operand:GPR 0 "register_operand" "=d,d")
6022 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
6023 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
6027 [(set_attr "op_type" "RRE,RXY")])
6029 ; alcr, alc, alcgr, alcg
6030 (define_insn "*add<mode>3_alc"
6031 [(set (match_operand:GPR 0 "register_operand" "=d,d")
6032 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
6033 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
6034 (match_operand:GPR 2 "general_operand" "d,RT")))
6035 (clobber (reg:CC CC_REGNUM))]
6040 [(set_attr "op_type" "RRE,RXY")])
6042 ; slbr, slb, slbgr, slbg
6043 (define_insn "*sub<mode>3_slb_cc"
6044 [(set (reg CC_REGNUM)
6046 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
6047 (match_operand:GPR 2 "general_operand" "d,RT"))
6048 (match_operand:GPR 3 "s390_slb_comparison" ""))
6050 (set (match_operand:GPR 0 "register_operand" "=d,d")
6051 (minus:GPR (minus:GPR (match_dup 1) (match_dup 2)) (match_dup 3)))]
6052 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
6056 [(set_attr "op_type" "RRE,RXY")
6057 (set_attr "z10prop" "z10_c,*")])
6059 ; slbr, slb, slbgr, slbg
6060 (define_insn "*sub<mode>3_slb"
6061 [(set (match_operand:GPR 0 "register_operand" "=d,d")
6062 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
6063 (match_operand:GPR 2 "general_operand" "d,RT"))
6064 (match_operand:GPR 3 "s390_slb_comparison" "")))
6065 (clobber (reg:CC CC_REGNUM))]
6070 [(set_attr "op_type" "RRE,RXY")
6071 (set_attr "z10prop" "z10_c,*")])
6073 (define_expand "add<mode>cc"
6074 [(match_operand:GPR 0 "register_operand" "")
6075 (match_operand 1 "comparison_operator" "")
6076 (match_operand:GPR 2 "register_operand" "")
6077 (match_operand:GPR 3 "const_int_operand" "")]
6079 "if (!s390_expand_addcc (GET_CODE (operands[1]),
6080 XEXP (operands[1], 0), XEXP (operands[1], 1),
6081 operands[0], operands[2],
6082 operands[3])) FAIL; DONE;")
6085 ; scond instruction pattern(s).
6088 (define_insn_and_split "*scond<mode>"
6089 [(set (match_operand:GPR 0 "register_operand" "=&d")
6090 (match_operand:GPR 1 "s390_alc_comparison" ""))
6091 (clobber (reg:CC CC_REGNUM))]
6094 "&& reload_completed"
6095 [(set (match_dup 0) (const_int 0))
6097 [(set (match_dup 0) (plus:GPR (plus:GPR (match_dup 1) (match_dup 0))
6099 (clobber (reg:CC CC_REGNUM))])]
6102 (define_insn_and_split "*scond<mode>_neg"
6103 [(set (match_operand:GPR 0 "register_operand" "=&d")
6104 (match_operand:GPR 1 "s390_slb_comparison" ""))
6105 (clobber (reg:CC CC_REGNUM))]
6108 "&& reload_completed"
6109 [(set (match_dup 0) (const_int 0))
6111 [(set (match_dup 0) (minus:GPR (minus:GPR (match_dup 0) (match_dup 0))
6113 (clobber (reg:CC CC_REGNUM))])
6115 [(set (match_dup 0) (neg:GPR (match_dup 0)))
6116 (clobber (reg:CC CC_REGNUM))])]
6120 (define_expand "cstore<mode>4"
6121 [(set (match_operand:SI 0 "register_operand" "")
6122 (match_operator:SI 1 "s390_scond_operator"
6123 [(match_operand:GPR 2 "register_operand" "")
6124 (match_operand:GPR 3 "general_operand" "")]))]
6126 "if (!s390_expand_addcc (GET_CODE (operands[1]), operands[2], operands[3],
6127 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
6129 (define_expand "cstorecc4"
6131 [(set (match_operand:SI 0 "register_operand" "")
6132 (match_operator:SI 1 "s390_eqne_operator"
6133 [(match_operand:CCZ1 2 "register_operand")
6134 (match_operand 3 "const0_operand")]))
6135 (clobber (reg:CC CC_REGNUM))])]
6137 "emit_insn (gen_sne (operands[0], operands[2]));
6138 if (GET_CODE (operands[1]) == EQ)
6139 emit_insn (gen_xorsi3 (operands[0], operands[0], const1_rtx));
6142 (define_insn_and_split "sne"
6143 [(set (match_operand:SI 0 "register_operand" "=d")
6144 (ne:SI (match_operand:CCZ1 1 "register_operand" "0")
6146 (clobber (reg:CC CC_REGNUM))]
6151 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 28)))
6152 (clobber (reg:CC CC_REGNUM))])])
6156 ;; - Conditional move instructions (introduced with z196)
6159 (define_expand "mov<mode>cc"
6160 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
6161 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6162 (match_operand:GPR 2 "nonimmediate_operand" "")
6163 (match_operand:GPR 3 "nonimmediate_operand" "")))]
6166 /* Emit the comparison insn in case we do not already have a comparison result. */
6167 if (!s390_comparison (operands[1], VOIDmode))
6168 operands[1] = s390_emit_compare (GET_CODE (operands[1]),
6169 XEXP (operands[1], 0),
6170 XEXP (operands[1], 1));
6173 ; locr, loc, stoc, locgr, locg, stocg
6174 (define_insn_and_split "*mov<mode>cc"
6175 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,QS,QS,&d")
6177 (match_operator 1 "s390_comparison"
6178 [(match_operand 2 "cc_reg_operand" " c,c, c, c, c, c, c")
6179 (match_operand 5 "const_int_operand" "")])
6180 (match_operand:GPR 3 "nonimmediate_operand" " d,0,QS, 0, d, 0,QS")
6181 (match_operand:GPR 4 "nonimmediate_operand" " 0,d, 0,QS, 0, d,QS")))]
6191 "&& reload_completed
6192 && MEM_P (operands[3]) && MEM_P (operands[4])"
6195 (match_op_dup 1 [(match_dup 2) (const_int 0)])
6200 (match_op_dup 1 [(match_dup 2) (const_int 0)])
6204 [(set_attr "op_type" "RRF,RRF,RSY,RSY,RSY,RSY,*")])
6207 ;;- Multiply instructions.
6211 ; muldi3 instruction pattern(s).
6214 (define_insn "*muldi3_sign"
6215 [(set (match_operand:DI 0 "register_operand" "=d,d")
6216 (mult:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
6217 (match_operand:DI 1 "register_operand" "0,0")))]
6222 [(set_attr "op_type" "RRE,RXY")
6223 (set_attr "type" "imuldi")])
6225 (define_insn "muldi3"
6226 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d")
6227 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
6228 (match_operand:DI 2 "general_operand" "d,K,RT,Os")))]
6235 [(set_attr "op_type" "RRE,RI,RXY,RIL")
6236 (set_attr "type" "imuldi")
6237 (set_attr "cpu_facility" "*,*,*,z10")])
6240 ; mulsi3 instruction pattern(s).
6243 (define_insn "*mulsi3_sign"
6244 [(set (match_operand:SI 0 "register_operand" "=d,d")
6245 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
6246 (match_operand:SI 1 "register_operand" "0,0")))]
6251 [(set_attr "op_type" "RX,RXY")
6252 (set_attr "type" "imulhi")
6253 (set_attr "cpu_facility" "*,z10")])
6255 (define_insn "mulsi3"
6256 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
6257 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0")
6258 (match_operand:SI 2 "general_operand" "d,K,R,T,Os")))]
6266 [(set_attr "op_type" "RRE,RI,RX,RXY,RIL")
6267 (set_attr "type" "imulsi,imulhi,imulsi,imulsi,imulsi")
6268 (set_attr "cpu_facility" "*,*,*,*,z10")])
6271 ; mulsidi3 instruction pattern(s).
6274 (define_insn "mulsidi3"
6275 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
6276 (mult:DI (sign_extend:DI
6277 (match_operand:SI 1 "register_operand" "%0,0,0"))
6279 (match_operand:SI 2 "nonimmediate_operand" "d,R,T"))))]
6285 [(set_attr "op_type" "RR,RX,RXY")
6286 (set_attr "type" "imulsi")
6287 (set_attr "cpu_facility" "*,*,z10")])
6290 ; umul instruction pattern(s).
6293 ; mlr, ml, mlgr, mlg
6294 (define_insn "umul<dwh><mode>3"
6295 [(set (match_operand:DW 0 "register_operand" "=d, d")
6296 (mult:DW (zero_extend:DW
6297 (match_operand:<DWH> 1 "register_operand" "%0, 0"))
6299 (match_operand:<DWH> 2 "nonimmediate_operand" " d,RT"))))]
6304 [(set_attr "op_type" "RRE,RXY")
6305 (set_attr "type" "imul<dwh>")])
6308 ; mul(tf|df|sf|td|dd)3 instruction pattern(s).
6311 ; mxbr, mdbr, meebr, mxb, mxb, meeb, mdtr, mxtr
6312 (define_insn "mul<mode>3"
6313 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
6314 (mult:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>, 0,<v0>")
6315 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))]
6318 m<xdee><bt>r\t%0,<op1>%2
6321 [(set_attr "op_type" "<RRer>,RXE,VRR")
6322 (set_attr "type" "fmul<mode>")
6323 (set_attr "cpu_facility" "*,*,vec")])
6325 ; madbr, maebr, maxb, madb, maeb
6326 (define_insn "fma<mode>4"
6327 [(set (match_operand:DSF 0 "register_operand" "=f,f,<vf>")
6328 (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,<vf>")
6329 (match_operand:DSF 2 "nonimmediate_operand" "f,R,<vf>")
6330 (match_operand:DSF 3 "register_operand" "0,0,<v0>")))]
6335 wfmadb\t%v0,%v1,%v2,%v3"
6336 [(set_attr "op_type" "RRE,RXE,VRR")
6337 (set_attr "type" "fmadd<mode>")
6338 (set_attr "cpu_facility" "*,*,vec")])
6340 ; msxbr, msdbr, msebr, msxb, msdb, mseb
6341 (define_insn "fms<mode>4"
6342 [(set (match_operand:DSF 0 "register_operand" "=f,f,<vf>")
6343 (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,<vf>")
6344 (match_operand:DSF 2 "nonimmediate_operand" "f,R,<vf>")
6345 (neg:DSF (match_operand:DSF 3 "register_operand" "0,0,<v0>"))))]
6350 wfmsdb\t%v0,%v1,%v2,%v3"
6351 [(set_attr "op_type" "RRE,RXE,VRR")
6352 (set_attr "type" "fmadd<mode>")
6353 (set_attr "cpu_facility" "*,*,vec")])
6356 ;;- Divide and modulo instructions.
6360 ; divmoddi4 instruction pattern(s).
6363 (define_expand "divmoddi4"
6364 [(parallel [(set (match_operand:DI 0 "general_operand" "")
6365 (div:DI (match_operand:DI 1 "register_operand" "")
6366 (match_operand:DI 2 "general_operand" "")))
6367 (set (match_operand:DI 3 "general_operand" "")
6368 (mod:DI (match_dup 1) (match_dup 2)))])
6369 (clobber (match_dup 4))]
6372 rtx insn, div_equal, mod_equal;
6374 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
6375 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
6377 operands[4] = gen_reg_rtx(TImode);
6378 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
6380 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
6381 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6383 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
6384 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6389 (define_insn "divmodtidi3"
6390 [(set (match_operand:TI 0 "register_operand" "=d,d")
6394 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6395 (match_operand:DI 2 "general_operand" "d,RT")))
6397 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
6402 [(set_attr "op_type" "RRE,RXY")
6403 (set_attr "type" "idiv")])
6405 (define_insn "divmodtisi3"
6406 [(set (match_operand:TI 0 "register_operand" "=d,d")
6410 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6412 (match_operand:SI 2 "nonimmediate_operand" "d,RT"))))
6415 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
6420 [(set_attr "op_type" "RRE,RXY")
6421 (set_attr "type" "idiv")])
6424 ; udivmoddi4 instruction pattern(s).
6427 (define_expand "udivmoddi4"
6428 [(parallel [(set (match_operand:DI 0 "general_operand" "")
6429 (udiv:DI (match_operand:DI 1 "general_operand" "")
6430 (match_operand:DI 2 "nonimmediate_operand" "")))
6431 (set (match_operand:DI 3 "general_operand" "")
6432 (umod:DI (match_dup 1) (match_dup 2)))])
6433 (clobber (match_dup 4))]
6436 rtx insn, div_equal, mod_equal, equal;
6438 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
6439 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
6440 equal = gen_rtx_IOR (TImode,
6441 gen_rtx_ASHIFT (TImode,
6442 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
6444 gen_rtx_ZERO_EXTEND (TImode, div_equal));
6446 operands[4] = gen_reg_rtx(TImode);
6447 emit_clobber (operands[4]);
6448 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
6449 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
6451 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
6452 set_unique_reg_note (insn, REG_EQUAL, equal);
6454 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
6455 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6457 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
6458 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6463 (define_insn "udivmodtidi3"
6464 [(set (match_operand:TI 0 "register_operand" "=d,d")
6469 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
6471 (match_operand:DI 2 "nonimmediate_operand" "d,RT")))))
6475 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
6480 [(set_attr "op_type" "RRE,RXY")
6481 (set_attr "type" "idiv")])
6484 ; divmodsi4 instruction pattern(s).
6487 (define_expand "divmodsi4"
6488 [(parallel [(set (match_operand:SI 0 "general_operand" "")
6489 (div:SI (match_operand:SI 1 "general_operand" "")
6490 (match_operand:SI 2 "nonimmediate_operand" "")))
6491 (set (match_operand:SI 3 "general_operand" "")
6492 (mod:SI (match_dup 1) (match_dup 2)))])
6493 (clobber (match_dup 4))]
6496 rtx insn, div_equal, mod_equal, equal;
6498 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
6499 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
6500 equal = gen_rtx_IOR (DImode,
6501 gen_rtx_ASHIFT (DImode,
6502 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
6504 gen_rtx_ZERO_EXTEND (DImode, div_equal));
6506 operands[4] = gen_reg_rtx(DImode);
6507 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
6509 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
6510 set_unique_reg_note (insn, REG_EQUAL, equal);
6512 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
6513 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6515 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
6516 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6521 (define_insn "divmoddisi3"
6522 [(set (match_operand:DI 0 "register_operand" "=d,d")
6527 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6529 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
6533 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
6538 [(set_attr "op_type" "RR,RX")
6539 (set_attr "type" "idiv")])
6542 ; udivsi3 and umodsi3 instruction pattern(s).
6545 (define_expand "udivmodsi4"
6546 [(parallel [(set (match_operand:SI 0 "general_operand" "")
6547 (udiv:SI (match_operand:SI 1 "general_operand" "")
6548 (match_operand:SI 2 "nonimmediate_operand" "")))
6549 (set (match_operand:SI 3 "general_operand" "")
6550 (umod:SI (match_dup 1) (match_dup 2)))])
6551 (clobber (match_dup 4))]
6552 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
6554 rtx insn, div_equal, mod_equal, equal;
6556 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6557 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6558 equal = gen_rtx_IOR (DImode,
6559 gen_rtx_ASHIFT (DImode,
6560 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
6562 gen_rtx_ZERO_EXTEND (DImode, div_equal));
6564 operands[4] = gen_reg_rtx(DImode);
6565 emit_clobber (operands[4]);
6566 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
6567 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
6569 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
6570 set_unique_reg_note (insn, REG_EQUAL, equal);
6572 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
6573 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6575 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
6576 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6581 (define_insn "udivmoddisi3"
6582 [(set (match_operand:DI 0 "register_operand" "=d,d")
6587 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
6589 (match_operand:SI 2 "nonimmediate_operand" "d,RT")))))
6593 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
6594 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
6598 [(set_attr "op_type" "RRE,RXY")
6599 (set_attr "type" "idiv")])
6601 (define_expand "udivsi3"
6602 [(set (match_operand:SI 0 "register_operand" "=d")
6603 (udiv:SI (match_operand:SI 1 "general_operand" "")
6604 (match_operand:SI 2 "general_operand" "")))
6605 (clobber (match_dup 3))]
6606 "!TARGET_ZARCH && !TARGET_CPU_ZARCH"
6608 rtx insn, udiv_equal, umod_equal, equal;
6610 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6611 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6612 equal = gen_rtx_IOR (DImode,
6613 gen_rtx_ASHIFT (DImode,
6614 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
6616 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
6618 operands[3] = gen_reg_rtx (DImode);
6620 if (CONSTANT_P (operands[2]))
6622 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
6624 rtx_code_label *label1 = gen_label_rtx ();
6626 operands[1] = make_safe_from (operands[1], operands[0]);
6627 emit_move_insn (operands[0], const0_rtx);
6628 emit_cmp_and_jump_insns (operands[1], operands[2], LT, NULL_RTX,
6630 emit_move_insn (operands[0], const1_rtx);
6631 emit_label (label1);
6635 operands[2] = force_reg (SImode, operands[2]);
6636 operands[2] = make_safe_from (operands[2], operands[0]);
6638 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6639 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6641 set_unique_reg_note (insn, REG_EQUAL, equal);
6643 insn = emit_move_insn (operands[0],
6644 gen_lowpart (SImode, operands[3]));
6645 set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
6650 rtx_code_label *label1 = gen_label_rtx ();
6651 rtx_code_label *label2 = gen_label_rtx ();
6652 rtx_code_label *label3 = gen_label_rtx ();
6654 operands[1] = force_reg (SImode, operands[1]);
6655 operands[1] = make_safe_from (operands[1], operands[0]);
6656 operands[2] = force_reg (SImode, operands[2]);
6657 operands[2] = make_safe_from (operands[2], operands[0]);
6659 emit_move_insn (operands[0], const0_rtx);
6660 emit_cmp_and_jump_insns (operands[2], operands[1], GT, NULL_RTX,
6662 emit_cmp_and_jump_insns (operands[2], const0_rtx, LT, NULL_RTX,
6664 emit_cmp_and_jump_insns (operands[2], const1_rtx, EQ, NULL_RTX,
6666 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6667 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6669 set_unique_reg_note (insn, REG_EQUAL, equal);
6671 insn = emit_move_insn (operands[0],
6672 gen_lowpart (SImode, operands[3]));
6673 set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
6676 emit_label (label1);
6677 emit_move_insn (operands[0], operands[1]);
6679 emit_label (label2);
6680 emit_move_insn (operands[0], const1_rtx);
6681 emit_label (label3);
6683 emit_move_insn (operands[0], operands[0]);
6687 (define_expand "umodsi3"
6688 [(set (match_operand:SI 0 "register_operand" "=d")
6689 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
6690 (match_operand:SI 2 "nonimmediate_operand" "")))
6691 (clobber (match_dup 3))]
6692 "!TARGET_ZARCH && !TARGET_CPU_ZARCH"
6694 rtx insn, udiv_equal, umod_equal, equal;
6696 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6697 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6698 equal = gen_rtx_IOR (DImode,
6699 gen_rtx_ASHIFT (DImode,
6700 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
6702 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
6704 operands[3] = gen_reg_rtx (DImode);
6706 if (CONSTANT_P (operands[2]))
6708 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
6710 rtx_code_label *label1 = gen_label_rtx ();
6712 operands[1] = make_safe_from (operands[1], operands[0]);
6713 emit_move_insn (operands[0], operands[1]);
6714 emit_cmp_and_jump_insns (operands[0], operands[2], LT, NULL_RTX,
6716 emit_insn (gen_abssi2 (operands[0], operands[2]));
6717 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
6718 emit_label (label1);
6722 operands[2] = force_reg (SImode, operands[2]);
6723 operands[2] = make_safe_from (operands[2], operands[0]);
6725 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6726 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6728 set_unique_reg_note (insn, REG_EQUAL, equal);
6730 insn = emit_move_insn (operands[0],
6731 gen_highpart (SImode, operands[3]));
6732 set_unique_reg_note (insn, REG_EQUAL, umod_equal);
6737 rtx_code_label *label1 = gen_label_rtx ();
6738 rtx_code_label *label2 = gen_label_rtx ();
6739 rtx_code_label *label3 = gen_label_rtx ();
6741 operands[1] = force_reg (SImode, operands[1]);
6742 operands[1] = make_safe_from (operands[1], operands[0]);
6743 operands[2] = force_reg (SImode, operands[2]);
6744 operands[2] = make_safe_from (operands[2], operands[0]);
6746 emit_move_insn(operands[0], operands[1]);
6747 emit_cmp_and_jump_insns (operands[2], operands[1], GT, NULL_RTX,
6749 emit_cmp_and_jump_insns (operands[2], const0_rtx, LT, NULL_RTX,
6751 emit_cmp_and_jump_insns (operands[2], const1_rtx, EQ, NULL_RTX,
6753 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6754 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6756 set_unique_reg_note (insn, REG_EQUAL, equal);
6758 insn = emit_move_insn (operands[0],
6759 gen_highpart (SImode, operands[3]));
6760 set_unique_reg_note (insn, REG_EQUAL, umod_equal);
6763 emit_label (label1);
6764 emit_move_insn (operands[0], const0_rtx);
6766 emit_label (label2);
6767 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
6768 emit_label (label3);
6774 ; div(df|sf)3 instruction pattern(s).
6777 ; dxbr, ddbr, debr, dxb, ddb, deb, ddtr, dxtr
6778 (define_insn "div<mode>3"
6779 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
6780 (div:FP (match_operand:FP 1 "register_operand" "<f0>, 0,<v0>")
6781 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))]
6784 d<xde><bt>r\t%0,<op1>%2
6787 [(set_attr "op_type" "<RRer>,RXE,VRR")
6788 (set_attr "type" "fdiv<mode>")
6789 (set_attr "cpu_facility" "*,*,vec")])
6793 ;;- And instructions.
6796 (define_expand "and<mode>3"
6797 [(set (match_operand:INT 0 "nonimmediate_operand" "")
6798 (and:INT (match_operand:INT 1 "nonimmediate_operand" "")
6799 (match_operand:INT 2 "general_operand" "")))
6800 (clobber (reg:CC CC_REGNUM))]
6802 "s390_expand_logical_operator (AND, <MODE>mode, operands); DONE;")
6805 ; anddi3 instruction pattern(s).
6808 (define_insn "*anddi3_cc"
6809 [(set (reg CC_REGNUM)
6811 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0, d")
6812 (match_operand:DI 2 "general_operand" " d,d,RT,NxxDq"))
6814 (set (match_operand:DI 0 "register_operand" "=d,d, d, d")
6815 (and:DI (match_dup 1) (match_dup 2)))]
6816 "TARGET_ZARCH && s390_match_ccmode(insn, CCTmode)"
6821 risbg\t%0,%1,%s2,128+%e2,0"
6822 [(set_attr "op_type" "RRE,RRF,RXY,RIE")
6823 (set_attr "cpu_facility" "*,z196,*,z10")
6824 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
6826 (define_insn "*anddi3_cconly"
6827 [(set (reg CC_REGNUM)
6829 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0, d")
6830 (match_operand:DI 2 "general_operand" " d,d,RT,NxxDq"))
6832 (clobber (match_scratch:DI 0 "=d,d, d, d"))]
6834 && s390_match_ccmode(insn, CCTmode)
6835 /* Do not steal TM patterns. */
6836 && s390_single_part (operands[2], DImode, HImode, 0) < 0"
6841 risbg\t%0,%1,%s2,128+%e2,0"
6842 [(set_attr "op_type" "RRE,RRF,RXY,RIE")
6843 (set_attr "cpu_facility" "*,z196,*,z10")
6844 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
6846 (define_insn "*anddi3"
6847 [(set (match_operand:DI 0 "nonimmediate_operand"
6848 "=d,d, d, d, d, d, d, d,d,d, d, d, AQ,Q")
6850 (match_operand:DI 1 "nonimmediate_operand"
6851 "%d,o, 0, 0, 0, 0, 0, 0,0,d, 0, d, 0,0")
6852 (match_operand:DI 2 "general_operand"
6853 "M, M,N0HDF,N1HDF,N2HDF,N3HDF,N0SDF,N1SDF,d,d,RT,NxxDq,NxQDF,Q")))
6854 (clobber (reg:CC CC_REGNUM))]
6855 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6868 risbg\t%0,%1,%s2,128+%e2,0
6871 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,RIE,SI,SS")
6872 (set_attr "cpu_facility" "*,*,*,*,*,*,extimm,extimm,*,z196,*,z10,*,*")
6873 (set_attr "z10prop" "*,
6889 [(set (match_operand:DI 0 "s_operand" "")
6890 (and:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
6891 (clobber (reg:CC CC_REGNUM))]
6894 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
6895 (clobber (reg:CC CC_REGNUM))])]
6896 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
6898 ;; These two are what combine generates for (ashift (zero_extract)).
6899 (define_insn "*extzv_<mode>_srl"
6900 [(set (match_operand:GPR 0 "register_operand" "=d")
6901 (and:GPR (lshiftrt:GPR
6902 (match_operand:GPR 1 "register_operand" "d")
6903 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
6904 (match_operand:GPR 3 "contiguous_bitmask_operand" "")))
6905 (clobber (reg:CC CC_REGNUM))]
6907 /* Note that even for the SImode pattern, the rotate is always DImode. */
6908 && s390_extzv_shift_ok (<bitsize>, -INTVAL (operands[2]),
6909 INTVAL (operands[3]))"
6910 "risbg\t%0,%1,%<bfstart>3,128+%<bfend>3,64-%2"
6911 [(set_attr "op_type" "RIE")
6912 (set_attr "z10prop" "z10_super_E1")])
6914 (define_insn "*extzv_<mode>_sll"
6915 [(set (match_operand:GPR 0 "register_operand" "=d")
6916 (and:GPR (ashift:GPR
6917 (match_operand:GPR 1 "register_operand" "d")
6918 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
6919 (match_operand:GPR 3 "contiguous_bitmask_operand" "")))
6920 (clobber (reg:CC CC_REGNUM))]
6922 && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[2]),
6923 INTVAL (operands[3]))"
6924 "risbg\t%0,%1,%<bfstart>3,128+%<bfend>3,%2"
6925 [(set_attr "op_type" "RIE")
6926 (set_attr "z10prop" "z10_super_E1")])
6930 ; andsi3 instruction pattern(s).
6933 (define_insn "*andsi3_cc"
6934 [(set (reg CC_REGNUM)
6937 (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d")
6938 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq"))
6940 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d, d")
6941 (and:SI (match_dup 1) (match_dup 2)))]
6942 "s390_match_ccmode(insn, CCTmode)"
6949 risbg\t%0,%1,%t2,128+%f2,0"
6950 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE")
6951 (set_attr "cpu_facility" "*,*,z196,*,*,z10")
6952 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
6953 z10_super_E1,z10_super_E1,z10_super_E1")])
6955 (define_insn "*andsi3_cconly"
6956 [(set (reg CC_REGNUM)
6959 (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d")
6960 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq"))
6962 (clobber (match_scratch:SI 0 "=d,d,d,d,d, d"))]
6963 "s390_match_ccmode(insn, CCTmode)
6964 /* Do not steal TM patterns. */
6965 && s390_single_part (operands[2], SImode, HImode, 0) < 0"
6972 risbg\t%0,%1,%t2,128+%f2,0"
6973 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE")
6974 (set_attr "cpu_facility" "*,*,z196,*,*,z10")
6975 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
6976 z10_super_E1,z10_super_E1,z10_super_E1")])
6978 (define_insn "*andsi3_zarch"
6979 [(set (match_operand:SI 0 "nonimmediate_operand"
6980 "=d,d, d, d, d,d,d,d,d, d, AQ,Q")
6981 (and:SI (match_operand:SI 1 "nonimmediate_operand"
6982 "%d,o, 0, 0, 0,0,d,0,0, d, 0,0")
6983 (match_operand:SI 2 "general_operand"
6984 " M,M,N0HSF,N1HSF,Os,d,d,R,T,NxxSq,NxQSF,Q")))
6985 (clobber (reg:CC CC_REGNUM))]
6986 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6997 risbg\t%0,%1,%t2,128+%f2,0
7000 [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RRF,RX,RXY,RIE,SI,SS")
7001 (set_attr "cpu_facility" "*,*,*,*,*,*,z196,*,*,z10,*,*")
7002 (set_attr "z10prop" "*,
7015 (define_insn "*andsi3_esa"
7016 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d, AQ,Q")
7017 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0, 0,0")
7018 (match_operand:SI 2 "general_operand" " d,R,NxQSF,Q")))
7019 (clobber (reg:CC CC_REGNUM))]
7020 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7026 [(set_attr "op_type" "RR,RX,SI,SS")
7027 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
7031 [(set (match_operand:SI 0 "s_operand" "")
7032 (and:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7033 (clobber (reg:CC CC_REGNUM))]
7036 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
7037 (clobber (reg:CC CC_REGNUM))])]
7038 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
7041 ; andhi3 instruction pattern(s).
7044 (define_insn "*andhi3_zarch"
7045 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7046 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0")
7047 (match_operand:HI 2 "general_operand" " d,d,n,NxQHF,Q")))
7048 (clobber (reg:CC CC_REGNUM))]
7049 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7056 [(set_attr "op_type" "RR,RRF,RI,SI,SS")
7057 (set_attr "cpu_facility" "*,z196,*,*,*")
7058 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*")
7061 (define_insn "*andhi3_esa"
7062 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
7063 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
7064 (match_operand:HI 2 "general_operand" "d,NxQHF,Q")))
7065 (clobber (reg:CC CC_REGNUM))]
7066 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7071 [(set_attr "op_type" "RR,SI,SS")
7072 (set_attr "z10prop" "z10_super_E1,*,*")
7076 [(set (match_operand:HI 0 "s_operand" "")
7077 (and:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7078 (clobber (reg:CC CC_REGNUM))]
7081 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
7082 (clobber (reg:CC CC_REGNUM))])]
7083 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
7086 ; andqi3 instruction pattern(s).
7089 (define_insn "*andqi3_zarch"
7090 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7091 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0")
7092 (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q")))
7093 (clobber (reg:CC CC_REGNUM))]
7094 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7102 [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS")
7103 (set_attr "cpu_facility" "*,z196,*,*,*,*")
7104 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super,z10_super,*")])
7106 (define_insn "*andqi3_esa"
7107 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
7108 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
7109 (match_operand:QI 2 "general_operand" "d,n,Q")))
7110 (clobber (reg:CC CC_REGNUM))]
7111 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7116 [(set_attr "op_type" "RR,SI,SS")
7117 (set_attr "z10prop" "z10_super_E1,z10_super,*")])
7120 ; Block and (NC) patterns.
7124 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7125 (and:BLK (match_dup 0)
7126 (match_operand:BLK 1 "memory_operand" "Q")))
7127 (use (match_operand 2 "const_int_operand" "n"))
7128 (clobber (reg:CC CC_REGNUM))]
7129 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7130 "nc\t%O0(%2,%R0),%S1"
7131 [(set_attr "op_type" "SS")
7132 (set_attr "z196prop" "z196_cracked")])
7135 [(set (match_operand 0 "memory_operand" "")
7137 (match_operand 1 "memory_operand" "")))
7138 (clobber (reg:CC CC_REGNUM))]
7140 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7141 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7143 [(set (match_dup 0) (and:BLK (match_dup 0) (match_dup 1)))
7145 (clobber (reg:CC CC_REGNUM))])]
7147 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7148 operands[0] = adjust_address (operands[0], BLKmode, 0);
7149 operands[1] = adjust_address (operands[1], BLKmode, 0);
7154 [(set (match_operand:BLK 0 "memory_operand" "")
7155 (and:BLK (match_dup 0)
7156 (match_operand:BLK 1 "memory_operand" "")))
7157 (use (match_operand 2 "const_int_operand" ""))
7158 (clobber (reg:CC CC_REGNUM))])
7160 [(set (match_operand:BLK 3 "memory_operand" "")
7161 (and:BLK (match_dup 3)
7162 (match_operand:BLK 4 "memory_operand" "")))
7163 (use (match_operand 5 "const_int_operand" ""))
7164 (clobber (reg:CC CC_REGNUM))])]
7165 "s390_offset_p (operands[0], operands[3], operands[2])
7166 && s390_offset_p (operands[1], operands[4], operands[2])
7167 && !s390_overlap_p (operands[0], operands[1],
7168 INTVAL (operands[2]) + INTVAL (operands[5]))
7169 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7171 [(set (match_dup 6) (and:BLK (match_dup 6) (match_dup 7)))
7173 (clobber (reg:CC CC_REGNUM))])]
7174 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7175 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7176 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7180 ;;- Bit set (inclusive or) instructions.
7183 (define_expand "ior<mode>3"
7184 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7185 (ior:INT (match_operand:INT 1 "nonimmediate_operand" "")
7186 (match_operand:INT 2 "general_operand" "")))
7187 (clobber (reg:CC CC_REGNUM))]
7189 "s390_expand_logical_operator (IOR, <MODE>mode, operands); DONE;")
7192 ; iordi3 instruction pattern(s).
7195 (define_insn "*iordi3_cc"
7196 [(set (reg CC_REGNUM)
7197 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7198 (match_operand:DI 2 "general_operand" " d,d,RT"))
7200 (set (match_operand:DI 0 "register_operand" "=d,d, d")
7201 (ior:DI (match_dup 1) (match_dup 2)))]
7202 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7207 [(set_attr "op_type" "RRE,RRF,RXY")
7208 (set_attr "cpu_facility" "*,z196,*")
7209 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7211 (define_insn "*iordi3_cconly"
7212 [(set (reg CC_REGNUM)
7213 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0")
7214 (match_operand:DI 2 "general_operand" " d,d,RT"))
7216 (clobber (match_scratch:DI 0 "=d,d,d"))]
7217 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7222 [(set_attr "op_type" "RRE,RRF,RXY")
7223 (set_attr "cpu_facility" "*,z196,*")
7224 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7226 (define_insn "*iordi3"
7227 [(set (match_operand:DI 0 "nonimmediate_operand"
7228 "=d, d, d, d, d, d,d,d, d, AQ,Q")
7229 (ior:DI (match_operand:DI 1 "nonimmediate_operand"
7230 " %0, 0, 0, 0, 0, 0,0,d, 0, 0,0")
7231 (match_operand:DI 2 "general_operand"
7232 "N0HD0,N1HD0,N2HD0,N3HD0,N0SD0,N1SD0,d,d,RT,NxQD0,Q")))
7233 (clobber (reg:CC CC_REGNUM))]
7234 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7247 [(set_attr "op_type" "RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,SI,SS")
7248 (set_attr "cpu_facility" "*,*,*,*,extimm,extimm,*,z196,*,*,*")
7249 (set_attr "z10prop" "z10_super_E1,
7262 [(set (match_operand:DI 0 "s_operand" "")
7263 (ior:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
7264 (clobber (reg:CC CC_REGNUM))]
7267 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7268 (clobber (reg:CC CC_REGNUM))])]
7269 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7272 ; iorsi3 instruction pattern(s).
7275 (define_insn "*iorsi3_cc"
7276 [(set (reg CC_REGNUM)
7277 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7278 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7280 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
7281 (ior:SI (match_dup 1) (match_dup 2)))]
7282 "s390_match_ccmode(insn, CCTmode)"
7289 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7290 (set_attr "cpu_facility" "*,*,z196,*,*")
7291 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")])
7293 (define_insn "*iorsi3_cconly"
7294 [(set (reg CC_REGNUM)
7295 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7296 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7298 (clobber (match_scratch:SI 0 "=d,d,d,d,d"))]
7299 "s390_match_ccmode(insn, CCTmode)"
7306 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7307 (set_attr "cpu_facility" "*,*,z196,*,*")
7308 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")])
7310 (define_insn "*iorsi3_zarch"
7311 [(set (match_operand:SI 0 "nonimmediate_operand" "=d, d, d,d,d,d,d, AQ,Q")
7312 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0, 0, 0,0,d,0,0, 0,0")
7313 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,Os,d,d,R,T,NxQS0,Q")))
7314 (clobber (reg:CC CC_REGNUM))]
7315 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7326 [(set_attr "op_type" "RI,RI,RIL,RR,RRF,RX,RXY,SI,SS")
7327 (set_attr "cpu_facility" "*,*,*,*,z196,*,*,*,*")
7328 (set_attr "z10prop" "z10_super_E1,
7338 (define_insn "*iorsi3_esa"
7339 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
7340 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
7341 (match_operand:SI 2 "general_operand" "d,R,NxQS0,Q")))
7342 (clobber (reg:CC CC_REGNUM))]
7343 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7349 [(set_attr "op_type" "RR,RX,SI,SS")
7350 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
7353 [(set (match_operand:SI 0 "s_operand" "")
7354 (ior:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7355 (clobber (reg:CC CC_REGNUM))]
7358 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7359 (clobber (reg:CC CC_REGNUM))])]
7360 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7363 ; iorhi3 instruction pattern(s).
7366 (define_insn "*iorhi3_zarch"
7367 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7368 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0")
7369 (match_operand:HI 2 "general_operand" " d,d,n,NxQH0,Q")))
7370 (clobber (reg:CC CC_REGNUM))]
7371 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7378 [(set_attr "op_type" "RR,RRF,RI,SI,SS")
7379 (set_attr "cpu_facility" "*,z196,*,*,*")
7380 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*")])
7382 (define_insn "*iorhi3_esa"
7383 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
7384 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
7385 (match_operand:HI 2 "general_operand" "d,NxQH0,Q")))
7386 (clobber (reg:CC CC_REGNUM))]
7387 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7392 [(set_attr "op_type" "RR,SI,SS")
7393 (set_attr "z10prop" "z10_super_E1,*,*")])
7396 [(set (match_operand:HI 0 "s_operand" "")
7397 (ior:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7398 (clobber (reg:CC CC_REGNUM))]
7401 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7402 (clobber (reg:CC CC_REGNUM))])]
7403 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7406 ; iorqi3 instruction pattern(s).
7409 (define_insn "*iorqi3_zarch"
7410 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7411 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0")
7412 (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q")))
7413 (clobber (reg:CC CC_REGNUM))]
7414 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7422 [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS")
7423 (set_attr "cpu_facility" "*,z196,*,*,*,*")
7424 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,
7425 z10_super,z10_super,*")])
7427 (define_insn "*iorqi3_esa"
7428 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
7429 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
7430 (match_operand:QI 2 "general_operand" "d,n,Q")))
7431 (clobber (reg:CC CC_REGNUM))]
7432 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7437 [(set_attr "op_type" "RR,SI,SS")
7438 (set_attr "z10prop" "z10_super_E1,z10_super,*")])
7441 ; Block inclusive or (OC) patterns.
7445 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7446 (ior:BLK (match_dup 0)
7447 (match_operand:BLK 1 "memory_operand" "Q")))
7448 (use (match_operand 2 "const_int_operand" "n"))
7449 (clobber (reg:CC CC_REGNUM))]
7450 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7451 "oc\t%O0(%2,%R0),%S1"
7452 [(set_attr "op_type" "SS")
7453 (set_attr "z196prop" "z196_cracked")])
7456 [(set (match_operand 0 "memory_operand" "")
7458 (match_operand 1 "memory_operand" "")))
7459 (clobber (reg:CC CC_REGNUM))]
7461 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7462 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7464 [(set (match_dup 0) (ior:BLK (match_dup 0) (match_dup 1)))
7466 (clobber (reg:CC CC_REGNUM))])]
7468 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7469 operands[0] = adjust_address (operands[0], BLKmode, 0);
7470 operands[1] = adjust_address (operands[1], BLKmode, 0);
7475 [(set (match_operand:BLK 0 "memory_operand" "")
7476 (ior:BLK (match_dup 0)
7477 (match_operand:BLK 1 "memory_operand" "")))
7478 (use (match_operand 2 "const_int_operand" ""))
7479 (clobber (reg:CC CC_REGNUM))])
7481 [(set (match_operand:BLK 3 "memory_operand" "")
7482 (ior:BLK (match_dup 3)
7483 (match_operand:BLK 4 "memory_operand" "")))
7484 (use (match_operand 5 "const_int_operand" ""))
7485 (clobber (reg:CC CC_REGNUM))])]
7486 "s390_offset_p (operands[0], operands[3], operands[2])
7487 && s390_offset_p (operands[1], operands[4], operands[2])
7488 && !s390_overlap_p (operands[0], operands[1],
7489 INTVAL (operands[2]) + INTVAL (operands[5]))
7490 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7492 [(set (match_dup 6) (ior:BLK (match_dup 6) (match_dup 7)))
7494 (clobber (reg:CC CC_REGNUM))])]
7495 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7496 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7497 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7501 ;;- Xor instructions.
7504 (define_expand "xor<mode>3"
7505 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7506 (xor:INT (match_operand:INT 1 "nonimmediate_operand" "")
7507 (match_operand:INT 2 "general_operand" "")))
7508 (clobber (reg:CC CC_REGNUM))]
7510 "s390_expand_logical_operator (XOR, <MODE>mode, operands); DONE;")
7512 ; Combine replaces (xor (x) (const_int -1)) with (not (x)) when doing
7513 ; simplifications. So its better to have something matching.
7515 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7516 (not:INT (match_operand:INT 1 "nonimmediate_operand" "")))]
7519 [(set (match_dup 0) (xor:INT (match_dup 1) (match_dup 2)))
7520 (clobber (reg:CC CC_REGNUM))])]
7522 operands[2] = constm1_rtx;
7523 if (!s390_logical_operator_ok_p (operands))
7528 ; xordi3 instruction pattern(s).
7531 (define_insn "*xordi3_cc"
7532 [(set (reg CC_REGNUM)
7533 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7534 (match_operand:DI 2 "general_operand" " d,d,RT"))
7536 (set (match_operand:DI 0 "register_operand" "=d,d, d")
7537 (xor:DI (match_dup 1) (match_dup 2)))]
7538 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7543 [(set_attr "op_type" "RRE,RRF,RXY")
7544 (set_attr "cpu_facility" "*,z196,*")
7545 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7547 (define_insn "*xordi3_cconly"
7548 [(set (reg CC_REGNUM)
7549 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7550 (match_operand:DI 2 "general_operand" " d,d,RT"))
7552 (clobber (match_scratch:DI 0 "=d,d, d"))]
7553 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7558 [(set_attr "op_type" "RRE,RRF,RXY")
7559 (set_attr "cpu_facility" "*,z196,*")
7560 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7562 (define_insn "*xordi3"
7563 [(set (match_operand:DI 0 "nonimmediate_operand" "=d, d,d,d, d, AQ,Q")
7564 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0, 0,0,d, 0, 0,0")
7565 (match_operand:DI 2 "general_operand" "N0SD0,N1SD0,d,d,RT,NxQD0,Q")))
7566 (clobber (reg:CC CC_REGNUM))]
7567 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7576 [(set_attr "op_type" "RIL,RIL,RRE,RRF,RXY,SI,SS")
7577 (set_attr "cpu_facility" "extimm,extimm,*,z196,*,*,*")
7578 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,
7579 *,z10_super_E1,*,*")])
7582 [(set (match_operand:DI 0 "s_operand" "")
7583 (xor:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
7584 (clobber (reg:CC CC_REGNUM))]
7587 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7588 (clobber (reg:CC CC_REGNUM))])]
7589 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7592 ; xorsi3 instruction pattern(s).
7595 (define_insn "*xorsi3_cc"
7596 [(set (reg CC_REGNUM)
7597 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7598 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7600 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
7601 (xor:SI (match_dup 1) (match_dup 2)))]
7602 "s390_match_ccmode(insn, CCTmode)"
7609 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7610 (set_attr "cpu_facility" "*,*,z196,*,*")
7611 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7612 z10_super_E1,z10_super_E1")])
7614 (define_insn "*xorsi3_cconly"
7615 [(set (reg CC_REGNUM)
7616 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7617 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7619 (clobber (match_scratch:SI 0 "=d,d,d,d,d"))]
7620 "s390_match_ccmode(insn, CCTmode)"
7627 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7628 (set_attr "cpu_facility" "*,*,z196,*,*")
7629 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7630 z10_super_E1,z10_super_E1")])
7632 (define_insn "*xorsi3"
7633 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d, AQ,Q")
7634 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, 0,0")
7635 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxQS0,Q")))
7636 (clobber (reg:CC CC_REGNUM))]
7637 "s390_logical_operator_ok_p (operands)"
7646 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,SI,SS")
7647 (set_attr "cpu_facility" "*,*,z196,*,*,*,*")
7648 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7649 z10_super_E1,z10_super_E1,*,*")])
7652 [(set (match_operand:SI 0 "s_operand" "")
7653 (xor:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7654 (clobber (reg:CC CC_REGNUM))]
7657 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7658 (clobber (reg:CC CC_REGNUM))])]
7659 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7662 ; xorhi3 instruction pattern(s).
7665 (define_insn "*xorhi3"
7666 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7667 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,d, 0,0")
7668 (match_operand:HI 2 "general_operand" "Os,d,d,NxQH0,Q")))
7669 (clobber (reg:CC CC_REGNUM))]
7670 "s390_logical_operator_ok_p (operands)"
7677 [(set_attr "op_type" "RIL,RR,RRF,SI,SS")
7678 (set_attr "cpu_facility" "*,*,z196,*,*")
7679 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*,*")])
7682 [(set (match_operand:HI 0 "s_operand" "")
7683 (xor:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7684 (clobber (reg:CC CC_REGNUM))]
7687 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7688 (clobber (reg:CC CC_REGNUM))])]
7689 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7692 ; xorqi3 instruction pattern(s).
7695 (define_insn "*xorqi3"
7696 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7697 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,d,0,0,0")
7698 (match_operand:QI 2 "general_operand" "Os,d,d,n,n,Q")))
7699 (clobber (reg:CC CC_REGNUM))]
7700 "s390_logical_operator_ok_p (operands)"
7708 [(set_attr "op_type" "RIL,RR,RRF,SI,SIY,SS")
7709 (set_attr "cpu_facility" "*,*,z196,*,*,*")
7710 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super,z10_super,*")])
7714 ; Block exclusive or (XC) patterns.
7718 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7719 (xor:BLK (match_dup 0)
7720 (match_operand:BLK 1 "memory_operand" "Q")))
7721 (use (match_operand 2 "const_int_operand" "n"))
7722 (clobber (reg:CC CC_REGNUM))]
7723 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7724 "xc\t%O0(%2,%R0),%S1"
7725 [(set_attr "op_type" "SS")])
7728 [(set (match_operand 0 "memory_operand" "")
7730 (match_operand 1 "memory_operand" "")))
7731 (clobber (reg:CC CC_REGNUM))]
7733 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7734 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7736 [(set (match_dup 0) (xor:BLK (match_dup 0) (match_dup 1)))
7738 (clobber (reg:CC CC_REGNUM))])]
7740 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7741 operands[0] = adjust_address (operands[0], BLKmode, 0);
7742 operands[1] = adjust_address (operands[1], BLKmode, 0);
7747 [(set (match_operand:BLK 0 "memory_operand" "")
7748 (xor:BLK (match_dup 0)
7749 (match_operand:BLK 1 "memory_operand" "")))
7750 (use (match_operand 2 "const_int_operand" ""))
7751 (clobber (reg:CC CC_REGNUM))])
7753 [(set (match_operand:BLK 3 "memory_operand" "")
7754 (xor:BLK (match_dup 3)
7755 (match_operand:BLK 4 "memory_operand" "")))
7756 (use (match_operand 5 "const_int_operand" ""))
7757 (clobber (reg:CC CC_REGNUM))])]
7758 "s390_offset_p (operands[0], operands[3], operands[2])
7759 && s390_offset_p (operands[1], operands[4], operands[2])
7760 && !s390_overlap_p (operands[0], operands[1],
7761 INTVAL (operands[2]) + INTVAL (operands[5]))
7762 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7764 [(set (match_dup 6) (xor:BLK (match_dup 6) (match_dup 7)))
7766 (clobber (reg:CC CC_REGNUM))])]
7767 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7768 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7769 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7772 ; Block xor (XC) patterns with src == dest.
7775 (define_insn "*xc_zero"
7776 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7778 (use (match_operand 1 "const_int_operand" "n"))
7779 (clobber (reg:CC CC_REGNUM))]
7780 "INTVAL (operands[1]) >= 1 && INTVAL (operands[1]) <= 256"
7781 "xc\t%O0(%1,%R0),%S0"
7782 [(set_attr "op_type" "SS")
7783 (set_attr "z196prop" "z196_cracked")])
7787 [(set (match_operand:BLK 0 "memory_operand" "")
7789 (use (match_operand 1 "const_int_operand" ""))
7790 (clobber (reg:CC CC_REGNUM))])
7792 [(set (match_operand:BLK 2 "memory_operand" "")
7794 (use (match_operand 3 "const_int_operand" ""))
7795 (clobber (reg:CC CC_REGNUM))])]
7796 "s390_offset_p (operands[0], operands[2], operands[1])
7797 && INTVAL (operands[1]) + INTVAL (operands[3]) <= 256"
7799 [(set (match_dup 4) (const_int 0))
7801 (clobber (reg:CC CC_REGNUM))])]
7802 "operands[4] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7803 operands[5] = GEN_INT (INTVAL (operands[1]) + INTVAL (operands[3]));")
7807 ;;- Negate instructions.
7811 ; neg(di|si)2 instruction pattern(s).
7814 (define_expand "neg<mode>2"
7816 [(set (match_operand:DSI 0 "register_operand" "=d")
7817 (neg:DSI (match_operand:DSI 1 "register_operand" "d")))
7818 (clobber (reg:CC CC_REGNUM))])]
7822 (define_insn "*negdi2_sign_cc"
7823 [(set (reg CC_REGNUM)
7824 (compare (neg:DI (ashiftrt:DI (ashift:DI (subreg:DI
7825 (match_operand:SI 1 "register_operand" "d") 0)
7826 (const_int 32)) (const_int 32)))
7828 (set (match_operand:DI 0 "register_operand" "=d")
7829 (neg:DI (sign_extend:DI (match_dup 1))))]
7830 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
7832 [(set_attr "op_type" "RRE")
7833 (set_attr "z10prop" "z10_c")])
7835 (define_insn "*negdi2_sign"
7836 [(set (match_operand:DI 0 "register_operand" "=d")
7837 (neg:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
7838 (clobber (reg:CC CC_REGNUM))]
7841 [(set_attr "op_type" "RRE")
7842 (set_attr "z10prop" "z10_c")])
7845 (define_insn "*neg<mode>2_cc"
7846 [(set (reg CC_REGNUM)
7847 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
7849 (set (match_operand:GPR 0 "register_operand" "=d")
7850 (neg:GPR (match_dup 1)))]
7851 "s390_match_ccmode (insn, CCAmode)"
7853 [(set_attr "op_type" "RR<E>")
7854 (set_attr "z10prop" "z10_super_c_E1")])
7857 (define_insn "*neg<mode>2_cconly"
7858 [(set (reg CC_REGNUM)
7859 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
7861 (clobber (match_scratch:GPR 0 "=d"))]
7862 "s390_match_ccmode (insn, CCAmode)"
7864 [(set_attr "op_type" "RR<E>")
7865 (set_attr "z10prop" "z10_super_c_E1")])
7868 (define_insn "*neg<mode>2"
7869 [(set (match_operand:GPR 0 "register_operand" "=d")
7870 (neg:GPR (match_operand:GPR 1 "register_operand" "d")))
7871 (clobber (reg:CC CC_REGNUM))]
7874 [(set_attr "op_type" "RR<E>")
7875 (set_attr "z10prop" "z10_super_c_E1")])
7877 (define_insn "*negdi2_31"
7878 [(set (match_operand:DI 0 "register_operand" "=d")
7879 (neg:DI (match_operand:DI 1 "register_operand" "d")))
7880 (clobber (reg:CC CC_REGNUM))]
7884 ; Split a DImode NEG on 31bit into 2 SImode NEGs
7886 ; Doing the twos complement separately on the SImode parts does an
7887 ; unwanted +1 on the high part which needs to be subtracted afterwards
7888 ; ... unless the +1 on the low part created an overflow.
7891 [(set (match_operand:DI 0 "register_operand" "")
7892 (neg:DI (match_operand:DI 1 "register_operand" "")))
7893 (clobber (reg:CC CC_REGNUM))]
7895 && (REGNO (operands[0]) == REGNO (operands[1])
7896 || s390_split_ok_p (operands[0], operands[1], DImode, 0))
7897 && reload_completed"
7899 [(set (match_dup 2) (neg:SI (match_dup 3)))
7900 (clobber (reg:CC CC_REGNUM))])
7902 [(set (reg:CCAP CC_REGNUM)
7903 (compare:CCAP (neg:SI (match_dup 5)) (const_int 0)))
7904 (set (match_dup 4) (neg:SI (match_dup 5)))])
7906 (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
7908 (label_ref (match_dup 6))))
7910 [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
7911 (clobber (reg:CC CC_REGNUM))])
7913 "operands[2] = operand_subword (operands[0], 0, 0, DImode);
7914 operands[3] = operand_subword (operands[1], 0, 0, DImode);
7915 operands[4] = operand_subword (operands[0], 1, 0, DImode);
7916 operands[5] = operand_subword (operands[1], 1, 0, DImode);
7917 operands[6] = gen_label_rtx ();")
7919 ; Like above but first make a copy of the low part of the src operand
7920 ; since it might overlap with the high part of the destination.
7923 [(set (match_operand:DI 0 "register_operand" "")
7924 (neg:DI (match_operand:DI 1 "register_operand" "")))
7925 (clobber (reg:CC CC_REGNUM))]
7927 && s390_split_ok_p (operands[0], operands[1], DImode, 1)
7928 && reload_completed"
7929 [; Make a backup of op5 first
7930 (set (match_dup 4) (match_dup 5))
7931 ; Setting op2 here might clobber op5
7933 [(set (match_dup 2) (neg:SI (match_dup 3)))
7934 (clobber (reg:CC CC_REGNUM))])
7936 [(set (reg:CCAP CC_REGNUM)
7937 (compare:CCAP (neg:SI (match_dup 4)) (const_int 0)))
7938 (set (match_dup 4) (neg:SI (match_dup 4)))])
7940 (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
7942 (label_ref (match_dup 6))))
7944 [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
7945 (clobber (reg:CC CC_REGNUM))])
7947 "operands[2] = operand_subword (operands[0], 0, 0, DImode);
7948 operands[3] = operand_subword (operands[1], 0, 0, DImode);
7949 operands[4] = operand_subword (operands[0], 1, 0, DImode);
7950 operands[5] = operand_subword (operands[1], 1, 0, DImode);
7951 operands[6] = gen_label_rtx ();")
7954 ; neg(df|sf)2 instruction pattern(s).
7957 (define_expand "neg<mode>2"
7959 [(set (match_operand:BFP 0 "register_operand" "=f")
7960 (neg:BFP (match_operand:BFP 1 "register_operand" "f")))
7961 (clobber (reg:CC CC_REGNUM))])]
7965 ; lcxbr, lcdbr, lcebr
7966 (define_insn "*neg<mode>2_cc"
7967 [(set (reg CC_REGNUM)
7968 (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f"))
7969 (match_operand:BFP 2 "const0_operand" "")))
7970 (set (match_operand:BFP 0 "register_operand" "=f")
7971 (neg:BFP (match_dup 1)))]
7972 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7974 [(set_attr "op_type" "RRE")
7975 (set_attr "type" "fsimp<mode>")])
7977 ; lcxbr, lcdbr, lcebr
7978 (define_insn "*neg<mode>2_cconly"
7979 [(set (reg CC_REGNUM)
7980 (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f"))
7981 (match_operand:BFP 2 "const0_operand" "")))
7982 (clobber (match_scratch:BFP 0 "=f"))]
7983 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7985 [(set_attr "op_type" "RRE")
7986 (set_attr "type" "fsimp<mode>")])
7989 (define_insn "*neg<mode>2_nocc"
7990 [(set (match_operand:FP 0 "register_operand" "=f")
7991 (neg:FP (match_operand:FP 1 "register_operand" "<fT0>")))]
7994 [(set_attr "op_type" "RRE")
7995 (set_attr "type" "fsimp<mode>")])
7997 ; lcxbr, lcdbr, lcebr
7998 ; FIXME: wflcdb does not clobber cc
7999 (define_insn "*neg<mode>2"
8000 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
8001 (neg:BFP (match_operand:BFP 1 "register_operand" "f,<vf>")))
8002 (clobber (reg:CC CC_REGNUM))]
8007 [(set_attr "op_type" "RRE,VRR")
8008 (set_attr "cpu_facility" "*,vec")
8009 (set_attr "type" "fsimp<mode>,*")])
8013 ;;- Absolute value instructions.
8017 ; abs(di|si)2 instruction pattern(s).
8020 (define_insn "*absdi2_sign_cc"
8021 [(set (reg CC_REGNUM)
8022 (compare (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
8023 (match_operand:SI 1 "register_operand" "d") 0)
8024 (const_int 32)) (const_int 32)))
8026 (set (match_operand:DI 0 "register_operand" "=d")
8027 (abs:DI (sign_extend:DI (match_dup 1))))]
8028 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
8030 [(set_attr "op_type" "RRE")
8031 (set_attr "z10prop" "z10_c")])
8033 (define_insn "*absdi2_sign"
8034 [(set (match_operand:DI 0 "register_operand" "=d")
8035 (abs:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
8036 (clobber (reg:CC CC_REGNUM))]
8039 [(set_attr "op_type" "RRE")
8040 (set_attr "z10prop" "z10_c")])
8043 (define_insn "*abs<mode>2_cc"
8044 [(set (reg CC_REGNUM)
8045 (compare (abs:GPR (match_operand:DI 1 "register_operand" "d"))
8047 (set (match_operand:GPR 0 "register_operand" "=d")
8048 (abs:GPR (match_dup 1)))]
8049 "s390_match_ccmode (insn, CCAmode)"
8051 [(set_attr "op_type" "RR<E>")
8052 (set_attr "z10prop" "z10_c")])
8055 (define_insn "*abs<mode>2_cconly"
8056 [(set (reg CC_REGNUM)
8057 (compare (abs:GPR (match_operand:GPR 1 "register_operand" "d"))
8059 (clobber (match_scratch:GPR 0 "=d"))]
8060 "s390_match_ccmode (insn, CCAmode)"
8062 [(set_attr "op_type" "RR<E>")
8063 (set_attr "z10prop" "z10_c")])
8066 (define_insn "abs<mode>2"
8067 [(set (match_operand:GPR 0 "register_operand" "=d")
8068 (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8069 (clobber (reg:CC CC_REGNUM))]
8072 [(set_attr "op_type" "RR<E>")
8073 (set_attr "z10prop" "z10_c")])
8076 ; abs(df|sf)2 instruction pattern(s).
8079 (define_expand "abs<mode>2"
8081 [(set (match_operand:BFP 0 "register_operand" "=f")
8082 (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8083 (clobber (reg:CC CC_REGNUM))])]
8087 ; lpxbr, lpdbr, lpebr
8088 (define_insn "*abs<mode>2_cc"
8089 [(set (reg CC_REGNUM)
8090 (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f"))
8091 (match_operand:BFP 2 "const0_operand" "")))
8092 (set (match_operand:BFP 0 "register_operand" "=f")
8093 (abs:BFP (match_dup 1)))]
8094 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8096 [(set_attr "op_type" "RRE")
8097 (set_attr "type" "fsimp<mode>")])
8099 ; lpxbr, lpdbr, lpebr
8100 (define_insn "*abs<mode>2_cconly"
8101 [(set (reg CC_REGNUM)
8102 (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f"))
8103 (match_operand:BFP 2 "const0_operand" "")))
8104 (clobber (match_scratch:BFP 0 "=f"))]
8105 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8107 [(set_attr "op_type" "RRE")
8108 (set_attr "type" "fsimp<mode>")])
8111 (define_insn "*abs<mode>2_nocc"
8112 [(set (match_operand:FP 0 "register_operand" "=f")
8113 (abs:FP (match_operand:FP 1 "register_operand" "<fT0>")))]
8116 [(set_attr "op_type" "RRE")
8117 (set_attr "type" "fsimp<mode>")])
8119 ; lpxbr, lpdbr, lpebr
8120 ; FIXME: wflpdb does not clobber cc
8121 (define_insn "*abs<mode>2"
8122 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
8123 (abs:BFP (match_operand:BFP 1 "register_operand" "f,<vf>")))
8124 (clobber (reg:CC CC_REGNUM))]
8129 [(set_attr "op_type" "RRE,VRR")
8130 (set_attr "cpu_facility" "*,vec")
8131 (set_attr "type" "fsimp<mode>,*")])
8135 ;;- Negated absolute value instructions
8142 (define_insn "*negabsdi2_sign_cc"
8143 [(set (reg CC_REGNUM)
8144 (compare (neg:DI (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
8145 (match_operand:SI 1 "register_operand" "d") 0)
8146 (const_int 32)) (const_int 32))))
8148 (set (match_operand:DI 0 "register_operand" "=d")
8149 (neg:DI (abs:DI (sign_extend:DI (match_dup 1)))))]
8150 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
8152 [(set_attr "op_type" "RRE")
8153 (set_attr "z10prop" "z10_c")])
8155 (define_insn "*negabsdi2_sign"
8156 [(set (match_operand:DI 0 "register_operand" "=d")
8157 (neg:DI (abs:DI (sign_extend:DI
8158 (match_operand:SI 1 "register_operand" "d")))))
8159 (clobber (reg:CC CC_REGNUM))]
8162 [(set_attr "op_type" "RRE")
8163 (set_attr "z10prop" "z10_c")])
8166 (define_insn "*negabs<mode>2_cc"
8167 [(set (reg CC_REGNUM)
8168 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8170 (set (match_operand:GPR 0 "register_operand" "=d")
8171 (neg:GPR (abs:GPR (match_dup 1))))]
8172 "s390_match_ccmode (insn, CCAmode)"
8174 [(set_attr "op_type" "RR<E>")
8175 (set_attr "z10prop" "z10_c")])
8178 (define_insn "*negabs<mode>2_cconly"
8179 [(set (reg CC_REGNUM)
8180 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8182 (clobber (match_scratch:GPR 0 "=d"))]
8183 "s390_match_ccmode (insn, CCAmode)"
8185 [(set_attr "op_type" "RR<E>")
8186 (set_attr "z10prop" "z10_c")])
8189 (define_insn "*negabs<mode>2"
8190 [(set (match_operand:GPR 0 "register_operand" "=d")
8191 (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d"))))
8192 (clobber (reg:CC CC_REGNUM))]
8195 [(set_attr "op_type" "RR<E>")
8196 (set_attr "z10prop" "z10_c")])
8202 ; lnxbr, lndbr, lnebr
8203 (define_insn "*negabs<mode>2_cc"
8204 [(set (reg CC_REGNUM)
8205 (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8206 (match_operand:BFP 2 "const0_operand" "")))
8207 (set (match_operand:BFP 0 "register_operand" "=f")
8208 (neg:BFP (abs:BFP (match_dup 1))))]
8209 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8211 [(set_attr "op_type" "RRE")
8212 (set_attr "type" "fsimp<mode>")])
8214 ; lnxbr, lndbr, lnebr
8215 (define_insn "*negabs<mode>2_cconly"
8216 [(set (reg CC_REGNUM)
8217 (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8218 (match_operand:BFP 2 "const0_operand" "")))
8219 (clobber (match_scratch:BFP 0 "=f"))]
8220 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8222 [(set_attr "op_type" "RRE")
8223 (set_attr "type" "fsimp<mode>")])
8226 (define_insn "*negabs<mode>2_nocc"
8227 [(set (match_operand:FP 0 "register_operand" "=f")
8228 (neg:FP (abs:FP (match_operand:BFP 1 "register_operand" "<fT0>"))))]
8231 [(set_attr "op_type" "RRE")
8232 (set_attr "type" "fsimp<mode>")])
8234 ; lnxbr, lndbr, lnebr
8235 ; FIXME: wflndb does not clobber cc
8236 (define_insn "*negabs<mode>2"
8237 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
8238 (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f,<vf>"))))
8239 (clobber (reg:CC CC_REGNUM))]
8244 [(set_attr "op_type" "RRE,VRR")
8245 (set_attr "cpu_facility" "*,vec")
8246 (set_attr "type" "fsimp<mode>,*")])
8249 ;;- Square root instructions.
8253 ; sqrt(df|sf)2 instruction pattern(s).
8256 ; sqxbr, sqdbr, sqebr, sqdb, sqeb
8257 (define_insn "sqrt<mode>2"
8258 [(set (match_operand:BFP 0 "register_operand" "=f, f,<vf>")
8259 (sqrt:BFP (match_operand:BFP 1 "general_operand" "f,<Rf>,<vf>")))]
8265 [(set_attr "op_type" "RRE,RXE,VRR")
8266 (set_attr "type" "fsqrt<mode>")
8267 (set_attr "cpu_facility" "*,*,vec")])
8271 ;;- One complement instructions.
8275 ; one_cmpl(di|si|hi|qi)2 instruction pattern(s).
8278 (define_expand "one_cmpl<mode>2"
8280 [(set (match_operand:INT 0 "register_operand" "")
8281 (xor:INT (match_operand:INT 1 "register_operand" "")
8283 (clobber (reg:CC CC_REGNUM))])]
8289 ;; Find leftmost bit instructions.
8292 (define_expand "clzdi2"
8293 [(set (match_operand:DI 0 "register_operand" "=d")
8294 (clz:DI (match_operand:DI 1 "register_operand" "d")))]
8295 "TARGET_EXTIMM && TARGET_ZARCH"
8297 rtx insn, clz_equal;
8298 rtx wide_reg = gen_reg_rtx (TImode);
8299 rtx msb = gen_rtx_CONST_INT (DImode, (unsigned HOST_WIDE_INT) 1 << 63);
8301 clz_equal = gen_rtx_CLZ (DImode, operands[1]);
8303 emit_insn (gen_clztidi2 (wide_reg, operands[1], msb));
8305 insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg));
8306 set_unique_reg_note (insn, REG_EQUAL, clz_equal);
8311 (define_insn "clztidi2"
8312 [(set (match_operand:TI 0 "register_operand" "=d")
8316 (xor:DI (match_operand:DI 1 "register_operand" "d")
8317 (lshiftrt (match_operand:DI 2 "const_int_operand" "")
8318 (subreg:SI (clz:DI (match_dup 1)) 4))))
8321 (zero_extend:TI (clz:DI (match_dup 1)))))
8322 (clobber (reg:CC CC_REGNUM))]
8323 "(unsigned HOST_WIDE_INT) INTVAL (operands[2])
8324 == (unsigned HOST_WIDE_INT) 1 << 63
8325 && TARGET_EXTIMM && TARGET_ZARCH"
8327 [(set_attr "op_type" "RRE")])
8331 ;;- Rotate instructions.
8335 ; rotl(di|si)3 instruction pattern(s).
8339 (define_insn "rotl<mode>3"
8340 [(set (match_operand:GPR 0 "register_operand" "=d")
8341 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
8342 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
8345 [(set_attr "op_type" "RSE")
8346 (set_attr "atype" "reg")
8347 (set_attr "z10prop" "z10_super_E1")])
8350 (define_insn "*rotl<mode>3_and"
8351 [(set (match_operand:GPR 0 "register_operand" "=d")
8352 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
8353 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8354 (match_operand:SI 3 "const_int_operand" "n"))))]
8355 "TARGET_CPU_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8357 [(set_attr "op_type" "RSE")
8358 (set_attr "atype" "reg")
8359 (set_attr "z10prop" "z10_super_E1")])
8363 ;;- Shift instructions.
8367 ; (ashl|lshr)(di|si)3 instruction pattern(s).
8368 ; Left shifts and logical right shifts
8370 (define_expand "<shift><mode>3"
8371 [(set (match_operand:DSI 0 "register_operand" "")
8372 (SHIFT:DSI (match_operand:DSI 1 "register_operand" "")
8373 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))]
8378 (define_insn "*<shift>di3_31"
8379 [(set (match_operand:DI 0 "register_operand" "=d")
8380 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
8381 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
8384 [(set_attr "op_type" "RS")
8385 (set_attr "atype" "reg")
8386 (set_attr "z196prop" "z196_cracked")])
8388 ; sll, srl, sllg, srlg, sllk, srlk
8389 (define_insn "*<shift><mode>3"
8390 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8391 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8392 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")))]
8395 s<lr>l<g>\t%0,<1>%Y2
8396 s<lr>l<gk>\t%0,%1,%Y2"
8397 [(set_attr "op_type" "RS<E>,RSY")
8398 (set_attr "atype" "reg,reg")
8399 (set_attr "cpu_facility" "*,z196")
8400 (set_attr "z10prop" "z10_super_E1,*")])
8403 (define_insn "*<shift>di3_31_and"
8404 [(set (match_operand:DI 0 "register_operand" "=d")
8405 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
8406 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8407 (match_operand:SI 3 "const_int_operand" "n"))))]
8408 "!TARGET_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8410 [(set_attr "op_type" "RS")
8411 (set_attr "atype" "reg")])
8413 ; sll, srl, sllg, srlg, sllk, srlk
8414 (define_insn "*<shift><mode>3_and"
8415 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8416 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8417 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8418 (match_operand:SI 3 "const_int_operand" "n,n"))))]
8419 "(INTVAL (operands[3]) & 63) == 63"
8421 s<lr>l<g>\t%0,<1>%Y2
8422 s<lr>l<gk>\t%0,%1,%Y2"
8423 [(set_attr "op_type" "RS<E>,RSY")
8424 (set_attr "atype" "reg,reg")
8425 (set_attr "cpu_facility" "*,z196")
8426 (set_attr "z10prop" "z10_super_E1,*")])
8429 ; ashr(di|si)3 instruction pattern(s).
8430 ; Arithmetic right shifts
8432 (define_expand "ashr<mode>3"
8434 [(set (match_operand:DSI 0 "register_operand" "")
8435 (ashiftrt:DSI (match_operand:DSI 1 "register_operand" "")
8436 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))
8437 (clobber (reg:CC CC_REGNUM))])]
8441 (define_insn "*ashrdi3_cc_31"
8442 [(set (reg CC_REGNUM)
8443 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8444 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
8446 (set (match_operand:DI 0 "register_operand" "=d")
8447 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8448 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)"
8450 [(set_attr "op_type" "RS")
8451 (set_attr "atype" "reg")])
8453 (define_insn "*ashrdi3_cconly_31"
8454 [(set (reg CC_REGNUM)
8455 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8456 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
8458 (clobber (match_scratch:DI 0 "=d"))]
8459 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)"
8461 [(set_attr "op_type" "RS")
8462 (set_attr "atype" "reg")])
8464 (define_insn "*ashrdi3_31"
8465 [(set (match_operand:DI 0 "register_operand" "=d")
8466 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8467 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))
8468 (clobber (reg:CC CC_REGNUM))]
8471 [(set_attr "op_type" "RS")
8472 (set_attr "atype" "reg")])
8475 (define_insn "*ashr<mode>3_cc"
8476 [(set (reg CC_REGNUM)
8477 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8478 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y"))
8480 (set (match_operand:GPR 0 "register_operand" "=d,d")
8481 (ashiftrt:GPR (match_dup 1) (match_dup 2)))]
8482 "s390_match_ccmode(insn, CCSmode)"
8486 [(set_attr "op_type" "RS<E>,RSY")
8487 (set_attr "atype" "reg,reg")
8488 (set_attr "cpu_facility" "*,z196")
8489 (set_attr "z10prop" "z10_super_E1,*")])
8492 (define_insn "*ashr<mode>3_cconly"
8493 [(set (reg CC_REGNUM)
8494 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8495 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y"))
8497 (clobber (match_scratch:GPR 0 "=d,d"))]
8498 "s390_match_ccmode(insn, CCSmode)"
8502 [(set_attr "op_type" "RS<E>,RSY")
8503 (set_attr "atype" "reg,reg")
8504 (set_attr "cpu_facility" "*,z196")
8505 (set_attr "z10prop" "z10_super_E1,*")])
8508 (define_insn "*ashr<mode>3"
8509 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8510 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8511 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")))
8512 (clobber (reg:CC CC_REGNUM))]
8517 [(set_attr "op_type" "RS<E>,RSY")
8518 (set_attr "atype" "reg,reg")
8519 (set_attr "cpu_facility" "*,z196")
8520 (set_attr "z10prop" "z10_super_E1,*")])
8523 ; shift pattern with implicit ANDs
8525 (define_insn "*ashrdi3_cc_31_and"
8526 [(set (reg CC_REGNUM)
8527 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8528 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8529 (match_operand:SI 3 "const_int_operand" "n")))
8531 (set (match_operand:DI 0 "register_operand" "=d")
8532 (ashiftrt:DI (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
8533 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)
8534 && (INTVAL (operands[3]) & 63) == 63"
8536 [(set_attr "op_type" "RS")
8537 (set_attr "atype" "reg")])
8539 (define_insn "*ashrdi3_cconly_31_and"
8540 [(set (reg CC_REGNUM)
8541 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8542 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8543 (match_operand:SI 3 "const_int_operand" "n")))
8545 (clobber (match_scratch:DI 0 "=d"))]
8546 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)
8547 && (INTVAL (operands[3]) & 63) == 63"
8549 [(set_attr "op_type" "RS")
8550 (set_attr "atype" "reg")])
8552 (define_insn "*ashrdi3_31_and"
8553 [(set (match_operand:DI 0 "register_operand" "=d")
8554 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8555 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8556 (match_operand:SI 3 "const_int_operand" "n"))))
8557 (clobber (reg:CC CC_REGNUM))]
8558 "!TARGET_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8560 [(set_attr "op_type" "RS")
8561 (set_attr "atype" "reg")])
8564 (define_insn "*ashr<mode>3_cc_and"
8565 [(set (reg CC_REGNUM)
8566 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8567 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8568 (match_operand:SI 3 "const_int_operand" "n,n")))
8570 (set (match_operand:GPR 0 "register_operand" "=d,d")
8571 (ashiftrt:GPR (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
8572 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
8576 [(set_attr "op_type" "RS<E>,RSY")
8577 (set_attr "atype" "reg,reg")
8578 (set_attr "cpu_facility" "*,z196")
8579 (set_attr "z10prop" "z10_super_E1,*")])
8582 (define_insn "*ashr<mode>3_cconly_and"
8583 [(set (reg CC_REGNUM)
8584 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8585 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8586 (match_operand:SI 3 "const_int_operand" "n,n")))
8588 (clobber (match_scratch:GPR 0 "=d,d"))]
8589 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
8593 [(set_attr "op_type" "RS<E>,RSY")
8594 (set_attr "atype" "reg,reg")
8595 (set_attr "cpu_facility" "*,z196")
8596 (set_attr "z10prop" "z10_super_E1,*")])
8599 (define_insn "*ashr<mode>3_and"
8600 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8601 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8602 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8603 (match_operand:SI 3 "const_int_operand" "n,n"))))
8604 (clobber (reg:CC CC_REGNUM))]
8605 "(INTVAL (operands[3]) & 63) == 63"
8609 [(set_attr "op_type" "RS<E>,RSY")
8610 (set_attr "atype" "reg,reg")
8611 (set_attr "cpu_facility" "*,z196")
8612 (set_attr "z10prop" "z10_super_E1,*")])
8616 ;; Branch instruction patterns.
8619 (define_expand "cbranch<mode>4"
8621 (if_then_else (match_operator 0 "comparison_operator"
8622 [(match_operand:GPR 1 "register_operand" "")
8623 (match_operand:GPR 2 "general_operand" "")])
8624 (label_ref (match_operand 3 "" ""))
8627 "s390_emit_jump (operands[3],
8628 s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2]));
8631 (define_expand "cbranch<mode>4"
8633 (if_then_else (match_operator 0 "comparison_operator"
8634 [(match_operand:FP 1 "register_operand" "")
8635 (match_operand:FP 2 "general_operand" "")])
8636 (label_ref (match_operand 3 "" ""))
8639 "s390_emit_jump (operands[3],
8640 s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2]));
8643 (define_expand "cbranchcc4"
8645 (if_then_else (match_operator 0 "s390_comparison"
8646 [(match_operand 1 "cc_reg_operand" "")
8647 (match_operand 2 "const_int_operand" "")])
8648 (label_ref (match_operand 3 "" ""))
8655 ;;- Conditional jump instructions.
8658 (define_insn "*cjump_64"
8661 (match_operator 1 "s390_comparison" [(reg CC_REGNUM)
8662 (match_operand 2 "const_int_operand" "")])
8663 (label_ref (match_operand 0 "" ""))
8667 if (get_attr_length (insn) == 4)
8670 return "jg%C1\t%l0";
8672 [(set_attr "op_type" "RI")
8673 (set_attr "type" "branch")
8674 (set (attr "length")
8675 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8676 (const_int 4) (const_int 6)))])
8678 (define_insn "*cjump_31"
8681 (match_operator 1 "s390_comparison" [(reg CC_REGNUM)
8682 (match_operand 2 "const_int_operand" "")])
8683 (label_ref (match_operand 0 "" ""))
8687 gcc_assert (get_attr_length (insn) == 4);
8690 [(set_attr "op_type" "RI")
8691 (set_attr "type" "branch")
8692 (set (attr "length")
8693 (if_then_else (not (match_test "flag_pic"))
8694 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8695 (const_int 4) (const_int 6))
8696 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8697 (const_int 4) (const_int 8))))])
8699 (define_insn "*cjump_long"
8702 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8703 (match_operand 0 "address_operand" "ZQZR")
8707 if (get_attr_op_type (insn) == OP_TYPE_RR)
8712 [(set (attr "op_type")
8713 (if_then_else (match_operand 0 "register_operand" "")
8714 (const_string "RR") (const_string "RX")))
8715 (set_attr "type" "branch")
8716 (set_attr "atype" "agen")])
8718 ;; A conditional return instruction.
8719 (define_insn "*c<code>"
8722 (match_operator 0 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8725 "s390_can_use_<code>_insn ()"
8727 [(set_attr "op_type" "RR")
8728 (set_attr "type" "jsr")
8729 (set_attr "atype" "agen")])
8732 ;;- Negated conditional jump instructions.
8735 (define_insn "*icjump_64"
8738 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8740 (label_ref (match_operand 0 "" ""))))]
8743 if (get_attr_length (insn) == 4)
8746 return "jg%D1\t%l0";
8748 [(set_attr "op_type" "RI")
8749 (set_attr "type" "branch")
8750 (set (attr "length")
8751 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8752 (const_int 4) (const_int 6)))])
8754 (define_insn "*icjump_31"
8757 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8759 (label_ref (match_operand 0 "" ""))))]
8762 gcc_assert (get_attr_length (insn) == 4);
8765 [(set_attr "op_type" "RI")
8766 (set_attr "type" "branch")
8767 (set (attr "length")
8768 (if_then_else (not (match_test "flag_pic"))
8769 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8770 (const_int 4) (const_int 6))
8771 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8772 (const_int 4) (const_int 8))))])
8774 (define_insn "*icjump_long"
8777 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8779 (match_operand 0 "address_operand" "ZQZR")))]
8782 if (get_attr_op_type (insn) == OP_TYPE_RR)
8787 [(set (attr "op_type")
8788 (if_then_else (match_operand 0 "register_operand" "")
8789 (const_string "RR") (const_string "RX")))
8790 (set_attr "type" "branch")
8791 (set_attr "atype" "agen")])
8794 ;;- Trap instructions.
8798 [(trap_if (const_int 1) (const_int 0))]
8801 [(set_attr "op_type" "RI")
8802 (set_attr "type" "branch")])
8804 (define_expand "ctrap<mode>4"
8805 [(trap_if (match_operator 0 "comparison_operator"
8806 [(match_operand:GPR 1 "register_operand" "")
8807 (match_operand:GPR 2 "general_operand" "")])
8808 (match_operand 3 "const0_operand" ""))]
8811 rtx cond = s390_emit_compare (GET_CODE (operands[0]),
8812 operands[1], operands[2]);
8813 emit_insn (gen_condtrap (cond, XEXP (cond, 0)));
8817 (define_expand "ctrap<mode>4"
8818 [(trap_if (match_operator 0 "comparison_operator"
8819 [(match_operand:FP 1 "register_operand" "")
8820 (match_operand:FP 2 "general_operand" "")])
8821 (match_operand 3 "const0_operand" ""))]
8824 rtx cond = s390_emit_compare (GET_CODE (operands[0]),
8825 operands[1], operands[2]);
8826 emit_insn (gen_condtrap (cond, XEXP (cond, 0)));
8830 (define_insn "condtrap"
8831 [(trap_if (match_operator 0 "s390_comparison"
8832 [(match_operand 1 "cc_reg_operand" "c")
8837 [(set_attr "op_type" "RI")
8838 (set_attr "type" "branch")])
8840 ; crt, cgrt, cit, cgit
8841 (define_insn "*cmp_and_trap_signed_int<mode>"
8842 [(trap_if (match_operator 0 "s390_signed_integer_comparison"
8843 [(match_operand:GPR 1 "register_operand" "d,d")
8844 (match_operand:GPR 2 "nonmemory_operand" "d,K")])
8850 [(set_attr "op_type" "RRF,RIE")
8851 (set_attr "type" "branch")
8852 (set_attr "z10prop" "z10_super_c,z10_super")])
8854 ; clrt, clgrt, clfit, clgit, clt, clgt
8855 (define_insn "*cmp_and_trap_unsigned_int<mode>"
8856 [(trap_if (match_operator 0 "s390_unsigned_integer_comparison"
8857 [(match_operand:GPR 1 "register_operand" "d,d, d")
8858 (match_operand:GPR 2 "general_operand" "d,D,RT")])
8865 [(set_attr "op_type" "RRF,RIE,RSY")
8866 (set_attr "type" "branch")
8867 (set_attr "z10prop" "z10_super_c,z10_super,*")
8868 (set_attr "cpu_facility" "z10,z10,zEC12")])
8871 (define_insn "*load_and_trap<mode>"
8872 [(trap_if (eq (match_operand:GPR 0 "memory_operand" "RT")
8875 (set (match_operand:GPR 1 "register_operand" "=d")
8879 [(set_attr "op_type" "RXY")])
8883 ;;- Loop instructions.
8885 ;; This is all complicated by the fact that since this is a jump insn
8886 ;; we must handle our own output reloads.
8890 ; This splitter will be matched by combine and has to add the 2 moves
8891 ; necessary to load the compare and the increment values into a
8892 ; register pair as needed by brxle.
8894 (define_insn_and_split "*brx_stage1_<GPR:mode>"
8897 (match_operator 6 "s390_brx_operator"
8898 [(plus:GPR (match_operand:GPR 1 "register_operand" "")
8899 (match_operand:GPR 2 "general_operand" ""))
8900 (match_operand:GPR 3 "register_operand" "")])
8901 (label_ref (match_operand 0 "" ""))
8903 (set (match_operand:GPR 4 "nonimmediate_operand" "")
8904 (plus:GPR (match_dup 1) (match_dup 2)))
8905 (clobber (match_scratch:GPR 5 ""))]
8908 "!reload_completed && !reload_in_progress"
8909 [(set (match_dup 7) (match_dup 2)) ; the increment
8910 (set (match_dup 8) (match_dup 3)) ; the comparison value
8911 (parallel [(set (pc)
8914 [(plus:GPR (match_dup 1) (match_dup 7))
8916 (label_ref (match_dup 0))
8919 (plus:GPR (match_dup 1) (match_dup 7)))
8920 (clobber (match_dup 5))
8921 (clobber (reg:CC CC_REGNUM))])]
8923 rtx dreg = gen_reg_rtx (word_mode == DImode ? TImode : DImode);
8924 operands[7] = gen_lowpart (<GPR:MODE>mode,
8925 gen_highpart (word_mode, dreg));
8926 operands[8] = gen_lowpart (<GPR:MODE>mode,
8927 gen_lowpart (word_mode, dreg));
8932 (define_insn_and_split "*brxg_64bit"
8935 (match_operator 5 "s390_brx_operator"
8936 [(plus:DI (match_operand:DI 1 "register_operand" "d,d,d")
8937 (subreg:DI (match_operand:TI 2 "register_operand" "d,d,d") 0))
8938 (subreg:DI (match_dup 2) 8)])
8939 (label_ref (match_operand 0 "" ""))
8941 (set (match_operand:DI 3 "nonimmediate_operand" "=1,?X,?X")
8942 (plus:DI (match_dup 1)
8943 (subreg:DI (match_dup 2) 0)))
8944 (clobber (match_scratch:DI 4 "=X,&1,&?d"))
8945 (clobber (reg:CC CC_REGNUM))]
8948 if (which_alternative != 0)
8950 else if (get_attr_length (insn) == 6)
8951 return "brx%E5g\t%1,%2,%l0";
8953 return "agr\t%1,%2\;cgr\t%1,%M2\;jg%C5\t%l0";
8955 "&& reload_completed
8956 && (!REG_P (operands[3])
8957 || !rtx_equal_p (operands[1], operands[3]))"
8958 [(set (match_dup 4) (match_dup 1))
8959 (parallel [(set (match_dup 4) (plus:DI (match_dup 4) (subreg:DI (match_dup 2) 0)))
8960 (clobber (reg:CC CC_REGNUM))])
8961 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:DI (match_dup 2) 8)))
8962 (set (match_dup 3) (match_dup 4))
8963 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
8964 (label_ref (match_dup 0))
8967 [(set_attr "op_type" "RIE")
8968 (set_attr "type" "branch")
8969 (set (attr "length")
8970 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8971 (const_int 6) (const_int 16)))])
8975 (define_insn_and_split "*brx_64bit"
8978 (match_operator 5 "s390_brx_operator"
8979 [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d")
8980 (subreg:SI (match_operand:TI 2 "register_operand" "d,d,d") 4))
8981 (subreg:SI (match_dup 2) 12)])
8982 (label_ref (match_operand 0 "" ""))
8984 (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X")
8985 (plus:SI (match_dup 1)
8986 (subreg:SI (match_dup 2) 4)))
8987 (clobber (match_scratch:SI 4 "=X,&1,&?d"))
8988 (clobber (reg:CC CC_REGNUM))]
8991 if (which_alternative != 0)
8993 else if (get_attr_length (insn) == 6)
8994 return "brx%C5\t%1,%2,%l0";
8996 return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0";
8998 "&& reload_completed
8999 && (!REG_P (operands[3])
9000 || !rtx_equal_p (operands[1], operands[3]))"
9001 [(set (match_dup 4) (match_dup 1))
9002 (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 4)))
9003 (clobber (reg:CC CC_REGNUM))])
9004 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 12)))
9005 (set (match_dup 3) (match_dup 4))
9006 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
9007 (label_ref (match_dup 0))
9010 [(set_attr "op_type" "RSI")
9011 (set_attr "type" "branch")
9012 (set (attr "length")
9013 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9014 (const_int 6) (const_int 14)))])
9018 (define_insn_and_split "*brx_31bit"
9021 (match_operator 5 "s390_brx_operator"
9022 [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d")
9023 (subreg:SI (match_operand:DI 2 "register_operand" "d,d,d") 0))
9024 (subreg:SI (match_dup 2) 4)])
9025 (label_ref (match_operand 0 "" ""))
9027 (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X")
9028 (plus:SI (match_dup 1)
9029 (subreg:SI (match_dup 2) 0)))
9030 (clobber (match_scratch:SI 4 "=X,&1,&?d"))
9031 (clobber (reg:CC CC_REGNUM))]
9032 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
9034 if (which_alternative != 0)
9036 else if (get_attr_length (insn) == 6)
9037 return "brx%C5\t%1,%2,%l0";
9039 return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0";
9041 "&& reload_completed
9042 && (!REG_P (operands[3])
9043 || !rtx_equal_p (operands[1], operands[3]))"
9044 [(set (match_dup 4) (match_dup 1))
9045 (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 0)))
9046 (clobber (reg:CC CC_REGNUM))])
9047 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 4)))
9048 (set (match_dup 3) (match_dup 4))
9049 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
9050 (label_ref (match_dup 0))
9053 [(set_attr "op_type" "RSI")
9054 (set_attr "type" "branch")
9055 (set (attr "length")
9056 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9057 (const_int 6) (const_int 14)))])
9062 (define_expand "doloop_end"
9063 [(use (match_operand 0 "" "")) ; loop pseudo
9064 (use (match_operand 1 "" ""))] ; label
9067 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
9068 emit_jump_insn (gen_doloop_si31 (operands[1], operands[0], operands[0]));
9069 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
9070 emit_jump_insn (gen_doloop_si64 (operands[1], operands[0], operands[0]));
9071 else if (GET_MODE (operands[0]) == DImode && TARGET_ZARCH)
9072 emit_jump_insn (gen_doloop_di (operands[1], operands[0], operands[0]));
9079 (define_insn_and_split "doloop_si64"
9082 (ne (match_operand:SI 1 "register_operand" "d,d,d")
9084 (label_ref (match_operand 0 "" ""))
9086 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?X,?X")
9087 (plus:SI (match_dup 1) (const_int -1)))
9088 (clobber (match_scratch:SI 3 "=X,&1,&?d"))
9089 (clobber (reg:CC CC_REGNUM))]
9092 if (which_alternative != 0)
9094 else if (get_attr_length (insn) == 4)
9095 return "brct\t%1,%l0";
9097 return "ahi\t%1,-1\;jgne\t%l0";
9099 "&& reload_completed
9100 && (! REG_P (operands[2])
9101 || ! rtx_equal_p (operands[1], operands[2]))"
9102 [(set (match_dup 3) (match_dup 1))
9103 (parallel [(set (reg:CCAN CC_REGNUM)
9104 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
9106 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
9107 (set (match_dup 2) (match_dup 3))
9108 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9109 (label_ref (match_dup 0))
9112 [(set_attr "op_type" "RI")
9113 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9114 ; hurt us in the (rare) case of ahi.
9115 (set_attr "z10prop" "z10_super_E1")
9116 (set_attr "type" "branch")
9117 (set (attr "length")
9118 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9119 (const_int 4) (const_int 10)))])
9121 (define_insn_and_split "doloop_si31"
9124 (ne (match_operand:SI 1 "register_operand" "d,d,d")
9126 (label_ref (match_operand 0 "" ""))
9128 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?X,?X")
9129 (plus:SI (match_dup 1) (const_int -1)))
9130 (clobber (match_scratch:SI 3 "=X,&1,&?d"))
9131 (clobber (reg:CC CC_REGNUM))]
9134 if (which_alternative != 0)
9136 else if (get_attr_length (insn) == 4)
9137 return "brct\t%1,%l0";
9141 "&& reload_completed
9142 && (! REG_P (operands[2])
9143 || ! rtx_equal_p (operands[1], operands[2]))"
9144 [(set (match_dup 3) (match_dup 1))
9145 (parallel [(set (reg:CCAN CC_REGNUM)
9146 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
9148 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
9149 (set (match_dup 2) (match_dup 3))
9150 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9151 (label_ref (match_dup 0))
9154 [(set_attr "op_type" "RI")
9155 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9156 ; hurt us in the (rare) case of ahi.
9157 (set_attr "z10prop" "z10_super_E1")
9158 (set_attr "type" "branch")
9159 (set (attr "length")
9160 (if_then_else (not (match_test "flag_pic"))
9161 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9162 (const_int 4) (const_int 6))
9163 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9164 (const_int 4) (const_int 8))))])
9166 (define_insn "*doloop_si_long"
9169 (ne (match_operand:SI 1 "register_operand" "d")
9171 (match_operand 0 "address_operand" "ZQZR")
9173 (set (match_operand:SI 2 "register_operand" "=1")
9174 (plus:SI (match_dup 1) (const_int -1)))
9175 (clobber (match_scratch:SI 3 "=X"))
9176 (clobber (reg:CC CC_REGNUM))]
9179 if (get_attr_op_type (insn) == OP_TYPE_RR)
9180 return "bctr\t%1,%0";
9182 return "bct\t%1,%a0";
9184 [(set (attr "op_type")
9185 (if_then_else (match_operand 0 "register_operand" "")
9186 (const_string "RR") (const_string "RX")))
9187 (set_attr "type" "branch")
9188 (set_attr "atype" "agen")
9189 (set_attr "z10prop" "z10_c")
9190 (set_attr "z196prop" "z196_cracked")])
9192 (define_insn_and_split "doloop_di"
9195 (ne (match_operand:DI 1 "register_operand" "d,d,d")
9197 (label_ref (match_operand 0 "" ""))
9199 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?X,?X")
9200 (plus:DI (match_dup 1) (const_int -1)))
9201 (clobber (match_scratch:DI 3 "=X,&1,&?d"))
9202 (clobber (reg:CC CC_REGNUM))]
9205 if (which_alternative != 0)
9207 else if (get_attr_length (insn) == 4)
9208 return "brctg\t%1,%l0";
9210 return "aghi\t%1,-1\;jgne\t%l0";
9212 "&& reload_completed
9213 && (! REG_P (operands[2])
9214 || ! rtx_equal_p (operands[1], operands[2]))"
9215 [(set (match_dup 3) (match_dup 1))
9216 (parallel [(set (reg:CCAN CC_REGNUM)
9217 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
9219 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
9220 (set (match_dup 2) (match_dup 3))
9221 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9222 (label_ref (match_dup 0))
9225 [(set_attr "op_type" "RI")
9226 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9227 ; hurt us in the (rare) case of ahi.
9228 (set_attr "z10prop" "z10_super_E1")
9229 (set_attr "type" "branch")
9230 (set (attr "length")
9231 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9232 (const_int 4) (const_int 10)))])
9235 ;;- Unconditional jump instructions.
9239 ; jump instruction pattern(s).
9242 (define_expand "jump"
9243 [(match_operand 0 "" "")]
9245 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
9247 (define_insn "*jump64"
9248 [(set (pc) (label_ref (match_operand 0 "" "")))]
9251 if (get_attr_length (insn) == 4)
9256 [(set_attr "op_type" "RI")
9257 (set_attr "type" "branch")
9258 (set (attr "length")
9259 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9260 (const_int 4) (const_int 6)))])
9262 (define_insn "*jump31"
9263 [(set (pc) (label_ref (match_operand 0 "" "")))]
9266 gcc_assert (get_attr_length (insn) == 4);
9269 [(set_attr "op_type" "RI")
9270 (set_attr "type" "branch")
9271 (set (attr "length")
9272 (if_then_else (not (match_test "flag_pic"))
9273 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9274 (const_int 4) (const_int 6))
9275 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9276 (const_int 4) (const_int 8))))])
9279 ; indirect-jump instruction pattern(s).
9282 (define_insn "indirect_jump"
9283 [(set (pc) (match_operand 0 "address_operand" "ZQZR"))]
9286 if (get_attr_op_type (insn) == OP_TYPE_RR)
9291 [(set (attr "op_type")
9292 (if_then_else (match_operand 0 "register_operand" "")
9293 (const_string "RR") (const_string "RX")))
9294 (set_attr "type" "branch")
9295 (set_attr "atype" "agen")])
9298 ; casesi instruction pattern(s).
9301 (define_insn "casesi_jump"
9302 [(set (pc) (match_operand 0 "address_operand" "ZQZR"))
9303 (use (label_ref (match_operand 1 "" "")))]
9306 if (get_attr_op_type (insn) == OP_TYPE_RR)
9311 [(set (attr "op_type")
9312 (if_then_else (match_operand 0 "register_operand" "")
9313 (const_string "RR") (const_string "RX")))
9314 (set_attr "type" "branch")
9315 (set_attr "atype" "agen")])
9317 (define_expand "casesi"
9318 [(match_operand:SI 0 "general_operand" "")
9319 (match_operand:SI 1 "general_operand" "")
9320 (match_operand:SI 2 "general_operand" "")
9321 (label_ref (match_operand 3 "" ""))
9322 (label_ref (match_operand 4 "" ""))]
9325 rtx index = gen_reg_rtx (SImode);
9326 rtx base = gen_reg_rtx (Pmode);
9327 rtx target = gen_reg_rtx (Pmode);
9329 emit_move_insn (index, operands[0]);
9330 emit_insn (gen_subsi3 (index, index, operands[1]));
9331 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
9334 if (Pmode != SImode)
9335 index = convert_to_mode (Pmode, index, 1);
9336 if (GET_CODE (index) != REG)
9337 index = copy_to_mode_reg (Pmode, index);
9340 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
9342 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
9344 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
9346 index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
9347 emit_move_insn (target, index);
9350 target = gen_rtx_PLUS (Pmode, base, target);
9351 emit_jump_insn (gen_casesi_jump (target, operands[3]));
9358 ;;- Jump to subroutine.
9363 ; untyped call instruction pattern(s).
9366 ;; Call subroutine returning any type.
9367 (define_expand "untyped_call"
9368 [(parallel [(call (match_operand 0 "" "")
9370 (match_operand 1 "" "")
9371 (match_operand 2 "" "")])]
9376 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
9378 for (i = 0; i < XVECLEN (operands[2], 0); i++)
9380 rtx set = XVECEXP (operands[2], 0, i);
9381 emit_move_insn (SET_DEST (set), SET_SRC (set));
9384 /* The optimizer does not know that the call sets the function value
9385 registers we stored in the result block. We avoid problems by
9386 claiming that all hard registers are used and clobbered at this
9388 emit_insn (gen_blockage ());
9393 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
9394 ;; all of memory. This blocks insns from being moved across this point.
9396 (define_insn "blockage"
9397 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
9400 [(set_attr "type" "none")
9401 (set_attr "length" "0")])
9407 (define_expand "sibcall"
9408 [(call (match_operand 0 "" "")
9409 (match_operand 1 "" ""))]
9412 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
9416 (define_insn "*sibcall_br"
9417 [(call (mem:QI (reg SIBCALL_REGNUM))
9418 (match_operand 0 "const_int_operand" "n"))]
9419 "SIBLING_CALL_P (insn)
9420 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
9422 [(set_attr "op_type" "RR")
9423 (set_attr "type" "branch")
9424 (set_attr "atype" "agen")])
9426 (define_insn "*sibcall_brc"
9427 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9428 (match_operand 1 "const_int_operand" "n"))]
9429 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
9431 [(set_attr "op_type" "RI")
9432 (set_attr "type" "branch")])
9434 (define_insn "*sibcall_brcl"
9435 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9436 (match_operand 1 "const_int_operand" "n"))]
9437 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
9439 [(set_attr "op_type" "RIL")
9440 (set_attr "type" "branch")])
9443 ; sibcall_value patterns
9446 (define_expand "sibcall_value"
9447 [(set (match_operand 0 "" "")
9448 (call (match_operand 1 "" "")
9449 (match_operand 2 "" "")))]
9452 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
9456 (define_insn "*sibcall_value_br"
9457 [(set (match_operand 0 "" "")
9458 (call (mem:QI (reg SIBCALL_REGNUM))
9459 (match_operand 1 "const_int_operand" "n")))]
9460 "SIBLING_CALL_P (insn)
9461 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
9463 [(set_attr "op_type" "RR")
9464 (set_attr "type" "branch")
9465 (set_attr "atype" "agen")])
9467 (define_insn "*sibcall_value_brc"
9468 [(set (match_operand 0 "" "")
9469 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9470 (match_operand 2 "const_int_operand" "n")))]
9471 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
9473 [(set_attr "op_type" "RI")
9474 (set_attr "type" "branch")])
9476 (define_insn "*sibcall_value_brcl"
9477 [(set (match_operand 0 "" "")
9478 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9479 (match_operand 2 "const_int_operand" "n")))]
9480 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
9482 [(set_attr "op_type" "RIL")
9483 (set_attr "type" "branch")])
9487 ; call instruction pattern(s).
9490 (define_expand "call"
9491 [(call (match_operand 0 "" "")
9492 (match_operand 1 "" ""))
9493 (use (match_operand 2 "" ""))]
9496 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
9497 gen_rtx_REG (Pmode, RETURN_REGNUM));
9501 (define_insn "*bras"
9502 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9503 (match_operand 1 "const_int_operand" "n"))
9504 (clobber (match_operand 2 "register_operand" "=r"))]
9505 "!SIBLING_CALL_P (insn)
9506 && TARGET_SMALL_EXEC
9507 && GET_MODE (operands[2]) == Pmode"
9509 [(set_attr "op_type" "RI")
9510 (set_attr "type" "jsr")
9511 (set_attr "z196prop" "z196_cracked")])
9513 (define_insn "*brasl"
9514 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9515 (match_operand 1 "const_int_operand" "n"))
9516 (clobber (match_operand 2 "register_operand" "=r"))]
9517 "!SIBLING_CALL_P (insn)
9519 && GET_MODE (operands[2]) == Pmode"
9521 [(set_attr "op_type" "RIL")
9522 (set_attr "type" "jsr")
9523 (set_attr "z196prop" "z196_cracked")])
9525 (define_insn "*basr"
9526 [(call (mem:QI (match_operand 0 "address_operand" "ZQZR"))
9527 (match_operand 1 "const_int_operand" "n"))
9528 (clobber (match_operand 2 "register_operand" "=r"))]
9529 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
9531 if (get_attr_op_type (insn) == OP_TYPE_RR)
9532 return "basr\t%2,%0";
9534 return "bas\t%2,%a0";
9536 [(set (attr "op_type")
9537 (if_then_else (match_operand 0 "register_operand" "")
9538 (const_string "RR") (const_string "RX")))
9539 (set_attr "type" "jsr")
9540 (set_attr "atype" "agen")
9541 (set_attr "z196prop" "z196_cracked")])
9544 ; call_value instruction pattern(s).
9547 (define_expand "call_value"
9548 [(set (match_operand 0 "" "")
9549 (call (match_operand 1 "" "")
9550 (match_operand 2 "" "")))
9551 (use (match_operand 3 "" ""))]
9554 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
9555 gen_rtx_REG (Pmode, RETURN_REGNUM));
9559 (define_insn "*bras_r"
9560 [(set (match_operand 0 "" "")
9561 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9562 (match_operand:SI 2 "const_int_operand" "n")))
9563 (clobber (match_operand 3 "register_operand" "=r"))]
9564 "!SIBLING_CALL_P (insn)
9565 && TARGET_SMALL_EXEC
9566 && GET_MODE (operands[3]) == Pmode"
9568 [(set_attr "op_type" "RI")
9569 (set_attr "type" "jsr")
9570 (set_attr "z196prop" "z196_cracked")])
9572 (define_insn "*brasl_r"
9573 [(set (match_operand 0 "" "")
9574 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9575 (match_operand 2 "const_int_operand" "n")))
9576 (clobber (match_operand 3 "register_operand" "=r"))]
9577 "!SIBLING_CALL_P (insn)
9579 && GET_MODE (operands[3]) == Pmode"
9581 [(set_attr "op_type" "RIL")
9582 (set_attr "type" "jsr")
9583 (set_attr "z196prop" "z196_cracked")])
9585 (define_insn "*basr_r"
9586 [(set (match_operand 0 "" "")
9587 (call (mem:QI (match_operand 1 "address_operand" "ZQZR"))
9588 (match_operand 2 "const_int_operand" "n")))
9589 (clobber (match_operand 3 "register_operand" "=r"))]
9590 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
9592 if (get_attr_op_type (insn) == OP_TYPE_RR)
9593 return "basr\t%3,%1";
9595 return "bas\t%3,%a1";
9597 [(set (attr "op_type")
9598 (if_then_else (match_operand 1 "register_operand" "")
9599 (const_string "RR") (const_string "RX")))
9600 (set_attr "type" "jsr")
9601 (set_attr "atype" "agen")
9602 (set_attr "z196prop" "z196_cracked")])
9605 ;;- Thread-local storage support.
9608 (define_expand "get_thread_pointer<mode>"
9609 [(set (match_operand:P 0 "nonimmediate_operand" "") (reg:P TP_REGNUM))]
9613 (define_expand "set_thread_pointer<mode>"
9614 [(set (reg:P TP_REGNUM) (match_operand:P 0 "nonimmediate_operand" ""))
9615 (set (reg:P TP_REGNUM) (unspec_volatile:P [(reg:P TP_REGNUM)] UNSPECV_SET_TP))]
9619 (define_insn "*set_tp"
9620 [(set (reg TP_REGNUM) (unspec_volatile [(reg TP_REGNUM)] UNSPECV_SET_TP))]
9623 [(set_attr "type" "none")
9624 (set_attr "length" "0")])
9626 (define_insn "*tls_load_64"
9627 [(set (match_operand:DI 0 "register_operand" "=d")
9628 (unspec:DI [(match_operand:DI 1 "memory_operand" "RT")
9629 (match_operand:DI 2 "" "")]
9633 [(set_attr "op_type" "RXE")
9634 (set_attr "z10prop" "z10_fwd_A3")])
9636 (define_insn "*tls_load_31"
9637 [(set (match_operand:SI 0 "register_operand" "=d,d")
9638 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
9639 (match_operand:SI 2 "" "")]
9645 [(set_attr "op_type" "RX,RXY")
9646 (set_attr "type" "load")
9647 (set_attr "z10prop" "z10_fwd_A3,z10_fwd_A3")])
9649 (define_insn "*bras_tls"
9650 [(set (match_operand 0 "" "")
9651 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9652 (match_operand 2 "const_int_operand" "n")))
9653 (clobber (match_operand 3 "register_operand" "=r"))
9654 (use (match_operand 4 "" ""))]
9655 "!SIBLING_CALL_P (insn)
9656 && TARGET_SMALL_EXEC
9657 && GET_MODE (operands[3]) == Pmode"
9659 [(set_attr "op_type" "RI")
9660 (set_attr "type" "jsr")
9661 (set_attr "z196prop" "z196_cracked")])
9663 (define_insn "*brasl_tls"
9664 [(set (match_operand 0 "" "")
9665 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9666 (match_operand 2 "const_int_operand" "n")))
9667 (clobber (match_operand 3 "register_operand" "=r"))
9668 (use (match_operand 4 "" ""))]
9669 "!SIBLING_CALL_P (insn)
9671 && GET_MODE (operands[3]) == Pmode"
9673 [(set_attr "op_type" "RIL")
9674 (set_attr "type" "jsr")
9675 (set_attr "z196prop" "z196_cracked")])
9677 (define_insn "*basr_tls"
9678 [(set (match_operand 0 "" "")
9679 (call (mem:QI (match_operand 1 "address_operand" "ZQZR"))
9680 (match_operand 2 "const_int_operand" "n")))
9681 (clobber (match_operand 3 "register_operand" "=r"))
9682 (use (match_operand 4 "" ""))]
9683 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
9685 if (get_attr_op_type (insn) == OP_TYPE_RR)
9686 return "basr\t%3,%1%J4";
9688 return "bas\t%3,%a1%J4";
9690 [(set (attr "op_type")
9691 (if_then_else (match_operand 1 "register_operand" "")
9692 (const_string "RR") (const_string "RX")))
9693 (set_attr "type" "jsr")
9694 (set_attr "atype" "agen")
9695 (set_attr "z196prop" "z196_cracked")])
9698 ;;- Atomic operations
9702 ; memory barrier patterns.
9705 (define_expand "mem_signal_fence"
9706 [(match_operand:SI 0 "const_int_operand")] ;; model
9709 /* The s390 memory model is strong enough not to require any
9710 barrier in order to synchronize a thread with itself. */
9714 (define_expand "mem_thread_fence"
9715 [(match_operand:SI 0 "const_int_operand")] ;; model
9718 /* Unless this is a SEQ_CST fence, the s390 memory model is strong
9719 enough not to require barriers of any kind. */
9720 if (is_mm_seq_cst (memmodel_from_int (INTVAL (operands[0]))))
9722 rtx mem = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
9723 MEM_VOLATILE_P (mem) = 1;
9724 emit_insn (gen_mem_thread_fence_1 (mem));
9729 ; Although bcr is superscalar on Z10, this variant will never
9730 ; become part of an execution group.
9731 ; With z196 we can make use of the fast-BCR-serialization facility.
9732 ; This allows for a slightly faster sync which is sufficient for our
9734 (define_insn "mem_thread_fence_1"
9735 [(set (match_operand:BLK 0 "" "")
9736 (unspec:BLK [(match_dup 0)] UNSPEC_MB))]
9744 [(set_attr "op_type" "RR")
9745 (set_attr "mnemonic" "bcr_flush")
9746 (set_attr "z196prop" "z196_alone")])
9749 ; atomic load/store operations
9752 ; Atomic loads need not examine the memory model at all.
9753 (define_expand "atomic_load<mode>"
9754 [(match_operand:DINT 0 "register_operand") ;; output
9755 (match_operand:DINT 1 "memory_operand") ;; memory
9756 (match_operand:SI 2 "const_int_operand")] ;; model
9759 if (MEM_ALIGN (operands[1]) < GET_MODE_BITSIZE (GET_MODE (operands[1])))
9762 if (<MODE>mode == TImode)
9763 emit_insn (gen_atomic_loadti_1 (operands[0], operands[1]));
9764 else if (<MODE>mode == DImode && !TARGET_ZARCH)
9765 emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1]));
9767 emit_move_insn (operands[0], operands[1]);
9771 ; Different from movdi_31 in that we want no splitters.
9772 (define_insn "atomic_loaddi_1"
9773 [(set (match_operand:DI 0 "register_operand" "=d,d,!*f,!*f")
9774 (unspec:DI [(match_operand:DI 1 "memory_operand" "Q,S,R,T")]
9782 [(set_attr "op_type" "RS,RSY,RS,RSY")
9783 (set_attr "type" "lm,lm,floaddf,floaddf")])
9785 (define_insn "atomic_loadti_1"
9786 [(set (match_operand:TI 0 "register_operand" "=r")
9787 (unspec:TI [(match_operand:TI 1 "memory_operand" "RT")]
9791 [(set_attr "op_type" "RXY")
9792 (set_attr "type" "other")])
9794 ; Atomic stores must(?) enforce sequential consistency.
9795 (define_expand "atomic_store<mode>"
9796 [(match_operand:DINT 0 "memory_operand") ;; memory
9797 (match_operand:DINT 1 "register_operand") ;; input
9798 (match_operand:SI 2 "const_int_operand")] ;; model
9801 enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
9803 if (MEM_ALIGN (operands[0]) < GET_MODE_BITSIZE (GET_MODE (operands[0])))
9806 if (<MODE>mode == TImode)
9807 emit_insn (gen_atomic_storeti_1 (operands[0], operands[1]));
9808 else if (<MODE>mode == DImode && !TARGET_ZARCH)
9809 emit_insn (gen_atomic_storedi_1 (operands[0], operands[1]));
9811 emit_move_insn (operands[0], operands[1]);
9812 if (is_mm_seq_cst (model))
9813 emit_insn (gen_mem_thread_fence (operands[2]));
9817 ; Different from movdi_31 in that we want no splitters.
9818 (define_insn "atomic_storedi_1"
9819 [(set (match_operand:DI 0 "memory_operand" "=Q,S,R,T")
9820 (unspec:DI [(match_operand:DI 1 "register_operand" "d,d,!*f,!*f")]
9828 [(set_attr "op_type" "RS,RSY,RS,RSY")
9829 (set_attr "type" "stm,stm,fstoredf,fstoredf")])
9831 (define_insn "atomic_storeti_1"
9832 [(set (match_operand:TI 0 "memory_operand" "=RT")
9833 (unspec:TI [(match_operand:TI 1 "register_operand" "r")]
9837 [(set_attr "op_type" "RXY")
9838 (set_attr "type" "other")])
9841 ; compare and swap patterns.
9844 (define_expand "atomic_compare_and_swap<mode>"
9845 [(match_operand:SI 0 "register_operand") ;; bool success output
9846 (match_operand:DGPR 1 "nonimmediate_operand");; oldval output
9847 (match_operand:DGPR 2 "memory_operand") ;; memory
9848 (match_operand:DGPR 3 "register_operand") ;; expected intput
9849 (match_operand:DGPR 4 "register_operand") ;; newval intput
9850 (match_operand:SI 5 "const_int_operand") ;; is_weak
9851 (match_operand:SI 6 "const_int_operand") ;; success model
9852 (match_operand:SI 7 "const_int_operand")] ;; failure model
9855 rtx cc, cmp, output = operands[1];
9857 if (!register_operand (output, <MODE>mode))
9858 output = gen_reg_rtx (<MODE>mode);
9860 if (MEM_ALIGN (operands[2]) < GET_MODE_BITSIZE (GET_MODE (operands[2])))
9863 emit_insn (gen_atomic_compare_and_swap<mode>_internal
9864 (output, operands[2], operands[3], operands[4]));
9866 /* We deliberately accept non-register operands in the predicate
9867 to ensure the write back to the output operand happens *before*
9868 the store-flags code below. This makes it easier for combine
9869 to merge the store-flags code with a potential test-and-branch
9870 pattern following (immediately!) afterwards. */
9871 if (output != operands[1])
9872 emit_move_insn (operands[1], output);
9874 cc = gen_rtx_REG (CCZ1mode, CC_REGNUM);
9875 cmp = gen_rtx_EQ (SImode, cc, const0_rtx);
9876 emit_insn (gen_cstorecc4 (operands[0], cmp, cc, const0_rtx));
9880 (define_expand "atomic_compare_and_swap<mode>"
9881 [(match_operand:SI 0 "register_operand") ;; bool success output
9882 (match_operand:HQI 1 "nonimmediate_operand") ;; oldval output
9883 (match_operand:HQI 2 "memory_operand") ;; memory
9884 (match_operand:HQI 3 "general_operand") ;; expected intput
9885 (match_operand:HQI 4 "general_operand") ;; newval intput
9886 (match_operand:SI 5 "const_int_operand") ;; is_weak
9887 (match_operand:SI 6 "const_int_operand") ;; success model
9888 (match_operand:SI 7 "const_int_operand")] ;; failure model
9891 s390_expand_cs_hqi (<MODE>mode, operands[0], operands[1], operands[2],
9892 operands[3], operands[4], INTVAL (operands[5]));
9896 (define_expand "atomic_compare_and_swap<mode>_internal"
9898 [(set (match_operand:DGPR 0 "register_operand")
9899 (match_operand:DGPR 1 "memory_operand"))
9901 (unspec_volatile:DGPR
9903 (match_operand:DGPR 2 "register_operand")
9904 (match_operand:DGPR 3 "register_operand")]
9906 (set (reg:CCZ1 CC_REGNUM)
9907 (compare:CCZ1 (match_dup 1) (match_dup 2)))])]
9911 (define_insn "*atomic_compare_and_swap<mode>_1"
9912 [(set (match_operand:TDI 0 "register_operand" "=r")
9913 (match_operand:TDI 1 "memory_operand" "+QS"))
9915 (unspec_volatile:TDI
9917 (match_operand:TDI 2 "register_operand" "0")
9918 (match_operand:TDI 3 "register_operand" "r")]
9920 (set (reg:CCZ1 CC_REGNUM)
9921 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9923 "c<td>sg\t%0,%3,%S1"
9924 [(set_attr "op_type" "RSY")
9925 (set_attr "type" "sem")])
9928 (define_insn "*atomic_compare_and_swapdi_2"
9929 [(set (match_operand:DI 0 "register_operand" "=r,r")
9930 (match_operand:DI 1 "memory_operand" "+Q,S"))
9934 (match_operand:DI 2 "register_operand" "0,0")
9935 (match_operand:DI 3 "register_operand" "r,r")]
9937 (set (reg:CCZ1 CC_REGNUM)
9938 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9943 [(set_attr "op_type" "RS,RSY")
9944 (set_attr "type" "sem")])
9947 (define_insn "*atomic_compare_and_swapsi_3"
9948 [(set (match_operand:SI 0 "register_operand" "=r,r")
9949 (match_operand:SI 1 "memory_operand" "+Q,S"))
9953 (match_operand:SI 2 "register_operand" "0,0")
9954 (match_operand:SI 3 "register_operand" "r,r")]
9956 (set (reg:CCZ1 CC_REGNUM)
9957 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9962 [(set_attr "op_type" "RS,RSY")
9963 (set_attr "type" "sem")])
9966 ; Other atomic instruction patterns.
9969 ; z196 load and add, xor, or and and instructions
9971 (define_expand "atomic_fetch_<atomic><mode>"
9972 [(match_operand:GPR 0 "register_operand") ;; val out
9974 (match_operand:GPR 1 "memory_operand") ;; memory
9975 (match_operand:GPR 2 "register_operand")) ;; val in
9976 (match_operand:SI 3 "const_int_operand")] ;; model
9979 if (MEM_ALIGN (operands[1]) < GET_MODE_BITSIZE (GET_MODE (operands[1])))
9982 emit_insn (gen_atomic_fetch_<atomic><mode>_iaf
9983 (operands[0], operands[1], operands[2]));
9987 ; lan, lang, lao, laog, lax, laxg, laa, laag
9988 (define_insn "atomic_fetch_<atomic><mode>_iaf"
9989 [(set (match_operand:GPR 0 "register_operand" "=d")
9990 (match_operand:GPR 1 "memory_operand" "+QS"))
9992 (unspec_volatile:GPR
9993 [(ATOMIC_Z196:GPR (match_dup 1)
9994 (match_operand:GPR 2 "general_operand" "d"))]
9996 (clobber (reg:CC CC_REGNUM))]
9998 "la<noxa><g>\t%0,%2,%1"
9999 [(set_attr "op_type" "RSY")
10000 (set_attr "type" "sem")])
10002 ;; For SImode and larger, the optabs.c code will do just fine in
10003 ;; expanding a compare-and-swap loop. For QI/HImode, we can do
10004 ;; better by expanding our own loop.
10006 (define_expand "atomic_<atomic><mode>"
10008 (match_operand:HQI 0 "memory_operand") ;; memory
10009 (match_operand:HQI 1 "general_operand")) ;; val in
10010 (match_operand:SI 2 "const_int_operand")] ;; model
10013 s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0],
10014 operands[1], false);
10018 (define_expand "atomic_fetch_<atomic><mode>"
10019 [(match_operand:HQI 0 "register_operand") ;; val out
10021 (match_operand:HQI 1 "memory_operand") ;; memory
10022 (match_operand:HQI 2 "general_operand")) ;; val in
10023 (match_operand:SI 3 "const_int_operand")] ;; model
10026 s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
10027 operands[2], false);
10031 (define_expand "atomic_<atomic>_fetch<mode>"
10032 [(match_operand:HQI 0 "register_operand") ;; val out
10034 (match_operand:HQI 1 "memory_operand") ;; memory
10035 (match_operand:HQI 2 "general_operand")) ;; val in
10036 (match_operand:SI 3 "const_int_operand")] ;; model
10039 s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
10040 operands[2], true);
10044 (define_expand "atomic_exchange<mode>"
10045 [(match_operand:HQI 0 "register_operand") ;; val out
10046 (match_operand:HQI 1 "memory_operand") ;; memory
10047 (match_operand:HQI 2 "general_operand") ;; val in
10048 (match_operand:SI 3 "const_int_operand")] ;; model
10051 s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1],
10052 operands[2], false);
10057 ;;- Miscellaneous instructions.
10061 ; allocate stack instruction pattern(s).
10064 (define_expand "allocate_stack"
10065 [(match_operand 0 "general_operand" "")
10066 (match_operand 1 "general_operand" "")]
10069 rtx temp = gen_reg_rtx (Pmode);
10071 emit_move_insn (temp, s390_back_chain_rtx ());
10072 anti_adjust_stack (operands[1]);
10073 emit_move_insn (s390_back_chain_rtx (), temp);
10075 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10081 ; setjmp instruction pattern.
10084 (define_expand "builtin_setjmp_receiver"
10085 [(match_operand 0 "" "")]
10088 emit_insn (s390_load_got ());
10089 emit_use (pic_offset_table_rtx);
10093 ;; These patterns say how to save and restore the stack pointer. We need not
10094 ;; save the stack pointer at function level since we are careful to
10095 ;; preserve the backchain. At block level, we have to restore the backchain
10096 ;; when we restore the stack pointer.
10098 ;; For nonlocal gotos, we must save both the stack pointer and its
10099 ;; backchain and restore both. Note that in the nonlocal case, the
10100 ;; save area is a memory location.
10102 (define_expand "save_stack_function"
10103 [(match_operand 0 "general_operand" "")
10104 (match_operand 1 "general_operand" "")]
10108 (define_expand "restore_stack_function"
10109 [(match_operand 0 "general_operand" "")
10110 (match_operand 1 "general_operand" "")]
10114 (define_expand "restore_stack_block"
10115 [(match_operand 0 "register_operand" "")
10116 (match_operand 1 "register_operand" "")]
10119 rtx temp = gen_reg_rtx (Pmode);
10121 emit_move_insn (temp, s390_back_chain_rtx ());
10122 emit_move_insn (operands[0], operands[1]);
10123 emit_move_insn (s390_back_chain_rtx (), temp);
10128 (define_expand "save_stack_nonlocal"
10129 [(match_operand 0 "memory_operand" "")
10130 (match_operand 1 "register_operand" "")]
10133 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
10135 /* Copy the backchain to the first word, sp to the second and the
10136 literal pool base to the third. */
10138 rtx save_bc = adjust_address (operands[0], Pmode, 0);
10139 rtx save_sp = adjust_address (operands[0], Pmode, GET_MODE_SIZE (Pmode));
10140 rtx save_bp = adjust_address (operands[0], Pmode, 2 * GET_MODE_SIZE (Pmode));
10142 if (TARGET_BACKCHAIN)
10143 emit_move_insn (save_bc, force_reg (Pmode, s390_back_chain_rtx ()));
10145 emit_move_insn (save_sp, operands[1]);
10146 emit_move_insn (save_bp, base);
10151 (define_expand "restore_stack_nonlocal"
10152 [(match_operand 0 "register_operand" "")
10153 (match_operand 1 "memory_operand" "")]
10156 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
10157 rtx temp = NULL_RTX;
10159 /* Restore the backchain from the first word, sp from the second and the
10160 literal pool base from the third. */
10162 rtx save_bc = adjust_address (operands[1], Pmode, 0);
10163 rtx save_sp = adjust_address (operands[1], Pmode, GET_MODE_SIZE (Pmode));
10164 rtx save_bp = adjust_address (operands[1], Pmode, 2 * GET_MODE_SIZE (Pmode));
10166 if (TARGET_BACKCHAIN)
10167 temp = force_reg (Pmode, save_bc);
10169 emit_move_insn (base, save_bp);
10170 emit_move_insn (operands[0], save_sp);
10173 emit_move_insn (s390_back_chain_rtx (), temp);
10179 (define_expand "exception_receiver"
10183 s390_set_has_landing_pad_p (true);
10188 ; nop instruction pattern(s).
10195 [(set_attr "op_type" "RR")
10196 (set_attr "z10prop" "z10_fr_E1")])
10198 (define_insn "nop1"
10202 [(set_attr "op_type" "RR")])
10204 ;;- Undeletable nops (used for hotpatching)
10206 (define_insn "nop_2_byte"
10207 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_2_BYTE)]
10210 [(set_attr "op_type" "RR")])
10212 (define_insn "nop_4_byte"
10213 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_4_BYTE)]
10216 [(set_attr "op_type" "RX")])
10218 (define_insn "nop_6_byte"
10219 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_6_BYTE)]
10222 [(set_attr "op_type" "RIL")])
10226 ; Special literal pool access instruction pattern(s).
10229 (define_insn "*pool_entry"
10230 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
10231 UNSPECV_POOL_ENTRY)]
10234 machine_mode mode = GET_MODE (PATTERN (insn));
10235 unsigned int align = GET_MODE_BITSIZE (mode);
10236 s390_output_pool_entry (operands[0], mode, align);
10239 [(set (attr "length")
10240 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
10242 (define_insn "pool_align"
10243 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")]
10244 UNSPECV_POOL_ALIGN)]
10247 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
10249 (define_insn "pool_section_start"
10250 [(unspec_volatile [(const_int 1)] UNSPECV_POOL_SECTION)]
10253 switch_to_section (targetm.asm_out.function_rodata_section
10254 (current_function_decl));
10257 [(set_attr "length" "0")])
10259 (define_insn "pool_section_end"
10260 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_SECTION)]
10263 switch_to_section (current_function_section ());
10266 [(set_attr "length" "0")])
10268 (define_insn "main_base_31_small"
10269 [(set (match_operand 0 "register_operand" "=a")
10270 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
10271 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10273 [(set_attr "op_type" "RR")
10274 (set_attr "type" "la")
10275 (set_attr "z196prop" "z196_cracked")])
10277 (define_insn "main_base_31_large"
10278 [(set (match_operand 0 "register_operand" "=a")
10279 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
10280 (set (pc) (label_ref (match_operand 2 "" "")))]
10281 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10283 [(set_attr "op_type" "RI")
10284 (set_attr "z196prop" "z196_cracked")])
10286 (define_insn "main_base_64"
10287 [(set (match_operand 0 "register_operand" "=a")
10288 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
10289 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10291 [(set_attr "op_type" "RIL")
10292 (set_attr "type" "larl")
10293 (set_attr "z10prop" "z10_fwd_A1")])
10295 (define_insn "main_pool"
10296 [(set (match_operand 0 "register_operand" "=a")
10297 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
10298 "GET_MODE (operands[0]) == Pmode"
10300 gcc_unreachable ();
10302 [(set (attr "type")
10303 (if_then_else (match_test "TARGET_CPU_ZARCH")
10304 (const_string "larl") (const_string "la")))])
10306 (define_insn "reload_base_31"
10307 [(set (match_operand 0 "register_operand" "=a")
10308 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
10309 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10310 "basr\t%0,0\;la\t%0,%1-.(%0)"
10311 [(set_attr "length" "6")
10312 (set_attr "type" "la")
10313 (set_attr "z196prop" "z196_cracked")])
10315 (define_insn "reload_base_64"
10316 [(set (match_operand 0 "register_operand" "=a")
10317 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
10318 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10320 [(set_attr "op_type" "RIL")
10321 (set_attr "type" "larl")
10322 (set_attr "z10prop" "z10_fwd_A1")])
10324 (define_insn "pool"
10325 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
10328 gcc_unreachable ();
10330 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
10333 ;; Insns related to generating the function prologue and epilogue.
10337 (define_expand "prologue"
10338 [(use (const_int 0))]
10340 "s390_emit_prologue (); DONE;")
10342 (define_expand "epilogue"
10343 [(use (const_int 1))]
10345 "s390_emit_epilogue (false); DONE;")
10347 (define_expand "sibcall_epilogue"
10348 [(use (const_int 0))]
10350 "s390_emit_epilogue (true); DONE;")
10352 ;; A direct return instruction, without using an epilogue.
10353 (define_insn "<code>"
10355 "s390_can_use_<code>_insn ()"
10357 [(set_attr "op_type" "RR")
10358 (set_attr "type" "jsr")
10359 (set_attr "atype" "agen")])
10361 (define_insn "*return"
10363 (use (match_operand 0 "register_operand" "a"))]
10364 "GET_MODE (operands[0]) == Pmode"
10366 [(set_attr "op_type" "RR")
10367 (set_attr "type" "jsr")
10368 (set_attr "atype" "agen")])
10371 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
10372 ;; pointer. This is used for compatibility.
10374 (define_expand "ptr_extend"
10375 [(set (match_operand:DI 0 "register_operand" "=r")
10376 (match_operand:SI 1 "register_operand" "r"))]
10379 emit_insn (gen_anddi3 (operands[0],
10380 gen_lowpart (DImode, operands[1]),
10381 GEN_INT (0x7fffffff)));
10385 ;; Instruction definition to expand eh_return macro to support
10386 ;; swapping in special linkage return addresses.
10388 (define_expand "eh_return"
10389 [(use (match_operand 0 "register_operand" ""))]
10392 s390_emit_tpf_eh_return (operands[0]);
10397 ; Stack Protector Patterns
10400 (define_expand "stack_protect_set"
10401 [(set (match_operand 0 "memory_operand" "")
10402 (match_operand 1 "memory_operand" ""))]
10405 #ifdef TARGET_THREAD_SSP_OFFSET
10407 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
10408 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
10411 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
10413 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
10418 (define_insn "stack_protect_set<mode>"
10419 [(set (match_operand:DSI 0 "memory_operand" "=Q")
10420 (unspec:DSI [(match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_SET))]
10422 "mvc\t%O0(%G0,%R0),%S1"
10423 [(set_attr "op_type" "SS")])
10425 (define_expand "stack_protect_test"
10426 [(set (reg:CC CC_REGNUM)
10427 (compare (match_operand 0 "memory_operand" "")
10428 (match_operand 1 "memory_operand" "")))
10429 (match_operand 2 "" "")]
10433 #ifdef TARGET_THREAD_SSP_OFFSET
10435 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
10436 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
10439 emit_insn (gen_stack_protect_testdi (operands[0], operands[1]));
10441 emit_insn (gen_stack_protect_testsi (operands[0], operands[1]));
10443 cc_reg = gen_rtx_REG (CCZmode, CC_REGNUM);
10444 test = gen_rtx_EQ (VOIDmode, cc_reg, const0_rtx);
10445 emit_jump_insn (gen_cbranchcc4 (test, cc_reg, const0_rtx, operands[2]));
10449 (define_insn "stack_protect_test<mode>"
10450 [(set (reg:CCZ CC_REGNUM)
10451 (unspec:CCZ [(match_operand:DSI 0 "memory_operand" "Q")
10452 (match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_TEST))]
10454 "clc\t%O0(%G0,%R0),%S1"
10455 [(set_attr "op_type" "SS")])
10457 ; This is used in s390_emit_prologue in order to prevent insns
10458 ; adjusting the stack pointer to be moved over insns writing stack
10459 ; slots using a copy of the stack pointer in a different register.
10460 (define_insn "stack_tie"
10461 [(set (match_operand:BLK 0 "memory_operand" "+m")
10462 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
10465 [(set_attr "length" "0")])
10469 ; Data prefetch patterns
10472 (define_insn "prefetch"
10473 [(prefetch (match_operand 0 "address_operand" "ZQZRZSZT,X")
10474 (match_operand:SI 1 "const_int_operand" " n,n")
10475 (match_operand:SI 2 "const_int_operand" " n,n"))]
10478 switch (which_alternative)
10481 return INTVAL (operands[1]) == 1 ? "pfd\t2,%a0" : "pfd\t1,%a0";
10483 if (larl_operand (operands[0], Pmode))
10484 return INTVAL (operands[1]) == 1 ? "pfdrl\t2,%a0" : "pfdrl\t1,%a0";
10487 /* This might be reached for symbolic operands with an odd
10488 addend. We simply omit the prefetch for such rare cases. */
10493 [(set_attr "type" "load,larl")
10494 (set_attr "op_type" "RXY,RIL")
10495 (set_attr "z10prop" "z10_super")
10496 (set_attr "z196prop" "z196_alone")])
10500 ; Byte swap instructions
10503 ; FIXME: There is also mvcin but we cannot use it since src and target
10505 (define_insn "bswap<mode>2"
10506 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d, d,RT")
10507 (bswap:GPR (match_operand:GPR 1 "nonimmediate_operand" " d,RT, d")))]
10513 [(set_attr "type" "*,load,store")
10514 (set_attr "op_type" "RRE,RXY,RXY")
10515 (set_attr "z10prop" "z10_super")])
10517 (define_insn "bswaphi2"
10518 [(set (match_operand:HI 0 "nonimmediate_operand" "=d, d,RT")
10519 (bswap:HI (match_operand:HI 1 "nonimmediate_operand" " d,RT, d")))]
10525 [(set_attr "type" "*,load,store")
10526 (set_attr "op_type" "RRE,RXY,RXY")
10527 (set_attr "z10prop" "z10_super")])
10530 [(set (match_operand:HI 0 "register_operand" "")
10531 (bswap:HI (match_operand:HI 1 "register_operand" "")))]
10533 [(set (match_dup 2) (bswap:SI (match_dup 3)))
10534 (set (match_dup 2) (lshiftrt:SI (match_dup 2) (const_int 16)))]
10536 operands[2] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
10537 operands[3] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
10542 ; Population count instruction
10545 ; The S/390 popcount instruction counts the bits of op1 in 8 byte
10546 ; portions and stores the result in the corresponding bytes in op0.
10547 (define_insn "*popcount<mode>"
10548 [(set (match_operand:INT 0 "register_operand" "=d")
10549 (unspec:INT [(match_operand:INT 1 "register_operand" "d")] UNSPEC_POPCNT))
10550 (clobber (reg:CC CC_REGNUM))]
10553 [(set_attr "op_type" "RRE")])
10555 (define_expand "popcountdi2"
10557 (parallel [(set (match_operand:DI 0 "register_operand" "")
10558 (unspec:DI [(match_operand:DI 1 "register_operand")]
10560 (clobber (reg:CC CC_REGNUM))])
10561 ; sllg op2, op0, 32
10562 (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 32)))
10564 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10565 (clobber (reg:CC CC_REGNUM))])
10566 ; sllg op2, op0, 16
10568 (ashift:DI (match_dup 0) (const_int 16)))
10570 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10571 (clobber (reg:CC CC_REGNUM))])
10573 (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 8)))
10575 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10576 (clobber (reg:CC CC_REGNUM))])
10577 ; srlg op0, op0, 56
10578 (set (match_dup 0) (lshiftrt:DI (match_dup 0) (const_int 56)))]
10579 "TARGET_Z196 && TARGET_64BIT"
10580 "operands[2] = gen_reg_rtx (DImode);")
10582 (define_expand "popcountsi2"
10584 (parallel [(set (match_operand:SI 0 "register_operand" "")
10585 (unspec:SI [(match_operand:SI 1 "register_operand")]
10587 (clobber (reg:CC CC_REGNUM))])
10588 ; sllk op2, op0, 16
10590 (ashift:SI (match_dup 0) (const_int 16)))
10592 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10593 (clobber (reg:CC CC_REGNUM))])
10595 (set (match_dup 2) (ashift:SI (match_dup 0) (const_int 8)))
10597 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10598 (clobber (reg:CC CC_REGNUM))])
10600 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 24)))]
10602 "operands[2] = gen_reg_rtx (SImode);")
10604 (define_expand "popcounthi2"
10606 (parallel [(set (match_operand:HI 0 "register_operand" "")
10607 (unspec:HI [(match_operand:HI 1 "register_operand")]
10609 (clobber (reg:CC CC_REGNUM))])
10612 (ashift:SI (match_dup 0) (const_int 8)))
10614 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10615 (clobber (reg:CC CC_REGNUM))])
10617 (set (match_dup 0) (lshiftrt:HI (match_dup 0) (const_int 8)))]
10619 "operands[2] = gen_reg_rtx (SImode);")
10621 (define_expand "popcountqi2"
10623 (parallel [(set (match_operand:QI 0 "register_operand" "")
10624 (unspec:QI [(match_operand:QI 1 "register_operand")]
10626 (clobber (reg:CC CC_REGNUM))])]
10631 ;;- Copy sign instructions
10634 (define_insn "copysign<mode>3"
10635 [(set (match_operand:FP 0 "register_operand" "=f")
10636 (unspec:FP [(match_operand:FP 1 "register_operand" "<fT0>")
10637 (match_operand:FP 2 "register_operand" "f")]
10641 [(set_attr "op_type" "RRF")
10642 (set_attr "type" "fsimp<mode>")])
10646 ;;- Transactional execution instructions
10649 ; This splitter helps combine to make use of CC directly when
10650 ; comparing the integer result of a tbegin builtin with a constant.
10651 ; The unspec is already removed by canonicalize_comparison. So this
10652 ; splitters only job is to turn the PARALLEL into separate insns
10653 ; again. Unfortunately this only works with the very first cc/int
10654 ; compare since combine is not able to deal with data flow across
10655 ; basic block boundaries.
10657 ; It needs to be an insn pattern as well since combine does not apply
10658 ; the splitter directly. Combine would only use it if it actually
10659 ; would reduce the number of instructions.
10660 (define_insn_and_split "*ccraw_to_int"
10663 (match_operator 0 "s390_eqne_operator"
10664 [(reg:CCRAW CC_REGNUM)
10665 (match_operand 1 "const_int_operand" "")])
10666 (label_ref (match_operand 2 "" ""))
10668 (set (match_operand:SI 3 "register_operand" "=d")
10669 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
10673 [(set (match_dup 3)
10674 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))
10676 (if_then_else (match_op_dup 0 [(reg:CCRAW CC_REGNUM) (match_dup 1)])
10677 (label_ref (match_dup 2))
10681 ; Non-constrained transaction begin
10683 (define_expand "tbegin"
10684 [(match_operand:SI 0 "register_operand" "")
10685 (match_operand:BLK 1 "memory_operand" "")]
10688 s390_expand_tbegin (operands[0], operands[1], NULL_RTX, true);
10692 (define_expand "tbegin_nofloat"
10693 [(match_operand:SI 0 "register_operand" "")
10694 (match_operand:BLK 1 "memory_operand" "")]
10697 s390_expand_tbegin (operands[0], operands[1], NULL_RTX, false);
10701 (define_expand "tbegin_retry"
10702 [(match_operand:SI 0 "register_operand" "")
10703 (match_operand:BLK 1 "memory_operand" "")
10704 (match_operand:SI 2 "general_operand" "")]
10707 s390_expand_tbegin (operands[0], operands[1], operands[2], true);
10711 (define_expand "tbegin_retry_nofloat"
10712 [(match_operand:SI 0 "register_operand" "")
10713 (match_operand:BLK 1 "memory_operand" "")
10714 (match_operand:SI 2 "general_operand" "")]
10717 s390_expand_tbegin (operands[0], operands[1], operands[2], false);
10721 ; Clobber VRs since they don't get restored
10722 (define_insn "tbegin_1_z13"
10723 [(set (reg:CCRAW CC_REGNUM)
10724 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10726 (set (match_operand:BLK 1 "memory_operand" "=Q")
10727 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))
10728 (clobber (reg:TI 16)) (clobber (reg:TI 38))
10729 (clobber (reg:TI 17)) (clobber (reg:TI 39))
10730 (clobber (reg:TI 18)) (clobber (reg:TI 40))
10731 (clobber (reg:TI 19)) (clobber (reg:TI 41))
10732 (clobber (reg:TI 20)) (clobber (reg:TI 42))
10733 (clobber (reg:TI 21)) (clobber (reg:TI 43))
10734 (clobber (reg:TI 22)) (clobber (reg:TI 44))
10735 (clobber (reg:TI 23)) (clobber (reg:TI 45))
10736 (clobber (reg:TI 24)) (clobber (reg:TI 46))
10737 (clobber (reg:TI 25)) (clobber (reg:TI 47))
10738 (clobber (reg:TI 26)) (clobber (reg:TI 48))
10739 (clobber (reg:TI 27)) (clobber (reg:TI 49))
10740 (clobber (reg:TI 28)) (clobber (reg:TI 50))
10741 (clobber (reg:TI 29)) (clobber (reg:TI 51))
10742 (clobber (reg:TI 30)) (clobber (reg:TI 52))
10743 (clobber (reg:TI 31)) (clobber (reg:TI 53))]
10744 ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is
10745 ; not supposed to be used for immediates (see genpreds.c).
10746 "TARGET_VX && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10748 [(set_attr "op_type" "SIL")])
10750 (define_insn "tbegin_1"
10751 [(set (reg:CCRAW CC_REGNUM)
10752 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10754 (set (match_operand:BLK 1 "memory_operand" "=Q")
10755 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))
10756 (clobber (reg:DF 16))
10757 (clobber (reg:DF 17))
10758 (clobber (reg:DF 18))
10759 (clobber (reg:DF 19))
10760 (clobber (reg:DF 20))
10761 (clobber (reg:DF 21))
10762 (clobber (reg:DF 22))
10763 (clobber (reg:DF 23))
10764 (clobber (reg:DF 24))
10765 (clobber (reg:DF 25))
10766 (clobber (reg:DF 26))
10767 (clobber (reg:DF 27))
10768 (clobber (reg:DF 28))
10769 (clobber (reg:DF 29))
10770 (clobber (reg:DF 30))
10771 (clobber (reg:DF 31))]
10772 ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is
10773 ; not supposed to be used for immediates (see genpreds.c).
10774 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10776 [(set_attr "op_type" "SIL")])
10778 ; Same as above but without the FPR clobbers
10779 (define_insn "tbegin_nofloat_1"
10780 [(set (reg:CCRAW CC_REGNUM)
10781 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10783 (set (match_operand:BLK 1 "memory_operand" "=Q")
10784 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))]
10785 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10787 [(set_attr "op_type" "SIL")])
10790 ; Constrained transaction begin
10792 (define_expand "tbeginc"
10793 [(set (reg:CCRAW CC_REGNUM)
10794 (unspec_volatile:CCRAW [(const_int TBEGINC_MASK)]
10799 (define_insn "*tbeginc_1"
10800 [(set (reg:CCRAW CC_REGNUM)
10801 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" " D")]
10803 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10805 [(set_attr "op_type" "SIL")])
10809 (define_expand "tend"
10810 [(set (reg:CCRAW CC_REGNUM)
10811 (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))
10812 (set (match_operand:SI 0 "register_operand" "")
10813 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
10817 (define_insn "*tend_1"
10818 [(set (reg:CCRAW CC_REGNUM)
10819 (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))]
10822 [(set_attr "op_type" "S")])
10824 ; Transaction abort
10826 (define_expand "tabort"
10827 [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "")]
10829 "TARGET_HTM && operands != NULL"
10831 if (CONST_INT_P (operands[0])
10832 && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 255)
10834 error ("Invalid transaction abort code: " HOST_WIDE_INT_PRINT_DEC
10835 ". Values in range 0 through 255 are reserved.",
10836 INTVAL (operands[0]));
10841 (define_insn "*tabort_1"
10842 [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "Y")]
10844 "TARGET_HTM && operands != NULL"
10846 [(set_attr "op_type" "S")])
10848 ; Transaction extract nesting depth
10850 (define_insn "etnd"
10851 [(set (match_operand:SI 0 "register_operand" "=d")
10852 (unspec_volatile:SI [(const_int 0)] UNSPECV_ETND))]
10855 [(set_attr "op_type" "RRE")])
10857 ; Non-transactional store
10859 (define_insn "ntstg"
10860 [(set (match_operand:DI 0 "memory_operand" "=RT")
10861 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "d")]
10865 [(set_attr "op_type" "RXY")])
10867 ; Transaction perform processor assist
10869 (define_expand "tx_assist"
10870 [(unspec_volatile [(match_operand:SI 0 "register_operand" "")
10871 (reg:SI GPR0_REGNUM)
10877 (define_insn "*ppa"
10878 [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")
10879 (match_operand:SI 1 "register_operand" "d")
10880 (match_operand 2 "const_int_operand" "I")]
10882 "TARGET_HTM && INTVAL (operands[2]) < 16"
10884 [(set_attr "op_type" "RRF")])
10887 ; Set and get floating point control register
10889 (define_insn "sfpc"
10890 [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")]
10892 "TARGET_HARD_FLOAT"
10895 (define_insn "efpc"
10896 [(set (match_operand:SI 0 "register_operand" "=d")
10897 (unspec_volatile:SI [(const_int 0)] UNSPECV_EFPC))]
10898 "TARGET_HARD_FLOAT"
10902 ; Load count to block boundary
10904 (define_insn "lcbb"
10905 [(set (match_operand:SI 0 "register_operand" "=d")
10906 (unspec:SI [(match_operand:SI 1 "address_operand" "ZQZR")
10907 (match_operand:SI 2 "immediate_operand" "C")] UNSPEC_LCBB))
10908 (clobber (reg:CC CC_REGNUM))]
10911 [(set_attr "op_type" "VRX")])