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 ; Split stack support
120 ; Test Data Class (TDC)
132 UNSPEC_FPINT_NEARBYINT
141 UNSPEC_VEC_SMULT_EVEN
142 UNSPEC_VEC_UMULT_EVEN
156 UNSPEC_VEC_INSERT_AND_ZERO
157 UNSPEC_VEC_LOAD_BNDRY
162 UNSPEC_VEC_PACK_SATURATE
163 UNSPEC_VEC_PACK_SATURATE_CC
164 UNSPEC_VEC_PACK_SATURATE_GENCC
165 UNSPEC_VEC_PACK_UNSIGNED_SATURATE
166 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_CC
167 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_GENCC
179 UNSPEC_VEC_ADDEC_U128
184 UNSPEC_VEC_GFMSUM_128
185 UNSPEC_VEC_GFMSUM_ACCUM
186 UNSPEC_VEC_GFMSUM_ACCUM_128
205 UNSPEC_VEC_SUBEC_U128
239 ;; UNSPEC_VOLATILE usage
242 (define_c_enum "unspecv" [
264 ; Hotpatching (unremovable NOPs)
269 ; Transactional Execution support
279 ; Set and get floating point control register
283 ; Split stack support
284 UNSPECV_SPLIT_STACK_CALL
285 UNSPECV_SPLIT_STACK_DATA
292 ; Registers with special meaning
296 ; Sibling call register.
298 ; Literal pool base register.
300 ; Return address register.
302 ; Condition code register.
304 ; Thread local storage pointer register.
308 ; Hardware register names
312 ; General purpose registers
317 ; Floating point registers.
342 ;; PFPO GPR0 argument format
347 ; PFPO operation type
348 (PFPO_CONVERT 0x1000000)
350 (PFPO_OP_TYPE_SF 0x5)
351 (PFPO_OP_TYPE_DF 0x6)
352 (PFPO_OP_TYPE_TF 0x7)
353 (PFPO_OP_TYPE_SD 0x8)
354 (PFPO_OP_TYPE_DD 0x9)
355 (PFPO_OP_TYPE_TD 0xa)
356 ; Bitposition of operand types
357 (PFPO_OP0_TYPE_SHIFT 16)
358 (PFPO_OP1_TYPE_SHIFT 8)
361 ; Immediate operands for tbegin and tbeginc
362 (define_constants [(TBEGIN_MASK 65292)]) ; 0xff0c
363 (define_constants [(TBEGINC_MASK 65288)]) ; 0xff08
365 ;; Instruction operand type as used in the Principles of Operation.
366 ;; Used to determine defaults for length and other attribute values.
368 (define_attr "op_type"
369 "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"
372 ;; Instruction type attribute used for scheduling.
374 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
375 cs,vs,store,sem,idiv,
376 imulhi,imulsi,imuldi,
377 branch,jsr,fsimptf,fsimpdf,fsimpsf,fhex,
378 floadtf,floaddf,floadsf,fstoredf,fstoresf,
379 fmultf,fmuldf,fmulsf,fdivtf,fdivdf,fdivsf,
380 ftoi,fsqrttf,fsqrtdf,fsqrtsf,
382 ftrunctf,ftruncdf, ftruncsd, ftruncdd,
383 itoftf, itofdf, itofsf, itofdd, itoftd,
384 fdivdd, fdivtd, floaddd, floadsd, fmuldd, fmultd,
385 fsimpdd, fsimpsd, fsimptd, fstoredd, fstoresd,
387 (cond [(eq_attr "op_type" "NN") (const_string "other")
388 (eq_attr "op_type" "SS") (const_string "cs")]
389 (const_string "integer")))
391 ;; Another attribute used for scheduling purposes:
392 ;; agen: Instruction uses the address generation unit
393 ;; reg: Instruction does not use the agen unit
395 (define_attr "atype" "agen,reg"
396 (if_then_else (eq_attr "op_type" "E,RR,RI,RRE,RSI,RIL,RIE,RRF,RRR")
398 (const_string "agen")))
400 ;; Properties concerning Z10 execution grouping and value forwarding.
401 ;; z10_super: instruction is superscalar.
402 ;; z10_super_c: instruction is superscalar and meets the condition of z10_c.
403 ;; z10_fwd: The instruction reads the value of an operand and stores it into a
404 ;; target register. It can forward this value to a second instruction that reads
405 ;; the same register if that second instruction is issued in the same group.
406 ;; z10_rec: The instruction is in the T pipeline and reads a register. If the
407 ;; instruction in the S pipe writes to the register, then the T instruction
408 ;; can immediately read the new value.
409 ;; z10_fr: union of Z10_fwd and z10_rec.
410 ;; z10_c: second operand of instruction is a register and read with complemented bits.
412 ;; An additional suffix A1, A3, or E1 indicates the respective AGI bypass.
415 (define_attr "z10prop" "none,
416 z10_super, z10_super_E1, z10_super_A1, z10_super_c, z10_super_c_E1,
417 z10_fwd, z10_fwd_A1, z10_fwd_A3, z10_fwd_E1,
419 z10_fr, z10_fr_A3, z10_fr_E1,
421 (const_string "none"))
423 ;; Properties concerning Z196 decoding
424 ;; z196_alone: must group alone
425 ;; z196_end: ends a group
426 ;; z196_cracked: instruction is cracked or expanded
427 (define_attr "z196prop" "none,
428 z196_alone, z196_ends,
430 (const_string "none"))
432 (define_attr "mnemonic" "bcr_flush,unknown" (const_string "unknown"))
436 (define_attr "length" ""
437 (cond [(eq_attr "op_type" "E,RR") (const_int 2)
438 (eq_attr "op_type" "RX,RI,RRE,RS,RSI,S,SI,RRF,RRR") (const_int 4)]
442 ;; Processor type. This attribute must exactly match the processor_type
443 ;; enumeration in s390.h. The current machine description does not
444 ;; distinguish between g5 and g6, but there are differences between the two
445 ;; CPUs could in theory be modeled.
447 (define_attr "cpu" "g5,g6,z900,z990,z9_109,z9_ec,z10,z196,zEC12,z13"
448 (const (symbol_ref "s390_tune_attr")))
450 (define_attr "cpu_facility"
451 "standard,ieee,zarch,cpu_zarch,longdisp,extimm,dfp,z10,z196,zEC12,vec"
452 (const_string "standard"))
454 (define_attr "enabled" ""
455 (cond [(eq_attr "cpu_facility" "standard")
458 (and (eq_attr "cpu_facility" "ieee")
459 (match_test "TARGET_CPU_IEEE_FLOAT"))
462 (and (eq_attr "cpu_facility" "zarch")
463 (match_test "TARGET_ZARCH"))
466 (and (eq_attr "cpu_facility" "longdisp")
467 (match_test "TARGET_LONG_DISPLACEMENT"))
470 (and (eq_attr "cpu_facility" "extimm")
471 (match_test "TARGET_EXTIMM"))
474 (and (eq_attr "cpu_facility" "dfp")
475 (match_test "TARGET_DFP"))
478 (and (eq_attr "cpu_facility" "cpu_zarch")
479 (match_test "TARGET_CPU_ZARCH"))
482 (and (eq_attr "cpu_facility" "z10")
483 (match_test "TARGET_Z10"))
486 (and (eq_attr "cpu_facility" "z196")
487 (match_test "TARGET_Z196"))
490 (and (eq_attr "cpu_facility" "zEC12")
491 (match_test "TARGET_ZEC12"))
494 (and (eq_attr "cpu_facility" "vec")
495 (match_test "TARGET_VX"))
499 ;; Pipeline description for z900. For lack of anything better,
500 ;; this description is also used for the g5 and g6.
503 ;; Pipeline description for z990, z9-109 and z9-ec.
506 ;; Pipeline description for z10
509 ;; Pipeline description for z196
512 ;; Pipeline description for zEC12
516 (include "predicates.md")
518 ;; Constraint definitions
519 (include "constraints.md")
526 (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])
528 ;; These mode iterators allow floating point patterns to be generated from the
530 (define_mode_iterator FP_ALL [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")
531 (SD "TARGET_HARD_DFP")])
532 (define_mode_iterator FP [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")])
533 (define_mode_iterator BFP [TF DF SF])
534 (define_mode_iterator DFP [TD DD])
535 (define_mode_iterator DFP_ALL [TD DD SD])
536 (define_mode_iterator DSF [DF SF])
537 (define_mode_iterator SD_SF [SF SD])
538 (define_mode_iterator DD_DF [DF DD])
539 (define_mode_iterator TD_TF [TF TD])
541 ;; These mode iterators allow 31-bit and 64-bit GPR patterns to be generated
542 ;; from the same template.
543 (define_mode_iterator GPR [(DI "TARGET_ZARCH") SI])
544 (define_mode_iterator DGPR [(TI "TARGET_ZARCH") DI SI])
545 (define_mode_iterator DSI [DI SI])
546 (define_mode_iterator TDI [TI DI])
548 ;; These mode iterators allow :P to be used for patterns that operate on
549 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
550 (define_mode_iterator P [(DI "TARGET_64BIT") (SI "!TARGET_64BIT")])
552 ;; These macros refer to the actual word_mode of the configuration.
553 ;; This is equal to Pmode except on 31-bit machines in zarch mode.
554 (define_mode_iterator DW [(TI "TARGET_ZARCH") (DI "!TARGET_ZARCH")])
555 (define_mode_iterator W [(DI "TARGET_ZARCH") (SI "!TARGET_ZARCH")])
557 ;; Used by the umul pattern to express modes having half the size.
558 (define_mode_attr DWH [(TI "DI") (DI "SI")])
559 (define_mode_attr dwh [(TI "di") (DI "si")])
561 ;; This mode iterator allows the QI and HI patterns to be defined from
562 ;; the same template.
563 (define_mode_iterator HQI [HI QI])
565 ;; This mode iterator allows the integer patterns to be defined from the
567 (define_mode_iterator INT [(DI "TARGET_ZARCH") SI HI QI])
568 (define_mode_iterator DINT [(TI "TARGET_ZARCH") DI SI HI QI])
570 ;; This iterator allows some 'ashift' and 'lshiftrt' pattern to be defined from
571 ;; the same template.
572 (define_code_iterator SHIFT [ashift lshiftrt])
574 ;; This iterator allows r[ox]sbg to be defined with the same template
575 (define_code_iterator IXOR [ior xor])
577 ;; This iterator is used to expand the patterns for the nearest
578 ;; integer functions.
579 (define_int_iterator FPINT [UNSPEC_FPINT_FLOOR UNSPEC_FPINT_BTRUNC
580 UNSPEC_FPINT_ROUND UNSPEC_FPINT_CEIL
581 UNSPEC_FPINT_NEARBYINT])
582 (define_int_attr fpint_name [(UNSPEC_FPINT_FLOOR "floor")
583 (UNSPEC_FPINT_BTRUNC "btrunc")
584 (UNSPEC_FPINT_ROUND "round")
585 (UNSPEC_FPINT_CEIL "ceil")
586 (UNSPEC_FPINT_NEARBYINT "nearbyint")])
587 (define_int_attr fpint_roundingmode [(UNSPEC_FPINT_FLOOR "7")
588 (UNSPEC_FPINT_BTRUNC "5")
589 (UNSPEC_FPINT_ROUND "1")
590 (UNSPEC_FPINT_CEIL "6")
591 (UNSPEC_FPINT_NEARBYINT "0")])
593 ;; This iterator and attribute allow to combine most atomic operations.
594 (define_code_iterator ATOMIC [and ior xor plus minus mult])
595 (define_code_iterator ATOMIC_Z196 [and ior xor plus])
596 (define_code_attr atomic [(and "and") (ior "or") (xor "xor")
597 (plus "add") (minus "sub") (mult "nand")])
598 (define_code_attr noxa [(and "n") (ior "o") (xor "x") (plus "a")])
600 ;; In FP templates, a string like "lt<de>br" will expand to "ltxbr" in
601 ;; TF/TDmode, "ltdbr" in DF/DDmode, and "ltebr" in SF/SDmode.
602 (define_mode_attr xde [(TF "x") (DF "d") (SF "e") (TD "x") (DD "d") (SD "e")])
604 ;; In FP templates, a <dee> in "m<dee><bt>r" will expand to "mx<bt>r" in
605 ;; TF/TDmode, "md<bt>r" in DF/DDmode, "mee<bt>r" in SFmode and "me<bt>r in
607 (define_mode_attr xdee [(TF "x") (DF "d") (SF "ee") (TD "x") (DD "d") (SD "e")])
609 ;; In FP templates, "<RRe>" will expand to "RRE" in TFmode and "RR" otherwise.
610 ;; Likewise for "<RXe>".
611 (define_mode_attr RRe [(TF "RRE") (DF "RR") (SF "RR")])
612 (define_mode_attr RXe [(TF "RXE") (DF "RX") (SF "RX")])
614 ;; The decimal floating point variants of add, sub, div and mul support 3
615 ;; fp register operands. The following attributes allow to merge the bfp and
616 ;; dfp variants in a single insn definition.
618 ;; This attribute is used to set op_type accordingly.
619 (define_mode_attr RRer [(TF "RRE") (DF "RRE") (SF "RRE") (TD "RRR")
620 (DD "RRR") (SD "RRR")])
622 ;; This attribute is used in the operand constraint list in order to have the
623 ;; first and the second operand match for bfp modes.
624 (define_mode_attr f0 [(TF "0") (DF "0") (SF "0") (TD "f") (DD "f") (DD "f")])
626 ;; This attribute is used to merge the scalar vector instructions into
627 ;; the FP patterns. For non-supported modes (all but DF) it expands
628 ;; to constraints which are supposed to be matched by an earlier
630 (define_mode_attr v0 [(TF "0") (DF "v") (SF "0") (TD "0") (DD "0") (DD "0") (TI "0") (DI "v") (SI "0")])
631 (define_mode_attr vf [(TF "f") (DF "v") (SF "f") (TD "f") (DD "f") (DD "f") (TI "f") (DI "v") (SI "f")])
632 (define_mode_attr vd [(TF "d") (DF "v") (SF "d") (TD "d") (DD "d") (DD "d") (TI "d") (DI "v") (SI "d")])
634 ;; This attribute is used in the operand list of the instruction to have an
635 ;; additional operand for the dfp instructions.
636 (define_mode_attr op1 [(TF "") (DF "") (SF "")
637 (TD "%1,") (DD "%1,") (SD "%1,")])
640 ;; This attribute is used in the operand constraint list
641 ;; for instructions dealing with the sign bit of 32 or 64bit fp values.
642 ;; TFmode values are represented by a fp register pair. Since the
643 ;; sign bit instructions only handle single source and target fp registers
644 ;; these instructions can only be used for TFmode values if the source and
645 ;; target operand uses the same fp register.
646 (define_mode_attr fT0 [(TF "0") (DF "f") (SF "f")])
648 ;; In FP templates, "<Rf>" will expand to "f" in TFmode and "R" otherwise.
649 ;; This is used to disable the memory alternative in TFmode patterns.
650 (define_mode_attr Rf [(TF "f") (DF "R") (SF "R") (TD "f") (DD "f") (SD "f")])
652 ;; This attribute adds b for bfp instructions and t for dfp instructions and is used
653 ;; within instruction mnemonics.
654 (define_mode_attr bt [(TF "b") (DF "b") (SF "b") (TD "t") (DD "t") (SD "t")])
656 ;; This attribute is used within instruction mnemonics. It evaluates to d for dfp
657 ;; modes and to an empty string for bfp modes.
658 (define_mode_attr _d [(TF "") (DF "") (SF "") (TD "d") (DD "d") (SD "d")])
660 ;; In GPR and P templates, a constraint like "<d0>" will expand to "d" in DImode
661 ;; and "0" in SImode. This allows to combine instructions of which the 31bit
662 ;; version only operates on one register.
663 (define_mode_attr d0 [(DI "d") (SI "0")])
665 ;; In combination with d0 this allows to combine instructions of which the 31bit
666 ;; version only operates on one register. The DImode version needs an additional
667 ;; register for the assembler output.
668 (define_mode_attr 1 [(DI "%1,") (SI "")])
670 ;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in
671 ;; 'ashift' and "srdl" in 'lshiftrt'.
672 (define_code_attr lr [(ashift "l") (lshiftrt "r")])
674 ;; In SHIFT templates, this attribute holds the correct standard name for the
675 ;; pattern itself and the corresponding function calls.
676 (define_code_attr shift [(ashift "ashl") (lshiftrt "lshr")])
678 ;; This attribute handles differences in the instruction 'type' and will result
679 ;; in "RRE" for DImode and "RR" for SImode.
680 (define_mode_attr E [(DI "E") (SI "")])
682 ;; This attribute handles differences in the instruction 'type' and makes RX<Y>
683 ;; to result in "RXY" for DImode and "RX" for SImode.
684 (define_mode_attr Y [(DI "Y") (SI "")])
686 ;; This attribute handles differences in the instruction 'type' and will result
687 ;; in "RSE" for TImode and "RS" for DImode.
688 (define_mode_attr TE [(TI "E") (DI "")])
690 ;; In GPR templates, a string like "lc<g>r" will expand to "lcgr" in DImode
691 ;; and "lcr" in SImode.
692 (define_mode_attr g [(DI "g") (SI "")])
694 ;; In GPR templates, a string like "sl<y>" will expand to "slg" in DImode
695 ;; and "sly" in SImode. This is useful because on 64bit the ..g instructions
696 ;; were enhanced with long displacements whereas 31bit instructions got a ..y
697 ;; variant for long displacements.
698 (define_mode_attr y [(DI "g") (SI "y")])
700 ;; In DW templates, a string like "cds<g>" will expand to "cdsg" in TImode
701 ;; and "cds" in DImode.
702 (define_mode_attr tg [(TI "g") (DI "")])
704 ;; In TDI templates, a string like "c<d>sg".
705 (define_mode_attr td [(TI "d") (DI "")])
707 ;; In GPR templates, a string like "c<gf>dbr" will expand to "cgdbr" in DImode
708 ;; and "cfdbr" in SImode.
709 (define_mode_attr gf [(DI "g") (SI "f")])
711 ;; In GPR templates, a string like sll<gk> will expand to sllg for DI
712 ;; and sllk for SI. This way it is possible to merge the new z196 SI
713 ;; 3 operands shift instructions into the existing patterns.
714 (define_mode_attr gk [(DI "g") (SI "k")])
716 ;; ICM mask required to load MODE value into the lowest subreg
717 ;; of a SImode register.
718 (define_mode_attr icm_lo [(HI "3") (QI "1")])
720 ;; In HQI templates, a string like "llg<hc>" will expand to "llgh" in
721 ;; HImode and "llgc" in QImode.
722 (define_mode_attr hc [(HI "h") (QI "c")])
724 ;; In P templates, the mode <DBL> will expand to "TI" in DImode and "DI"
726 (define_mode_attr DBL [(DI "TI") (SI "DI")])
728 ;; This attribute expands to DF for TFmode and to DD for TDmode . It is
729 ;; used for Txmode splitters splitting a Txmode copy into 2 Dxmode copies.
730 (define_mode_attr HALF_TMODE [(TF "DF") (TD "DD")])
732 ;; Maximum unsigned integer that fits in MODE.
733 (define_mode_attr max_uint [(HI "65535") (QI "255")])
735 ;; Start and end field computations for RISBG et al.
736 (define_mode_attr bfstart [(DI "s") (SI "t")])
737 (define_mode_attr bfend [(DI "e") (SI "f")])
739 ;; In place of GET_MODE_BITSIZE (<MODE>mode)
740 (define_mode_attr bitsize [(DI "64") (SI "32") (HI "16") (QI "8")])
742 ;; In place of GET_MODE_SIZE (<MODE>mode)
743 (define_mode_attr modesize [(DI "8") (SI "4")])
745 ;; Allow return and simple_return to be defined from a single template.
746 (define_code_iterator ANY_RETURN [return simple_return])
750 ; Condition code modes generated by vector fp comparisons. These will
751 ; be used also in single element mode.
752 (define_mode_iterator VFCMP [CCVEQ CCVFH CCVFHE])
753 ; Used with VFCMP to expand part of the mnemonic
754 ; For fp we have a mismatch: eq in the insn name - e in asm
755 (define_mode_attr asm_fcmp [(CCVEQ "e") (CCVFH "h") (CCVFHE "he")])
756 (define_mode_attr insn_cmp [(CCVEQ "eq") (CCVH "h") (CCVHU "hl") (CCVFH "h") (CCVFHE "he")])
759 (include "vector.md")
762 ;;- Compare instructions.
765 ; Test-under-Mask instructions
767 (define_insn "*tmqi_mem"
768 [(set (reg CC_REGNUM)
769 (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S")
770 (match_operand:QI 1 "immediate_operand" "n,n"))
771 (match_operand:QI 2 "immediate_operand" "n,n")))]
772 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], false))"
776 [(set_attr "op_type" "SI,SIY")
777 (set_attr "z10prop" "z10_super,z10_super")])
779 (define_insn "*tmdi_reg"
780 [(set (reg CC_REGNUM)
781 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
782 (match_operand:DI 1 "immediate_operand"
783 "N0HD0,N1HD0,N2HD0,N3HD0"))
784 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
786 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
787 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
793 [(set_attr "op_type" "RI")
794 (set_attr "z10prop" "z10_super,z10_super,z10_super,z10_super")])
796 (define_insn "*tmsi_reg"
797 [(set (reg CC_REGNUM)
798 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
799 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
800 (match_operand:SI 2 "immediate_operand" "n,n")))]
801 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
802 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
806 [(set_attr "op_type" "RI")
807 (set_attr "z10prop" "z10_super,z10_super")])
809 (define_insn "*tm<mode>_full"
810 [(set (reg CC_REGNUM)
811 (compare (match_operand:HQI 0 "register_operand" "d")
812 (match_operand:HQI 1 "immediate_operand" "n")))]
813 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], true))"
815 [(set_attr "op_type" "RI")
816 (set_attr "z10prop" "z10_super")])
820 ; Load-and-Test instructions
823 ; tst(di|si) instruction pattern(s).
825 (define_insn "*tstdi_sign"
826 [(set (reg CC_REGNUM)
830 (subreg:DI (match_operand:SI 0 "nonimmediate_operand" "d,RT") 0)
831 (const_int 32)) (const_int 32))
832 (match_operand:DI 1 "const0_operand" "")))
833 (set (match_operand:DI 2 "register_operand" "=d,d")
834 (sign_extend:DI (match_dup 0)))]
835 "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH"
838 [(set_attr "op_type" "RRE,RXY")
839 (set_attr "cpu_facility" "*,z10")
840 (set_attr "z10prop" "z10_super_E1,z10_super_E1") ])
843 (define_insn "*tst<mode>_extimm"
844 [(set (reg CC_REGNUM)
845 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,RT")
846 (match_operand:GPR 1 "const0_operand" "")))
847 (set (match_operand:GPR 2 "register_operand" "=d,d")
849 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
853 [(set_attr "op_type" "RR<E>,RXY")
854 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3") ])
857 (define_insn "*tst<mode>_cconly_extimm"
858 [(set (reg CC_REGNUM)
859 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,RT")
860 (match_operand:GPR 1 "const0_operand" "")))
861 (clobber (match_scratch:GPR 2 "=X,d"))]
862 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
866 [(set_attr "op_type" "RR<E>,RXY")
867 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3")])
869 (define_insn "*tstdi"
870 [(set (reg CC_REGNUM)
871 (compare (match_operand:DI 0 "register_operand" "d")
872 (match_operand:DI 1 "const0_operand" "")))
873 (set (match_operand:DI 2 "register_operand" "=d")
875 "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH && !TARGET_EXTIMM"
877 [(set_attr "op_type" "RRE")
878 (set_attr "z10prop" "z10_fr_E1")])
880 (define_insn "*tstsi"
881 [(set (reg CC_REGNUM)
882 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
883 (match_operand:SI 1 "const0_operand" "")))
884 (set (match_operand:SI 2 "register_operand" "=d,d,d")
886 "s390_match_ccmode(insn, CCSmode) && !TARGET_EXTIMM"
891 [(set_attr "op_type" "RR,RS,RSY")
892 (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
894 (define_insn "*tstsi_cconly"
895 [(set (reg CC_REGNUM)
896 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
897 (match_operand:SI 1 "const0_operand" "")))
898 (clobber (match_scratch:SI 2 "=X,d,d"))]
899 "s390_match_ccmode(insn, CCSmode)"
904 [(set_attr "op_type" "RR,RS,RSY")
905 (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
907 (define_insn "*tstdi_cconly_31"
908 [(set (reg CC_REGNUM)
909 (compare (match_operand:DI 0 "register_operand" "d")
910 (match_operand:DI 1 "const0_operand" "")))]
911 "s390_match_ccmode(insn, CCSmode) && !TARGET_ZARCH"
913 [(set_attr "op_type" "RS")
914 (set_attr "atype" "reg")])
917 (define_insn "*tst<mode>_cconly2"
918 [(set (reg CC_REGNUM)
919 (compare (match_operand:GPR 0 "register_operand" "d")
920 (match_operand:GPR 1 "const0_operand" "")))]
921 "s390_match_ccmode(insn, CCSmode)"
923 [(set_attr "op_type" "RR<E>")
924 (set_attr "z10prop" "z10_fr_E1")])
926 ; tst(hi|qi) instruction pattern(s).
928 (define_insn "*tst<mode>CCT"
929 [(set (reg CC_REGNUM)
930 (compare (match_operand:HQI 0 "nonimmediate_operand" "?Q,?S,d")
931 (match_operand:HQI 1 "const0_operand" "")))
932 (set (match_operand:HQI 2 "register_operand" "=d,d,0")
934 "s390_match_ccmode(insn, CCTmode)"
937 icmy\t%2,<icm_lo>,%S0
939 [(set_attr "op_type" "RS,RSY,RI")
940 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
942 (define_insn "*tsthiCCT_cconly"
943 [(set (reg CC_REGNUM)
944 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
945 (match_operand:HI 1 "const0_operand" "")))
946 (clobber (match_scratch:HI 2 "=d,d,X"))]
947 "s390_match_ccmode(insn, CCTmode)"
952 [(set_attr "op_type" "RS,RSY,RI")
953 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
955 (define_insn "*tstqiCCT_cconly"
956 [(set (reg CC_REGNUM)
957 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
958 (match_operand:QI 1 "const0_operand" "")))]
959 "s390_match_ccmode(insn, CCTmode)"
964 [(set_attr "op_type" "SI,SIY,RI")
965 (set_attr "z10prop" "z10_super,z10_super,z10_super")])
967 (define_insn "*tst<mode>"
968 [(set (reg CC_REGNUM)
969 (compare (match_operand:HQI 0 "s_operand" "Q,S")
970 (match_operand:HQI 1 "const0_operand" "")))
971 (set (match_operand:HQI 2 "register_operand" "=d,d")
973 "s390_match_ccmode(insn, CCSmode)"
976 icmy\t%2,<icm_lo>,%S0"
977 [(set_attr "op_type" "RS,RSY")
978 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
980 (define_insn "*tst<mode>_cconly"
981 [(set (reg CC_REGNUM)
982 (compare (match_operand:HQI 0 "s_operand" "Q,S")
983 (match_operand:HQI 1 "const0_operand" "")))
984 (clobber (match_scratch:HQI 2 "=d,d"))]
985 "s390_match_ccmode(insn, CCSmode)"
988 icmy\t%2,<icm_lo>,%S0"
989 [(set_attr "op_type" "RS,RSY")
990 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
993 ; Compare (equality) instructions
995 (define_insn "*cmpdi_cct"
996 [(set (reg CC_REGNUM)
997 (compare (match_operand:DI 0 "nonimmediate_operand" "%d,d,d,d,Q")
998 (match_operand:DI 1 "general_operand" "d,K,Os,RT,BQ")))]
999 "s390_match_ccmode (insn, CCTmode) && TARGET_ZARCH"
1006 [(set_attr "op_type" "RRE,RI,RIL,RXY,SS")
1007 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,*")])
1009 (define_insn "*cmpsi_cct"
1010 [(set (reg CC_REGNUM)
1011 (compare (match_operand:SI 0 "nonimmediate_operand" "%d,d,d,d,d,Q")
1012 (match_operand:SI 1 "general_operand" "d,K,Os,R,T,BQ")))]
1013 "s390_match_ccmode (insn, CCTmode)"
1021 [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS")
1022 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*")])
1024 ; Compare (signed) instructions
1026 (define_insn "*cmpdi_ccs_sign"
1027 [(set (reg CC_REGNUM)
1028 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand"
1030 (match_operand:DI 0 "register_operand" "d, d,d")))]
1031 "s390_match_ccmode(insn, CCSRmode) && TARGET_ZARCH"
1036 [(set_attr "op_type" "RRE,RXY,RIL")
1037 (set_attr "z10prop" "z10_c,*,*")
1038 (set_attr "type" "*,*,larl")])
1042 (define_insn "*cmpsi_ccs_sign"
1043 [(set (reg CC_REGNUM)
1044 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T,b"))
1045 (match_operand:SI 0 "register_operand" "d,d,d")))]
1046 "s390_match_ccmode(insn, CCSRmode)"
1051 [(set_attr "op_type" "RX,RXY,RIL")
1052 (set_attr "cpu_facility" "*,*,z10")
1053 (set_attr "type" "*,*,larl")
1054 (set_attr "z196prop" "z196_cracked,z196_cracked,z196_cracked")])
1056 (define_insn "*cmphi_ccs_z10"
1057 [(set (reg CC_REGNUM)
1058 (compare (match_operand:HI 0 "s_operand" "Q")
1059 (match_operand:HI 1 "immediate_operand" "K")))]
1060 "s390_match_ccmode(insn, CCSmode) && TARGET_Z10"
1062 [(set_attr "op_type" "SIL")
1063 (set_attr "z196prop" "z196_cracked")])
1065 (define_insn "*cmpdi_ccs_signhi_rl"
1066 [(set (reg CC_REGNUM)
1067 (compare (sign_extend:DI (match_operand:HI 1 "memory_operand" "RT,b"))
1068 (match_operand:GPR 0 "register_operand" "d,d")))]
1069 "s390_match_ccmode(insn, CCSRmode) && TARGET_Z10"
1073 [(set_attr "op_type" "RXY,RIL")
1074 (set_attr "type" "*,larl")])
1076 ; cr, chi, cfi, c, cy, cgr, cghi, cgfi, cg, chsi, cghsi, crl, cgrl
1077 (define_insn "*cmp<mode>_ccs"
1078 [(set (reg CC_REGNUM)
1079 (compare (match_operand:GPR 0 "nonimmediate_operand"
1081 (match_operand:GPR 1 "general_operand"
1082 "d,K,K,Os,R,T,b")))]
1083 "s390_match_ccmode(insn, CCSmode)"
1092 [(set_attr "op_type" "RR<E>,RI,SIL,RIL,RX<Y>,RXY,RIL")
1093 (set_attr "cpu_facility" "*,*,z10,extimm,*,*,z10")
1094 (set_attr "type" "*,*,*,*,*,*,larl")
1095 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,z10_super")])
1098 ; Compare (unsigned) instructions
1100 (define_insn "*cmpsi_ccu_zerohi_rlsi"
1101 [(set (reg CC_REGNUM)
1102 (compare (zero_extend:SI (mem:HI (match_operand:SI 1
1103 "larl_operand" "X")))
1104 (match_operand:SI 0 "register_operand" "d")))]
1105 "s390_match_ccmode(insn, CCURmode) && TARGET_Z10"
1107 [(set_attr "op_type" "RIL")
1108 (set_attr "type" "larl")
1109 (set_attr "z10prop" "z10_super")])
1112 (define_insn "*cmp<GPR:mode>_ccu_zerohi_rldi"
1113 [(set (reg CC_REGNUM)
1114 (compare (zero_extend:GPR (mem:HI (match_operand:DI 1
1115 "larl_operand" "X")))
1116 (match_operand:GPR 0 "register_operand" "d")))]
1117 "s390_match_ccmode(insn, CCURmode) && TARGET_Z10"
1119 [(set_attr "op_type" "RIL")
1120 (set_attr "type" "larl")
1121 (set_attr "z10prop" "z10_super")])
1123 (define_insn "*cmpdi_ccu_zero"
1124 [(set (reg CC_REGNUM)
1125 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand"
1127 (match_operand:DI 0 "register_operand" "d, d,d")))]
1128 "s390_match_ccmode (insn, CCURmode) && TARGET_ZARCH"
1133 [(set_attr "op_type" "RRE,RXY,RIL")
1134 (set_attr "cpu_facility" "*,*,z10")
1135 (set_attr "type" "*,*,larl")
1136 (set_attr "z10prop" "z10_super_c,z10_super_E1,z10_super")])
1138 (define_insn "*cmpdi_ccu"
1139 [(set (reg CC_REGNUM)
1140 (compare (match_operand:DI 0 "nonimmediate_operand"
1141 "d, d,d,Q, d, Q,BQ")
1142 (match_operand:DI 1 "general_operand"
1143 "d,Op,b,D,RT,BQ,Q")))]
1144 "s390_match_ccmode (insn, CCUmode) && TARGET_ZARCH"
1153 [(set_attr "op_type" "RRE,RIL,RIL,SIL,RXY,SS,SS")
1154 (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*")
1155 (set_attr "type" "*,*,larl,*,*,*,*")
1156 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*,*")])
1158 (define_insn "*cmpsi_ccu"
1159 [(set (reg CC_REGNUM)
1160 (compare (match_operand:SI 0 "nonimmediate_operand" "d, d,d,Q,d,d, Q,BQ")
1161 (match_operand:SI 1 "general_operand" "d,Os,b,D,R,T,BQ, Q")))]
1162 "s390_match_ccmode (insn, CCUmode)"
1172 [(set_attr "op_type" "RR,RIL,RIL,SIL,RX,RXY,SS,SS")
1173 (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*,*")
1174 (set_attr "type" "*,*,larl,*,*,*,*,*")
1175 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,*,*")])
1177 (define_insn "*cmphi_ccu"
1178 [(set (reg CC_REGNUM)
1179 (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,Q,BQ")
1180 (match_operand:HI 1 "general_operand" "Q,S,D,BQ,Q")))]
1181 "s390_match_ccmode (insn, CCUmode)
1182 && !register_operand (operands[1], HImode)"
1189 [(set_attr "op_type" "RS,RSY,SIL,SS,SS")
1190 (set_attr "cpu_facility" "*,*,z10,*,*")
1191 (set_attr "z10prop" "*,*,z10_super,*,*")])
1193 (define_insn "*cmpqi_ccu"
1194 [(set (reg CC_REGNUM)
1195 (compare (match_operand:QI 0 "nonimmediate_operand" "d,d,Q,S,Q,BQ")
1196 (match_operand:QI 1 "general_operand" "Q,S,n,n,BQ,Q")))]
1197 "s390_match_ccmode (insn, CCUmode)
1198 && !register_operand (operands[1], QImode)"
1206 [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS")
1207 (set_attr "z10prop" "*,*,z10_super,z10_super,*,*")])
1210 ; Block compare (CLC) instruction patterns.
1213 [(set (reg CC_REGNUM)
1214 (compare (match_operand:BLK 0 "memory_operand" "Q")
1215 (match_operand:BLK 1 "memory_operand" "Q")))
1216 (use (match_operand 2 "const_int_operand" "n"))]
1217 "s390_match_ccmode (insn, CCUmode)
1218 && INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
1219 "clc\t%O0(%2,%R0),%S1"
1220 [(set_attr "op_type" "SS")])
1223 [(set (reg CC_REGNUM)
1224 (compare (match_operand 0 "memory_operand" "")
1225 (match_operand 1 "memory_operand" "")))]
1227 && s390_match_ccmode (insn, CCUmode)
1228 && GET_MODE (operands[0]) == GET_MODE (operands[1])
1229 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
1231 [(set (match_dup 0) (match_dup 1))
1232 (use (match_dup 2))])]
1234 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
1235 operands[0] = adjust_address (operands[0], BLKmode, 0);
1236 operands[1] = adjust_address (operands[1], BLKmode, 0);
1238 operands[1] = gen_rtx_COMPARE (GET_MODE (SET_DEST (PATTERN (curr_insn))),
1239 operands[0], operands[1]);
1240 operands[0] = SET_DEST (PATTERN (curr_insn));
1244 ; (TF|DF|SF|TD|DD|SD) instructions
1246 ; ltxbr, ltdbr, ltebr, ltxtr, ltdtr
1247 (define_insn "*cmp<mode>_ccs_0"
1248 [(set (reg CC_REGNUM)
1249 (compare (match_operand:FP 0 "register_operand" "f")
1250 (match_operand:FP 1 "const0_operand" "")))]
1251 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
1252 "lt<xde><bt>r\t%0,%0"
1253 [(set_attr "op_type" "RRE")
1254 (set_attr "type" "fsimp<mode>")])
1256 ; cxtr, cxbr, cdtr, cdbr, cebr, cdb, ceb
1257 (define_insn "*cmp<mode>_ccs"
1258 [(set (reg CC_REGNUM)
1259 (compare (match_operand:FP 0 "register_operand" "f,f")
1260 (match_operand:FP 1 "general_operand" "f,<Rf>")))]
1261 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
1265 [(set_attr "op_type" "RRE,RXE")
1266 (set_attr "type" "fsimp<mode>")])
1268 ; wfcedbs, wfchdbs, wfchedbs
1269 (define_insn "*vec_cmp<insn_cmp>df_cconly"
1270 [(set (reg:VFCMP CC_REGNUM)
1271 (compare:VFCMP (match_operand:DF 0 "register_operand" "v")
1272 (match_operand:DF 1 "register_operand" "v")))
1273 (clobber (match_scratch:V2DI 2 "=v"))]
1274 "TARGET_Z13 && TARGET_HARD_FLOAT"
1275 "wfc<asm_fcmp>dbs\t%v2,%v0,%v1"
1276 [(set_attr "op_type" "VRR")])
1278 ; Compare and Branch instructions
1280 ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
1281 ; The following instructions do a complementary access of their second
1282 ; operand (z01 only): crj_c, cgrjc, cr, cgr
1283 (define_insn "*cmp_and_br_signed_<mode>"
1285 (if_then_else (match_operator 0 "s390_signed_integer_comparison"
1286 [(match_operand:GPR 1 "register_operand" "d,d")
1287 (match_operand:GPR 2 "nonmemory_operand" "d,C")])
1288 (label_ref (match_operand 3 "" ""))
1290 (clobber (reg:CC CC_REGNUM))]
1291 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1293 if (get_attr_length (insn) == 6)
1294 return which_alternative ?
1295 "c<g>ij%C0\t%1,%c2,%l3" : "c<g>rj%C0\t%1,%2,%l3";
1297 return which_alternative ?
1298 "c<g>fi\t%1,%c2\;jg%C0\t%l3" : "c<g>r\t%1,%2\;jg%C0\t%l3";
1300 [(set_attr "op_type" "RIE")
1301 (set_attr "type" "branch")
1302 (set_attr "z10prop" "z10_super_c,z10_super")
1303 (set (attr "length")
1304 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1305 (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg
1306 ; 10 byte for cgr/jg
1308 ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr
1309 ; The following instructions do a complementary access of their second
1310 ; operand (z10 only): clrj, clgrj, clr, clgr
1311 (define_insn "*cmp_and_br_unsigned_<mode>"
1313 (if_then_else (match_operator 0 "s390_unsigned_integer_comparison"
1314 [(match_operand:GPR 1 "register_operand" "d,d")
1315 (match_operand:GPR 2 "nonmemory_operand" "d,I")])
1316 (label_ref (match_operand 3 "" ""))
1318 (clobber (reg:CC CC_REGNUM))]
1319 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1321 if (get_attr_length (insn) == 6)
1322 return which_alternative ?
1323 "cl<g>ij%C0\t%1,%b2,%l3" : "cl<g>rj%C0\t%1,%2,%l3";
1325 return which_alternative ?
1326 "cl<g>fi\t%1,%b2\;jg%C0\t%l3" : "cl<g>r\t%1,%2\;jg%C0\t%l3";
1328 [(set_attr "op_type" "RIE")
1329 (set_attr "type" "branch")
1330 (set_attr "z10prop" "z10_super_c,z10_super")
1331 (set (attr "length")
1332 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1333 (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg
1334 ; 10 byte for clgr/jg
1336 ; And now the same two patterns as above but with a negated CC mask.
1338 ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
1339 ; The following instructions do a complementary access of their second
1340 ; operand (z01 only): crj_c, cgrjc, cr, cgr
1341 (define_insn "*icmp_and_br_signed_<mode>"
1343 (if_then_else (match_operator 0 "s390_signed_integer_comparison"
1344 [(match_operand:GPR 1 "register_operand" "d,d")
1345 (match_operand:GPR 2 "nonmemory_operand" "d,C")])
1347 (label_ref (match_operand 3 "" ""))))
1348 (clobber (reg:CC CC_REGNUM))]
1349 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1351 if (get_attr_length (insn) == 6)
1352 return which_alternative ?
1353 "c<g>ij%D0\t%1,%c2,%l3" : "c<g>rj%D0\t%1,%2,%l3";
1355 return which_alternative ?
1356 "c<g>fi\t%1,%c2\;jg%D0\t%l3" : "c<g>r\t%1,%2\;jg%D0\t%l3";
1358 [(set_attr "op_type" "RIE")
1359 (set_attr "type" "branch")
1360 (set_attr "z10prop" "z10_super_c,z10_super")
1361 (set (attr "length")
1362 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1363 (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg
1364 ; 10 byte for cgr/jg
1366 ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr
1367 ; The following instructions do a complementary access of their second
1368 ; operand (z10 only): clrj, clgrj, clr, clgr
1369 (define_insn "*icmp_and_br_unsigned_<mode>"
1371 (if_then_else (match_operator 0 "s390_unsigned_integer_comparison"
1372 [(match_operand:GPR 1 "register_operand" "d,d")
1373 (match_operand:GPR 2 "nonmemory_operand" "d,I")])
1375 (label_ref (match_operand 3 "" ""))))
1376 (clobber (reg:CC CC_REGNUM))]
1377 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1379 if (get_attr_length (insn) == 6)
1380 return which_alternative ?
1381 "cl<g>ij%D0\t%1,%b2,%l3" : "cl<g>rj%D0\t%1,%2,%l3";
1383 return which_alternative ?
1384 "cl<g>fi\t%1,%b2\;jg%D0\t%l3" : "cl<g>r\t%1,%2\;jg%D0\t%l3";
1386 [(set_attr "op_type" "RIE")
1387 (set_attr "type" "branch")
1388 (set_attr "z10prop" "z10_super_c,z10_super")
1389 (set (attr "length")
1390 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1391 (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg
1392 ; 10 byte for clgr/jg
1395 ;;- Move instructions.
1399 ; movti instruction pattern(s).
1402 ; FIXME: More constants are possible by enabling jxx, jyy constraints
1403 ; for TImode (use double-int for the calculations)
1404 (define_insn "movti"
1405 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,v, v, v,v,d, v,QR, d,o")
1406 (match_operand:TI 1 "general_operand" "QS, d,v,j00,jm1,d,v,QR, v,dPRT,d"))]
1420 [(set_attr "op_type" "RSY,RSY,VRR,VRI,VRI,VRR,*,VRX,VRX,*,*")
1421 (set_attr "type" "lm,stm,*,*,*,*,*,*,*,*,*")
1422 (set_attr "cpu_facility" "*,*,vec,vec,vec,vec,vec,vec,vec,*,*")])
1425 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1426 (match_operand:TI 1 "general_operand" ""))]
1427 "TARGET_ZARCH && reload_completed
1428 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
1429 [(set (match_dup 2) (match_dup 4))
1430 (set (match_dup 3) (match_dup 5))]
1432 operands[2] = operand_subword (operands[0], 0, 0, TImode);
1433 operands[3] = operand_subword (operands[0], 1, 0, TImode);
1434 operands[4] = operand_subword (operands[1], 0, 0, TImode);
1435 operands[5] = operand_subword (operands[1], 1, 0, TImode);
1439 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1440 (match_operand:TI 1 "general_operand" ""))]
1441 "TARGET_ZARCH && reload_completed
1442 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
1443 [(set (match_dup 2) (match_dup 4))
1444 (set (match_dup 3) (match_dup 5))]
1446 operands[2] = operand_subword (operands[0], 1, 0, TImode);
1447 operands[3] = operand_subword (operands[0], 0, 0, TImode);
1448 operands[4] = operand_subword (operands[1], 1, 0, TImode);
1449 operands[5] = operand_subword (operands[1], 0, 0, TImode);
1452 ; Use part of the TImode target reg to perform the address
1453 ; calculation. If the TImode value is supposed to be copied into a VR
1454 ; this splitter is not necessary.
1456 [(set (match_operand:TI 0 "register_operand" "")
1457 (match_operand:TI 1 "memory_operand" ""))]
1458 "TARGET_ZARCH && reload_completed
1459 && !VECTOR_REG_P (operands[0])
1460 && !s_operand (operands[1], VOIDmode)"
1461 [(set (match_dup 0) (match_dup 1))]
1463 rtx addr = operand_subword (operands[0], 1, 0, TImode);
1464 addr = gen_lowpart (Pmode, addr);
1465 s390_load_address (addr, XEXP (operands[1], 0));
1466 operands[1] = replace_equiv_address (operands[1], addr);
1470 ; Split a VR -> GPR TImode move into 2 vector load GR from VR element.
1471 ; For the higher order bits we do simply a DImode move while the
1472 ; second part is done via vec extract. Both will end up as vlgvg.
1474 [(set (match_operand:TI 0 "register_operand" "")
1475 (match_operand:TI 1 "register_operand" ""))]
1476 "TARGET_VX && reload_completed
1477 && GENERAL_REG_P (operands[0])
1478 && VECTOR_REG_P (operands[1])"
1479 [(set (match_dup 2) (match_dup 4))
1480 (set (match_dup 3) (unspec:DI [(match_dup 5) (const_int 1)]
1481 UNSPEC_VEC_EXTRACT))]
1483 operands[2] = operand_subword (operands[0], 0, 0, TImode);
1484 operands[3] = operand_subword (operands[0], 1, 0, TImode);
1485 operands[4] = gen_rtx_REG (DImode, REGNO (operands[1]));
1486 operands[5] = gen_rtx_REG (V2DImode, REGNO (operands[1]));
1490 ; Patterns used for secondary reloads
1493 ; z10 provides move instructions accepting larl memory operands.
1494 ; Unfortunately there is no such variant for QI, TI and FP mode moves.
1495 ; These patterns are also used for unaligned SI and DI accesses.
1497 (define_expand "reload<ALL:mode><P:mode>_tomem_z10"
1498 [(parallel [(match_operand:ALL 0 "memory_operand" "")
1499 (match_operand:ALL 1 "register_operand" "=d")
1500 (match_operand:P 2 "register_operand" "=&a")])]
1503 s390_reload_symref_address (operands[1], operands[0], operands[2], 1);
1507 (define_expand "reload<ALL:mode><P:mode>_toreg_z10"
1508 [(parallel [(match_operand:ALL 0 "register_operand" "=d")
1509 (match_operand:ALL 1 "memory_operand" "")
1510 (match_operand:P 2 "register_operand" "=a")])]
1513 s390_reload_symref_address (operands[0], operands[1], operands[2], 0);
1517 (define_expand "reload<P:mode>_larl_odd_addend_z10"
1518 [(parallel [(match_operand:P 0 "register_operand" "=d")
1519 (match_operand:P 1 "larl_operand" "")
1520 (match_operand:P 2 "register_operand" "=a")])]
1523 s390_reload_larl_operand (operands[0], operands[1], operands[2]);
1527 ; Handles loading a PLUS (load address) expression
1529 (define_expand "reload<mode>_plus"
1530 [(parallel [(match_operand:P 0 "register_operand" "=a")
1531 (match_operand:P 1 "s390_plus_operand" "")
1532 (match_operand:P 2 "register_operand" "=&a")])]
1535 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1539 ; Not all the indirect memory access instructions support the full
1540 ; format (long disp + index + base). So whenever a move from/to such
1541 ; an address is required and the instruction cannot deal with it we do
1542 ; a load address into a scratch register first and use this as the new
1544 ; This in particular is used for:
1545 ; - non-offsetable memory accesses for multiword moves
1546 ; - full vector reg moves with long displacements
1548 (define_expand "reload<mode>_la_in"
1549 [(parallel [(match_operand 0 "register_operand" "")
1550 (match_operand 1 "" "")
1551 (match_operand:P 2 "register_operand" "=&a")])]
1554 gcc_assert (MEM_P (operands[1]));
1555 s390_load_address (operands[2], find_replacement (&XEXP (operands[1], 0)));
1556 operands[1] = replace_equiv_address (operands[1], operands[2]);
1557 emit_move_insn (operands[0], operands[1]);
1561 (define_expand "reload<mode>_la_out"
1562 [(parallel [(match_operand 0 "" "")
1563 (match_operand 1 "register_operand" "")
1564 (match_operand:P 2 "register_operand" "=&a")])]
1567 gcc_assert (MEM_P (operands[0]));
1568 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
1569 operands[0] = replace_equiv_address (operands[0], operands[2]);
1570 emit_move_insn (operands[0], operands[1]);
1574 (define_expand "reload<mode>_PIC_addr"
1575 [(parallel [(match_operand 0 "register_operand" "=d")
1576 (match_operand 1 "larl_operand" "")
1577 (match_operand:P 2 "register_operand" "=a")])]
1580 rtx new_rtx = legitimize_pic_address (operands[1], operands[2]);
1581 emit_move_insn (operands[0], new_rtx);
1585 ; movdi instruction pattern(s).
1588 (define_expand "movdi"
1589 [(set (match_operand:DI 0 "general_operand" "")
1590 (match_operand:DI 1 "general_operand" ""))]
1593 /* Handle symbolic constants. */
1595 && (SYMBOLIC_CONST (operands[1])
1596 || (GET_CODE (operands[1]) == PLUS
1597 && XEXP (operands[1], 0) == pic_offset_table_rtx
1598 && SYMBOLIC_CONST (XEXP (operands[1], 1)))))
1599 emit_symbolic_move (operands);
1602 (define_insn "*movdi_larl"
1603 [(set (match_operand:DI 0 "register_operand" "=d")
1604 (match_operand:DI 1 "larl_operand" "X"))]
1606 && !FP_REG_P (operands[0])"
1608 [(set_attr "op_type" "RIL")
1609 (set_attr "type" "larl")
1610 (set_attr "z10prop" "z10_super_A1")])
1612 (define_insn "*movdi_64"
1613 [(set (match_operand:DI 0 "nonimmediate_operand"
1614 "=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")
1615 (match_operand:DI 1 "general_operand"
1616 " 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"))]
1651 [(set_attr "op_type" "RI,RI,RI,RI,RI,RIL,RIL,RIL,RRE,RRE,RXY,RIL,RRE,RXY,
1652 RXY,RR,RX,RXY,RX,RXY,RIL,SIL,*,*,RS,RS,VRI,VRR,VRS,VRS,VRX,VRX")
1653 (set_attr "type" "*,*,*,*,*,*,*,*,floaddf,floaddf,la,larl,lr,load,store,
1654 floaddf,floaddf,floaddf,fstoredf,fstoredf,larl,*,*,*,*,
1656 (set_attr "cpu_facility" "*,*,*,*,*,extimm,extimm,extimm,dfp,dfp,longdisp,
1657 z10,*,*,*,*,*,longdisp,*,longdisp,
1658 z10,z10,*,*,*,*,vec,vec,vec,vec,vec,vec")
1659 (set_attr "z10prop" "z10_fwd_A1,
1688 [(set (match_operand:DI 0 "register_operand" "")
1689 (match_operand:DI 1 "register_operand" ""))]
1690 "TARGET_ZARCH && ACCESS_REG_P (operands[1])"
1691 [(set (match_dup 2) (match_dup 3))
1692 (set (match_dup 0) (ashift:DI (match_dup 0) (const_int 32)))
1693 (set (strict_low_part (match_dup 2)) (match_dup 4))]
1694 "operands[2] = gen_lowpart (SImode, operands[0]);
1695 s390_split_access_reg (operands[1], &operands[4], &operands[3]);")
1698 [(set (match_operand:DI 0 "register_operand" "")
1699 (match_operand:DI 1 "register_operand" ""))]
1700 "TARGET_ZARCH && ACCESS_REG_P (operands[0])
1701 && dead_or_set_p (insn, operands[1])"
1702 [(set (match_dup 3) (match_dup 2))
1703 (set (match_dup 1) (lshiftrt:DI (match_dup 1) (const_int 32)))
1704 (set (match_dup 4) (match_dup 2))]
1705 "operands[2] = gen_lowpart (SImode, operands[1]);
1706 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1709 [(set (match_operand:DI 0 "register_operand" "")
1710 (match_operand:DI 1 "register_operand" ""))]
1711 "TARGET_ZARCH && ACCESS_REG_P (operands[0])
1712 && !dead_or_set_p (insn, operands[1])"
1713 [(set (match_dup 3) (match_dup 2))
1714 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))
1715 (set (match_dup 4) (match_dup 2))
1716 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))]
1717 "operands[2] = gen_lowpart (SImode, operands[1]);
1718 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1720 (define_insn "*movdi_31"
1721 [(set (match_operand:DI 0 "nonimmediate_operand"
1722 "=d,d,Q,S,d ,o,!*f,!*f,!*f,!R,!T,d")
1723 (match_operand:DI 1 "general_operand"
1724 " Q,S,d,d,dPRT,d, *f, R, T,*f,*f,b"))]
1739 [(set_attr "op_type" "RS,RSY,RS,RSY,*,*,RR,RX,RXY,RX,RXY,*")
1740 (set_attr "type" "lm,lm,stm,stm,*,*,floaddf,floaddf,floaddf,fstoredf,fstoredf,*")
1741 (set_attr "cpu_facility" "*,*,*,*,*,*,*,*,*,*,*,z10")])
1743 ; For a load from a symbol ref we can use one of the target registers
1744 ; together with larl to load the address.
1746 [(set (match_operand:DI 0 "register_operand" "")
1747 (match_operand:DI 1 "memory_operand" ""))]
1748 "!TARGET_ZARCH && reload_completed && TARGET_Z10
1749 && larl_operand (XEXP (operands[1], 0), SImode)"
1750 [(set (match_dup 2) (match_dup 3))
1751 (set (match_dup 0) (match_dup 1))]
1753 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1754 operands[3] = XEXP (operands[1], 0);
1755 operands[1] = replace_equiv_address (operands[1], operands[2]);
1759 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1760 (match_operand:DI 1 "general_operand" ""))]
1761 "!TARGET_ZARCH && reload_completed
1762 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1763 [(set (match_dup 2) (match_dup 4))
1764 (set (match_dup 3) (match_dup 5))]
1766 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1767 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1768 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1769 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1773 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1774 (match_operand:DI 1 "general_operand" ""))]
1775 "!TARGET_ZARCH && reload_completed
1776 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1777 [(set (match_dup 2) (match_dup 4))
1778 (set (match_dup 3) (match_dup 5))]
1780 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1781 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1782 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1783 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1787 [(set (match_operand:DI 0 "register_operand" "")
1788 (match_operand:DI 1 "memory_operand" ""))]
1789 "!TARGET_ZARCH && reload_completed
1790 && !FP_REG_P (operands[0])
1791 && !s_operand (operands[1], VOIDmode)"
1792 [(set (match_dup 0) (match_dup 1))]
1794 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1795 s390_load_address (addr, XEXP (operands[1], 0));
1796 operands[1] = replace_equiv_address (operands[1], addr);
1800 [(set (match_operand:DI 0 "register_operand" "")
1801 (mem:DI (match_operand 1 "address_operand" "")))]
1803 && !FP_REG_P (operands[0])
1804 && GET_CODE (operands[1]) == SYMBOL_REF
1805 && CONSTANT_POOL_ADDRESS_P (operands[1])
1806 && get_pool_mode (operands[1]) == DImode
1807 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1808 [(set (match_dup 0) (match_dup 2))]
1809 "operands[2] = get_pool_constant (operands[1]);")
1811 (define_insn "*la_64"
1812 [(set (match_operand:DI 0 "register_operand" "=d,d")
1813 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))]
1818 [(set_attr "op_type" "RX,RXY")
1819 (set_attr "type" "la")
1820 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
1824 [(set (match_operand:DI 0 "register_operand" "")
1825 (match_operand:QI 1 "address_operand" ""))
1826 (clobber (reg:CC CC_REGNUM))])]
1828 && preferred_la_operand_p (operands[1], const0_rtx)"
1829 [(set (match_dup 0) (match_dup 1))]
1833 [(set (match_operand:DI 0 "register_operand" "")
1834 (match_operand:DI 1 "register_operand" ""))
1837 (plus:DI (match_dup 0)
1838 (match_operand:DI 2 "nonmemory_operand" "")))
1839 (clobber (reg:CC CC_REGNUM))])]
1841 && !reg_overlap_mentioned_p (operands[0], operands[2])
1842 && preferred_la_operand_p (operands[1], operands[2])"
1843 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1847 ; movsi instruction pattern(s).
1850 (define_expand "movsi"
1851 [(set (match_operand:SI 0 "general_operand" "")
1852 (match_operand:SI 1 "general_operand" ""))]
1855 /* Handle symbolic constants. */
1857 && (SYMBOLIC_CONST (operands[1])
1858 || (GET_CODE (operands[1]) == PLUS
1859 && XEXP (operands[1], 0) == pic_offset_table_rtx
1860 && SYMBOLIC_CONST (XEXP(operands[1], 1)))))
1861 emit_symbolic_move (operands);
1864 (define_insn "*movsi_larl"
1865 [(set (match_operand:SI 0 "register_operand" "=d")
1866 (match_operand:SI 1 "larl_operand" "X"))]
1867 "!TARGET_64BIT && TARGET_CPU_ZARCH
1868 && !FP_REG_P (operands[0])"
1870 [(set_attr "op_type" "RIL")
1871 (set_attr "type" "larl")
1872 (set_attr "z10prop" "z10_fwd_A1")])
1874 (define_insn "*movsi_zarch"
1875 [(set (match_operand:SI 0 "nonimmediate_operand"
1876 "=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")
1877 (match_operand:SI 1 "general_operand"
1878 " 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"))]
1911 [(set_attr "op_type" "RI,RI,RI,RIL,RXY,RIL,RR,RX,RXY,RX,RXY,
1912 RRE,RR,RXE,RX,RXY,RX,RXY,RRE,RRE,RS,RIL,SIL,RS,VRI,VRR,VRS,VRS,VRX,VRX")
1913 (set_attr "type" "*,
1937 (set_attr "cpu_facility" "*,*,*,extimm,longdisp,z10,*,*,longdisp,*,longdisp,
1938 vec,*,vec,*,longdisp,*,longdisp,*,*,*,z10,z10,*,vec,vec,vec,vec,vec,vec")
1939 (set_attr "z10prop" "z10_fwd_A1,
1964 (define_insn "*movsi_esa"
1965 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!*f,!*f,!R,d,t,Q,t")
1966 (match_operand:SI 1 "general_operand" "K,d,R,d, *f, *f, R, R,*f,t,d,t,Q"))]
1982 [(set_attr "op_type" "RI,RR,RX,RX,RRE,RR,RXE,RX,RX,RRE,RRE,RS,RS")
1983 (set_attr "type" "*,lr,load,store,floadsf,floadsf,floadsf,floadsf,fstoresf,*,*,*,*")
1984 (set_attr "z10prop" "z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_rec,*,*,*,*,*,z10_super_E1,
1986 (set_attr "cpu_facility" "*,*,*,*,vec,*,vec,*,*,*,*,*,*")
1990 [(set (match_operand:SI 0 "register_operand" "")
1991 (mem:SI (match_operand 1 "address_operand" "")))]
1992 "!FP_REG_P (operands[0])
1993 && GET_CODE (operands[1]) == SYMBOL_REF
1994 && CONSTANT_POOL_ADDRESS_P (operands[1])
1995 && get_pool_mode (operands[1]) == SImode
1996 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1997 [(set (match_dup 0) (match_dup 2))]
1998 "operands[2] = get_pool_constant (operands[1]);")
2000 (define_insn "*la_31"
2001 [(set (match_operand:SI 0 "register_operand" "=d,d")
2002 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))]
2003 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
2007 [(set_attr "op_type" "RX,RXY")
2008 (set_attr "type" "la")
2009 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
2013 [(set (match_operand:SI 0 "register_operand" "")
2014 (match_operand:QI 1 "address_operand" ""))
2015 (clobber (reg:CC CC_REGNUM))])]
2017 && preferred_la_operand_p (operands[1], const0_rtx)"
2018 [(set (match_dup 0) (match_dup 1))]
2022 [(set (match_operand:SI 0 "register_operand" "")
2023 (match_operand:SI 1 "register_operand" ""))
2026 (plus:SI (match_dup 0)
2027 (match_operand:SI 2 "nonmemory_operand" "")))
2028 (clobber (reg:CC CC_REGNUM))])]
2030 && !reg_overlap_mentioned_p (operands[0], operands[2])
2031 && preferred_la_operand_p (operands[1], operands[2])"
2032 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
2035 (define_insn "*la_31_and"
2036 [(set (match_operand:SI 0 "register_operand" "=d,d")
2037 (and:SI (match_operand:QI 1 "address_operand" "ZQZR,ZSZT")
2038 (const_int 2147483647)))]
2043 [(set_attr "op_type" "RX,RXY")
2044 (set_attr "type" "la")
2045 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
2047 (define_insn_and_split "*la_31_and_cc"
2048 [(set (match_operand:SI 0 "register_operand" "=d")
2049 (and:SI (match_operand:QI 1 "address_operand" "p")
2050 (const_int 2147483647)))
2051 (clobber (reg:CC CC_REGNUM))]
2054 "&& reload_completed"
2056 (and:SI (match_dup 1) (const_int 2147483647)))]
2058 [(set_attr "op_type" "RX")
2059 (set_attr "type" "la")])
2061 (define_insn "force_la_31"
2062 [(set (match_operand:SI 0 "register_operand" "=d,d")
2063 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))
2064 (use (const_int 0))]
2069 [(set_attr "op_type" "RX")
2070 (set_attr "type" "la")
2071 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
2074 ; movhi instruction pattern(s).
2077 (define_expand "movhi"
2078 [(set (match_operand:HI 0 "nonimmediate_operand" "")
2079 (match_operand:HI 1 "general_operand" ""))]
2082 /* Make it explicit that loading a register from memory
2083 always sign-extends (at least) to SImode. */
2084 if (optimize && can_create_pseudo_p ()
2085 && register_operand (operands[0], VOIDmode)
2086 && GET_CODE (operands[1]) == MEM)
2088 rtx tmp = gen_reg_rtx (SImode);
2089 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
2090 emit_insn (gen_rtx_SET (tmp, ext));
2091 operands[1] = gen_lowpart (HImode, tmp);
2095 (define_insn "*movhi"
2096 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,d,R,T,b,Q,v,v,v,d, v,QR")
2097 (match_operand:HI 1 "general_operand" " d,n,R,T,b,d,d,d,K,K,v,d,v,QR, v"))]
2115 [(set_attr "op_type" "RR,RI,RX,RXY,RIL,RX,RXY,RIL,SIL,VRI,VRR,VRS,VRS,VRX,VRX")
2116 (set_attr "type" "lr,*,*,*,larl,store,store,store,*,*,*,*,*,*,*")
2117 (set_attr "cpu_facility" "*,*,*,*,z10,*,*,z10,z10,vec,vec,vec,vec,vec,vec")
2118 (set_attr "z10prop" "z10_fr_E1,
2126 z10_super,*,*,*,*,*,*")])
2129 [(set (match_operand:HI 0 "register_operand" "")
2130 (mem:HI (match_operand 1 "address_operand" "")))]
2131 "GET_CODE (operands[1]) == SYMBOL_REF
2132 && CONSTANT_POOL_ADDRESS_P (operands[1])
2133 && get_pool_mode (operands[1]) == HImode
2134 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
2135 [(set (match_dup 0) (match_dup 2))]
2136 "operands[2] = get_pool_constant (operands[1]);")
2139 ; movqi instruction pattern(s).
2142 (define_expand "movqi"
2143 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2144 (match_operand:QI 1 "general_operand" ""))]
2147 /* On z/Architecture, zero-extending from memory to register
2148 is just as fast as a QImode load. */
2149 if (TARGET_ZARCH && optimize && can_create_pseudo_p ()
2150 && register_operand (operands[0], VOIDmode)
2151 && GET_CODE (operands[1]) == MEM)
2153 rtx tmp = gen_reg_rtx (DImode);
2154 rtx ext = gen_rtx_ZERO_EXTEND (DImode, operands[1]);
2155 emit_insn (gen_rtx_SET (tmp, ext));
2156 operands[1] = gen_lowpart (QImode, tmp);
2160 (define_insn "*movqi"
2161 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q,v,v,v,d, v,QR")
2162 (match_operand:QI 1 "general_operand" " d,n,R,T,d,d,n,n,?Q,K,v,d,v,QR, v"))]
2180 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS,VRI,VRR,VRS,VRS,VRX,VRX")
2181 (set_attr "type" "lr,*,*,*,store,store,store,store,*,*,*,*,*,*,*")
2182 (set_attr "cpu_facility" "*,*,*,*,*,*,*,*,*,vec,vec,vec,vec,vec,vec")
2183 (set_attr "z10prop" "z10_fr_E1,
2194 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2195 (mem:QI (match_operand 1 "address_operand" "")))]
2196 "GET_CODE (operands[1]) == SYMBOL_REF
2197 && CONSTANT_POOL_ADDRESS_P (operands[1])
2198 && get_pool_mode (operands[1]) == QImode
2199 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
2200 [(set (match_dup 0) (match_dup 2))]
2201 "operands[2] = get_pool_constant (operands[1]);")
2204 ; movstrictqi instruction pattern(s).
2207 (define_insn "*movstrictqi"
2208 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
2209 (match_operand:QI 1 "memory_operand" "R,T"))]
2214 [(set_attr "op_type" "RX,RXY")
2215 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
2218 ; movstricthi instruction pattern(s).
2221 (define_insn "*movstricthi"
2222 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
2223 (match_operand:HI 1 "memory_operand" "Q,S"))
2224 (clobber (reg:CC CC_REGNUM))]
2229 [(set_attr "op_type" "RS,RSY")
2230 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
2233 ; movstrictsi instruction pattern(s).
2236 (define_insn "movstrictsi"
2237 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d,d"))
2238 (match_operand:SI 1 "general_operand" "d,R,T,t"))]
2245 [(set_attr "op_type" "RR,RX,RXY,RRE")
2246 (set_attr "type" "lr,load,load,*")
2247 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_super_E1")])
2250 ; mov(tf|td) instruction pattern(s).
2253 (define_expand "mov<mode>"
2254 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2255 (match_operand:TD_TF 1 "general_operand" ""))]
2259 (define_insn "*mov<mode>_64"
2260 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o, d,QS, d,o")
2261 (match_operand:TD_TF 1 "general_operand" " G,f,o,f,QS, d,dRT,d"))]
2272 [(set_attr "op_type" "RRE,RRE,*,*,RSY,RSY,*,*")
2273 (set_attr "type" "fsimptf,fsimptf,*,*,lm,stm,*,*")
2274 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*")])
2276 (define_insn "*mov<mode>_31"
2277 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o")
2278 (match_operand:TD_TF 1 "general_operand" " G,f,o,f"))]
2285 [(set_attr "op_type" "RRE,RRE,*,*")
2286 (set_attr "type" "fsimptf,fsimptf,*,*")
2287 (set_attr "cpu_facility" "z196,*,*,*")])
2289 ; TFmode in GPRs splitters
2292 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2293 (match_operand:TD_TF 1 "general_operand" ""))]
2294 "TARGET_ZARCH && reload_completed
2295 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)"
2296 [(set (match_dup 2) (match_dup 4))
2297 (set (match_dup 3) (match_dup 5))]
2299 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
2300 operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode);
2301 operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode);
2302 operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode);
2306 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2307 (match_operand:TD_TF 1 "general_operand" ""))]
2308 "TARGET_ZARCH && reload_completed
2309 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)"
2310 [(set (match_dup 2) (match_dup 4))
2311 (set (match_dup 3) (match_dup 5))]
2313 operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode);
2314 operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode);
2315 operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode);
2316 operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode);
2320 [(set (match_operand:TD_TF 0 "register_operand" "")
2321 (match_operand:TD_TF 1 "memory_operand" ""))]
2322 "TARGET_ZARCH && reload_completed
2323 && GENERAL_REG_P (operands[0])
2324 && !s_operand (operands[1], VOIDmode)"
2325 [(set (match_dup 0) (match_dup 1))]
2327 rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode);
2328 addr = gen_lowpart (Pmode, addr);
2329 s390_load_address (addr, XEXP (operands[1], 0));
2330 operands[1] = replace_equiv_address (operands[1], addr);
2333 ; TFmode in BFPs splitters
2336 [(set (match_operand:TD_TF 0 "register_operand" "")
2337 (match_operand:TD_TF 1 "memory_operand" ""))]
2338 "reload_completed && offsettable_memref_p (operands[1])
2339 && FP_REG_P (operands[0])"
2340 [(set (match_dup 2) (match_dup 4))
2341 (set (match_dup 3) (match_dup 5))]
2343 operands[2] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0],
2345 operands[3] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0],
2347 operands[4] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 0);
2348 operands[5] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 8);
2352 [(set (match_operand:TD_TF 0 "memory_operand" "")
2353 (match_operand:TD_TF 1 "register_operand" ""))]
2354 "reload_completed && offsettable_memref_p (operands[0])
2355 && FP_REG_P (operands[1])"
2356 [(set (match_dup 2) (match_dup 4))
2357 (set (match_dup 3) (match_dup 5))]
2359 operands[2] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 0);
2360 operands[3] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 8);
2361 operands[4] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1],
2363 operands[5] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1],
2368 ; mov(df|dd) instruction pattern(s).
2371 (define_expand "mov<mode>"
2372 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2373 (match_operand:DD_DF 1 "general_operand" ""))]
2377 (define_insn "*mov<mode>_64dfp"
2378 [(set (match_operand:DD_DF 0 "nonimmediate_operand"
2379 "=f,f,f,d,f,f,R,T,d,d,d, d,b,RT,v,v,d,v,QR")
2380 (match_operand:DD_DF 1 "general_operand"
2381 " G,f,d,f,R,T,f,f,G,d,b,RT,d, d,v,d,v,QR,v"))]
2403 [(set_attr "op_type" "RRE,RR,RRE,RRE,RX,RXY,RX,RXY,RI,RRE,RIL,RXY,RIL,RXY,VRR,VRS,VRS,VRX,VRX")
2404 (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,floaddf,floaddf,
2405 fstoredf,fstoredf,*,lr,load,load,store,store,*,*,*,load,store")
2406 (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,*,*,*,*,*")
2407 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*,z10,*,z10,*,vec,vec,vec,vec,vec")])
2409 (define_insn "*mov<mode>_64"
2410 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,d, d,b,RT,v,v,QR")
2411 (match_operand:DD_DF 1 "general_operand" " G,f,R,T,f,f,G,d,b,RT,d, d,v,QR,v"))]
2429 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RI,RRE,RIL,RXY,RIL,RXY,VRR,VRX,VRX")
2430 (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>,
2431 fstore<mode>,fstore<mode>,*,lr,load,load,store,store,*,load,store")
2432 (set_attr "z10prop" "*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,*,*,*")
2433 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,z10,*,z10,*,vec,vec,vec")])
2435 (define_insn "*mov<mode>_31"
2436 [(set (match_operand:DD_DF 0 "nonimmediate_operand"
2437 "=f,f,f,f,R,T,d,d,Q,S, d,o")
2438 (match_operand:DD_DF 1 "general_operand"
2439 " G,f,R,T,f,f,Q,S,d,d,dPRT,d"))]
2454 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*")
2455 (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>,
2456 fstore<mode>,fstore<mode>,lm,lm,stm,stm,*,*")
2457 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*,*,*")])
2460 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2461 (match_operand:DD_DF 1 "general_operand" ""))]
2462 "!TARGET_ZARCH && reload_completed
2463 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)"
2464 [(set (match_dup 2) (match_dup 4))
2465 (set (match_dup 3) (match_dup 5))]
2467 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
2468 operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode);
2469 operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode);
2470 operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode);
2474 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2475 (match_operand:DD_DF 1 "general_operand" ""))]
2476 "!TARGET_ZARCH && reload_completed
2477 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)"
2478 [(set (match_dup 2) (match_dup 4))
2479 (set (match_dup 3) (match_dup 5))]
2481 operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode);
2482 operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode);
2483 operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode);
2484 operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode);
2488 [(set (match_operand:DD_DF 0 "register_operand" "")
2489 (match_operand:DD_DF 1 "memory_operand" ""))]
2490 "!TARGET_ZARCH && reload_completed
2491 && !FP_REG_P (operands[0])
2492 && !s_operand (operands[1], VOIDmode)"
2493 [(set (match_dup 0) (match_dup 1))]
2495 rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode);
2496 s390_load_address (addr, XEXP (operands[1], 0));
2497 operands[1] = replace_equiv_address (operands[1], addr);
2501 ; mov(sf|sd) instruction pattern(s).
2504 (define_insn "mov<mode>"
2505 [(set (match_operand:SD_SF 0 "nonimmediate_operand"
2506 "=f,f,f,f,f,f,R,T,d,d,d,d,d,b,R,T,v,v,v,d,v,QR")
2507 (match_operand:SD_SF 1 "general_operand"
2508 " G,f,f,R,R,T,f,f,G,d,b,R,T,d,d,d,v,G,d,v,QR,v"))]
2533 [(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")
2534 (set_attr "type" "fsimpsf,fsimpsf,fload<mode>,fload<mode>,fload<mode>,fload<mode>,
2535 fstore<mode>,fstore<mode>,*,lr,load,load,load,store,store,store,*,*,*,*,load,store")
2536 (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,z10_rec,*,*,*,*,*,*")
2537 (set_attr "cpu_facility" "z196,vec,*,vec,*,*,*,*,*,*,z10,*,*,z10,*,*,vec,vec,vec,vec,vec,vec")])
2540 ; movcc instruction pattern
2543 (define_insn "movcc"
2544 [(set (match_operand:CC 0 "nonimmediate_operand" "=d,c,d,d,d,R,T")
2545 (match_operand:CC 1 "nonimmediate_operand" " d,d,c,R,T,d,d"))]
2555 [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY")
2556 (set_attr "type" "lr,*,*,load,load,store,store")
2557 (set_attr "z10prop" "z10_fr_E1,z10_super,*,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec")
2558 (set_attr "z196prop" "*,*,z196_ends,*,*,*,*")])
2561 ; Block move (MVC) patterns.
2565 [(set (match_operand:BLK 0 "memory_operand" "=Q")
2566 (match_operand:BLK 1 "memory_operand" "Q"))
2567 (use (match_operand 2 "const_int_operand" "n"))]
2568 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
2569 "mvc\t%O0(%2,%R0),%S1"
2570 [(set_attr "op_type" "SS")])
2572 ; This splitter converts a QI to QI mode copy into a BLK mode copy in
2573 ; order to have it implemented with mvc.
2576 [(set (match_operand:QI 0 "memory_operand" "")
2577 (match_operand:QI 1 "memory_operand" ""))]
2580 [(set (match_dup 0) (match_dup 1))
2581 (use (const_int 1))])]
2583 operands[0] = adjust_address (operands[0], BLKmode, 0);
2584 operands[1] = adjust_address (operands[1], BLKmode, 0);
2590 [(set (match_operand:BLK 0 "memory_operand" "")
2591 (match_operand:BLK 1 "memory_operand" ""))
2592 (use (match_operand 2 "const_int_operand" ""))])
2594 [(set (match_operand:BLK 3 "memory_operand" "")
2595 (match_operand:BLK 4 "memory_operand" ""))
2596 (use (match_operand 5 "const_int_operand" ""))])]
2597 "s390_offset_p (operands[0], operands[3], operands[2])
2598 && s390_offset_p (operands[1], operands[4], operands[2])
2599 && !s390_overlap_p (operands[0], operands[1],
2600 INTVAL (operands[2]) + INTVAL (operands[5]))
2601 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
2603 [(set (match_dup 6) (match_dup 7))
2604 (use (match_dup 8))])]
2605 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
2606 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
2607 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
2611 ; load_multiple pattern(s).
2613 ; ??? Due to reload problems with replacing registers inside match_parallel
2614 ; we currently support load_multiple/store_multiple only after reload.
2617 (define_expand "load_multiple"
2618 [(match_par_dup 3 [(set (match_operand 0 "" "")
2619 (match_operand 1 "" ""))
2620 (use (match_operand 2 "" ""))])]
2629 /* Support only loading a constant number of fixed-point registers from
2630 memory and only bother with this if more than two */
2631 if (GET_CODE (operands[2]) != CONST_INT
2632 || INTVAL (operands[2]) < 2
2633 || INTVAL (operands[2]) > 16
2634 || GET_CODE (operands[1]) != MEM
2635 || GET_CODE (operands[0]) != REG
2636 || REGNO (operands[0]) >= 16)
2639 count = INTVAL (operands[2]);
2640 regno = REGNO (operands[0]);
2641 mode = GET_MODE (operands[0]);
2642 if (mode != SImode && (!TARGET_ZARCH || mode != DImode))
2645 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2646 if (!can_create_pseudo_p ())
2648 if (GET_CODE (XEXP (operands[1], 0)) == REG)
2650 from = XEXP (operands[1], 0);
2653 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
2654 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
2655 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
2657 from = XEXP (XEXP (operands[1], 0), 0);
2658 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
2665 from = force_reg (Pmode, XEXP (operands[1], 0));
2669 for (i = 0; i < count; i++)
2670 XVECEXP (operands[3], 0, i)
2671 = gen_rtx_SET (gen_rtx_REG (mode, regno + i),
2672 change_address (operands[1], mode,
2673 plus_constant (Pmode, from,
2674 off + i * GET_MODE_SIZE (mode))));
2677 (define_insn "*load_multiple_di"
2678 [(match_parallel 0 "load_multiple_operation"
2679 [(set (match_operand:DI 1 "register_operand" "=r")
2680 (match_operand:DI 2 "s_operand" "QS"))])]
2681 "reload_completed && TARGET_ZARCH"
2683 int words = XVECLEN (operands[0], 0);
2684 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
2685 return "lmg\t%1,%0,%S2";
2687 [(set_attr "op_type" "RSY")
2688 (set_attr "type" "lm")])
2690 (define_insn "*load_multiple_si"
2691 [(match_parallel 0 "load_multiple_operation"
2692 [(set (match_operand:SI 1 "register_operand" "=r,r")
2693 (match_operand:SI 2 "s_operand" "Q,S"))])]
2696 int words = XVECLEN (operands[0], 0);
2697 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
2698 return which_alternative == 0 ? "lm\t%1,%0,%S2" : "lmy\t%1,%0,%S2";
2700 [(set_attr "op_type" "RS,RSY")
2701 (set_attr "type" "lm")])
2704 ; store multiple pattern(s).
2707 (define_expand "store_multiple"
2708 [(match_par_dup 3 [(set (match_operand 0 "" "")
2709 (match_operand 1 "" ""))
2710 (use (match_operand 2 "" ""))])]
2719 /* Support only storing a constant number of fixed-point registers to
2720 memory and only bother with this if more than two. */
2721 if (GET_CODE (operands[2]) != CONST_INT
2722 || INTVAL (operands[2]) < 2
2723 || INTVAL (operands[2]) > 16
2724 || GET_CODE (operands[0]) != MEM
2725 || GET_CODE (operands[1]) != REG
2726 || REGNO (operands[1]) >= 16)
2729 count = INTVAL (operands[2]);
2730 regno = REGNO (operands[1]);
2731 mode = GET_MODE (operands[1]);
2732 if (mode != SImode && (!TARGET_ZARCH || mode != DImode))
2735 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2737 if (!can_create_pseudo_p ())
2739 if (GET_CODE (XEXP (operands[0], 0)) == REG)
2741 to = XEXP (operands[0], 0);
2744 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
2745 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
2746 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
2748 to = XEXP (XEXP (operands[0], 0), 0);
2749 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
2756 to = force_reg (Pmode, XEXP (operands[0], 0));
2760 for (i = 0; i < count; i++)
2761 XVECEXP (operands[3], 0, i)
2762 = gen_rtx_SET (change_address (operands[0], mode,
2763 plus_constant (Pmode, to,
2764 off + i * GET_MODE_SIZE (mode))),
2765 gen_rtx_REG (mode, regno + i));
2768 (define_insn "*store_multiple_di"
2769 [(match_parallel 0 "store_multiple_operation"
2770 [(set (match_operand:DI 1 "s_operand" "=QS")
2771 (match_operand:DI 2 "register_operand" "r"))])]
2772 "reload_completed && TARGET_ZARCH"
2774 int words = XVECLEN (operands[0], 0);
2775 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
2776 return "stmg\t%2,%0,%S1";
2778 [(set_attr "op_type" "RSY")
2779 (set_attr "type" "stm")])
2782 (define_insn "*store_multiple_si"
2783 [(match_parallel 0 "store_multiple_operation"
2784 [(set (match_operand:SI 1 "s_operand" "=Q,S")
2785 (match_operand:SI 2 "register_operand" "r,r"))])]
2788 int words = XVECLEN (operands[0], 0);
2789 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
2790 return which_alternative == 0 ? "stm\t%2,%0,%S1" : "stmy\t%2,%0,%S1";
2792 [(set_attr "op_type" "RS,RSY")
2793 (set_attr "type" "stm")])
2796 ;; String instructions.
2799 (define_insn "*execute_rl"
2800 [(match_parallel 0 "execute_operation"
2801 [(unspec [(match_operand 1 "register_operand" "a")
2802 (match_operand 2 "" "")
2803 (match_operand:SI 3 "larl_operand" "X")] UNSPEC_EXECUTE)])]
2804 "TARGET_Z10 && GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
2805 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
2807 [(set_attr "op_type" "RIL")
2808 (set_attr "type" "cs")])
2810 (define_insn "*execute"
2811 [(match_parallel 0 "execute_operation"
2812 [(unspec [(match_operand 1 "register_operand" "a")
2813 (match_operand:BLK 2 "memory_operand" "R")
2814 (match_operand 3 "" "")] UNSPEC_EXECUTE)])]
2815 "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
2816 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
2818 [(set_attr "op_type" "RX")
2819 (set_attr "type" "cs")])
2823 ; strlenM instruction pattern(s).
2826 (define_expand "strlen<mode>"
2827 [(match_operand:P 0 "register_operand" "") ; result
2828 (match_operand:BLK 1 "memory_operand" "") ; input string
2829 (match_operand:SI 2 "immediate_operand" "") ; search character
2830 (match_operand:SI 3 "immediate_operand" "")] ; known alignment
2833 if (!TARGET_VX || operands[2] != const0_rtx)
2834 emit_insn (gen_strlen_srst<mode> (operands[0], operands[1],
2835 operands[2], operands[3]));
2837 s390_expand_vec_strlen (operands[0], operands[1], operands[3]);
2842 (define_expand "strlen_srst<mode>"
2843 [(set (reg:SI 0) (match_operand:SI 2 "immediate_operand" ""))
2846 (unspec:P [(const_int 0)
2847 (match_operand:BLK 1 "memory_operand" "")
2849 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
2850 (clobber (scratch:P))
2851 (clobber (reg:CC CC_REGNUM))])
2853 [(set (match_operand:P 0 "register_operand" "")
2854 (minus:P (match_dup 4) (match_dup 5)))
2855 (clobber (reg:CC CC_REGNUM))])]
2858 operands[4] = gen_reg_rtx (Pmode);
2859 operands[5] = gen_reg_rtx (Pmode);
2860 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
2861 operands[1] = replace_equiv_address (operands[1], operands[5]);
2864 (define_insn "*strlen<mode>"
2865 [(set (match_operand:P 0 "register_operand" "=a")
2866 (unspec:P [(match_operand:P 2 "general_operand" "0")
2867 (mem:BLK (match_operand:P 3 "register_operand" "1"))
2869 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
2870 (clobber (match_scratch:P 1 "=a"))
2871 (clobber (reg:CC CC_REGNUM))]
2873 "srst\t%0,%1\;jo\t.-4"
2874 [(set_attr "length" "8")
2875 (set_attr "type" "vs")])
2878 ; cmpstrM instruction pattern(s).
2881 (define_expand "cmpstrsi"
2882 [(set (reg:SI 0) (const_int 0))
2884 [(clobber (match_operand 3 "" ""))
2885 (clobber (match_dup 4))
2886 (set (reg:CCU CC_REGNUM)
2887 (compare:CCU (match_operand:BLK 1 "memory_operand" "")
2888 (match_operand:BLK 2 "memory_operand" "")))
2891 [(set (match_operand:SI 0 "register_operand" "=d")
2892 (unspec:SI [(reg:CCU CC_REGNUM)] UNSPEC_STRCMPCC_TO_INT))
2893 (clobber (reg:CC CC_REGNUM))])]
2896 /* As the result of CMPINT is inverted compared to what we need,
2897 we have to swap the operands. */
2898 rtx op1 = operands[2];
2899 rtx op2 = operands[1];
2900 rtx addr1 = gen_reg_rtx (Pmode);
2901 rtx addr2 = gen_reg_rtx (Pmode);
2903 emit_move_insn (addr1, force_operand (XEXP (op1, 0), NULL_RTX));
2904 emit_move_insn (addr2, force_operand (XEXP (op2, 0), NULL_RTX));
2905 operands[1] = replace_equiv_address_nv (op1, addr1);
2906 operands[2] = replace_equiv_address_nv (op2, addr2);
2907 operands[3] = addr1;
2908 operands[4] = addr2;
2911 (define_insn "*cmpstr<mode>"
2912 [(clobber (match_operand:P 0 "register_operand" "=d"))
2913 (clobber (match_operand:P 1 "register_operand" "=d"))
2914 (set (reg:CCU CC_REGNUM)
2915 (compare:CCU (mem:BLK (match_operand:P 2 "register_operand" "0"))
2916 (mem:BLK (match_operand:P 3 "register_operand" "1"))))
2919 "clst\t%0,%1\;jo\t.-4"
2920 [(set_attr "length" "8")
2921 (set_attr "type" "vs")])
2924 ; movstr instruction pattern.
2927 (define_expand "movstr"
2928 [(match_operand 0 "register_operand" "")
2929 (match_operand 1 "memory_operand" "")
2930 (match_operand 2 "memory_operand" "")]
2934 emit_insn (gen_movstrdi (operands[0], operands[1], operands[2]));
2936 emit_insn (gen_movstrsi (operands[0], operands[1], operands[2]));
2940 (define_expand "movstr<P:mode>"
2941 [(set (reg:SI 0) (const_int 0))
2943 [(clobber (match_dup 3))
2944 (set (match_operand:BLK 1 "memory_operand" "")
2945 (match_operand:BLK 2 "memory_operand" ""))
2946 (set (match_operand:P 0 "register_operand" "")
2947 (unspec:P [(match_dup 1)
2949 (reg:SI 0)] UNSPEC_MVST))
2950 (clobber (reg:CC CC_REGNUM))])]
2953 rtx addr1 = gen_reg_rtx (Pmode);
2954 rtx addr2 = gen_reg_rtx (Pmode);
2956 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2957 emit_move_insn (addr2, force_operand (XEXP (operands[2], 0), NULL_RTX));
2958 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2959 operands[2] = replace_equiv_address_nv (operands[2], addr2);
2960 operands[3] = addr2;
2963 (define_insn "*movstr"
2964 [(clobber (match_operand:P 2 "register_operand" "=d"))
2965 (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
2966 (mem:BLK (match_operand:P 3 "register_operand" "2")))
2967 (set (match_operand:P 0 "register_operand" "=d")
2968 (unspec:P [(mem:BLK (match_dup 1))
2969 (mem:BLK (match_dup 3))
2970 (reg:SI 0)] UNSPEC_MVST))
2971 (clobber (reg:CC CC_REGNUM))]
2973 "mvst\t%1,%2\;jo\t.-4"
2974 [(set_attr "length" "8")
2975 (set_attr "type" "vs")])
2979 ; movmemM instruction pattern(s).
2982 (define_expand "movmem<mode>"
2983 [(set (match_operand:BLK 0 "memory_operand" "") ; destination
2984 (match_operand:BLK 1 "memory_operand" "")) ; source
2985 (use (match_operand:GPR 2 "general_operand" "")) ; count
2986 (match_operand 3 "" "")]
2989 if (s390_expand_movmem (operands[0], operands[1], operands[2]))
2995 ; Move a block that is up to 256 bytes in length.
2996 ; The block length is taken as (operands[2] % 256) + 1.
2998 (define_expand "movmem_short"
3000 [(set (match_operand:BLK 0 "memory_operand" "")
3001 (match_operand:BLK 1 "memory_operand" ""))
3002 (use (match_operand 2 "nonmemory_operand" ""))
3003 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3004 (clobber (match_dup 3))])]
3006 "operands[3] = gen_rtx_SCRATCH (Pmode);")
3008 (define_insn "*movmem_short"
3009 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q")
3010 (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q"))
3011 (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
3012 (use (match_operand 3 "immediate_operand" "X,R,X,X"))
3013 (clobber (match_scratch:P 4 "=X,X,X,&a"))]
3014 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
3016 [(set_attr "type" "cs")
3017 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3020 [(set (match_operand:BLK 0 "memory_operand" "")
3021 (match_operand:BLK 1 "memory_operand" ""))
3022 (use (match_operand 2 "const_int_operand" ""))
3023 (use (match_operand 3 "immediate_operand" ""))
3024 (clobber (scratch))]
3027 [(set (match_dup 0) (match_dup 1))
3028 (use (match_dup 2))])]
3029 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
3032 [(set (match_operand:BLK 0 "memory_operand" "")
3033 (match_operand:BLK 1 "memory_operand" ""))
3034 (use (match_operand 2 "register_operand" ""))
3035 (use (match_operand 3 "memory_operand" ""))
3036 (clobber (scratch))]
3039 [(unspec [(match_dup 2) (match_dup 3)
3040 (const_int 0)] UNSPEC_EXECUTE)
3041 (set (match_dup 0) (match_dup 1))
3042 (use (const_int 1))])]
3046 [(set (match_operand:BLK 0 "memory_operand" "")
3047 (match_operand:BLK 1 "memory_operand" ""))
3048 (use (match_operand 2 "register_operand" ""))
3049 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3050 (clobber (scratch))]
3051 "TARGET_Z10 && reload_completed"
3053 [(unspec [(match_dup 2) (const_int 0)
3054 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3055 (set (match_dup 0) (match_dup 1))
3056 (use (const_int 1))])]
3057 "operands[3] = gen_label_rtx ();")
3060 [(set (match_operand:BLK 0 "memory_operand" "")
3061 (match_operand:BLK 1 "memory_operand" ""))
3062 (use (match_operand 2 "register_operand" ""))
3063 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3064 (clobber (match_operand 3 "register_operand" ""))]
3065 "reload_completed && TARGET_CPU_ZARCH"
3066 [(set (match_dup 3) (label_ref (match_dup 4)))
3068 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
3069 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3070 (set (match_dup 0) (match_dup 1))
3071 (use (const_int 1))])]
3072 "operands[4] = gen_label_rtx ();")
3074 ; Move a block of arbitrary length.
3076 (define_expand "movmem_long"
3078 [(clobber (match_dup 2))
3079 (clobber (match_dup 3))
3080 (set (match_operand:BLK 0 "memory_operand" "")
3081 (match_operand:BLK 1 "memory_operand" ""))
3082 (use (match_operand 2 "general_operand" ""))
3084 (clobber (reg:CC CC_REGNUM))])]
3087 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3088 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3089 rtx reg0 = gen_reg_rtx (dreg_mode);
3090 rtx reg1 = gen_reg_rtx (dreg_mode);
3091 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3092 rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1));
3093 rtx len0 = gen_lowpart (Pmode, reg0);
3094 rtx len1 = gen_lowpart (Pmode, reg1);
3096 emit_clobber (reg0);
3097 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3098 emit_move_insn (len0, operands[2]);
3100 emit_clobber (reg1);
3101 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
3102 emit_move_insn (len1, operands[2]);
3104 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3105 operands[1] = replace_equiv_address_nv (operands[1], addr1);
3110 (define_insn "*movmem_long"
3111 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3112 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
3113 (set (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
3114 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0)))
3117 (clobber (reg:CC CC_REGNUM))]
3118 "TARGET_64BIT || !TARGET_ZARCH"
3119 "mvcle\t%0,%1,0\;jo\t.-4"
3120 [(set_attr "length" "8")
3121 (set_attr "type" "vs")])
3123 (define_insn "*movmem_long_31z"
3124 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3125 (clobber (match_operand:TI 1 "register_operand" "=d"))
3126 (set (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4))
3127 (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4)))
3130 (clobber (reg:CC CC_REGNUM))]
3131 "!TARGET_64BIT && TARGET_ZARCH"
3132 "mvcle\t%0,%1,0\;jo\t.-4"
3133 [(set_attr "length" "8")
3134 (set_attr "type" "vs")])
3141 (define_expand "signbit<mode>2"
3142 [(set (reg:CCZ CC_REGNUM)
3143 (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
3146 (set (match_operand:SI 0 "register_operand" "=d")
3147 (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))]
3150 operands[2] = GEN_INT (S390_TDC_SIGNBIT_SET);
3153 (define_expand "isinf<mode>2"
3154 [(set (reg:CCZ CC_REGNUM)
3155 (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
3158 (set (match_operand:SI 0 "register_operand" "=d")
3159 (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))]
3162 operands[2] = GEN_INT (S390_TDC_INFINITY);
3165 ; This extracts CC into a GPR properly shifted. The actual IPM
3166 ; instruction will be issued by reload. The constraint of operand 1
3167 ; forces reload to use a GPR. So reload will issue a movcc insn for
3168 ; copying CC into a GPR first.
3169 (define_insn_and_split "*cc_to_int"
3170 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3171 (unspec:SI [(match_operand 1 "register_operand" "0")]
3176 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 28)))])
3178 ; This insn is used to generate all variants of the Test Data Class
3179 ; instruction, namely tcxb, tcdb, and tceb. The insn's first operand
3180 ; is the register to be tested and the second one is the bit mask
3181 ; specifying the required test(s).
3183 ; tcxb, tcdb, tceb, tdcxt, tdcdt, tdcet
3184 (define_insn "*TDC_insn_<mode>"
3185 [(set (reg:CCZ CC_REGNUM)
3186 (unspec:CCZ [(match_operand:FP_ALL 0 "register_operand" "f")
3187 (match_operand:SI 1 "const_int_operand")] UNSPEC_TDC_INSN))]
3189 "t<_d>c<xde><bt>\t%0,%1"
3190 [(set_attr "op_type" "RXE")
3191 (set_attr "type" "fsimp<mode>")])
3196 ; setmemM instruction pattern(s).
3199 (define_expand "setmem<mode>"
3200 [(set (match_operand:BLK 0 "memory_operand" "")
3201 (match_operand:QI 2 "general_operand" ""))
3202 (use (match_operand:GPR 1 "general_operand" ""))
3203 (match_operand 3 "" "")]
3205 "s390_expand_setmem (operands[0], operands[1], operands[2]); DONE;")
3207 ; Clear a block that is up to 256 bytes in length.
3208 ; The block length is taken as (operands[1] % 256) + 1.
3210 (define_expand "clrmem_short"
3212 [(set (match_operand:BLK 0 "memory_operand" "")
3214 (use (match_operand 1 "nonmemory_operand" ""))
3215 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3216 (clobber (match_dup 2))
3217 (clobber (reg:CC CC_REGNUM))])]
3219 "operands[2] = gen_rtx_SCRATCH (Pmode);")
3221 (define_insn "*clrmem_short"
3222 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q")
3224 (use (match_operand 1 "nonmemory_operand" "n,a,a,a"))
3225 (use (match_operand 2 "immediate_operand" "X,R,X,X"))
3226 (clobber (match_scratch:P 3 "=X,X,X,&a"))
3227 (clobber (reg:CC CC_REGNUM))]
3228 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)"
3230 [(set_attr "type" "cs")
3231 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3234 [(set (match_operand:BLK 0 "memory_operand" "")
3236 (use (match_operand 1 "const_int_operand" ""))
3237 (use (match_operand 2 "immediate_operand" ""))
3239 (clobber (reg:CC CC_REGNUM))]
3242 [(set (match_dup 0) (const_int 0))
3244 (clobber (reg:CC CC_REGNUM))])]
3245 "operands[1] = GEN_INT ((INTVAL (operands[1]) & 0xff) + 1);")
3248 [(set (match_operand:BLK 0 "memory_operand" "")
3250 (use (match_operand 1 "register_operand" ""))
3251 (use (match_operand 2 "memory_operand" ""))
3253 (clobber (reg:CC CC_REGNUM))]
3256 [(unspec [(match_dup 1) (match_dup 2)
3257 (const_int 0)] UNSPEC_EXECUTE)
3258 (set (match_dup 0) (const_int 0))
3260 (clobber (reg:CC CC_REGNUM))])]
3264 [(set (match_operand:BLK 0 "memory_operand" "")
3266 (use (match_operand 1 "register_operand" ""))
3267 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3269 (clobber (reg:CC CC_REGNUM))]
3270 "TARGET_Z10 && reload_completed"
3272 [(unspec [(match_dup 1) (const_int 0)
3273 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3274 (set (match_dup 0) (const_int 0))
3276 (clobber (reg:CC CC_REGNUM))])]
3277 "operands[3] = gen_label_rtx ();")
3280 [(set (match_operand:BLK 0 "memory_operand" "")
3282 (use (match_operand 1 "register_operand" ""))
3283 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3284 (clobber (match_operand 2 "register_operand" ""))
3285 (clobber (reg:CC CC_REGNUM))]
3286 "reload_completed && TARGET_CPU_ZARCH"
3287 [(set (match_dup 2) (label_ref (match_dup 3)))
3289 [(unspec [(match_dup 1) (mem:BLK (match_dup 2))
3290 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3291 (set (match_dup 0) (const_int 0))
3293 (clobber (reg:CC CC_REGNUM))])]
3294 "operands[3] = gen_label_rtx ();")
3296 ; Initialize a block of arbitrary length with (operands[2] % 256).
3298 (define_expand "setmem_long_<P:mode>"
3300 [(clobber (match_dup 1))
3301 (set (match_operand:BLK 0 "memory_operand" "")
3302 (unspec:BLK [(match_operand:P 2 "shift_count_or_setmem_operand" "")
3303 (match_dup 4)] UNSPEC_REPLICATE_BYTE))
3305 (clobber (reg:CC CC_REGNUM))])]
3308 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3309 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3310 rtx reg0 = gen_reg_rtx (dreg_mode);
3311 rtx reg1 = gen_reg_rtx (dreg_mode);
3312 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3313 rtx len0 = gen_lowpart (Pmode, reg0);
3315 emit_clobber (reg0);
3316 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3317 emit_move_insn (len0, operands[1]);
3319 emit_move_insn (reg1, const0_rtx);
3321 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3324 operands[4] = gen_lowpart (Pmode, operands[1]);
3327 ; Patterns for 31 bit + Esa and 64 bit + Zarch.
3329 (define_insn "*setmem_long"
3330 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3331 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
3332 (unspec:BLK [(match_operand:P 2 "shift_count_or_setmem_operand" "Y")
3333 (subreg:P (match_dup 3) <modesize>)]
3334 UNSPEC_REPLICATE_BYTE))
3335 (use (match_operand:<DBL> 1 "register_operand" "d"))
3336 (clobber (reg:CC CC_REGNUM))]
3337 "TARGET_64BIT || !TARGET_ZARCH"
3338 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3339 [(set_attr "length" "8")
3340 (set_attr "type" "vs")])
3342 (define_insn "*setmem_long_and"
3343 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3344 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
3346 (match_operand:P 2 "shift_count_or_setmem_operand" "Y")
3347 (match_operand:P 4 "const_int_operand" "n"))
3348 (subreg:P (match_dup 3) <modesize>)]
3349 UNSPEC_REPLICATE_BYTE))
3350 (use (match_operand:<DBL> 1 "register_operand" "d"))
3351 (clobber (reg:CC CC_REGNUM))]
3352 "(TARGET_64BIT || !TARGET_ZARCH) &&
3353 (INTVAL (operands[4]) & 255) == 255"
3354 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3355 [(set_attr "length" "8")
3356 (set_attr "type" "vs")])
3358 ; Variants for 31 bit + Zarch, necessary because of the odd in-register offsets
3359 ; of the SImode subregs.
3361 (define_insn "*setmem_long_31z"
3362 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3363 (set (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "0") 4))
3364 (unspec:BLK [(match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
3365 (subreg:SI (match_dup 3) 12)] UNSPEC_REPLICATE_BYTE))
3366 (use (match_operand:TI 1 "register_operand" "d"))
3367 (clobber (reg:CC CC_REGNUM))]
3368 "!TARGET_64BIT && TARGET_ZARCH"
3369 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3370 [(set_attr "length" "8")
3371 (set_attr "type" "vs")])
3373 (define_insn "*setmem_long_and_31z"
3374 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3375 (set (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "0") 4))
3376 (unspec:BLK [(and:SI
3377 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
3378 (match_operand:SI 4 "const_int_operand" "n"))
3379 (subreg:SI (match_dup 3) 12)] UNSPEC_REPLICATE_BYTE))
3380 (use (match_operand:TI 1 "register_operand" "d"))
3381 (clobber (reg:CC CC_REGNUM))]
3382 "(!TARGET_64BIT && TARGET_ZARCH) &&
3383 (INTVAL (operands[4]) & 255) == 255"
3384 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3385 [(set_attr "length" "8")
3386 (set_attr "type" "vs")])
3389 ; cmpmemM instruction pattern(s).
3392 (define_expand "cmpmemsi"
3393 [(set (match_operand:SI 0 "register_operand" "")
3394 (compare:SI (match_operand:BLK 1 "memory_operand" "")
3395 (match_operand:BLK 2 "memory_operand" "") ) )
3396 (use (match_operand:SI 3 "general_operand" ""))
3397 (use (match_operand:SI 4 "" ""))]
3400 if (s390_expand_cmpmem (operands[0], operands[1],
3401 operands[2], operands[3]))
3407 ; Compare a block that is up to 256 bytes in length.
3408 ; The block length is taken as (operands[2] % 256) + 1.
3410 (define_expand "cmpmem_short"
3412 [(set (reg:CCU CC_REGNUM)
3413 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3414 (match_operand:BLK 1 "memory_operand" "")))
3415 (use (match_operand 2 "nonmemory_operand" ""))
3416 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3417 (clobber (match_dup 3))])]
3419 "operands[3] = gen_rtx_SCRATCH (Pmode);")
3421 (define_insn "*cmpmem_short"
3422 [(set (reg:CCU CC_REGNUM)
3423 (compare:CCU (match_operand:BLK 0 "memory_operand" "Q,Q,Q,Q")
3424 (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q")))
3425 (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
3426 (use (match_operand 3 "immediate_operand" "X,R,X,X"))
3427 (clobber (match_scratch:P 4 "=X,X,X,&a"))]
3428 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
3430 [(set_attr "type" "cs")
3431 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3434 [(set (reg:CCU CC_REGNUM)
3435 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3436 (match_operand:BLK 1 "memory_operand" "")))
3437 (use (match_operand 2 "const_int_operand" ""))
3438 (use (match_operand 3 "immediate_operand" ""))
3439 (clobber (scratch))]
3442 [(set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3443 (use (match_dup 2))])]
3444 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
3447 [(set (reg:CCU CC_REGNUM)
3448 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3449 (match_operand:BLK 1 "memory_operand" "")))
3450 (use (match_operand 2 "register_operand" ""))
3451 (use (match_operand 3 "memory_operand" ""))
3452 (clobber (scratch))]
3455 [(unspec [(match_dup 2) (match_dup 3)
3456 (const_int 0)] UNSPEC_EXECUTE)
3457 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3458 (use (const_int 1))])]
3462 [(set (reg:CCU CC_REGNUM)
3463 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3464 (match_operand:BLK 1 "memory_operand" "")))
3465 (use (match_operand 2 "register_operand" ""))
3466 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3467 (clobber (scratch))]
3468 "TARGET_Z10 && reload_completed"
3470 [(unspec [(match_dup 2) (const_int 0)
3471 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3472 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3473 (use (const_int 1))])]
3474 "operands[4] = gen_label_rtx ();")
3477 [(set (reg:CCU CC_REGNUM)
3478 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3479 (match_operand:BLK 1 "memory_operand" "")))
3480 (use (match_operand 2 "register_operand" ""))
3481 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3482 (clobber (match_operand 3 "register_operand" ""))]
3483 "reload_completed && TARGET_CPU_ZARCH"
3484 [(set (match_dup 3) (label_ref (match_dup 4)))
3486 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
3487 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3488 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3489 (use (const_int 1))])]
3490 "operands[4] = gen_label_rtx ();")
3492 ; Compare a block of arbitrary length.
3494 (define_expand "cmpmem_long"
3496 [(clobber (match_dup 2))
3497 (clobber (match_dup 3))
3498 (set (reg:CCU CC_REGNUM)
3499 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3500 (match_operand:BLK 1 "memory_operand" "")))
3501 (use (match_operand 2 "general_operand" ""))
3502 (use (match_dup 3))])]
3505 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3506 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3507 rtx reg0 = gen_reg_rtx (dreg_mode);
3508 rtx reg1 = gen_reg_rtx (dreg_mode);
3509 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3510 rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1));
3511 rtx len0 = gen_lowpart (Pmode, reg0);
3512 rtx len1 = gen_lowpart (Pmode, reg1);
3514 emit_clobber (reg0);
3515 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3516 emit_move_insn (len0, operands[2]);
3518 emit_clobber (reg1);
3519 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
3520 emit_move_insn (len1, operands[2]);
3522 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3523 operands[1] = replace_equiv_address_nv (operands[1], addr1);
3528 (define_insn "*cmpmem_long"
3529 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3530 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
3531 (set (reg:CCU CC_REGNUM)
3532 (compare:CCU (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
3533 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0))))
3535 (use (match_dup 3))]
3536 "TARGET_64BIT || !TARGET_ZARCH"
3537 "clcle\t%0,%1,0\;jo\t.-4"
3538 [(set_attr "length" "8")
3539 (set_attr "type" "vs")])
3541 (define_insn "*cmpmem_long_31z"
3542 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3543 (clobber (match_operand:TI 1 "register_operand" "=d"))
3544 (set (reg:CCU CC_REGNUM)
3545 (compare:CCU (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4))
3546 (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4))))
3548 (use (match_dup 3))]
3549 "!TARGET_64BIT && TARGET_ZARCH"
3550 "clcle\t%0,%1,0\;jo\t.-4"
3551 [(set_attr "op_type" "NN")
3552 (set_attr "type" "vs")
3553 (set_attr "length" "8")])
3555 ; Convert CCUmode condition code to integer.
3556 ; Result is zero if EQ, positive if LTU, negative if GTU.
3558 (define_insn_and_split "cmpint"
3559 [(set (match_operand:SI 0 "register_operand" "=d")
3560 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3561 UNSPEC_STRCMPCC_TO_INT))
3562 (clobber (reg:CC CC_REGNUM))]
3566 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
3568 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))
3569 (clobber (reg:CC CC_REGNUM))])])
3571 (define_insn_and_split "*cmpint_cc"
3572 [(set (reg CC_REGNUM)
3573 (compare (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3574 UNSPEC_STRCMPCC_TO_INT)
3576 (set (match_operand:SI 0 "register_operand" "=d")
3577 (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT))]
3578 "s390_match_ccmode (insn, CCSmode)"
3580 "&& reload_completed"
3581 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
3583 [(set (match_dup 2) (match_dup 3))
3584 (set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))])]
3586 rtx result = gen_rtx_ASHIFTRT (SImode, operands[0], GEN_INT (30));
3587 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
3588 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
3591 (define_insn_and_split "*cmpint_sign"
3592 [(set (match_operand:DI 0 "register_operand" "=d")
3593 (sign_extend:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3594 UNSPEC_STRCMPCC_TO_INT)))
3595 (clobber (reg:CC CC_REGNUM))]
3598 "&& reload_completed"
3599 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
3601 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))
3602 (clobber (reg:CC CC_REGNUM))])])
3604 (define_insn_and_split "*cmpint_sign_cc"
3605 [(set (reg CC_REGNUM)
3606 (compare (ashiftrt:DI (ashift:DI (subreg:DI
3607 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3608 UNSPEC_STRCMPCC_TO_INT) 0)
3609 (const_int 32)) (const_int 32))
3611 (set (match_operand:DI 0 "register_operand" "=d")
3612 (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT)))]
3613 "s390_match_ccmode (insn, CCSmode) && TARGET_ZARCH"
3615 "&& reload_completed"
3616 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
3618 [(set (match_dup 2) (match_dup 3))
3619 (set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))])]
3621 rtx result = gen_rtx_ASHIFTRT (DImode, operands[0], GEN_INT (62));
3622 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
3623 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
3628 ;;- Conversion instructions.
3631 (define_insn "*sethighpartsi"
3632 [(set (match_operand:SI 0 "register_operand" "=d,d")
3633 (unspec:SI [(match_operand:BLK 1 "s_operand" "Q,S")
3634 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
3635 (clobber (reg:CC CC_REGNUM))]
3640 [(set_attr "op_type" "RS,RSY")
3641 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3643 (define_insn "*sethighpartdi_64"
3644 [(set (match_operand:DI 0 "register_operand" "=d")
3645 (unspec:DI [(match_operand:BLK 1 "s_operand" "QS")
3646 (match_operand 2 "const_int_operand" "n")] UNSPEC_ICM))
3647 (clobber (reg:CC CC_REGNUM))]
3650 [(set_attr "op_type" "RSY")
3651 (set_attr "z10prop" "z10_super")])
3653 (define_insn "*sethighpartdi_31"
3654 [(set (match_operand:DI 0 "register_operand" "=d,d")
3655 (unspec:DI [(match_operand:BLK 1 "s_operand" "Q,S")
3656 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
3657 (clobber (reg:CC CC_REGNUM))]
3662 [(set_attr "op_type" "RS,RSY")
3663 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3666 ; extv instruction patterns
3669 ; FIXME: This expander needs to be converted from DI to GPR as well
3670 ; after resolving some issues with it.
3672 (define_expand "extzv"
3674 [(set (match_operand:DI 0 "register_operand" "=d")
3676 (match_operand:DI 1 "register_operand" "d")
3677 (match_operand 2 "const_int_operand" "") ; size
3678 (match_operand 3 "const_int_operand" ""))) ; start
3679 (clobber (reg:CC CC_REGNUM))])]
3682 /* Starting with zEC12 there is risbgn not clobbering CC. */
3685 emit_move_insn (operands[0],
3686 gen_rtx_ZERO_EXTRACT (DImode,
3694 (define_insn "*extzv<mode>_zEC12"
3695 [(set (match_operand:GPR 0 "register_operand" "=d")
3697 (match_operand:GPR 1 "register_operand" "d")
3698 (match_operand 2 "const_int_operand" "") ; size
3699 (match_operand 3 "const_int_operand" "")))] ; start]
3701 "risbgn\t%0,%1,64-%2,128+63,<bitsize>+%3+%2" ; dst, src, start, end, shift
3702 [(set_attr "op_type" "RIE")])
3704 (define_insn "*extzv<mode>_z10"
3705 [(set (match_operand:GPR 0 "register_operand" "=d")
3707 (match_operand:GPR 1 "register_operand" "d")
3708 (match_operand 2 "const_int_operand" "") ; size
3709 (match_operand 3 "const_int_operand" ""))) ; start
3710 (clobber (reg:CC CC_REGNUM))]
3712 "risbg\t%0,%1,64-%2,128+63,<bitsize>+%3+%2" ; dst, src, start, end, shift
3713 [(set_attr "op_type" "RIE")
3714 (set_attr "z10prop" "z10_super_E1")])
3716 (define_insn_and_split "*pre_z10_extzv<mode>"
3717 [(set (match_operand:GPR 0 "register_operand" "=d")
3718 (zero_extract:GPR (match_operand:QI 1 "s_operand" "QS")
3719 (match_operand 2 "nonzero_shift_count_operand" "")
3721 (clobber (reg:CC CC_REGNUM))]
3724 "&& reload_completed"
3726 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
3727 (clobber (reg:CC CC_REGNUM))])
3728 (set (match_dup 0) (lshiftrt:GPR (match_dup 0) (match_dup 2)))]
3730 int bitsize = INTVAL (operands[2]);
3731 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
3732 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
3734 operands[1] = adjust_address (operands[1], BLKmode, 0);
3735 set_mem_size (operands[1], size);
3736 operands[2] = GEN_INT (<GPR:bitsize> - bitsize);
3737 operands[3] = GEN_INT (mask);
3740 (define_insn_and_split "*pre_z10_extv<mode>"
3741 [(set (match_operand:GPR 0 "register_operand" "=d")
3742 (sign_extract:GPR (match_operand:QI 1 "s_operand" "QS")
3743 (match_operand 2 "nonzero_shift_count_operand" "")
3745 (clobber (reg:CC CC_REGNUM))]
3748 "&& reload_completed"
3750 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
3751 (clobber (reg:CC CC_REGNUM))])
3753 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
3754 (clobber (reg:CC CC_REGNUM))])]
3756 int bitsize = INTVAL (operands[2]);
3757 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
3758 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
3760 operands[1] = adjust_address (operands[1], BLKmode, 0);
3761 set_mem_size (operands[1], size);
3762 operands[2] = GEN_INT (<GPR:bitsize> - bitsize);
3763 operands[3] = GEN_INT (mask);
3767 ; insv instruction patterns
3770 (define_expand "insv"
3771 [(set (zero_extract (match_operand 0 "nonimmediate_operand" "")
3772 (match_operand 1 "const_int_operand" "")
3773 (match_operand 2 "const_int_operand" ""))
3774 (match_operand 3 "general_operand" ""))]
3777 if (s390_expand_insv (operands[0], operands[1], operands[2], operands[3]))
3783 ; The normal RTL expansion will never generate a zero_extract where
3784 ; the location operand isn't word mode. However, we do this in the
3785 ; back-end when generating atomic operations. See s390_two_part_insv.
3786 (define_insn "*insv<mode>_zEC12"
3787 [(set (zero_extract:GPR (match_operand:GPR 0 "nonimmediate_operand" "+d")
3788 (match_operand 1 "const_int_operand" "I") ; size
3789 (match_operand 2 "const_int_operand" "I")) ; pos
3790 (match_operand:GPR 3 "nonimmediate_operand" "d"))]
3792 && (INTVAL (operands[1]) + INTVAL (operands[2])) <= <bitsize>"
3793 "risbgn\t%0,%3,64-<bitsize>+%2,64-<bitsize>+%2+%1-1,<bitsize>-%2-%1"
3794 [(set_attr "op_type" "RIE")])
3796 (define_insn "*insv<mode>_z10"
3797 [(set (zero_extract:GPR (match_operand:GPR 0 "nonimmediate_operand" "+d")
3798 (match_operand 1 "const_int_operand" "I") ; size
3799 (match_operand 2 "const_int_operand" "I")) ; pos
3800 (match_operand:GPR 3 "nonimmediate_operand" "d"))
3801 (clobber (reg:CC CC_REGNUM))]
3803 && (INTVAL (operands[1]) + INTVAL (operands[2])) <= <bitsize>"
3804 "risbg\t%0,%3,64-<bitsize>+%2,64-<bitsize>+%2+%1-1,<bitsize>-%2-%1"
3805 [(set_attr "op_type" "RIE")
3806 (set_attr "z10prop" "z10_super_E1")])
3808 ; and op1 with a mask being 1 for the selected bits and 0 for the rest
3809 ; and op3=op0 with a mask being 0 for the selected bits and 1 for the rest
3810 (define_insn "*insv<mode>_zEC12_noshift"
3811 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3812 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3813 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3814 (and:GPR (match_operand:GPR 3 "nonimmediate_operand" "0")
3815 (match_operand:GPR 4 "const_int_operand" ""))))]
3816 "TARGET_ZEC12 && INTVAL (operands[2]) == ~INTVAL (operands[4])"
3817 "risbgn\t%0,%1,%<bfstart>2,%<bfend>2,0"
3818 [(set_attr "op_type" "RIE")])
3820 (define_insn "*insv<mode>_z10_noshift"
3821 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3822 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3823 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3824 (and:GPR (match_operand:GPR 3 "nonimmediate_operand" "0")
3825 (match_operand:GPR 4 "const_int_operand" ""))))
3826 (clobber (reg:CC CC_REGNUM))]
3827 "TARGET_Z10 && INTVAL (operands[2]) == ~INTVAL (operands[4])"
3828 "risbg\t%0,%1,%<bfstart>2,%<bfend>2,0"
3829 [(set_attr "op_type" "RIE")
3830 (set_attr "z10prop" "z10_super_E1")])
3832 ; Implement appending Y on the left of S bits of X
3833 ; x = (y << s) | (x & ((1 << s) - 1))
3834 (define_insn "*insv<mode>_zEC12_appendbitsleft"
3835 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3836 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "0")
3837 (match_operand:GPR 2 "immediate_operand" ""))
3838 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "d")
3839 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))]
3840 "TARGET_ZEC12 && UINTVAL (operands[2]) == (1UL << UINTVAL (operands[4])) - 1"
3841 "risbgn\t%0,%3,64-<bitsize>,64-%4-1,%4"
3842 [(set_attr "op_type" "RIE")
3843 (set_attr "z10prop" "z10_super_E1")])
3845 (define_insn "*insv<mode>_z10_appendbitsleft"
3846 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3847 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "0")
3848 (match_operand:GPR 2 "immediate_operand" ""))
3849 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "d")
3850 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))
3851 (clobber (reg:CC CC_REGNUM))]
3852 "TARGET_Z10 && !TARGET_ZEC12 && UINTVAL (operands[2]) == (1UL << UINTVAL (operands[4])) - 1"
3853 "risbg\t%0,%3,64-<bitsize>,64-%4-1,%4"
3854 [(set_attr "op_type" "RIE")
3855 (set_attr "z10prop" "z10_super_E1")])
3857 ; z = (x << c) | (y >> d) with (x << c) and (y >> d) not overlapping after shifting
3858 ; -> z = y >> d; z = (x << c) | (z & ((1 << c) - 1))
3859 ; -> z = y >> d; z = risbg;
3862 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
3863 (ior:GPR (lshiftrt:GPR (match_operand:GPR 1 "nonimmediate_operand" "")
3864 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
3865 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "")
3866 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))]
3867 "TARGET_ZEC12 && UINTVAL (operands[2]) + UINTVAL (operands[4]) >= <bitsize>"
3869 (lshiftrt:GPR (match_dup 1) (match_dup 2)))
3871 (ior:GPR (and:GPR (match_dup 0) (match_dup 5))
3872 (ashift:GPR (match_dup 3) (match_dup 4))))]
3874 operands[5] = GEN_INT ((1UL << UINTVAL (operands[4])) - 1);
3879 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
3880 (ior:GPR (lshiftrt:GPR (match_operand:GPR 1 "nonimmediate_operand" "")
3881 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
3882 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "")
3883 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))
3884 (clobber (reg:CC CC_REGNUM))])]
3885 "TARGET_Z10 && !TARGET_ZEC12 && UINTVAL (operands[2]) + UINTVAL (operands[4]) >= <bitsize>"
3887 (lshiftrt:GPR (match_dup 1) (match_dup 2)))
3890 (ior:GPR (and:GPR (match_dup 0) (match_dup 5))
3891 (ashift:GPR (match_dup 3) (match_dup 4))))
3892 (clobber (reg:CC CC_REGNUM))])]
3894 operands[5] = GEN_INT ((1UL << UINTVAL (operands[4])) - 1);
3897 (define_insn "*r<noxa>sbg_<mode>_noshift"
3898 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3900 (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3901 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3902 (match_operand:GPR 3 "nonimmediate_operand" "0")))
3903 (clobber (reg:CC CC_REGNUM))]
3905 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,0"
3906 [(set_attr "op_type" "RIE")])
3908 (define_insn "*r<noxa>sbg_di_rotl"
3909 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
3913 (match_operand:DI 1 "nonimmediate_operand" "d")
3914 (match_operand:DI 3 "const_int_operand" ""))
3915 (match_operand:DI 2 "contiguous_bitmask_operand" ""))
3916 (match_operand:DI 4 "nonimmediate_operand" "0")))
3917 (clobber (reg:CC CC_REGNUM))]
3919 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%b3"
3920 [(set_attr "op_type" "RIE")])
3922 (define_insn "*r<noxa>sbg_<mode>_srl"
3923 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3927 (match_operand:GPR 1 "nonimmediate_operand" "d")
3928 (match_operand:GPR 3 "nonzero_shift_count_operand" ""))
3929 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3930 (match_operand:GPR 4 "nonimmediate_operand" "0")))
3931 (clobber (reg:CC CC_REGNUM))]
3933 && s390_extzv_shift_ok (<bitsize>, 64 - INTVAL (operands[3]),
3934 INTVAL (operands[2]))"
3935 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,64-%3"
3936 [(set_attr "op_type" "RIE")])
3938 (define_insn "*r<noxa>sbg_<mode>_sll"
3939 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3943 (match_operand:GPR 1 "nonimmediate_operand" "d")
3944 (match_operand:GPR 3 "nonzero_shift_count_operand" ""))
3945 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3946 (match_operand:GPR 4 "nonimmediate_operand" "0")))
3947 (clobber (reg:CC CC_REGNUM))]
3949 && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[3]),
3950 INTVAL (operands[2]))"
3951 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%3"
3952 [(set_attr "op_type" "RIE")])
3954 ;; These two are generated by combine for s.bf &= val.
3955 ;; ??? For bitfields smaller than 32-bits, we wind up with SImode
3956 ;; shifts and ands, which results in some truly awful patterns
3957 ;; including subregs of operations. Rather unnecessisarily, IMO.
3960 ;; (set (zero_extract:DI (reg/v:DI 50 [ s ])
3961 ;; (const_int 24 [0x18])
3962 ;; (const_int 0 [0]))
3963 ;; (subreg:DI (and:SI (subreg:SI (lshiftrt:DI (reg/v:DI 50 [ s ])
3964 ;; (const_int 40 [0x28])) 4)
3965 ;; (reg:SI 4 %r4 [ y+4 ])) 0))
3967 ;; we should instead generate
3969 ;; (set (zero_extract:DI (reg/v:DI 50 [ s ])
3970 ;; (const_int 24 [0x18])
3971 ;; (const_int 0 [0]))
3972 ;; (and:DI (lshiftrt:DI (reg/v:DI 50 [ s ])
3973 ;; (const_int 40 [0x28]))
3974 ;; (subreg:DI (reg:SI 4 %r4 [ y+4 ]) 0)))
3976 ;; by noticing that we can push down the outer paradoxical subreg
3977 ;; into the operation.
3979 (define_insn "*insv_rnsbg_noshift"
3980 [(set (zero_extract:DI
3981 (match_operand:DI 0 "nonimmediate_operand" "+d")
3982 (match_operand 1 "const_int_operand" "")
3983 (match_operand 2 "const_int_operand" ""))
3986 (match_operand:DI 3 "nonimmediate_operand" "d")))
3987 (clobber (reg:CC CC_REGNUM))]
3989 && INTVAL (operands[1]) + INTVAL (operands[2]) == 64"
3990 "rnsbg\t%0,%3,%2,63,0"
3991 [(set_attr "op_type" "RIE")])
3993 (define_insn "*insv_rnsbg_srl"
3994 [(set (zero_extract:DI
3995 (match_operand:DI 0 "nonimmediate_operand" "+d")
3996 (match_operand 1 "const_int_operand" "")
3997 (match_operand 2 "const_int_operand" ""))
4001 (match_operand 3 "const_int_operand" ""))
4002 (match_operand:DI 4 "nonimmediate_operand" "d")))
4003 (clobber (reg:CC CC_REGNUM))]
4005 && INTVAL (operands[3]) == 64 - INTVAL (operands[1]) - INTVAL (operands[2])"
4006 "rnsbg\t%0,%4,%2,%2+%1-1,%3"
4007 [(set_attr "op_type" "RIE")])
4009 (define_insn "*insv<mode>_mem_reg"
4010 [(set (zero_extract:W (match_operand:QI 0 "memory_operand" "+Q,S")
4011 (match_operand 1 "const_int_operand" "n,n")
4013 (match_operand:W 2 "register_operand" "d,d"))]
4014 "INTVAL (operands[1]) > 0
4015 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
4016 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
4018 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
4020 operands[1] = GEN_INT ((1ul << size) - 1);
4021 return (which_alternative == 0) ? "stcm\t%2,%1,%S0"
4022 : "stcmy\t%2,%1,%S0";
4024 [(set_attr "op_type" "RS,RSY")
4025 (set_attr "z10prop" "z10_super,z10_super")])
4027 (define_insn "*insvdi_mem_reghigh"
4028 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "+QS")
4029 (match_operand 1 "const_int_operand" "n")
4031 (lshiftrt:DI (match_operand:DI 2 "register_operand" "d")
4034 && INTVAL (operands[1]) > 0
4035 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
4036 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
4038 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
4040 operands[1] = GEN_INT ((1ul << size) - 1);
4041 return "stcmh\t%2,%1,%S0";
4043 [(set_attr "op_type" "RSY")
4044 (set_attr "z10prop" "z10_super")])
4046 (define_insn "*insvdi_reg_imm"
4047 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4049 (match_operand 1 "const_int_operand" "n"))
4050 (match_operand:DI 2 "const_int_operand" "n"))]
4052 && INTVAL (operands[1]) >= 0
4053 && INTVAL (operands[1]) < BITS_PER_WORD
4054 && INTVAL (operands[1]) % 16 == 0"
4056 switch (BITS_PER_WORD - INTVAL (operands[1]))
4058 case 64: return "iihh\t%0,%x2"; break;
4059 case 48: return "iihl\t%0,%x2"; break;
4060 case 32: return "iilh\t%0,%x2"; break;
4061 case 16: return "iill\t%0,%x2"; break;
4062 default: gcc_unreachable();
4065 [(set_attr "op_type" "RI")
4066 (set_attr "z10prop" "z10_super_E1")])
4068 ; Update the left-most 32 bit of a DI.
4069 (define_insn "*insv_h_di_reg_extimm"
4070 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4073 (match_operand:DI 1 "const_int_operand" "n"))]
4076 [(set_attr "op_type" "RIL")
4077 (set_attr "z10prop" "z10_fwd_E1")])
4079 ; Update the right-most 32 bit of a DI.
4080 (define_insn "*insv_l_di_reg_extimm"
4081 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4084 (match_operand:DI 1 "const_int_operand" "n"))]
4087 [(set_attr "op_type" "RIL")
4088 (set_attr "z10prop" "z10_fwd_A1")])
4091 ; extendsidi2 instruction pattern(s).
4094 (define_expand "extendsidi2"
4095 [(set (match_operand:DI 0 "register_operand" "")
4096 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
4101 emit_clobber (operands[0]);
4102 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
4103 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
4104 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
4109 (define_insn "*extendsidi2"
4110 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4111 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,RT,b")))]
4117 [(set_attr "op_type" "RRE,RXY,RIL")
4118 (set_attr "type" "*,*,larl")
4119 (set_attr "cpu_facility" "*,*,z10")
4120 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
4123 ; extend(hi|qi)(si|di)2 instruction pattern(s).
4126 (define_expand "extend<HQI:mode><DSI:mode>2"
4127 [(set (match_operand:DSI 0 "register_operand" "")
4128 (sign_extend:DSI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4131 if (<DSI:MODE>mode == DImode && !TARGET_ZARCH)
4133 rtx tmp = gen_reg_rtx (SImode);
4134 emit_insn (gen_extend<HQI:mode>si2 (tmp, operands[1]));
4135 emit_insn (gen_extendsidi2 (operands[0], tmp));
4138 else if (!TARGET_EXTIMM)
4140 rtx bitcount = GEN_INT (<DSI:bitsize> - <HQI:bitsize>);
4142 operands[1] = gen_lowpart (<DSI:MODE>mode, operands[1]);
4143 emit_insn (gen_ashl<DSI:mode>3 (operands[0], operands[1], bitcount));
4144 emit_insn (gen_ashr<DSI:mode>3 (operands[0], operands[0], bitcount));
4150 ; extendhidi2 instruction pattern(s).
4153 (define_insn "*extendhidi2_extimm"
4154 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4155 (sign_extend:DI (match_operand:HI 1 "general_operand" "d,RT,b")))]
4156 "TARGET_ZARCH && TARGET_EXTIMM"
4161 [(set_attr "op_type" "RRE,RXY,RIL")
4162 (set_attr "type" "*,*,larl")
4163 (set_attr "cpu_facility" "extimm,extimm,z10")
4164 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
4166 (define_insn "*extendhidi2"
4167 [(set (match_operand:DI 0 "register_operand" "=d")
4168 (sign_extend:DI (match_operand:HI 1 "memory_operand" "RT")))]
4171 [(set_attr "op_type" "RXY")
4172 (set_attr "z10prop" "z10_super_E1")])
4175 ; extendhisi2 instruction pattern(s).
4178 (define_insn "*extendhisi2_extimm"
4179 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4180 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" " d,R,T,b")))]
4187 [(set_attr "op_type" "RRE,RX,RXY,RIL")
4188 (set_attr "type" "*,*,*,larl")
4189 (set_attr "cpu_facility" "extimm,extimm,extimm,z10")
4190 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
4192 (define_insn "*extendhisi2"
4193 [(set (match_operand:SI 0 "register_operand" "=d,d")
4194 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
4199 [(set_attr "op_type" "RX,RXY")
4200 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4203 ; extendqi(si|di)2 instruction pattern(s).
4206 ; lbr, lgbr, lb, lgb
4207 (define_insn "*extendqi<mode>2_extimm"
4208 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4209 (sign_extend:GPR (match_operand:QI 1 "nonimmediate_operand" "d,RT")))]
4214 [(set_attr "op_type" "RRE,RXY")
4215 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4218 (define_insn "*extendqi<mode>2"
4219 [(set (match_operand:GPR 0 "register_operand" "=d")
4220 (sign_extend:GPR (match_operand:QI 1 "memory_operand" "RT")))]
4221 "!TARGET_EXTIMM && TARGET_LONG_DISPLACEMENT"
4223 [(set_attr "op_type" "RXY")
4224 (set_attr "z10prop" "z10_super_E1")])
4226 (define_insn_and_split "*extendqi<mode>2_short_displ"
4227 [(set (match_operand:GPR 0 "register_operand" "=d")
4228 (sign_extend:GPR (match_operand:QI 1 "s_operand" "Q")))
4229 (clobber (reg:CC CC_REGNUM))]
4230 "!TARGET_EXTIMM && !TARGET_LONG_DISPLACEMENT"
4232 "&& reload_completed"
4234 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (const_int 8)] UNSPEC_ICM))
4235 (clobber (reg:CC CC_REGNUM))])
4237 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
4238 (clobber (reg:CC CC_REGNUM))])]
4240 operands[1] = adjust_address (operands[1], BLKmode, 0);
4241 set_mem_size (operands[1], GET_MODE_SIZE (QImode));
4242 operands[2] = GEN_INT (<GPR:bitsize> - BITS_PER_UNIT);
4246 ; zero_extendsidi2 instruction pattern(s).
4249 (define_expand "zero_extendsidi2"
4250 [(set (match_operand:DI 0 "register_operand" "")
4251 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
4256 emit_clobber (operands[0]);
4257 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
4258 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
4263 (define_insn "*zero_extendsidi2"
4264 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4265 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,RT,b")))]
4271 [(set_attr "op_type" "RRE,RXY,RIL")
4272 (set_attr "type" "*,*,larl")
4273 (set_attr "cpu_facility" "*,*,z10")
4274 (set_attr "z10prop" "z10_fwd_E1,z10_fwd_A3,z10_fwd_A3")])
4277 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
4280 (define_insn "*llgt_sidi"
4281 [(set (match_operand:DI 0 "register_operand" "=d")
4282 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "RT") 0)
4283 (const_int 2147483647)))]
4286 [(set_attr "op_type" "RXE")
4287 (set_attr "z10prop" "z10_super_E1")])
4289 (define_insn_and_split "*llgt_sidi_split"
4290 [(set (match_operand:DI 0 "register_operand" "=d")
4291 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "RT") 0)
4292 (const_int 2147483647)))
4293 (clobber (reg:CC CC_REGNUM))]
4296 "&& reload_completed"
4298 (and:DI (subreg:DI (match_dup 1) 0)
4299 (const_int 2147483647)))]
4302 (define_insn "*llgt_sisi"
4303 [(set (match_operand:SI 0 "register_operand" "=d,d")
4304 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,RT")
4305 (const_int 2147483647)))]
4310 [(set_attr "op_type" "RRE,RXE")
4311 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4313 (define_insn "*llgt_didi"
4314 [(set (match_operand:DI 0 "register_operand" "=d,d")
4315 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
4316 (const_int 2147483647)))]
4321 [(set_attr "op_type" "RRE,RXE")
4322 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4325 [(set (match_operand:DSI 0 "register_operand" "")
4326 (and:DSI (match_operand:DSI 1 "nonimmediate_operand" "")
4327 (const_int 2147483647)))
4328 (clobber (reg:CC CC_REGNUM))]
4329 "TARGET_ZARCH && reload_completed"
4331 (and:DSI (match_dup 1)
4332 (const_int 2147483647)))]
4336 ; zero_extend(hi|qi)(si|di)2 instruction pattern(s).
4339 (define_expand "zero_extend<mode>di2"
4340 [(set (match_operand:DI 0 "register_operand" "")
4341 (zero_extend:DI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4346 rtx tmp = gen_reg_rtx (SImode);
4347 emit_insn (gen_zero_extend<mode>si2 (tmp, operands[1]));
4348 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
4351 else if (!TARGET_EXTIMM)
4353 rtx bitcount = GEN_INT (64 - <HQI:bitsize>);
4354 operands[1] = gen_lowpart (DImode, operands[1]);
4355 emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount));
4356 emit_insn (gen_lshrdi3 (operands[0], operands[0], bitcount));
4361 (define_expand "zero_extend<mode>si2"
4362 [(set (match_operand:SI 0 "register_operand" "")
4363 (zero_extend:SI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4368 operands[1] = gen_lowpart (SImode, operands[1]);
4369 emit_insn (gen_andsi3 (operands[0], operands[1],
4370 GEN_INT ((1 << <HQI:bitsize>) - 1)));
4376 (define_insn "*zero_extendhi<mode>2_z10"
4377 [(set (match_operand:GPR 0 "register_operand" "=d,d,d")
4378 (zero_extend:GPR (match_operand:HI 1 "nonimmediate_operand" "d,RT,b")))]
4384 [(set_attr "op_type" "RXY,RRE,RIL")
4385 (set_attr "type" "*,*,larl")
4386 (set_attr "cpu_facility" "*,*,z10")
4387 (set_attr "z10prop" "z10_super_E1,z10_fwd_A3,z10_fwd_A3")])
4389 ; llhr, llcr, llghr, llgcr, llh, llc, llgh, llgc
4390 (define_insn "*zero_extend<HQI:mode><GPR:mode>2_extimm"
4391 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4392 (zero_extend:GPR (match_operand:HQI 1 "nonimmediate_operand" "d,RT")))]
4397 [(set_attr "op_type" "RRE,RXY")
4398 (set_attr "z10prop" "z10_super_E1,z10_fwd_A3")])
4401 (define_insn "*zero_extend<HQI:mode><GPR:mode>2"
4402 [(set (match_operand:GPR 0 "register_operand" "=d")
4403 (zero_extend:GPR (match_operand:HQI 1 "memory_operand" "RT")))]
4404 "TARGET_ZARCH && !TARGET_EXTIMM"
4406 [(set_attr "op_type" "RXY")
4407 (set_attr "z10prop" "z10_fwd_A3")])
4409 (define_insn_and_split "*zero_extendhisi2_31"
4410 [(set (match_operand:SI 0 "register_operand" "=&d")
4411 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
4412 (clobber (reg:CC CC_REGNUM))]
4415 "&& reload_completed"
4416 [(set (match_dup 0) (const_int 0))
4418 [(set (strict_low_part (match_dup 2)) (match_dup 1))
4419 (clobber (reg:CC CC_REGNUM))])]
4420 "operands[2] = gen_lowpart (HImode, operands[0]);")
4422 (define_insn_and_split "*zero_extendqisi2_31"
4423 [(set (match_operand:SI 0 "register_operand" "=&d")
4424 (zero_extend:SI (match_operand:QI 1 "memory_operand" "RT")))]
4427 "&& reload_completed"
4428 [(set (match_dup 0) (const_int 0))
4429 (set (strict_low_part (match_dup 2)) (match_dup 1))]
4430 "operands[2] = gen_lowpart (QImode, operands[0]);")
4433 ; zero_extendqihi2 instruction pattern(s).
4436 (define_expand "zero_extendqihi2"
4437 [(set (match_operand:HI 0 "register_operand" "")
4438 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
4439 "TARGET_ZARCH && !TARGET_EXTIMM"
4441 operands[1] = gen_lowpart (HImode, operands[1]);
4442 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
4446 (define_insn "*zero_extendqihi2_64"
4447 [(set (match_operand:HI 0 "register_operand" "=d")
4448 (zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))]
4449 "TARGET_ZARCH && !TARGET_EXTIMM"
4451 [(set_attr "op_type" "RXY")
4452 (set_attr "z10prop" "z10_fwd_A3")])
4454 (define_insn_and_split "*zero_extendqihi2_31"
4455 [(set (match_operand:HI 0 "register_operand" "=&d")
4456 (zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))]
4459 "&& reload_completed"
4460 [(set (match_dup 0) (const_int 0))
4461 (set (strict_low_part (match_dup 2)) (match_dup 1))]
4462 "operands[2] = gen_lowpart (QImode, operands[0]);")
4465 ; fixuns_trunc(dd|td)di2 instruction pattern(s).
4468 (define_expand "fixuns_truncdddi2"
4470 [(set (match_operand:DI 0 "register_operand" "")
4471 (unsigned_fix:DI (match_operand:DD 1 "register_operand" "")))
4472 (unspec:DI [(const_int 5)] UNSPEC_ROUND)
4473 (clobber (reg:CC CC_REGNUM))])]
4479 rtx_code_label *label1 = gen_label_rtx ();
4480 rtx_code_label *label2 = gen_label_rtx ();
4481 rtx temp = gen_reg_rtx (TDmode);
4482 REAL_VALUE_TYPE cmp, sub;
4484 decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */
4485 decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
4487 /* 2^63 can't be represented as 64bit DFP number with full precision. The
4488 solution is doing the check and the subtraction in TD mode and using a
4489 TD -> DI convert afterwards. */
4490 emit_insn (gen_extendddtd2 (temp, operands[1]));
4491 temp = force_reg (TDmode, temp);
4492 emit_cmp_and_jump_insns (temp,
4493 const_double_from_real_value (cmp, TDmode),
4494 LT, NULL_RTX, VOIDmode, 0, label1);
4495 emit_insn (gen_subtd3 (temp, temp,
4496 const_double_from_real_value (sub, TDmode)));
4497 emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, GEN_INT (11)));
4500 emit_label (label1);
4501 emit_insn (gen_fix_truncdddi2_dfp (operands[0], operands[1], GEN_INT (9)));
4502 emit_label (label2);
4507 (define_expand "fixuns_trunctddi2"
4509 [(set (match_operand:DI 0 "register_operand" "")
4510 (unsigned_fix:DI (match_operand:TD 1 "register_operand" "")))
4511 (unspec:DI [(const_int 5)] UNSPEC_ROUND)
4512 (clobber (reg:CC CC_REGNUM))])]
4518 rtx_code_label *label1 = gen_label_rtx ();
4519 rtx_code_label *label2 = gen_label_rtx ();
4520 rtx temp = gen_reg_rtx (TDmode);
4521 REAL_VALUE_TYPE cmp, sub;
4523 operands[1] = force_reg (TDmode, operands[1]);
4524 decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */
4525 decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
4527 emit_cmp_and_jump_insns (operands[1],
4528 const_double_from_real_value (cmp, TDmode),
4529 LT, NULL_RTX, VOIDmode, 0, label1);
4530 emit_insn (gen_subtd3 (temp, operands[1],
4531 const_double_from_real_value (sub, TDmode)));
4532 emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, GEN_INT (11)));
4535 emit_label (label1);
4536 emit_insn (gen_fix_trunctddi2_dfp (operands[0], operands[1], GEN_INT (9)));
4537 emit_label (label2);
4543 ; fixuns_trunc(sf|df|tf)(si|di)2 and fix_trunc(sf|df|tf)(si|di)2
4544 ; instruction pattern(s).
4547 (define_expand "fixuns_trunc<BFP:mode><GPR:mode>2"
4549 [(set (match_operand:GPR 0 "register_operand" "")
4550 (unsigned_fix:GPR (match_operand:BFP 1 "register_operand" "")))
4551 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
4552 (clobber (reg:CC CC_REGNUM))])]
4557 rtx_code_label *label1 = gen_label_rtx ();
4558 rtx_code_label *label2 = gen_label_rtx ();
4559 rtx temp = gen_reg_rtx (<BFP:MODE>mode);
4560 REAL_VALUE_TYPE cmp, sub;
4562 operands[1] = force_reg (<BFP:MODE>mode, operands[1]);
4563 real_2expN (&cmp, <GPR:bitsize> - 1, <BFP:MODE>mode);
4564 real_2expN (&sub, <GPR:bitsize>, <BFP:MODE>mode);
4566 emit_cmp_and_jump_insns (operands[1],
4567 const_double_from_real_value (cmp, <BFP:MODE>mode),
4568 LT, NULL_RTX, VOIDmode, 0, label1);
4569 emit_insn (gen_sub<BFP:mode>3 (temp, operands[1],
4570 const_double_from_real_value (sub, <BFP:MODE>mode)));
4571 emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0], temp,
4575 emit_label (label1);
4576 emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0],
4577 operands[1], GEN_INT (5)));
4578 emit_label (label2);
4583 ; fixuns_trunc(td|dd)si2 expander
4584 (define_expand "fixuns_trunc<mode>si2"
4586 [(set (match_operand:SI 0 "register_operand" "")
4587 (unsigned_fix:SI (match_operand:DFP 1 "register_operand" "")))
4588 (unspec:SI [(const_int 5)] UNSPEC_ROUND)
4589 (clobber (reg:CC CC_REGNUM))])]
4590 "TARGET_Z196 && TARGET_HARD_DFP"
4593 ; fixuns_trunc(tf|df|sf|td|dd)(di|si)2 instruction patterns.
4595 (define_insn "*fixuns_truncdfdi2_z13"
4596 [(set (match_operand:DI 0 "register_operand" "=d,v")
4597 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "f,v")))
4598 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND)
4599 (clobber (reg:CC CC_REGNUM))]
4600 "TARGET_Z13 && TARGET_HARD_FLOAT"
4603 wclgdb\t%v0,%v1,0,%h2"
4604 [(set_attr "op_type" "RRF,VRR")
4605 (set_attr "type" "ftoi")])
4607 ; clfebr, clfdbr, clfxbr, clgebr, clgdbr, clgxbr
4608 ; clfdtr, clfxtr, clgdtr, clgxtr
4609 (define_insn "*fixuns_trunc<FP:mode><GPR:mode>2_z196"
4610 [(set (match_operand:GPR 0 "register_operand" "=d")
4611 (unsigned_fix:GPR (match_operand:FP 1 "register_operand" "f")))
4612 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4613 (clobber (reg:CC CC_REGNUM))]
4614 "TARGET_Z196 && TARGET_HARD_FLOAT
4615 && (!TARGET_Z13 || <GPR:MODE>mode != DImode || <FP:MODE>mode != DFmode)"
4616 "cl<GPR:gf><FP:xde><FP:bt>r\t%0,%h2,%1,0"
4617 [(set_attr "op_type" "RRF")
4618 (set_attr "type" "ftoi")])
4620 (define_expand "fix_trunc<DSF:mode><GPR:mode>2"
4621 [(set (match_operand:GPR 0 "register_operand" "")
4622 (fix:GPR (match_operand:DSF 1 "register_operand" "")))]
4625 emit_insn (gen_fix_trunc<DSF:mode><GPR:mode>2_bfp (operands[0], operands[1],
4630 (define_insn "*fix_truncdfdi2_bfp_z13"
4631 [(set (match_operand:DI 0 "register_operand" "=d,v")
4632 (fix:DI (match_operand:DF 1 "register_operand" "f,v")))
4633 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND)
4634 (clobber (reg:CC CC_REGNUM))]
4635 "TARGET_Z13 && TARGET_HARD_FLOAT"
4638 wcgdb\t%v0,%v1,0,%h2"
4639 [(set_attr "op_type" "RRE,VRR")
4640 (set_attr "type" "ftoi")])
4642 ; cgxbr, cgdbr, cgebr, cfxbr, cfdbr, cfebr
4643 (define_insn "*fix_trunc<BFP:mode><GPR:mode>2_bfp"
4644 [(set (match_operand:GPR 0 "register_operand" "=d")
4645 (fix:GPR (match_operand:BFP 1 "register_operand" "f")))
4646 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4647 (clobber (reg:CC CC_REGNUM))]
4649 && (!TARGET_VX || <GPR:MODE>mode != DImode || <BFP:MODE>mode != DFmode)"
4650 "c<GPR:gf><BFP:xde>br\t%0,%h2,%1"
4651 [(set_attr "op_type" "RRE")
4652 (set_attr "type" "ftoi")])
4654 (define_expand "fix_trunc<BFP:mode><GPR:mode>2_bfp"
4656 [(set (match_operand:GPR 0 "register_operand" "=d")
4657 (fix:GPR (match_operand:BFP 1 "register_operand" "f")))
4658 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4659 (clobber (reg:CC CC_REGNUM))])]
4660 "TARGET_HARD_FLOAT")
4662 ; fix_trunc(td|dd)di2 instruction pattern(s).
4665 (define_expand "fix_trunc<mode>di2"
4666 [(set (match_operand:DI 0 "register_operand" "")
4667 (fix:DI (match_operand:DFP 1 "nonimmediate_operand" "")))]
4668 "TARGET_ZARCH && TARGET_HARD_DFP"
4670 operands[1] = force_reg (<MODE>mode, operands[1]);
4671 emit_insn (gen_fix_trunc<mode>di2_dfp (operands[0], operands[1],
4677 (define_insn "fix_trunc<DFP:mode>di2_dfp"
4678 [(set (match_operand:DI 0 "register_operand" "=d")
4679 (fix:DI (match_operand:DFP 1 "register_operand" "f")))
4680 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
4681 (clobber (reg:CC CC_REGNUM))]
4682 "TARGET_ZARCH && TARGET_HARD_DFP"
4683 "cg<DFP:xde>tr\t%0,%h2,%1"
4684 [(set_attr "op_type" "RRF")
4685 (set_attr "type" "ftoidfp")])
4689 ; fix_trunctf(si|di)2 instruction pattern(s).
4692 (define_expand "fix_trunctf<mode>2"
4693 [(parallel [(set (match_operand:GPR 0 "register_operand" "")
4694 (fix:GPR (match_operand:TF 1 "register_operand" "")))
4695 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
4696 (clobber (reg:CC CC_REGNUM))])]
4702 ; float(si|di)(tf|df|sf|td|dd)2 instruction pattern(s).
4705 ; cxgbr, cdgbr, cegbr, cxgtr, cdgtr
4706 (define_insn "floatdi<mode>2"
4707 [(set (match_operand:FP 0 "register_operand" "=f,<vf>")
4708 (float:FP (match_operand:DI 1 "register_operand" "d,<vd>")))]
4709 "TARGET_ZARCH && TARGET_HARD_FLOAT"
4713 [(set_attr "op_type" "RRE,VRR")
4714 (set_attr "type" "itof<mode>" )
4715 (set_attr "cpu_facility" "*,vec")])
4717 ; cxfbr, cdfbr, cefbr
4718 (define_insn "floatsi<mode>2"
4719 [(set (match_operand:BFP 0 "register_operand" "=f")
4720 (float:BFP (match_operand:SI 1 "register_operand" "d")))]
4723 [(set_attr "op_type" "RRE")
4724 (set_attr "type" "itof<mode>" )])
4727 (define_insn "floatsi<mode>2"
4728 [(set (match_operand:DFP 0 "register_operand" "=f")
4729 (float:DFP (match_operand:SI 1 "register_operand" "d")))]
4730 "TARGET_Z196 && TARGET_HARD_FLOAT"
4731 "c<xde>ftr\t%0,0,%1,0"
4732 [(set_attr "op_type" "RRE")
4733 (set_attr "type" "itof<mode>" )])
4736 ; floatuns(si|di)(tf|df|sf|td|dd)2 instruction pattern(s).
4739 (define_insn "*floatunsdidf2_z13"
4740 [(set (match_operand:DF 0 "register_operand" "=f,v")
4741 (unsigned_float:DF (match_operand:DI 1 "register_operand" "d,v")))]
4742 "TARGET_Z13 && TARGET_HARD_FLOAT"
4745 wcdlgb\t%v0,%v1,0,0"
4746 [(set_attr "op_type" "RRE,VRR")
4747 (set_attr "type" "itofdf")])
4749 ; cxlgbr, cdlgbr, celgbr, cxlgtr, cdlgtr
4750 ; cxlfbr, cdlfbr, celfbr, cxlftr, cdlftr
4751 (define_insn "*floatuns<GPR:mode><FP:mode>2"
4752 [(set (match_operand:FP 0 "register_operand" "=f")
4753 (unsigned_float:FP (match_operand:GPR 1 "register_operand" "d")))]
4754 "TARGET_Z196 && TARGET_HARD_FLOAT
4755 && (!TARGET_VX || <FP:MODE>mode != DFmode || <GPR:MODE>mode != DImode)"
4756 "c<FP:xde>l<GPR:gf><FP:bt>r\t%0,0,%1,0"
4757 [(set_attr "op_type" "RRE")
4758 (set_attr "type" "itof<FP:mode>")])
4760 (define_expand "floatuns<GPR:mode><FP:mode>2"
4761 [(set (match_operand:FP 0 "register_operand" "")
4762 (unsigned_float:FP (match_operand:GPR 1 "register_operand" "")))]
4763 "TARGET_Z196 && TARGET_HARD_FLOAT")
4766 ; truncdfsf2 instruction pattern(s).
4769 (define_insn "truncdfsf2"
4770 [(set (match_operand:SF 0 "register_operand" "=f,v")
4771 (float_truncate:SF (match_operand:DF 1 "register_operand" "f,v")))]
4775 wledb\t%v0,%v1,0,0" ; IEEE inexact exception not suppressed
4776 ; According to BFP rounding mode
4777 [(set_attr "op_type" "RRE,VRR")
4778 (set_attr "type" "ftruncdf")
4779 (set_attr "cpu_facility" "*,vec")])
4782 ; trunctf(df|sf)2 instruction pattern(s).
4786 (define_insn "trunctf<mode>2"
4787 [(set (match_operand:DSF 0 "register_operand" "=f")
4788 (float_truncate:DSF (match_operand:TF 1 "register_operand" "f")))
4789 (clobber (match_scratch:TF 2 "=f"))]
4791 "l<xde>xbr\t%2,%1\;l<xde>r\t%0,%2"
4792 [(set_attr "length" "6")
4793 (set_attr "type" "ftrunctf")])
4796 ; trunctddd2 and truncddsd2 instruction pattern(s).
4799 (define_insn "trunctddd2"
4800 [(set (match_operand:DD 0 "register_operand" "=f")
4801 (float_truncate:DD (match_operand:TD 1 "register_operand" "f")))
4802 (clobber (match_scratch:TD 2 "=f"))]
4804 "ldxtr\t%2,0,%1,0\;ldr\t%0,%2"
4805 [(set_attr "length" "6")
4806 (set_attr "type" "ftruncdd")])
4808 (define_insn "truncddsd2"
4809 [(set (match_operand:SD 0 "register_operand" "=f")
4810 (float_truncate:SD (match_operand:DD 1 "register_operand" "f")))]
4813 [(set_attr "op_type" "RRF")
4814 (set_attr "type" "ftruncsd")])
4816 (define_expand "trunctdsd2"
4819 (float_truncate:DD (match_operand:TD 1 "register_operand" "")))
4820 (clobber (match_scratch:TD 2 ""))])
4821 (set (match_operand:SD 0 "register_operand" "")
4822 (float_truncate:SD (match_dup 3)))]
4825 operands[3] = gen_reg_rtx (DDmode);
4829 ; extend(sf|df)(df|tf)2 instruction pattern(s).
4832 (define_insn "*extendsfdf2_z13"
4833 [(set (match_operand:DF 0 "register_operand" "=f,f,v")
4834 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R,v")))]
4835 "TARGET_Z13 && TARGET_HARD_FLOAT"
4840 [(set_attr "op_type" "RRE,RXE,VRR")
4841 (set_attr "type" "fsimpdf, floaddf,fsimpdf")])
4843 ; ldebr, ldeb, lxdbr, lxdb, lxebr, lxeb
4844 (define_insn "*extend<DSF:mode><BFP:mode>2"
4845 [(set (match_operand:BFP 0 "register_operand" "=f,f")
4846 (float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "f,R")))]
4848 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DSF:MODE>mode)
4849 && (!TARGET_VX || <BFP:MODE>mode != DFmode || <DSF:MODE>mode != SFmode)"
4851 l<BFP:xde><DSF:xde>br\t%0,%1
4852 l<BFP:xde><DSF:xde>b\t%0,%1"
4853 [(set_attr "op_type" "RRE,RXE")
4854 (set_attr "type" "fsimp<BFP:mode>, fload<BFP:mode>")])
4856 (define_expand "extend<DSF:mode><BFP:mode>2"
4857 [(set (match_operand:BFP 0 "register_operand" "")
4858 (float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "")))]
4860 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DSF:MODE>mode)")
4863 ; extendddtd2 and extendsddd2 instruction pattern(s).
4866 (define_insn "extendddtd2"
4867 [(set (match_operand:TD 0 "register_operand" "=f")
4868 (float_extend:TD (match_operand:DD 1 "register_operand" "f")))]
4871 [(set_attr "op_type" "RRF")
4872 (set_attr "type" "fsimptf")])
4874 (define_insn "extendsddd2"
4875 [(set (match_operand:DD 0 "register_operand" "=f")
4876 (float_extend:DD (match_operand:SD 1 "register_operand" "f")))]
4879 [(set_attr "op_type" "RRF")
4880 (set_attr "type" "fsimptf")])
4882 (define_expand "extendsdtd2"
4884 (float_extend:DD (match_operand:SD 1 "register_operand" "")))
4885 (set (match_operand:TD 0 "register_operand" "")
4886 (float_extend:TD (match_dup 2)))]
4889 operands[2] = gen_reg_rtx (DDmode);
4892 ; Binary Floating Point - load fp integer
4894 ; Expanders for: floor, btrunc, round, ceil, and nearbyint
4895 ; For all of them the inexact exceptions are suppressed.
4897 ; fiebra, fidbra, fixbra
4898 (define_insn "<FPINT:fpint_name><BFP:mode>2"
4899 [(set (match_operand:BFP 0 "register_operand" "=f")
4900 (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
4903 "fi<BFP:xde>bra\t%0,<FPINT:fpint_roundingmode>,%1,4"
4904 [(set_attr "op_type" "RRF")
4905 (set_attr "type" "fsimp<BFP:mode>")])
4907 ; rint is supposed to raise an inexact exception so we can use the
4908 ; older instructions.
4910 ; fiebr, fidbr, fixbr
4911 (define_insn "rint<BFP:mode>2"
4912 [(set (match_operand:BFP 0 "register_operand" "=f")
4913 (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
4914 UNSPEC_FPINT_RINT))]
4916 "fi<BFP:xde>br\t%0,0,%1"
4917 [(set_attr "op_type" "RRF")
4918 (set_attr "type" "fsimp<BFP:mode>")])
4921 ; Decimal Floating Point - load fp integer
4924 (define_insn "<FPINT:fpint_name><DFP:mode>2"
4925 [(set (match_operand:DFP 0 "register_operand" "=f")
4926 (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")]
4929 "fi<DFP:xde>tr\t%0,<FPINT:fpint_roundingmode>,%1,4"
4930 [(set_attr "op_type" "RRF")
4931 (set_attr "type" "fsimp<DFP:mode>")])
4934 (define_insn "rint<DFP:mode>2"
4935 [(set (match_operand:DFP 0 "register_operand" "=f")
4936 (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")]
4937 UNSPEC_FPINT_RINT))]
4939 "fi<DFP:xde>tr\t%0,0,%1,0"
4940 [(set_attr "op_type" "RRF")
4941 (set_attr "type" "fsimp<DFP:mode>")])
4944 ; Binary <-> Decimal floating point trunc patterns
4947 (define_insn "*trunc<BFP:mode><DFP_ALL:mode>2"
4948 [(set (reg:DFP_ALL FPR0_REGNUM)
4949 (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM)))
4950 (use (reg:SI GPR0_REGNUM))
4951 (clobber (reg:CC CC_REGNUM))
4952 (clobber (reg:SI GPR1_REGNUM))]
4956 (define_insn "*trunc<DFP_ALL:mode><BFP:mode>2"
4957 [(set (reg:BFP FPR0_REGNUM)
4958 (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM)))
4959 (use (reg:SI GPR0_REGNUM))
4960 (clobber (reg:CC CC_REGNUM))
4961 (clobber (reg:SI GPR1_REGNUM))]
4965 (define_expand "trunc<BFP:mode><DFP_ALL:mode>2"
4966 [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
4967 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4969 [(set (reg:DFP_ALL FPR0_REGNUM)
4970 (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM)))
4971 (use (reg:SI GPR0_REGNUM))
4972 (clobber (reg:CC CC_REGNUM))
4973 (clobber (reg:SI GPR1_REGNUM))])
4974 (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "")
4975 (reg:DFP_ALL FPR0_REGNUM))]
4977 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DFP_ALL:MODE>mode)"
4979 HOST_WIDE_INT flags;
4981 flags = (PFPO_CONVERT |
4982 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT |
4983 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT);
4985 operands[2] = GEN_INT (flags);
4988 (define_expand "trunc<DFP_ALL:mode><BFP:mode>2"
4989 [(set (reg:DFP_ALL FPR4_REGNUM)
4990 (match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
4991 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4993 [(set (reg:BFP FPR0_REGNUM) (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM)))
4994 (use (reg:SI GPR0_REGNUM))
4995 (clobber (reg:CC CC_REGNUM))
4996 (clobber (reg:SI GPR1_REGNUM))])
4997 (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))]
4999 && GET_MODE_SIZE (<DFP_ALL:MODE>mode) >= GET_MODE_SIZE (<BFP:MODE>mode)"
5001 HOST_WIDE_INT flags;
5003 flags = (PFPO_CONVERT |
5004 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT |
5005 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT);
5007 operands[2] = GEN_INT (flags);
5011 ; Binary <-> Decimal floating point extend patterns
5014 (define_insn "*extend<BFP:mode><DFP_ALL:mode>2"
5015 [(set (reg:DFP_ALL FPR0_REGNUM) (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM)))
5016 (use (reg:SI GPR0_REGNUM))
5017 (clobber (reg:CC CC_REGNUM))
5018 (clobber (reg:SI GPR1_REGNUM))]
5022 (define_insn "*extend<DFP_ALL:mode><BFP:mode>2"
5023 [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM)))
5024 (use (reg:SI GPR0_REGNUM))
5025 (clobber (reg:CC CC_REGNUM))
5026 (clobber (reg:SI GPR1_REGNUM))]
5030 (define_expand "extend<BFP:mode><DFP_ALL:mode>2"
5031 [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
5032 (set (reg:SI GPR0_REGNUM) (match_dup 2))
5034 [(set (reg:DFP_ALL FPR0_REGNUM)
5035 (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM)))
5036 (use (reg:SI GPR0_REGNUM))
5037 (clobber (reg:CC CC_REGNUM))
5038 (clobber (reg:SI GPR1_REGNUM))])
5039 (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "")
5040 (reg:DFP_ALL FPR0_REGNUM))]
5042 && GET_MODE_SIZE (<BFP:MODE>mode) <= GET_MODE_SIZE (<DFP_ALL:MODE>mode)"
5044 HOST_WIDE_INT flags;
5046 flags = (PFPO_CONVERT |
5047 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT |
5048 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT);
5050 operands[2] = GEN_INT (flags);
5053 (define_expand "extend<DFP_ALL:mode><BFP:mode>2"
5054 [(set (reg:DFP_ALL FPR4_REGNUM)
5055 (match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
5056 (set (reg:SI GPR0_REGNUM) (match_dup 2))
5058 [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM)))
5059 (use (reg:SI GPR0_REGNUM))
5060 (clobber (reg:CC CC_REGNUM))
5061 (clobber (reg:SI GPR1_REGNUM))])
5062 (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))]
5064 && GET_MODE_SIZE (<DFP_ALL:MODE>mode) < GET_MODE_SIZE (<BFP:MODE>mode)"
5066 HOST_WIDE_INT flags;
5068 flags = (PFPO_CONVERT |
5069 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT |
5070 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT);
5072 operands[2] = GEN_INT (flags);
5077 ;; ARITHMETIC OPERATIONS
5079 ; arithmetic operations set the ConditionCode,
5080 ; because of unpredictable Bits in Register for Halfword and Byte
5081 ; the ConditionCode can be set wrong in operations for Halfword and Byte
5084 ;;- Add instructions.
5088 ; addti3 instruction pattern(s).
5091 (define_expand "addti3"
5093 [(set (match_operand:TI 0 "register_operand" "")
5094 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "")
5095 (match_operand:TI 2 "general_operand" "") ) )
5096 (clobber (reg:CC CC_REGNUM))])]
5099 /* For z13 we have vaq which doesn't set CC. */
5102 emit_insn (gen_rtx_SET (operands[0],
5103 gen_rtx_PLUS (TImode,
5104 copy_to_mode_reg (TImode, operands[1]),
5105 copy_to_mode_reg (TImode, operands[2]))));
5110 (define_insn_and_split "*addti3"
5111 [(set (match_operand:TI 0 "register_operand" "=&d")
5112 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
5113 (match_operand:TI 2 "general_operand" "do") ) )
5114 (clobber (reg:CC CC_REGNUM))]
5117 "&& reload_completed"
5119 [(set (reg:CCL1 CC_REGNUM)
5120 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
5122 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
5124 [(set (match_dup 3) (plus:DI
5125 (plus:DI (ltu:DI (reg:CCL1 CC_REGNUM) (const_int 0))
5126 (match_dup 4)) (match_dup 5)))
5127 (clobber (reg:CC CC_REGNUM))])]
5128 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
5129 operands[4] = operand_subword (operands[1], 0, 0, TImode);
5130 operands[5] = operand_subword (operands[2], 0, 0, TImode);
5131 operands[6] = operand_subword (operands[0], 1, 0, TImode);
5132 operands[7] = operand_subword (operands[1], 1, 0, TImode);
5133 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
5134 [(set_attr "op_type" "*")
5135 (set_attr "cpu_facility" "*")])
5138 ; adddi3 instruction pattern(s).
5141 (define_expand "adddi3"
5143 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5144 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
5145 (match_operand:DI 2 "general_operand" "")))
5146 (clobber (reg:CC CC_REGNUM))])]
5150 (define_insn "*adddi3_sign"
5151 [(set (match_operand:DI 0 "register_operand" "=d,d")
5152 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5153 (match_operand:DI 1 "register_operand" "0,0")))
5154 (clobber (reg:CC CC_REGNUM))]
5159 [(set_attr "op_type" "RRE,RXY")
5160 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5162 (define_insn "*adddi3_zero_cc"
5163 [(set (reg CC_REGNUM)
5164 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5165 (match_operand:DI 1 "register_operand" "0,0"))
5167 (set (match_operand:DI 0 "register_operand" "=d,d")
5168 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
5169 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5173 [(set_attr "op_type" "RRE,RXY")
5174 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5176 (define_insn "*adddi3_zero_cconly"
5177 [(set (reg CC_REGNUM)
5178 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5179 (match_operand:DI 1 "register_operand" "0,0"))
5181 (clobber (match_scratch:DI 0 "=d,d"))]
5182 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5186 [(set_attr "op_type" "RRE,RXY")
5187 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5189 (define_insn "*adddi3_zero"
5190 [(set (match_operand:DI 0 "register_operand" "=d,d")
5191 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5192 (match_operand:DI 1 "register_operand" "0,0")))
5193 (clobber (reg:CC CC_REGNUM))]
5198 [(set_attr "op_type" "RRE,RXY")
5199 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5201 (define_insn_and_split "*adddi3_31z"
5202 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
5203 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5204 (match_operand:DI 2 "general_operand" "do") ) )
5205 (clobber (reg:CC CC_REGNUM))]
5206 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
5208 "&& reload_completed"
5210 [(set (reg:CCL1 CC_REGNUM)
5211 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
5213 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
5215 [(set (match_dup 3) (plus:SI
5216 (plus:SI (ltu:SI (reg:CCL1 CC_REGNUM) (const_int 0))
5217 (match_dup 4)) (match_dup 5)))
5218 (clobber (reg:CC CC_REGNUM))])]
5219 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5220 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5221 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5222 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5223 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5224 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
5226 (define_insn_and_split "*adddi3_31"
5227 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
5228 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5229 (match_operand:DI 2 "general_operand" "do") ) )
5230 (clobber (reg:CC CC_REGNUM))]
5233 "&& reload_completed"
5235 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
5236 (clobber (reg:CC CC_REGNUM))])
5238 [(set (reg:CCL1 CC_REGNUM)
5239 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
5241 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
5243 (if_then_else (ltu (reg:CCL1 CC_REGNUM) (const_int 0))
5245 (label_ref (match_dup 9))))
5247 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
5248 (clobber (reg:CC CC_REGNUM))])
5250 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5251 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5252 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5253 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5254 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5255 operands[8] = operand_subword (operands[2], 1, 0, DImode);
5256 operands[9] = gen_label_rtx ();")
5259 ; addsi3 instruction pattern(s).
5262 (define_expand "addsi3"
5264 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5265 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "")
5266 (match_operand:SI 2 "general_operand" "")))
5267 (clobber (reg:CC CC_REGNUM))])]
5271 (define_insn "*addsi3_sign"
5272 [(set (match_operand:SI 0 "register_operand" "=d,d")
5273 (plus:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
5274 (match_operand:SI 1 "register_operand" "0,0")))
5275 (clobber (reg:CC CC_REGNUM))]
5280 [(set_attr "op_type" "RX,RXY")
5281 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5284 ; add(di|si)3 instruction pattern(s).
5287 ; ark, agrk, ar, ahi, ahik, aghik, alfi, slfi, a, ay, agr, aghi, algfi, slgfi, ag, asi, agsi
5288 (define_insn "*add<mode>3"
5289 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d,d,d, d, d,d,d,QS")
5290 (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,d, 0, 0,0,0, 0")
5291 (match_operand:GPR 2 "general_operand" " d,d,K,K,Op,On,R,T, C") ) )
5292 (clobber (reg:CC CC_REGNUM))]
5304 [(set_attr "op_type" "RR<E>,RRF,RI,RIE,RIL,RIL,RX<Y>,RXY,SIY")
5305 (set_attr "cpu_facility" "*,z196,*,z196,extimm,extimm,*,*,z10")
5306 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,z10_super_E1,z10_super_E1,
5307 z10_super_E1,z10_super_E1,z10_super_E1")])
5309 ; alr, alfi, slfi, al, aly, alrk, alhsik, algr, algfi, slgfi, alg, alsi, algsi, algrk, alghsik
5310 (define_insn "*add<mode>3_carry1_cc"
5311 [(set (reg CC_REGNUM)
5312 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0,0")
5313 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T,C"))
5315 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,d")
5316 (plus:GPR (match_dup 1) (match_dup 2)))]
5317 "s390_match_ccmode (insn, CCL1mode)"
5323 al<g>hsik\t%0,%1,%h2
5327 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5328 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5329 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*,
5330 z10_super_E1,z10_super_E1,z10_super_E1")])
5332 ; alr, al, aly, algr, alg, alrk, algrk
5333 (define_insn "*add<mode>3_carry1_cconly"
5334 [(set (reg CC_REGNUM)
5335 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5336 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5338 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5339 "s390_match_ccmode (insn, CCL1mode)"
5345 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5346 (set_attr "cpu_facility" "*,z196,*,*")
5347 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5349 ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik
5350 (define_insn "*add<mode>3_carry2_cc"
5351 [(set (reg CC_REGNUM)
5352 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0, 0")
5353 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T, C"))
5355 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,RS")
5356 (plus:GPR (match_dup 1) (match_dup 2)))]
5357 "s390_match_ccmode (insn, CCL1mode)"
5363 al<g>hsik\t%0,%1,%h2
5367 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5368 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5369 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*,
5370 z10_super_E1,z10_super_E1,z10_super_E1")])
5372 ; alr, al, aly, algr, alg, alrk, algrk
5373 (define_insn "*add<mode>3_carry2_cconly"
5374 [(set (reg CC_REGNUM)
5375 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5376 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5378 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5379 "s390_match_ccmode (insn, CCL1mode)"
5385 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5386 (set_attr "cpu_facility" "*,z196,*,*")
5387 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5389 ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik
5390 (define_insn "*add<mode>3_cc"
5391 [(set (reg CC_REGNUM)
5392 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0, 0")
5393 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T, C"))
5395 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,RS")
5396 (plus:GPR (match_dup 1) (match_dup 2)))]
5397 "s390_match_ccmode (insn, CCLmode)"
5403 al<g>hsik\t%0,%1,%h2
5407 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5408 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5409 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,
5410 *,z10_super_E1,z10_super_E1,z10_super_E1")])
5412 ; alr, al, aly, algr, alg, alrk, algrk
5413 (define_insn "*add<mode>3_cconly"
5414 [(set (reg CC_REGNUM)
5415 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5416 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5418 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5419 "s390_match_ccmode (insn, CCLmode)"
5425 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5426 (set_attr "cpu_facility" "*,z196,*,*")
5427 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5429 ; alr, al, aly, algr, alg, alrk, algrk
5430 (define_insn "*add<mode>3_cconly2"
5431 [(set (reg CC_REGNUM)
5432 (compare (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5433 (neg:GPR (match_operand:GPR 2 "general_operand" "d,d,R,T"))))
5434 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5435 "s390_match_ccmode(insn, CCLmode)"
5441 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5442 (set_attr "cpu_facility" "*,z196,*,*")
5443 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5445 ; ahi, afi, aghi, agfi, asi, agsi
5446 (define_insn "*add<mode>3_imm_cc"
5447 [(set (reg CC_REGNUM)
5448 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" " 0, d,0, 0")
5449 (match_operand:GPR 2 "const_int_operand" " K, K,Os, C"))
5451 (set (match_operand:GPR 0 "nonimmediate_operand" "=d, d,d,QS")
5452 (plus:GPR (match_dup 1) (match_dup 2)))]
5453 "s390_match_ccmode (insn, CCAmode)
5454 && (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")
5455 || (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'O', \"Os\")
5456 /* Avoid INT32_MIN on 32 bit. */
5457 && (!TARGET_ZARCH || INTVAL (operands[2]) != -0x7fffffff - 1)))"
5463 [(set_attr "op_type" "RI,RIE,RIL,SIY")
5464 (set_attr "cpu_facility" "*,z196,extimm,z10")
5465 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5468 ; add(tf|df|sf|td|dd)3 instruction pattern(s).
5471 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5472 ; FIXME: wfadb does not clobber cc
5473 (define_insn "add<mode>3"
5474 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
5475 (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>, 0,<v0>")
5476 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))
5477 (clobber (reg:CC CC_REGNUM))]
5480 a<xde><bt>r\t%0,<op1>%2
5483 [(set_attr "op_type" "<RRer>,RXE,VRR")
5484 (set_attr "type" "fsimp<mode>")
5485 (set_attr "cpu_facility" "*,*,vec")])
5487 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5488 (define_insn "*add<mode>3_cc"
5489 [(set (reg CC_REGNUM)
5490 (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
5491 (match_operand:FP 2 "general_operand" " f,<Rf>"))
5492 (match_operand:FP 3 "const0_operand" "")))
5493 (set (match_operand:FP 0 "register_operand" "=f,f")
5494 (plus:FP (match_dup 1) (match_dup 2)))]
5495 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5497 a<xde><bt>r\t%0,<op1>%2
5499 [(set_attr "op_type" "<RRer>,RXE")
5500 (set_attr "type" "fsimp<mode>")])
5502 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5503 (define_insn "*add<mode>3_cconly"
5504 [(set (reg CC_REGNUM)
5505 (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
5506 (match_operand:FP 2 "general_operand" " f,<Rf>"))
5507 (match_operand:FP 3 "const0_operand" "")))
5508 (clobber (match_scratch:FP 0 "=f,f"))]
5509 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5511 a<xde><bt>r\t%0,<op1>%2
5513 [(set_attr "op_type" "<RRer>,RXE")
5514 (set_attr "type" "fsimp<mode>")])
5517 ; Pointer add instruction patterns
5520 ; This will match "*la_64"
5521 (define_expand "addptrdi3"
5522 [(set (match_operand:DI 0 "register_operand" "")
5523 (plus:DI (match_operand:DI 1 "register_operand" "")
5524 (match_operand:DI 2 "nonmemory_operand" "")))]
5527 if (GET_CODE (operands[2]) == CONST_INT)
5529 HOST_WIDE_INT c = INTVAL (operands[2]);
5531 if (!CONST_OK_FOR_CONSTRAINT_P (c, 'K', "K")
5532 && !CONST_OK_FOR_CONSTRAINT_P (c, 'O', "Os"))
5534 operands[2] = force_const_mem (DImode, operands[2]);
5535 operands[2] = force_reg (DImode, operands[2]);
5537 else if (!DISP_IN_RANGE (INTVAL (operands[2])))
5538 operands[2] = force_reg (DImode, operands[2]);
5542 ; For 31 bit we have to prevent the generated pattern from matching
5543 ; normal ADDs since la only does a 31 bit add. This is supposed to
5544 ; match "force_la_31".
5545 (define_expand "addptrsi3"
5547 [(set (match_operand:SI 0 "register_operand" "")
5548 (plus:SI (match_operand:SI 1 "register_operand" "")
5549 (match_operand:SI 2 "nonmemory_operand" "")))
5550 (use (const_int 0))])]
5553 if (GET_CODE (operands[2]) == CONST_INT)
5555 HOST_WIDE_INT c = INTVAL (operands[2]);
5557 if (!CONST_OK_FOR_CONSTRAINT_P (c, 'K', "K")
5558 && !CONST_OK_FOR_CONSTRAINT_P (c, 'O', "Os"))
5560 operands[2] = force_const_mem (SImode, operands[2]);
5561 operands[2] = force_reg (SImode, operands[2]);
5563 else if (!DISP_IN_RANGE (INTVAL (operands[2])))
5564 operands[2] = force_reg (SImode, operands[2]);
5569 ;;- Subtract instructions.
5573 ; subti3 instruction pattern(s).
5576 (define_expand "subti3"
5578 [(set (match_operand:TI 0 "register_operand" "")
5579 (minus:TI (match_operand:TI 1 "register_operand" "")
5580 (match_operand:TI 2 "general_operand" "") ) )
5581 (clobber (reg:CC CC_REGNUM))])]
5584 /* For z13 we have vaq which doesn't set CC. */
5587 emit_insn (gen_rtx_SET (operands[0],
5588 gen_rtx_MINUS (TImode,
5590 copy_to_mode_reg (TImode, operands[2]))));
5595 (define_insn_and_split "*subti3"
5596 [(set (match_operand:TI 0 "register_operand" "=&d")
5597 (minus:TI (match_operand:TI 1 "register_operand" "0")
5598 (match_operand:TI 2 "general_operand" "do") ) )
5599 (clobber (reg:CC CC_REGNUM))]
5602 "&& reload_completed"
5604 [(set (reg:CCL2 CC_REGNUM)
5605 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
5607 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
5609 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
5610 (gtu:DI (reg:CCL2 CC_REGNUM) (const_int 0))))
5611 (clobber (reg:CC CC_REGNUM))])]
5612 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
5613 operands[4] = operand_subword (operands[1], 0, 0, TImode);
5614 operands[5] = operand_subword (operands[2], 0, 0, TImode);
5615 operands[6] = operand_subword (operands[0], 1, 0, TImode);
5616 operands[7] = operand_subword (operands[1], 1, 0, TImode);
5617 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
5618 [(set_attr "op_type" "*")
5619 (set_attr "cpu_facility" "*")])
5622 ; subdi3 instruction pattern(s).
5625 (define_expand "subdi3"
5627 [(set (match_operand:DI 0 "register_operand" "")
5628 (minus:DI (match_operand:DI 1 "register_operand" "")
5629 (match_operand:DI 2 "general_operand" "")))
5630 (clobber (reg:CC CC_REGNUM))])]
5634 (define_insn "*subdi3_sign"
5635 [(set (match_operand:DI 0 "register_operand" "=d,d")
5636 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5637 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))))
5638 (clobber (reg:CC CC_REGNUM))]
5643 [(set_attr "op_type" "RRE,RXY")
5644 (set_attr "z10prop" "z10_c,*")
5645 (set_attr "z196prop" "z196_cracked")])
5647 (define_insn "*subdi3_zero_cc"
5648 [(set (reg CC_REGNUM)
5649 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5650 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT")))
5652 (set (match_operand:DI 0 "register_operand" "=d,d")
5653 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
5654 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5658 [(set_attr "op_type" "RRE,RXY")
5659 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5661 (define_insn "*subdi3_zero_cconly"
5662 [(set (reg CC_REGNUM)
5663 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5664 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT")))
5666 (clobber (match_scratch:DI 0 "=d,d"))]
5667 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5671 [(set_attr "op_type" "RRE,RXY")
5672 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5674 (define_insn "*subdi3_zero"
5675 [(set (match_operand:DI 0 "register_operand" "=d,d")
5676 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5677 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))))
5678 (clobber (reg:CC CC_REGNUM))]
5683 [(set_attr "op_type" "RRE,RXY")
5684 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5686 (define_insn_and_split "*subdi3_31z"
5687 [(set (match_operand:DI 0 "register_operand" "=&d")
5688 (minus:DI (match_operand:DI 1 "register_operand" "0")
5689 (match_operand:DI 2 "general_operand" "do") ) )
5690 (clobber (reg:CC CC_REGNUM))]
5691 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
5693 "&& reload_completed"
5695 [(set (reg:CCL2 CC_REGNUM)
5696 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
5698 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
5700 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
5701 (gtu:SI (reg:CCL2 CC_REGNUM) (const_int 0))))
5702 (clobber (reg:CC CC_REGNUM))])]
5703 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5704 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5705 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5706 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5707 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5708 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
5710 (define_insn_and_split "*subdi3_31"
5711 [(set (match_operand:DI 0 "register_operand" "=&d")
5712 (minus:DI (match_operand:DI 1 "register_operand" "0")
5713 (match_operand:DI 2 "general_operand" "do") ) )
5714 (clobber (reg:CC CC_REGNUM))]
5717 "&& reload_completed"
5719 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
5720 (clobber (reg:CC CC_REGNUM))])
5722 [(set (reg:CCL2 CC_REGNUM)
5723 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
5725 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
5727 (if_then_else (gtu (reg:CCL2 CC_REGNUM) (const_int 0))
5729 (label_ref (match_dup 9))))
5731 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
5732 (clobber (reg:CC CC_REGNUM))])
5734 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5735 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5736 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5737 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5738 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5739 operands[8] = operand_subword (operands[2], 1, 0, DImode);
5740 operands[9] = gen_label_rtx ();")
5743 ; subsi3 instruction pattern(s).
5746 (define_expand "subsi3"
5748 [(set (match_operand:SI 0 "register_operand" "")
5749 (minus:SI (match_operand:SI 1 "register_operand" "")
5750 (match_operand:SI 2 "general_operand" "")))
5751 (clobber (reg:CC CC_REGNUM))])]
5755 (define_insn "*subsi3_sign"
5756 [(set (match_operand:SI 0 "register_operand" "=d,d")
5757 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
5758 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
5759 (clobber (reg:CC CC_REGNUM))]
5764 [(set_attr "op_type" "RX,RXY")
5765 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5768 ; sub(di|si)3 instruction pattern(s).
5771 ; sr, s, sy, sgr, sg, srk, sgrk
5772 (define_insn "*sub<mode>3"
5773 [(set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5774 (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5775 (match_operand:GPR 2 "general_operand" "d,d,R,T") ) )
5776 (clobber (reg:CC CC_REGNUM))]
5783 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5784 (set_attr "cpu_facility" "*,z196,*,*")
5785 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5787 ; slr, sl, sly, slgr, slg, slrk, slgrk
5788 (define_insn "*sub<mode>3_borrow_cc"
5789 [(set (reg CC_REGNUM)
5790 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5791 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5793 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5794 (minus:GPR (match_dup 1) (match_dup 2)))]
5795 "s390_match_ccmode (insn, CCL2mode)"
5801 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5802 (set_attr "cpu_facility" "*,z196,*,*")
5803 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5805 ; slr, sl, sly, slgr, slg, slrk, slgrk
5806 (define_insn "*sub<mode>3_borrow_cconly"
5807 [(set (reg CC_REGNUM)
5808 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5809 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5811 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5812 "s390_match_ccmode (insn, CCL2mode)"
5818 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5819 (set_attr "cpu_facility" "*,z196,*,*")
5820 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5822 ; slr, sl, sly, slgr, slg, slrk, slgrk
5823 (define_insn "*sub<mode>3_cc"
5824 [(set (reg CC_REGNUM)
5825 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5826 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5828 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5829 (minus:GPR (match_dup 1) (match_dup 2)))]
5830 "s390_match_ccmode (insn, CCLmode)"
5836 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5837 (set_attr "cpu_facility" "*,z196,*,*")
5838 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5840 ; slr, sl, sly, slgr, slg, slrk, slgrk
5841 (define_insn "*sub<mode>3_cc2"
5842 [(set (reg CC_REGNUM)
5843 (compare (match_operand:GPR 1 "register_operand" "0,d,0,0")
5844 (match_operand:GPR 2 "general_operand" "d,d,R,T")))
5845 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5846 (minus:GPR (match_dup 1) (match_dup 2)))]
5847 "s390_match_ccmode (insn, CCL3mode)"
5853 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5854 (set_attr "cpu_facility" "*,z196,*,*")
5855 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5857 ; slr, sl, sly, slgr, slg, slrk, slgrk
5858 (define_insn "*sub<mode>3_cconly"
5859 [(set (reg CC_REGNUM)
5860 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5861 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5863 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5864 "s390_match_ccmode (insn, CCLmode)"
5870 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5871 (set_attr "cpu_facility" "*,z196,*,*")
5872 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5875 ; slr, sl, sly, slgr, slg, slrk, slgrk
5876 (define_insn "*sub<mode>3_cconly2"
5877 [(set (reg CC_REGNUM)
5878 (compare (match_operand:GPR 1 "register_operand" "0,d,0,0")
5879 (match_operand:GPR 2 "general_operand" "d,d,R,T")))
5880 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5881 "s390_match_ccmode (insn, CCL3mode)"
5887 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5888 (set_attr "cpu_facility" "*,z196,*,*")
5889 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5893 ; sub(tf|df|sf|td|dd)3 instruction pattern(s).
5896 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5897 (define_insn "sub<mode>3"
5898 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
5899 (minus:FP (match_operand:FP 1 "register_operand" "<f0>, 0,<v0>")
5900 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))
5901 (clobber (reg:CC CC_REGNUM))]
5904 s<xde><bt>r\t%0,<op1>%2
5907 [(set_attr "op_type" "<RRer>,RXE,VRR")
5908 (set_attr "type" "fsimp<mode>")
5909 (set_attr "cpu_facility" "*,*,vec")])
5911 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5912 (define_insn "*sub<mode>3_cc"
5913 [(set (reg CC_REGNUM)
5914 (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "<f0>,0")
5915 (match_operand:FP 2 "general_operand" "f,<Rf>"))
5916 (match_operand:FP 3 "const0_operand" "")))
5917 (set (match_operand:FP 0 "register_operand" "=f,f")
5918 (minus:FP (match_dup 1) (match_dup 2)))]
5919 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5921 s<xde><bt>r\t%0,<op1>%2
5923 [(set_attr "op_type" "<RRer>,RXE")
5924 (set_attr "type" "fsimp<mode>")])
5926 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5927 (define_insn "*sub<mode>3_cconly"
5928 [(set (reg CC_REGNUM)
5929 (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "<f0>,0")
5930 (match_operand:FP 2 "general_operand" "f,<Rf>"))
5931 (match_operand:FP 3 "const0_operand" "")))
5932 (clobber (match_scratch:FP 0 "=f,f"))]
5933 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5935 s<xde><bt>r\t%0,<op1>%2
5937 [(set_attr "op_type" "<RRer>,RXE")
5938 (set_attr "type" "fsimp<mode>")])
5942 ;;- Conditional add/subtract instructions.
5946 ; add(di|si)cc instruction pattern(s).
5949 ; the following 4 patterns are used when the result of an add with
5950 ; carry is checked for an overflow condition
5952 ; op1 + op2 + c < op1
5954 ; alcr, alc, alcgr, alcg
5955 (define_insn "*add<mode>3_alc_carry1_cc"
5956 [(set (reg CC_REGNUM)
5958 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5959 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5960 (match_operand:GPR 2 "general_operand" "d,RT"))
5962 (set (match_operand:GPR 0 "register_operand" "=d,d")
5963 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5964 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5968 [(set_attr "op_type" "RRE,RXY")
5969 (set_attr "z196prop" "z196_alone,z196_alone")])
5971 ; alcr, alc, alcgr, alcg
5972 (define_insn "*add<mode>3_alc_carry1_cconly"
5973 [(set (reg CC_REGNUM)
5975 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5976 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5977 (match_operand:GPR 2 "general_operand" "d,RT"))
5979 (clobber (match_scratch:GPR 0 "=d,d"))]
5980 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5984 [(set_attr "op_type" "RRE,RXY")
5985 (set_attr "z196prop" "z196_alone,z196_alone")])
5987 ; op1 + op2 + c < op2
5989 ; alcr, alc, alcgr, alcg
5990 (define_insn "*add<mode>3_alc_carry2_cc"
5991 [(set (reg CC_REGNUM)
5993 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5994 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5995 (match_operand:GPR 2 "general_operand" "d,RT"))
5997 (set (match_operand:GPR 0 "register_operand" "=d,d")
5998 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5999 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
6003 [(set_attr "op_type" "RRE,RXY")])
6005 ; alcr, alc, alcgr, alcg
6006 (define_insn "*add<mode>3_alc_carry2_cconly"
6007 [(set (reg CC_REGNUM)
6009 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
6010 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
6011 (match_operand:GPR 2 "general_operand" "d,RT"))
6013 (clobber (match_scratch:GPR 0 "=d,d"))]
6014 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
6018 [(set_attr "op_type" "RRE,RXY")])
6020 ; alcr, alc, alcgr, alcg
6021 (define_insn "*add<mode>3_alc_cc"
6022 [(set (reg CC_REGNUM)
6024 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
6025 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
6026 (match_operand:GPR 2 "general_operand" "d,RT"))
6028 (set (match_operand:GPR 0 "register_operand" "=d,d")
6029 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
6030 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
6034 [(set_attr "op_type" "RRE,RXY")])
6036 ; alcr, alc, alcgr, alcg
6037 (define_insn "*add<mode>3_alc"
6038 [(set (match_operand:GPR 0 "register_operand" "=d,d")
6039 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
6040 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
6041 (match_operand:GPR 2 "general_operand" "d,RT")))
6042 (clobber (reg:CC CC_REGNUM))]
6047 [(set_attr "op_type" "RRE,RXY")])
6049 ; slbr, slb, slbgr, slbg
6050 (define_insn "*sub<mode>3_slb_cc"
6051 [(set (reg CC_REGNUM)
6053 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
6054 (match_operand:GPR 2 "general_operand" "d,RT"))
6055 (match_operand:GPR 3 "s390_slb_comparison" ""))
6057 (set (match_operand:GPR 0 "register_operand" "=d,d")
6058 (minus:GPR (minus:GPR (match_dup 1) (match_dup 2)) (match_dup 3)))]
6059 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
6063 [(set_attr "op_type" "RRE,RXY")
6064 (set_attr "z10prop" "z10_c,*")])
6066 ; slbr, slb, slbgr, slbg
6067 (define_insn "*sub<mode>3_slb"
6068 [(set (match_operand:GPR 0 "register_operand" "=d,d")
6069 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
6070 (match_operand:GPR 2 "general_operand" "d,RT"))
6071 (match_operand:GPR 3 "s390_slb_comparison" "")))
6072 (clobber (reg:CC CC_REGNUM))]
6077 [(set_attr "op_type" "RRE,RXY")
6078 (set_attr "z10prop" "z10_c,*")])
6080 (define_expand "add<mode>cc"
6081 [(match_operand:GPR 0 "register_operand" "")
6082 (match_operand 1 "comparison_operator" "")
6083 (match_operand:GPR 2 "register_operand" "")
6084 (match_operand:GPR 3 "const_int_operand" "")]
6086 "if (!s390_expand_addcc (GET_CODE (operands[1]),
6087 XEXP (operands[1], 0), XEXP (operands[1], 1),
6088 operands[0], operands[2],
6089 operands[3])) FAIL; DONE;")
6092 ; scond instruction pattern(s).
6095 (define_insn_and_split "*scond<mode>"
6096 [(set (match_operand:GPR 0 "register_operand" "=&d")
6097 (match_operand:GPR 1 "s390_alc_comparison" ""))
6098 (clobber (reg:CC CC_REGNUM))]
6101 "&& reload_completed"
6102 [(set (match_dup 0) (const_int 0))
6104 [(set (match_dup 0) (plus:GPR (plus:GPR (match_dup 1) (match_dup 0))
6106 (clobber (reg:CC CC_REGNUM))])]
6109 (define_insn_and_split "*scond<mode>_neg"
6110 [(set (match_operand:GPR 0 "register_operand" "=&d")
6111 (match_operand:GPR 1 "s390_slb_comparison" ""))
6112 (clobber (reg:CC CC_REGNUM))]
6115 "&& reload_completed"
6116 [(set (match_dup 0) (const_int 0))
6118 [(set (match_dup 0) (minus:GPR (minus:GPR (match_dup 0) (match_dup 0))
6120 (clobber (reg:CC CC_REGNUM))])
6122 [(set (match_dup 0) (neg:GPR (match_dup 0)))
6123 (clobber (reg:CC CC_REGNUM))])]
6127 (define_expand "cstore<mode>4"
6128 [(set (match_operand:SI 0 "register_operand" "")
6129 (match_operator:SI 1 "s390_scond_operator"
6130 [(match_operand:GPR 2 "register_operand" "")
6131 (match_operand:GPR 3 "general_operand" "")]))]
6133 "if (!s390_expand_addcc (GET_CODE (operands[1]), operands[2], operands[3],
6134 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
6136 (define_expand "cstorecc4"
6138 [(set (match_operand:SI 0 "register_operand" "")
6139 (match_operator:SI 1 "s390_eqne_operator"
6140 [(match_operand:CCZ1 2 "register_operand")
6141 (match_operand 3 "const0_operand")]))
6142 (clobber (reg:CC CC_REGNUM))])]
6144 "emit_insn (gen_sne (operands[0], operands[2]));
6145 if (GET_CODE (operands[1]) == EQ)
6146 emit_insn (gen_xorsi3 (operands[0], operands[0], const1_rtx));
6149 (define_insn_and_split "sne"
6150 [(set (match_operand:SI 0 "register_operand" "=d")
6151 (ne:SI (match_operand:CCZ1 1 "register_operand" "0")
6153 (clobber (reg:CC CC_REGNUM))]
6158 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 28)))
6159 (clobber (reg:CC CC_REGNUM))])])
6163 ;; - Conditional move instructions (introduced with z196)
6166 (define_expand "mov<mode>cc"
6167 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
6168 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6169 (match_operand:GPR 2 "nonimmediate_operand" "")
6170 (match_operand:GPR 3 "nonimmediate_operand" "")))]
6173 /* Emit the comparison insn in case we do not already have a comparison result. */
6174 if (!s390_comparison (operands[1], VOIDmode))
6175 operands[1] = s390_emit_compare (GET_CODE (operands[1]),
6176 XEXP (operands[1], 0),
6177 XEXP (operands[1], 1));
6180 ; locr, loc, stoc, locgr, locg, stocg
6181 (define_insn_and_split "*mov<mode>cc"
6182 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,QS,QS,&d")
6184 (match_operator 1 "s390_comparison"
6185 [(match_operand 2 "cc_reg_operand" " c,c, c, c, c, c, c")
6186 (match_operand 5 "const_int_operand" "")])
6187 (match_operand:GPR 3 "nonimmediate_operand" " d,0,QS, 0, d, 0,QS")
6188 (match_operand:GPR 4 "nonimmediate_operand" " 0,d, 0,QS, 0, d,QS")))]
6198 "&& reload_completed
6199 && MEM_P (operands[3]) && MEM_P (operands[4])"
6202 (match_op_dup 1 [(match_dup 2) (const_int 0)])
6207 (match_op_dup 1 [(match_dup 2) (const_int 0)])
6211 [(set_attr "op_type" "RRF,RRF,RSY,RSY,RSY,RSY,*")])
6214 ;;- Multiply instructions.
6218 ; muldi3 instruction pattern(s).
6221 (define_insn "*muldi3_sign"
6222 [(set (match_operand:DI 0 "register_operand" "=d,d")
6223 (mult:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
6224 (match_operand:DI 1 "register_operand" "0,0")))]
6229 [(set_attr "op_type" "RRE,RXY")
6230 (set_attr "type" "imuldi")])
6232 (define_insn "muldi3"
6233 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d")
6234 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
6235 (match_operand:DI 2 "general_operand" "d,K,RT,Os")))]
6242 [(set_attr "op_type" "RRE,RI,RXY,RIL")
6243 (set_attr "type" "imuldi")
6244 (set_attr "cpu_facility" "*,*,*,z10")])
6247 ; mulsi3 instruction pattern(s).
6250 (define_insn "*mulsi3_sign"
6251 [(set (match_operand:SI 0 "register_operand" "=d,d")
6252 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
6253 (match_operand:SI 1 "register_operand" "0,0")))]
6258 [(set_attr "op_type" "RX,RXY")
6259 (set_attr "type" "imulhi")
6260 (set_attr "cpu_facility" "*,z10")])
6262 (define_insn "mulsi3"
6263 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
6264 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0")
6265 (match_operand:SI 2 "general_operand" "d,K,R,T,Os")))]
6273 [(set_attr "op_type" "RRE,RI,RX,RXY,RIL")
6274 (set_attr "type" "imulsi,imulhi,imulsi,imulsi,imulsi")
6275 (set_attr "cpu_facility" "*,*,*,*,z10")])
6278 ; mulsidi3 instruction pattern(s).
6281 (define_insn "mulsidi3"
6282 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
6283 (mult:DI (sign_extend:DI
6284 (match_operand:SI 1 "register_operand" "%0,0,0"))
6286 (match_operand:SI 2 "nonimmediate_operand" "d,R,T"))))]
6292 [(set_attr "op_type" "RR,RX,RXY")
6293 (set_attr "type" "imulsi")
6294 (set_attr "cpu_facility" "*,*,z10")])
6297 ; umul instruction pattern(s).
6300 ; mlr, ml, mlgr, mlg
6301 (define_insn "umul<dwh><mode>3"
6302 [(set (match_operand:DW 0 "register_operand" "=d, d")
6303 (mult:DW (zero_extend:DW
6304 (match_operand:<DWH> 1 "register_operand" "%0, 0"))
6306 (match_operand:<DWH> 2 "nonimmediate_operand" " d,RT"))))]
6311 [(set_attr "op_type" "RRE,RXY")
6312 (set_attr "type" "imul<dwh>")])
6315 ; mul(tf|df|sf|td|dd)3 instruction pattern(s).
6318 ; mxbr, mdbr, meebr, mxb, mxb, meeb, mdtr, mxtr
6319 (define_insn "mul<mode>3"
6320 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
6321 (mult:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>, 0,<v0>")
6322 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))]
6325 m<xdee><bt>r\t%0,<op1>%2
6328 [(set_attr "op_type" "<RRer>,RXE,VRR")
6329 (set_attr "type" "fmul<mode>")
6330 (set_attr "cpu_facility" "*,*,vec")])
6332 ; madbr, maebr, maxb, madb, maeb
6333 (define_insn "fma<mode>4"
6334 [(set (match_operand:DSF 0 "register_operand" "=f,f,<vf>")
6335 (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,<vf>")
6336 (match_operand:DSF 2 "nonimmediate_operand" "f,R,<vf>")
6337 (match_operand:DSF 3 "register_operand" "0,0,<v0>")))]
6342 wfmadb\t%v0,%v1,%v2,%v3"
6343 [(set_attr "op_type" "RRE,RXE,VRR")
6344 (set_attr "type" "fmadd<mode>")
6345 (set_attr "cpu_facility" "*,*,vec")])
6347 ; msxbr, msdbr, msebr, msxb, msdb, mseb
6348 (define_insn "fms<mode>4"
6349 [(set (match_operand:DSF 0 "register_operand" "=f,f,<vf>")
6350 (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,<vf>")
6351 (match_operand:DSF 2 "nonimmediate_operand" "f,R,<vf>")
6352 (neg:DSF (match_operand:DSF 3 "register_operand" "0,0,<v0>"))))]
6357 wfmsdb\t%v0,%v1,%v2,%v3"
6358 [(set_attr "op_type" "RRE,RXE,VRR")
6359 (set_attr "type" "fmadd<mode>")
6360 (set_attr "cpu_facility" "*,*,vec")])
6363 ;;- Divide and modulo instructions.
6367 ; divmoddi4 instruction pattern(s).
6370 (define_expand "divmoddi4"
6371 [(parallel [(set (match_operand:DI 0 "general_operand" "")
6372 (div:DI (match_operand:DI 1 "register_operand" "")
6373 (match_operand:DI 2 "general_operand" "")))
6374 (set (match_operand:DI 3 "general_operand" "")
6375 (mod:DI (match_dup 1) (match_dup 2)))])
6376 (clobber (match_dup 4))]
6379 rtx insn, div_equal, mod_equal;
6381 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
6382 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
6384 operands[4] = gen_reg_rtx(TImode);
6385 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
6387 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
6388 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6390 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
6391 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6396 (define_insn "divmodtidi3"
6397 [(set (match_operand:TI 0 "register_operand" "=d,d")
6401 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6402 (match_operand:DI 2 "general_operand" "d,RT")))
6404 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
6409 [(set_attr "op_type" "RRE,RXY")
6410 (set_attr "type" "idiv")])
6412 (define_insn "divmodtisi3"
6413 [(set (match_operand:TI 0 "register_operand" "=d,d")
6417 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6419 (match_operand:SI 2 "nonimmediate_operand" "d,RT"))))
6422 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
6427 [(set_attr "op_type" "RRE,RXY")
6428 (set_attr "type" "idiv")])
6431 ; udivmoddi4 instruction pattern(s).
6434 (define_expand "udivmoddi4"
6435 [(parallel [(set (match_operand:DI 0 "general_operand" "")
6436 (udiv:DI (match_operand:DI 1 "general_operand" "")
6437 (match_operand:DI 2 "nonimmediate_operand" "")))
6438 (set (match_operand:DI 3 "general_operand" "")
6439 (umod:DI (match_dup 1) (match_dup 2)))])
6440 (clobber (match_dup 4))]
6443 rtx insn, div_equal, mod_equal, equal;
6445 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
6446 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
6447 equal = gen_rtx_IOR (TImode,
6448 gen_rtx_ASHIFT (TImode,
6449 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
6451 gen_rtx_ZERO_EXTEND (TImode, div_equal));
6453 operands[4] = gen_reg_rtx(TImode);
6454 emit_clobber (operands[4]);
6455 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
6456 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
6458 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
6459 set_unique_reg_note (insn, REG_EQUAL, equal);
6461 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
6462 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6464 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
6465 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6470 (define_insn "udivmodtidi3"
6471 [(set (match_operand:TI 0 "register_operand" "=d,d")
6476 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
6478 (match_operand:DI 2 "nonimmediate_operand" "d,RT")))))
6482 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
6487 [(set_attr "op_type" "RRE,RXY")
6488 (set_attr "type" "idiv")])
6491 ; divmodsi4 instruction pattern(s).
6494 (define_expand "divmodsi4"
6495 [(parallel [(set (match_operand:SI 0 "general_operand" "")
6496 (div:SI (match_operand:SI 1 "general_operand" "")
6497 (match_operand:SI 2 "nonimmediate_operand" "")))
6498 (set (match_operand:SI 3 "general_operand" "")
6499 (mod:SI (match_dup 1) (match_dup 2)))])
6500 (clobber (match_dup 4))]
6503 rtx insn, div_equal, mod_equal, equal;
6505 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
6506 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
6507 equal = gen_rtx_IOR (DImode,
6508 gen_rtx_ASHIFT (DImode,
6509 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
6511 gen_rtx_ZERO_EXTEND (DImode, div_equal));
6513 operands[4] = gen_reg_rtx(DImode);
6514 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
6516 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
6517 set_unique_reg_note (insn, REG_EQUAL, equal);
6519 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
6520 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6522 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
6523 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6528 (define_insn "divmoddisi3"
6529 [(set (match_operand:DI 0 "register_operand" "=d,d")
6534 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6536 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
6540 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
6545 [(set_attr "op_type" "RR,RX")
6546 (set_attr "type" "idiv")])
6549 ; udivsi3 and umodsi3 instruction pattern(s).
6552 (define_expand "udivmodsi4"
6553 [(parallel [(set (match_operand:SI 0 "general_operand" "")
6554 (udiv:SI (match_operand:SI 1 "general_operand" "")
6555 (match_operand:SI 2 "nonimmediate_operand" "")))
6556 (set (match_operand:SI 3 "general_operand" "")
6557 (umod:SI (match_dup 1) (match_dup 2)))])
6558 (clobber (match_dup 4))]
6559 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
6561 rtx insn, div_equal, mod_equal, equal;
6563 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6564 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6565 equal = gen_rtx_IOR (DImode,
6566 gen_rtx_ASHIFT (DImode,
6567 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
6569 gen_rtx_ZERO_EXTEND (DImode, div_equal));
6571 operands[4] = gen_reg_rtx(DImode);
6572 emit_clobber (operands[4]);
6573 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
6574 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
6576 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
6577 set_unique_reg_note (insn, REG_EQUAL, equal);
6579 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
6580 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6582 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
6583 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6588 (define_insn "udivmoddisi3"
6589 [(set (match_operand:DI 0 "register_operand" "=d,d")
6594 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
6596 (match_operand:SI 2 "nonimmediate_operand" "d,RT")))))
6600 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
6601 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
6605 [(set_attr "op_type" "RRE,RXY")
6606 (set_attr "type" "idiv")])
6608 (define_expand "udivsi3"
6609 [(set (match_operand:SI 0 "register_operand" "=d")
6610 (udiv:SI (match_operand:SI 1 "general_operand" "")
6611 (match_operand:SI 2 "general_operand" "")))
6612 (clobber (match_dup 3))]
6613 "!TARGET_ZARCH && !TARGET_CPU_ZARCH"
6615 rtx insn, udiv_equal, umod_equal, equal;
6617 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6618 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6619 equal = gen_rtx_IOR (DImode,
6620 gen_rtx_ASHIFT (DImode,
6621 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
6623 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
6625 operands[3] = gen_reg_rtx (DImode);
6627 if (CONSTANT_P (operands[2]))
6629 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
6631 rtx_code_label *label1 = gen_label_rtx ();
6633 operands[1] = make_safe_from (operands[1], operands[0]);
6634 emit_move_insn (operands[0], const0_rtx);
6635 emit_cmp_and_jump_insns (operands[1], operands[2], LT, NULL_RTX,
6637 emit_move_insn (operands[0], const1_rtx);
6638 emit_label (label1);
6642 operands[2] = force_reg (SImode, operands[2]);
6643 operands[2] = make_safe_from (operands[2], operands[0]);
6645 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6646 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6648 set_unique_reg_note (insn, REG_EQUAL, equal);
6650 insn = emit_move_insn (operands[0],
6651 gen_lowpart (SImode, operands[3]));
6652 set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
6657 rtx_code_label *label1 = gen_label_rtx ();
6658 rtx_code_label *label2 = gen_label_rtx ();
6659 rtx_code_label *label3 = gen_label_rtx ();
6661 operands[1] = force_reg (SImode, operands[1]);
6662 operands[1] = make_safe_from (operands[1], operands[0]);
6663 operands[2] = force_reg (SImode, operands[2]);
6664 operands[2] = make_safe_from (operands[2], operands[0]);
6666 emit_move_insn (operands[0], const0_rtx);
6667 emit_cmp_and_jump_insns (operands[2], operands[1], GT, NULL_RTX,
6669 emit_cmp_and_jump_insns (operands[2], const0_rtx, LT, NULL_RTX,
6671 emit_cmp_and_jump_insns (operands[2], const1_rtx, EQ, NULL_RTX,
6673 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6674 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6676 set_unique_reg_note (insn, REG_EQUAL, equal);
6678 insn = emit_move_insn (operands[0],
6679 gen_lowpart (SImode, operands[3]));
6680 set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
6683 emit_label (label1);
6684 emit_move_insn (operands[0], operands[1]);
6686 emit_label (label2);
6687 emit_move_insn (operands[0], const1_rtx);
6688 emit_label (label3);
6690 emit_move_insn (operands[0], operands[0]);
6694 (define_expand "umodsi3"
6695 [(set (match_operand:SI 0 "register_operand" "=d")
6696 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
6697 (match_operand:SI 2 "nonimmediate_operand" "")))
6698 (clobber (match_dup 3))]
6699 "!TARGET_ZARCH && !TARGET_CPU_ZARCH"
6701 rtx insn, udiv_equal, umod_equal, equal;
6703 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6704 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6705 equal = gen_rtx_IOR (DImode,
6706 gen_rtx_ASHIFT (DImode,
6707 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
6709 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
6711 operands[3] = gen_reg_rtx (DImode);
6713 if (CONSTANT_P (operands[2]))
6715 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
6717 rtx_code_label *label1 = gen_label_rtx ();
6719 operands[1] = make_safe_from (operands[1], operands[0]);
6720 emit_move_insn (operands[0], operands[1]);
6721 emit_cmp_and_jump_insns (operands[0], operands[2], LT, NULL_RTX,
6723 emit_insn (gen_abssi2 (operands[0], operands[2]));
6724 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
6725 emit_label (label1);
6729 operands[2] = force_reg (SImode, operands[2]);
6730 operands[2] = make_safe_from (operands[2], operands[0]);
6732 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6733 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6735 set_unique_reg_note (insn, REG_EQUAL, equal);
6737 insn = emit_move_insn (operands[0],
6738 gen_highpart (SImode, operands[3]));
6739 set_unique_reg_note (insn, REG_EQUAL, umod_equal);
6744 rtx_code_label *label1 = gen_label_rtx ();
6745 rtx_code_label *label2 = gen_label_rtx ();
6746 rtx_code_label *label3 = gen_label_rtx ();
6748 operands[1] = force_reg (SImode, operands[1]);
6749 operands[1] = make_safe_from (operands[1], operands[0]);
6750 operands[2] = force_reg (SImode, operands[2]);
6751 operands[2] = make_safe_from (operands[2], operands[0]);
6753 emit_move_insn(operands[0], operands[1]);
6754 emit_cmp_and_jump_insns (operands[2], operands[1], GT, NULL_RTX,
6756 emit_cmp_and_jump_insns (operands[2], const0_rtx, LT, NULL_RTX,
6758 emit_cmp_and_jump_insns (operands[2], const1_rtx, EQ, NULL_RTX,
6760 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6761 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6763 set_unique_reg_note (insn, REG_EQUAL, equal);
6765 insn = emit_move_insn (operands[0],
6766 gen_highpart (SImode, operands[3]));
6767 set_unique_reg_note (insn, REG_EQUAL, umod_equal);
6770 emit_label (label1);
6771 emit_move_insn (operands[0], const0_rtx);
6773 emit_label (label2);
6774 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
6775 emit_label (label3);
6781 ; div(df|sf)3 instruction pattern(s).
6784 ; dxbr, ddbr, debr, dxb, ddb, deb, ddtr, dxtr
6785 (define_insn "div<mode>3"
6786 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
6787 (div:FP (match_operand:FP 1 "register_operand" "<f0>, 0,<v0>")
6788 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))]
6791 d<xde><bt>r\t%0,<op1>%2
6794 [(set_attr "op_type" "<RRer>,RXE,VRR")
6795 (set_attr "type" "fdiv<mode>")
6796 (set_attr "cpu_facility" "*,*,vec")])
6800 ;;- And instructions.
6803 (define_expand "and<mode>3"
6804 [(set (match_operand:INT 0 "nonimmediate_operand" "")
6805 (and:INT (match_operand:INT 1 "nonimmediate_operand" "")
6806 (match_operand:INT 2 "general_operand" "")))
6807 (clobber (reg:CC CC_REGNUM))]
6809 "s390_expand_logical_operator (AND, <MODE>mode, operands); DONE;")
6812 ; anddi3 instruction pattern(s).
6815 (define_insn "*anddi3_cc"
6816 [(set (reg CC_REGNUM)
6818 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0, d")
6819 (match_operand:DI 2 "general_operand" " d,d,RT,NxxDq"))
6821 (set (match_operand:DI 0 "register_operand" "=d,d, d, d")
6822 (and:DI (match_dup 1) (match_dup 2)))]
6823 "TARGET_ZARCH && s390_match_ccmode(insn, CCTmode)"
6828 risbg\t%0,%1,%s2,128+%e2,0"
6829 [(set_attr "op_type" "RRE,RRF,RXY,RIE")
6830 (set_attr "cpu_facility" "*,z196,*,z10")
6831 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
6833 (define_insn "*anddi3_cconly"
6834 [(set (reg CC_REGNUM)
6836 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0, d")
6837 (match_operand:DI 2 "general_operand" " d,d,RT,NxxDq"))
6839 (clobber (match_scratch:DI 0 "=d,d, d, d"))]
6841 && s390_match_ccmode(insn, CCTmode)
6842 /* Do not steal TM patterns. */
6843 && s390_single_part (operands[2], DImode, HImode, 0) < 0"
6848 risbg\t%0,%1,%s2,128+%e2,0"
6849 [(set_attr "op_type" "RRE,RRF,RXY,RIE")
6850 (set_attr "cpu_facility" "*,z196,*,z10")
6851 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
6853 (define_insn "*anddi3"
6854 [(set (match_operand:DI 0 "nonimmediate_operand"
6855 "=d,d, d, d, d, d, d, d,d,d, d, d, AQ,Q")
6857 (match_operand:DI 1 "nonimmediate_operand"
6858 "%d,o, 0, 0, 0, 0, 0, 0,0,d, 0, d, 0,0")
6859 (match_operand:DI 2 "general_operand"
6860 "M, M,N0HDF,N1HDF,N2HDF,N3HDF,N0SDF,N1SDF,d,d,RT,NxxDq,NxQDF,Q")))
6861 (clobber (reg:CC CC_REGNUM))]
6862 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6875 risbg\t%0,%1,%s2,128+%e2,0
6878 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,RIE,SI,SS")
6879 (set_attr "cpu_facility" "*,*,*,*,*,*,extimm,extimm,*,z196,*,z10,*,*")
6880 (set_attr "z10prop" "*,
6896 [(set (match_operand:DI 0 "s_operand" "")
6897 (and:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
6898 (clobber (reg:CC CC_REGNUM))]
6901 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
6902 (clobber (reg:CC CC_REGNUM))])]
6903 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
6905 ;; These two are what combine generates for (ashift (zero_extract)).
6906 (define_insn "*extzv_<mode>_srl"
6907 [(set (match_operand:GPR 0 "register_operand" "=d")
6908 (and:GPR (lshiftrt:GPR
6909 (match_operand:GPR 1 "register_operand" "d")
6910 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
6911 (match_operand:GPR 3 "contiguous_bitmask_operand" "")))
6912 (clobber (reg:CC CC_REGNUM))]
6914 /* Note that even for the SImode pattern, the rotate is always DImode. */
6915 && s390_extzv_shift_ok (<bitsize>, -INTVAL (operands[2]),
6916 INTVAL (operands[3]))"
6917 "risbg\t%0,%1,%<bfstart>3,128+%<bfend>3,64-%2"
6918 [(set_attr "op_type" "RIE")
6919 (set_attr "z10prop" "z10_super_E1")])
6921 (define_insn "*extzv_<mode>_sll"
6922 [(set (match_operand:GPR 0 "register_operand" "=d")
6923 (and:GPR (ashift:GPR
6924 (match_operand:GPR 1 "register_operand" "d")
6925 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
6926 (match_operand:GPR 3 "contiguous_bitmask_operand" "")))
6927 (clobber (reg:CC CC_REGNUM))]
6929 && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[2]),
6930 INTVAL (operands[3]))"
6931 "risbg\t%0,%1,%<bfstart>3,128+%<bfend>3,%2"
6932 [(set_attr "op_type" "RIE")
6933 (set_attr "z10prop" "z10_super_E1")])
6937 ; andsi3 instruction pattern(s).
6940 (define_insn "*andsi3_cc"
6941 [(set (reg CC_REGNUM)
6944 (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d")
6945 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq"))
6947 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d, d")
6948 (and:SI (match_dup 1) (match_dup 2)))]
6949 "s390_match_ccmode(insn, CCTmode)"
6956 risbg\t%0,%1,%t2,128+%f2,0"
6957 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE")
6958 (set_attr "cpu_facility" "*,*,z196,*,*,z10")
6959 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
6960 z10_super_E1,z10_super_E1,z10_super_E1")])
6962 (define_insn "*andsi3_cconly"
6963 [(set (reg CC_REGNUM)
6966 (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d")
6967 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq"))
6969 (clobber (match_scratch:SI 0 "=d,d,d,d,d, d"))]
6970 "s390_match_ccmode(insn, CCTmode)
6971 /* Do not steal TM patterns. */
6972 && s390_single_part (operands[2], SImode, HImode, 0) < 0"
6979 risbg\t%0,%1,%t2,128+%f2,0"
6980 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE")
6981 (set_attr "cpu_facility" "*,*,z196,*,*,z10")
6982 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
6983 z10_super_E1,z10_super_E1,z10_super_E1")])
6985 (define_insn "*andsi3_zarch"
6986 [(set (match_operand:SI 0 "nonimmediate_operand"
6987 "=d,d, d, d, d,d,d,d,d, d, AQ,Q")
6988 (and:SI (match_operand:SI 1 "nonimmediate_operand"
6989 "%d,o, 0, 0, 0,0,d,0,0, d, 0,0")
6990 (match_operand:SI 2 "general_operand"
6991 " M,M,N0HSF,N1HSF,Os,d,d,R,T,NxxSq,NxQSF,Q")))
6992 (clobber (reg:CC CC_REGNUM))]
6993 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7004 risbg\t%0,%1,%t2,128+%f2,0
7007 [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RRF,RX,RXY,RIE,SI,SS")
7008 (set_attr "cpu_facility" "*,*,*,*,*,*,z196,*,*,z10,*,*")
7009 (set_attr "z10prop" "*,
7022 (define_insn "*andsi3_esa"
7023 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d, AQ,Q")
7024 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0, 0,0")
7025 (match_operand:SI 2 "general_operand" " d,R,NxQSF,Q")))
7026 (clobber (reg:CC CC_REGNUM))]
7027 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7033 [(set_attr "op_type" "RR,RX,SI,SS")
7034 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
7038 [(set (match_operand:SI 0 "s_operand" "")
7039 (and:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7040 (clobber (reg:CC CC_REGNUM))]
7043 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
7044 (clobber (reg:CC CC_REGNUM))])]
7045 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
7048 ; andhi3 instruction pattern(s).
7051 (define_insn "*andhi3_zarch"
7052 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7053 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0")
7054 (match_operand:HI 2 "general_operand" " d,d,n,NxQHF,Q")))
7055 (clobber (reg:CC CC_REGNUM))]
7056 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7063 [(set_attr "op_type" "RR,RRF,RI,SI,SS")
7064 (set_attr "cpu_facility" "*,z196,*,*,*")
7065 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*")
7068 (define_insn "*andhi3_esa"
7069 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
7070 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
7071 (match_operand:HI 2 "general_operand" "d,NxQHF,Q")))
7072 (clobber (reg:CC CC_REGNUM))]
7073 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7078 [(set_attr "op_type" "RR,SI,SS")
7079 (set_attr "z10prop" "z10_super_E1,*,*")
7083 [(set (match_operand:HI 0 "s_operand" "")
7084 (and:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7085 (clobber (reg:CC CC_REGNUM))]
7088 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
7089 (clobber (reg:CC CC_REGNUM))])]
7090 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
7093 ; andqi3 instruction pattern(s).
7096 (define_insn "*andqi3_zarch"
7097 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7098 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0")
7099 (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q")))
7100 (clobber (reg:CC CC_REGNUM))]
7101 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7109 [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS")
7110 (set_attr "cpu_facility" "*,z196,*,*,*,*")
7111 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super,z10_super,*")])
7113 (define_insn "*andqi3_esa"
7114 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
7115 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
7116 (match_operand:QI 2 "general_operand" "d,n,Q")))
7117 (clobber (reg:CC CC_REGNUM))]
7118 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7123 [(set_attr "op_type" "RR,SI,SS")
7124 (set_attr "z10prop" "z10_super_E1,z10_super,*")])
7127 ; Block and (NC) patterns.
7131 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7132 (and:BLK (match_dup 0)
7133 (match_operand:BLK 1 "memory_operand" "Q")))
7134 (use (match_operand 2 "const_int_operand" "n"))
7135 (clobber (reg:CC CC_REGNUM))]
7136 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7137 "nc\t%O0(%2,%R0),%S1"
7138 [(set_attr "op_type" "SS")
7139 (set_attr "z196prop" "z196_cracked")])
7142 [(set (match_operand 0 "memory_operand" "")
7144 (match_operand 1 "memory_operand" "")))
7145 (clobber (reg:CC CC_REGNUM))]
7147 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7148 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7150 [(set (match_dup 0) (and:BLK (match_dup 0) (match_dup 1)))
7152 (clobber (reg:CC CC_REGNUM))])]
7154 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7155 operands[0] = adjust_address (operands[0], BLKmode, 0);
7156 operands[1] = adjust_address (operands[1], BLKmode, 0);
7161 [(set (match_operand:BLK 0 "memory_operand" "")
7162 (and:BLK (match_dup 0)
7163 (match_operand:BLK 1 "memory_operand" "")))
7164 (use (match_operand 2 "const_int_operand" ""))
7165 (clobber (reg:CC CC_REGNUM))])
7167 [(set (match_operand:BLK 3 "memory_operand" "")
7168 (and:BLK (match_dup 3)
7169 (match_operand:BLK 4 "memory_operand" "")))
7170 (use (match_operand 5 "const_int_operand" ""))
7171 (clobber (reg:CC CC_REGNUM))])]
7172 "s390_offset_p (operands[0], operands[3], operands[2])
7173 && s390_offset_p (operands[1], operands[4], operands[2])
7174 && !s390_overlap_p (operands[0], operands[1],
7175 INTVAL (operands[2]) + INTVAL (operands[5]))
7176 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7178 [(set (match_dup 6) (and:BLK (match_dup 6) (match_dup 7)))
7180 (clobber (reg:CC CC_REGNUM))])]
7181 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7182 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7183 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7187 ;;- Bit set (inclusive or) instructions.
7190 (define_expand "ior<mode>3"
7191 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7192 (ior:INT (match_operand:INT 1 "nonimmediate_operand" "")
7193 (match_operand:INT 2 "general_operand" "")))
7194 (clobber (reg:CC CC_REGNUM))]
7196 "s390_expand_logical_operator (IOR, <MODE>mode, operands); DONE;")
7199 ; iordi3 instruction pattern(s).
7202 (define_insn "*iordi3_cc"
7203 [(set (reg CC_REGNUM)
7204 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7205 (match_operand:DI 2 "general_operand" " d,d,RT"))
7207 (set (match_operand:DI 0 "register_operand" "=d,d, d")
7208 (ior:DI (match_dup 1) (match_dup 2)))]
7209 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7214 [(set_attr "op_type" "RRE,RRF,RXY")
7215 (set_attr "cpu_facility" "*,z196,*")
7216 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7218 (define_insn "*iordi3_cconly"
7219 [(set (reg CC_REGNUM)
7220 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0")
7221 (match_operand:DI 2 "general_operand" " d,d,RT"))
7223 (clobber (match_scratch:DI 0 "=d,d,d"))]
7224 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7229 [(set_attr "op_type" "RRE,RRF,RXY")
7230 (set_attr "cpu_facility" "*,z196,*")
7231 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7233 (define_insn "*iordi3"
7234 [(set (match_operand:DI 0 "nonimmediate_operand"
7235 "=d, d, d, d, d, d,d,d, d, AQ,Q")
7236 (ior:DI (match_operand:DI 1 "nonimmediate_operand"
7237 " %0, 0, 0, 0, 0, 0,0,d, 0, 0,0")
7238 (match_operand:DI 2 "general_operand"
7239 "N0HD0,N1HD0,N2HD0,N3HD0,N0SD0,N1SD0,d,d,RT,NxQD0,Q")))
7240 (clobber (reg:CC CC_REGNUM))]
7241 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7254 [(set_attr "op_type" "RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,SI,SS")
7255 (set_attr "cpu_facility" "*,*,*,*,extimm,extimm,*,z196,*,*,*")
7256 (set_attr "z10prop" "z10_super_E1,
7269 [(set (match_operand:DI 0 "s_operand" "")
7270 (ior:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
7271 (clobber (reg:CC CC_REGNUM))]
7274 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7275 (clobber (reg:CC CC_REGNUM))])]
7276 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7279 ; iorsi3 instruction pattern(s).
7282 (define_insn "*iorsi3_cc"
7283 [(set (reg CC_REGNUM)
7284 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7285 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7287 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
7288 (ior:SI (match_dup 1) (match_dup 2)))]
7289 "s390_match_ccmode(insn, CCTmode)"
7296 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7297 (set_attr "cpu_facility" "*,*,z196,*,*")
7298 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")])
7300 (define_insn "*iorsi3_cconly"
7301 [(set (reg CC_REGNUM)
7302 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7303 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7305 (clobber (match_scratch:SI 0 "=d,d,d,d,d"))]
7306 "s390_match_ccmode(insn, CCTmode)"
7313 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7314 (set_attr "cpu_facility" "*,*,z196,*,*")
7315 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")])
7317 (define_insn "*iorsi3_zarch"
7318 [(set (match_operand:SI 0 "nonimmediate_operand" "=d, d, d,d,d,d,d, AQ,Q")
7319 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0, 0, 0,0,d,0,0, 0,0")
7320 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,Os,d,d,R,T,NxQS0,Q")))
7321 (clobber (reg:CC CC_REGNUM))]
7322 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7333 [(set_attr "op_type" "RI,RI,RIL,RR,RRF,RX,RXY,SI,SS")
7334 (set_attr "cpu_facility" "*,*,*,*,z196,*,*,*,*")
7335 (set_attr "z10prop" "z10_super_E1,
7345 (define_insn "*iorsi3_esa"
7346 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
7347 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
7348 (match_operand:SI 2 "general_operand" "d,R,NxQS0,Q")))
7349 (clobber (reg:CC CC_REGNUM))]
7350 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7356 [(set_attr "op_type" "RR,RX,SI,SS")
7357 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
7360 [(set (match_operand:SI 0 "s_operand" "")
7361 (ior:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7362 (clobber (reg:CC CC_REGNUM))]
7365 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7366 (clobber (reg:CC CC_REGNUM))])]
7367 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7370 ; iorhi3 instruction pattern(s).
7373 (define_insn "*iorhi3_zarch"
7374 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7375 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0")
7376 (match_operand:HI 2 "general_operand" " d,d,n,NxQH0,Q")))
7377 (clobber (reg:CC CC_REGNUM))]
7378 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7385 [(set_attr "op_type" "RR,RRF,RI,SI,SS")
7386 (set_attr "cpu_facility" "*,z196,*,*,*")
7387 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*")])
7389 (define_insn "*iorhi3_esa"
7390 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
7391 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
7392 (match_operand:HI 2 "general_operand" "d,NxQH0,Q")))
7393 (clobber (reg:CC CC_REGNUM))]
7394 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7399 [(set_attr "op_type" "RR,SI,SS")
7400 (set_attr "z10prop" "z10_super_E1,*,*")])
7403 [(set (match_operand:HI 0 "s_operand" "")
7404 (ior:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7405 (clobber (reg:CC CC_REGNUM))]
7408 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7409 (clobber (reg:CC CC_REGNUM))])]
7410 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7413 ; iorqi3 instruction pattern(s).
7416 (define_insn "*iorqi3_zarch"
7417 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7418 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0")
7419 (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q")))
7420 (clobber (reg:CC CC_REGNUM))]
7421 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7429 [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS")
7430 (set_attr "cpu_facility" "*,z196,*,*,*,*")
7431 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,
7432 z10_super,z10_super,*")])
7434 (define_insn "*iorqi3_esa"
7435 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
7436 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
7437 (match_operand:QI 2 "general_operand" "d,n,Q")))
7438 (clobber (reg:CC CC_REGNUM))]
7439 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7444 [(set_attr "op_type" "RR,SI,SS")
7445 (set_attr "z10prop" "z10_super_E1,z10_super,*")])
7448 ; Block inclusive or (OC) patterns.
7452 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7453 (ior:BLK (match_dup 0)
7454 (match_operand:BLK 1 "memory_operand" "Q")))
7455 (use (match_operand 2 "const_int_operand" "n"))
7456 (clobber (reg:CC CC_REGNUM))]
7457 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7458 "oc\t%O0(%2,%R0),%S1"
7459 [(set_attr "op_type" "SS")
7460 (set_attr "z196prop" "z196_cracked")])
7463 [(set (match_operand 0 "memory_operand" "")
7465 (match_operand 1 "memory_operand" "")))
7466 (clobber (reg:CC CC_REGNUM))]
7468 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7469 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7471 [(set (match_dup 0) (ior:BLK (match_dup 0) (match_dup 1)))
7473 (clobber (reg:CC CC_REGNUM))])]
7475 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7476 operands[0] = adjust_address (operands[0], BLKmode, 0);
7477 operands[1] = adjust_address (operands[1], BLKmode, 0);
7482 [(set (match_operand:BLK 0 "memory_operand" "")
7483 (ior:BLK (match_dup 0)
7484 (match_operand:BLK 1 "memory_operand" "")))
7485 (use (match_operand 2 "const_int_operand" ""))
7486 (clobber (reg:CC CC_REGNUM))])
7488 [(set (match_operand:BLK 3 "memory_operand" "")
7489 (ior:BLK (match_dup 3)
7490 (match_operand:BLK 4 "memory_operand" "")))
7491 (use (match_operand 5 "const_int_operand" ""))
7492 (clobber (reg:CC CC_REGNUM))])]
7493 "s390_offset_p (operands[0], operands[3], operands[2])
7494 && s390_offset_p (operands[1], operands[4], operands[2])
7495 && !s390_overlap_p (operands[0], operands[1],
7496 INTVAL (operands[2]) + INTVAL (operands[5]))
7497 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7499 [(set (match_dup 6) (ior:BLK (match_dup 6) (match_dup 7)))
7501 (clobber (reg:CC CC_REGNUM))])]
7502 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7503 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7504 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7508 ;;- Xor instructions.
7511 (define_expand "xor<mode>3"
7512 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7513 (xor:INT (match_operand:INT 1 "nonimmediate_operand" "")
7514 (match_operand:INT 2 "general_operand" "")))
7515 (clobber (reg:CC CC_REGNUM))]
7517 "s390_expand_logical_operator (XOR, <MODE>mode, operands); DONE;")
7519 ; Combine replaces (xor (x) (const_int -1)) with (not (x)) when doing
7520 ; simplifications. So its better to have something matching.
7522 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7523 (not:INT (match_operand:INT 1 "nonimmediate_operand" "")))]
7526 [(set (match_dup 0) (xor:INT (match_dup 1) (match_dup 2)))
7527 (clobber (reg:CC CC_REGNUM))])]
7529 operands[2] = constm1_rtx;
7530 if (!s390_logical_operator_ok_p (operands))
7535 ; xordi3 instruction pattern(s).
7538 (define_insn "*xordi3_cc"
7539 [(set (reg CC_REGNUM)
7540 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7541 (match_operand:DI 2 "general_operand" " d,d,RT"))
7543 (set (match_operand:DI 0 "register_operand" "=d,d, d")
7544 (xor:DI (match_dup 1) (match_dup 2)))]
7545 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7550 [(set_attr "op_type" "RRE,RRF,RXY")
7551 (set_attr "cpu_facility" "*,z196,*")
7552 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7554 (define_insn "*xordi3_cconly"
7555 [(set (reg CC_REGNUM)
7556 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7557 (match_operand:DI 2 "general_operand" " d,d,RT"))
7559 (clobber (match_scratch:DI 0 "=d,d, d"))]
7560 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7565 [(set_attr "op_type" "RRE,RRF,RXY")
7566 (set_attr "cpu_facility" "*,z196,*")
7567 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7569 (define_insn "*xordi3"
7570 [(set (match_operand:DI 0 "nonimmediate_operand" "=d, d,d,d, d, AQ,Q")
7571 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0, 0,0,d, 0, 0,0")
7572 (match_operand:DI 2 "general_operand" "N0SD0,N1SD0,d,d,RT,NxQD0,Q")))
7573 (clobber (reg:CC CC_REGNUM))]
7574 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7583 [(set_attr "op_type" "RIL,RIL,RRE,RRF,RXY,SI,SS")
7584 (set_attr "cpu_facility" "extimm,extimm,*,z196,*,*,*")
7585 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,
7586 *,z10_super_E1,*,*")])
7589 [(set (match_operand:DI 0 "s_operand" "")
7590 (xor:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
7591 (clobber (reg:CC CC_REGNUM))]
7594 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7595 (clobber (reg:CC CC_REGNUM))])]
7596 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7599 ; xorsi3 instruction pattern(s).
7602 (define_insn "*xorsi3_cc"
7603 [(set (reg CC_REGNUM)
7604 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7605 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7607 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
7608 (xor:SI (match_dup 1) (match_dup 2)))]
7609 "s390_match_ccmode(insn, CCTmode)"
7616 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7617 (set_attr "cpu_facility" "*,*,z196,*,*")
7618 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7619 z10_super_E1,z10_super_E1")])
7621 (define_insn "*xorsi3_cconly"
7622 [(set (reg CC_REGNUM)
7623 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7624 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7626 (clobber (match_scratch:SI 0 "=d,d,d,d,d"))]
7627 "s390_match_ccmode(insn, CCTmode)"
7634 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7635 (set_attr "cpu_facility" "*,*,z196,*,*")
7636 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7637 z10_super_E1,z10_super_E1")])
7639 (define_insn "*xorsi3"
7640 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d, AQ,Q")
7641 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, 0,0")
7642 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxQS0,Q")))
7643 (clobber (reg:CC CC_REGNUM))]
7644 "s390_logical_operator_ok_p (operands)"
7653 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,SI,SS")
7654 (set_attr "cpu_facility" "*,*,z196,*,*,*,*")
7655 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7656 z10_super_E1,z10_super_E1,*,*")])
7659 [(set (match_operand:SI 0 "s_operand" "")
7660 (xor:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7661 (clobber (reg:CC CC_REGNUM))]
7664 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7665 (clobber (reg:CC CC_REGNUM))])]
7666 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7669 ; xorhi3 instruction pattern(s).
7672 (define_insn "*xorhi3"
7673 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7674 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,d, 0,0")
7675 (match_operand:HI 2 "general_operand" "Os,d,d,NxQH0,Q")))
7676 (clobber (reg:CC CC_REGNUM))]
7677 "s390_logical_operator_ok_p (operands)"
7684 [(set_attr "op_type" "RIL,RR,RRF,SI,SS")
7685 (set_attr "cpu_facility" "*,*,z196,*,*")
7686 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*,*")])
7689 [(set (match_operand:HI 0 "s_operand" "")
7690 (xor:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7691 (clobber (reg:CC CC_REGNUM))]
7694 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7695 (clobber (reg:CC CC_REGNUM))])]
7696 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7699 ; xorqi3 instruction pattern(s).
7702 (define_insn "*xorqi3"
7703 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7704 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,d,0,0,0")
7705 (match_operand:QI 2 "general_operand" "Os,d,d,n,n,Q")))
7706 (clobber (reg:CC CC_REGNUM))]
7707 "s390_logical_operator_ok_p (operands)"
7715 [(set_attr "op_type" "RIL,RR,RRF,SI,SIY,SS")
7716 (set_attr "cpu_facility" "*,*,z196,*,*,*")
7717 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super,z10_super,*")])
7721 ; Block exclusive or (XC) patterns.
7725 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7726 (xor:BLK (match_dup 0)
7727 (match_operand:BLK 1 "memory_operand" "Q")))
7728 (use (match_operand 2 "const_int_operand" "n"))
7729 (clobber (reg:CC CC_REGNUM))]
7730 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7731 "xc\t%O0(%2,%R0),%S1"
7732 [(set_attr "op_type" "SS")])
7735 [(set (match_operand 0 "memory_operand" "")
7737 (match_operand 1 "memory_operand" "")))
7738 (clobber (reg:CC CC_REGNUM))]
7740 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7741 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7743 [(set (match_dup 0) (xor:BLK (match_dup 0) (match_dup 1)))
7745 (clobber (reg:CC CC_REGNUM))])]
7747 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7748 operands[0] = adjust_address (operands[0], BLKmode, 0);
7749 operands[1] = adjust_address (operands[1], BLKmode, 0);
7754 [(set (match_operand:BLK 0 "memory_operand" "")
7755 (xor:BLK (match_dup 0)
7756 (match_operand:BLK 1 "memory_operand" "")))
7757 (use (match_operand 2 "const_int_operand" ""))
7758 (clobber (reg:CC CC_REGNUM))])
7760 [(set (match_operand:BLK 3 "memory_operand" "")
7761 (xor:BLK (match_dup 3)
7762 (match_operand:BLK 4 "memory_operand" "")))
7763 (use (match_operand 5 "const_int_operand" ""))
7764 (clobber (reg:CC CC_REGNUM))])]
7765 "s390_offset_p (operands[0], operands[3], operands[2])
7766 && s390_offset_p (operands[1], operands[4], operands[2])
7767 && !s390_overlap_p (operands[0], operands[1],
7768 INTVAL (operands[2]) + INTVAL (operands[5]))
7769 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7771 [(set (match_dup 6) (xor:BLK (match_dup 6) (match_dup 7)))
7773 (clobber (reg:CC CC_REGNUM))])]
7774 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7775 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7776 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7779 ; Block xor (XC) patterns with src == dest.
7782 (define_insn "*xc_zero"
7783 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7785 (use (match_operand 1 "const_int_operand" "n"))
7786 (clobber (reg:CC CC_REGNUM))]
7787 "INTVAL (operands[1]) >= 1 && INTVAL (operands[1]) <= 256"
7788 "xc\t%O0(%1,%R0),%S0"
7789 [(set_attr "op_type" "SS")
7790 (set_attr "z196prop" "z196_cracked")])
7794 [(set (match_operand:BLK 0 "memory_operand" "")
7796 (use (match_operand 1 "const_int_operand" ""))
7797 (clobber (reg:CC CC_REGNUM))])
7799 [(set (match_operand:BLK 2 "memory_operand" "")
7801 (use (match_operand 3 "const_int_operand" ""))
7802 (clobber (reg:CC CC_REGNUM))])]
7803 "s390_offset_p (operands[0], operands[2], operands[1])
7804 && INTVAL (operands[1]) + INTVAL (operands[3]) <= 256"
7806 [(set (match_dup 4) (const_int 0))
7808 (clobber (reg:CC CC_REGNUM))])]
7809 "operands[4] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7810 operands[5] = GEN_INT (INTVAL (operands[1]) + INTVAL (operands[3]));")
7814 ;;- Negate instructions.
7818 ; neg(di|si)2 instruction pattern(s).
7821 (define_expand "neg<mode>2"
7823 [(set (match_operand:DSI 0 "register_operand" "=d")
7824 (neg:DSI (match_operand:DSI 1 "register_operand" "d")))
7825 (clobber (reg:CC CC_REGNUM))])]
7829 (define_insn "*negdi2_sign_cc"
7830 [(set (reg CC_REGNUM)
7831 (compare (neg:DI (ashiftrt:DI (ashift:DI (subreg:DI
7832 (match_operand:SI 1 "register_operand" "d") 0)
7833 (const_int 32)) (const_int 32)))
7835 (set (match_operand:DI 0 "register_operand" "=d")
7836 (neg:DI (sign_extend:DI (match_dup 1))))]
7837 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
7839 [(set_attr "op_type" "RRE")
7840 (set_attr "z10prop" "z10_c")])
7842 (define_insn "*negdi2_sign"
7843 [(set (match_operand:DI 0 "register_operand" "=d")
7844 (neg:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
7845 (clobber (reg:CC CC_REGNUM))]
7848 [(set_attr "op_type" "RRE")
7849 (set_attr "z10prop" "z10_c")])
7852 (define_insn "*neg<mode>2_cc"
7853 [(set (reg CC_REGNUM)
7854 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
7856 (set (match_operand:GPR 0 "register_operand" "=d")
7857 (neg:GPR (match_dup 1)))]
7858 "s390_match_ccmode (insn, CCAmode)"
7860 [(set_attr "op_type" "RR<E>")
7861 (set_attr "z10prop" "z10_super_c_E1")])
7864 (define_insn "*neg<mode>2_cconly"
7865 [(set (reg CC_REGNUM)
7866 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
7868 (clobber (match_scratch:GPR 0 "=d"))]
7869 "s390_match_ccmode (insn, CCAmode)"
7871 [(set_attr "op_type" "RR<E>")
7872 (set_attr "z10prop" "z10_super_c_E1")])
7875 (define_insn "*neg<mode>2"
7876 [(set (match_operand:GPR 0 "register_operand" "=d")
7877 (neg:GPR (match_operand:GPR 1 "register_operand" "d")))
7878 (clobber (reg:CC CC_REGNUM))]
7881 [(set_attr "op_type" "RR<E>")
7882 (set_attr "z10prop" "z10_super_c_E1")])
7884 (define_insn "*negdi2_31"
7885 [(set (match_operand:DI 0 "register_operand" "=d")
7886 (neg:DI (match_operand:DI 1 "register_operand" "d")))
7887 (clobber (reg:CC CC_REGNUM))]
7891 ; Split a DImode NEG on 31bit into 2 SImode NEGs
7893 ; Doing the twos complement separately on the SImode parts does an
7894 ; unwanted +1 on the high part which needs to be subtracted afterwards
7895 ; ... unless the +1 on the low part created an overflow.
7898 [(set (match_operand:DI 0 "register_operand" "")
7899 (neg:DI (match_operand:DI 1 "register_operand" "")))
7900 (clobber (reg:CC CC_REGNUM))]
7902 && (REGNO (operands[0]) == REGNO (operands[1])
7903 || s390_split_ok_p (operands[0], operands[1], DImode, 0))
7904 && reload_completed"
7906 [(set (match_dup 2) (neg:SI (match_dup 3)))
7907 (clobber (reg:CC CC_REGNUM))])
7909 [(set (reg:CCAP CC_REGNUM)
7910 (compare:CCAP (neg:SI (match_dup 5)) (const_int 0)))
7911 (set (match_dup 4) (neg:SI (match_dup 5)))])
7913 (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
7915 (label_ref (match_dup 6))))
7917 [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
7918 (clobber (reg:CC CC_REGNUM))])
7920 "operands[2] = operand_subword (operands[0], 0, 0, DImode);
7921 operands[3] = operand_subword (operands[1], 0, 0, DImode);
7922 operands[4] = operand_subword (operands[0], 1, 0, DImode);
7923 operands[5] = operand_subword (operands[1], 1, 0, DImode);
7924 operands[6] = gen_label_rtx ();")
7926 ; Like above but first make a copy of the low part of the src operand
7927 ; since it might overlap with the high part of the destination.
7930 [(set (match_operand:DI 0 "register_operand" "")
7931 (neg:DI (match_operand:DI 1 "register_operand" "")))
7932 (clobber (reg:CC CC_REGNUM))]
7934 && s390_split_ok_p (operands[0], operands[1], DImode, 1)
7935 && reload_completed"
7936 [; Make a backup of op5 first
7937 (set (match_dup 4) (match_dup 5))
7938 ; Setting op2 here might clobber op5
7940 [(set (match_dup 2) (neg:SI (match_dup 3)))
7941 (clobber (reg:CC CC_REGNUM))])
7943 [(set (reg:CCAP CC_REGNUM)
7944 (compare:CCAP (neg:SI (match_dup 4)) (const_int 0)))
7945 (set (match_dup 4) (neg:SI (match_dup 4)))])
7947 (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
7949 (label_ref (match_dup 6))))
7951 [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
7952 (clobber (reg:CC CC_REGNUM))])
7954 "operands[2] = operand_subword (operands[0], 0, 0, DImode);
7955 operands[3] = operand_subword (operands[1], 0, 0, DImode);
7956 operands[4] = operand_subword (operands[0], 1, 0, DImode);
7957 operands[5] = operand_subword (operands[1], 1, 0, DImode);
7958 operands[6] = gen_label_rtx ();")
7961 ; neg(df|sf)2 instruction pattern(s).
7964 (define_expand "neg<mode>2"
7966 [(set (match_operand:BFP 0 "register_operand" "=f")
7967 (neg:BFP (match_operand:BFP 1 "register_operand" "f")))
7968 (clobber (reg:CC CC_REGNUM))])]
7972 ; lcxbr, lcdbr, lcebr
7973 (define_insn "*neg<mode>2_cc"
7974 [(set (reg CC_REGNUM)
7975 (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f"))
7976 (match_operand:BFP 2 "const0_operand" "")))
7977 (set (match_operand:BFP 0 "register_operand" "=f")
7978 (neg:BFP (match_dup 1)))]
7979 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7981 [(set_attr "op_type" "RRE")
7982 (set_attr "type" "fsimp<mode>")])
7984 ; lcxbr, lcdbr, lcebr
7985 (define_insn "*neg<mode>2_cconly"
7986 [(set (reg CC_REGNUM)
7987 (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f"))
7988 (match_operand:BFP 2 "const0_operand" "")))
7989 (clobber (match_scratch:BFP 0 "=f"))]
7990 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7992 [(set_attr "op_type" "RRE")
7993 (set_attr "type" "fsimp<mode>")])
7996 (define_insn "*neg<mode>2_nocc"
7997 [(set (match_operand:FP 0 "register_operand" "=f")
7998 (neg:FP (match_operand:FP 1 "register_operand" "<fT0>")))]
8001 [(set_attr "op_type" "RRE")
8002 (set_attr "type" "fsimp<mode>")])
8004 ; lcxbr, lcdbr, lcebr
8005 ; FIXME: wflcdb does not clobber cc
8006 (define_insn "*neg<mode>2"
8007 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
8008 (neg:BFP (match_operand:BFP 1 "register_operand" "f,<vf>")))
8009 (clobber (reg:CC CC_REGNUM))]
8014 [(set_attr "op_type" "RRE,VRR")
8015 (set_attr "cpu_facility" "*,vec")
8016 (set_attr "type" "fsimp<mode>,*")])
8020 ;;- Absolute value instructions.
8024 ; abs(di|si)2 instruction pattern(s).
8027 (define_insn "*absdi2_sign_cc"
8028 [(set (reg CC_REGNUM)
8029 (compare (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
8030 (match_operand:SI 1 "register_operand" "d") 0)
8031 (const_int 32)) (const_int 32)))
8033 (set (match_operand:DI 0 "register_operand" "=d")
8034 (abs:DI (sign_extend:DI (match_dup 1))))]
8035 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
8037 [(set_attr "op_type" "RRE")
8038 (set_attr "z10prop" "z10_c")])
8040 (define_insn "*absdi2_sign"
8041 [(set (match_operand:DI 0 "register_operand" "=d")
8042 (abs:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
8043 (clobber (reg:CC CC_REGNUM))]
8046 [(set_attr "op_type" "RRE")
8047 (set_attr "z10prop" "z10_c")])
8050 (define_insn "*abs<mode>2_cc"
8051 [(set (reg CC_REGNUM)
8052 (compare (abs:GPR (match_operand:DI 1 "register_operand" "d"))
8054 (set (match_operand:GPR 0 "register_operand" "=d")
8055 (abs:GPR (match_dup 1)))]
8056 "s390_match_ccmode (insn, CCAmode)"
8058 [(set_attr "op_type" "RR<E>")
8059 (set_attr "z10prop" "z10_c")])
8062 (define_insn "*abs<mode>2_cconly"
8063 [(set (reg CC_REGNUM)
8064 (compare (abs:GPR (match_operand:GPR 1 "register_operand" "d"))
8066 (clobber (match_scratch:GPR 0 "=d"))]
8067 "s390_match_ccmode (insn, CCAmode)"
8069 [(set_attr "op_type" "RR<E>")
8070 (set_attr "z10prop" "z10_c")])
8073 (define_insn "abs<mode>2"
8074 [(set (match_operand:GPR 0 "register_operand" "=d")
8075 (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8076 (clobber (reg:CC CC_REGNUM))]
8079 [(set_attr "op_type" "RR<E>")
8080 (set_attr "z10prop" "z10_c")])
8083 ; abs(df|sf)2 instruction pattern(s).
8086 (define_expand "abs<mode>2"
8088 [(set (match_operand:BFP 0 "register_operand" "=f")
8089 (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8090 (clobber (reg:CC CC_REGNUM))])]
8094 ; lpxbr, lpdbr, lpebr
8095 (define_insn "*abs<mode>2_cc"
8096 [(set (reg CC_REGNUM)
8097 (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f"))
8098 (match_operand:BFP 2 "const0_operand" "")))
8099 (set (match_operand:BFP 0 "register_operand" "=f")
8100 (abs:BFP (match_dup 1)))]
8101 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8103 [(set_attr "op_type" "RRE")
8104 (set_attr "type" "fsimp<mode>")])
8106 ; lpxbr, lpdbr, lpebr
8107 (define_insn "*abs<mode>2_cconly"
8108 [(set (reg CC_REGNUM)
8109 (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f"))
8110 (match_operand:BFP 2 "const0_operand" "")))
8111 (clobber (match_scratch:BFP 0 "=f"))]
8112 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8114 [(set_attr "op_type" "RRE")
8115 (set_attr "type" "fsimp<mode>")])
8118 (define_insn "*abs<mode>2_nocc"
8119 [(set (match_operand:FP 0 "register_operand" "=f")
8120 (abs:FP (match_operand:FP 1 "register_operand" "<fT0>")))]
8123 [(set_attr "op_type" "RRE")
8124 (set_attr "type" "fsimp<mode>")])
8126 ; lpxbr, lpdbr, lpebr
8127 ; FIXME: wflpdb does not clobber cc
8128 (define_insn "*abs<mode>2"
8129 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
8130 (abs:BFP (match_operand:BFP 1 "register_operand" "f,<vf>")))
8131 (clobber (reg:CC CC_REGNUM))]
8136 [(set_attr "op_type" "RRE,VRR")
8137 (set_attr "cpu_facility" "*,vec")
8138 (set_attr "type" "fsimp<mode>,*")])
8142 ;;- Negated absolute value instructions
8149 (define_insn "*negabsdi2_sign_cc"
8150 [(set (reg CC_REGNUM)
8151 (compare (neg:DI (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
8152 (match_operand:SI 1 "register_operand" "d") 0)
8153 (const_int 32)) (const_int 32))))
8155 (set (match_operand:DI 0 "register_operand" "=d")
8156 (neg:DI (abs:DI (sign_extend:DI (match_dup 1)))))]
8157 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
8159 [(set_attr "op_type" "RRE")
8160 (set_attr "z10prop" "z10_c")])
8162 (define_insn "*negabsdi2_sign"
8163 [(set (match_operand:DI 0 "register_operand" "=d")
8164 (neg:DI (abs:DI (sign_extend:DI
8165 (match_operand:SI 1 "register_operand" "d")))))
8166 (clobber (reg:CC CC_REGNUM))]
8169 [(set_attr "op_type" "RRE")
8170 (set_attr "z10prop" "z10_c")])
8173 (define_insn "*negabs<mode>2_cc"
8174 [(set (reg CC_REGNUM)
8175 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8177 (set (match_operand:GPR 0 "register_operand" "=d")
8178 (neg:GPR (abs:GPR (match_dup 1))))]
8179 "s390_match_ccmode (insn, CCAmode)"
8181 [(set_attr "op_type" "RR<E>")
8182 (set_attr "z10prop" "z10_c")])
8185 (define_insn "*negabs<mode>2_cconly"
8186 [(set (reg CC_REGNUM)
8187 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8189 (clobber (match_scratch:GPR 0 "=d"))]
8190 "s390_match_ccmode (insn, CCAmode)"
8192 [(set_attr "op_type" "RR<E>")
8193 (set_attr "z10prop" "z10_c")])
8196 (define_insn "*negabs<mode>2"
8197 [(set (match_operand:GPR 0 "register_operand" "=d")
8198 (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d"))))
8199 (clobber (reg:CC CC_REGNUM))]
8202 [(set_attr "op_type" "RR<E>")
8203 (set_attr "z10prop" "z10_c")])
8209 ; lnxbr, lndbr, lnebr
8210 (define_insn "*negabs<mode>2_cc"
8211 [(set (reg CC_REGNUM)
8212 (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8213 (match_operand:BFP 2 "const0_operand" "")))
8214 (set (match_operand:BFP 0 "register_operand" "=f")
8215 (neg:BFP (abs:BFP (match_dup 1))))]
8216 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8218 [(set_attr "op_type" "RRE")
8219 (set_attr "type" "fsimp<mode>")])
8221 ; lnxbr, lndbr, lnebr
8222 (define_insn "*negabs<mode>2_cconly"
8223 [(set (reg CC_REGNUM)
8224 (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8225 (match_operand:BFP 2 "const0_operand" "")))
8226 (clobber (match_scratch:BFP 0 "=f"))]
8227 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8229 [(set_attr "op_type" "RRE")
8230 (set_attr "type" "fsimp<mode>")])
8233 (define_insn "*negabs<mode>2_nocc"
8234 [(set (match_operand:FP 0 "register_operand" "=f")
8235 (neg:FP (abs:FP (match_operand:BFP 1 "register_operand" "<fT0>"))))]
8238 [(set_attr "op_type" "RRE")
8239 (set_attr "type" "fsimp<mode>")])
8241 ; lnxbr, lndbr, lnebr
8242 ; FIXME: wflndb does not clobber cc
8243 (define_insn "*negabs<mode>2"
8244 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
8245 (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f,<vf>"))))
8246 (clobber (reg:CC CC_REGNUM))]
8251 [(set_attr "op_type" "RRE,VRR")
8252 (set_attr "cpu_facility" "*,vec")
8253 (set_attr "type" "fsimp<mode>,*")])
8256 ;;- Square root instructions.
8260 ; sqrt(df|sf)2 instruction pattern(s).
8263 ; sqxbr, sqdbr, sqebr, sqdb, sqeb
8264 (define_insn "sqrt<mode>2"
8265 [(set (match_operand:BFP 0 "register_operand" "=f, f,<vf>")
8266 (sqrt:BFP (match_operand:BFP 1 "general_operand" "f,<Rf>,<vf>")))]
8272 [(set_attr "op_type" "RRE,RXE,VRR")
8273 (set_attr "type" "fsqrt<mode>")
8274 (set_attr "cpu_facility" "*,*,vec")])
8278 ;;- One complement instructions.
8282 ; one_cmpl(di|si|hi|qi)2 instruction pattern(s).
8285 (define_expand "one_cmpl<mode>2"
8287 [(set (match_operand:INT 0 "register_operand" "")
8288 (xor:INT (match_operand:INT 1 "register_operand" "")
8290 (clobber (reg:CC CC_REGNUM))])]
8296 ;; Find leftmost bit instructions.
8299 (define_expand "clzdi2"
8300 [(set (match_operand:DI 0 "register_operand" "=d")
8301 (clz:DI (match_operand:DI 1 "register_operand" "d")))]
8302 "TARGET_EXTIMM && TARGET_ZARCH"
8304 rtx insn, clz_equal;
8305 rtx wide_reg = gen_reg_rtx (TImode);
8306 rtx msb = gen_rtx_CONST_INT (DImode, (unsigned HOST_WIDE_INT) 1 << 63);
8308 clz_equal = gen_rtx_CLZ (DImode, operands[1]);
8310 emit_insn (gen_clztidi2 (wide_reg, operands[1], msb));
8312 insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg));
8313 set_unique_reg_note (insn, REG_EQUAL, clz_equal);
8318 (define_insn "clztidi2"
8319 [(set (match_operand:TI 0 "register_operand" "=d")
8323 (xor:DI (match_operand:DI 1 "register_operand" "d")
8324 (lshiftrt (match_operand:DI 2 "const_int_operand" "")
8325 (subreg:SI (clz:DI (match_dup 1)) 4))))
8328 (zero_extend:TI (clz:DI (match_dup 1)))))
8329 (clobber (reg:CC CC_REGNUM))]
8330 "(unsigned HOST_WIDE_INT) INTVAL (operands[2])
8331 == (unsigned HOST_WIDE_INT) 1 << 63
8332 && TARGET_EXTIMM && TARGET_ZARCH"
8334 [(set_attr "op_type" "RRE")])
8338 ;;- Rotate instructions.
8342 ; rotl(di|si)3 instruction pattern(s).
8346 (define_insn "rotl<mode>3"
8347 [(set (match_operand:GPR 0 "register_operand" "=d")
8348 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
8349 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
8352 [(set_attr "op_type" "RSE")
8353 (set_attr "atype" "reg")
8354 (set_attr "z10prop" "z10_super_E1")])
8357 (define_insn "*rotl<mode>3_and"
8358 [(set (match_operand:GPR 0 "register_operand" "=d")
8359 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
8360 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8361 (match_operand:SI 3 "const_int_operand" "n"))))]
8362 "TARGET_CPU_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8364 [(set_attr "op_type" "RSE")
8365 (set_attr "atype" "reg")
8366 (set_attr "z10prop" "z10_super_E1")])
8370 ;;- Shift instructions.
8374 ; (ashl|lshr)(di|si)3 instruction pattern(s).
8375 ; Left shifts and logical right shifts
8377 (define_expand "<shift><mode>3"
8378 [(set (match_operand:DSI 0 "register_operand" "")
8379 (SHIFT:DSI (match_operand:DSI 1 "register_operand" "")
8380 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))]
8385 (define_insn "*<shift>di3_31"
8386 [(set (match_operand:DI 0 "register_operand" "=d")
8387 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
8388 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
8391 [(set_attr "op_type" "RS")
8392 (set_attr "atype" "reg")
8393 (set_attr "z196prop" "z196_cracked")])
8395 ; sll, srl, sllg, srlg, sllk, srlk
8396 (define_insn "*<shift><mode>3"
8397 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8398 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8399 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")))]
8402 s<lr>l<g>\t%0,<1>%Y2
8403 s<lr>l<gk>\t%0,%1,%Y2"
8404 [(set_attr "op_type" "RS<E>,RSY")
8405 (set_attr "atype" "reg,reg")
8406 (set_attr "cpu_facility" "*,z196")
8407 (set_attr "z10prop" "z10_super_E1,*")])
8410 (define_insn "*<shift>di3_31_and"
8411 [(set (match_operand:DI 0 "register_operand" "=d")
8412 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
8413 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8414 (match_operand:SI 3 "const_int_operand" "n"))))]
8415 "!TARGET_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8417 [(set_attr "op_type" "RS")
8418 (set_attr "atype" "reg")])
8420 ; sll, srl, sllg, srlg, sllk, srlk
8421 (define_insn "*<shift><mode>3_and"
8422 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8423 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8424 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8425 (match_operand:SI 3 "const_int_operand" "n,n"))))]
8426 "(INTVAL (operands[3]) & 63) == 63"
8428 s<lr>l<g>\t%0,<1>%Y2
8429 s<lr>l<gk>\t%0,%1,%Y2"
8430 [(set_attr "op_type" "RS<E>,RSY")
8431 (set_attr "atype" "reg,reg")
8432 (set_attr "cpu_facility" "*,z196")
8433 (set_attr "z10prop" "z10_super_E1,*")])
8436 ; ashr(di|si)3 instruction pattern(s).
8437 ; Arithmetic right shifts
8439 (define_expand "ashr<mode>3"
8441 [(set (match_operand:DSI 0 "register_operand" "")
8442 (ashiftrt:DSI (match_operand:DSI 1 "register_operand" "")
8443 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))
8444 (clobber (reg:CC CC_REGNUM))])]
8448 (define_insn "*ashrdi3_cc_31"
8449 [(set (reg CC_REGNUM)
8450 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8451 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
8453 (set (match_operand:DI 0 "register_operand" "=d")
8454 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8455 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)"
8457 [(set_attr "op_type" "RS")
8458 (set_attr "atype" "reg")])
8460 (define_insn "*ashrdi3_cconly_31"
8461 [(set (reg CC_REGNUM)
8462 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8463 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
8465 (clobber (match_scratch:DI 0 "=d"))]
8466 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)"
8468 [(set_attr "op_type" "RS")
8469 (set_attr "atype" "reg")])
8471 (define_insn "*ashrdi3_31"
8472 [(set (match_operand:DI 0 "register_operand" "=d")
8473 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8474 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))
8475 (clobber (reg:CC CC_REGNUM))]
8478 [(set_attr "op_type" "RS")
8479 (set_attr "atype" "reg")])
8482 (define_insn "*ashr<mode>3_cc"
8483 [(set (reg CC_REGNUM)
8484 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8485 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y"))
8487 (set (match_operand:GPR 0 "register_operand" "=d,d")
8488 (ashiftrt:GPR (match_dup 1) (match_dup 2)))]
8489 "s390_match_ccmode(insn, CCSmode)"
8493 [(set_attr "op_type" "RS<E>,RSY")
8494 (set_attr "atype" "reg,reg")
8495 (set_attr "cpu_facility" "*,z196")
8496 (set_attr "z10prop" "z10_super_E1,*")])
8499 (define_insn "*ashr<mode>3_cconly"
8500 [(set (reg CC_REGNUM)
8501 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8502 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y"))
8504 (clobber (match_scratch:GPR 0 "=d,d"))]
8505 "s390_match_ccmode(insn, CCSmode)"
8509 [(set_attr "op_type" "RS<E>,RSY")
8510 (set_attr "atype" "reg,reg")
8511 (set_attr "cpu_facility" "*,z196")
8512 (set_attr "z10prop" "z10_super_E1,*")])
8515 (define_insn "*ashr<mode>3"
8516 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8517 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8518 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")))
8519 (clobber (reg:CC CC_REGNUM))]
8524 [(set_attr "op_type" "RS<E>,RSY")
8525 (set_attr "atype" "reg,reg")
8526 (set_attr "cpu_facility" "*,z196")
8527 (set_attr "z10prop" "z10_super_E1,*")])
8530 ; shift pattern with implicit ANDs
8532 (define_insn "*ashrdi3_cc_31_and"
8533 [(set (reg CC_REGNUM)
8534 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8535 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8536 (match_operand:SI 3 "const_int_operand" "n")))
8538 (set (match_operand:DI 0 "register_operand" "=d")
8539 (ashiftrt:DI (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
8540 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)
8541 && (INTVAL (operands[3]) & 63) == 63"
8543 [(set_attr "op_type" "RS")
8544 (set_attr "atype" "reg")])
8546 (define_insn "*ashrdi3_cconly_31_and"
8547 [(set (reg CC_REGNUM)
8548 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8549 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8550 (match_operand:SI 3 "const_int_operand" "n")))
8552 (clobber (match_scratch:DI 0 "=d"))]
8553 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)
8554 && (INTVAL (operands[3]) & 63) == 63"
8556 [(set_attr "op_type" "RS")
8557 (set_attr "atype" "reg")])
8559 (define_insn "*ashrdi3_31_and"
8560 [(set (match_operand:DI 0 "register_operand" "=d")
8561 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8562 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8563 (match_operand:SI 3 "const_int_operand" "n"))))
8564 (clobber (reg:CC CC_REGNUM))]
8565 "!TARGET_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8567 [(set_attr "op_type" "RS")
8568 (set_attr "atype" "reg")])
8571 (define_insn "*ashr<mode>3_cc_and"
8572 [(set (reg CC_REGNUM)
8573 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8574 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8575 (match_operand:SI 3 "const_int_operand" "n,n")))
8577 (set (match_operand:GPR 0 "register_operand" "=d,d")
8578 (ashiftrt:GPR (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
8579 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
8583 [(set_attr "op_type" "RS<E>,RSY")
8584 (set_attr "atype" "reg,reg")
8585 (set_attr "cpu_facility" "*,z196")
8586 (set_attr "z10prop" "z10_super_E1,*")])
8589 (define_insn "*ashr<mode>3_cconly_and"
8590 [(set (reg CC_REGNUM)
8591 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8592 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8593 (match_operand:SI 3 "const_int_operand" "n,n")))
8595 (clobber (match_scratch:GPR 0 "=d,d"))]
8596 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
8600 [(set_attr "op_type" "RS<E>,RSY")
8601 (set_attr "atype" "reg,reg")
8602 (set_attr "cpu_facility" "*,z196")
8603 (set_attr "z10prop" "z10_super_E1,*")])
8606 (define_insn "*ashr<mode>3_and"
8607 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8608 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8609 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8610 (match_operand:SI 3 "const_int_operand" "n,n"))))
8611 (clobber (reg:CC CC_REGNUM))]
8612 "(INTVAL (operands[3]) & 63) == 63"
8616 [(set_attr "op_type" "RS<E>,RSY")
8617 (set_attr "atype" "reg,reg")
8618 (set_attr "cpu_facility" "*,z196")
8619 (set_attr "z10prop" "z10_super_E1,*")])
8623 ;; Branch instruction patterns.
8626 (define_expand "cbranch<mode>4"
8628 (if_then_else (match_operator 0 "comparison_operator"
8629 [(match_operand:GPR 1 "register_operand" "")
8630 (match_operand:GPR 2 "general_operand" "")])
8631 (label_ref (match_operand 3 "" ""))
8634 "s390_emit_jump (operands[3],
8635 s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2]));
8638 (define_expand "cbranch<mode>4"
8640 (if_then_else (match_operator 0 "comparison_operator"
8641 [(match_operand:FP 1 "register_operand" "")
8642 (match_operand:FP 2 "general_operand" "")])
8643 (label_ref (match_operand 3 "" ""))
8646 "s390_emit_jump (operands[3],
8647 s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2]));
8650 (define_expand "cbranchcc4"
8652 (if_then_else (match_operator 0 "s390_comparison"
8653 [(match_operand 1 "cc_reg_operand" "")
8654 (match_operand 2 "const_int_operand" "")])
8655 (label_ref (match_operand 3 "" ""))
8662 ;;- Conditional jump instructions.
8665 (define_insn "*cjump_64"
8668 (match_operator 1 "s390_comparison" [(reg CC_REGNUM)
8669 (match_operand 2 "const_int_operand" "")])
8670 (label_ref (match_operand 0 "" ""))
8674 if (get_attr_length (insn) == 4)
8677 return "jg%C1\t%l0";
8679 [(set_attr "op_type" "RI")
8680 (set_attr "type" "branch")
8681 (set (attr "length")
8682 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8683 (const_int 4) (const_int 6)))])
8685 (define_insn "*cjump_31"
8688 (match_operator 1 "s390_comparison" [(reg CC_REGNUM)
8689 (match_operand 2 "const_int_operand" "")])
8690 (label_ref (match_operand 0 "" ""))
8694 gcc_assert (get_attr_length (insn) == 4);
8697 [(set_attr "op_type" "RI")
8698 (set_attr "type" "branch")
8699 (set (attr "length")
8700 (if_then_else (not (match_test "flag_pic"))
8701 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8702 (const_int 4) (const_int 6))
8703 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8704 (const_int 4) (const_int 8))))])
8706 (define_insn "*cjump_long"
8709 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8710 (match_operand 0 "address_operand" "ZQZR")
8714 if (get_attr_op_type (insn) == OP_TYPE_RR)
8719 [(set (attr "op_type")
8720 (if_then_else (match_operand 0 "register_operand" "")
8721 (const_string "RR") (const_string "RX")))
8722 (set_attr "type" "branch")
8723 (set_attr "atype" "agen")])
8725 ;; A conditional return instruction.
8726 (define_insn "*c<code>"
8729 (match_operator 0 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8732 "s390_can_use_<code>_insn ()"
8734 [(set_attr "op_type" "RR")
8735 (set_attr "type" "jsr")
8736 (set_attr "atype" "agen")])
8739 ;;- Negated conditional jump instructions.
8742 (define_insn "*icjump_64"
8745 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8747 (label_ref (match_operand 0 "" ""))))]
8750 if (get_attr_length (insn) == 4)
8753 return "jg%D1\t%l0";
8755 [(set_attr "op_type" "RI")
8756 (set_attr "type" "branch")
8757 (set (attr "length")
8758 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8759 (const_int 4) (const_int 6)))])
8761 (define_insn "*icjump_31"
8764 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8766 (label_ref (match_operand 0 "" ""))))]
8769 gcc_assert (get_attr_length (insn) == 4);
8772 [(set_attr "op_type" "RI")
8773 (set_attr "type" "branch")
8774 (set (attr "length")
8775 (if_then_else (not (match_test "flag_pic"))
8776 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8777 (const_int 4) (const_int 6))
8778 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8779 (const_int 4) (const_int 8))))])
8781 (define_insn "*icjump_long"
8784 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8786 (match_operand 0 "address_operand" "ZQZR")))]
8789 if (get_attr_op_type (insn) == OP_TYPE_RR)
8794 [(set (attr "op_type")
8795 (if_then_else (match_operand 0 "register_operand" "")
8796 (const_string "RR") (const_string "RX")))
8797 (set_attr "type" "branch")
8798 (set_attr "atype" "agen")])
8801 ;;- Trap instructions.
8805 [(trap_if (const_int 1) (const_int 0))]
8808 [(set_attr "op_type" "RI")
8809 (set_attr "type" "branch")])
8811 (define_expand "ctrap<mode>4"
8812 [(trap_if (match_operator 0 "comparison_operator"
8813 [(match_operand:GPR 1 "register_operand" "")
8814 (match_operand:GPR 2 "general_operand" "")])
8815 (match_operand 3 "const0_operand" ""))]
8818 rtx cond = s390_emit_compare (GET_CODE (operands[0]),
8819 operands[1], operands[2]);
8820 emit_insn (gen_condtrap (cond, XEXP (cond, 0)));
8824 (define_expand "ctrap<mode>4"
8825 [(trap_if (match_operator 0 "comparison_operator"
8826 [(match_operand:FP 1 "register_operand" "")
8827 (match_operand:FP 2 "general_operand" "")])
8828 (match_operand 3 "const0_operand" ""))]
8831 rtx cond = s390_emit_compare (GET_CODE (operands[0]),
8832 operands[1], operands[2]);
8833 emit_insn (gen_condtrap (cond, XEXP (cond, 0)));
8837 (define_insn "condtrap"
8838 [(trap_if (match_operator 0 "s390_comparison"
8839 [(match_operand 1 "cc_reg_operand" "c")
8844 [(set_attr "op_type" "RI")
8845 (set_attr "type" "branch")])
8847 ; crt, cgrt, cit, cgit
8848 (define_insn "*cmp_and_trap_signed_int<mode>"
8849 [(trap_if (match_operator 0 "s390_signed_integer_comparison"
8850 [(match_operand:GPR 1 "register_operand" "d,d")
8851 (match_operand:GPR 2 "nonmemory_operand" "d,K")])
8857 [(set_attr "op_type" "RRF,RIE")
8858 (set_attr "type" "branch")
8859 (set_attr "z10prop" "z10_super_c,z10_super")])
8861 ; clrt, clgrt, clfit, clgit, clt, clgt
8862 (define_insn "*cmp_and_trap_unsigned_int<mode>"
8863 [(trap_if (match_operator 0 "s390_unsigned_integer_comparison"
8864 [(match_operand:GPR 1 "register_operand" "d,d, d")
8865 (match_operand:GPR 2 "general_operand" "d,D,RT")])
8872 [(set_attr "op_type" "RRF,RIE,RSY")
8873 (set_attr "type" "branch")
8874 (set_attr "z10prop" "z10_super_c,z10_super,*")
8875 (set_attr "cpu_facility" "z10,z10,zEC12")])
8878 (define_insn "*load_and_trap<mode>"
8879 [(trap_if (eq (match_operand:GPR 0 "memory_operand" "RT")
8882 (set (match_operand:GPR 1 "register_operand" "=d")
8886 [(set_attr "op_type" "RXY")])
8890 ;;- Loop instructions.
8892 ;; This is all complicated by the fact that since this is a jump insn
8893 ;; we must handle our own output reloads.
8897 ; This splitter will be matched by combine and has to add the 2 moves
8898 ; necessary to load the compare and the increment values into a
8899 ; register pair as needed by brxle.
8901 (define_insn_and_split "*brx_stage1_<GPR:mode>"
8904 (match_operator 6 "s390_brx_operator"
8905 [(plus:GPR (match_operand:GPR 1 "register_operand" "")
8906 (match_operand:GPR 2 "general_operand" ""))
8907 (match_operand:GPR 3 "register_operand" "")])
8908 (label_ref (match_operand 0 "" ""))
8910 (set (match_operand:GPR 4 "nonimmediate_operand" "")
8911 (plus:GPR (match_dup 1) (match_dup 2)))
8912 (clobber (match_scratch:GPR 5 ""))]
8915 "!reload_completed && !reload_in_progress"
8916 [(set (match_dup 7) (match_dup 2)) ; the increment
8917 (set (match_dup 8) (match_dup 3)) ; the comparison value
8918 (parallel [(set (pc)
8921 [(plus:GPR (match_dup 1) (match_dup 7))
8923 (label_ref (match_dup 0))
8926 (plus:GPR (match_dup 1) (match_dup 7)))
8927 (clobber (match_dup 5))
8928 (clobber (reg:CC CC_REGNUM))])]
8930 rtx dreg = gen_reg_rtx (word_mode == DImode ? TImode : DImode);
8931 operands[7] = gen_lowpart (<GPR:MODE>mode,
8932 gen_highpart (word_mode, dreg));
8933 operands[8] = gen_lowpart (<GPR:MODE>mode,
8934 gen_lowpart (word_mode, dreg));
8939 (define_insn_and_split "*brxg_64bit"
8942 (match_operator 5 "s390_brx_operator"
8943 [(plus:DI (match_operand:DI 1 "register_operand" "d,d,d")
8944 (subreg:DI (match_operand:TI 2 "register_operand" "d,d,d") 0))
8945 (subreg:DI (match_dup 2) 8)])
8946 (label_ref (match_operand 0 "" ""))
8948 (set (match_operand:DI 3 "nonimmediate_operand" "=1,?X,?X")
8949 (plus:DI (match_dup 1)
8950 (subreg:DI (match_dup 2) 0)))
8951 (clobber (match_scratch:DI 4 "=X,&1,&?d"))
8952 (clobber (reg:CC CC_REGNUM))]
8955 if (which_alternative != 0)
8957 else if (get_attr_length (insn) == 6)
8958 return "brx%E5g\t%1,%2,%l0";
8960 return "agr\t%1,%2\;cgr\t%1,%M2\;jg%C5\t%l0";
8962 "&& reload_completed
8963 && (!REG_P (operands[3])
8964 || !rtx_equal_p (operands[1], operands[3]))"
8965 [(set (match_dup 4) (match_dup 1))
8966 (parallel [(set (match_dup 4) (plus:DI (match_dup 4) (subreg:DI (match_dup 2) 0)))
8967 (clobber (reg:CC CC_REGNUM))])
8968 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:DI (match_dup 2) 8)))
8969 (set (match_dup 3) (match_dup 4))
8970 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
8971 (label_ref (match_dup 0))
8974 [(set_attr "op_type" "RIE")
8975 (set_attr "type" "branch")
8976 (set (attr "length")
8977 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8978 (const_int 6) (const_int 16)))])
8982 (define_insn_and_split "*brx_64bit"
8985 (match_operator 5 "s390_brx_operator"
8986 [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d")
8987 (subreg:SI (match_operand:TI 2 "register_operand" "d,d,d") 4))
8988 (subreg:SI (match_dup 2) 12)])
8989 (label_ref (match_operand 0 "" ""))
8991 (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X")
8992 (plus:SI (match_dup 1)
8993 (subreg:SI (match_dup 2) 4)))
8994 (clobber (match_scratch:SI 4 "=X,&1,&?d"))
8995 (clobber (reg:CC CC_REGNUM))]
8998 if (which_alternative != 0)
9000 else if (get_attr_length (insn) == 6)
9001 return "brx%C5\t%1,%2,%l0";
9003 return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0";
9005 "&& reload_completed
9006 && (!REG_P (operands[3])
9007 || !rtx_equal_p (operands[1], operands[3]))"
9008 [(set (match_dup 4) (match_dup 1))
9009 (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 4)))
9010 (clobber (reg:CC CC_REGNUM))])
9011 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 12)))
9012 (set (match_dup 3) (match_dup 4))
9013 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
9014 (label_ref (match_dup 0))
9017 [(set_attr "op_type" "RSI")
9018 (set_attr "type" "branch")
9019 (set (attr "length")
9020 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9021 (const_int 6) (const_int 14)))])
9025 (define_insn_and_split "*brx_31bit"
9028 (match_operator 5 "s390_brx_operator"
9029 [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d")
9030 (subreg:SI (match_operand:DI 2 "register_operand" "d,d,d") 0))
9031 (subreg:SI (match_dup 2) 4)])
9032 (label_ref (match_operand 0 "" ""))
9034 (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X")
9035 (plus:SI (match_dup 1)
9036 (subreg:SI (match_dup 2) 0)))
9037 (clobber (match_scratch:SI 4 "=X,&1,&?d"))
9038 (clobber (reg:CC CC_REGNUM))]
9039 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
9041 if (which_alternative != 0)
9043 else if (get_attr_length (insn) == 6)
9044 return "brx%C5\t%1,%2,%l0";
9046 return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0";
9048 "&& reload_completed
9049 && (!REG_P (operands[3])
9050 || !rtx_equal_p (operands[1], operands[3]))"
9051 [(set (match_dup 4) (match_dup 1))
9052 (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 0)))
9053 (clobber (reg:CC CC_REGNUM))])
9054 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 4)))
9055 (set (match_dup 3) (match_dup 4))
9056 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
9057 (label_ref (match_dup 0))
9060 [(set_attr "op_type" "RSI")
9061 (set_attr "type" "branch")
9062 (set (attr "length")
9063 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9064 (const_int 6) (const_int 14)))])
9069 (define_expand "doloop_end"
9070 [(use (match_operand 0 "" "")) ; loop pseudo
9071 (use (match_operand 1 "" ""))] ; label
9074 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
9075 emit_jump_insn (gen_doloop_si31 (operands[1], operands[0], operands[0]));
9076 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
9077 emit_jump_insn (gen_doloop_si64 (operands[1], operands[0], operands[0]));
9078 else if (GET_MODE (operands[0]) == DImode && TARGET_ZARCH)
9079 emit_jump_insn (gen_doloop_di (operands[1], operands[0], operands[0]));
9086 (define_insn_and_split "doloop_si64"
9089 (ne (match_operand:SI 1 "register_operand" "d,d,d")
9091 (label_ref (match_operand 0 "" ""))
9093 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?X,?X")
9094 (plus:SI (match_dup 1) (const_int -1)))
9095 (clobber (match_scratch:SI 3 "=X,&1,&?d"))
9096 (clobber (reg:CC CC_REGNUM))]
9099 if (which_alternative != 0)
9101 else if (get_attr_length (insn) == 4)
9102 return "brct\t%1,%l0";
9104 return "ahi\t%1,-1\;jgne\t%l0";
9106 "&& reload_completed
9107 && (! REG_P (operands[2])
9108 || ! rtx_equal_p (operands[1], operands[2]))"
9109 [(set (match_dup 3) (match_dup 1))
9110 (parallel [(set (reg:CCAN CC_REGNUM)
9111 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
9113 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
9114 (set (match_dup 2) (match_dup 3))
9115 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9116 (label_ref (match_dup 0))
9119 [(set_attr "op_type" "RI")
9120 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9121 ; hurt us in the (rare) case of ahi.
9122 (set_attr "z10prop" "z10_super_E1")
9123 (set_attr "type" "branch")
9124 (set (attr "length")
9125 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9126 (const_int 4) (const_int 10)))])
9128 (define_insn_and_split "doloop_si31"
9131 (ne (match_operand:SI 1 "register_operand" "d,d,d")
9133 (label_ref (match_operand 0 "" ""))
9135 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?X,?X")
9136 (plus:SI (match_dup 1) (const_int -1)))
9137 (clobber (match_scratch:SI 3 "=X,&1,&?d"))
9138 (clobber (reg:CC CC_REGNUM))]
9141 if (which_alternative != 0)
9143 else if (get_attr_length (insn) == 4)
9144 return "brct\t%1,%l0";
9148 "&& reload_completed
9149 && (! REG_P (operands[2])
9150 || ! rtx_equal_p (operands[1], operands[2]))"
9151 [(set (match_dup 3) (match_dup 1))
9152 (parallel [(set (reg:CCAN CC_REGNUM)
9153 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
9155 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
9156 (set (match_dup 2) (match_dup 3))
9157 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9158 (label_ref (match_dup 0))
9161 [(set_attr "op_type" "RI")
9162 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9163 ; hurt us in the (rare) case of ahi.
9164 (set_attr "z10prop" "z10_super_E1")
9165 (set_attr "type" "branch")
9166 (set (attr "length")
9167 (if_then_else (not (match_test "flag_pic"))
9168 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9169 (const_int 4) (const_int 6))
9170 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9171 (const_int 4) (const_int 8))))])
9173 (define_insn "*doloop_si_long"
9176 (ne (match_operand:SI 1 "register_operand" "d")
9178 (match_operand 0 "address_operand" "ZQZR")
9180 (set (match_operand:SI 2 "register_operand" "=1")
9181 (plus:SI (match_dup 1) (const_int -1)))
9182 (clobber (match_scratch:SI 3 "=X"))
9183 (clobber (reg:CC CC_REGNUM))]
9186 if (get_attr_op_type (insn) == OP_TYPE_RR)
9187 return "bctr\t%1,%0";
9189 return "bct\t%1,%a0";
9191 [(set (attr "op_type")
9192 (if_then_else (match_operand 0 "register_operand" "")
9193 (const_string "RR") (const_string "RX")))
9194 (set_attr "type" "branch")
9195 (set_attr "atype" "agen")
9196 (set_attr "z10prop" "z10_c")
9197 (set_attr "z196prop" "z196_cracked")])
9199 (define_insn_and_split "doloop_di"
9202 (ne (match_operand:DI 1 "register_operand" "d,d,d")
9204 (label_ref (match_operand 0 "" ""))
9206 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?X,?X")
9207 (plus:DI (match_dup 1) (const_int -1)))
9208 (clobber (match_scratch:DI 3 "=X,&1,&?d"))
9209 (clobber (reg:CC CC_REGNUM))]
9212 if (which_alternative != 0)
9214 else if (get_attr_length (insn) == 4)
9215 return "brctg\t%1,%l0";
9217 return "aghi\t%1,-1\;jgne\t%l0";
9219 "&& reload_completed
9220 && (! REG_P (operands[2])
9221 || ! rtx_equal_p (operands[1], operands[2]))"
9222 [(set (match_dup 3) (match_dup 1))
9223 (parallel [(set (reg:CCAN CC_REGNUM)
9224 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
9226 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
9227 (set (match_dup 2) (match_dup 3))
9228 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9229 (label_ref (match_dup 0))
9232 [(set_attr "op_type" "RI")
9233 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9234 ; hurt us in the (rare) case of ahi.
9235 (set_attr "z10prop" "z10_super_E1")
9236 (set_attr "type" "branch")
9237 (set (attr "length")
9238 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9239 (const_int 4) (const_int 10)))])
9242 ;;- Unconditional jump instructions.
9246 ; jump instruction pattern(s).
9249 (define_expand "jump"
9250 [(match_operand 0 "" "")]
9252 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
9254 (define_insn "*jump64"
9255 [(set (pc) (label_ref (match_operand 0 "" "")))]
9258 if (get_attr_length (insn) == 4)
9263 [(set_attr "op_type" "RI")
9264 (set_attr "type" "branch")
9265 (set (attr "length")
9266 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9267 (const_int 4) (const_int 6)))])
9269 (define_insn "*jump31"
9270 [(set (pc) (label_ref (match_operand 0 "" "")))]
9273 gcc_assert (get_attr_length (insn) == 4);
9276 [(set_attr "op_type" "RI")
9277 (set_attr "type" "branch")
9278 (set (attr "length")
9279 (if_then_else (not (match_test "flag_pic"))
9280 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9281 (const_int 4) (const_int 6))
9282 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9283 (const_int 4) (const_int 8))))])
9286 ; indirect-jump instruction pattern(s).
9289 (define_insn "indirect_jump"
9290 [(set (pc) (match_operand 0 "address_operand" "ZQZR"))]
9293 if (get_attr_op_type (insn) == OP_TYPE_RR)
9298 [(set (attr "op_type")
9299 (if_then_else (match_operand 0 "register_operand" "")
9300 (const_string "RR") (const_string "RX")))
9301 (set_attr "type" "branch")
9302 (set_attr "atype" "agen")])
9305 ; casesi instruction pattern(s).
9308 (define_insn "casesi_jump"
9309 [(set (pc) (match_operand 0 "address_operand" "ZQZR"))
9310 (use (label_ref (match_operand 1 "" "")))]
9313 if (get_attr_op_type (insn) == OP_TYPE_RR)
9318 [(set (attr "op_type")
9319 (if_then_else (match_operand 0 "register_operand" "")
9320 (const_string "RR") (const_string "RX")))
9321 (set_attr "type" "branch")
9322 (set_attr "atype" "agen")])
9324 (define_expand "casesi"
9325 [(match_operand:SI 0 "general_operand" "")
9326 (match_operand:SI 1 "general_operand" "")
9327 (match_operand:SI 2 "general_operand" "")
9328 (label_ref (match_operand 3 "" ""))
9329 (label_ref (match_operand 4 "" ""))]
9332 rtx index = gen_reg_rtx (SImode);
9333 rtx base = gen_reg_rtx (Pmode);
9334 rtx target = gen_reg_rtx (Pmode);
9336 emit_move_insn (index, operands[0]);
9337 emit_insn (gen_subsi3 (index, index, operands[1]));
9338 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
9341 if (Pmode != SImode)
9342 index = convert_to_mode (Pmode, index, 1);
9343 if (GET_CODE (index) != REG)
9344 index = copy_to_mode_reg (Pmode, index);
9347 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
9349 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
9351 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
9353 index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
9354 emit_move_insn (target, index);
9357 target = gen_rtx_PLUS (Pmode, base, target);
9358 emit_jump_insn (gen_casesi_jump (target, operands[3]));
9365 ;;- Jump to subroutine.
9370 ; untyped call instruction pattern(s).
9373 ;; Call subroutine returning any type.
9374 (define_expand "untyped_call"
9375 [(parallel [(call (match_operand 0 "" "")
9377 (match_operand 1 "" "")
9378 (match_operand 2 "" "")])]
9383 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
9385 for (i = 0; i < XVECLEN (operands[2], 0); i++)
9387 rtx set = XVECEXP (operands[2], 0, i);
9388 emit_move_insn (SET_DEST (set), SET_SRC (set));
9391 /* The optimizer does not know that the call sets the function value
9392 registers we stored in the result block. We avoid problems by
9393 claiming that all hard registers are used and clobbered at this
9395 emit_insn (gen_blockage ());
9400 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
9401 ;; all of memory. This blocks insns from being moved across this point.
9403 (define_insn "blockage"
9404 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
9407 [(set_attr "type" "none")
9408 (set_attr "length" "0")])
9414 (define_expand "sibcall"
9415 [(call (match_operand 0 "" "")
9416 (match_operand 1 "" ""))]
9419 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
9423 (define_insn "*sibcall_br"
9424 [(call (mem:QI (reg SIBCALL_REGNUM))
9425 (match_operand 0 "const_int_operand" "n"))]
9426 "SIBLING_CALL_P (insn)
9427 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
9429 [(set_attr "op_type" "RR")
9430 (set_attr "type" "branch")
9431 (set_attr "atype" "agen")])
9433 (define_insn "*sibcall_brc"
9434 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9435 (match_operand 1 "const_int_operand" "n"))]
9436 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
9438 [(set_attr "op_type" "RI")
9439 (set_attr "type" "branch")])
9441 (define_insn "*sibcall_brcl"
9442 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9443 (match_operand 1 "const_int_operand" "n"))]
9444 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
9446 [(set_attr "op_type" "RIL")
9447 (set_attr "type" "branch")])
9450 ; sibcall_value patterns
9453 (define_expand "sibcall_value"
9454 [(set (match_operand 0 "" "")
9455 (call (match_operand 1 "" "")
9456 (match_operand 2 "" "")))]
9459 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
9463 (define_insn "*sibcall_value_br"
9464 [(set (match_operand 0 "" "")
9465 (call (mem:QI (reg SIBCALL_REGNUM))
9466 (match_operand 1 "const_int_operand" "n")))]
9467 "SIBLING_CALL_P (insn)
9468 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
9470 [(set_attr "op_type" "RR")
9471 (set_attr "type" "branch")
9472 (set_attr "atype" "agen")])
9474 (define_insn "*sibcall_value_brc"
9475 [(set (match_operand 0 "" "")
9476 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9477 (match_operand 2 "const_int_operand" "n")))]
9478 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
9480 [(set_attr "op_type" "RI")
9481 (set_attr "type" "branch")])
9483 (define_insn "*sibcall_value_brcl"
9484 [(set (match_operand 0 "" "")
9485 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9486 (match_operand 2 "const_int_operand" "n")))]
9487 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
9489 [(set_attr "op_type" "RIL")
9490 (set_attr "type" "branch")])
9494 ; call instruction pattern(s).
9497 (define_expand "call"
9498 [(call (match_operand 0 "" "")
9499 (match_operand 1 "" ""))
9500 (use (match_operand 2 "" ""))]
9503 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
9504 gen_rtx_REG (Pmode, RETURN_REGNUM));
9508 (define_insn "*bras"
9509 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9510 (match_operand 1 "const_int_operand" "n"))
9511 (clobber (match_operand 2 "register_operand" "=r"))]
9512 "!SIBLING_CALL_P (insn)
9513 && TARGET_SMALL_EXEC
9514 && GET_MODE (operands[2]) == Pmode"
9516 [(set_attr "op_type" "RI")
9517 (set_attr "type" "jsr")
9518 (set_attr "z196prop" "z196_cracked")])
9520 (define_insn "*brasl"
9521 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9522 (match_operand 1 "const_int_operand" "n"))
9523 (clobber (match_operand 2 "register_operand" "=r"))]
9524 "!SIBLING_CALL_P (insn)
9526 && GET_MODE (operands[2]) == Pmode"
9528 [(set_attr "op_type" "RIL")
9529 (set_attr "type" "jsr")
9530 (set_attr "z196prop" "z196_cracked")])
9532 (define_insn "*basr"
9533 [(call (mem:QI (match_operand 0 "address_operand" "ZQZR"))
9534 (match_operand 1 "const_int_operand" "n"))
9535 (clobber (match_operand 2 "register_operand" "=r"))]
9536 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
9538 if (get_attr_op_type (insn) == OP_TYPE_RR)
9539 return "basr\t%2,%0";
9541 return "bas\t%2,%a0";
9543 [(set (attr "op_type")
9544 (if_then_else (match_operand 0 "register_operand" "")
9545 (const_string "RR") (const_string "RX")))
9546 (set_attr "type" "jsr")
9547 (set_attr "atype" "agen")
9548 (set_attr "z196prop" "z196_cracked")])
9551 ; call_value instruction pattern(s).
9554 (define_expand "call_value"
9555 [(set (match_operand 0 "" "")
9556 (call (match_operand 1 "" "")
9557 (match_operand 2 "" "")))
9558 (use (match_operand 3 "" ""))]
9561 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
9562 gen_rtx_REG (Pmode, RETURN_REGNUM));
9566 (define_insn "*bras_r"
9567 [(set (match_operand 0 "" "")
9568 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9569 (match_operand:SI 2 "const_int_operand" "n")))
9570 (clobber (match_operand 3 "register_operand" "=r"))]
9571 "!SIBLING_CALL_P (insn)
9572 && TARGET_SMALL_EXEC
9573 && GET_MODE (operands[3]) == Pmode"
9575 [(set_attr "op_type" "RI")
9576 (set_attr "type" "jsr")
9577 (set_attr "z196prop" "z196_cracked")])
9579 (define_insn "*brasl_r"
9580 [(set (match_operand 0 "" "")
9581 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9582 (match_operand 2 "const_int_operand" "n")))
9583 (clobber (match_operand 3 "register_operand" "=r"))]
9584 "!SIBLING_CALL_P (insn)
9586 && GET_MODE (operands[3]) == Pmode"
9588 [(set_attr "op_type" "RIL")
9589 (set_attr "type" "jsr")
9590 (set_attr "z196prop" "z196_cracked")])
9592 (define_insn "*basr_r"
9593 [(set (match_operand 0 "" "")
9594 (call (mem:QI (match_operand 1 "address_operand" "ZQZR"))
9595 (match_operand 2 "const_int_operand" "n")))
9596 (clobber (match_operand 3 "register_operand" "=r"))]
9597 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
9599 if (get_attr_op_type (insn) == OP_TYPE_RR)
9600 return "basr\t%3,%1";
9602 return "bas\t%3,%a1";
9604 [(set (attr "op_type")
9605 (if_then_else (match_operand 1 "register_operand" "")
9606 (const_string "RR") (const_string "RX")))
9607 (set_attr "type" "jsr")
9608 (set_attr "atype" "agen")
9609 (set_attr "z196prop" "z196_cracked")])
9612 ;;- Thread-local storage support.
9615 (define_expand "get_thread_pointer<mode>"
9616 [(set (match_operand:P 0 "nonimmediate_operand" "") (reg:P TP_REGNUM))]
9620 (define_expand "set_thread_pointer<mode>"
9621 [(set (reg:P TP_REGNUM) (match_operand:P 0 "nonimmediate_operand" ""))
9622 (set (reg:P TP_REGNUM) (unspec_volatile:P [(reg:P TP_REGNUM)] UNSPECV_SET_TP))]
9626 (define_insn "*set_tp"
9627 [(set (reg TP_REGNUM) (unspec_volatile [(reg TP_REGNUM)] UNSPECV_SET_TP))]
9630 [(set_attr "type" "none")
9631 (set_attr "length" "0")])
9633 (define_insn "*tls_load_64"
9634 [(set (match_operand:DI 0 "register_operand" "=d")
9635 (unspec:DI [(match_operand:DI 1 "memory_operand" "RT")
9636 (match_operand:DI 2 "" "")]
9640 [(set_attr "op_type" "RXE")
9641 (set_attr "z10prop" "z10_fwd_A3")])
9643 (define_insn "*tls_load_31"
9644 [(set (match_operand:SI 0 "register_operand" "=d,d")
9645 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
9646 (match_operand:SI 2 "" "")]
9652 [(set_attr "op_type" "RX,RXY")
9653 (set_attr "type" "load")
9654 (set_attr "z10prop" "z10_fwd_A3,z10_fwd_A3")])
9656 (define_insn "*bras_tls"
9657 [(set (match_operand 0 "" "")
9658 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9659 (match_operand 2 "const_int_operand" "n")))
9660 (clobber (match_operand 3 "register_operand" "=r"))
9661 (use (match_operand 4 "" ""))]
9662 "!SIBLING_CALL_P (insn)
9663 && TARGET_SMALL_EXEC
9664 && GET_MODE (operands[3]) == Pmode"
9666 [(set_attr "op_type" "RI")
9667 (set_attr "type" "jsr")
9668 (set_attr "z196prop" "z196_cracked")])
9670 (define_insn "*brasl_tls"
9671 [(set (match_operand 0 "" "")
9672 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9673 (match_operand 2 "const_int_operand" "n")))
9674 (clobber (match_operand 3 "register_operand" "=r"))
9675 (use (match_operand 4 "" ""))]
9676 "!SIBLING_CALL_P (insn)
9678 && GET_MODE (operands[3]) == Pmode"
9680 [(set_attr "op_type" "RIL")
9681 (set_attr "type" "jsr")
9682 (set_attr "z196prop" "z196_cracked")])
9684 (define_insn "*basr_tls"
9685 [(set (match_operand 0 "" "")
9686 (call (mem:QI (match_operand 1 "address_operand" "ZQZR"))
9687 (match_operand 2 "const_int_operand" "n")))
9688 (clobber (match_operand 3 "register_operand" "=r"))
9689 (use (match_operand 4 "" ""))]
9690 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
9692 if (get_attr_op_type (insn) == OP_TYPE_RR)
9693 return "basr\t%3,%1%J4";
9695 return "bas\t%3,%a1%J4";
9697 [(set (attr "op_type")
9698 (if_then_else (match_operand 1 "register_operand" "")
9699 (const_string "RR") (const_string "RX")))
9700 (set_attr "type" "jsr")
9701 (set_attr "atype" "agen")
9702 (set_attr "z196prop" "z196_cracked")])
9705 ;;- Atomic operations
9709 ; memory barrier patterns.
9712 (define_expand "mem_signal_fence"
9713 [(match_operand:SI 0 "const_int_operand")] ;; model
9716 /* The s390 memory model is strong enough not to require any
9717 barrier in order to synchronize a thread with itself. */
9721 (define_expand "mem_thread_fence"
9722 [(match_operand:SI 0 "const_int_operand")] ;; model
9725 /* Unless this is a SEQ_CST fence, the s390 memory model is strong
9726 enough not to require barriers of any kind. */
9727 if (is_mm_seq_cst (memmodel_from_int (INTVAL (operands[0]))))
9729 rtx mem = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
9730 MEM_VOLATILE_P (mem) = 1;
9731 emit_insn (gen_mem_thread_fence_1 (mem));
9736 ; Although bcr is superscalar on Z10, this variant will never
9737 ; become part of an execution group.
9738 ; With z196 we can make use of the fast-BCR-serialization facility.
9739 ; This allows for a slightly faster sync which is sufficient for our
9741 (define_insn "mem_thread_fence_1"
9742 [(set (match_operand:BLK 0 "" "")
9743 (unspec:BLK [(match_dup 0)] UNSPEC_MB))]
9751 [(set_attr "op_type" "RR")
9752 (set_attr "mnemonic" "bcr_flush")
9753 (set_attr "z196prop" "z196_alone")])
9756 ; atomic load/store operations
9759 ; Atomic loads need not examine the memory model at all.
9760 (define_expand "atomic_load<mode>"
9761 [(match_operand:DINT 0 "register_operand") ;; output
9762 (match_operand:DINT 1 "memory_operand") ;; memory
9763 (match_operand:SI 2 "const_int_operand")] ;; model
9766 if (MEM_ALIGN (operands[1]) < GET_MODE_BITSIZE (GET_MODE (operands[1])))
9769 if (<MODE>mode == TImode)
9770 emit_insn (gen_atomic_loadti_1 (operands[0], operands[1]));
9771 else if (<MODE>mode == DImode && !TARGET_ZARCH)
9772 emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1]));
9774 emit_move_insn (operands[0], operands[1]);
9778 ; Different from movdi_31 in that we want no splitters.
9779 (define_insn "atomic_loaddi_1"
9780 [(set (match_operand:DI 0 "register_operand" "=d,d,!*f,!*f")
9781 (unspec:DI [(match_operand:DI 1 "memory_operand" "Q,S,R,T")]
9789 [(set_attr "op_type" "RS,RSY,RS,RSY")
9790 (set_attr "type" "lm,lm,floaddf,floaddf")])
9792 (define_insn "atomic_loadti_1"
9793 [(set (match_operand:TI 0 "register_operand" "=r")
9794 (unspec:TI [(match_operand:TI 1 "memory_operand" "RT")]
9798 [(set_attr "op_type" "RXY")
9799 (set_attr "type" "other")])
9801 ; Atomic stores must(?) enforce sequential consistency.
9802 (define_expand "atomic_store<mode>"
9803 [(match_operand:DINT 0 "memory_operand") ;; memory
9804 (match_operand:DINT 1 "register_operand") ;; input
9805 (match_operand:SI 2 "const_int_operand")] ;; model
9808 enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
9810 if (MEM_ALIGN (operands[0]) < GET_MODE_BITSIZE (GET_MODE (operands[0])))
9813 if (<MODE>mode == TImode)
9814 emit_insn (gen_atomic_storeti_1 (operands[0], operands[1]));
9815 else if (<MODE>mode == DImode && !TARGET_ZARCH)
9816 emit_insn (gen_atomic_storedi_1 (operands[0], operands[1]));
9818 emit_move_insn (operands[0], operands[1]);
9819 if (is_mm_seq_cst (model))
9820 emit_insn (gen_mem_thread_fence (operands[2]));
9824 ; Different from movdi_31 in that we want no splitters.
9825 (define_insn "atomic_storedi_1"
9826 [(set (match_operand:DI 0 "memory_operand" "=Q,S,R,T")
9827 (unspec:DI [(match_operand:DI 1 "register_operand" "d,d,!*f,!*f")]
9835 [(set_attr "op_type" "RS,RSY,RS,RSY")
9836 (set_attr "type" "stm,stm,fstoredf,fstoredf")])
9838 (define_insn "atomic_storeti_1"
9839 [(set (match_operand:TI 0 "memory_operand" "=RT")
9840 (unspec:TI [(match_operand:TI 1 "register_operand" "r")]
9844 [(set_attr "op_type" "RXY")
9845 (set_attr "type" "other")])
9848 ; compare and swap patterns.
9851 (define_expand "atomic_compare_and_swap<mode>"
9852 [(match_operand:SI 0 "register_operand") ;; bool success output
9853 (match_operand:DGPR 1 "nonimmediate_operand");; oldval output
9854 (match_operand:DGPR 2 "memory_operand") ;; memory
9855 (match_operand:DGPR 3 "register_operand") ;; expected intput
9856 (match_operand:DGPR 4 "register_operand") ;; newval intput
9857 (match_operand:SI 5 "const_int_operand") ;; is_weak
9858 (match_operand:SI 6 "const_int_operand") ;; success model
9859 (match_operand:SI 7 "const_int_operand")] ;; failure model
9862 rtx cc, cmp, output = operands[1];
9864 if (!register_operand (output, <MODE>mode))
9865 output = gen_reg_rtx (<MODE>mode);
9867 if (MEM_ALIGN (operands[2]) < GET_MODE_BITSIZE (GET_MODE (operands[2])))
9870 emit_insn (gen_atomic_compare_and_swap<mode>_internal
9871 (output, operands[2], operands[3], operands[4]));
9873 /* We deliberately accept non-register operands in the predicate
9874 to ensure the write back to the output operand happens *before*
9875 the store-flags code below. This makes it easier for combine
9876 to merge the store-flags code with a potential test-and-branch
9877 pattern following (immediately!) afterwards. */
9878 if (output != operands[1])
9879 emit_move_insn (operands[1], output);
9881 cc = gen_rtx_REG (CCZ1mode, CC_REGNUM);
9882 cmp = gen_rtx_EQ (SImode, cc, const0_rtx);
9883 emit_insn (gen_cstorecc4 (operands[0], cmp, cc, const0_rtx));
9887 (define_expand "atomic_compare_and_swap<mode>"
9888 [(match_operand:SI 0 "register_operand") ;; bool success output
9889 (match_operand:HQI 1 "nonimmediate_operand") ;; oldval output
9890 (match_operand:HQI 2 "memory_operand") ;; memory
9891 (match_operand:HQI 3 "general_operand") ;; expected intput
9892 (match_operand:HQI 4 "general_operand") ;; newval intput
9893 (match_operand:SI 5 "const_int_operand") ;; is_weak
9894 (match_operand:SI 6 "const_int_operand") ;; success model
9895 (match_operand:SI 7 "const_int_operand")] ;; failure model
9898 s390_expand_cs_hqi (<MODE>mode, operands[0], operands[1], operands[2],
9899 operands[3], operands[4], INTVAL (operands[5]));
9903 (define_expand "atomic_compare_and_swap<mode>_internal"
9905 [(set (match_operand:DGPR 0 "register_operand")
9906 (match_operand:DGPR 1 "memory_operand"))
9908 (unspec_volatile:DGPR
9910 (match_operand:DGPR 2 "register_operand")
9911 (match_operand:DGPR 3 "register_operand")]
9913 (set (reg:CCZ1 CC_REGNUM)
9914 (compare:CCZ1 (match_dup 1) (match_dup 2)))])]
9918 (define_insn "*atomic_compare_and_swap<mode>_1"
9919 [(set (match_operand:TDI 0 "register_operand" "=r")
9920 (match_operand:TDI 1 "memory_operand" "+QS"))
9922 (unspec_volatile:TDI
9924 (match_operand:TDI 2 "register_operand" "0")
9925 (match_operand:TDI 3 "register_operand" "r")]
9927 (set (reg:CCZ1 CC_REGNUM)
9928 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9930 "c<td>sg\t%0,%3,%S1"
9931 [(set_attr "op_type" "RSY")
9932 (set_attr "type" "sem")])
9935 (define_insn "*atomic_compare_and_swapdi_2"
9936 [(set (match_operand:DI 0 "register_operand" "=r,r")
9937 (match_operand:DI 1 "memory_operand" "+Q,S"))
9941 (match_operand:DI 2 "register_operand" "0,0")
9942 (match_operand:DI 3 "register_operand" "r,r")]
9944 (set (reg:CCZ1 CC_REGNUM)
9945 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9950 [(set_attr "op_type" "RS,RSY")
9951 (set_attr "type" "sem")])
9954 (define_insn "*atomic_compare_and_swapsi_3"
9955 [(set (match_operand:SI 0 "register_operand" "=r,r")
9956 (match_operand:SI 1 "memory_operand" "+Q,S"))
9960 (match_operand:SI 2 "register_operand" "0,0")
9961 (match_operand:SI 3 "register_operand" "r,r")]
9963 (set (reg:CCZ1 CC_REGNUM)
9964 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9969 [(set_attr "op_type" "RS,RSY")
9970 (set_attr "type" "sem")])
9973 ; Other atomic instruction patterns.
9976 ; z196 load and add, xor, or and and instructions
9978 (define_expand "atomic_fetch_<atomic><mode>"
9979 [(match_operand:GPR 0 "register_operand") ;; val out
9981 (match_operand:GPR 1 "memory_operand") ;; memory
9982 (match_operand:GPR 2 "register_operand")) ;; val in
9983 (match_operand:SI 3 "const_int_operand")] ;; model
9986 if (MEM_ALIGN (operands[1]) < GET_MODE_BITSIZE (GET_MODE (operands[1])))
9989 emit_insn (gen_atomic_fetch_<atomic><mode>_iaf
9990 (operands[0], operands[1], operands[2]));
9994 ; lan, lang, lao, laog, lax, laxg, laa, laag
9995 (define_insn "atomic_fetch_<atomic><mode>_iaf"
9996 [(set (match_operand:GPR 0 "register_operand" "=d")
9997 (match_operand:GPR 1 "memory_operand" "+QS"))
9999 (unspec_volatile:GPR
10000 [(ATOMIC_Z196:GPR (match_dup 1)
10001 (match_operand:GPR 2 "general_operand" "d"))]
10002 UNSPECV_ATOMIC_OP))
10003 (clobber (reg:CC CC_REGNUM))]
10005 "la<noxa><g>\t%0,%2,%1"
10006 [(set_attr "op_type" "RSY")
10007 (set_attr "type" "sem")])
10009 ;; For SImode and larger, the optabs.c code will do just fine in
10010 ;; expanding a compare-and-swap loop. For QI/HImode, we can do
10011 ;; better by expanding our own loop.
10013 (define_expand "atomic_<atomic><mode>"
10015 (match_operand:HQI 0 "memory_operand") ;; memory
10016 (match_operand:HQI 1 "general_operand")) ;; val in
10017 (match_operand:SI 2 "const_int_operand")] ;; model
10020 s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0],
10021 operands[1], false);
10025 (define_expand "atomic_fetch_<atomic><mode>"
10026 [(match_operand:HQI 0 "register_operand") ;; val out
10028 (match_operand:HQI 1 "memory_operand") ;; memory
10029 (match_operand:HQI 2 "general_operand")) ;; val in
10030 (match_operand:SI 3 "const_int_operand")] ;; model
10033 s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
10034 operands[2], false);
10038 (define_expand "atomic_<atomic>_fetch<mode>"
10039 [(match_operand:HQI 0 "register_operand") ;; val out
10041 (match_operand:HQI 1 "memory_operand") ;; memory
10042 (match_operand:HQI 2 "general_operand")) ;; val in
10043 (match_operand:SI 3 "const_int_operand")] ;; model
10046 s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
10047 operands[2], true);
10051 (define_expand "atomic_exchange<mode>"
10052 [(match_operand:HQI 0 "register_operand") ;; val out
10053 (match_operand:HQI 1 "memory_operand") ;; memory
10054 (match_operand:HQI 2 "general_operand") ;; val in
10055 (match_operand:SI 3 "const_int_operand")] ;; model
10058 s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1],
10059 operands[2], false);
10064 ;;- Miscellaneous instructions.
10068 ; allocate stack instruction pattern(s).
10071 (define_expand "allocate_stack"
10072 [(match_operand 0 "general_operand" "")
10073 (match_operand 1 "general_operand" "")]
10076 rtx temp = gen_reg_rtx (Pmode);
10078 emit_move_insn (temp, s390_back_chain_rtx ());
10079 anti_adjust_stack (operands[1]);
10080 emit_move_insn (s390_back_chain_rtx (), temp);
10082 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10088 ; setjmp instruction pattern.
10091 (define_expand "builtin_setjmp_receiver"
10092 [(match_operand 0 "" "")]
10095 emit_insn (s390_load_got ());
10096 emit_use (pic_offset_table_rtx);
10100 ;; These patterns say how to save and restore the stack pointer. We need not
10101 ;; save the stack pointer at function level since we are careful to
10102 ;; preserve the backchain. At block level, we have to restore the backchain
10103 ;; when we restore the stack pointer.
10105 ;; For nonlocal gotos, we must save both the stack pointer and its
10106 ;; backchain and restore both. Note that in the nonlocal case, the
10107 ;; save area is a memory location.
10109 (define_expand "save_stack_function"
10110 [(match_operand 0 "general_operand" "")
10111 (match_operand 1 "general_operand" "")]
10115 (define_expand "restore_stack_function"
10116 [(match_operand 0 "general_operand" "")
10117 (match_operand 1 "general_operand" "")]
10121 (define_expand "restore_stack_block"
10122 [(match_operand 0 "register_operand" "")
10123 (match_operand 1 "register_operand" "")]
10126 rtx temp = gen_reg_rtx (Pmode);
10128 emit_move_insn (temp, s390_back_chain_rtx ());
10129 emit_move_insn (operands[0], operands[1]);
10130 emit_move_insn (s390_back_chain_rtx (), temp);
10135 (define_expand "save_stack_nonlocal"
10136 [(match_operand 0 "memory_operand" "")
10137 (match_operand 1 "register_operand" "")]
10140 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
10142 /* Copy the backchain to the first word, sp to the second and the
10143 literal pool base to the third. */
10145 rtx save_bc = adjust_address (operands[0], Pmode, 0);
10146 rtx save_sp = adjust_address (operands[0], Pmode, GET_MODE_SIZE (Pmode));
10147 rtx save_bp = adjust_address (operands[0], Pmode, 2 * GET_MODE_SIZE (Pmode));
10149 if (TARGET_BACKCHAIN)
10150 emit_move_insn (save_bc, force_reg (Pmode, s390_back_chain_rtx ()));
10152 emit_move_insn (save_sp, operands[1]);
10153 emit_move_insn (save_bp, base);
10158 (define_expand "restore_stack_nonlocal"
10159 [(match_operand 0 "register_operand" "")
10160 (match_operand 1 "memory_operand" "")]
10163 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
10164 rtx temp = NULL_RTX;
10166 /* Restore the backchain from the first word, sp from the second and the
10167 literal pool base from the third. */
10169 rtx save_bc = adjust_address (operands[1], Pmode, 0);
10170 rtx save_sp = adjust_address (operands[1], Pmode, GET_MODE_SIZE (Pmode));
10171 rtx save_bp = adjust_address (operands[1], Pmode, 2 * GET_MODE_SIZE (Pmode));
10173 if (TARGET_BACKCHAIN)
10174 temp = force_reg (Pmode, save_bc);
10176 emit_move_insn (base, save_bp);
10177 emit_move_insn (operands[0], save_sp);
10180 emit_move_insn (s390_back_chain_rtx (), temp);
10186 (define_expand "exception_receiver"
10190 s390_set_has_landing_pad_p (true);
10195 ; nop instruction pattern(s).
10202 [(set_attr "op_type" "RR")
10203 (set_attr "z10prop" "z10_fr_E1")])
10205 (define_insn "nop1"
10209 [(set_attr "op_type" "RR")])
10211 ;;- Undeletable nops (used for hotpatching)
10213 (define_insn "nop_2_byte"
10214 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_2_BYTE)]
10217 [(set_attr "op_type" "RR")])
10219 (define_insn "nop_4_byte"
10220 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_4_BYTE)]
10223 [(set_attr "op_type" "RX")])
10225 (define_insn "nop_6_byte"
10226 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_6_BYTE)]
10229 [(set_attr "op_type" "RIL")])
10233 ; Special literal pool access instruction pattern(s).
10236 (define_insn "*pool_entry"
10237 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
10238 UNSPECV_POOL_ENTRY)]
10241 machine_mode mode = GET_MODE (PATTERN (insn));
10242 unsigned int align = GET_MODE_BITSIZE (mode);
10243 s390_output_pool_entry (operands[0], mode, align);
10246 [(set (attr "length")
10247 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
10249 (define_insn "pool_align"
10250 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")]
10251 UNSPECV_POOL_ALIGN)]
10254 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
10256 (define_insn "pool_section_start"
10257 [(unspec_volatile [(const_int 1)] UNSPECV_POOL_SECTION)]
10260 switch_to_section (targetm.asm_out.function_rodata_section
10261 (current_function_decl));
10264 [(set_attr "length" "0")])
10266 (define_insn "pool_section_end"
10267 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_SECTION)]
10270 switch_to_section (current_function_section ());
10273 [(set_attr "length" "0")])
10275 (define_insn "main_base_31_small"
10276 [(set (match_operand 0 "register_operand" "=a")
10277 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
10278 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10280 [(set_attr "op_type" "RR")
10281 (set_attr "type" "la")
10282 (set_attr "z196prop" "z196_cracked")])
10284 (define_insn "main_base_31_large"
10285 [(set (match_operand 0 "register_operand" "=a")
10286 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
10287 (set (pc) (label_ref (match_operand 2 "" "")))]
10288 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10290 [(set_attr "op_type" "RI")
10291 (set_attr "z196prop" "z196_cracked")])
10293 (define_insn "main_base_64"
10294 [(set (match_operand 0 "register_operand" "=a")
10295 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
10296 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10298 [(set_attr "op_type" "RIL")
10299 (set_attr "type" "larl")
10300 (set_attr "z10prop" "z10_fwd_A1")])
10302 (define_insn "main_pool"
10303 [(set (match_operand 0 "register_operand" "=a")
10304 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
10305 "GET_MODE (operands[0]) == Pmode"
10307 gcc_unreachable ();
10309 [(set (attr "type")
10310 (if_then_else (match_test "TARGET_CPU_ZARCH")
10311 (const_string "larl") (const_string "la")))])
10313 (define_insn "reload_base_31"
10314 [(set (match_operand 0 "register_operand" "=a")
10315 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
10316 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10317 "basr\t%0,0\;la\t%0,%1-.(%0)"
10318 [(set_attr "length" "6")
10319 (set_attr "type" "la")
10320 (set_attr "z196prop" "z196_cracked")])
10322 (define_insn "reload_base_64"
10323 [(set (match_operand 0 "register_operand" "=a")
10324 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
10325 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10327 [(set_attr "op_type" "RIL")
10328 (set_attr "type" "larl")
10329 (set_attr "z10prop" "z10_fwd_A1")])
10331 (define_insn "pool"
10332 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
10335 gcc_unreachable ();
10337 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
10340 ;; Insns related to generating the function prologue and epilogue.
10344 (define_expand "prologue"
10345 [(use (const_int 0))]
10347 "s390_emit_prologue (); DONE;")
10349 (define_expand "epilogue"
10350 [(use (const_int 1))]
10352 "s390_emit_epilogue (false); DONE;")
10354 (define_expand "sibcall_epilogue"
10355 [(use (const_int 0))]
10357 "s390_emit_epilogue (true); DONE;")
10359 ;; A direct return instruction, without using an epilogue.
10360 (define_insn "<code>"
10362 "s390_can_use_<code>_insn ()"
10364 [(set_attr "op_type" "RR")
10365 (set_attr "type" "jsr")
10366 (set_attr "atype" "agen")])
10368 (define_insn "*return"
10370 (use (match_operand 0 "register_operand" "a"))]
10371 "GET_MODE (operands[0]) == Pmode"
10373 [(set_attr "op_type" "RR")
10374 (set_attr "type" "jsr")
10375 (set_attr "atype" "agen")])
10378 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
10379 ;; pointer. This is used for compatibility.
10381 (define_expand "ptr_extend"
10382 [(set (match_operand:DI 0 "register_operand" "=r")
10383 (match_operand:SI 1 "register_operand" "r"))]
10386 emit_insn (gen_anddi3 (operands[0],
10387 gen_lowpart (DImode, operands[1]),
10388 GEN_INT (0x7fffffff)));
10392 ;; Instruction definition to expand eh_return macro to support
10393 ;; swapping in special linkage return addresses.
10395 (define_expand "eh_return"
10396 [(use (match_operand 0 "register_operand" ""))]
10399 s390_emit_tpf_eh_return (operands[0]);
10404 ; Stack Protector Patterns
10407 (define_expand "stack_protect_set"
10408 [(set (match_operand 0 "memory_operand" "")
10409 (match_operand 1 "memory_operand" ""))]
10412 #ifdef TARGET_THREAD_SSP_OFFSET
10414 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
10415 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
10418 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
10420 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
10425 (define_insn "stack_protect_set<mode>"
10426 [(set (match_operand:DSI 0 "memory_operand" "=Q")
10427 (unspec:DSI [(match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_SET))]
10429 "mvc\t%O0(%G0,%R0),%S1"
10430 [(set_attr "op_type" "SS")])
10432 (define_expand "stack_protect_test"
10433 [(set (reg:CC CC_REGNUM)
10434 (compare (match_operand 0 "memory_operand" "")
10435 (match_operand 1 "memory_operand" "")))
10436 (match_operand 2 "" "")]
10440 #ifdef TARGET_THREAD_SSP_OFFSET
10442 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
10443 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
10446 emit_insn (gen_stack_protect_testdi (operands[0], operands[1]));
10448 emit_insn (gen_stack_protect_testsi (operands[0], operands[1]));
10450 cc_reg = gen_rtx_REG (CCZmode, CC_REGNUM);
10451 test = gen_rtx_EQ (VOIDmode, cc_reg, const0_rtx);
10452 emit_jump_insn (gen_cbranchcc4 (test, cc_reg, const0_rtx, operands[2]));
10456 (define_insn "stack_protect_test<mode>"
10457 [(set (reg:CCZ CC_REGNUM)
10458 (unspec:CCZ [(match_operand:DSI 0 "memory_operand" "Q")
10459 (match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_TEST))]
10461 "clc\t%O0(%G0,%R0),%S1"
10462 [(set_attr "op_type" "SS")])
10464 ; This is used in s390_emit_prologue in order to prevent insns
10465 ; adjusting the stack pointer to be moved over insns writing stack
10466 ; slots using a copy of the stack pointer in a different register.
10467 (define_insn "stack_tie"
10468 [(set (match_operand:BLK 0 "memory_operand" "+m")
10469 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
10472 [(set_attr "length" "0")])
10476 ; Data prefetch patterns
10479 (define_insn "prefetch"
10480 [(prefetch (match_operand 0 "address_operand" "ZQZRZSZT,X")
10481 (match_operand:SI 1 "const_int_operand" " n,n")
10482 (match_operand:SI 2 "const_int_operand" " n,n"))]
10485 switch (which_alternative)
10488 return INTVAL (operands[1]) == 1 ? "pfd\t2,%a0" : "pfd\t1,%a0";
10490 if (larl_operand (operands[0], Pmode))
10491 return INTVAL (operands[1]) == 1 ? "pfdrl\t2,%a0" : "pfdrl\t1,%a0";
10494 /* This might be reached for symbolic operands with an odd
10495 addend. We simply omit the prefetch for such rare cases. */
10500 [(set_attr "type" "load,larl")
10501 (set_attr "op_type" "RXY,RIL")
10502 (set_attr "z10prop" "z10_super")
10503 (set_attr "z196prop" "z196_alone")])
10507 ; Byte swap instructions
10510 ; FIXME: There is also mvcin but we cannot use it since src and target
10512 (define_insn "bswap<mode>2"
10513 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d, d,RT")
10514 (bswap:GPR (match_operand:GPR 1 "nonimmediate_operand" " d,RT, d")))]
10520 [(set_attr "type" "*,load,store")
10521 (set_attr "op_type" "RRE,RXY,RXY")
10522 (set_attr "z10prop" "z10_super")])
10524 (define_insn "bswaphi2"
10525 [(set (match_operand:HI 0 "nonimmediate_operand" "=d, d,RT")
10526 (bswap:HI (match_operand:HI 1 "nonimmediate_operand" " d,RT, d")))]
10532 [(set_attr "type" "*,load,store")
10533 (set_attr "op_type" "RRE,RXY,RXY")
10534 (set_attr "z10prop" "z10_super")])
10537 [(set (match_operand:HI 0 "register_operand" "")
10538 (bswap:HI (match_operand:HI 1 "register_operand" "")))]
10540 [(set (match_dup 2) (bswap:SI (match_dup 3)))
10541 (set (match_dup 2) (lshiftrt:SI (match_dup 2) (const_int 16)))]
10543 operands[2] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
10544 operands[3] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
10549 ; Population count instruction
10552 ; The S/390 popcount instruction counts the bits of op1 in 8 byte
10553 ; portions and stores the result in the corresponding bytes in op0.
10554 (define_insn "*popcount<mode>"
10555 [(set (match_operand:INT 0 "register_operand" "=d")
10556 (unspec:INT [(match_operand:INT 1 "register_operand" "d")] UNSPEC_POPCNT))
10557 (clobber (reg:CC CC_REGNUM))]
10560 [(set_attr "op_type" "RRE")])
10562 (define_expand "popcountdi2"
10564 (parallel [(set (match_operand:DI 0 "register_operand" "")
10565 (unspec:DI [(match_operand:DI 1 "register_operand")]
10567 (clobber (reg:CC CC_REGNUM))])
10568 ; sllg op2, op0, 32
10569 (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 32)))
10571 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10572 (clobber (reg:CC CC_REGNUM))])
10573 ; sllg op2, op0, 16
10575 (ashift:DI (match_dup 0) (const_int 16)))
10577 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10578 (clobber (reg:CC CC_REGNUM))])
10580 (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 8)))
10582 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10583 (clobber (reg:CC CC_REGNUM))])
10584 ; srlg op0, op0, 56
10585 (set (match_dup 0) (lshiftrt:DI (match_dup 0) (const_int 56)))]
10586 "TARGET_Z196 && TARGET_64BIT"
10587 "operands[2] = gen_reg_rtx (DImode);")
10589 (define_expand "popcountsi2"
10591 (parallel [(set (match_operand:SI 0 "register_operand" "")
10592 (unspec:SI [(match_operand:SI 1 "register_operand")]
10594 (clobber (reg:CC CC_REGNUM))])
10595 ; sllk op2, op0, 16
10597 (ashift:SI (match_dup 0) (const_int 16)))
10599 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10600 (clobber (reg:CC CC_REGNUM))])
10602 (set (match_dup 2) (ashift:SI (match_dup 0) (const_int 8)))
10604 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10605 (clobber (reg:CC CC_REGNUM))])
10607 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 24)))]
10609 "operands[2] = gen_reg_rtx (SImode);")
10611 (define_expand "popcounthi2"
10613 (parallel [(set (match_operand:HI 0 "register_operand" "")
10614 (unspec:HI [(match_operand:HI 1 "register_operand")]
10616 (clobber (reg:CC CC_REGNUM))])
10619 (ashift:SI (match_dup 0) (const_int 8)))
10621 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10622 (clobber (reg:CC CC_REGNUM))])
10624 (set (match_dup 0) (lshiftrt:HI (match_dup 0) (const_int 8)))]
10626 "operands[2] = gen_reg_rtx (SImode);")
10628 (define_expand "popcountqi2"
10630 (parallel [(set (match_operand:QI 0 "register_operand" "")
10631 (unspec:QI [(match_operand:QI 1 "register_operand")]
10633 (clobber (reg:CC CC_REGNUM))])]
10638 ;;- Copy sign instructions
10641 (define_insn "copysign<mode>3"
10642 [(set (match_operand:FP 0 "register_operand" "=f")
10643 (unspec:FP [(match_operand:FP 1 "register_operand" "<fT0>")
10644 (match_operand:FP 2 "register_operand" "f")]
10648 [(set_attr "op_type" "RRF")
10649 (set_attr "type" "fsimp<mode>")])
10653 ;;- Transactional execution instructions
10656 ; This splitter helps combine to make use of CC directly when
10657 ; comparing the integer result of a tbegin builtin with a constant.
10658 ; The unspec is already removed by canonicalize_comparison. So this
10659 ; splitters only job is to turn the PARALLEL into separate insns
10660 ; again. Unfortunately this only works with the very first cc/int
10661 ; compare since combine is not able to deal with data flow across
10662 ; basic block boundaries.
10664 ; It needs to be an insn pattern as well since combine does not apply
10665 ; the splitter directly. Combine would only use it if it actually
10666 ; would reduce the number of instructions.
10667 (define_insn_and_split "*ccraw_to_int"
10670 (match_operator 0 "s390_eqne_operator"
10671 [(reg:CCRAW CC_REGNUM)
10672 (match_operand 1 "const_int_operand" "")])
10673 (label_ref (match_operand 2 "" ""))
10675 (set (match_operand:SI 3 "register_operand" "=d")
10676 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
10680 [(set (match_dup 3)
10681 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))
10683 (if_then_else (match_op_dup 0 [(reg:CCRAW CC_REGNUM) (match_dup 1)])
10684 (label_ref (match_dup 2))
10688 ; Non-constrained transaction begin
10690 (define_expand "tbegin"
10691 [(match_operand:SI 0 "register_operand" "")
10692 (match_operand:BLK 1 "memory_operand" "")]
10695 s390_expand_tbegin (operands[0], operands[1], NULL_RTX, true);
10699 (define_expand "tbegin_nofloat"
10700 [(match_operand:SI 0 "register_operand" "")
10701 (match_operand:BLK 1 "memory_operand" "")]
10704 s390_expand_tbegin (operands[0], operands[1], NULL_RTX, false);
10708 (define_expand "tbegin_retry"
10709 [(match_operand:SI 0 "register_operand" "")
10710 (match_operand:BLK 1 "memory_operand" "")
10711 (match_operand:SI 2 "general_operand" "")]
10714 s390_expand_tbegin (operands[0], operands[1], operands[2], true);
10718 (define_expand "tbegin_retry_nofloat"
10719 [(match_operand:SI 0 "register_operand" "")
10720 (match_operand:BLK 1 "memory_operand" "")
10721 (match_operand:SI 2 "general_operand" "")]
10724 s390_expand_tbegin (operands[0], operands[1], operands[2], false);
10728 ; Clobber VRs since they don't get restored
10729 (define_insn "tbegin_1_z13"
10730 [(set (reg:CCRAW CC_REGNUM)
10731 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10733 (set (match_operand:BLK 1 "memory_operand" "=Q")
10734 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))
10735 (clobber (reg:TI 16)) (clobber (reg:TI 38))
10736 (clobber (reg:TI 17)) (clobber (reg:TI 39))
10737 (clobber (reg:TI 18)) (clobber (reg:TI 40))
10738 (clobber (reg:TI 19)) (clobber (reg:TI 41))
10739 (clobber (reg:TI 20)) (clobber (reg:TI 42))
10740 (clobber (reg:TI 21)) (clobber (reg:TI 43))
10741 (clobber (reg:TI 22)) (clobber (reg:TI 44))
10742 (clobber (reg:TI 23)) (clobber (reg:TI 45))
10743 (clobber (reg:TI 24)) (clobber (reg:TI 46))
10744 (clobber (reg:TI 25)) (clobber (reg:TI 47))
10745 (clobber (reg:TI 26)) (clobber (reg:TI 48))
10746 (clobber (reg:TI 27)) (clobber (reg:TI 49))
10747 (clobber (reg:TI 28)) (clobber (reg:TI 50))
10748 (clobber (reg:TI 29)) (clobber (reg:TI 51))
10749 (clobber (reg:TI 30)) (clobber (reg:TI 52))
10750 (clobber (reg:TI 31)) (clobber (reg:TI 53))]
10751 ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is
10752 ; not supposed to be used for immediates (see genpreds.c).
10753 "TARGET_VX && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10755 [(set_attr "op_type" "SIL")])
10757 (define_insn "tbegin_1"
10758 [(set (reg:CCRAW CC_REGNUM)
10759 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10761 (set (match_operand:BLK 1 "memory_operand" "=Q")
10762 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))
10763 (clobber (reg:DF 16))
10764 (clobber (reg:DF 17))
10765 (clobber (reg:DF 18))
10766 (clobber (reg:DF 19))
10767 (clobber (reg:DF 20))
10768 (clobber (reg:DF 21))
10769 (clobber (reg:DF 22))
10770 (clobber (reg:DF 23))
10771 (clobber (reg:DF 24))
10772 (clobber (reg:DF 25))
10773 (clobber (reg:DF 26))
10774 (clobber (reg:DF 27))
10775 (clobber (reg:DF 28))
10776 (clobber (reg:DF 29))
10777 (clobber (reg:DF 30))
10778 (clobber (reg:DF 31))]
10779 ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is
10780 ; not supposed to be used for immediates (see genpreds.c).
10781 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10783 [(set_attr "op_type" "SIL")])
10785 ; Same as above but without the FPR clobbers
10786 (define_insn "tbegin_nofloat_1"
10787 [(set (reg:CCRAW CC_REGNUM)
10788 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10790 (set (match_operand:BLK 1 "memory_operand" "=Q")
10791 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))]
10792 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10794 [(set_attr "op_type" "SIL")])
10797 ; Constrained transaction begin
10799 (define_expand "tbeginc"
10800 [(set (reg:CCRAW CC_REGNUM)
10801 (unspec_volatile:CCRAW [(const_int TBEGINC_MASK)]
10806 (define_insn "*tbeginc_1"
10807 [(set (reg:CCRAW CC_REGNUM)
10808 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" " D")]
10810 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10812 [(set_attr "op_type" "SIL")])
10816 (define_expand "tend"
10817 [(set (reg:CCRAW CC_REGNUM)
10818 (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))
10819 (set (match_operand:SI 0 "register_operand" "")
10820 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
10824 (define_insn "*tend_1"
10825 [(set (reg:CCRAW CC_REGNUM)
10826 (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))]
10829 [(set_attr "op_type" "S")])
10831 ; Transaction abort
10833 (define_expand "tabort"
10834 [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "")]
10836 "TARGET_HTM && operands != NULL"
10838 if (CONST_INT_P (operands[0])
10839 && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 255)
10841 error ("Invalid transaction abort code: " HOST_WIDE_INT_PRINT_DEC
10842 ". Values in range 0 through 255 are reserved.",
10843 INTVAL (operands[0]));
10848 (define_insn "*tabort_1"
10849 [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "Y")]
10851 "TARGET_HTM && operands != NULL"
10853 [(set_attr "op_type" "S")])
10855 ; Transaction extract nesting depth
10857 (define_insn "etnd"
10858 [(set (match_operand:SI 0 "register_operand" "=d")
10859 (unspec_volatile:SI [(const_int 0)] UNSPECV_ETND))]
10862 [(set_attr "op_type" "RRE")])
10864 ; Non-transactional store
10866 (define_insn "ntstg"
10867 [(set (match_operand:DI 0 "memory_operand" "=RT")
10868 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "d")]
10872 [(set_attr "op_type" "RXY")])
10874 ; Transaction perform processor assist
10876 (define_expand "tx_assist"
10877 [(unspec_volatile [(match_operand:SI 0 "register_operand" "")
10878 (reg:SI GPR0_REGNUM)
10884 (define_insn "*ppa"
10885 [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")
10886 (match_operand:SI 1 "register_operand" "d")
10887 (match_operand 2 "const_int_operand" "I")]
10889 "TARGET_HTM && INTVAL (operands[2]) < 16"
10891 [(set_attr "op_type" "RRF")])
10894 ; Set and get floating point control register
10896 (define_insn "sfpc"
10897 [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")]
10899 "TARGET_HARD_FLOAT"
10902 (define_insn "efpc"
10903 [(set (match_operand:SI 0 "register_operand" "=d")
10904 (unspec_volatile:SI [(const_int 0)] UNSPECV_EFPC))]
10905 "TARGET_HARD_FLOAT"
10909 ; Load count to block boundary
10911 (define_insn "lcbb"
10912 [(set (match_operand:SI 0 "register_operand" "=d")
10913 (unspec:SI [(match_operand:SI 1 "address_operand" "ZQZR")
10914 (match_operand:SI 2 "immediate_operand" "C")] UNSPEC_LCBB))
10915 (clobber (reg:CC CC_REGNUM))]
10918 [(set_attr "op_type" "VRX")])
10920 ; Handle -fsplit-stack.
10922 (define_expand "split_stack_prologue"
10926 s390_expand_split_stack_prologue ();
10930 ;; If there are operand 0 bytes available on the stack, jump to
10933 (define_expand "split_stack_space_check"
10934 [(set (pc) (if_then_else
10935 (ltu (minus (reg 15)
10936 (match_operand 0 "register_operand"))
10937 (unspec [(const_int 0)] UNSPEC_STACK_CHECK))
10938 (label_ref (match_operand 1))
10942 /* Offset from thread pointer to __private_ss. */
10943 int psso = TARGET_64BIT ? 0x38 : 0x20;
10944 rtx tp = s390_get_thread_pointer ();
10945 rtx guard = gen_rtx_MEM (Pmode, plus_constant (Pmode, tp, psso));
10946 rtx reg = gen_reg_rtx (Pmode);
10949 emit_insn (gen_subdi3 (reg, stack_pointer_rtx, operands[0]));
10951 emit_insn (gen_subsi3 (reg, stack_pointer_rtx, operands[0]));
10952 cc = s390_emit_compare (GT, reg, guard);
10953 s390_emit_jump (operands[1], cc);
10958 ;; __morestack parameter block for split stack prologue. Parameters are:
10959 ;; parameter block label, label to be called by __morestack, frame size,
10960 ;; stack parameter size.
10962 (define_insn "split_stack_data"
10963 [(unspec_volatile [(match_operand 0 "" "X")
10964 (match_operand 1 "" "X")
10965 (match_operand 2 "const_int_operand" "X")
10966 (match_operand 3 "const_int_operand" "X")]
10967 UNSPECV_SPLIT_STACK_DATA)]
10970 switch_to_section (targetm.asm_out.function_rodata_section
10971 (current_function_decl));
10974 output_asm_insn (".align\t8", operands);
10976 output_asm_insn (".align\t4", operands);
10977 (*targetm.asm_out.internal_label) (asm_out_file, "L",
10978 CODE_LABEL_NUMBER (operands[0]));
10981 output_asm_insn (".quad\t%2", operands);
10982 output_asm_insn (".quad\t%3", operands);
10983 output_asm_insn (".quad\t%1-%0", operands);
10987 output_asm_insn (".long\t%2", operands);
10988 output_asm_insn (".long\t%3", operands);
10989 output_asm_insn (".long\t%1-%0", operands);
10992 switch_to_section (current_function_section ());
10995 [(set_attr "length" "0")])
10998 ;; A jg with minimal fuss for use in split stack prologue.
11000 (define_expand "split_stack_call"
11001 [(match_operand 0 "bras_sym_operand" "X")
11002 (match_operand 1 "" "")]
11006 emit_jump_insn (gen_split_stack_call_di (operands[0], operands[1]));
11008 emit_jump_insn (gen_split_stack_call_si (operands[0], operands[1]));
11012 (define_insn "split_stack_call_<mode>"
11013 [(set (pc) (label_ref (match_operand 1 "" "")))
11014 (set (reg:P 1) (unspec_volatile [(match_operand 0 "bras_sym_operand" "X")
11016 UNSPECV_SPLIT_STACK_CALL))]
11019 [(set_attr "op_type" "RIL")
11020 (set_attr "type" "branch")])
11022 ;; Also a conditional one.
11024 (define_expand "split_stack_cond_call"
11025 [(match_operand 0 "bras_sym_operand" "X")
11026 (match_operand 1 "" "")
11027 (match_operand 2 "" "")]
11031 emit_jump_insn (gen_split_stack_cond_call_di (operands[0], operands[1], operands[2]));
11033 emit_jump_insn (gen_split_stack_cond_call_si (operands[0], operands[1], operands[2]));
11037 (define_insn "split_stack_cond_call_<mode>"
11040 (match_operand 1 "" "")
11041 (label_ref (match_operand 2 "" ""))
11043 (set (reg:P 1) (unspec_volatile [(match_operand 0 "bras_sym_operand" "X")
11045 UNSPECV_SPLIT_STACK_CALL))]
11048 [(set_attr "op_type" "RIL")
11049 (set_attr "type" "branch")])