1 ;;- Machine description for GNU compiler -- S/390 / zSeries version.
2 ;; Copyright (C) 1999-2015 Free Software Foundation, Inc.
3 ;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and
4 ;; Ulrich Weigand (uweigand@de.ibm.com) and
5 ;; Andreas Krebbel (Andreas.Krebbel@de.ibm.com)
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it under
10 ;; the terms of the GNU General Public License as published by the Free
11 ;; Software Foundation; either version 3, or (at your option) any later
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
24 ;; See constraints.md for a description of constraints specific to s390.
27 ;; Special formats used for outputting 390 instructions.
29 ;; %C: print opcode suffix for branch condition.
30 ;; %D: print opcode suffix for inverse branch condition.
31 ;; %J: print tls_load/tls_gdcall/tls_ldcall suffix
32 ;; %G: print the size of the operand in bytes.
33 ;; %O: print only the displacement of a memory reference.
34 ;; %R: print only the base register of a memory reference.
35 ;; %S: print S-type memory reference (base+displacement).
36 ;; %N: print the second word of a DImode operand.
37 ;; %M: print the second word of a TImode operand.
38 ;; %Y: print shift count operand.
40 ;; %b: print integer X as if it's an unsigned byte.
41 ;; %c: print integer X as if it's an signed byte.
42 ;; %x: print integer X as if it's an unsigned halfword.
43 ;; %h: print integer X as if it's a signed halfword.
44 ;; %i: print the first nonzero HImode part of X.
45 ;; %j: print the first HImode part unequal to -1 of X.
46 ;; %k: print the first nonzero SImode part of X.
47 ;; %m: print the first SImode part unequal to -1 of X.
48 ;; %o: print integer X as if it's an unsigned 32bit word.
50 ;; We have a special constraint for pattern matching.
52 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
59 (define_c_enum "unspec" [
65 ; Convert CC into a str comparison result and copy it into an
67 ; cc0->0, cc1->1, cc2->-1, (cc3->-1)
68 UNSPEC_STRCMPCC_TO_INT
70 ; Copy CC as is into the lower 2 bits of an integer register
73 ; The right hand side of an setmem
76 ; GOT/PLT and lt-relative accesses
97 ; TLS relocation specifiers
113 ; Stack Smashing Protector
117 ; Test Data Class (TDC)
129 UNSPEC_FPINT_NEARBYINT
138 UNSPEC_VEC_SMULT_EVEN
139 UNSPEC_VEC_UMULT_EVEN
153 UNSPEC_VEC_INSERT_AND_ZERO
154 UNSPEC_VEC_LOAD_BNDRY
159 UNSPEC_VEC_PACK_SATURATE
160 UNSPEC_VEC_PACK_SATURATE_CC
161 UNSPEC_VEC_PACK_SATURATE_GENCC
162 UNSPEC_VEC_PACK_UNSIGNED_SATURATE
163 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_CC
164 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_GENCC
176 UNSPEC_VEC_ADDEC_U128
181 UNSPEC_VEC_GFMSUM_128
182 UNSPEC_VEC_GFMSUM_ACCUM
183 UNSPEC_VEC_GFMSUM_ACCUM_128
202 UNSPEC_VEC_SUBEC_U128
236 ;; UNSPEC_VOLATILE usage
239 (define_c_enum "unspecv" [
261 ; Hotpatching (unremovable NOPs)
266 ; Transactional Execution support
276 ; Set and get floating point control register
285 ; Registers with special meaning
289 ; Sibling call register.
291 ; Literal pool base register.
293 ; Return address register.
295 ; Condition code register.
297 ; Thread local storage pointer register.
301 ; Hardware register names
305 ; General purpose registers
308 ; Floating point registers.
333 ;; PFPO GPR0 argument format
338 ; PFPO operation type
339 (PFPO_CONVERT 0x1000000)
341 (PFPO_OP_TYPE_SF 0x5)
342 (PFPO_OP_TYPE_DF 0x6)
343 (PFPO_OP_TYPE_TF 0x7)
344 (PFPO_OP_TYPE_SD 0x8)
345 (PFPO_OP_TYPE_DD 0x9)
346 (PFPO_OP_TYPE_TD 0xa)
347 ; Bitposition of operand types
348 (PFPO_OP0_TYPE_SHIFT 16)
349 (PFPO_OP1_TYPE_SHIFT 8)
352 ; Immediate operands for tbegin and tbeginc
353 (define_constants [(TBEGIN_MASK 65292)]) ; 0xff0c
354 (define_constants [(TBEGINC_MASK 65288)]) ; 0xff08
356 ;; Instruction operand type as used in the Principles of Operation.
357 ;; Used to determine defaults for length and other attribute values.
359 (define_attr "op_type"
360 "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"
363 ;; Instruction type attribute used for scheduling.
365 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
366 cs,vs,store,sem,idiv,
367 imulhi,imulsi,imuldi,
368 branch,jsr,fsimptf,fsimpdf,fsimpsf,fhex,
369 floadtf,floaddf,floadsf,fstoredf,fstoresf,
370 fmultf,fmuldf,fmulsf,fdivtf,fdivdf,fdivsf,
371 ftoi,fsqrttf,fsqrtdf,fsqrtsf,
373 ftrunctf,ftruncdf, ftruncsd, ftruncdd,
374 itoftf, itofdf, itofsf, itofdd, itoftd,
375 fdivdd, fdivtd, floaddd, floadsd, fmuldd, fmultd,
376 fsimpdd, fsimpsd, fsimptd, fstoredd, fstoresd,
378 (cond [(eq_attr "op_type" "NN") (const_string "other")
379 (eq_attr "op_type" "SS") (const_string "cs")]
380 (const_string "integer")))
382 ;; Another attribute used for scheduling purposes:
383 ;; agen: Instruction uses the address generation unit
384 ;; reg: Instruction does not use the agen unit
386 (define_attr "atype" "agen,reg"
387 (if_then_else (eq_attr "op_type" "E,RR,RI,RRE,RSI,RIL,RIE,RRF,RRR")
389 (const_string "agen")))
391 ;; Properties concerning Z10 execution grouping and value forwarding.
392 ;; z10_super: instruction is superscalar.
393 ;; z10_super_c: instruction is superscalar and meets the condition of z10_c.
394 ;; z10_fwd: The instruction reads the value of an operand and stores it into a
395 ;; target register. It can forward this value to a second instruction that reads
396 ;; the same register if that second instruction is issued in the same group.
397 ;; z10_rec: The instruction is in the T pipeline and reads a register. If the
398 ;; instruction in the S pipe writes to the register, then the T instruction
399 ;; can immediately read the new value.
400 ;; z10_fr: union of Z10_fwd and z10_rec.
401 ;; z10_c: second operand of instruction is a register and read with complemented bits.
403 ;; An additional suffix A1, A3, or E1 indicates the respective AGI bypass.
406 (define_attr "z10prop" "none,
407 z10_super, z10_super_E1, z10_super_A1, z10_super_c, z10_super_c_E1,
408 z10_fwd, z10_fwd_A1, z10_fwd_A3, z10_fwd_E1,
410 z10_fr, z10_fr_A3, z10_fr_E1,
412 (const_string "none"))
414 ;; Properties concerning Z196 decoding
415 ;; z196_alone: must group alone
416 ;; z196_end: ends a group
417 ;; z196_cracked: instruction is cracked or expanded
418 (define_attr "z196prop" "none,
419 z196_alone, z196_ends,
421 (const_string "none"))
423 (define_attr "mnemonic" "bcr_flush,unknown" (const_string "unknown"))
427 (define_attr "length" ""
428 (cond [(eq_attr "op_type" "E,RR") (const_int 2)
429 (eq_attr "op_type" "RX,RI,RRE,RS,RSI,S,SI,RRF,RRR") (const_int 4)]
433 ;; Processor type. This attribute must exactly match the processor_type
434 ;; enumeration in s390.h. The current machine description does not
435 ;; distinguish between g5 and g6, but there are differences between the two
436 ;; CPUs could in theory be modeled.
438 (define_attr "cpu" "g5,g6,z900,z990,z9_109,z9_ec,z10,z196,zEC12,z13"
439 (const (symbol_ref "s390_tune_attr")))
441 (define_attr "cpu_facility"
442 "standard,ieee,zarch,cpu_zarch,longdisp,extimm,dfp,z10,z196,zEC12,vec"
443 (const_string "standard"))
445 (define_attr "enabled" ""
446 (cond [(eq_attr "cpu_facility" "standard")
449 (and (eq_attr "cpu_facility" "ieee")
450 (match_test "TARGET_CPU_IEEE_FLOAT"))
453 (and (eq_attr "cpu_facility" "zarch")
454 (match_test "TARGET_ZARCH"))
457 (and (eq_attr "cpu_facility" "longdisp")
458 (match_test "TARGET_LONG_DISPLACEMENT"))
461 (and (eq_attr "cpu_facility" "extimm")
462 (match_test "TARGET_EXTIMM"))
465 (and (eq_attr "cpu_facility" "dfp")
466 (match_test "TARGET_DFP"))
469 (and (eq_attr "cpu_facility" "cpu_zarch")
470 (match_test "TARGET_CPU_ZARCH"))
473 (and (eq_attr "cpu_facility" "z10")
474 (match_test "TARGET_Z10"))
477 (and (eq_attr "cpu_facility" "z196")
478 (match_test "TARGET_Z196"))
481 (and (eq_attr "cpu_facility" "zEC12")
482 (match_test "TARGET_ZEC12"))
485 (and (eq_attr "cpu_facility" "vec")
486 (match_test "TARGET_VX"))
490 ;; Pipeline description for z900. For lack of anything better,
491 ;; this description is also used for the g5 and g6.
494 ;; Pipeline description for z990, z9-109 and z9-ec.
497 ;; Pipeline description for z10
500 ;; Pipeline description for z196
503 ;; Pipeline description for zEC12
507 (include "predicates.md")
509 ;; Constraint definitions
510 (include "constraints.md")
517 (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])
519 ;; These mode iterators allow floating point patterns to be generated from the
521 (define_mode_iterator FP_ALL [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")
522 (SD "TARGET_HARD_DFP")])
523 (define_mode_iterator FP [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")])
524 (define_mode_iterator BFP [TF DF SF])
525 (define_mode_iterator DFP [TD DD])
526 (define_mode_iterator DFP_ALL [TD DD SD])
527 (define_mode_iterator DSF [DF SF])
528 (define_mode_iterator SD_SF [SF SD])
529 (define_mode_iterator DD_DF [DF DD])
530 (define_mode_iterator TD_TF [TF TD])
532 ;; These mode iterators allow 31-bit and 64-bit GPR patterns to be generated
533 ;; from the same template.
534 (define_mode_iterator GPR [(DI "TARGET_ZARCH") SI])
535 (define_mode_iterator DGPR [(TI "TARGET_ZARCH") DI SI])
536 (define_mode_iterator DSI [DI SI])
537 (define_mode_iterator TDI [TI DI])
539 ;; These mode iterators allow :P to be used for patterns that operate on
540 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
541 (define_mode_iterator P [(DI "TARGET_64BIT") (SI "!TARGET_64BIT")])
543 ;; These macros refer to the actual word_mode of the configuration.
544 ;; This is equal to Pmode except on 31-bit machines in zarch mode.
545 (define_mode_iterator DW [(TI "TARGET_ZARCH") (DI "!TARGET_ZARCH")])
546 (define_mode_iterator W [(DI "TARGET_ZARCH") (SI "!TARGET_ZARCH")])
548 ;; Used by the umul pattern to express modes having half the size.
549 (define_mode_attr DWH [(TI "DI") (DI "SI")])
550 (define_mode_attr dwh [(TI "di") (DI "si")])
552 ;; This mode iterator allows the QI and HI patterns to be defined from
553 ;; the same template.
554 (define_mode_iterator HQI [HI QI])
556 ;; This mode iterator allows the integer patterns to be defined from the
558 (define_mode_iterator INT [(DI "TARGET_ZARCH") SI HI QI])
559 (define_mode_iterator DINT [(TI "TARGET_ZARCH") DI SI HI QI])
561 ;; This iterator allows some 'ashift' and 'lshiftrt' pattern to be defined from
562 ;; the same template.
563 (define_code_iterator SHIFT [ashift lshiftrt])
565 ;; This iterator allows r[ox]sbg to be defined with the same template
566 (define_code_iterator IXOR [ior xor])
568 ;; This iterator is used to expand the patterns for the nearest
569 ;; integer functions.
570 (define_int_iterator FPINT [UNSPEC_FPINT_FLOOR UNSPEC_FPINT_BTRUNC
571 UNSPEC_FPINT_ROUND UNSPEC_FPINT_CEIL
572 UNSPEC_FPINT_NEARBYINT])
573 (define_int_attr fpint_name [(UNSPEC_FPINT_FLOOR "floor")
574 (UNSPEC_FPINT_BTRUNC "btrunc")
575 (UNSPEC_FPINT_ROUND "round")
576 (UNSPEC_FPINT_CEIL "ceil")
577 (UNSPEC_FPINT_NEARBYINT "nearbyint")])
578 (define_int_attr fpint_roundingmode [(UNSPEC_FPINT_FLOOR "7")
579 (UNSPEC_FPINT_BTRUNC "5")
580 (UNSPEC_FPINT_ROUND "1")
581 (UNSPEC_FPINT_CEIL "6")
582 (UNSPEC_FPINT_NEARBYINT "0")])
584 ;; This iterator and attribute allow to combine most atomic operations.
585 (define_code_iterator ATOMIC [and ior xor plus minus mult])
586 (define_code_iterator ATOMIC_Z196 [and ior xor plus])
587 (define_code_attr atomic [(and "and") (ior "or") (xor "xor")
588 (plus "add") (minus "sub") (mult "nand")])
589 (define_code_attr noxa [(and "n") (ior "o") (xor "x") (plus "a")])
591 ;; In FP templates, a string like "lt<de>br" will expand to "ltxbr" in
592 ;; TF/TDmode, "ltdbr" in DF/DDmode, and "ltebr" in SF/SDmode.
593 (define_mode_attr xde [(TF "x") (DF "d") (SF "e") (TD "x") (DD "d") (SD "e")])
595 ;; In FP templates, a <dee> in "m<dee><bt>r" will expand to "mx<bt>r" in
596 ;; TF/TDmode, "md<bt>r" in DF/DDmode, "mee<bt>r" in SFmode and "me<bt>r in
598 (define_mode_attr xdee [(TF "x") (DF "d") (SF "ee") (TD "x") (DD "d") (SD "e")])
600 ;; In FP templates, "<RRe>" will expand to "RRE" in TFmode and "RR" otherwise.
601 ;; Likewise for "<RXe>".
602 (define_mode_attr RRe [(TF "RRE") (DF "RR") (SF "RR")])
603 (define_mode_attr RXe [(TF "RXE") (DF "RX") (SF "RX")])
605 ;; The decimal floating point variants of add, sub, div and mul support 3
606 ;; fp register operands. The following attributes allow to merge the bfp and
607 ;; dfp variants in a single insn definition.
609 ;; This attribute is used to set op_type accordingly.
610 (define_mode_attr RRer [(TF "RRE") (DF "RRE") (SF "RRE") (TD "RRR")
611 (DD "RRR") (SD "RRR")])
613 ;; This attribute is used in the operand constraint list in order to have the
614 ;; first and the second operand match for bfp modes.
615 (define_mode_attr f0 [(TF "0") (DF "0") (SF "0") (TD "f") (DD "f") (DD "f")])
617 ;; This attribute is used to merge the scalar vector instructions into
618 ;; the FP patterns. For non-supported modes (all but DF) it expands
619 ;; to constraints which are supposed to be matched by an earlier
621 (define_mode_attr v0 [(TF "0") (DF "v") (SF "0") (TD "0") (DD "0") (DD "0") (TI "0") (DI "v") (SI "0")])
622 (define_mode_attr vf [(TF "f") (DF "v") (SF "f") (TD "f") (DD "f") (DD "f") (TI "f") (DI "v") (SI "f")])
623 (define_mode_attr vd [(TF "d") (DF "v") (SF "d") (TD "d") (DD "d") (DD "d") (TI "d") (DI "v") (SI "d")])
625 ;; This attribute is used in the operand list of the instruction to have an
626 ;; additional operand for the dfp instructions.
627 (define_mode_attr op1 [(TF "") (DF "") (SF "")
628 (TD "%1,") (DD "%1,") (SD "%1,")])
631 ;; This attribute is used in the operand constraint list
632 ;; for instructions dealing with the sign bit of 32 or 64bit fp values.
633 ;; TFmode values are represented by a fp register pair. Since the
634 ;; sign bit instructions only handle single source and target fp registers
635 ;; these instructions can only be used for TFmode values if the source and
636 ;; target operand uses the same fp register.
637 (define_mode_attr fT0 [(TF "0") (DF "f") (SF "f")])
639 ;; In FP templates, "<Rf>" will expand to "f" in TFmode and "R" otherwise.
640 ;; This is used to disable the memory alternative in TFmode patterns.
641 (define_mode_attr Rf [(TF "f") (DF "R") (SF "R") (TD "f") (DD "f") (SD "f")])
643 ;; This attribute adds b for bfp instructions and t for dfp instructions and is used
644 ;; within instruction mnemonics.
645 (define_mode_attr bt [(TF "b") (DF "b") (SF "b") (TD "t") (DD "t") (SD "t")])
647 ;; This attribute is used within instruction mnemonics. It evaluates to d for dfp
648 ;; modes and to an empty string for bfp modes.
649 (define_mode_attr _d [(TF "") (DF "") (SF "") (TD "d") (DD "d") (SD "d")])
651 ;; In GPR and P templates, a constraint like "<d0>" will expand to "d" in DImode
652 ;; and "0" in SImode. This allows to combine instructions of which the 31bit
653 ;; version only operates on one register.
654 (define_mode_attr d0 [(DI "d") (SI "0")])
656 ;; In combination with d0 this allows to combine instructions of which the 31bit
657 ;; version only operates on one register. The DImode version needs an additional
658 ;; register for the assembler output.
659 (define_mode_attr 1 [(DI "%1,") (SI "")])
661 ;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in
662 ;; 'ashift' and "srdl" in 'lshiftrt'.
663 (define_code_attr lr [(ashift "l") (lshiftrt "r")])
665 ;; In SHIFT templates, this attribute holds the correct standard name for the
666 ;; pattern itself and the corresponding function calls.
667 (define_code_attr shift [(ashift "ashl") (lshiftrt "lshr")])
669 ;; This attribute handles differences in the instruction 'type' and will result
670 ;; in "RRE" for DImode and "RR" for SImode.
671 (define_mode_attr E [(DI "E") (SI "")])
673 ;; This attribute handles differences in the instruction 'type' and makes RX<Y>
674 ;; to result in "RXY" for DImode and "RX" for SImode.
675 (define_mode_attr Y [(DI "Y") (SI "")])
677 ;; This attribute handles differences in the instruction 'type' and will result
678 ;; in "RSE" for TImode and "RS" for DImode.
679 (define_mode_attr TE [(TI "E") (DI "")])
681 ;; In GPR templates, a string like "lc<g>r" will expand to "lcgr" in DImode
682 ;; and "lcr" in SImode.
683 (define_mode_attr g [(DI "g") (SI "")])
685 ;; In GPR templates, a string like "sl<y>" will expand to "slg" in DImode
686 ;; and "sly" in SImode. This is useful because on 64bit the ..g instructions
687 ;; were enhanced with long displacements whereas 31bit instructions got a ..y
688 ;; variant for long displacements.
689 (define_mode_attr y [(DI "g") (SI "y")])
691 ;; In DW templates, a string like "cds<g>" will expand to "cdsg" in TImode
692 ;; and "cds" in DImode.
693 (define_mode_attr tg [(TI "g") (DI "")])
695 ;; In TDI templates, a string like "c<d>sg".
696 (define_mode_attr td [(TI "d") (DI "")])
698 ;; In GPR templates, a string like "c<gf>dbr" will expand to "cgdbr" in DImode
699 ;; and "cfdbr" in SImode.
700 (define_mode_attr gf [(DI "g") (SI "f")])
702 ;; In GPR templates, a string like sll<gk> will expand to sllg for DI
703 ;; and sllk for SI. This way it is possible to merge the new z196 SI
704 ;; 3 operands shift instructions into the existing patterns.
705 (define_mode_attr gk [(DI "g") (SI "k")])
707 ;; ICM mask required to load MODE value into the lowest subreg
708 ;; of a SImode register.
709 (define_mode_attr icm_lo [(HI "3") (QI "1")])
711 ;; In HQI templates, a string like "llg<hc>" will expand to "llgh" in
712 ;; HImode and "llgc" in QImode.
713 (define_mode_attr hc [(HI "h") (QI "c")])
715 ;; In P templates, the mode <DBL> will expand to "TI" in DImode and "DI"
717 (define_mode_attr DBL [(DI "TI") (SI "DI")])
719 ;; This attribute expands to DF for TFmode and to DD for TDmode . It is
720 ;; used for Txmode splitters splitting a Txmode copy into 2 Dxmode copies.
721 (define_mode_attr HALF_TMODE [(TF "DF") (TD "DD")])
723 ;; Maximum unsigned integer that fits in MODE.
724 (define_mode_attr max_uint [(HI "65535") (QI "255")])
726 ;; Start and end field computations for RISBG et al.
727 (define_mode_attr bfstart [(DI "s") (SI "t")])
728 (define_mode_attr bfend [(DI "e") (SI "f")])
730 ;; In place of GET_MODE_BITSIZE (<MODE>mode)
731 (define_mode_attr bitsize [(DI "64") (SI "32") (HI "16") (QI "8")])
733 ;; In place of GET_MODE_SIZE (<MODE>mode)
734 (define_mode_attr modesize [(DI "8") (SI "4")])
736 ;; Allow return and simple_return to be defined from a single template.
737 (define_code_iterator ANY_RETURN [return simple_return])
741 ; Condition code modes generated by vector fp comparisons. These will
742 ; be used also in single element mode.
743 (define_mode_iterator VFCMP [CCVEQ CCVFH CCVFHE])
744 ; Used with VFCMP to expand part of the mnemonic
745 ; For fp we have a mismatch: eq in the insn name - e in asm
746 (define_mode_attr asm_fcmp [(CCVEQ "e") (CCVFH "h") (CCVFHE "he")])
747 (define_mode_attr insn_cmp [(CCVEQ "eq") (CCVH "h") (CCVHU "hl") (CCVFH "h") (CCVFHE "he")])
750 (include "vector.md")
753 ;;- Compare instructions.
756 ; Test-under-Mask instructions
758 (define_insn "*tmqi_mem"
759 [(set (reg CC_REGNUM)
760 (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S")
761 (match_operand:QI 1 "immediate_operand" "n,n"))
762 (match_operand:QI 2 "immediate_operand" "n,n")))]
763 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], false))"
767 [(set_attr "op_type" "SI,SIY")
768 (set_attr "z10prop" "z10_super,z10_super")])
770 (define_insn "*tmdi_reg"
771 [(set (reg CC_REGNUM)
772 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
773 (match_operand:DI 1 "immediate_operand"
774 "N0HD0,N1HD0,N2HD0,N3HD0"))
775 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
777 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
778 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
784 [(set_attr "op_type" "RI")
785 (set_attr "z10prop" "z10_super,z10_super,z10_super,z10_super")])
787 (define_insn "*tmsi_reg"
788 [(set (reg CC_REGNUM)
789 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
790 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
791 (match_operand:SI 2 "immediate_operand" "n,n")))]
792 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
793 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
797 [(set_attr "op_type" "RI")
798 (set_attr "z10prop" "z10_super,z10_super")])
800 (define_insn "*tm<mode>_full"
801 [(set (reg CC_REGNUM)
802 (compare (match_operand:HQI 0 "register_operand" "d")
803 (match_operand:HQI 1 "immediate_operand" "n")))]
804 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], true))"
806 [(set_attr "op_type" "RI")
807 (set_attr "z10prop" "z10_super")])
811 ; Load-and-Test instructions
814 ; tst(di|si) instruction pattern(s).
816 (define_insn "*tstdi_sign"
817 [(set (reg CC_REGNUM)
821 (subreg:DI (match_operand:SI 0 "nonimmediate_operand" "d,RT") 0)
822 (const_int 32)) (const_int 32))
823 (match_operand:DI 1 "const0_operand" "")))
824 (set (match_operand:DI 2 "register_operand" "=d,d")
825 (sign_extend:DI (match_dup 0)))]
826 "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH"
829 [(set_attr "op_type" "RRE,RXY")
830 (set_attr "cpu_facility" "*,z10")
831 (set_attr "z10prop" "z10_super_E1,z10_super_E1") ])
834 (define_insn "*tst<mode>_extimm"
835 [(set (reg CC_REGNUM)
836 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,RT")
837 (match_operand:GPR 1 "const0_operand" "")))
838 (set (match_operand:GPR 2 "register_operand" "=d,d")
840 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
844 [(set_attr "op_type" "RR<E>,RXY")
845 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3") ])
848 (define_insn "*tst<mode>_cconly_extimm"
849 [(set (reg CC_REGNUM)
850 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,RT")
851 (match_operand:GPR 1 "const0_operand" "")))
852 (clobber (match_scratch:GPR 2 "=X,d"))]
853 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
857 [(set_attr "op_type" "RR<E>,RXY")
858 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3")])
860 (define_insn "*tstdi"
861 [(set (reg CC_REGNUM)
862 (compare (match_operand:DI 0 "register_operand" "d")
863 (match_operand:DI 1 "const0_operand" "")))
864 (set (match_operand:DI 2 "register_operand" "=d")
866 "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH && !TARGET_EXTIMM"
868 [(set_attr "op_type" "RRE")
869 (set_attr "z10prop" "z10_fr_E1")])
871 (define_insn "*tstsi"
872 [(set (reg CC_REGNUM)
873 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
874 (match_operand:SI 1 "const0_operand" "")))
875 (set (match_operand:SI 2 "register_operand" "=d,d,d")
877 "s390_match_ccmode(insn, CCSmode) && !TARGET_EXTIMM"
882 [(set_attr "op_type" "RR,RS,RSY")
883 (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
885 (define_insn "*tstsi_cconly"
886 [(set (reg CC_REGNUM)
887 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
888 (match_operand:SI 1 "const0_operand" "")))
889 (clobber (match_scratch:SI 2 "=X,d,d"))]
890 "s390_match_ccmode(insn, CCSmode)"
895 [(set_attr "op_type" "RR,RS,RSY")
896 (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
898 (define_insn "*tstdi_cconly_31"
899 [(set (reg CC_REGNUM)
900 (compare (match_operand:DI 0 "register_operand" "d")
901 (match_operand:DI 1 "const0_operand" "")))]
902 "s390_match_ccmode(insn, CCSmode) && !TARGET_ZARCH"
904 [(set_attr "op_type" "RS")
905 (set_attr "atype" "reg")])
908 (define_insn "*tst<mode>_cconly2"
909 [(set (reg CC_REGNUM)
910 (compare (match_operand:GPR 0 "register_operand" "d")
911 (match_operand:GPR 1 "const0_operand" "")))]
912 "s390_match_ccmode(insn, CCSmode)"
914 [(set_attr "op_type" "RR<E>")
915 (set_attr "z10prop" "z10_fr_E1")])
917 ; tst(hi|qi) instruction pattern(s).
919 (define_insn "*tst<mode>CCT"
920 [(set (reg CC_REGNUM)
921 (compare (match_operand:HQI 0 "nonimmediate_operand" "?Q,?S,d")
922 (match_operand:HQI 1 "const0_operand" "")))
923 (set (match_operand:HQI 2 "register_operand" "=d,d,0")
925 "s390_match_ccmode(insn, CCTmode)"
928 icmy\t%2,<icm_lo>,%S0
930 [(set_attr "op_type" "RS,RSY,RI")
931 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
933 (define_insn "*tsthiCCT_cconly"
934 [(set (reg CC_REGNUM)
935 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
936 (match_operand:HI 1 "const0_operand" "")))
937 (clobber (match_scratch:HI 2 "=d,d,X"))]
938 "s390_match_ccmode(insn, CCTmode)"
943 [(set_attr "op_type" "RS,RSY,RI")
944 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
946 (define_insn "*tstqiCCT_cconly"
947 [(set (reg CC_REGNUM)
948 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
949 (match_operand:QI 1 "const0_operand" "")))]
950 "s390_match_ccmode(insn, CCTmode)"
955 [(set_attr "op_type" "SI,SIY,RI")
956 (set_attr "z10prop" "z10_super,z10_super,z10_super")])
958 (define_insn "*tst<mode>"
959 [(set (reg CC_REGNUM)
960 (compare (match_operand:HQI 0 "s_operand" "Q,S")
961 (match_operand:HQI 1 "const0_operand" "")))
962 (set (match_operand:HQI 2 "register_operand" "=d,d")
964 "s390_match_ccmode(insn, CCSmode)"
967 icmy\t%2,<icm_lo>,%S0"
968 [(set_attr "op_type" "RS,RSY")
969 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
971 (define_insn "*tst<mode>_cconly"
972 [(set (reg CC_REGNUM)
973 (compare (match_operand:HQI 0 "s_operand" "Q,S")
974 (match_operand:HQI 1 "const0_operand" "")))
975 (clobber (match_scratch:HQI 2 "=d,d"))]
976 "s390_match_ccmode(insn, CCSmode)"
979 icmy\t%2,<icm_lo>,%S0"
980 [(set_attr "op_type" "RS,RSY")
981 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
984 ; Compare (equality) instructions
986 (define_insn "*cmpdi_cct"
987 [(set (reg CC_REGNUM)
988 (compare (match_operand:DI 0 "nonimmediate_operand" "%d,d,d,d,Q")
989 (match_operand:DI 1 "general_operand" "d,K,Os,RT,BQ")))]
990 "s390_match_ccmode (insn, CCTmode) && TARGET_ZARCH"
997 [(set_attr "op_type" "RRE,RI,RIL,RXY,SS")
998 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,*")])
1000 (define_insn "*cmpsi_cct"
1001 [(set (reg CC_REGNUM)
1002 (compare (match_operand:SI 0 "nonimmediate_operand" "%d,d,d,d,d,Q")
1003 (match_operand:SI 1 "general_operand" "d,K,Os,R,T,BQ")))]
1004 "s390_match_ccmode (insn, CCTmode)"
1012 [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS")
1013 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*")])
1015 ; Compare (signed) instructions
1017 (define_insn "*cmpdi_ccs_sign"
1018 [(set (reg CC_REGNUM)
1019 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand"
1021 (match_operand:DI 0 "register_operand" "d, d,d")))]
1022 "s390_match_ccmode(insn, CCSRmode) && TARGET_ZARCH"
1027 [(set_attr "op_type" "RRE,RXY,RIL")
1028 (set_attr "z10prop" "z10_c,*,*")
1029 (set_attr "type" "*,*,larl")])
1033 (define_insn "*cmpsi_ccs_sign"
1034 [(set (reg CC_REGNUM)
1035 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T,b"))
1036 (match_operand:SI 0 "register_operand" "d,d,d")))]
1037 "s390_match_ccmode(insn, CCSRmode)"
1042 [(set_attr "op_type" "RX,RXY,RIL")
1043 (set_attr "cpu_facility" "*,*,z10")
1044 (set_attr "type" "*,*,larl")
1045 (set_attr "z196prop" "z196_cracked,z196_cracked,z196_cracked")])
1047 (define_insn "*cmphi_ccs_z10"
1048 [(set (reg CC_REGNUM)
1049 (compare (match_operand:HI 0 "s_operand" "Q")
1050 (match_operand:HI 1 "immediate_operand" "K")))]
1051 "s390_match_ccmode(insn, CCSmode) && TARGET_Z10"
1053 [(set_attr "op_type" "SIL")
1054 (set_attr "z196prop" "z196_cracked")])
1056 (define_insn "*cmpdi_ccs_signhi_rl"
1057 [(set (reg CC_REGNUM)
1058 (compare (sign_extend:DI (match_operand:HI 1 "memory_operand" "RT,b"))
1059 (match_operand:GPR 0 "register_operand" "d,d")))]
1060 "s390_match_ccmode(insn, CCSRmode) && TARGET_Z10"
1064 [(set_attr "op_type" "RXY,RIL")
1065 (set_attr "type" "*,larl")])
1067 ; cr, chi, cfi, c, cy, cgr, cghi, cgfi, cg, chsi, cghsi, crl, cgrl
1068 (define_insn "*cmp<mode>_ccs"
1069 [(set (reg CC_REGNUM)
1070 (compare (match_operand:GPR 0 "nonimmediate_operand"
1072 (match_operand:GPR 1 "general_operand"
1073 "d,K,K,Os,R,T,b")))]
1074 "s390_match_ccmode(insn, CCSmode)"
1083 [(set_attr "op_type" "RR<E>,RI,SIL,RIL,RX<Y>,RXY,RIL")
1084 (set_attr "cpu_facility" "*,*,z10,extimm,*,*,z10")
1085 (set_attr "type" "*,*,*,*,*,*,larl")
1086 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,z10_super")])
1089 ; Compare (unsigned) instructions
1091 (define_insn "*cmpsi_ccu_zerohi_rlsi"
1092 [(set (reg CC_REGNUM)
1093 (compare (zero_extend:SI (mem:HI (match_operand:SI 1
1094 "larl_operand" "X")))
1095 (match_operand:SI 0 "register_operand" "d")))]
1096 "s390_match_ccmode(insn, CCURmode) && TARGET_Z10"
1098 [(set_attr "op_type" "RIL")
1099 (set_attr "type" "larl")
1100 (set_attr "z10prop" "z10_super")])
1103 (define_insn "*cmp<GPR:mode>_ccu_zerohi_rldi"
1104 [(set (reg CC_REGNUM)
1105 (compare (zero_extend:GPR (mem:HI (match_operand:DI 1
1106 "larl_operand" "X")))
1107 (match_operand:GPR 0 "register_operand" "d")))]
1108 "s390_match_ccmode(insn, CCURmode) && TARGET_Z10"
1110 [(set_attr "op_type" "RIL")
1111 (set_attr "type" "larl")
1112 (set_attr "z10prop" "z10_super")])
1114 (define_insn "*cmpdi_ccu_zero"
1115 [(set (reg CC_REGNUM)
1116 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand"
1118 (match_operand:DI 0 "register_operand" "d, d,d")))]
1119 "s390_match_ccmode (insn, CCURmode) && TARGET_ZARCH"
1124 [(set_attr "op_type" "RRE,RXY,RIL")
1125 (set_attr "cpu_facility" "*,*,z10")
1126 (set_attr "type" "*,*,larl")
1127 (set_attr "z10prop" "z10_super_c,z10_super_E1,z10_super")])
1129 (define_insn "*cmpdi_ccu"
1130 [(set (reg CC_REGNUM)
1131 (compare (match_operand:DI 0 "nonimmediate_operand"
1132 "d, d,d,Q, d, Q,BQ")
1133 (match_operand:DI 1 "general_operand"
1134 "d,Op,b,D,RT,BQ,Q")))]
1135 "s390_match_ccmode (insn, CCUmode) && TARGET_ZARCH"
1144 [(set_attr "op_type" "RRE,RIL,RIL,SIL,RXY,SS,SS")
1145 (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*")
1146 (set_attr "type" "*,*,larl,*,*,*,*")
1147 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*,*")])
1149 (define_insn "*cmpsi_ccu"
1150 [(set (reg CC_REGNUM)
1151 (compare (match_operand:SI 0 "nonimmediate_operand" "d, d,d,Q,d,d, Q,BQ")
1152 (match_operand:SI 1 "general_operand" "d,Os,b,D,R,T,BQ, Q")))]
1153 "s390_match_ccmode (insn, CCUmode)"
1163 [(set_attr "op_type" "RR,RIL,RIL,SIL,RX,RXY,SS,SS")
1164 (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*,*")
1165 (set_attr "type" "*,*,larl,*,*,*,*,*")
1166 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,*,*")])
1168 (define_insn "*cmphi_ccu"
1169 [(set (reg CC_REGNUM)
1170 (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,Q,BQ")
1171 (match_operand:HI 1 "general_operand" "Q,S,D,BQ,Q")))]
1172 "s390_match_ccmode (insn, CCUmode)
1173 && !register_operand (operands[1], HImode)"
1180 [(set_attr "op_type" "RS,RSY,SIL,SS,SS")
1181 (set_attr "cpu_facility" "*,*,z10,*,*")
1182 (set_attr "z10prop" "*,*,z10_super,*,*")])
1184 (define_insn "*cmpqi_ccu"
1185 [(set (reg CC_REGNUM)
1186 (compare (match_operand:QI 0 "nonimmediate_operand" "d,d,Q,S,Q,BQ")
1187 (match_operand:QI 1 "general_operand" "Q,S,n,n,BQ,Q")))]
1188 "s390_match_ccmode (insn, CCUmode)
1189 && !register_operand (operands[1], QImode)"
1197 [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS")
1198 (set_attr "z10prop" "*,*,z10_super,z10_super,*,*")])
1201 ; Block compare (CLC) instruction patterns.
1204 [(set (reg CC_REGNUM)
1205 (compare (match_operand:BLK 0 "memory_operand" "Q")
1206 (match_operand:BLK 1 "memory_operand" "Q")))
1207 (use (match_operand 2 "const_int_operand" "n"))]
1208 "s390_match_ccmode (insn, CCUmode)
1209 && INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
1210 "clc\t%O0(%2,%R0),%S1"
1211 [(set_attr "op_type" "SS")])
1214 [(set (reg CC_REGNUM)
1215 (compare (match_operand 0 "memory_operand" "")
1216 (match_operand 1 "memory_operand" "")))]
1218 && s390_match_ccmode (insn, CCUmode)
1219 && GET_MODE (operands[0]) == GET_MODE (operands[1])
1220 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
1222 [(set (match_dup 0) (match_dup 1))
1223 (use (match_dup 2))])]
1225 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
1226 operands[0] = adjust_address (operands[0], BLKmode, 0);
1227 operands[1] = adjust_address (operands[1], BLKmode, 0);
1229 operands[1] = gen_rtx_COMPARE (GET_MODE (SET_DEST (PATTERN (curr_insn))),
1230 operands[0], operands[1]);
1231 operands[0] = SET_DEST (PATTERN (curr_insn));
1235 ; (TF|DF|SF|TD|DD|SD) instructions
1237 ; ltxbr, ltdbr, ltebr, ltxtr, ltdtr
1238 (define_insn "*cmp<mode>_ccs_0"
1239 [(set (reg CC_REGNUM)
1240 (compare (match_operand:FP 0 "register_operand" "f")
1241 (match_operand:FP 1 "const0_operand" "")))]
1242 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
1243 "lt<xde><bt>r\t%0,%0"
1244 [(set_attr "op_type" "RRE")
1245 (set_attr "type" "fsimp<mode>")])
1247 ; cxtr, cxbr, cdtr, cdbr, cebr, cdb, ceb
1248 (define_insn "*cmp<mode>_ccs"
1249 [(set (reg CC_REGNUM)
1250 (compare (match_operand:FP 0 "register_operand" "f,f")
1251 (match_operand:FP 1 "general_operand" "f,<Rf>")))]
1252 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
1256 [(set_attr "op_type" "RRE,RXE")
1257 (set_attr "type" "fsimp<mode>")])
1259 ; wfcedbs, wfchdbs, wfchedbs
1260 (define_insn "*vec_cmp<insn_cmp>df_cconly"
1261 [(set (reg:VFCMP CC_REGNUM)
1262 (compare:VFCMP (match_operand:DF 0 "register_operand" "v")
1263 (match_operand:DF 1 "register_operand" "v")))
1264 (clobber (match_scratch:V2DI 2 "=v"))]
1265 "TARGET_Z13 && TARGET_HARD_FLOAT"
1266 "wfc<asm_fcmp>dbs\t%v2,%v0,%v1"
1267 [(set_attr "op_type" "VRR")])
1269 ; Compare and Branch instructions
1271 ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
1272 ; The following instructions do a complementary access of their second
1273 ; operand (z01 only): crj_c, cgrjc, cr, cgr
1274 (define_insn "*cmp_and_br_signed_<mode>"
1276 (if_then_else (match_operator 0 "s390_signed_integer_comparison"
1277 [(match_operand:GPR 1 "register_operand" "d,d")
1278 (match_operand:GPR 2 "nonmemory_operand" "d,C")])
1279 (label_ref (match_operand 3 "" ""))
1281 (clobber (reg:CC CC_REGNUM))]
1282 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1284 if (get_attr_length (insn) == 6)
1285 return which_alternative ?
1286 "c<g>ij%C0\t%1,%c2,%l3" : "c<g>rj%C0\t%1,%2,%l3";
1288 return which_alternative ?
1289 "c<g>fi\t%1,%c2\;jg%C0\t%l3" : "c<g>r\t%1,%2\;jg%C0\t%l3";
1291 [(set_attr "op_type" "RIE")
1292 (set_attr "type" "branch")
1293 (set_attr "z10prop" "z10_super_c,z10_super")
1294 (set (attr "length")
1295 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1296 (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg
1297 ; 10 byte for cgr/jg
1299 ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr
1300 ; The following instructions do a complementary access of their second
1301 ; operand (z10 only): clrj, clgrj, clr, clgr
1302 (define_insn "*cmp_and_br_unsigned_<mode>"
1304 (if_then_else (match_operator 0 "s390_unsigned_integer_comparison"
1305 [(match_operand:GPR 1 "register_operand" "d,d")
1306 (match_operand:GPR 2 "nonmemory_operand" "d,I")])
1307 (label_ref (match_operand 3 "" ""))
1309 (clobber (reg:CC CC_REGNUM))]
1310 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1312 if (get_attr_length (insn) == 6)
1313 return which_alternative ?
1314 "cl<g>ij%C0\t%1,%b2,%l3" : "cl<g>rj%C0\t%1,%2,%l3";
1316 return which_alternative ?
1317 "cl<g>fi\t%1,%b2\;jg%C0\t%l3" : "cl<g>r\t%1,%2\;jg%C0\t%l3";
1319 [(set_attr "op_type" "RIE")
1320 (set_attr "type" "branch")
1321 (set_attr "z10prop" "z10_super_c,z10_super")
1322 (set (attr "length")
1323 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1324 (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg
1325 ; 10 byte for clgr/jg
1327 ; And now the same two patterns as above but with a negated CC mask.
1329 ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
1330 ; The following instructions do a complementary access of their second
1331 ; operand (z01 only): crj_c, cgrjc, cr, cgr
1332 (define_insn "*icmp_and_br_signed_<mode>"
1334 (if_then_else (match_operator 0 "s390_signed_integer_comparison"
1335 [(match_operand:GPR 1 "register_operand" "d,d")
1336 (match_operand:GPR 2 "nonmemory_operand" "d,C")])
1338 (label_ref (match_operand 3 "" ""))))
1339 (clobber (reg:CC CC_REGNUM))]
1340 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1342 if (get_attr_length (insn) == 6)
1343 return which_alternative ?
1344 "c<g>ij%D0\t%1,%c2,%l3" : "c<g>rj%D0\t%1,%2,%l3";
1346 return which_alternative ?
1347 "c<g>fi\t%1,%c2\;jg%D0\t%l3" : "c<g>r\t%1,%2\;jg%D0\t%l3";
1349 [(set_attr "op_type" "RIE")
1350 (set_attr "type" "branch")
1351 (set_attr "z10prop" "z10_super_c,z10_super")
1352 (set (attr "length")
1353 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1354 (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg
1355 ; 10 byte for cgr/jg
1357 ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr
1358 ; The following instructions do a complementary access of their second
1359 ; operand (z10 only): clrj, clgrj, clr, clgr
1360 (define_insn "*icmp_and_br_unsigned_<mode>"
1362 (if_then_else (match_operator 0 "s390_unsigned_integer_comparison"
1363 [(match_operand:GPR 1 "register_operand" "d,d")
1364 (match_operand:GPR 2 "nonmemory_operand" "d,I")])
1366 (label_ref (match_operand 3 "" ""))))
1367 (clobber (reg:CC CC_REGNUM))]
1368 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1370 if (get_attr_length (insn) == 6)
1371 return which_alternative ?
1372 "cl<g>ij%D0\t%1,%b2,%l3" : "cl<g>rj%D0\t%1,%2,%l3";
1374 return which_alternative ?
1375 "cl<g>fi\t%1,%b2\;jg%D0\t%l3" : "cl<g>r\t%1,%2\;jg%D0\t%l3";
1377 [(set_attr "op_type" "RIE")
1378 (set_attr "type" "branch")
1379 (set_attr "z10prop" "z10_super_c,z10_super")
1380 (set (attr "length")
1381 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1382 (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg
1383 ; 10 byte for clgr/jg
1386 ;;- Move instructions.
1390 ; movti instruction pattern(s).
1393 ; FIXME: More constants are possible by enabling jxx, jyy constraints
1394 ; for TImode (use double-int for the calculations)
1395 (define_insn "movti"
1396 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,v, v, v,v,d, v,QR, d,o")
1397 (match_operand:TI 1 "general_operand" "QS, d,v,j00,jm1,d,v,QR, v,dPRT,d"))]
1411 [(set_attr "op_type" "RSY,RSY,VRR,VRI,VRI,VRR,*,VRX,VRX,*,*")
1412 (set_attr "type" "lm,stm,*,*,*,*,*,*,*,*,*")
1413 (set_attr "cpu_facility" "*,*,vec,vec,vec,vec,vec,vec,vec,*,*")])
1416 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1417 (match_operand:TI 1 "general_operand" ""))]
1418 "TARGET_ZARCH && reload_completed
1419 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
1420 [(set (match_dup 2) (match_dup 4))
1421 (set (match_dup 3) (match_dup 5))]
1423 operands[2] = operand_subword (operands[0], 0, 0, TImode);
1424 operands[3] = operand_subword (operands[0], 1, 0, TImode);
1425 operands[4] = operand_subword (operands[1], 0, 0, TImode);
1426 operands[5] = operand_subword (operands[1], 1, 0, TImode);
1430 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1431 (match_operand:TI 1 "general_operand" ""))]
1432 "TARGET_ZARCH && reload_completed
1433 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
1434 [(set (match_dup 2) (match_dup 4))
1435 (set (match_dup 3) (match_dup 5))]
1437 operands[2] = operand_subword (operands[0], 1, 0, TImode);
1438 operands[3] = operand_subword (operands[0], 0, 0, TImode);
1439 operands[4] = operand_subword (operands[1], 1, 0, TImode);
1440 operands[5] = operand_subword (operands[1], 0, 0, TImode);
1443 ; Use part of the TImode target reg to perform the address
1444 ; calculation. If the TImode value is supposed to be copied into a VR
1445 ; this splitter is not necessary.
1447 [(set (match_operand:TI 0 "register_operand" "")
1448 (match_operand:TI 1 "memory_operand" ""))]
1449 "TARGET_ZARCH && reload_completed
1450 && !VECTOR_REG_P (operands[0])
1451 && !s_operand (operands[1], VOIDmode)"
1452 [(set (match_dup 0) (match_dup 1))]
1454 rtx addr = operand_subword (operands[0], 1, 0, TImode);
1455 addr = gen_lowpart (Pmode, addr);
1456 s390_load_address (addr, XEXP (operands[1], 0));
1457 operands[1] = replace_equiv_address (operands[1], addr);
1461 ; Split a VR -> GPR TImode move into 2 vector load GR from VR element.
1462 ; For the higher order bits we do simply a DImode move while the
1463 ; second part is done via vec extract. Both will end up as vlgvg.
1465 [(set (match_operand:TI 0 "register_operand" "")
1466 (match_operand:TI 1 "register_operand" ""))]
1467 "TARGET_VX && reload_completed
1468 && GENERAL_REG_P (operands[0])
1469 && VECTOR_REG_P (operands[1])"
1470 [(set (match_dup 2) (match_dup 4))
1471 (set (match_dup 3) (unspec:DI [(match_dup 5) (const_int 1)]
1472 UNSPEC_VEC_EXTRACT))]
1474 operands[2] = operand_subword (operands[0], 0, 0, TImode);
1475 operands[3] = operand_subword (operands[0], 1, 0, TImode);
1476 operands[4] = gen_rtx_REG (DImode, REGNO (operands[1]));
1477 operands[5] = gen_rtx_REG (V2DImode, REGNO (operands[1]));
1481 ; Patterns used for secondary reloads
1484 ; z10 provides move instructions accepting larl memory operands.
1485 ; Unfortunately there is no such variant for QI, TI and FP mode moves.
1486 ; These patterns are also used for unaligned SI and DI accesses.
1488 (define_expand "reload<ALL:mode><P:mode>_tomem_z10"
1489 [(parallel [(match_operand:ALL 0 "memory_operand" "")
1490 (match_operand:ALL 1 "register_operand" "=d")
1491 (match_operand:P 2 "register_operand" "=&a")])]
1494 s390_reload_symref_address (operands[1], operands[0], operands[2], 1);
1498 (define_expand "reload<ALL:mode><P:mode>_toreg_z10"
1499 [(parallel [(match_operand:ALL 0 "register_operand" "=d")
1500 (match_operand:ALL 1 "memory_operand" "")
1501 (match_operand:P 2 "register_operand" "=a")])]
1504 s390_reload_symref_address (operands[0], operands[1], operands[2], 0);
1508 (define_expand "reload<P:mode>_larl_odd_addend_z10"
1509 [(parallel [(match_operand:P 0 "register_operand" "=d")
1510 (match_operand:P 1 "larl_operand" "")
1511 (match_operand:P 2 "register_operand" "=a")])]
1514 s390_reload_larl_operand (operands[0], operands[1], operands[2]);
1518 ; Handles loading a PLUS (load address) expression
1520 (define_expand "reload<mode>_plus"
1521 [(parallel [(match_operand:P 0 "register_operand" "=a")
1522 (match_operand:P 1 "s390_plus_operand" "")
1523 (match_operand:P 2 "register_operand" "=&a")])]
1526 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1530 ; Not all the indirect memory access instructions support the full
1531 ; format (long disp + index + base). So whenever a move from/to such
1532 ; an address is required and the instruction cannot deal with it we do
1533 ; a load address into a scratch register first and use this as the new
1535 ; This in particular is used for:
1536 ; - non-offsetable memory accesses for multiword moves
1537 ; - full vector reg moves with long displacements
1539 (define_expand "reload<mode>_la_in"
1540 [(parallel [(match_operand 0 "register_operand" "")
1541 (match_operand 1 "" "")
1542 (match_operand:P 2 "register_operand" "=&a")])]
1545 gcc_assert (MEM_P (operands[1]));
1546 s390_load_address (operands[2], find_replacement (&XEXP (operands[1], 0)));
1547 operands[1] = replace_equiv_address (operands[1], operands[2]);
1548 emit_move_insn (operands[0], operands[1]);
1552 (define_expand "reload<mode>_la_out"
1553 [(parallel [(match_operand 0 "" "")
1554 (match_operand 1 "register_operand" "")
1555 (match_operand:P 2 "register_operand" "=&a")])]
1558 gcc_assert (MEM_P (operands[0]));
1559 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
1560 operands[0] = replace_equiv_address (operands[0], operands[2]);
1561 emit_move_insn (operands[0], operands[1]);
1565 (define_expand "reload<mode>_PIC_addr"
1566 [(parallel [(match_operand 0 "register_operand" "=d")
1567 (match_operand 1 "larl_operand" "")
1568 (match_operand:P 2 "register_operand" "=a")])]
1571 rtx new_rtx = legitimize_pic_address (operands[1], operands[2]);
1572 emit_move_insn (operands[0], new_rtx);
1576 ; movdi instruction pattern(s).
1579 (define_expand "movdi"
1580 [(set (match_operand:DI 0 "general_operand" "")
1581 (match_operand:DI 1 "general_operand" ""))]
1584 /* Handle symbolic constants. */
1586 && (SYMBOLIC_CONST (operands[1])
1587 || (GET_CODE (operands[1]) == PLUS
1588 && XEXP (operands[1], 0) == pic_offset_table_rtx
1589 && SYMBOLIC_CONST (XEXP (operands[1], 1)))))
1590 emit_symbolic_move (operands);
1593 (define_insn "*movdi_larl"
1594 [(set (match_operand:DI 0 "register_operand" "=d")
1595 (match_operand:DI 1 "larl_operand" "X"))]
1597 && !FP_REG_P (operands[0])"
1599 [(set_attr "op_type" "RIL")
1600 (set_attr "type" "larl")
1601 (set_attr "z10prop" "z10_super_A1")])
1603 (define_insn "*movdi_64"
1604 [(set (match_operand:DI 0 "nonimmediate_operand"
1605 "=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")
1606 (match_operand:DI 1 "general_operand"
1607 " 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"))]
1642 [(set_attr "op_type" "RI,RI,RI,RI,RI,RIL,RIL,RIL,RRE,RRE,RXY,RIL,RRE,RXY,
1643 RXY,RR,RX,RXY,RX,RXY,RIL,SIL,*,*,RS,RS,VRI,VRR,VRS,VRS,VRX,VRX")
1644 (set_attr "type" "*,*,*,*,*,*,*,*,floaddf,floaddf,la,larl,lr,load,store,
1645 floaddf,floaddf,floaddf,fstoredf,fstoredf,larl,*,*,*,*,
1647 (set_attr "cpu_facility" "*,*,*,*,*,extimm,extimm,extimm,dfp,dfp,longdisp,
1648 z10,*,*,*,*,*,longdisp,*,longdisp,
1649 z10,z10,*,*,*,*,vec,vec,vec,vec,vec,vec")
1650 (set_attr "z10prop" "z10_fwd_A1,
1679 [(set (match_operand:DI 0 "register_operand" "")
1680 (match_operand:DI 1 "register_operand" ""))]
1681 "TARGET_ZARCH && ACCESS_REG_P (operands[1])"
1682 [(set (match_dup 2) (match_dup 3))
1683 (set (match_dup 0) (ashift:DI (match_dup 0) (const_int 32)))
1684 (set (strict_low_part (match_dup 2)) (match_dup 4))]
1685 "operands[2] = gen_lowpart (SImode, operands[0]);
1686 s390_split_access_reg (operands[1], &operands[4], &operands[3]);")
1689 [(set (match_operand:DI 0 "register_operand" "")
1690 (match_operand:DI 1 "register_operand" ""))]
1691 "TARGET_ZARCH && ACCESS_REG_P (operands[0])
1692 && dead_or_set_p (insn, operands[1])"
1693 [(set (match_dup 3) (match_dup 2))
1694 (set (match_dup 1) (lshiftrt:DI (match_dup 1) (const_int 32)))
1695 (set (match_dup 4) (match_dup 2))]
1696 "operands[2] = gen_lowpart (SImode, operands[1]);
1697 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1700 [(set (match_operand:DI 0 "register_operand" "")
1701 (match_operand:DI 1 "register_operand" ""))]
1702 "TARGET_ZARCH && ACCESS_REG_P (operands[0])
1703 && !dead_or_set_p (insn, operands[1])"
1704 [(set (match_dup 3) (match_dup 2))
1705 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))
1706 (set (match_dup 4) (match_dup 2))
1707 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))]
1708 "operands[2] = gen_lowpart (SImode, operands[1]);
1709 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1711 (define_insn "*movdi_31"
1712 [(set (match_operand:DI 0 "nonimmediate_operand"
1713 "=d,d,Q,S,d ,o,!*f,!*f,!*f,!R,!T,d")
1714 (match_operand:DI 1 "general_operand"
1715 " Q,S,d,d,dPRT,d, *f, R, T,*f,*f,b"))]
1730 [(set_attr "op_type" "RS,RSY,RS,RSY,*,*,RR,RX,RXY,RX,RXY,*")
1731 (set_attr "type" "lm,lm,stm,stm,*,*,floaddf,floaddf,floaddf,fstoredf,fstoredf,*")
1732 (set_attr "cpu_facility" "*,*,*,*,*,*,*,*,*,*,*,z10")])
1734 ; For a load from a symbol ref we can use one of the target registers
1735 ; together with larl to load the address.
1737 [(set (match_operand:DI 0 "register_operand" "")
1738 (match_operand:DI 1 "memory_operand" ""))]
1739 "!TARGET_ZARCH && reload_completed && TARGET_Z10
1740 && larl_operand (XEXP (operands[1], 0), SImode)"
1741 [(set (match_dup 2) (match_dup 3))
1742 (set (match_dup 0) (match_dup 1))]
1744 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1745 operands[3] = XEXP (operands[1], 0);
1746 operands[1] = replace_equiv_address (operands[1], operands[2]);
1750 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1751 (match_operand:DI 1 "general_operand" ""))]
1752 "!TARGET_ZARCH && reload_completed
1753 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1754 [(set (match_dup 2) (match_dup 4))
1755 (set (match_dup 3) (match_dup 5))]
1757 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1758 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1759 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1760 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1764 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1765 (match_operand:DI 1 "general_operand" ""))]
1766 "!TARGET_ZARCH && reload_completed
1767 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1768 [(set (match_dup 2) (match_dup 4))
1769 (set (match_dup 3) (match_dup 5))]
1771 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1772 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1773 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1774 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1778 [(set (match_operand:DI 0 "register_operand" "")
1779 (match_operand:DI 1 "memory_operand" ""))]
1780 "!TARGET_ZARCH && reload_completed
1781 && !FP_REG_P (operands[0])
1782 && !s_operand (operands[1], VOIDmode)"
1783 [(set (match_dup 0) (match_dup 1))]
1785 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1786 s390_load_address (addr, XEXP (operands[1], 0));
1787 operands[1] = replace_equiv_address (operands[1], addr);
1791 [(set (match_operand:DI 0 "register_operand" "")
1792 (mem:DI (match_operand 1 "address_operand" "")))]
1794 && !FP_REG_P (operands[0])
1795 && GET_CODE (operands[1]) == SYMBOL_REF
1796 && CONSTANT_POOL_ADDRESS_P (operands[1])
1797 && get_pool_mode (operands[1]) == DImode
1798 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1799 [(set (match_dup 0) (match_dup 2))]
1800 "operands[2] = get_pool_constant (operands[1]);")
1802 (define_insn "*la_64"
1803 [(set (match_operand:DI 0 "register_operand" "=d,d")
1804 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))]
1809 [(set_attr "op_type" "RX,RXY")
1810 (set_attr "type" "la")
1811 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
1815 [(set (match_operand:DI 0 "register_operand" "")
1816 (match_operand:QI 1 "address_operand" ""))
1817 (clobber (reg:CC CC_REGNUM))])]
1819 && preferred_la_operand_p (operands[1], const0_rtx)"
1820 [(set (match_dup 0) (match_dup 1))]
1824 [(set (match_operand:DI 0 "register_operand" "")
1825 (match_operand:DI 1 "register_operand" ""))
1828 (plus:DI (match_dup 0)
1829 (match_operand:DI 2 "nonmemory_operand" "")))
1830 (clobber (reg:CC CC_REGNUM))])]
1832 && !reg_overlap_mentioned_p (operands[0], operands[2])
1833 && preferred_la_operand_p (operands[1], operands[2])"
1834 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1838 ; movsi instruction pattern(s).
1841 (define_expand "movsi"
1842 [(set (match_operand:SI 0 "general_operand" "")
1843 (match_operand:SI 1 "general_operand" ""))]
1846 /* Handle symbolic constants. */
1848 && (SYMBOLIC_CONST (operands[1])
1849 || (GET_CODE (operands[1]) == PLUS
1850 && XEXP (operands[1], 0) == pic_offset_table_rtx
1851 && SYMBOLIC_CONST (XEXP(operands[1], 1)))))
1852 emit_symbolic_move (operands);
1855 (define_insn "*movsi_larl"
1856 [(set (match_operand:SI 0 "register_operand" "=d")
1857 (match_operand:SI 1 "larl_operand" "X"))]
1858 "!TARGET_64BIT && TARGET_CPU_ZARCH
1859 && !FP_REG_P (operands[0])"
1861 [(set_attr "op_type" "RIL")
1862 (set_attr "type" "larl")
1863 (set_attr "z10prop" "z10_fwd_A1")])
1865 (define_insn "*movsi_zarch"
1866 [(set (match_operand:SI 0 "nonimmediate_operand"
1867 "=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")
1868 (match_operand:SI 1 "general_operand"
1869 " 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"))]
1902 [(set_attr "op_type" "RI,RI,RI,RIL,RXY,RIL,RR,RX,RXY,RX,RXY,
1903 RRE,RR,RXE,RX,RXY,RX,RXY,RRE,RRE,RS,RIL,SIL,RS,VRI,VRR,VRS,VRS,VRX,VRX")
1904 (set_attr "type" "*,
1928 (set_attr "cpu_facility" "*,*,*,extimm,longdisp,z10,*,*,longdisp,*,longdisp,
1929 vec,*,vec,*,longdisp,*,longdisp,*,*,*,z10,z10,*,vec,vec,vec,vec,vec,vec")
1930 (set_attr "z10prop" "z10_fwd_A1,
1955 (define_insn "*movsi_esa"
1956 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!*f,!*f,!R,d,t,Q,t")
1957 (match_operand:SI 1 "general_operand" "K,d,R,d, *f, *f, R, R,*f,t,d,t,Q"))]
1973 [(set_attr "op_type" "RI,RR,RX,RX,RRE,RR,RXE,RX,RX,RRE,RRE,RS,RS")
1974 (set_attr "type" "*,lr,load,store,floadsf,floadsf,floadsf,floadsf,fstoresf,*,*,*,*")
1975 (set_attr "z10prop" "z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_rec,*,*,*,*,*,z10_super_E1,
1977 (set_attr "cpu_facility" "*,*,*,*,vec,*,vec,*,*,*,*,*,*")
1981 [(set (match_operand:SI 0 "register_operand" "")
1982 (mem:SI (match_operand 1 "address_operand" "")))]
1983 "!FP_REG_P (operands[0])
1984 && GET_CODE (operands[1]) == SYMBOL_REF
1985 && CONSTANT_POOL_ADDRESS_P (operands[1])
1986 && get_pool_mode (operands[1]) == SImode
1987 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1988 [(set (match_dup 0) (match_dup 2))]
1989 "operands[2] = get_pool_constant (operands[1]);")
1991 (define_insn "*la_31"
1992 [(set (match_operand:SI 0 "register_operand" "=d,d")
1993 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))]
1994 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1998 [(set_attr "op_type" "RX,RXY")
1999 (set_attr "type" "la")
2000 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
2004 [(set (match_operand:SI 0 "register_operand" "")
2005 (match_operand:QI 1 "address_operand" ""))
2006 (clobber (reg:CC CC_REGNUM))])]
2008 && preferred_la_operand_p (operands[1], const0_rtx)"
2009 [(set (match_dup 0) (match_dup 1))]
2013 [(set (match_operand:SI 0 "register_operand" "")
2014 (match_operand:SI 1 "register_operand" ""))
2017 (plus:SI (match_dup 0)
2018 (match_operand:SI 2 "nonmemory_operand" "")))
2019 (clobber (reg:CC CC_REGNUM))])]
2021 && !reg_overlap_mentioned_p (operands[0], operands[2])
2022 && preferred_la_operand_p (operands[1], operands[2])"
2023 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
2026 (define_insn "*la_31_and"
2027 [(set (match_operand:SI 0 "register_operand" "=d,d")
2028 (and:SI (match_operand:QI 1 "address_operand" "ZQZR,ZSZT")
2029 (const_int 2147483647)))]
2034 [(set_attr "op_type" "RX,RXY")
2035 (set_attr "type" "la")
2036 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
2038 (define_insn_and_split "*la_31_and_cc"
2039 [(set (match_operand:SI 0 "register_operand" "=d")
2040 (and:SI (match_operand:QI 1 "address_operand" "p")
2041 (const_int 2147483647)))
2042 (clobber (reg:CC CC_REGNUM))]
2045 "&& reload_completed"
2047 (and:SI (match_dup 1) (const_int 2147483647)))]
2049 [(set_attr "op_type" "RX")
2050 (set_attr "type" "la")])
2052 (define_insn "force_la_31"
2053 [(set (match_operand:SI 0 "register_operand" "=d,d")
2054 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))
2055 (use (const_int 0))]
2060 [(set_attr "op_type" "RX")
2061 (set_attr "type" "la")
2062 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
2065 ; movhi instruction pattern(s).
2068 (define_expand "movhi"
2069 [(set (match_operand:HI 0 "nonimmediate_operand" "")
2070 (match_operand:HI 1 "general_operand" ""))]
2073 /* Make it explicit that loading a register from memory
2074 always sign-extends (at least) to SImode. */
2075 if (optimize && can_create_pseudo_p ()
2076 && register_operand (operands[0], VOIDmode)
2077 && GET_CODE (operands[1]) == MEM)
2079 rtx tmp = gen_reg_rtx (SImode);
2080 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
2081 emit_insn (gen_rtx_SET (tmp, ext));
2082 operands[1] = gen_lowpart (HImode, tmp);
2086 (define_insn "*movhi"
2087 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,d,R,T,b,Q,v,v,v,d, v,QR")
2088 (match_operand:HI 1 "general_operand" " d,n,R,T,b,d,d,d,K,K,v,d,v,QR, v"))]
2106 [(set_attr "op_type" "RR,RI,RX,RXY,RIL,RX,RXY,RIL,SIL,VRI,VRR,VRS,VRS,VRX,VRX")
2107 (set_attr "type" "lr,*,*,*,larl,store,store,store,*,*,*,*,*,*,*")
2108 (set_attr "cpu_facility" "*,*,*,*,z10,*,*,z10,z10,vec,vec,vec,vec,vec,vec")
2109 (set_attr "z10prop" "z10_fr_E1,
2117 z10_super,*,*,*,*,*,*")])
2120 [(set (match_operand:HI 0 "register_operand" "")
2121 (mem:HI (match_operand 1 "address_operand" "")))]
2122 "GET_CODE (operands[1]) == SYMBOL_REF
2123 && CONSTANT_POOL_ADDRESS_P (operands[1])
2124 && get_pool_mode (operands[1]) == HImode
2125 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
2126 [(set (match_dup 0) (match_dup 2))]
2127 "operands[2] = get_pool_constant (operands[1]);")
2130 ; movqi instruction pattern(s).
2133 (define_expand "movqi"
2134 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2135 (match_operand:QI 1 "general_operand" ""))]
2138 /* On z/Architecture, zero-extending from memory to register
2139 is just as fast as a QImode load. */
2140 if (TARGET_ZARCH && optimize && can_create_pseudo_p ()
2141 && register_operand (operands[0], VOIDmode)
2142 && GET_CODE (operands[1]) == MEM)
2144 rtx tmp = gen_reg_rtx (DImode);
2145 rtx ext = gen_rtx_ZERO_EXTEND (DImode, operands[1]);
2146 emit_insn (gen_rtx_SET (tmp, ext));
2147 operands[1] = gen_lowpart (QImode, tmp);
2151 (define_insn "*movqi"
2152 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q,v,v,v,d, v,QR")
2153 (match_operand:QI 1 "general_operand" " d,n,R,T,d,d,n,n,?Q,K,v,d,v,QR, v"))]
2171 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS,VRI,VRR,VRS,VRS,VRX,VRX")
2172 (set_attr "type" "lr,*,*,*,store,store,store,store,*,*,*,*,*,*,*")
2173 (set_attr "cpu_facility" "*,*,*,*,*,*,*,*,*,vec,vec,vec,vec,vec,vec")
2174 (set_attr "z10prop" "z10_fr_E1,
2185 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2186 (mem:QI (match_operand 1 "address_operand" "")))]
2187 "GET_CODE (operands[1]) == SYMBOL_REF
2188 && CONSTANT_POOL_ADDRESS_P (operands[1])
2189 && get_pool_mode (operands[1]) == QImode
2190 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
2191 [(set (match_dup 0) (match_dup 2))]
2192 "operands[2] = get_pool_constant (operands[1]);")
2195 ; movstrictqi instruction pattern(s).
2198 (define_insn "*movstrictqi"
2199 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
2200 (match_operand:QI 1 "memory_operand" "R,T"))]
2205 [(set_attr "op_type" "RX,RXY")
2206 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
2209 ; movstricthi instruction pattern(s).
2212 (define_insn "*movstricthi"
2213 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
2214 (match_operand:HI 1 "memory_operand" "Q,S"))
2215 (clobber (reg:CC CC_REGNUM))]
2220 [(set_attr "op_type" "RS,RSY")
2221 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
2224 ; movstrictsi instruction pattern(s).
2227 (define_insn "movstrictsi"
2228 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d,d"))
2229 (match_operand:SI 1 "general_operand" "d,R,T,t"))]
2236 [(set_attr "op_type" "RR,RX,RXY,RRE")
2237 (set_attr "type" "lr,load,load,*")
2238 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_super_E1")])
2241 ; mov(tf|td) instruction pattern(s).
2244 (define_expand "mov<mode>"
2245 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2246 (match_operand:TD_TF 1 "general_operand" ""))]
2250 (define_insn "*mov<mode>_64"
2251 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o, d,QS, d,o")
2252 (match_operand:TD_TF 1 "general_operand" " G,f,o,f,QS, d,dRT,d"))]
2263 [(set_attr "op_type" "RRE,RRE,*,*,RSY,RSY,*,*")
2264 (set_attr "type" "fsimptf,fsimptf,*,*,lm,stm,*,*")
2265 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*")])
2267 (define_insn "*mov<mode>_31"
2268 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o")
2269 (match_operand:TD_TF 1 "general_operand" " G,f,o,f"))]
2276 [(set_attr "op_type" "RRE,RRE,*,*")
2277 (set_attr "type" "fsimptf,fsimptf,*,*")
2278 (set_attr "cpu_facility" "z196,*,*,*")])
2280 ; TFmode in GPRs splitters
2283 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2284 (match_operand:TD_TF 1 "general_operand" ""))]
2285 "TARGET_ZARCH && reload_completed
2286 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)"
2287 [(set (match_dup 2) (match_dup 4))
2288 (set (match_dup 3) (match_dup 5))]
2290 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
2291 operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode);
2292 operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode);
2293 operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode);
2297 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2298 (match_operand:TD_TF 1 "general_operand" ""))]
2299 "TARGET_ZARCH && reload_completed
2300 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)"
2301 [(set (match_dup 2) (match_dup 4))
2302 (set (match_dup 3) (match_dup 5))]
2304 operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode);
2305 operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode);
2306 operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode);
2307 operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode);
2311 [(set (match_operand:TD_TF 0 "register_operand" "")
2312 (match_operand:TD_TF 1 "memory_operand" ""))]
2313 "TARGET_ZARCH && reload_completed
2314 && GENERAL_REG_P (operands[0])
2315 && !s_operand (operands[1], VOIDmode)"
2316 [(set (match_dup 0) (match_dup 1))]
2318 rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode);
2319 addr = gen_lowpart (Pmode, addr);
2320 s390_load_address (addr, XEXP (operands[1], 0));
2321 operands[1] = replace_equiv_address (operands[1], addr);
2324 ; TFmode in BFPs splitters
2327 [(set (match_operand:TD_TF 0 "register_operand" "")
2328 (match_operand:TD_TF 1 "memory_operand" ""))]
2329 "reload_completed && offsettable_memref_p (operands[1])
2330 && FP_REG_P (operands[0])"
2331 [(set (match_dup 2) (match_dup 4))
2332 (set (match_dup 3) (match_dup 5))]
2334 operands[2] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0],
2336 operands[3] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0],
2338 operands[4] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 0);
2339 operands[5] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 8);
2343 [(set (match_operand:TD_TF 0 "memory_operand" "")
2344 (match_operand:TD_TF 1 "register_operand" ""))]
2345 "reload_completed && offsettable_memref_p (operands[0])
2346 && FP_REG_P (operands[1])"
2347 [(set (match_dup 2) (match_dup 4))
2348 (set (match_dup 3) (match_dup 5))]
2350 operands[2] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 0);
2351 operands[3] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 8);
2352 operands[4] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1],
2354 operands[5] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1],
2359 ; mov(df|dd) instruction pattern(s).
2362 (define_expand "mov<mode>"
2363 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2364 (match_operand:DD_DF 1 "general_operand" ""))]
2368 (define_insn "*mov<mode>_64dfp"
2369 [(set (match_operand:DD_DF 0 "nonimmediate_operand"
2370 "=f,f,f,d,f,f,R,T,d,d,d, d,b,RT,v,v,d,v,QR")
2371 (match_operand:DD_DF 1 "general_operand"
2372 " G,f,d,f,R,T,f,f,G,d,b,RT,d, d,v,d,v,QR,v"))]
2394 [(set_attr "op_type" "RRE,RR,RRE,RRE,RX,RXY,RX,RXY,RI,RRE,RIL,RXY,RIL,RXY,VRR,VRS,VRS,VRX,VRX")
2395 (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,floaddf,floaddf,
2396 fstoredf,fstoredf,*,lr,load,load,store,store,*,*,*,load,store")
2397 (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,*,*,*,*,*")
2398 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*,z10,*,z10,*,vec,vec,vec,vec,vec")])
2400 (define_insn "*mov<mode>_64"
2401 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,d, d,b,RT,v,v,QR")
2402 (match_operand:DD_DF 1 "general_operand" " G,f,R,T,f,f,G,d,b,RT,d, d,v,QR,v"))]
2420 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RI,RRE,RIL,RXY,RIL,RXY,VRR,VRX,VRX")
2421 (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>,
2422 fstore<mode>,fstore<mode>,*,lr,load,load,store,store,*,load,store")
2423 (set_attr "z10prop" "*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,*,*,*")
2424 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,z10,*,z10,*,vec,vec,vec")])
2426 (define_insn "*mov<mode>_31"
2427 [(set (match_operand:DD_DF 0 "nonimmediate_operand"
2428 "=f,f,f,f,R,T,d,d,Q,S, d,o")
2429 (match_operand:DD_DF 1 "general_operand"
2430 " G,f,R,T,f,f,Q,S,d,d,dPRT,d"))]
2445 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*")
2446 (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>,
2447 fstore<mode>,fstore<mode>,lm,lm,stm,stm,*,*")
2448 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*,*,*")])
2451 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2452 (match_operand:DD_DF 1 "general_operand" ""))]
2453 "!TARGET_ZARCH && reload_completed
2454 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)"
2455 [(set (match_dup 2) (match_dup 4))
2456 (set (match_dup 3) (match_dup 5))]
2458 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
2459 operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode);
2460 operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode);
2461 operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode);
2465 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2466 (match_operand:DD_DF 1 "general_operand" ""))]
2467 "!TARGET_ZARCH && reload_completed
2468 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)"
2469 [(set (match_dup 2) (match_dup 4))
2470 (set (match_dup 3) (match_dup 5))]
2472 operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode);
2473 operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode);
2474 operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode);
2475 operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode);
2479 [(set (match_operand:DD_DF 0 "register_operand" "")
2480 (match_operand:DD_DF 1 "memory_operand" ""))]
2481 "!TARGET_ZARCH && reload_completed
2482 && !FP_REG_P (operands[0])
2483 && !s_operand (operands[1], VOIDmode)"
2484 [(set (match_dup 0) (match_dup 1))]
2486 rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode);
2487 s390_load_address (addr, XEXP (operands[1], 0));
2488 operands[1] = replace_equiv_address (operands[1], addr);
2492 ; mov(sf|sd) instruction pattern(s).
2495 (define_insn "mov<mode>"
2496 [(set (match_operand:SD_SF 0 "nonimmediate_operand"
2497 "=f,f,f,f,f,f,R,T,d,d,d,d,d,b,R,T,v,v,v,d,v,QR")
2498 (match_operand:SD_SF 1 "general_operand"
2499 " G,f,f,R,R,T,f,f,G,d,b,R,T,d,d,d,v,G,d,v,QR,v"))]
2524 [(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")
2525 (set_attr "type" "fsimpsf,fsimpsf,fload<mode>,fload<mode>,fload<mode>,fload<mode>,
2526 fstore<mode>,fstore<mode>,*,lr,load,load,load,store,store,store,*,*,*,*,load,store")
2527 (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,z10_rec,*,*,*,*,*,*")
2528 (set_attr "cpu_facility" "z196,vec,*,vec,*,*,*,*,*,*,z10,*,*,z10,*,*,vec,vec,vec,vec,vec,vec")])
2531 ; movcc instruction pattern
2534 (define_insn "movcc"
2535 [(set (match_operand:CC 0 "nonimmediate_operand" "=d,c,d,d,d,R,T")
2536 (match_operand:CC 1 "nonimmediate_operand" " d,d,c,R,T,d,d"))]
2546 [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY")
2547 (set_attr "type" "lr,*,*,load,load,store,store")
2548 (set_attr "z10prop" "z10_fr_E1,z10_super,*,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec")
2549 (set_attr "z196prop" "*,*,z196_ends,*,*,*,*")])
2552 ; Block move (MVC) patterns.
2556 [(set (match_operand:BLK 0 "memory_operand" "=Q")
2557 (match_operand:BLK 1 "memory_operand" "Q"))
2558 (use (match_operand 2 "const_int_operand" "n"))]
2559 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
2560 "mvc\t%O0(%2,%R0),%S1"
2561 [(set_attr "op_type" "SS")])
2563 ; This splitter converts a QI to QI mode copy into a BLK mode copy in
2564 ; order to have it implemented with mvc.
2567 [(set (match_operand:QI 0 "memory_operand" "")
2568 (match_operand:QI 1 "memory_operand" ""))]
2571 [(set (match_dup 0) (match_dup 1))
2572 (use (const_int 1))])]
2574 operands[0] = adjust_address (operands[0], BLKmode, 0);
2575 operands[1] = adjust_address (operands[1], BLKmode, 0);
2581 [(set (match_operand:BLK 0 "memory_operand" "")
2582 (match_operand:BLK 1 "memory_operand" ""))
2583 (use (match_operand 2 "const_int_operand" ""))])
2585 [(set (match_operand:BLK 3 "memory_operand" "")
2586 (match_operand:BLK 4 "memory_operand" ""))
2587 (use (match_operand 5 "const_int_operand" ""))])]
2588 "s390_offset_p (operands[0], operands[3], operands[2])
2589 && s390_offset_p (operands[1], operands[4], operands[2])
2590 && !s390_overlap_p (operands[0], operands[1],
2591 INTVAL (operands[2]) + INTVAL (operands[5]))
2592 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
2594 [(set (match_dup 6) (match_dup 7))
2595 (use (match_dup 8))])]
2596 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
2597 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
2598 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
2602 ; load_multiple pattern(s).
2604 ; ??? Due to reload problems with replacing registers inside match_parallel
2605 ; we currently support load_multiple/store_multiple only after reload.
2608 (define_expand "load_multiple"
2609 [(match_par_dup 3 [(set (match_operand 0 "" "")
2610 (match_operand 1 "" ""))
2611 (use (match_operand 2 "" ""))])]
2620 /* Support only loading a constant number of fixed-point registers from
2621 memory and only bother with this if more than two */
2622 if (GET_CODE (operands[2]) != CONST_INT
2623 || INTVAL (operands[2]) < 2
2624 || INTVAL (operands[2]) > 16
2625 || GET_CODE (operands[1]) != MEM
2626 || GET_CODE (operands[0]) != REG
2627 || REGNO (operands[0]) >= 16)
2630 count = INTVAL (operands[2]);
2631 regno = REGNO (operands[0]);
2632 mode = GET_MODE (operands[0]);
2633 if (mode != SImode && (!TARGET_ZARCH || mode != DImode))
2636 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2637 if (!can_create_pseudo_p ())
2639 if (GET_CODE (XEXP (operands[1], 0)) == REG)
2641 from = XEXP (operands[1], 0);
2644 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
2645 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
2646 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
2648 from = XEXP (XEXP (operands[1], 0), 0);
2649 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
2656 from = force_reg (Pmode, XEXP (operands[1], 0));
2660 for (i = 0; i < count; i++)
2661 XVECEXP (operands[3], 0, i)
2662 = gen_rtx_SET (gen_rtx_REG (mode, regno + i),
2663 change_address (operands[1], mode,
2664 plus_constant (Pmode, from,
2665 off + i * GET_MODE_SIZE (mode))));
2668 (define_insn "*load_multiple_di"
2669 [(match_parallel 0 "load_multiple_operation"
2670 [(set (match_operand:DI 1 "register_operand" "=r")
2671 (match_operand:DI 2 "s_operand" "QS"))])]
2672 "reload_completed && TARGET_ZARCH"
2674 int words = XVECLEN (operands[0], 0);
2675 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
2676 return "lmg\t%1,%0,%S2";
2678 [(set_attr "op_type" "RSY")
2679 (set_attr "type" "lm")])
2681 (define_insn "*load_multiple_si"
2682 [(match_parallel 0 "load_multiple_operation"
2683 [(set (match_operand:SI 1 "register_operand" "=r,r")
2684 (match_operand:SI 2 "s_operand" "Q,S"))])]
2687 int words = XVECLEN (operands[0], 0);
2688 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
2689 return which_alternative == 0 ? "lm\t%1,%0,%S2" : "lmy\t%1,%0,%S2";
2691 [(set_attr "op_type" "RS,RSY")
2692 (set_attr "type" "lm")])
2695 ; store multiple pattern(s).
2698 (define_expand "store_multiple"
2699 [(match_par_dup 3 [(set (match_operand 0 "" "")
2700 (match_operand 1 "" ""))
2701 (use (match_operand 2 "" ""))])]
2710 /* Support only storing a constant number of fixed-point registers to
2711 memory and only bother with this if more than two. */
2712 if (GET_CODE (operands[2]) != CONST_INT
2713 || INTVAL (operands[2]) < 2
2714 || INTVAL (operands[2]) > 16
2715 || GET_CODE (operands[0]) != MEM
2716 || GET_CODE (operands[1]) != REG
2717 || REGNO (operands[1]) >= 16)
2720 count = INTVAL (operands[2]);
2721 regno = REGNO (operands[1]);
2722 mode = GET_MODE (operands[1]);
2723 if (mode != SImode && (!TARGET_ZARCH || mode != DImode))
2726 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2728 if (!can_create_pseudo_p ())
2730 if (GET_CODE (XEXP (operands[0], 0)) == REG)
2732 to = XEXP (operands[0], 0);
2735 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
2736 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
2737 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
2739 to = XEXP (XEXP (operands[0], 0), 0);
2740 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
2747 to = force_reg (Pmode, XEXP (operands[0], 0));
2751 for (i = 0; i < count; i++)
2752 XVECEXP (operands[3], 0, i)
2753 = gen_rtx_SET (change_address (operands[0], mode,
2754 plus_constant (Pmode, to,
2755 off + i * GET_MODE_SIZE (mode))),
2756 gen_rtx_REG (mode, regno + i));
2759 (define_insn "*store_multiple_di"
2760 [(match_parallel 0 "store_multiple_operation"
2761 [(set (match_operand:DI 1 "s_operand" "=QS")
2762 (match_operand:DI 2 "register_operand" "r"))])]
2763 "reload_completed && TARGET_ZARCH"
2765 int words = XVECLEN (operands[0], 0);
2766 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
2767 return "stmg\t%2,%0,%S1";
2769 [(set_attr "op_type" "RSY")
2770 (set_attr "type" "stm")])
2773 (define_insn "*store_multiple_si"
2774 [(match_parallel 0 "store_multiple_operation"
2775 [(set (match_operand:SI 1 "s_operand" "=Q,S")
2776 (match_operand:SI 2 "register_operand" "r,r"))])]
2779 int words = XVECLEN (operands[0], 0);
2780 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
2781 return which_alternative == 0 ? "stm\t%2,%0,%S1" : "stmy\t%2,%0,%S1";
2783 [(set_attr "op_type" "RS,RSY")
2784 (set_attr "type" "stm")])
2787 ;; String instructions.
2790 (define_insn "*execute_rl"
2791 [(match_parallel 0 "execute_operation"
2792 [(unspec [(match_operand 1 "register_operand" "a")
2793 (match_operand 2 "" "")
2794 (match_operand:SI 3 "larl_operand" "X")] UNSPEC_EXECUTE)])]
2795 "TARGET_Z10 && GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
2796 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
2798 [(set_attr "op_type" "RIL")
2799 (set_attr "type" "cs")])
2801 (define_insn "*execute"
2802 [(match_parallel 0 "execute_operation"
2803 [(unspec [(match_operand 1 "register_operand" "a")
2804 (match_operand:BLK 2 "memory_operand" "R")
2805 (match_operand 3 "" "")] UNSPEC_EXECUTE)])]
2806 "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
2807 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
2809 [(set_attr "op_type" "RX")
2810 (set_attr "type" "cs")])
2814 ; strlenM instruction pattern(s).
2817 (define_expand "strlen<mode>"
2818 [(match_operand:P 0 "register_operand" "") ; result
2819 (match_operand:BLK 1 "memory_operand" "") ; input string
2820 (match_operand:SI 2 "immediate_operand" "") ; search character
2821 (match_operand:SI 3 "immediate_operand" "")] ; known alignment
2824 if (!TARGET_VX || operands[2] != const0_rtx)
2825 emit_insn (gen_strlen_srst<mode> (operands[0], operands[1],
2826 operands[2], operands[3]));
2828 s390_expand_vec_strlen (operands[0], operands[1], operands[3]);
2833 (define_expand "strlen_srst<mode>"
2834 [(set (reg:SI 0) (match_operand:SI 2 "immediate_operand" ""))
2837 (unspec:P [(const_int 0)
2838 (match_operand:BLK 1 "memory_operand" "")
2840 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
2841 (clobber (scratch:P))
2842 (clobber (reg:CC CC_REGNUM))])
2844 [(set (match_operand:P 0 "register_operand" "")
2845 (minus:P (match_dup 4) (match_dup 5)))
2846 (clobber (reg:CC CC_REGNUM))])]
2849 operands[4] = gen_reg_rtx (Pmode);
2850 operands[5] = gen_reg_rtx (Pmode);
2851 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
2852 operands[1] = replace_equiv_address (operands[1], operands[5]);
2855 (define_insn "*strlen<mode>"
2856 [(set (match_operand:P 0 "register_operand" "=a")
2857 (unspec:P [(match_operand:P 2 "general_operand" "0")
2858 (mem:BLK (match_operand:P 3 "register_operand" "1"))
2860 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
2861 (clobber (match_scratch:P 1 "=a"))
2862 (clobber (reg:CC CC_REGNUM))]
2864 "srst\t%0,%1\;jo\t.-4"
2865 [(set_attr "length" "8")
2866 (set_attr "type" "vs")])
2869 ; cmpstrM instruction pattern(s).
2872 (define_expand "cmpstrsi"
2873 [(set (reg:SI 0) (const_int 0))
2875 [(clobber (match_operand 3 "" ""))
2876 (clobber (match_dup 4))
2877 (set (reg:CCU CC_REGNUM)
2878 (compare:CCU (match_operand:BLK 1 "memory_operand" "")
2879 (match_operand:BLK 2 "memory_operand" "")))
2882 [(set (match_operand:SI 0 "register_operand" "=d")
2883 (unspec:SI [(reg:CCU CC_REGNUM)] UNSPEC_STRCMPCC_TO_INT))
2884 (clobber (reg:CC CC_REGNUM))])]
2887 /* As the result of CMPINT is inverted compared to what we need,
2888 we have to swap the operands. */
2889 rtx op1 = operands[2];
2890 rtx op2 = operands[1];
2891 rtx addr1 = gen_reg_rtx (Pmode);
2892 rtx addr2 = gen_reg_rtx (Pmode);
2894 emit_move_insn (addr1, force_operand (XEXP (op1, 0), NULL_RTX));
2895 emit_move_insn (addr2, force_operand (XEXP (op2, 0), NULL_RTX));
2896 operands[1] = replace_equiv_address_nv (op1, addr1);
2897 operands[2] = replace_equiv_address_nv (op2, addr2);
2898 operands[3] = addr1;
2899 operands[4] = addr2;
2902 (define_insn "*cmpstr<mode>"
2903 [(clobber (match_operand:P 0 "register_operand" "=d"))
2904 (clobber (match_operand:P 1 "register_operand" "=d"))
2905 (set (reg:CCU CC_REGNUM)
2906 (compare:CCU (mem:BLK (match_operand:P 2 "register_operand" "0"))
2907 (mem:BLK (match_operand:P 3 "register_operand" "1"))))
2910 "clst\t%0,%1\;jo\t.-4"
2911 [(set_attr "length" "8")
2912 (set_attr "type" "vs")])
2915 ; movstr instruction pattern.
2918 (define_expand "movstr"
2919 [(match_operand 0 "register_operand" "")
2920 (match_operand 1 "memory_operand" "")
2921 (match_operand 2 "memory_operand" "")]
2925 emit_insn (gen_movstrdi (operands[0], operands[1], operands[2]));
2927 emit_insn (gen_movstrsi (operands[0], operands[1], operands[2]));
2931 (define_expand "movstr<P:mode>"
2932 [(set (reg:SI 0) (const_int 0))
2934 [(clobber (match_dup 3))
2935 (set (match_operand:BLK 1 "memory_operand" "")
2936 (match_operand:BLK 2 "memory_operand" ""))
2937 (set (match_operand:P 0 "register_operand" "")
2938 (unspec:P [(match_dup 1)
2940 (reg:SI 0)] UNSPEC_MVST))
2941 (clobber (reg:CC CC_REGNUM))])]
2944 rtx addr1 = gen_reg_rtx (Pmode);
2945 rtx addr2 = gen_reg_rtx (Pmode);
2947 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2948 emit_move_insn (addr2, force_operand (XEXP (operands[2], 0), NULL_RTX));
2949 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2950 operands[2] = replace_equiv_address_nv (operands[2], addr2);
2951 operands[3] = addr2;
2954 (define_insn "*movstr"
2955 [(clobber (match_operand:P 2 "register_operand" "=d"))
2956 (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
2957 (mem:BLK (match_operand:P 3 "register_operand" "2")))
2958 (set (match_operand:P 0 "register_operand" "=d")
2959 (unspec:P [(mem:BLK (match_dup 1))
2960 (mem:BLK (match_dup 3))
2961 (reg:SI 0)] UNSPEC_MVST))
2962 (clobber (reg:CC CC_REGNUM))]
2964 "mvst\t%1,%2\;jo\t.-4"
2965 [(set_attr "length" "8")
2966 (set_attr "type" "vs")])
2970 ; movmemM instruction pattern(s).
2973 (define_expand "movmem<mode>"
2974 [(set (match_operand:BLK 0 "memory_operand" "") ; destination
2975 (match_operand:BLK 1 "memory_operand" "")) ; source
2976 (use (match_operand:GPR 2 "general_operand" "")) ; count
2977 (match_operand 3 "" "")]
2980 if (s390_expand_movmem (operands[0], operands[1], operands[2]))
2986 ; Move a block that is up to 256 bytes in length.
2987 ; The block length is taken as (operands[2] % 256) + 1.
2989 (define_expand "movmem_short"
2991 [(set (match_operand:BLK 0 "memory_operand" "")
2992 (match_operand:BLK 1 "memory_operand" ""))
2993 (use (match_operand 2 "nonmemory_operand" ""))
2994 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2995 (clobber (match_dup 3))])]
2997 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2999 (define_insn "*movmem_short"
3000 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q")
3001 (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q"))
3002 (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
3003 (use (match_operand 3 "immediate_operand" "X,R,X,X"))
3004 (clobber (match_scratch:P 4 "=X,X,X,&a"))]
3005 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
3007 [(set_attr "type" "cs")
3008 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3011 [(set (match_operand:BLK 0 "memory_operand" "")
3012 (match_operand:BLK 1 "memory_operand" ""))
3013 (use (match_operand 2 "const_int_operand" ""))
3014 (use (match_operand 3 "immediate_operand" ""))
3015 (clobber (scratch))]
3018 [(set (match_dup 0) (match_dup 1))
3019 (use (match_dup 2))])]
3020 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
3023 [(set (match_operand:BLK 0 "memory_operand" "")
3024 (match_operand:BLK 1 "memory_operand" ""))
3025 (use (match_operand 2 "register_operand" ""))
3026 (use (match_operand 3 "memory_operand" ""))
3027 (clobber (scratch))]
3030 [(unspec [(match_dup 2) (match_dup 3)
3031 (const_int 0)] UNSPEC_EXECUTE)
3032 (set (match_dup 0) (match_dup 1))
3033 (use (const_int 1))])]
3037 [(set (match_operand:BLK 0 "memory_operand" "")
3038 (match_operand:BLK 1 "memory_operand" ""))
3039 (use (match_operand 2 "register_operand" ""))
3040 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3041 (clobber (scratch))]
3042 "TARGET_Z10 && reload_completed"
3044 [(unspec [(match_dup 2) (const_int 0)
3045 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3046 (set (match_dup 0) (match_dup 1))
3047 (use (const_int 1))])]
3048 "operands[3] = gen_label_rtx ();")
3051 [(set (match_operand:BLK 0 "memory_operand" "")
3052 (match_operand:BLK 1 "memory_operand" ""))
3053 (use (match_operand 2 "register_operand" ""))
3054 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3055 (clobber (match_operand 3 "register_operand" ""))]
3056 "reload_completed && TARGET_CPU_ZARCH"
3057 [(set (match_dup 3) (label_ref (match_dup 4)))
3059 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
3060 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3061 (set (match_dup 0) (match_dup 1))
3062 (use (const_int 1))])]
3063 "operands[4] = gen_label_rtx ();")
3065 ; Move a block of arbitrary length.
3067 (define_expand "movmem_long"
3069 [(clobber (match_dup 2))
3070 (clobber (match_dup 3))
3071 (set (match_operand:BLK 0 "memory_operand" "")
3072 (match_operand:BLK 1 "memory_operand" ""))
3073 (use (match_operand 2 "general_operand" ""))
3075 (clobber (reg:CC CC_REGNUM))])]
3078 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3079 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3080 rtx reg0 = gen_reg_rtx (dreg_mode);
3081 rtx reg1 = gen_reg_rtx (dreg_mode);
3082 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3083 rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1));
3084 rtx len0 = gen_lowpart (Pmode, reg0);
3085 rtx len1 = gen_lowpart (Pmode, reg1);
3087 emit_clobber (reg0);
3088 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3089 emit_move_insn (len0, operands[2]);
3091 emit_clobber (reg1);
3092 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
3093 emit_move_insn (len1, operands[2]);
3095 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3096 operands[1] = replace_equiv_address_nv (operands[1], addr1);
3101 (define_insn "*movmem_long"
3102 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3103 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
3104 (set (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
3105 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0)))
3108 (clobber (reg:CC CC_REGNUM))]
3109 "TARGET_64BIT || !TARGET_ZARCH"
3110 "mvcle\t%0,%1,0\;jo\t.-4"
3111 [(set_attr "length" "8")
3112 (set_attr "type" "vs")])
3114 (define_insn "*movmem_long_31z"
3115 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3116 (clobber (match_operand:TI 1 "register_operand" "=d"))
3117 (set (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4))
3118 (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4)))
3121 (clobber (reg:CC CC_REGNUM))]
3122 "!TARGET_64BIT && TARGET_ZARCH"
3123 "mvcle\t%0,%1,0\;jo\t.-4"
3124 [(set_attr "length" "8")
3125 (set_attr "type" "vs")])
3132 (define_expand "signbit<mode>2"
3133 [(set (reg:CCZ CC_REGNUM)
3134 (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
3137 (set (match_operand:SI 0 "register_operand" "=d")
3138 (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))]
3141 operands[2] = GEN_INT (S390_TDC_SIGNBIT_SET);
3144 (define_expand "isinf<mode>2"
3145 [(set (reg:CCZ CC_REGNUM)
3146 (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
3149 (set (match_operand:SI 0 "register_operand" "=d")
3150 (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))]
3153 operands[2] = GEN_INT (S390_TDC_INFINITY);
3156 ; This extracts CC into a GPR properly shifted. The actual IPM
3157 ; instruction will be issued by reload. The constraint of operand 1
3158 ; forces reload to use a GPR. So reload will issue a movcc insn for
3159 ; copying CC into a GPR first.
3160 (define_insn_and_split "*cc_to_int"
3161 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3162 (unspec:SI [(match_operand 1 "register_operand" "0")]
3167 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 28)))])
3169 ; This insn is used to generate all variants of the Test Data Class
3170 ; instruction, namely tcxb, tcdb, and tceb. The insn's first operand
3171 ; is the register to be tested and the second one is the bit mask
3172 ; specifying the required test(s).
3174 ; tcxb, tcdb, tceb, tdcxt, tdcdt, tdcet
3175 (define_insn "*TDC_insn_<mode>"
3176 [(set (reg:CCZ CC_REGNUM)
3177 (unspec:CCZ [(match_operand:FP_ALL 0 "register_operand" "f")
3178 (match_operand:SI 1 "const_int_operand")] UNSPEC_TDC_INSN))]
3180 "t<_d>c<xde><bt>\t%0,%1"
3181 [(set_attr "op_type" "RXE")
3182 (set_attr "type" "fsimp<mode>")])
3187 ; setmemM instruction pattern(s).
3190 (define_expand "setmem<mode>"
3191 [(set (match_operand:BLK 0 "memory_operand" "")
3192 (match_operand:QI 2 "general_operand" ""))
3193 (use (match_operand:GPR 1 "general_operand" ""))
3194 (match_operand 3 "" "")]
3196 "s390_expand_setmem (operands[0], operands[1], operands[2]); DONE;")
3198 ; Clear a block that is up to 256 bytes in length.
3199 ; The block length is taken as (operands[1] % 256) + 1.
3201 (define_expand "clrmem_short"
3203 [(set (match_operand:BLK 0 "memory_operand" "")
3205 (use (match_operand 1 "nonmemory_operand" ""))
3206 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3207 (clobber (match_dup 2))
3208 (clobber (reg:CC CC_REGNUM))])]
3210 "operands[2] = gen_rtx_SCRATCH (Pmode);")
3212 (define_insn "*clrmem_short"
3213 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q")
3215 (use (match_operand 1 "nonmemory_operand" "n,a,a,a"))
3216 (use (match_operand 2 "immediate_operand" "X,R,X,X"))
3217 (clobber (match_scratch:P 3 "=X,X,X,&a"))
3218 (clobber (reg:CC CC_REGNUM))]
3219 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)"
3221 [(set_attr "type" "cs")
3222 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3225 [(set (match_operand:BLK 0 "memory_operand" "")
3227 (use (match_operand 1 "const_int_operand" ""))
3228 (use (match_operand 2 "immediate_operand" ""))
3230 (clobber (reg:CC CC_REGNUM))]
3233 [(set (match_dup 0) (const_int 0))
3235 (clobber (reg:CC CC_REGNUM))])]
3236 "operands[1] = GEN_INT ((INTVAL (operands[1]) & 0xff) + 1);")
3239 [(set (match_operand:BLK 0 "memory_operand" "")
3241 (use (match_operand 1 "register_operand" ""))
3242 (use (match_operand 2 "memory_operand" ""))
3244 (clobber (reg:CC CC_REGNUM))]
3247 [(unspec [(match_dup 1) (match_dup 2)
3248 (const_int 0)] UNSPEC_EXECUTE)
3249 (set (match_dup 0) (const_int 0))
3251 (clobber (reg:CC CC_REGNUM))])]
3255 [(set (match_operand:BLK 0 "memory_operand" "")
3257 (use (match_operand 1 "register_operand" ""))
3258 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3260 (clobber (reg:CC CC_REGNUM))]
3261 "TARGET_Z10 && reload_completed"
3263 [(unspec [(match_dup 1) (const_int 0)
3264 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3265 (set (match_dup 0) (const_int 0))
3267 (clobber (reg:CC CC_REGNUM))])]
3268 "operands[3] = gen_label_rtx ();")
3271 [(set (match_operand:BLK 0 "memory_operand" "")
3273 (use (match_operand 1 "register_operand" ""))
3274 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3275 (clobber (match_operand 2 "register_operand" ""))
3276 (clobber (reg:CC CC_REGNUM))]
3277 "reload_completed && TARGET_CPU_ZARCH"
3278 [(set (match_dup 2) (label_ref (match_dup 3)))
3280 [(unspec [(match_dup 1) (mem:BLK (match_dup 2))
3281 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3282 (set (match_dup 0) (const_int 0))
3284 (clobber (reg:CC CC_REGNUM))])]
3285 "operands[3] = gen_label_rtx ();")
3287 ; Initialize a block of arbitrary length with (operands[2] % 256).
3289 (define_expand "setmem_long_<P:mode>"
3291 [(clobber (match_dup 1))
3292 (set (match_operand:BLK 0 "memory_operand" "")
3293 (unspec:BLK [(match_operand:P 2 "shift_count_or_setmem_operand" "")
3294 (match_dup 4)] UNSPEC_REPLICATE_BYTE))
3296 (clobber (reg:CC CC_REGNUM))])]
3299 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3300 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3301 rtx reg0 = gen_reg_rtx (dreg_mode);
3302 rtx reg1 = gen_reg_rtx (dreg_mode);
3303 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3304 rtx len0 = gen_lowpart (Pmode, reg0);
3306 emit_clobber (reg0);
3307 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3308 emit_move_insn (len0, operands[1]);
3310 emit_move_insn (reg1, const0_rtx);
3312 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3315 operands[4] = gen_lowpart (Pmode, operands[1]);
3318 ; Patterns for 31 bit + Esa and 64 bit + Zarch.
3320 (define_insn "*setmem_long"
3321 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3322 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
3323 (unspec:BLK [(match_operand:P 2 "shift_count_or_setmem_operand" "Y")
3324 (subreg:P (match_dup 3) <modesize>)]
3325 UNSPEC_REPLICATE_BYTE))
3326 (use (match_operand:<DBL> 1 "register_operand" "d"))
3327 (clobber (reg:CC CC_REGNUM))]
3328 "TARGET_64BIT || !TARGET_ZARCH"
3329 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3330 [(set_attr "length" "8")
3331 (set_attr "type" "vs")])
3333 (define_insn "*setmem_long_and"
3334 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3335 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
3337 (match_operand:P 2 "shift_count_or_setmem_operand" "Y")
3338 (match_operand:P 4 "const_int_operand" "n"))
3339 (subreg:P (match_dup 3) <modesize>)]
3340 UNSPEC_REPLICATE_BYTE))
3341 (use (match_operand:<DBL> 1 "register_operand" "d"))
3342 (clobber (reg:CC CC_REGNUM))]
3343 "(TARGET_64BIT || !TARGET_ZARCH) &&
3344 (INTVAL (operands[4]) & 255) == 255"
3345 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3346 [(set_attr "length" "8")
3347 (set_attr "type" "vs")])
3349 ; Variants for 31 bit + Zarch, necessary because of the odd in-register offsets
3350 ; of the SImode subregs.
3352 (define_insn "*setmem_long_31z"
3353 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3354 (set (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "0") 4))
3355 (unspec:BLK [(match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
3356 (subreg:SI (match_dup 3) 12)] UNSPEC_REPLICATE_BYTE))
3357 (use (match_operand:TI 1 "register_operand" "d"))
3358 (clobber (reg:CC CC_REGNUM))]
3359 "!TARGET_64BIT && TARGET_ZARCH"
3360 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3361 [(set_attr "length" "8")
3362 (set_attr "type" "vs")])
3364 (define_insn "*setmem_long_and_31z"
3365 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3366 (set (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "0") 4))
3367 (unspec:BLK [(and:SI
3368 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
3369 (match_operand:SI 4 "const_int_operand" "n"))
3370 (subreg:SI (match_dup 3) 12)] UNSPEC_REPLICATE_BYTE))
3371 (use (match_operand:TI 1 "register_operand" "d"))
3372 (clobber (reg:CC CC_REGNUM))]
3373 "(!TARGET_64BIT && TARGET_ZARCH) &&
3374 (INTVAL (operands[4]) & 255) == 255"
3375 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3376 [(set_attr "length" "8")
3377 (set_attr "type" "vs")])
3380 ; cmpmemM instruction pattern(s).
3383 (define_expand "cmpmemsi"
3384 [(set (match_operand:SI 0 "register_operand" "")
3385 (compare:SI (match_operand:BLK 1 "memory_operand" "")
3386 (match_operand:BLK 2 "memory_operand" "") ) )
3387 (use (match_operand:SI 3 "general_operand" ""))
3388 (use (match_operand:SI 4 "" ""))]
3391 if (s390_expand_cmpmem (operands[0], operands[1],
3392 operands[2], operands[3]))
3398 ; Compare a block that is up to 256 bytes in length.
3399 ; The block length is taken as (operands[2] % 256) + 1.
3401 (define_expand "cmpmem_short"
3403 [(set (reg:CCU CC_REGNUM)
3404 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3405 (match_operand:BLK 1 "memory_operand" "")))
3406 (use (match_operand 2 "nonmemory_operand" ""))
3407 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3408 (clobber (match_dup 3))])]
3410 "operands[3] = gen_rtx_SCRATCH (Pmode);")
3412 (define_insn "*cmpmem_short"
3413 [(set (reg:CCU CC_REGNUM)
3414 (compare:CCU (match_operand:BLK 0 "memory_operand" "Q,Q,Q,Q")
3415 (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q")))
3416 (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
3417 (use (match_operand 3 "immediate_operand" "X,R,X,X"))
3418 (clobber (match_scratch:P 4 "=X,X,X,&a"))]
3419 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
3421 [(set_attr "type" "cs")
3422 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3425 [(set (reg:CCU CC_REGNUM)
3426 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3427 (match_operand:BLK 1 "memory_operand" "")))
3428 (use (match_operand 2 "const_int_operand" ""))
3429 (use (match_operand 3 "immediate_operand" ""))
3430 (clobber (scratch))]
3433 [(set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3434 (use (match_dup 2))])]
3435 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
3438 [(set (reg:CCU CC_REGNUM)
3439 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3440 (match_operand:BLK 1 "memory_operand" "")))
3441 (use (match_operand 2 "register_operand" ""))
3442 (use (match_operand 3 "memory_operand" ""))
3443 (clobber (scratch))]
3446 [(unspec [(match_dup 2) (match_dup 3)
3447 (const_int 0)] UNSPEC_EXECUTE)
3448 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3449 (use (const_int 1))])]
3453 [(set (reg:CCU CC_REGNUM)
3454 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3455 (match_operand:BLK 1 "memory_operand" "")))
3456 (use (match_operand 2 "register_operand" ""))
3457 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3458 (clobber (scratch))]
3459 "TARGET_Z10 && reload_completed"
3461 [(unspec [(match_dup 2) (const_int 0)
3462 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3463 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3464 (use (const_int 1))])]
3465 "operands[4] = gen_label_rtx ();")
3468 [(set (reg:CCU CC_REGNUM)
3469 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3470 (match_operand:BLK 1 "memory_operand" "")))
3471 (use (match_operand 2 "register_operand" ""))
3472 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3473 (clobber (match_operand 3 "register_operand" ""))]
3474 "reload_completed && TARGET_CPU_ZARCH"
3475 [(set (match_dup 3) (label_ref (match_dup 4)))
3477 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
3478 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3479 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3480 (use (const_int 1))])]
3481 "operands[4] = gen_label_rtx ();")
3483 ; Compare a block of arbitrary length.
3485 (define_expand "cmpmem_long"
3487 [(clobber (match_dup 2))
3488 (clobber (match_dup 3))
3489 (set (reg:CCU CC_REGNUM)
3490 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3491 (match_operand:BLK 1 "memory_operand" "")))
3492 (use (match_operand 2 "general_operand" ""))
3493 (use (match_dup 3))])]
3496 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3497 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3498 rtx reg0 = gen_reg_rtx (dreg_mode);
3499 rtx reg1 = gen_reg_rtx (dreg_mode);
3500 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3501 rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1));
3502 rtx len0 = gen_lowpart (Pmode, reg0);
3503 rtx len1 = gen_lowpart (Pmode, reg1);
3505 emit_clobber (reg0);
3506 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3507 emit_move_insn (len0, operands[2]);
3509 emit_clobber (reg1);
3510 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
3511 emit_move_insn (len1, operands[2]);
3513 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3514 operands[1] = replace_equiv_address_nv (operands[1], addr1);
3519 (define_insn "*cmpmem_long"
3520 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3521 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
3522 (set (reg:CCU CC_REGNUM)
3523 (compare:CCU (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
3524 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0))))
3526 (use (match_dup 3))]
3527 "TARGET_64BIT || !TARGET_ZARCH"
3528 "clcle\t%0,%1,0\;jo\t.-4"
3529 [(set_attr "length" "8")
3530 (set_attr "type" "vs")])
3532 (define_insn "*cmpmem_long_31z"
3533 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3534 (clobber (match_operand:TI 1 "register_operand" "=d"))
3535 (set (reg:CCU CC_REGNUM)
3536 (compare:CCU (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4))
3537 (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4))))
3539 (use (match_dup 3))]
3540 "!TARGET_64BIT && TARGET_ZARCH"
3541 "clcle\t%0,%1,0\;jo\t.-4"
3542 [(set_attr "op_type" "NN")
3543 (set_attr "type" "vs")
3544 (set_attr "length" "8")])
3546 ; Convert CCUmode condition code to integer.
3547 ; Result is zero if EQ, positive if LTU, negative if GTU.
3549 (define_insn_and_split "cmpint"
3550 [(set (match_operand:SI 0 "register_operand" "=d")
3551 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3552 UNSPEC_STRCMPCC_TO_INT))
3553 (clobber (reg:CC CC_REGNUM))]
3557 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
3559 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))
3560 (clobber (reg:CC CC_REGNUM))])])
3562 (define_insn_and_split "*cmpint_cc"
3563 [(set (reg CC_REGNUM)
3564 (compare (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3565 UNSPEC_STRCMPCC_TO_INT)
3567 (set (match_operand:SI 0 "register_operand" "=d")
3568 (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT))]
3569 "s390_match_ccmode (insn, CCSmode)"
3571 "&& reload_completed"
3572 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
3574 [(set (match_dup 2) (match_dup 3))
3575 (set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))])]
3577 rtx result = gen_rtx_ASHIFTRT (SImode, operands[0], GEN_INT (30));
3578 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
3579 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
3582 (define_insn_and_split "*cmpint_sign"
3583 [(set (match_operand:DI 0 "register_operand" "=d")
3584 (sign_extend:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3585 UNSPEC_STRCMPCC_TO_INT)))
3586 (clobber (reg:CC CC_REGNUM))]
3589 "&& reload_completed"
3590 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
3592 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))
3593 (clobber (reg:CC CC_REGNUM))])])
3595 (define_insn_and_split "*cmpint_sign_cc"
3596 [(set (reg CC_REGNUM)
3597 (compare (ashiftrt:DI (ashift:DI (subreg:DI
3598 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3599 UNSPEC_STRCMPCC_TO_INT) 0)
3600 (const_int 32)) (const_int 32))
3602 (set (match_operand:DI 0 "register_operand" "=d")
3603 (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT)))]
3604 "s390_match_ccmode (insn, CCSmode) && TARGET_ZARCH"
3606 "&& reload_completed"
3607 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
3609 [(set (match_dup 2) (match_dup 3))
3610 (set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))])]
3612 rtx result = gen_rtx_ASHIFTRT (DImode, operands[0], GEN_INT (62));
3613 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
3614 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
3619 ;;- Conversion instructions.
3622 (define_insn "*sethighpartsi"
3623 [(set (match_operand:SI 0 "register_operand" "=d,d")
3624 (unspec:SI [(match_operand:BLK 1 "s_operand" "Q,S")
3625 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
3626 (clobber (reg:CC CC_REGNUM))]
3631 [(set_attr "op_type" "RS,RSY")
3632 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3634 (define_insn "*sethighpartdi_64"
3635 [(set (match_operand:DI 0 "register_operand" "=d")
3636 (unspec:DI [(match_operand:BLK 1 "s_operand" "QS")
3637 (match_operand 2 "const_int_operand" "n")] UNSPEC_ICM))
3638 (clobber (reg:CC CC_REGNUM))]
3641 [(set_attr "op_type" "RSY")
3642 (set_attr "z10prop" "z10_super")])
3644 (define_insn "*sethighpartdi_31"
3645 [(set (match_operand:DI 0 "register_operand" "=d,d")
3646 (unspec:DI [(match_operand:BLK 1 "s_operand" "Q,S")
3647 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
3648 (clobber (reg:CC CC_REGNUM))]
3653 [(set_attr "op_type" "RS,RSY")
3654 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3657 ; extv instruction patterns
3660 ; FIXME: This expander needs to be converted from DI to GPR as well
3661 ; after resolving some issues with it.
3663 (define_expand "extzv"
3665 [(set (match_operand:DI 0 "register_operand" "=d")
3667 (match_operand:DI 1 "register_operand" "d")
3668 (match_operand 2 "const_int_operand" "") ; size
3669 (match_operand 3 "const_int_operand" ""))) ; start
3670 (clobber (reg:CC CC_REGNUM))])]
3673 /* Starting with zEC12 there is risbgn not clobbering CC. */
3676 emit_move_insn (operands[0],
3677 gen_rtx_ZERO_EXTRACT (DImode,
3685 (define_insn "*extzv<mode>_zEC12"
3686 [(set (match_operand:GPR 0 "register_operand" "=d")
3688 (match_operand:GPR 1 "register_operand" "d")
3689 (match_operand 2 "const_int_operand" "") ; size
3690 (match_operand 3 "const_int_operand" "")))] ; start]
3692 "risbgn\t%0,%1,64-%2,128+63,<bitsize>+%3+%2" ; dst, src, start, end, shift
3693 [(set_attr "op_type" "RIE")])
3695 (define_insn "*extzv<mode>_z10"
3696 [(set (match_operand:GPR 0 "register_operand" "=d")
3698 (match_operand:GPR 1 "register_operand" "d")
3699 (match_operand 2 "const_int_operand" "") ; size
3700 (match_operand 3 "const_int_operand" ""))) ; start
3701 (clobber (reg:CC CC_REGNUM))]
3703 "risbg\t%0,%1,64-%2,128+63,<bitsize>+%3+%2" ; dst, src, start, end, shift
3704 [(set_attr "op_type" "RIE")
3705 (set_attr "z10prop" "z10_super_E1")])
3707 (define_insn_and_split "*pre_z10_extzv<mode>"
3708 [(set (match_operand:GPR 0 "register_operand" "=d")
3709 (zero_extract:GPR (match_operand:QI 1 "s_operand" "QS")
3710 (match_operand 2 "nonzero_shift_count_operand" "")
3712 (clobber (reg:CC CC_REGNUM))]
3715 "&& reload_completed"
3717 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
3718 (clobber (reg:CC CC_REGNUM))])
3719 (set (match_dup 0) (lshiftrt:GPR (match_dup 0) (match_dup 2)))]
3721 int bitsize = INTVAL (operands[2]);
3722 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
3723 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
3725 operands[1] = adjust_address (operands[1], BLKmode, 0);
3726 set_mem_size (operands[1], size);
3727 operands[2] = GEN_INT (<GPR:bitsize> - bitsize);
3728 operands[3] = GEN_INT (mask);
3731 (define_insn_and_split "*pre_z10_extv<mode>"
3732 [(set (match_operand:GPR 0 "register_operand" "=d")
3733 (sign_extract:GPR (match_operand:QI 1 "s_operand" "QS")
3734 (match_operand 2 "nonzero_shift_count_operand" "")
3736 (clobber (reg:CC CC_REGNUM))]
3739 "&& reload_completed"
3741 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
3742 (clobber (reg:CC CC_REGNUM))])
3744 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
3745 (clobber (reg:CC CC_REGNUM))])]
3747 int bitsize = INTVAL (operands[2]);
3748 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
3749 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
3751 operands[1] = adjust_address (operands[1], BLKmode, 0);
3752 set_mem_size (operands[1], size);
3753 operands[2] = GEN_INT (<GPR:bitsize> - bitsize);
3754 operands[3] = GEN_INT (mask);
3758 ; insv instruction patterns
3761 (define_expand "insv"
3762 [(set (zero_extract (match_operand 0 "nonimmediate_operand" "")
3763 (match_operand 1 "const_int_operand" "")
3764 (match_operand 2 "const_int_operand" ""))
3765 (match_operand 3 "general_operand" ""))]
3768 if (s390_expand_insv (operands[0], operands[1], operands[2], operands[3]))
3774 ; The normal RTL expansion will never generate a zero_extract where
3775 ; the location operand isn't word mode. However, we do this in the
3776 ; back-end when generating atomic operations. See s390_two_part_insv.
3777 (define_insn "*insv<mode>_zEC12"
3778 [(set (zero_extract:GPR (match_operand:GPR 0 "nonimmediate_operand" "+d")
3779 (match_operand 1 "const_int_operand" "I") ; size
3780 (match_operand 2 "const_int_operand" "I")) ; pos
3781 (match_operand:GPR 3 "nonimmediate_operand" "d"))]
3783 && (INTVAL (operands[1]) + INTVAL (operands[2])) <= <bitsize>"
3784 "risbgn\t%0,%3,64-<bitsize>+%2,64-<bitsize>+%2+%1-1,<bitsize>-%2-%1"
3785 [(set_attr "op_type" "RIE")])
3787 (define_insn "*insv<mode>_z10"
3788 [(set (zero_extract:GPR (match_operand:GPR 0 "nonimmediate_operand" "+d")
3789 (match_operand 1 "const_int_operand" "I") ; size
3790 (match_operand 2 "const_int_operand" "I")) ; pos
3791 (match_operand:GPR 3 "nonimmediate_operand" "d"))
3792 (clobber (reg:CC CC_REGNUM))]
3794 && (INTVAL (operands[1]) + INTVAL (operands[2])) <= <bitsize>"
3795 "risbg\t%0,%3,64-<bitsize>+%2,64-<bitsize>+%2+%1-1,<bitsize>-%2-%1"
3796 [(set_attr "op_type" "RIE")
3797 (set_attr "z10prop" "z10_super_E1")])
3799 ; and op1 with a mask being 1 for the selected bits and 0 for the rest
3800 ; and op3=op0 with a mask being 0 for the selected bits and 1 for the rest
3801 (define_insn "*insv<mode>_zEC12_noshift"
3802 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3803 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3804 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3805 (and:GPR (match_operand:GPR 3 "nonimmediate_operand" "0")
3806 (match_operand:GPR 4 "const_int_operand" ""))))]
3807 "TARGET_ZEC12 && INTVAL (operands[2]) == ~INTVAL (operands[4])"
3808 "risbgn\t%0,%1,%<bfstart>2,%<bfend>2,0"
3809 [(set_attr "op_type" "RIE")])
3811 (define_insn "*insv<mode>_z10_noshift"
3812 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3813 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3814 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3815 (and:GPR (match_operand:GPR 3 "nonimmediate_operand" "0")
3816 (match_operand:GPR 4 "const_int_operand" ""))))
3817 (clobber (reg:CC CC_REGNUM))]
3818 "TARGET_Z10 && INTVAL (operands[2]) == ~INTVAL (operands[4])"
3819 "risbg\t%0,%1,%<bfstart>2,%<bfend>2,0"
3820 [(set_attr "op_type" "RIE")
3821 (set_attr "z10prop" "z10_super_E1")])
3823 ; Implement appending Y on the left of S bits of X
3824 ; x = (y << s) | (x & ((1 << s) - 1))
3825 (define_insn "*insv<mode>_zEC12_appendbitsleft"
3826 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3827 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "0")
3828 (match_operand:GPR 2 "immediate_operand" ""))
3829 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "d")
3830 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))]
3831 "TARGET_ZEC12 && UINTVAL (operands[2]) == (1UL << UINTVAL (operands[4])) - 1"
3832 "risbgn\t%0,%3,64-<bitsize>,64-%4-1,%4"
3833 [(set_attr "op_type" "RIE")
3834 (set_attr "z10prop" "z10_super_E1")])
3836 (define_insn "*insv<mode>_z10_appendbitsleft"
3837 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3838 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "0")
3839 (match_operand:GPR 2 "immediate_operand" ""))
3840 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "d")
3841 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))
3842 (clobber (reg:CC CC_REGNUM))]
3843 "TARGET_Z10 && !TARGET_ZEC12 && UINTVAL (operands[2]) == (1UL << UINTVAL (operands[4])) - 1"
3844 "risbg\t%0,%3,64-<bitsize>,64-%4-1,%4"
3845 [(set_attr "op_type" "RIE")
3846 (set_attr "z10prop" "z10_super_E1")])
3848 ; z = (x << c) | (y >> d) with (x << c) and (y >> d) not overlapping after shifting
3849 ; -> z = y >> d; z = (x << c) | (z & ((1 << c) - 1))
3850 ; -> z = y >> d; z = risbg;
3853 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
3854 (ior:GPR (lshiftrt:GPR (match_operand:GPR 1 "nonimmediate_operand" "")
3855 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
3856 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "")
3857 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))]
3858 "TARGET_ZEC12 && UINTVAL (operands[2]) + UINTVAL (operands[4]) >= <bitsize>"
3860 (lshiftrt:GPR (match_dup 1) (match_dup 2)))
3862 (ior:GPR (and:GPR (match_dup 0) (match_dup 5))
3863 (ashift:GPR (match_dup 3) (match_dup 4))))]
3865 operands[5] = GEN_INT ((1UL << UINTVAL (operands[4])) - 1);
3870 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
3871 (ior:GPR (lshiftrt:GPR (match_operand:GPR 1 "nonimmediate_operand" "")
3872 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
3873 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "")
3874 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))
3875 (clobber (reg:CC CC_REGNUM))])]
3876 "TARGET_Z10 && !TARGET_ZEC12 && UINTVAL (operands[2]) + UINTVAL (operands[4]) >= <bitsize>"
3878 (lshiftrt:GPR (match_dup 1) (match_dup 2)))
3881 (ior:GPR (and:GPR (match_dup 0) (match_dup 5))
3882 (ashift:GPR (match_dup 3) (match_dup 4))))
3883 (clobber (reg:CC CC_REGNUM))])]
3885 operands[5] = GEN_INT ((1UL << UINTVAL (operands[4])) - 1);
3888 (define_insn "*r<noxa>sbg_<mode>_noshift"
3889 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3891 (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3892 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3893 (match_operand:GPR 3 "nonimmediate_operand" "0")))
3894 (clobber (reg:CC CC_REGNUM))]
3896 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,0"
3897 [(set_attr "op_type" "RIE")])
3899 (define_insn "*r<noxa>sbg_di_rotl"
3900 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
3904 (match_operand:DI 1 "nonimmediate_operand" "d")
3905 (match_operand:DI 3 "const_int_operand" ""))
3906 (match_operand:DI 2 "contiguous_bitmask_operand" ""))
3907 (match_operand:DI 4 "nonimmediate_operand" "0")))
3908 (clobber (reg:CC CC_REGNUM))]
3910 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%b3"
3911 [(set_attr "op_type" "RIE")])
3913 (define_insn "*r<noxa>sbg_<mode>_srl"
3914 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3918 (match_operand:GPR 1 "nonimmediate_operand" "d")
3919 (match_operand:GPR 3 "nonzero_shift_count_operand" ""))
3920 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3921 (match_operand:GPR 4 "nonimmediate_operand" "0")))
3922 (clobber (reg:CC CC_REGNUM))]
3924 && s390_extzv_shift_ok (<bitsize>, 64 - INTVAL (operands[3]),
3925 INTVAL (operands[2]))"
3926 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,64-%3"
3927 [(set_attr "op_type" "RIE")])
3929 (define_insn "*r<noxa>sbg_<mode>_sll"
3930 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3934 (match_operand:GPR 1 "nonimmediate_operand" "d")
3935 (match_operand:GPR 3 "nonzero_shift_count_operand" ""))
3936 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3937 (match_operand:GPR 4 "nonimmediate_operand" "0")))
3938 (clobber (reg:CC CC_REGNUM))]
3940 && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[3]),
3941 INTVAL (operands[2]))"
3942 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%3"
3943 [(set_attr "op_type" "RIE")])
3945 ;; These two are generated by combine for s.bf &= val.
3946 ;; ??? For bitfields smaller than 32-bits, we wind up with SImode
3947 ;; shifts and ands, which results in some truly awful patterns
3948 ;; including subregs of operations. Rather unnecessisarily, IMO.
3951 ;; (set (zero_extract:DI (reg/v:DI 50 [ s ])
3952 ;; (const_int 24 [0x18])
3953 ;; (const_int 0 [0]))
3954 ;; (subreg:DI (and:SI (subreg:SI (lshiftrt:DI (reg/v:DI 50 [ s ])
3955 ;; (const_int 40 [0x28])) 4)
3956 ;; (reg:SI 4 %r4 [ y+4 ])) 0))
3958 ;; we should instead generate
3960 ;; (set (zero_extract:DI (reg/v:DI 50 [ s ])
3961 ;; (const_int 24 [0x18])
3962 ;; (const_int 0 [0]))
3963 ;; (and:DI (lshiftrt:DI (reg/v:DI 50 [ s ])
3964 ;; (const_int 40 [0x28]))
3965 ;; (subreg:DI (reg:SI 4 %r4 [ y+4 ]) 0)))
3967 ;; by noticing that we can push down the outer paradoxical subreg
3968 ;; into the operation.
3970 (define_insn "*insv_rnsbg_noshift"
3971 [(set (zero_extract:DI
3972 (match_operand:DI 0 "nonimmediate_operand" "+d")
3973 (match_operand 1 "const_int_operand" "")
3974 (match_operand 2 "const_int_operand" ""))
3977 (match_operand:DI 3 "nonimmediate_operand" "d")))
3978 (clobber (reg:CC CC_REGNUM))]
3980 && INTVAL (operands[1]) + INTVAL (operands[2]) == 64"
3981 "rnsbg\t%0,%3,%2,63,0"
3982 [(set_attr "op_type" "RIE")])
3984 (define_insn "*insv_rnsbg_srl"
3985 [(set (zero_extract:DI
3986 (match_operand:DI 0 "nonimmediate_operand" "+d")
3987 (match_operand 1 "const_int_operand" "")
3988 (match_operand 2 "const_int_operand" ""))
3992 (match_operand 3 "const_int_operand" ""))
3993 (match_operand:DI 4 "nonimmediate_operand" "d")))
3994 (clobber (reg:CC CC_REGNUM))]
3996 && INTVAL (operands[3]) == 64 - INTVAL (operands[1]) - INTVAL (operands[2])"
3997 "rnsbg\t%0,%4,%2,%2+%1-1,%3"
3998 [(set_attr "op_type" "RIE")])
4000 (define_insn "*insv<mode>_mem_reg"
4001 [(set (zero_extract:W (match_operand:QI 0 "memory_operand" "+Q,S")
4002 (match_operand 1 "const_int_operand" "n,n")
4004 (match_operand:W 2 "register_operand" "d,d"))]
4005 "INTVAL (operands[1]) > 0
4006 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
4007 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
4009 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
4011 operands[1] = GEN_INT ((1ul << size) - 1);
4012 return (which_alternative == 0) ? "stcm\t%2,%1,%S0"
4013 : "stcmy\t%2,%1,%S0";
4015 [(set_attr "op_type" "RS,RSY")
4016 (set_attr "z10prop" "z10_super,z10_super")])
4018 (define_insn "*insvdi_mem_reghigh"
4019 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "+QS")
4020 (match_operand 1 "const_int_operand" "n")
4022 (lshiftrt:DI (match_operand:DI 2 "register_operand" "d")
4025 && INTVAL (operands[1]) > 0
4026 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
4027 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
4029 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
4031 operands[1] = GEN_INT ((1ul << size) - 1);
4032 return "stcmh\t%2,%1,%S0";
4034 [(set_attr "op_type" "RSY")
4035 (set_attr "z10prop" "z10_super")])
4037 (define_insn "*insvdi_reg_imm"
4038 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4040 (match_operand 1 "const_int_operand" "n"))
4041 (match_operand:DI 2 "const_int_operand" "n"))]
4043 && INTVAL (operands[1]) >= 0
4044 && INTVAL (operands[1]) < BITS_PER_WORD
4045 && INTVAL (operands[1]) % 16 == 0"
4047 switch (BITS_PER_WORD - INTVAL (operands[1]))
4049 case 64: return "iihh\t%0,%x2"; break;
4050 case 48: return "iihl\t%0,%x2"; break;
4051 case 32: return "iilh\t%0,%x2"; break;
4052 case 16: return "iill\t%0,%x2"; break;
4053 default: gcc_unreachable();
4056 [(set_attr "op_type" "RI")
4057 (set_attr "z10prop" "z10_super_E1")])
4059 ; Update the left-most 32 bit of a DI.
4060 (define_insn "*insv_h_di_reg_extimm"
4061 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4064 (match_operand:DI 1 "const_int_operand" "n"))]
4067 [(set_attr "op_type" "RIL")
4068 (set_attr "z10prop" "z10_fwd_E1")])
4070 ; Update the right-most 32 bit of a DI.
4071 (define_insn "*insv_l_di_reg_extimm"
4072 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4075 (match_operand:DI 1 "const_int_operand" "n"))]
4078 [(set_attr "op_type" "RIL")
4079 (set_attr "z10prop" "z10_fwd_A1")])
4082 ; extendsidi2 instruction pattern(s).
4085 (define_expand "extendsidi2"
4086 [(set (match_operand:DI 0 "register_operand" "")
4087 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
4092 emit_clobber (operands[0]);
4093 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
4094 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
4095 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
4100 (define_insn "*extendsidi2"
4101 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4102 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,RT,b")))]
4108 [(set_attr "op_type" "RRE,RXY,RIL")
4109 (set_attr "type" "*,*,larl")
4110 (set_attr "cpu_facility" "*,*,z10")
4111 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
4114 ; extend(hi|qi)(si|di)2 instruction pattern(s).
4117 (define_expand "extend<HQI:mode><DSI:mode>2"
4118 [(set (match_operand:DSI 0 "register_operand" "")
4119 (sign_extend:DSI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4122 if (<DSI:MODE>mode == DImode && !TARGET_ZARCH)
4124 rtx tmp = gen_reg_rtx (SImode);
4125 emit_insn (gen_extend<HQI:mode>si2 (tmp, operands[1]));
4126 emit_insn (gen_extendsidi2 (operands[0], tmp));
4129 else if (!TARGET_EXTIMM)
4131 rtx bitcount = GEN_INT (<DSI:bitsize> - <HQI:bitsize>);
4133 operands[1] = gen_lowpart (<DSI:MODE>mode, operands[1]);
4134 emit_insn (gen_ashl<DSI:mode>3 (operands[0], operands[1], bitcount));
4135 emit_insn (gen_ashr<DSI:mode>3 (operands[0], operands[0], bitcount));
4141 ; extendhidi2 instruction pattern(s).
4144 (define_insn "*extendhidi2_extimm"
4145 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4146 (sign_extend:DI (match_operand:HI 1 "general_operand" "d,RT,b")))]
4147 "TARGET_ZARCH && TARGET_EXTIMM"
4152 [(set_attr "op_type" "RRE,RXY,RIL")
4153 (set_attr "type" "*,*,larl")
4154 (set_attr "cpu_facility" "extimm,extimm,z10")
4155 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
4157 (define_insn "*extendhidi2"
4158 [(set (match_operand:DI 0 "register_operand" "=d")
4159 (sign_extend:DI (match_operand:HI 1 "memory_operand" "RT")))]
4162 [(set_attr "op_type" "RXY")
4163 (set_attr "z10prop" "z10_super_E1")])
4166 ; extendhisi2 instruction pattern(s).
4169 (define_insn "*extendhisi2_extimm"
4170 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4171 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" " d,R,T,b")))]
4178 [(set_attr "op_type" "RRE,RX,RXY,RIL")
4179 (set_attr "type" "*,*,*,larl")
4180 (set_attr "cpu_facility" "extimm,extimm,extimm,z10")
4181 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
4183 (define_insn "*extendhisi2"
4184 [(set (match_operand:SI 0 "register_operand" "=d,d")
4185 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
4190 [(set_attr "op_type" "RX,RXY")
4191 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4194 ; extendqi(si|di)2 instruction pattern(s).
4197 ; lbr, lgbr, lb, lgb
4198 (define_insn "*extendqi<mode>2_extimm"
4199 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4200 (sign_extend:GPR (match_operand:QI 1 "nonimmediate_operand" "d,RT")))]
4205 [(set_attr "op_type" "RRE,RXY")
4206 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4209 (define_insn "*extendqi<mode>2"
4210 [(set (match_operand:GPR 0 "register_operand" "=d")
4211 (sign_extend:GPR (match_operand:QI 1 "memory_operand" "RT")))]
4212 "!TARGET_EXTIMM && TARGET_LONG_DISPLACEMENT"
4214 [(set_attr "op_type" "RXY")
4215 (set_attr "z10prop" "z10_super_E1")])
4217 (define_insn_and_split "*extendqi<mode>2_short_displ"
4218 [(set (match_operand:GPR 0 "register_operand" "=d")
4219 (sign_extend:GPR (match_operand:QI 1 "s_operand" "Q")))
4220 (clobber (reg:CC CC_REGNUM))]
4221 "!TARGET_EXTIMM && !TARGET_LONG_DISPLACEMENT"
4223 "&& reload_completed"
4225 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (const_int 8)] UNSPEC_ICM))
4226 (clobber (reg:CC CC_REGNUM))])
4228 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
4229 (clobber (reg:CC CC_REGNUM))])]
4231 operands[1] = adjust_address (operands[1], BLKmode, 0);
4232 set_mem_size (operands[1], GET_MODE_SIZE (QImode));
4233 operands[2] = GEN_INT (<GPR:bitsize> - BITS_PER_UNIT);
4237 ; zero_extendsidi2 instruction pattern(s).
4240 (define_expand "zero_extendsidi2"
4241 [(set (match_operand:DI 0 "register_operand" "")
4242 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
4247 emit_clobber (operands[0]);
4248 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
4249 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
4254 (define_insn "*zero_extendsidi2"
4255 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4256 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,RT,b")))]
4262 [(set_attr "op_type" "RRE,RXY,RIL")
4263 (set_attr "type" "*,*,larl")
4264 (set_attr "cpu_facility" "*,*,z10")
4265 (set_attr "z10prop" "z10_fwd_E1,z10_fwd_A3,z10_fwd_A3")])
4268 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
4271 (define_insn "*llgt_sidi"
4272 [(set (match_operand:DI 0 "register_operand" "=d")
4273 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "RT") 0)
4274 (const_int 2147483647)))]
4277 [(set_attr "op_type" "RXE")
4278 (set_attr "z10prop" "z10_super_E1")])
4280 (define_insn_and_split "*llgt_sidi_split"
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)))
4284 (clobber (reg:CC CC_REGNUM))]
4287 "&& reload_completed"
4289 (and:DI (subreg:DI (match_dup 1) 0)
4290 (const_int 2147483647)))]
4293 (define_insn "*llgt_sisi"
4294 [(set (match_operand:SI 0 "register_operand" "=d,d")
4295 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,RT")
4296 (const_int 2147483647)))]
4301 [(set_attr "op_type" "RRE,RXE")
4302 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4304 (define_insn "*llgt_didi"
4305 [(set (match_operand:DI 0 "register_operand" "=d,d")
4306 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
4307 (const_int 2147483647)))]
4312 [(set_attr "op_type" "RRE,RXE")
4313 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4316 [(set (match_operand:DSI 0 "register_operand" "")
4317 (and:DSI (match_operand:DSI 1 "nonimmediate_operand" "")
4318 (const_int 2147483647)))
4319 (clobber (reg:CC CC_REGNUM))]
4320 "TARGET_ZARCH && reload_completed"
4322 (and:DSI (match_dup 1)
4323 (const_int 2147483647)))]
4327 ; zero_extend(hi|qi)(si|di)2 instruction pattern(s).
4330 (define_expand "zero_extend<mode>di2"
4331 [(set (match_operand:DI 0 "register_operand" "")
4332 (zero_extend:DI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4337 rtx tmp = gen_reg_rtx (SImode);
4338 emit_insn (gen_zero_extend<mode>si2 (tmp, operands[1]));
4339 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
4342 else if (!TARGET_EXTIMM)
4344 rtx bitcount = GEN_INT (64 - <HQI:bitsize>);
4345 operands[1] = gen_lowpart (DImode, operands[1]);
4346 emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount));
4347 emit_insn (gen_lshrdi3 (operands[0], operands[0], bitcount));
4352 (define_expand "zero_extend<mode>si2"
4353 [(set (match_operand:SI 0 "register_operand" "")
4354 (zero_extend:SI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4359 operands[1] = gen_lowpart (SImode, operands[1]);
4360 emit_insn (gen_andsi3 (operands[0], operands[1],
4361 GEN_INT ((1 << <HQI:bitsize>) - 1)));
4367 (define_insn "*zero_extendhi<mode>2_z10"
4368 [(set (match_operand:GPR 0 "register_operand" "=d,d,d")
4369 (zero_extend:GPR (match_operand:HI 1 "nonimmediate_operand" "d,RT,b")))]
4375 [(set_attr "op_type" "RXY,RRE,RIL")
4376 (set_attr "type" "*,*,larl")
4377 (set_attr "cpu_facility" "*,*,z10")
4378 (set_attr "z10prop" "z10_super_E1,z10_fwd_A3,z10_fwd_A3")])
4380 ; llhr, llcr, llghr, llgcr, llh, llc, llgh, llgc
4381 (define_insn "*zero_extend<HQI:mode><GPR:mode>2_extimm"
4382 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4383 (zero_extend:GPR (match_operand:HQI 1 "nonimmediate_operand" "d,RT")))]
4388 [(set_attr "op_type" "RRE,RXY")
4389 (set_attr "z10prop" "z10_super_E1,z10_fwd_A3")])
4392 (define_insn "*zero_extend<HQI:mode><GPR:mode>2"
4393 [(set (match_operand:GPR 0 "register_operand" "=d")
4394 (zero_extend:GPR (match_operand:HQI 1 "memory_operand" "RT")))]
4395 "TARGET_ZARCH && !TARGET_EXTIMM"
4397 [(set_attr "op_type" "RXY")
4398 (set_attr "z10prop" "z10_fwd_A3")])
4400 (define_insn_and_split "*zero_extendhisi2_31"
4401 [(set (match_operand:SI 0 "register_operand" "=&d")
4402 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
4403 (clobber (reg:CC CC_REGNUM))]
4406 "&& reload_completed"
4407 [(set (match_dup 0) (const_int 0))
4409 [(set (strict_low_part (match_dup 2)) (match_dup 1))
4410 (clobber (reg:CC CC_REGNUM))])]
4411 "operands[2] = gen_lowpart (HImode, operands[0]);")
4413 (define_insn_and_split "*zero_extendqisi2_31"
4414 [(set (match_operand:SI 0 "register_operand" "=&d")
4415 (zero_extend:SI (match_operand:QI 1 "memory_operand" "RT")))]
4418 "&& reload_completed"
4419 [(set (match_dup 0) (const_int 0))
4420 (set (strict_low_part (match_dup 2)) (match_dup 1))]
4421 "operands[2] = gen_lowpart (QImode, operands[0]);")
4424 ; zero_extendqihi2 instruction pattern(s).
4427 (define_expand "zero_extendqihi2"
4428 [(set (match_operand:HI 0 "register_operand" "")
4429 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
4430 "TARGET_ZARCH && !TARGET_EXTIMM"
4432 operands[1] = gen_lowpart (HImode, operands[1]);
4433 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
4437 (define_insn "*zero_extendqihi2_64"
4438 [(set (match_operand:HI 0 "register_operand" "=d")
4439 (zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))]
4440 "TARGET_ZARCH && !TARGET_EXTIMM"
4442 [(set_attr "op_type" "RXY")
4443 (set_attr "z10prop" "z10_fwd_A3")])
4445 (define_insn_and_split "*zero_extendqihi2_31"
4446 [(set (match_operand:HI 0 "register_operand" "=&d")
4447 (zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))]
4450 "&& reload_completed"
4451 [(set (match_dup 0) (const_int 0))
4452 (set (strict_low_part (match_dup 2)) (match_dup 1))]
4453 "operands[2] = gen_lowpart (QImode, operands[0]);")
4456 ; fixuns_trunc(dd|td)di2 instruction pattern(s).
4459 (define_expand "fixuns_truncdddi2"
4461 [(set (match_operand:DI 0 "register_operand" "")
4462 (unsigned_fix:DI (match_operand:DD 1 "register_operand" "")))
4463 (unspec:DI [(const_int 5)] UNSPEC_ROUND)
4464 (clobber (reg:CC CC_REGNUM))])]
4470 rtx_code_label *label1 = gen_label_rtx ();
4471 rtx_code_label *label2 = gen_label_rtx ();
4472 rtx temp = gen_reg_rtx (TDmode);
4473 REAL_VALUE_TYPE cmp, sub;
4475 decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */
4476 decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
4478 /* 2^63 can't be represented as 64bit DFP number with full precision. The
4479 solution is doing the check and the subtraction in TD mode and using a
4480 TD -> DI convert afterwards. */
4481 emit_insn (gen_extendddtd2 (temp, operands[1]));
4482 temp = force_reg (TDmode, temp);
4483 emit_cmp_and_jump_insns (temp,
4484 const_double_from_real_value (cmp, TDmode),
4485 LT, NULL_RTX, VOIDmode, 0, label1);
4486 emit_insn (gen_subtd3 (temp, temp,
4487 const_double_from_real_value (sub, TDmode)));
4488 emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, GEN_INT (11)));
4491 emit_label (label1);
4492 emit_insn (gen_fix_truncdddi2_dfp (operands[0], operands[1], GEN_INT (9)));
4493 emit_label (label2);
4498 (define_expand "fixuns_trunctddi2"
4500 [(set (match_operand:DI 0 "register_operand" "")
4501 (unsigned_fix:DI (match_operand:TD 1 "register_operand" "")))
4502 (unspec:DI [(const_int 5)] UNSPEC_ROUND)
4503 (clobber (reg:CC CC_REGNUM))])]
4509 rtx_code_label *label1 = gen_label_rtx ();
4510 rtx_code_label *label2 = gen_label_rtx ();
4511 rtx temp = gen_reg_rtx (TDmode);
4512 REAL_VALUE_TYPE cmp, sub;
4514 operands[1] = force_reg (TDmode, operands[1]);
4515 decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */
4516 decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
4518 emit_cmp_and_jump_insns (operands[1],
4519 const_double_from_real_value (cmp, TDmode),
4520 LT, NULL_RTX, VOIDmode, 0, label1);
4521 emit_insn (gen_subtd3 (temp, operands[1],
4522 const_double_from_real_value (sub, TDmode)));
4523 emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, GEN_INT (11)));
4526 emit_label (label1);
4527 emit_insn (gen_fix_trunctddi2_dfp (operands[0], operands[1], GEN_INT (9)));
4528 emit_label (label2);
4534 ; fixuns_trunc(sf|df|tf)(si|di)2 and fix_trunc(sf|df|tf)(si|di)2
4535 ; instruction pattern(s).
4538 (define_expand "fixuns_trunc<BFP:mode><GPR:mode>2"
4540 [(set (match_operand:GPR 0 "register_operand" "")
4541 (unsigned_fix:GPR (match_operand:BFP 1 "register_operand" "")))
4542 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
4543 (clobber (reg:CC CC_REGNUM))])]
4548 rtx_code_label *label1 = gen_label_rtx ();
4549 rtx_code_label *label2 = gen_label_rtx ();
4550 rtx temp = gen_reg_rtx (<BFP:MODE>mode);
4551 REAL_VALUE_TYPE cmp, sub;
4553 operands[1] = force_reg (<BFP:MODE>mode, operands[1]);
4554 real_2expN (&cmp, <GPR:bitsize> - 1, <BFP:MODE>mode);
4555 real_2expN (&sub, <GPR:bitsize>, <BFP:MODE>mode);
4557 emit_cmp_and_jump_insns (operands[1],
4558 const_double_from_real_value (cmp, <BFP:MODE>mode),
4559 LT, NULL_RTX, VOIDmode, 0, label1);
4560 emit_insn (gen_sub<BFP:mode>3 (temp, operands[1],
4561 const_double_from_real_value (sub, <BFP:MODE>mode)));
4562 emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0], temp,
4566 emit_label (label1);
4567 emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0],
4568 operands[1], GEN_INT (5)));
4569 emit_label (label2);
4574 ; fixuns_trunc(td|dd)si2 expander
4575 (define_expand "fixuns_trunc<mode>si2"
4577 [(set (match_operand:SI 0 "register_operand" "")
4578 (unsigned_fix:SI (match_operand:DFP 1 "register_operand" "")))
4579 (unspec:SI [(const_int 5)] UNSPEC_ROUND)
4580 (clobber (reg:CC CC_REGNUM))])]
4581 "TARGET_Z196 && TARGET_HARD_DFP"
4584 ; fixuns_trunc(tf|df|sf|td|dd)(di|si)2 instruction patterns.
4586 (define_insn "*fixuns_truncdfdi2_z13"
4587 [(set (match_operand:DI 0 "register_operand" "=d,v")
4588 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "f,v")))
4589 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND)
4590 (clobber (reg:CC CC_REGNUM))]
4591 "TARGET_Z13 && TARGET_HARD_FLOAT"
4594 wclgdb\t%v0,%v1,0,%h2"
4595 [(set_attr "op_type" "RRF,VRR")
4596 (set_attr "type" "ftoi")])
4598 ; clfebr, clfdbr, clfxbr, clgebr, clgdbr, clgxbr
4599 ; clfdtr, clfxtr, clgdtr, clgxtr
4600 (define_insn "*fixuns_trunc<FP:mode><GPR:mode>2_z196"
4601 [(set (match_operand:GPR 0 "register_operand" "=d")
4602 (unsigned_fix:GPR (match_operand:FP 1 "register_operand" "f")))
4603 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4604 (clobber (reg:CC CC_REGNUM))]
4605 "TARGET_Z196 && TARGET_HARD_FLOAT
4606 && (!TARGET_Z13 || <GPR:MODE>mode != DImode || <FP:MODE>mode != DFmode)"
4607 "cl<GPR:gf><FP:xde><FP:bt>r\t%0,%h2,%1,0"
4608 [(set_attr "op_type" "RRF")
4609 (set_attr "type" "ftoi")])
4611 (define_expand "fix_trunc<DSF:mode><GPR:mode>2"
4612 [(set (match_operand:GPR 0 "register_operand" "")
4613 (fix:GPR (match_operand:DSF 1 "register_operand" "")))]
4616 emit_insn (gen_fix_trunc<DSF:mode><GPR:mode>2_bfp (operands[0], operands[1],
4621 (define_insn "*fix_truncdfdi2_bfp_z13"
4622 [(set (match_operand:DI 0 "register_operand" "=d,v")
4623 (fix:DI (match_operand:DF 1 "register_operand" "f,v")))
4624 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND)
4625 (clobber (reg:CC CC_REGNUM))]
4626 "TARGET_Z13 && TARGET_HARD_FLOAT"
4629 wcgdb\t%v0,%v1,0,%h2"
4630 [(set_attr "op_type" "RRE,VRR")
4631 (set_attr "type" "ftoi")])
4633 ; cgxbr, cgdbr, cgebr, cfxbr, cfdbr, cfebr
4634 (define_insn "*fix_trunc<BFP:mode><GPR:mode>2_bfp"
4635 [(set (match_operand:GPR 0 "register_operand" "=d")
4636 (fix:GPR (match_operand:BFP 1 "register_operand" "f")))
4637 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4638 (clobber (reg:CC CC_REGNUM))]
4640 && (!TARGET_VX || <GPR:MODE>mode != DImode || <BFP:MODE>mode != DFmode)"
4641 "c<GPR:gf><BFP:xde>br\t%0,%h2,%1"
4642 [(set_attr "op_type" "RRE")
4643 (set_attr "type" "ftoi")])
4645 (define_expand "fix_trunc<BFP:mode><GPR:mode>2_bfp"
4647 [(set (match_operand:GPR 0 "register_operand" "=d")
4648 (fix:GPR (match_operand:BFP 1 "register_operand" "f")))
4649 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4650 (clobber (reg:CC CC_REGNUM))])]
4651 "TARGET_HARD_FLOAT")
4653 ; fix_trunc(td|dd)di2 instruction pattern(s).
4656 (define_expand "fix_trunc<mode>di2"
4657 [(set (match_operand:DI 0 "register_operand" "")
4658 (fix:DI (match_operand:DFP 1 "nonimmediate_operand" "")))]
4659 "TARGET_ZARCH && TARGET_HARD_DFP"
4661 operands[1] = force_reg (<MODE>mode, operands[1]);
4662 emit_insn (gen_fix_trunc<mode>di2_dfp (operands[0], operands[1],
4668 (define_insn "fix_trunc<DFP:mode>di2_dfp"
4669 [(set (match_operand:DI 0 "register_operand" "=d")
4670 (fix:DI (match_operand:DFP 1 "register_operand" "f")))
4671 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
4672 (clobber (reg:CC CC_REGNUM))]
4673 "TARGET_ZARCH && TARGET_HARD_DFP"
4674 "cg<DFP:xde>tr\t%0,%h2,%1"
4675 [(set_attr "op_type" "RRF")
4676 (set_attr "type" "ftoidfp")])
4680 ; fix_trunctf(si|di)2 instruction pattern(s).
4683 (define_expand "fix_trunctf<mode>2"
4684 [(parallel [(set (match_operand:GPR 0 "register_operand" "")
4685 (fix:GPR (match_operand:TF 1 "register_operand" "")))
4686 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
4687 (clobber (reg:CC CC_REGNUM))])]
4693 ; float(si|di)(tf|df|sf|td|dd)2 instruction pattern(s).
4696 ; cxgbr, cdgbr, cegbr, cxgtr, cdgtr
4697 (define_insn "floatdi<mode>2"
4698 [(set (match_operand:FP 0 "register_operand" "=f,<vf>")
4699 (float:FP (match_operand:DI 1 "register_operand" "d,<vd>")))]
4700 "TARGET_ZARCH && TARGET_HARD_FLOAT"
4704 [(set_attr "op_type" "RRE,VRR")
4705 (set_attr "type" "itof<mode>" )
4706 (set_attr "cpu_facility" "*,vec")])
4708 ; cxfbr, cdfbr, cefbr
4709 (define_insn "floatsi<mode>2"
4710 [(set (match_operand:BFP 0 "register_operand" "=f")
4711 (float:BFP (match_operand:SI 1 "register_operand" "d")))]
4714 [(set_attr "op_type" "RRE")
4715 (set_attr "type" "itof<mode>" )])
4718 (define_insn "floatsi<mode>2"
4719 [(set (match_operand:DFP 0 "register_operand" "=f")
4720 (float:DFP (match_operand:SI 1 "register_operand" "d")))]
4721 "TARGET_Z196 && TARGET_HARD_FLOAT"
4722 "c<xde>ftr\t%0,0,%1,0"
4723 [(set_attr "op_type" "RRE")
4724 (set_attr "type" "itof<mode>" )])
4727 ; floatuns(si|di)(tf|df|sf|td|dd)2 instruction pattern(s).
4730 (define_insn "*floatunsdidf2_z13"
4731 [(set (match_operand:DF 0 "register_operand" "=f,v")
4732 (unsigned_float:DF (match_operand:DI 1 "register_operand" "d,v")))]
4733 "TARGET_Z13 && TARGET_HARD_FLOAT"
4736 wcdlgb\t%v0,%v1,0,0"
4737 [(set_attr "op_type" "RRE,VRR")
4738 (set_attr "type" "itofdf")])
4740 ; cxlgbr, cdlgbr, celgbr, cxlgtr, cdlgtr
4741 ; cxlfbr, cdlfbr, celfbr, cxlftr, cdlftr
4742 (define_insn "*floatuns<GPR:mode><FP:mode>2"
4743 [(set (match_operand:FP 0 "register_operand" "=f")
4744 (unsigned_float:FP (match_operand:GPR 1 "register_operand" "d")))]
4745 "TARGET_Z196 && TARGET_HARD_FLOAT
4746 && (!TARGET_VX || <FP:MODE>mode != DFmode || <GPR:MODE>mode != DImode)"
4747 "c<FP:xde>l<GPR:gf><FP:bt>r\t%0,0,%1,0"
4748 [(set_attr "op_type" "RRE")
4749 (set_attr "type" "itof<FP:mode>")])
4751 (define_expand "floatuns<GPR:mode><FP:mode>2"
4752 [(set (match_operand:FP 0 "register_operand" "")
4753 (unsigned_float:FP (match_operand:GPR 1 "register_operand" "")))]
4754 "TARGET_Z196 && TARGET_HARD_FLOAT")
4757 ; truncdfsf2 instruction pattern(s).
4760 (define_insn "truncdfsf2"
4761 [(set (match_operand:SF 0 "register_operand" "=f,v")
4762 (float_truncate:SF (match_operand:DF 1 "register_operand" "f,v")))]
4766 wledb\t%v0,%v1,0,0" ; IEEE inexact exception not suppressed
4767 ; According to BFP rounding mode
4768 [(set_attr "op_type" "RRE,VRR")
4769 (set_attr "type" "ftruncdf")
4770 (set_attr "cpu_facility" "*,vec")])
4773 ; trunctf(df|sf)2 instruction pattern(s).
4777 (define_insn "trunctf<mode>2"
4778 [(set (match_operand:DSF 0 "register_operand" "=f")
4779 (float_truncate:DSF (match_operand:TF 1 "register_operand" "f")))
4780 (clobber (match_scratch:TF 2 "=f"))]
4782 "l<xde>xbr\t%2,%1\;l<xde>r\t%0,%2"
4783 [(set_attr "length" "6")
4784 (set_attr "type" "ftrunctf")])
4787 ; trunctddd2 and truncddsd2 instruction pattern(s).
4790 (define_insn "trunctddd2"
4791 [(set (match_operand:DD 0 "register_operand" "=f")
4792 (float_truncate:DD (match_operand:TD 1 "register_operand" "f")))
4793 (clobber (match_scratch:TD 2 "=f"))]
4795 "ldxtr\t%2,0,%1,0\;ldr\t%0,%2"
4796 [(set_attr "length" "6")
4797 (set_attr "type" "ftruncdd")])
4799 (define_insn "truncddsd2"
4800 [(set (match_operand:SD 0 "register_operand" "=f")
4801 (float_truncate:SD (match_operand:DD 1 "register_operand" "f")))]
4804 [(set_attr "op_type" "RRF")
4805 (set_attr "type" "ftruncsd")])
4807 (define_expand "trunctdsd2"
4810 (float_truncate:DD (match_operand:TD 1 "register_operand" "")))
4811 (clobber (match_scratch:TD 2 ""))])
4812 (set (match_operand:SD 0 "register_operand" "")
4813 (float_truncate:SD (match_dup 3)))]
4816 operands[3] = gen_reg_rtx (DDmode);
4820 ; extend(sf|df)(df|tf)2 instruction pattern(s).
4823 (define_insn "*extendsfdf2_z13"
4824 [(set (match_operand:DF 0 "register_operand" "=f,f,v")
4825 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R,v")))]
4826 "TARGET_Z13 && TARGET_HARD_FLOAT"
4831 [(set_attr "op_type" "RRE,RXE,VRR")
4832 (set_attr "type" "fsimpdf, floaddf,fsimpdf")])
4834 ; ldebr, ldeb, lxdbr, lxdb, lxebr, lxeb
4835 (define_insn "*extend<DSF:mode><BFP:mode>2"
4836 [(set (match_operand:BFP 0 "register_operand" "=f,f")
4837 (float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "f,R")))]
4839 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DSF:MODE>mode)
4840 && (!TARGET_VX || <BFP:MODE>mode != DFmode || <DSF:MODE>mode != SFmode)"
4842 l<BFP:xde><DSF:xde>br\t%0,%1
4843 l<BFP:xde><DSF:xde>b\t%0,%1"
4844 [(set_attr "op_type" "RRE,RXE")
4845 (set_attr "type" "fsimp<BFP:mode>, fload<BFP:mode>")])
4847 (define_expand "extend<DSF:mode><BFP:mode>2"
4848 [(set (match_operand:BFP 0 "register_operand" "")
4849 (float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "")))]
4851 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DSF:MODE>mode)")
4854 ; extendddtd2 and extendsddd2 instruction pattern(s).
4857 (define_insn "extendddtd2"
4858 [(set (match_operand:TD 0 "register_operand" "=f")
4859 (float_extend:TD (match_operand:DD 1 "register_operand" "f")))]
4862 [(set_attr "op_type" "RRF")
4863 (set_attr "type" "fsimptf")])
4865 (define_insn "extendsddd2"
4866 [(set (match_operand:DD 0 "register_operand" "=f")
4867 (float_extend:DD (match_operand:SD 1 "register_operand" "f")))]
4870 [(set_attr "op_type" "RRF")
4871 (set_attr "type" "fsimptf")])
4873 (define_expand "extendsdtd2"
4875 (float_extend:DD (match_operand:SD 1 "register_operand" "")))
4876 (set (match_operand:TD 0 "register_operand" "")
4877 (float_extend:TD (match_dup 2)))]
4880 operands[2] = gen_reg_rtx (DDmode);
4883 ; Binary Floating Point - load fp integer
4885 ; Expanders for: floor, btrunc, round, ceil, and nearbyint
4886 ; For all of them the inexact exceptions are suppressed.
4888 ; fiebra, fidbra, fixbra
4889 (define_insn "<FPINT:fpint_name><BFP:mode>2"
4890 [(set (match_operand:BFP 0 "register_operand" "=f")
4891 (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
4894 "fi<BFP:xde>bra\t%0,<FPINT:fpint_roundingmode>,%1,4"
4895 [(set_attr "op_type" "RRF")
4896 (set_attr "type" "fsimp<BFP:mode>")])
4898 ; rint is supposed to raise an inexact exception so we can use the
4899 ; older instructions.
4901 ; fiebr, fidbr, fixbr
4902 (define_insn "rint<BFP:mode>2"
4903 [(set (match_operand:BFP 0 "register_operand" "=f")
4904 (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
4905 UNSPEC_FPINT_RINT))]
4907 "fi<BFP:xde>br\t%0,0,%1"
4908 [(set_attr "op_type" "RRF")
4909 (set_attr "type" "fsimp<BFP:mode>")])
4912 ; Decimal Floating Point - load fp integer
4915 (define_insn "<FPINT:fpint_name><DFP:mode>2"
4916 [(set (match_operand:DFP 0 "register_operand" "=f")
4917 (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")]
4920 "fi<DFP:xde>tr\t%0,<FPINT:fpint_roundingmode>,%1,4"
4921 [(set_attr "op_type" "RRF")
4922 (set_attr "type" "fsimp<DFP:mode>")])
4925 (define_insn "rint<DFP:mode>2"
4926 [(set (match_operand:DFP 0 "register_operand" "=f")
4927 (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")]
4928 UNSPEC_FPINT_RINT))]
4930 "fi<DFP:xde>tr\t%0,0,%1,0"
4931 [(set_attr "op_type" "RRF")
4932 (set_attr "type" "fsimp<DFP:mode>")])
4935 ; Binary <-> Decimal floating point trunc patterns
4938 (define_insn "*trunc<BFP:mode><DFP_ALL:mode>2"
4939 [(set (reg:DFP_ALL FPR0_REGNUM)
4940 (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM)))
4941 (use (reg:SI GPR0_REGNUM))
4942 (clobber (reg:CC CC_REGNUM))
4943 (clobber (reg:SI GPR1_REGNUM))]
4947 (define_insn "*trunc<DFP_ALL:mode><BFP:mode>2"
4948 [(set (reg:BFP FPR0_REGNUM)
4949 (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM)))
4950 (use (reg:SI GPR0_REGNUM))
4951 (clobber (reg:CC CC_REGNUM))
4952 (clobber (reg:SI GPR1_REGNUM))]
4956 (define_expand "trunc<BFP:mode><DFP_ALL:mode>2"
4957 [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
4958 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4960 [(set (reg:DFP_ALL FPR0_REGNUM)
4961 (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM)))
4962 (use (reg:SI GPR0_REGNUM))
4963 (clobber (reg:CC CC_REGNUM))
4964 (clobber (reg:SI GPR1_REGNUM))])
4965 (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "")
4966 (reg:DFP_ALL FPR0_REGNUM))]
4968 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DFP_ALL:MODE>mode)"
4970 HOST_WIDE_INT flags;
4972 flags = (PFPO_CONVERT |
4973 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT |
4974 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT);
4976 operands[2] = GEN_INT (flags);
4979 (define_expand "trunc<DFP_ALL:mode><BFP:mode>2"
4980 [(set (reg:DFP_ALL FPR4_REGNUM)
4981 (match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
4982 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4984 [(set (reg:BFP FPR0_REGNUM) (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM)))
4985 (use (reg:SI GPR0_REGNUM))
4986 (clobber (reg:CC CC_REGNUM))
4987 (clobber (reg:SI GPR1_REGNUM))])
4988 (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))]
4990 && GET_MODE_SIZE (<DFP_ALL:MODE>mode) >= GET_MODE_SIZE (<BFP:MODE>mode)"
4992 HOST_WIDE_INT flags;
4994 flags = (PFPO_CONVERT |
4995 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT |
4996 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT);
4998 operands[2] = GEN_INT (flags);
5002 ; Binary <-> Decimal floating point extend patterns
5005 (define_insn "*extend<BFP:mode><DFP_ALL:mode>2"
5006 [(set (reg:DFP_ALL FPR0_REGNUM) (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM)))
5007 (use (reg:SI GPR0_REGNUM))
5008 (clobber (reg:CC CC_REGNUM))
5009 (clobber (reg:SI GPR1_REGNUM))]
5013 (define_insn "*extend<DFP_ALL:mode><BFP:mode>2"
5014 [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM)))
5015 (use (reg:SI GPR0_REGNUM))
5016 (clobber (reg:CC CC_REGNUM))
5017 (clobber (reg:SI GPR1_REGNUM))]
5021 (define_expand "extend<BFP:mode><DFP_ALL:mode>2"
5022 [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
5023 (set (reg:SI GPR0_REGNUM) (match_dup 2))
5025 [(set (reg:DFP_ALL FPR0_REGNUM)
5026 (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM)))
5027 (use (reg:SI GPR0_REGNUM))
5028 (clobber (reg:CC CC_REGNUM))
5029 (clobber (reg:SI GPR1_REGNUM))])
5030 (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "")
5031 (reg:DFP_ALL FPR0_REGNUM))]
5033 && GET_MODE_SIZE (<BFP:MODE>mode) <= GET_MODE_SIZE (<DFP_ALL:MODE>mode)"
5035 HOST_WIDE_INT flags;
5037 flags = (PFPO_CONVERT |
5038 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT |
5039 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT);
5041 operands[2] = GEN_INT (flags);
5044 (define_expand "extend<DFP_ALL:mode><BFP:mode>2"
5045 [(set (reg:DFP_ALL FPR4_REGNUM)
5046 (match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
5047 (set (reg:SI GPR0_REGNUM) (match_dup 2))
5049 [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM)))
5050 (use (reg:SI GPR0_REGNUM))
5051 (clobber (reg:CC CC_REGNUM))
5052 (clobber (reg:SI GPR1_REGNUM))])
5053 (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))]
5055 && GET_MODE_SIZE (<DFP_ALL:MODE>mode) < GET_MODE_SIZE (<BFP:MODE>mode)"
5057 HOST_WIDE_INT flags;
5059 flags = (PFPO_CONVERT |
5060 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT |
5061 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT);
5063 operands[2] = GEN_INT (flags);
5068 ;; ARITHMETIC OPERATIONS
5070 ; arithmetic operations set the ConditionCode,
5071 ; because of unpredictable Bits in Register for Halfword and Byte
5072 ; the ConditionCode can be set wrong in operations for Halfword and Byte
5075 ;;- Add instructions.
5079 ; addti3 instruction pattern(s).
5082 (define_expand "addti3"
5084 [(set (match_operand:TI 0 "register_operand" "")
5085 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "")
5086 (match_operand:TI 2 "general_operand" "") ) )
5087 (clobber (reg:CC CC_REGNUM))])]
5090 /* For z13 we have vaq which doesn't set CC. */
5093 emit_insn (gen_rtx_SET (operands[0],
5094 gen_rtx_PLUS (TImode,
5095 copy_to_mode_reg (TImode, operands[1]),
5096 copy_to_mode_reg (TImode, operands[2]))));
5101 (define_insn_and_split "*addti3"
5102 [(set (match_operand:TI 0 "register_operand" "=&d")
5103 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
5104 (match_operand:TI 2 "general_operand" "do") ) )
5105 (clobber (reg:CC CC_REGNUM))]
5108 "&& reload_completed"
5110 [(set (reg:CCL1 CC_REGNUM)
5111 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
5113 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
5115 [(set (match_dup 3) (plus:DI
5116 (plus:DI (ltu:DI (reg:CCL1 CC_REGNUM) (const_int 0))
5117 (match_dup 4)) (match_dup 5)))
5118 (clobber (reg:CC CC_REGNUM))])]
5119 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
5120 operands[4] = operand_subword (operands[1], 0, 0, TImode);
5121 operands[5] = operand_subword (operands[2], 0, 0, TImode);
5122 operands[6] = operand_subword (operands[0], 1, 0, TImode);
5123 operands[7] = operand_subword (operands[1], 1, 0, TImode);
5124 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
5125 [(set_attr "op_type" "*")
5126 (set_attr "cpu_facility" "*")])
5129 ; adddi3 instruction pattern(s).
5132 (define_expand "adddi3"
5134 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5135 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
5136 (match_operand:DI 2 "general_operand" "")))
5137 (clobber (reg:CC CC_REGNUM))])]
5141 (define_insn "*adddi3_sign"
5142 [(set (match_operand:DI 0 "register_operand" "=d,d")
5143 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5144 (match_operand:DI 1 "register_operand" "0,0")))
5145 (clobber (reg:CC CC_REGNUM))]
5150 [(set_attr "op_type" "RRE,RXY")
5151 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5153 (define_insn "*adddi3_zero_cc"
5154 [(set (reg CC_REGNUM)
5155 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5156 (match_operand:DI 1 "register_operand" "0,0"))
5158 (set (match_operand:DI 0 "register_operand" "=d,d")
5159 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
5160 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5164 [(set_attr "op_type" "RRE,RXY")
5165 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5167 (define_insn "*adddi3_zero_cconly"
5168 [(set (reg CC_REGNUM)
5169 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5170 (match_operand:DI 1 "register_operand" "0,0"))
5172 (clobber (match_scratch:DI 0 "=d,d"))]
5173 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5177 [(set_attr "op_type" "RRE,RXY")
5178 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5180 (define_insn "*adddi3_zero"
5181 [(set (match_operand:DI 0 "register_operand" "=d,d")
5182 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5183 (match_operand:DI 1 "register_operand" "0,0")))
5184 (clobber (reg:CC CC_REGNUM))]
5189 [(set_attr "op_type" "RRE,RXY")
5190 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5192 (define_insn_and_split "*adddi3_31z"
5193 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
5194 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5195 (match_operand:DI 2 "general_operand" "do") ) )
5196 (clobber (reg:CC CC_REGNUM))]
5197 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
5199 "&& reload_completed"
5201 [(set (reg:CCL1 CC_REGNUM)
5202 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
5204 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
5206 [(set (match_dup 3) (plus:SI
5207 (plus:SI (ltu:SI (reg:CCL1 CC_REGNUM) (const_int 0))
5208 (match_dup 4)) (match_dup 5)))
5209 (clobber (reg:CC CC_REGNUM))])]
5210 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5211 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5212 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5213 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5214 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5215 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
5217 (define_insn_and_split "*adddi3_31"
5218 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
5219 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5220 (match_operand:DI 2 "general_operand" "do") ) )
5221 (clobber (reg:CC CC_REGNUM))]
5224 "&& reload_completed"
5226 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
5227 (clobber (reg:CC CC_REGNUM))])
5229 [(set (reg:CCL1 CC_REGNUM)
5230 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
5232 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
5234 (if_then_else (ltu (reg:CCL1 CC_REGNUM) (const_int 0))
5236 (label_ref (match_dup 9))))
5238 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
5239 (clobber (reg:CC CC_REGNUM))])
5241 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5242 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5243 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5244 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5245 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5246 operands[8] = operand_subword (operands[2], 1, 0, DImode);
5247 operands[9] = gen_label_rtx ();")
5250 ; addsi3 instruction pattern(s).
5253 (define_expand "addsi3"
5255 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5256 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "")
5257 (match_operand:SI 2 "general_operand" "")))
5258 (clobber (reg:CC CC_REGNUM))])]
5262 (define_insn "*addsi3_sign"
5263 [(set (match_operand:SI 0 "register_operand" "=d,d")
5264 (plus:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
5265 (match_operand:SI 1 "register_operand" "0,0")))
5266 (clobber (reg:CC CC_REGNUM))]
5271 [(set_attr "op_type" "RX,RXY")
5272 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5275 ; add(di|si)3 instruction pattern(s).
5278 ; ark, agrk, ar, ahi, ahik, aghik, alfi, slfi, a, ay, agr, aghi, algfi, slgfi, ag, asi, agsi
5279 (define_insn "*add<mode>3"
5280 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d,d,d, d, d,d,d,QS")
5281 (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,d, 0, 0,0,0, 0")
5282 (match_operand:GPR 2 "general_operand" " d,d,K,K,Op,On,R,T, C") ) )
5283 (clobber (reg:CC CC_REGNUM))]
5295 [(set_attr "op_type" "RR<E>,RRF,RI,RIE,RIL,RIL,RX<Y>,RXY,SIY")
5296 (set_attr "cpu_facility" "*,z196,*,z196,extimm,extimm,*,*,z10")
5297 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,z10_super_E1,z10_super_E1,
5298 z10_super_E1,z10_super_E1,z10_super_E1")])
5300 ; alr, alfi, slfi, al, aly, alrk, alhsik, algr, algfi, slgfi, alg, alsi, algsi, algrk, alghsik
5301 (define_insn "*add<mode>3_carry1_cc"
5302 [(set (reg CC_REGNUM)
5303 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0,0")
5304 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T,C"))
5306 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,d")
5307 (plus:GPR (match_dup 1) (match_dup 2)))]
5308 "s390_match_ccmode (insn, CCL1mode)"
5314 al<g>hsik\t%0,%1,%h2
5318 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5319 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5320 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*,
5321 z10_super_E1,z10_super_E1,z10_super_E1")])
5323 ; alr, al, aly, algr, alg, alrk, algrk
5324 (define_insn "*add<mode>3_carry1_cconly"
5325 [(set (reg CC_REGNUM)
5326 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5327 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5329 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5330 "s390_match_ccmode (insn, CCL1mode)"
5336 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5337 (set_attr "cpu_facility" "*,z196,*,*")
5338 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5340 ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik
5341 (define_insn "*add<mode>3_carry2_cc"
5342 [(set (reg CC_REGNUM)
5343 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0, 0")
5344 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T, C"))
5346 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,RS")
5347 (plus:GPR (match_dup 1) (match_dup 2)))]
5348 "s390_match_ccmode (insn, CCL1mode)"
5354 al<g>hsik\t%0,%1,%h2
5358 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5359 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5360 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*,
5361 z10_super_E1,z10_super_E1,z10_super_E1")])
5363 ; alr, al, aly, algr, alg, alrk, algrk
5364 (define_insn "*add<mode>3_carry2_cconly"
5365 [(set (reg CC_REGNUM)
5366 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5367 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5369 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5370 "s390_match_ccmode (insn, CCL1mode)"
5376 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5377 (set_attr "cpu_facility" "*,z196,*,*")
5378 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5380 ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik
5381 (define_insn "*add<mode>3_cc"
5382 [(set (reg CC_REGNUM)
5383 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0, 0")
5384 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T, C"))
5386 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,RS")
5387 (plus:GPR (match_dup 1) (match_dup 2)))]
5388 "s390_match_ccmode (insn, CCLmode)"
5394 al<g>hsik\t%0,%1,%h2
5398 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5399 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5400 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,
5401 *,z10_super_E1,z10_super_E1,z10_super_E1")])
5403 ; alr, al, aly, algr, alg, alrk, algrk
5404 (define_insn "*add<mode>3_cconly"
5405 [(set (reg CC_REGNUM)
5406 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5407 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5409 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5410 "s390_match_ccmode (insn, CCLmode)"
5416 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5417 (set_attr "cpu_facility" "*,z196,*,*")
5418 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5420 ; alr, al, aly, algr, alg, alrk, algrk
5421 (define_insn "*add<mode>3_cconly2"
5422 [(set (reg CC_REGNUM)
5423 (compare (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5424 (neg:GPR (match_operand:GPR 2 "general_operand" "d,d,R,T"))))
5425 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5426 "s390_match_ccmode(insn, CCLmode)"
5432 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5433 (set_attr "cpu_facility" "*,z196,*,*")
5434 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5436 ; ahi, afi, aghi, agfi, asi, agsi
5437 (define_insn "*add<mode>3_imm_cc"
5438 [(set (reg CC_REGNUM)
5439 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" " 0, d,0, 0")
5440 (match_operand:GPR 2 "const_int_operand" " K, K,Os, C"))
5442 (set (match_operand:GPR 0 "nonimmediate_operand" "=d, d,d,QS")
5443 (plus:GPR (match_dup 1) (match_dup 2)))]
5444 "s390_match_ccmode (insn, CCAmode)
5445 && (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")
5446 || (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'O', \"Os\")
5447 /* Avoid INT32_MIN on 32 bit. */
5448 && (!TARGET_ZARCH || INTVAL (operands[2]) != -0x7fffffff - 1)))"
5454 [(set_attr "op_type" "RI,RIE,RIL,SIY")
5455 (set_attr "cpu_facility" "*,z196,extimm,z10")
5456 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5459 ; add(tf|df|sf|td|dd)3 instruction pattern(s).
5462 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5463 ; FIXME: wfadb does not clobber cc
5464 (define_insn "add<mode>3"
5465 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
5466 (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>, 0,<v0>")
5467 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))
5468 (clobber (reg:CC CC_REGNUM))]
5471 a<xde><bt>r\t%0,<op1>%2
5474 [(set_attr "op_type" "<RRer>,RXE,VRR")
5475 (set_attr "type" "fsimp<mode>")
5476 (set_attr "cpu_facility" "*,*,vec")])
5478 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5479 (define_insn "*add<mode>3_cc"
5480 [(set (reg CC_REGNUM)
5481 (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
5482 (match_operand:FP 2 "general_operand" " f,<Rf>"))
5483 (match_operand:FP 3 "const0_operand" "")))
5484 (set (match_operand:FP 0 "register_operand" "=f,f")
5485 (plus:FP (match_dup 1) (match_dup 2)))]
5486 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5488 a<xde><bt>r\t%0,<op1>%2
5490 [(set_attr "op_type" "<RRer>,RXE")
5491 (set_attr "type" "fsimp<mode>")])
5493 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5494 (define_insn "*add<mode>3_cconly"
5495 [(set (reg CC_REGNUM)
5496 (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
5497 (match_operand:FP 2 "general_operand" " f,<Rf>"))
5498 (match_operand:FP 3 "const0_operand" "")))
5499 (clobber (match_scratch:FP 0 "=f,f"))]
5500 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5502 a<xde><bt>r\t%0,<op1>%2
5504 [(set_attr "op_type" "<RRer>,RXE")
5505 (set_attr "type" "fsimp<mode>")])
5508 ; Pointer add instruction patterns
5511 ; This will match "*la_64"
5512 (define_expand "addptrdi3"
5513 [(set (match_operand:DI 0 "register_operand" "")
5514 (plus:DI (match_operand:DI 1 "register_operand" "")
5515 (match_operand:DI 2 "nonmemory_operand" "")))]
5518 if (GET_CODE (operands[2]) == CONST_INT)
5520 HOST_WIDE_INT c = INTVAL (operands[2]);
5522 if (!CONST_OK_FOR_CONSTRAINT_P (c, 'K', "K")
5523 && !CONST_OK_FOR_CONSTRAINT_P (c, 'O', "Os"))
5525 operands[2] = force_const_mem (DImode, operands[2]);
5526 operands[2] = force_reg (DImode, operands[2]);
5528 else if (!DISP_IN_RANGE (INTVAL (operands[2])))
5529 operands[2] = force_reg (DImode, operands[2]);
5533 ; For 31 bit we have to prevent the generated pattern from matching
5534 ; normal ADDs since la only does a 31 bit add. This is supposed to
5535 ; match "force_la_31".
5536 (define_expand "addptrsi3"
5538 [(set (match_operand:SI 0 "register_operand" "")
5539 (plus:SI (match_operand:SI 1 "register_operand" "")
5540 (match_operand:SI 2 "nonmemory_operand" "")))
5541 (use (const_int 0))])]
5544 if (GET_CODE (operands[2]) == CONST_INT)
5546 HOST_WIDE_INT c = INTVAL (operands[2]);
5548 if (!CONST_OK_FOR_CONSTRAINT_P (c, 'K', "K")
5549 && !CONST_OK_FOR_CONSTRAINT_P (c, 'O', "Os"))
5551 operands[2] = force_const_mem (SImode, operands[2]);
5552 operands[2] = force_reg (SImode, operands[2]);
5554 else if (!DISP_IN_RANGE (INTVAL (operands[2])))
5555 operands[2] = force_reg (SImode, operands[2]);
5560 ;;- Subtract instructions.
5564 ; subti3 instruction pattern(s).
5567 (define_expand "subti3"
5569 [(set (match_operand:TI 0 "register_operand" "")
5570 (minus:TI (match_operand:TI 1 "register_operand" "")
5571 (match_operand:TI 2 "general_operand" "") ) )
5572 (clobber (reg:CC CC_REGNUM))])]
5575 /* For z13 we have vaq which doesn't set CC. */
5578 emit_insn (gen_rtx_SET (operands[0],
5579 gen_rtx_MINUS (TImode,
5581 copy_to_mode_reg (TImode, operands[2]))));
5586 (define_insn_and_split "*subti3"
5587 [(set (match_operand:TI 0 "register_operand" "=&d")
5588 (minus:TI (match_operand:TI 1 "register_operand" "0")
5589 (match_operand:TI 2 "general_operand" "do") ) )
5590 (clobber (reg:CC CC_REGNUM))]
5593 "&& reload_completed"
5595 [(set (reg:CCL2 CC_REGNUM)
5596 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
5598 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
5600 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
5601 (gtu:DI (reg:CCL2 CC_REGNUM) (const_int 0))))
5602 (clobber (reg:CC CC_REGNUM))])]
5603 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
5604 operands[4] = operand_subword (operands[1], 0, 0, TImode);
5605 operands[5] = operand_subword (operands[2], 0, 0, TImode);
5606 operands[6] = operand_subword (operands[0], 1, 0, TImode);
5607 operands[7] = operand_subword (operands[1], 1, 0, TImode);
5608 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
5609 [(set_attr "op_type" "*")
5610 (set_attr "cpu_facility" "*")])
5613 ; subdi3 instruction pattern(s).
5616 (define_expand "subdi3"
5618 [(set (match_operand:DI 0 "register_operand" "")
5619 (minus:DI (match_operand:DI 1 "register_operand" "")
5620 (match_operand:DI 2 "general_operand" "")))
5621 (clobber (reg:CC CC_REGNUM))])]
5625 (define_insn "*subdi3_sign"
5626 [(set (match_operand:DI 0 "register_operand" "=d,d")
5627 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5628 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))))
5629 (clobber (reg:CC CC_REGNUM))]
5634 [(set_attr "op_type" "RRE,RXY")
5635 (set_attr "z10prop" "z10_c,*")
5636 (set_attr "z196prop" "z196_cracked")])
5638 (define_insn "*subdi3_zero_cc"
5639 [(set (reg CC_REGNUM)
5640 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5641 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT")))
5643 (set (match_operand:DI 0 "register_operand" "=d,d")
5644 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
5645 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5649 [(set_attr "op_type" "RRE,RXY")
5650 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5652 (define_insn "*subdi3_zero_cconly"
5653 [(set (reg CC_REGNUM)
5654 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5655 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT")))
5657 (clobber (match_scratch:DI 0 "=d,d"))]
5658 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5662 [(set_attr "op_type" "RRE,RXY")
5663 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5665 (define_insn "*subdi3_zero"
5666 [(set (match_operand:DI 0 "register_operand" "=d,d")
5667 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5668 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))))
5669 (clobber (reg:CC CC_REGNUM))]
5674 [(set_attr "op_type" "RRE,RXY")
5675 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5677 (define_insn_and_split "*subdi3_31z"
5678 [(set (match_operand:DI 0 "register_operand" "=&d")
5679 (minus:DI (match_operand:DI 1 "register_operand" "0")
5680 (match_operand:DI 2 "general_operand" "do") ) )
5681 (clobber (reg:CC CC_REGNUM))]
5682 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
5684 "&& reload_completed"
5686 [(set (reg:CCL2 CC_REGNUM)
5687 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
5689 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
5691 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
5692 (gtu:SI (reg:CCL2 CC_REGNUM) (const_int 0))))
5693 (clobber (reg:CC CC_REGNUM))])]
5694 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5695 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5696 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5697 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5698 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5699 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
5701 (define_insn_and_split "*subdi3_31"
5702 [(set (match_operand:DI 0 "register_operand" "=&d")
5703 (minus:DI (match_operand:DI 1 "register_operand" "0")
5704 (match_operand:DI 2 "general_operand" "do") ) )
5705 (clobber (reg:CC CC_REGNUM))]
5708 "&& reload_completed"
5710 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
5711 (clobber (reg:CC CC_REGNUM))])
5713 [(set (reg:CCL2 CC_REGNUM)
5714 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
5716 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
5718 (if_then_else (gtu (reg:CCL2 CC_REGNUM) (const_int 0))
5720 (label_ref (match_dup 9))))
5722 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
5723 (clobber (reg:CC CC_REGNUM))])
5725 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5726 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5727 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5728 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5729 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5730 operands[8] = operand_subword (operands[2], 1, 0, DImode);
5731 operands[9] = gen_label_rtx ();")
5734 ; subsi3 instruction pattern(s).
5737 (define_expand "subsi3"
5739 [(set (match_operand:SI 0 "register_operand" "")
5740 (minus:SI (match_operand:SI 1 "register_operand" "")
5741 (match_operand:SI 2 "general_operand" "")))
5742 (clobber (reg:CC CC_REGNUM))])]
5746 (define_insn "*subsi3_sign"
5747 [(set (match_operand:SI 0 "register_operand" "=d,d")
5748 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
5749 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
5750 (clobber (reg:CC CC_REGNUM))]
5755 [(set_attr "op_type" "RX,RXY")
5756 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5759 ; sub(di|si)3 instruction pattern(s).
5762 ; sr, s, sy, sgr, sg, srk, sgrk
5763 (define_insn "*sub<mode>3"
5764 [(set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5765 (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5766 (match_operand:GPR 2 "general_operand" "d,d,R,T") ) )
5767 (clobber (reg:CC CC_REGNUM))]
5774 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5775 (set_attr "cpu_facility" "*,z196,*,*")
5776 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5778 ; slr, sl, sly, slgr, slg, slrk, slgrk
5779 (define_insn "*sub<mode>3_borrow_cc"
5780 [(set (reg CC_REGNUM)
5781 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5782 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5784 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5785 (minus:GPR (match_dup 1) (match_dup 2)))]
5786 "s390_match_ccmode (insn, CCL2mode)"
5792 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5793 (set_attr "cpu_facility" "*,z196,*,*")
5794 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5796 ; slr, sl, sly, slgr, slg, slrk, slgrk
5797 (define_insn "*sub<mode>3_borrow_cconly"
5798 [(set (reg CC_REGNUM)
5799 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5800 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5802 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5803 "s390_match_ccmode (insn, CCL2mode)"
5809 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5810 (set_attr "cpu_facility" "*,z196,*,*")
5811 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5813 ; slr, sl, sly, slgr, slg, slrk, slgrk
5814 (define_insn "*sub<mode>3_cc"
5815 [(set (reg CC_REGNUM)
5816 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5817 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5819 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5820 (minus:GPR (match_dup 1) (match_dup 2)))]
5821 "s390_match_ccmode (insn, CCLmode)"
5827 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5828 (set_attr "cpu_facility" "*,z196,*,*")
5829 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5831 ; slr, sl, sly, slgr, slg, slrk, slgrk
5832 (define_insn "*sub<mode>3_cc2"
5833 [(set (reg CC_REGNUM)
5834 (compare (match_operand:GPR 1 "register_operand" "0,d,0,0")
5835 (match_operand:GPR 2 "general_operand" "d,d,R,T")))
5836 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5837 (minus:GPR (match_dup 1) (match_dup 2)))]
5838 "s390_match_ccmode (insn, CCL3mode)"
5844 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5845 (set_attr "cpu_facility" "*,z196,*,*")
5846 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5848 ; slr, sl, sly, slgr, slg, slrk, slgrk
5849 (define_insn "*sub<mode>3_cconly"
5850 [(set (reg CC_REGNUM)
5851 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5852 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5854 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5855 "s390_match_ccmode (insn, CCLmode)"
5861 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5862 (set_attr "cpu_facility" "*,z196,*,*")
5863 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5866 ; slr, sl, sly, slgr, slg, slrk, slgrk
5867 (define_insn "*sub<mode>3_cconly2"
5868 [(set (reg CC_REGNUM)
5869 (compare (match_operand:GPR 1 "register_operand" "0,d,0,0")
5870 (match_operand:GPR 2 "general_operand" "d,d,R,T")))
5871 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5872 "s390_match_ccmode (insn, CCL3mode)"
5878 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5879 (set_attr "cpu_facility" "*,z196,*,*")
5880 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5884 ; sub(tf|df|sf|td|dd)3 instruction pattern(s).
5887 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5888 (define_insn "sub<mode>3"
5889 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
5890 (minus:FP (match_operand:FP 1 "register_operand" "<f0>, 0,<v0>")
5891 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))
5892 (clobber (reg:CC CC_REGNUM))]
5895 s<xde><bt>r\t%0,<op1>%2
5898 [(set_attr "op_type" "<RRer>,RXE,VRR")
5899 (set_attr "type" "fsimp<mode>")
5900 (set_attr "cpu_facility" "*,*,vec")])
5902 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5903 (define_insn "*sub<mode>3_cc"
5904 [(set (reg CC_REGNUM)
5905 (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "<f0>,0")
5906 (match_operand:FP 2 "general_operand" "f,<Rf>"))
5907 (match_operand:FP 3 "const0_operand" "")))
5908 (set (match_operand:FP 0 "register_operand" "=f,f")
5909 (minus:FP (match_dup 1) (match_dup 2)))]
5910 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5912 s<xde><bt>r\t%0,<op1>%2
5914 [(set_attr "op_type" "<RRer>,RXE")
5915 (set_attr "type" "fsimp<mode>")])
5917 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5918 (define_insn "*sub<mode>3_cconly"
5919 [(set (reg CC_REGNUM)
5920 (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "<f0>,0")
5921 (match_operand:FP 2 "general_operand" "f,<Rf>"))
5922 (match_operand:FP 3 "const0_operand" "")))
5923 (clobber (match_scratch:FP 0 "=f,f"))]
5924 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5926 s<xde><bt>r\t%0,<op1>%2
5928 [(set_attr "op_type" "<RRer>,RXE")
5929 (set_attr "type" "fsimp<mode>")])
5933 ;;- Conditional add/subtract instructions.
5937 ; add(di|si)cc instruction pattern(s).
5940 ; the following 4 patterns are used when the result of an add with
5941 ; carry is checked for an overflow condition
5943 ; op1 + op2 + c < op1
5945 ; alcr, alc, alcgr, alcg
5946 (define_insn "*add<mode>3_alc_carry1_cc"
5947 [(set (reg CC_REGNUM)
5949 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5950 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5951 (match_operand:GPR 2 "general_operand" "d,RT"))
5953 (set (match_operand:GPR 0 "register_operand" "=d,d")
5954 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5955 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5959 [(set_attr "op_type" "RRE,RXY")
5960 (set_attr "z196prop" "z196_alone,z196_alone")])
5962 ; alcr, alc, alcgr, alcg
5963 (define_insn "*add<mode>3_alc_carry1_cconly"
5964 [(set (reg CC_REGNUM)
5966 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5967 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5968 (match_operand:GPR 2 "general_operand" "d,RT"))
5970 (clobber (match_scratch:GPR 0 "=d,d"))]
5971 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5975 [(set_attr "op_type" "RRE,RXY")
5976 (set_attr "z196prop" "z196_alone,z196_alone")])
5978 ; op1 + op2 + c < op2
5980 ; alcr, alc, alcgr, alcg
5981 (define_insn "*add<mode>3_alc_carry2_cc"
5982 [(set (reg CC_REGNUM)
5984 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5985 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5986 (match_operand:GPR 2 "general_operand" "d,RT"))
5988 (set (match_operand:GPR 0 "register_operand" "=d,d")
5989 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5990 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5994 [(set_attr "op_type" "RRE,RXY")])
5996 ; alcr, alc, alcgr, alcg
5997 (define_insn "*add<mode>3_alc_carry2_cconly"
5998 [(set (reg CC_REGNUM)
6000 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
6001 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
6002 (match_operand:GPR 2 "general_operand" "d,RT"))
6004 (clobber (match_scratch:GPR 0 "=d,d"))]
6005 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
6009 [(set_attr "op_type" "RRE,RXY")])
6011 ; alcr, alc, alcgr, alcg
6012 (define_insn "*add<mode>3_alc_cc"
6013 [(set (reg CC_REGNUM)
6015 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
6016 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
6017 (match_operand:GPR 2 "general_operand" "d,RT"))
6019 (set (match_operand:GPR 0 "register_operand" "=d,d")
6020 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
6021 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
6025 [(set_attr "op_type" "RRE,RXY")])
6027 ; alcr, alc, alcgr, alcg
6028 (define_insn "*add<mode>3_alc"
6029 [(set (match_operand:GPR 0 "register_operand" "=d,d")
6030 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
6031 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
6032 (match_operand:GPR 2 "general_operand" "d,RT")))
6033 (clobber (reg:CC CC_REGNUM))]
6038 [(set_attr "op_type" "RRE,RXY")])
6040 ; slbr, slb, slbgr, slbg
6041 (define_insn "*sub<mode>3_slb_cc"
6042 [(set (reg CC_REGNUM)
6044 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
6045 (match_operand:GPR 2 "general_operand" "d,RT"))
6046 (match_operand:GPR 3 "s390_slb_comparison" ""))
6048 (set (match_operand:GPR 0 "register_operand" "=d,d")
6049 (minus:GPR (minus:GPR (match_dup 1) (match_dup 2)) (match_dup 3)))]
6050 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
6054 [(set_attr "op_type" "RRE,RXY")
6055 (set_attr "z10prop" "z10_c,*")])
6057 ; slbr, slb, slbgr, slbg
6058 (define_insn "*sub<mode>3_slb"
6059 [(set (match_operand:GPR 0 "register_operand" "=d,d")
6060 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
6061 (match_operand:GPR 2 "general_operand" "d,RT"))
6062 (match_operand:GPR 3 "s390_slb_comparison" "")))
6063 (clobber (reg:CC CC_REGNUM))]
6068 [(set_attr "op_type" "RRE,RXY")
6069 (set_attr "z10prop" "z10_c,*")])
6071 (define_expand "add<mode>cc"
6072 [(match_operand:GPR 0 "register_operand" "")
6073 (match_operand 1 "comparison_operator" "")
6074 (match_operand:GPR 2 "register_operand" "")
6075 (match_operand:GPR 3 "const_int_operand" "")]
6077 "if (!s390_expand_addcc (GET_CODE (operands[1]),
6078 XEXP (operands[1], 0), XEXP (operands[1], 1),
6079 operands[0], operands[2],
6080 operands[3])) FAIL; DONE;")
6083 ; scond instruction pattern(s).
6086 (define_insn_and_split "*scond<mode>"
6087 [(set (match_operand:GPR 0 "register_operand" "=&d")
6088 (match_operand:GPR 1 "s390_alc_comparison" ""))
6089 (clobber (reg:CC CC_REGNUM))]
6092 "&& reload_completed"
6093 [(set (match_dup 0) (const_int 0))
6095 [(set (match_dup 0) (plus:GPR (plus:GPR (match_dup 1) (match_dup 0))
6097 (clobber (reg:CC CC_REGNUM))])]
6100 (define_insn_and_split "*scond<mode>_neg"
6101 [(set (match_operand:GPR 0 "register_operand" "=&d")
6102 (match_operand:GPR 1 "s390_slb_comparison" ""))
6103 (clobber (reg:CC CC_REGNUM))]
6106 "&& reload_completed"
6107 [(set (match_dup 0) (const_int 0))
6109 [(set (match_dup 0) (minus:GPR (minus:GPR (match_dup 0) (match_dup 0))
6111 (clobber (reg:CC CC_REGNUM))])
6113 [(set (match_dup 0) (neg:GPR (match_dup 0)))
6114 (clobber (reg:CC CC_REGNUM))])]
6118 (define_expand "cstore<mode>4"
6119 [(set (match_operand:SI 0 "register_operand" "")
6120 (match_operator:SI 1 "s390_scond_operator"
6121 [(match_operand:GPR 2 "register_operand" "")
6122 (match_operand:GPR 3 "general_operand" "")]))]
6124 "if (!s390_expand_addcc (GET_CODE (operands[1]), operands[2], operands[3],
6125 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
6127 (define_expand "cstorecc4"
6129 [(set (match_operand:SI 0 "register_operand" "")
6130 (match_operator:SI 1 "s390_eqne_operator"
6131 [(match_operand:CCZ1 2 "register_operand")
6132 (match_operand 3 "const0_operand")]))
6133 (clobber (reg:CC CC_REGNUM))])]
6135 "emit_insn (gen_sne (operands[0], operands[2]));
6136 if (GET_CODE (operands[1]) == EQ)
6137 emit_insn (gen_xorsi3 (operands[0], operands[0], const1_rtx));
6140 (define_insn_and_split "sne"
6141 [(set (match_operand:SI 0 "register_operand" "=d")
6142 (ne:SI (match_operand:CCZ1 1 "register_operand" "0")
6144 (clobber (reg:CC CC_REGNUM))]
6149 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 28)))
6150 (clobber (reg:CC CC_REGNUM))])])
6154 ;; - Conditional move instructions (introduced with z196)
6157 (define_expand "mov<mode>cc"
6158 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
6159 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6160 (match_operand:GPR 2 "nonimmediate_operand" "")
6161 (match_operand:GPR 3 "nonimmediate_operand" "")))]
6164 /* Emit the comparison insn in case we do not already have a comparison result. */
6165 if (!s390_comparison (operands[1], VOIDmode))
6166 operands[1] = s390_emit_compare (GET_CODE (operands[1]),
6167 XEXP (operands[1], 0),
6168 XEXP (operands[1], 1));
6171 ; locr, loc, stoc, locgr, locg, stocg
6172 (define_insn_and_split "*mov<mode>cc"
6173 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,QS,QS,&d")
6175 (match_operator 1 "s390_comparison"
6176 [(match_operand 2 "cc_reg_operand" " c,c, c, c, c, c, c")
6177 (match_operand 5 "const_int_operand" "")])
6178 (match_operand:GPR 3 "nonimmediate_operand" " d,0,QS, 0, d, 0,QS")
6179 (match_operand:GPR 4 "nonimmediate_operand" " 0,d, 0,QS, 0, d,QS")))]
6189 "&& reload_completed
6190 && MEM_P (operands[3]) && MEM_P (operands[4])"
6193 (match_op_dup 1 [(match_dup 2) (const_int 0)])
6198 (match_op_dup 1 [(match_dup 2) (const_int 0)])
6202 [(set_attr "op_type" "RRF,RRF,RSY,RSY,RSY,RSY,*")])
6205 ;;- Multiply instructions.
6209 ; muldi3 instruction pattern(s).
6212 (define_insn "*muldi3_sign"
6213 [(set (match_operand:DI 0 "register_operand" "=d,d")
6214 (mult:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
6215 (match_operand:DI 1 "register_operand" "0,0")))]
6220 [(set_attr "op_type" "RRE,RXY")
6221 (set_attr "type" "imuldi")])
6223 (define_insn "muldi3"
6224 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d")
6225 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
6226 (match_operand:DI 2 "general_operand" "d,K,RT,Os")))]
6233 [(set_attr "op_type" "RRE,RI,RXY,RIL")
6234 (set_attr "type" "imuldi")
6235 (set_attr "cpu_facility" "*,*,*,z10")])
6238 ; mulsi3 instruction pattern(s).
6241 (define_insn "*mulsi3_sign"
6242 [(set (match_operand:SI 0 "register_operand" "=d,d")
6243 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
6244 (match_operand:SI 1 "register_operand" "0,0")))]
6249 [(set_attr "op_type" "RX,RXY")
6250 (set_attr "type" "imulhi")
6251 (set_attr "cpu_facility" "*,z10")])
6253 (define_insn "mulsi3"
6254 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
6255 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0")
6256 (match_operand:SI 2 "general_operand" "d,K,R,T,Os")))]
6264 [(set_attr "op_type" "RRE,RI,RX,RXY,RIL")
6265 (set_attr "type" "imulsi,imulhi,imulsi,imulsi,imulsi")
6266 (set_attr "cpu_facility" "*,*,*,*,z10")])
6269 ; mulsidi3 instruction pattern(s).
6272 (define_insn "mulsidi3"
6273 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
6274 (mult:DI (sign_extend:DI
6275 (match_operand:SI 1 "register_operand" "%0,0,0"))
6277 (match_operand:SI 2 "nonimmediate_operand" "d,R,T"))))]
6283 [(set_attr "op_type" "RR,RX,RXY")
6284 (set_attr "type" "imulsi")
6285 (set_attr "cpu_facility" "*,*,z10")])
6288 ; umul instruction pattern(s).
6291 ; mlr, ml, mlgr, mlg
6292 (define_insn "umul<dwh><mode>3"
6293 [(set (match_operand:DW 0 "register_operand" "=d, d")
6294 (mult:DW (zero_extend:DW
6295 (match_operand:<DWH> 1 "register_operand" "%0, 0"))
6297 (match_operand:<DWH> 2 "nonimmediate_operand" " d,RT"))))]
6302 [(set_attr "op_type" "RRE,RXY")
6303 (set_attr "type" "imul<dwh>")])
6306 ; mul(tf|df|sf|td|dd)3 instruction pattern(s).
6309 ; mxbr, mdbr, meebr, mxb, mxb, meeb, mdtr, mxtr
6310 (define_insn "mul<mode>3"
6311 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
6312 (mult:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>, 0,<v0>")
6313 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))]
6316 m<xdee><bt>r\t%0,<op1>%2
6319 [(set_attr "op_type" "<RRer>,RXE,VRR")
6320 (set_attr "type" "fmul<mode>")
6321 (set_attr "cpu_facility" "*,*,vec")])
6323 ; madbr, maebr, maxb, madb, maeb
6324 (define_insn "fma<mode>4"
6325 [(set (match_operand:DSF 0 "register_operand" "=f,f,<vf>")
6326 (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,<vf>")
6327 (match_operand:DSF 2 "nonimmediate_operand" "f,R,<vf>")
6328 (match_operand:DSF 3 "register_operand" "0,0,<v0>")))]
6333 wfmadb\t%v0,%v1,%v2,%v3"
6334 [(set_attr "op_type" "RRE,RXE,VRR")
6335 (set_attr "type" "fmadd<mode>")
6336 (set_attr "cpu_facility" "*,*,vec")])
6338 ; msxbr, msdbr, msebr, msxb, msdb, mseb
6339 (define_insn "fms<mode>4"
6340 [(set (match_operand:DSF 0 "register_operand" "=f,f,<vf>")
6341 (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,<vf>")
6342 (match_operand:DSF 2 "nonimmediate_operand" "f,R,<vf>")
6343 (neg:DSF (match_operand:DSF 3 "register_operand" "0,0,<v0>"))))]
6348 wfmsdb\t%v0,%v1,%v2,%v3"
6349 [(set_attr "op_type" "RRE,RXE,VRR")
6350 (set_attr "type" "fmadd<mode>")
6351 (set_attr "cpu_facility" "*,*,vec")])
6354 ;;- Divide and modulo instructions.
6358 ; divmoddi4 instruction pattern(s).
6361 (define_expand "divmoddi4"
6362 [(parallel [(set (match_operand:DI 0 "general_operand" "")
6363 (div:DI (match_operand:DI 1 "register_operand" "")
6364 (match_operand:DI 2 "general_operand" "")))
6365 (set (match_operand:DI 3 "general_operand" "")
6366 (mod:DI (match_dup 1) (match_dup 2)))])
6367 (clobber (match_dup 4))]
6370 rtx insn, div_equal, mod_equal;
6372 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
6373 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
6375 operands[4] = gen_reg_rtx(TImode);
6376 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
6378 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
6379 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6381 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
6382 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6387 (define_insn "divmodtidi3"
6388 [(set (match_operand:TI 0 "register_operand" "=d,d")
6392 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6393 (match_operand:DI 2 "general_operand" "d,RT")))
6395 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
6400 [(set_attr "op_type" "RRE,RXY")
6401 (set_attr "type" "idiv")])
6403 (define_insn "divmodtisi3"
6404 [(set (match_operand:TI 0 "register_operand" "=d,d")
6408 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6410 (match_operand:SI 2 "nonimmediate_operand" "d,RT"))))
6413 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
6418 [(set_attr "op_type" "RRE,RXY")
6419 (set_attr "type" "idiv")])
6422 ; udivmoddi4 instruction pattern(s).
6425 (define_expand "udivmoddi4"
6426 [(parallel [(set (match_operand:DI 0 "general_operand" "")
6427 (udiv:DI (match_operand:DI 1 "general_operand" "")
6428 (match_operand:DI 2 "nonimmediate_operand" "")))
6429 (set (match_operand:DI 3 "general_operand" "")
6430 (umod:DI (match_dup 1) (match_dup 2)))])
6431 (clobber (match_dup 4))]
6434 rtx insn, div_equal, mod_equal, equal;
6436 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
6437 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
6438 equal = gen_rtx_IOR (TImode,
6439 gen_rtx_ASHIFT (TImode,
6440 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
6442 gen_rtx_ZERO_EXTEND (TImode, div_equal));
6444 operands[4] = gen_reg_rtx(TImode);
6445 emit_clobber (operands[4]);
6446 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
6447 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
6449 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
6450 set_unique_reg_note (insn, REG_EQUAL, equal);
6452 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
6453 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6455 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
6456 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6461 (define_insn "udivmodtidi3"
6462 [(set (match_operand:TI 0 "register_operand" "=d,d")
6467 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
6469 (match_operand:DI 2 "nonimmediate_operand" "d,RT")))))
6473 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
6478 [(set_attr "op_type" "RRE,RXY")
6479 (set_attr "type" "idiv")])
6482 ; divmodsi4 instruction pattern(s).
6485 (define_expand "divmodsi4"
6486 [(parallel [(set (match_operand:SI 0 "general_operand" "")
6487 (div:SI (match_operand:SI 1 "general_operand" "")
6488 (match_operand:SI 2 "nonimmediate_operand" "")))
6489 (set (match_operand:SI 3 "general_operand" "")
6490 (mod:SI (match_dup 1) (match_dup 2)))])
6491 (clobber (match_dup 4))]
6494 rtx insn, div_equal, mod_equal, equal;
6496 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
6497 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
6498 equal = gen_rtx_IOR (DImode,
6499 gen_rtx_ASHIFT (DImode,
6500 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
6502 gen_rtx_ZERO_EXTEND (DImode, div_equal));
6504 operands[4] = gen_reg_rtx(DImode);
6505 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
6507 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
6508 set_unique_reg_note (insn, REG_EQUAL, equal);
6510 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
6511 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6513 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
6514 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6519 (define_insn "divmoddisi3"
6520 [(set (match_operand:DI 0 "register_operand" "=d,d")
6525 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6527 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
6531 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
6536 [(set_attr "op_type" "RR,RX")
6537 (set_attr "type" "idiv")])
6540 ; udivsi3 and umodsi3 instruction pattern(s).
6543 (define_expand "udivmodsi4"
6544 [(parallel [(set (match_operand:SI 0 "general_operand" "")
6545 (udiv:SI (match_operand:SI 1 "general_operand" "")
6546 (match_operand:SI 2 "nonimmediate_operand" "")))
6547 (set (match_operand:SI 3 "general_operand" "")
6548 (umod:SI (match_dup 1) (match_dup 2)))])
6549 (clobber (match_dup 4))]
6550 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
6552 rtx insn, div_equal, mod_equal, equal;
6554 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6555 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6556 equal = gen_rtx_IOR (DImode,
6557 gen_rtx_ASHIFT (DImode,
6558 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
6560 gen_rtx_ZERO_EXTEND (DImode, div_equal));
6562 operands[4] = gen_reg_rtx(DImode);
6563 emit_clobber (operands[4]);
6564 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
6565 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
6567 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
6568 set_unique_reg_note (insn, REG_EQUAL, equal);
6570 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
6571 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6573 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
6574 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6579 (define_insn "udivmoddisi3"
6580 [(set (match_operand:DI 0 "register_operand" "=d,d")
6585 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
6587 (match_operand:SI 2 "nonimmediate_operand" "d,RT")))))
6591 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
6592 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
6596 [(set_attr "op_type" "RRE,RXY")
6597 (set_attr "type" "idiv")])
6599 (define_expand "udivsi3"
6600 [(set (match_operand:SI 0 "register_operand" "=d")
6601 (udiv:SI (match_operand:SI 1 "general_operand" "")
6602 (match_operand:SI 2 "general_operand" "")))
6603 (clobber (match_dup 3))]
6604 "!TARGET_ZARCH && !TARGET_CPU_ZARCH"
6606 rtx insn, udiv_equal, umod_equal, equal;
6608 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6609 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6610 equal = gen_rtx_IOR (DImode,
6611 gen_rtx_ASHIFT (DImode,
6612 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
6614 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
6616 operands[3] = gen_reg_rtx (DImode);
6618 if (CONSTANT_P (operands[2]))
6620 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
6622 rtx_code_label *label1 = gen_label_rtx ();
6624 operands[1] = make_safe_from (operands[1], operands[0]);
6625 emit_move_insn (operands[0], const0_rtx);
6626 emit_cmp_and_jump_insns (operands[1], operands[2], LT, NULL_RTX,
6628 emit_move_insn (operands[0], const1_rtx);
6629 emit_label (label1);
6633 operands[2] = force_reg (SImode, operands[2]);
6634 operands[2] = make_safe_from (operands[2], operands[0]);
6636 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6637 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6639 set_unique_reg_note (insn, REG_EQUAL, equal);
6641 insn = emit_move_insn (operands[0],
6642 gen_lowpart (SImode, operands[3]));
6643 set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
6648 rtx_code_label *label1 = gen_label_rtx ();
6649 rtx_code_label *label2 = gen_label_rtx ();
6650 rtx_code_label *label3 = gen_label_rtx ();
6652 operands[1] = force_reg (SImode, operands[1]);
6653 operands[1] = make_safe_from (operands[1], operands[0]);
6654 operands[2] = force_reg (SImode, operands[2]);
6655 operands[2] = make_safe_from (operands[2], operands[0]);
6657 emit_move_insn (operands[0], const0_rtx);
6658 emit_cmp_and_jump_insns (operands[2], operands[1], GT, NULL_RTX,
6660 emit_cmp_and_jump_insns (operands[2], const0_rtx, LT, NULL_RTX,
6662 emit_cmp_and_jump_insns (operands[2], const1_rtx, EQ, NULL_RTX,
6664 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6665 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6667 set_unique_reg_note (insn, REG_EQUAL, equal);
6669 insn = emit_move_insn (operands[0],
6670 gen_lowpart (SImode, operands[3]));
6671 set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
6674 emit_label (label1);
6675 emit_move_insn (operands[0], operands[1]);
6677 emit_label (label2);
6678 emit_move_insn (operands[0], const1_rtx);
6679 emit_label (label3);
6681 emit_move_insn (operands[0], operands[0]);
6685 (define_expand "umodsi3"
6686 [(set (match_operand:SI 0 "register_operand" "=d")
6687 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
6688 (match_operand:SI 2 "nonimmediate_operand" "")))
6689 (clobber (match_dup 3))]
6690 "!TARGET_ZARCH && !TARGET_CPU_ZARCH"
6692 rtx insn, udiv_equal, umod_equal, equal;
6694 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6695 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6696 equal = gen_rtx_IOR (DImode,
6697 gen_rtx_ASHIFT (DImode,
6698 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
6700 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
6702 operands[3] = gen_reg_rtx (DImode);
6704 if (CONSTANT_P (operands[2]))
6706 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
6708 rtx_code_label *label1 = gen_label_rtx ();
6710 operands[1] = make_safe_from (operands[1], operands[0]);
6711 emit_move_insn (operands[0], operands[1]);
6712 emit_cmp_and_jump_insns (operands[0], operands[2], LT, NULL_RTX,
6714 emit_insn (gen_abssi2 (operands[0], operands[2]));
6715 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
6716 emit_label (label1);
6720 operands[2] = force_reg (SImode, operands[2]);
6721 operands[2] = make_safe_from (operands[2], operands[0]);
6723 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6724 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6726 set_unique_reg_note (insn, REG_EQUAL, equal);
6728 insn = emit_move_insn (operands[0],
6729 gen_highpart (SImode, operands[3]));
6730 set_unique_reg_note (insn, REG_EQUAL, umod_equal);
6735 rtx_code_label *label1 = gen_label_rtx ();
6736 rtx_code_label *label2 = gen_label_rtx ();
6737 rtx_code_label *label3 = gen_label_rtx ();
6739 operands[1] = force_reg (SImode, operands[1]);
6740 operands[1] = make_safe_from (operands[1], operands[0]);
6741 operands[2] = force_reg (SImode, operands[2]);
6742 operands[2] = make_safe_from (operands[2], operands[0]);
6744 emit_move_insn(operands[0], operands[1]);
6745 emit_cmp_and_jump_insns (operands[2], operands[1], GT, NULL_RTX,
6747 emit_cmp_and_jump_insns (operands[2], const0_rtx, LT, NULL_RTX,
6749 emit_cmp_and_jump_insns (operands[2], const1_rtx, EQ, NULL_RTX,
6751 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6752 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6754 set_unique_reg_note (insn, REG_EQUAL, equal);
6756 insn = emit_move_insn (operands[0],
6757 gen_highpart (SImode, operands[3]));
6758 set_unique_reg_note (insn, REG_EQUAL, umod_equal);
6761 emit_label (label1);
6762 emit_move_insn (operands[0], const0_rtx);
6764 emit_label (label2);
6765 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
6766 emit_label (label3);
6772 ; div(df|sf)3 instruction pattern(s).
6775 ; dxbr, ddbr, debr, dxb, ddb, deb, ddtr, dxtr
6776 (define_insn "div<mode>3"
6777 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
6778 (div:FP (match_operand:FP 1 "register_operand" "<f0>, 0,<v0>")
6779 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))]
6782 d<xde><bt>r\t%0,<op1>%2
6785 [(set_attr "op_type" "<RRer>,RXE,VRR")
6786 (set_attr "type" "fdiv<mode>")
6787 (set_attr "cpu_facility" "*,*,vec")])
6791 ;;- And instructions.
6794 (define_expand "and<mode>3"
6795 [(set (match_operand:INT 0 "nonimmediate_operand" "")
6796 (and:INT (match_operand:INT 1 "nonimmediate_operand" "")
6797 (match_operand:INT 2 "general_operand" "")))
6798 (clobber (reg:CC CC_REGNUM))]
6800 "s390_expand_logical_operator (AND, <MODE>mode, operands); DONE;")
6803 ; anddi3 instruction pattern(s).
6806 (define_insn "*anddi3_cc"
6807 [(set (reg CC_REGNUM)
6809 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0, d")
6810 (match_operand:DI 2 "general_operand" " d,d,RT,NxxDq"))
6812 (set (match_operand:DI 0 "register_operand" "=d,d, d, d")
6813 (and:DI (match_dup 1) (match_dup 2)))]
6814 "TARGET_ZARCH && s390_match_ccmode(insn, CCTmode)"
6819 risbg\t%0,%1,%s2,128+%e2,0"
6820 [(set_attr "op_type" "RRE,RRF,RXY,RIE")
6821 (set_attr "cpu_facility" "*,z196,*,z10")
6822 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
6824 (define_insn "*anddi3_cconly"
6825 [(set (reg CC_REGNUM)
6827 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0, d")
6828 (match_operand:DI 2 "general_operand" " d,d,RT,NxxDq"))
6830 (clobber (match_scratch:DI 0 "=d,d, d, d"))]
6832 && s390_match_ccmode(insn, CCTmode)
6833 /* Do not steal TM patterns. */
6834 && s390_single_part (operands[2], DImode, HImode, 0) < 0"
6839 risbg\t%0,%1,%s2,128+%e2,0"
6840 [(set_attr "op_type" "RRE,RRF,RXY,RIE")
6841 (set_attr "cpu_facility" "*,z196,*,z10")
6842 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
6844 (define_insn "*anddi3"
6845 [(set (match_operand:DI 0 "nonimmediate_operand"
6846 "=d,d, d, d, d, d, d, d,d,d, d, d, AQ,Q")
6848 (match_operand:DI 1 "nonimmediate_operand"
6849 "%d,o, 0, 0, 0, 0, 0, 0,0,d, 0, d, 0,0")
6850 (match_operand:DI 2 "general_operand"
6851 "M, M,N0HDF,N1HDF,N2HDF,N3HDF,N0SDF,N1SDF,d,d,RT,NxxDq,NxQDF,Q")))
6852 (clobber (reg:CC CC_REGNUM))]
6853 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6866 risbg\t%0,%1,%s2,128+%e2,0
6869 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,RIE,SI,SS")
6870 (set_attr "cpu_facility" "*,*,*,*,*,*,extimm,extimm,*,z196,*,z10,*,*")
6871 (set_attr "z10prop" "*,
6887 [(set (match_operand:DI 0 "s_operand" "")
6888 (and:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
6889 (clobber (reg:CC CC_REGNUM))]
6892 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
6893 (clobber (reg:CC CC_REGNUM))])]
6894 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
6896 ;; These two are what combine generates for (ashift (zero_extract)).
6897 (define_insn "*extzv_<mode>_srl"
6898 [(set (match_operand:GPR 0 "register_operand" "=d")
6899 (and:GPR (lshiftrt:GPR
6900 (match_operand:GPR 1 "register_operand" "d")
6901 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
6902 (match_operand:GPR 3 "contiguous_bitmask_operand" "")))
6903 (clobber (reg:CC CC_REGNUM))]
6905 /* Note that even for the SImode pattern, the rotate is always DImode. */
6906 && s390_extzv_shift_ok (<bitsize>, -INTVAL (operands[2]),
6907 INTVAL (operands[3]))"
6908 "risbg\t%0,%1,%<bfstart>3,128+%<bfend>3,64-%2"
6909 [(set_attr "op_type" "RIE")
6910 (set_attr "z10prop" "z10_super_E1")])
6912 (define_insn "*extzv_<mode>_sll"
6913 [(set (match_operand:GPR 0 "register_operand" "=d")
6914 (and:GPR (ashift:GPR
6915 (match_operand:GPR 1 "register_operand" "d")
6916 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
6917 (match_operand:GPR 3 "contiguous_bitmask_operand" "")))
6918 (clobber (reg:CC CC_REGNUM))]
6920 && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[2]),
6921 INTVAL (operands[3]))"
6922 "risbg\t%0,%1,%<bfstart>3,128+%<bfend>3,%2"
6923 [(set_attr "op_type" "RIE")
6924 (set_attr "z10prop" "z10_super_E1")])
6928 ; andsi3 instruction pattern(s).
6931 (define_insn "*andsi3_cc"
6932 [(set (reg CC_REGNUM)
6935 (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d")
6936 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq"))
6938 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d, d")
6939 (and:SI (match_dup 1) (match_dup 2)))]
6940 "s390_match_ccmode(insn, CCTmode)"
6947 risbg\t%0,%1,%t2,128+%f2,0"
6948 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE")
6949 (set_attr "cpu_facility" "*,*,z196,*,*,z10")
6950 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
6951 z10_super_E1,z10_super_E1,z10_super_E1")])
6953 (define_insn "*andsi3_cconly"
6954 [(set (reg CC_REGNUM)
6957 (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d")
6958 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq"))
6960 (clobber (match_scratch:SI 0 "=d,d,d,d,d, d"))]
6961 "s390_match_ccmode(insn, CCTmode)
6962 /* Do not steal TM patterns. */
6963 && s390_single_part (operands[2], SImode, HImode, 0) < 0"
6970 risbg\t%0,%1,%t2,128+%f2,0"
6971 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE")
6972 (set_attr "cpu_facility" "*,*,z196,*,*,z10")
6973 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
6974 z10_super_E1,z10_super_E1,z10_super_E1")])
6976 (define_insn "*andsi3_zarch"
6977 [(set (match_operand:SI 0 "nonimmediate_operand"
6978 "=d,d, d, d, d,d,d,d,d, d, AQ,Q")
6979 (and:SI (match_operand:SI 1 "nonimmediate_operand"
6980 "%d,o, 0, 0, 0,0,d,0,0, d, 0,0")
6981 (match_operand:SI 2 "general_operand"
6982 " M,M,N0HSF,N1HSF,Os,d,d,R,T,NxxSq,NxQSF,Q")))
6983 (clobber (reg:CC CC_REGNUM))]
6984 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6995 risbg\t%0,%1,%t2,128+%f2,0
6998 [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RRF,RX,RXY,RIE,SI,SS")
6999 (set_attr "cpu_facility" "*,*,*,*,*,*,z196,*,*,z10,*,*")
7000 (set_attr "z10prop" "*,
7013 (define_insn "*andsi3_esa"
7014 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d, AQ,Q")
7015 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0, 0,0")
7016 (match_operand:SI 2 "general_operand" " d,R,NxQSF,Q")))
7017 (clobber (reg:CC CC_REGNUM))]
7018 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7024 [(set_attr "op_type" "RR,RX,SI,SS")
7025 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
7029 [(set (match_operand:SI 0 "s_operand" "")
7030 (and:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7031 (clobber (reg:CC CC_REGNUM))]
7034 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
7035 (clobber (reg:CC CC_REGNUM))])]
7036 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
7039 ; andhi3 instruction pattern(s).
7042 (define_insn "*andhi3_zarch"
7043 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7044 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0")
7045 (match_operand:HI 2 "general_operand" " d,d,n,NxQHF,Q")))
7046 (clobber (reg:CC CC_REGNUM))]
7047 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7054 [(set_attr "op_type" "RR,RRF,RI,SI,SS")
7055 (set_attr "cpu_facility" "*,z196,*,*,*")
7056 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*")
7059 (define_insn "*andhi3_esa"
7060 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
7061 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
7062 (match_operand:HI 2 "general_operand" "d,NxQHF,Q")))
7063 (clobber (reg:CC CC_REGNUM))]
7064 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7069 [(set_attr "op_type" "RR,SI,SS")
7070 (set_attr "z10prop" "z10_super_E1,*,*")
7074 [(set (match_operand:HI 0 "s_operand" "")
7075 (and:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7076 (clobber (reg:CC CC_REGNUM))]
7079 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
7080 (clobber (reg:CC CC_REGNUM))])]
7081 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
7084 ; andqi3 instruction pattern(s).
7087 (define_insn "*andqi3_zarch"
7088 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7089 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0")
7090 (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q")))
7091 (clobber (reg:CC CC_REGNUM))]
7092 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7100 [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS")
7101 (set_attr "cpu_facility" "*,z196,*,*,*,*")
7102 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super,z10_super,*")])
7104 (define_insn "*andqi3_esa"
7105 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
7106 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
7107 (match_operand:QI 2 "general_operand" "d,n,Q")))
7108 (clobber (reg:CC CC_REGNUM))]
7109 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7114 [(set_attr "op_type" "RR,SI,SS")
7115 (set_attr "z10prop" "z10_super_E1,z10_super,*")])
7118 ; Block and (NC) patterns.
7122 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7123 (and:BLK (match_dup 0)
7124 (match_operand:BLK 1 "memory_operand" "Q")))
7125 (use (match_operand 2 "const_int_operand" "n"))
7126 (clobber (reg:CC CC_REGNUM))]
7127 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7128 "nc\t%O0(%2,%R0),%S1"
7129 [(set_attr "op_type" "SS")
7130 (set_attr "z196prop" "z196_cracked")])
7133 [(set (match_operand 0 "memory_operand" "")
7135 (match_operand 1 "memory_operand" "")))
7136 (clobber (reg:CC CC_REGNUM))]
7138 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7139 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7141 [(set (match_dup 0) (and:BLK (match_dup 0) (match_dup 1)))
7143 (clobber (reg:CC CC_REGNUM))])]
7145 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7146 operands[0] = adjust_address (operands[0], BLKmode, 0);
7147 operands[1] = adjust_address (operands[1], BLKmode, 0);
7152 [(set (match_operand:BLK 0 "memory_operand" "")
7153 (and:BLK (match_dup 0)
7154 (match_operand:BLK 1 "memory_operand" "")))
7155 (use (match_operand 2 "const_int_operand" ""))
7156 (clobber (reg:CC CC_REGNUM))])
7158 [(set (match_operand:BLK 3 "memory_operand" "")
7159 (and:BLK (match_dup 3)
7160 (match_operand:BLK 4 "memory_operand" "")))
7161 (use (match_operand 5 "const_int_operand" ""))
7162 (clobber (reg:CC CC_REGNUM))])]
7163 "s390_offset_p (operands[0], operands[3], operands[2])
7164 && s390_offset_p (operands[1], operands[4], operands[2])
7165 && !s390_overlap_p (operands[0], operands[1],
7166 INTVAL (operands[2]) + INTVAL (operands[5]))
7167 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7169 [(set (match_dup 6) (and:BLK (match_dup 6) (match_dup 7)))
7171 (clobber (reg:CC CC_REGNUM))])]
7172 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7173 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7174 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7178 ;;- Bit set (inclusive or) instructions.
7181 (define_expand "ior<mode>3"
7182 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7183 (ior:INT (match_operand:INT 1 "nonimmediate_operand" "")
7184 (match_operand:INT 2 "general_operand" "")))
7185 (clobber (reg:CC CC_REGNUM))]
7187 "s390_expand_logical_operator (IOR, <MODE>mode, operands); DONE;")
7190 ; iordi3 instruction pattern(s).
7193 (define_insn "*iordi3_cc"
7194 [(set (reg CC_REGNUM)
7195 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7196 (match_operand:DI 2 "general_operand" " d,d,RT"))
7198 (set (match_operand:DI 0 "register_operand" "=d,d, d")
7199 (ior:DI (match_dup 1) (match_dup 2)))]
7200 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7205 [(set_attr "op_type" "RRE,RRF,RXY")
7206 (set_attr "cpu_facility" "*,z196,*")
7207 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7209 (define_insn "*iordi3_cconly"
7210 [(set (reg CC_REGNUM)
7211 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0")
7212 (match_operand:DI 2 "general_operand" " d,d,RT"))
7214 (clobber (match_scratch:DI 0 "=d,d,d"))]
7215 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7220 [(set_attr "op_type" "RRE,RRF,RXY")
7221 (set_attr "cpu_facility" "*,z196,*")
7222 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7224 (define_insn "*iordi3"
7225 [(set (match_operand:DI 0 "nonimmediate_operand"
7226 "=d, d, d, d, d, d,d,d, d, AQ,Q")
7227 (ior:DI (match_operand:DI 1 "nonimmediate_operand"
7228 " %0, 0, 0, 0, 0, 0,0,d, 0, 0,0")
7229 (match_operand:DI 2 "general_operand"
7230 "N0HD0,N1HD0,N2HD0,N3HD0,N0SD0,N1SD0,d,d,RT,NxQD0,Q")))
7231 (clobber (reg:CC CC_REGNUM))]
7232 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7245 [(set_attr "op_type" "RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,SI,SS")
7246 (set_attr "cpu_facility" "*,*,*,*,extimm,extimm,*,z196,*,*,*")
7247 (set_attr "z10prop" "z10_super_E1,
7260 [(set (match_operand:DI 0 "s_operand" "")
7261 (ior:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
7262 (clobber (reg:CC CC_REGNUM))]
7265 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7266 (clobber (reg:CC CC_REGNUM))])]
7267 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7270 ; iorsi3 instruction pattern(s).
7273 (define_insn "*iorsi3_cc"
7274 [(set (reg CC_REGNUM)
7275 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7276 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7278 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
7279 (ior:SI (match_dup 1) (match_dup 2)))]
7280 "s390_match_ccmode(insn, CCTmode)"
7287 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7288 (set_attr "cpu_facility" "*,*,z196,*,*")
7289 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")])
7291 (define_insn "*iorsi3_cconly"
7292 [(set (reg CC_REGNUM)
7293 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7294 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7296 (clobber (match_scratch:SI 0 "=d,d,d,d,d"))]
7297 "s390_match_ccmode(insn, CCTmode)"
7304 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7305 (set_attr "cpu_facility" "*,*,z196,*,*")
7306 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")])
7308 (define_insn "*iorsi3_zarch"
7309 [(set (match_operand:SI 0 "nonimmediate_operand" "=d, d, d,d,d,d,d, AQ,Q")
7310 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0, 0, 0,0,d,0,0, 0,0")
7311 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,Os,d,d,R,T,NxQS0,Q")))
7312 (clobber (reg:CC CC_REGNUM))]
7313 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7324 [(set_attr "op_type" "RI,RI,RIL,RR,RRF,RX,RXY,SI,SS")
7325 (set_attr "cpu_facility" "*,*,*,*,z196,*,*,*,*")
7326 (set_attr "z10prop" "z10_super_E1,
7336 (define_insn "*iorsi3_esa"
7337 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
7338 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
7339 (match_operand:SI 2 "general_operand" "d,R,NxQS0,Q")))
7340 (clobber (reg:CC CC_REGNUM))]
7341 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7347 [(set_attr "op_type" "RR,RX,SI,SS")
7348 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
7351 [(set (match_operand:SI 0 "s_operand" "")
7352 (ior:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7353 (clobber (reg:CC CC_REGNUM))]
7356 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7357 (clobber (reg:CC CC_REGNUM))])]
7358 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7361 ; iorhi3 instruction pattern(s).
7364 (define_insn "*iorhi3_zarch"
7365 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7366 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0")
7367 (match_operand:HI 2 "general_operand" " d,d,n,NxQH0,Q")))
7368 (clobber (reg:CC CC_REGNUM))]
7369 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7376 [(set_attr "op_type" "RR,RRF,RI,SI,SS")
7377 (set_attr "cpu_facility" "*,z196,*,*,*")
7378 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*")])
7380 (define_insn "*iorhi3_esa"
7381 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
7382 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
7383 (match_operand:HI 2 "general_operand" "d,NxQH0,Q")))
7384 (clobber (reg:CC CC_REGNUM))]
7385 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7390 [(set_attr "op_type" "RR,SI,SS")
7391 (set_attr "z10prop" "z10_super_E1,*,*")])
7394 [(set (match_operand:HI 0 "s_operand" "")
7395 (ior:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7396 (clobber (reg:CC CC_REGNUM))]
7399 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7400 (clobber (reg:CC CC_REGNUM))])]
7401 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7404 ; iorqi3 instruction pattern(s).
7407 (define_insn "*iorqi3_zarch"
7408 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7409 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0")
7410 (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q")))
7411 (clobber (reg:CC CC_REGNUM))]
7412 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7420 [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS")
7421 (set_attr "cpu_facility" "*,z196,*,*,*,*")
7422 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,
7423 z10_super,z10_super,*")])
7425 (define_insn "*iorqi3_esa"
7426 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
7427 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
7428 (match_operand:QI 2 "general_operand" "d,n,Q")))
7429 (clobber (reg:CC CC_REGNUM))]
7430 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7435 [(set_attr "op_type" "RR,SI,SS")
7436 (set_attr "z10prop" "z10_super_E1,z10_super,*")])
7439 ; Block inclusive or (OC) patterns.
7443 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7444 (ior:BLK (match_dup 0)
7445 (match_operand:BLK 1 "memory_operand" "Q")))
7446 (use (match_operand 2 "const_int_operand" "n"))
7447 (clobber (reg:CC CC_REGNUM))]
7448 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7449 "oc\t%O0(%2,%R0),%S1"
7450 [(set_attr "op_type" "SS")
7451 (set_attr "z196prop" "z196_cracked")])
7454 [(set (match_operand 0 "memory_operand" "")
7456 (match_operand 1 "memory_operand" "")))
7457 (clobber (reg:CC CC_REGNUM))]
7459 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7460 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7462 [(set (match_dup 0) (ior:BLK (match_dup 0) (match_dup 1)))
7464 (clobber (reg:CC CC_REGNUM))])]
7466 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7467 operands[0] = adjust_address (operands[0], BLKmode, 0);
7468 operands[1] = adjust_address (operands[1], BLKmode, 0);
7473 [(set (match_operand:BLK 0 "memory_operand" "")
7474 (ior:BLK (match_dup 0)
7475 (match_operand:BLK 1 "memory_operand" "")))
7476 (use (match_operand 2 "const_int_operand" ""))
7477 (clobber (reg:CC CC_REGNUM))])
7479 [(set (match_operand:BLK 3 "memory_operand" "")
7480 (ior:BLK (match_dup 3)
7481 (match_operand:BLK 4 "memory_operand" "")))
7482 (use (match_operand 5 "const_int_operand" ""))
7483 (clobber (reg:CC CC_REGNUM))])]
7484 "s390_offset_p (operands[0], operands[3], operands[2])
7485 && s390_offset_p (operands[1], operands[4], operands[2])
7486 && !s390_overlap_p (operands[0], operands[1],
7487 INTVAL (operands[2]) + INTVAL (operands[5]))
7488 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7490 [(set (match_dup 6) (ior:BLK (match_dup 6) (match_dup 7)))
7492 (clobber (reg:CC CC_REGNUM))])]
7493 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7494 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7495 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7499 ;;- Xor instructions.
7502 (define_expand "xor<mode>3"
7503 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7504 (xor:INT (match_operand:INT 1 "nonimmediate_operand" "")
7505 (match_operand:INT 2 "general_operand" "")))
7506 (clobber (reg:CC CC_REGNUM))]
7508 "s390_expand_logical_operator (XOR, <MODE>mode, operands); DONE;")
7510 ; Combine replaces (xor (x) (const_int -1)) with (not (x)) when doing
7511 ; simplifications. So its better to have something matching.
7513 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7514 (not:INT (match_operand:INT 1 "nonimmediate_operand" "")))]
7517 [(set (match_dup 0) (xor:INT (match_dup 1) (match_dup 2)))
7518 (clobber (reg:CC CC_REGNUM))])]
7520 operands[2] = constm1_rtx;
7521 if (!s390_logical_operator_ok_p (operands))
7526 ; xordi3 instruction pattern(s).
7529 (define_insn "*xordi3_cc"
7530 [(set (reg CC_REGNUM)
7531 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7532 (match_operand:DI 2 "general_operand" " d,d,RT"))
7534 (set (match_operand:DI 0 "register_operand" "=d,d, d")
7535 (xor:DI (match_dup 1) (match_dup 2)))]
7536 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7541 [(set_attr "op_type" "RRE,RRF,RXY")
7542 (set_attr "cpu_facility" "*,z196,*")
7543 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7545 (define_insn "*xordi3_cconly"
7546 [(set (reg CC_REGNUM)
7547 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7548 (match_operand:DI 2 "general_operand" " d,d,RT"))
7550 (clobber (match_scratch:DI 0 "=d,d, d"))]
7551 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7556 [(set_attr "op_type" "RRE,RRF,RXY")
7557 (set_attr "cpu_facility" "*,z196,*")
7558 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7560 (define_insn "*xordi3"
7561 [(set (match_operand:DI 0 "nonimmediate_operand" "=d, d,d,d, d, AQ,Q")
7562 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0, 0,0,d, 0, 0,0")
7563 (match_operand:DI 2 "general_operand" "N0SD0,N1SD0,d,d,RT,NxQD0,Q")))
7564 (clobber (reg:CC CC_REGNUM))]
7565 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7574 [(set_attr "op_type" "RIL,RIL,RRE,RRF,RXY,SI,SS")
7575 (set_attr "cpu_facility" "extimm,extimm,*,z196,*,*,*")
7576 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,
7577 *,z10_super_E1,*,*")])
7580 [(set (match_operand:DI 0 "s_operand" "")
7581 (xor:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
7582 (clobber (reg:CC CC_REGNUM))]
7585 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7586 (clobber (reg:CC CC_REGNUM))])]
7587 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7590 ; xorsi3 instruction pattern(s).
7593 (define_insn "*xorsi3_cc"
7594 [(set (reg CC_REGNUM)
7595 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7596 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7598 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
7599 (xor:SI (match_dup 1) (match_dup 2)))]
7600 "s390_match_ccmode(insn, CCTmode)"
7607 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7608 (set_attr "cpu_facility" "*,*,z196,*,*")
7609 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7610 z10_super_E1,z10_super_E1")])
7612 (define_insn "*xorsi3_cconly"
7613 [(set (reg CC_REGNUM)
7614 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7615 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7617 (clobber (match_scratch:SI 0 "=d,d,d,d,d"))]
7618 "s390_match_ccmode(insn, CCTmode)"
7625 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7626 (set_attr "cpu_facility" "*,*,z196,*,*")
7627 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7628 z10_super_E1,z10_super_E1")])
7630 (define_insn "*xorsi3"
7631 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d, AQ,Q")
7632 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, 0,0")
7633 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxQS0,Q")))
7634 (clobber (reg:CC CC_REGNUM))]
7635 "s390_logical_operator_ok_p (operands)"
7644 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,SI,SS")
7645 (set_attr "cpu_facility" "*,*,z196,*,*,*,*")
7646 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7647 z10_super_E1,z10_super_E1,*,*")])
7650 [(set (match_operand:SI 0 "s_operand" "")
7651 (xor:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7652 (clobber (reg:CC CC_REGNUM))]
7655 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7656 (clobber (reg:CC CC_REGNUM))])]
7657 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7660 ; xorhi3 instruction pattern(s).
7663 (define_insn "*xorhi3"
7664 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7665 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,d, 0,0")
7666 (match_operand:HI 2 "general_operand" "Os,d,d,NxQH0,Q")))
7667 (clobber (reg:CC CC_REGNUM))]
7668 "s390_logical_operator_ok_p (operands)"
7675 [(set_attr "op_type" "RIL,RR,RRF,SI,SS")
7676 (set_attr "cpu_facility" "*,*,z196,*,*")
7677 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*,*")])
7680 [(set (match_operand:HI 0 "s_operand" "")
7681 (xor:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7682 (clobber (reg:CC CC_REGNUM))]
7685 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7686 (clobber (reg:CC CC_REGNUM))])]
7687 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7690 ; xorqi3 instruction pattern(s).
7693 (define_insn "*xorqi3"
7694 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7695 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,d,0,0,0")
7696 (match_operand:QI 2 "general_operand" "Os,d,d,n,n,Q")))
7697 (clobber (reg:CC CC_REGNUM))]
7698 "s390_logical_operator_ok_p (operands)"
7706 [(set_attr "op_type" "RIL,RR,RRF,SI,SIY,SS")
7707 (set_attr "cpu_facility" "*,*,z196,*,*,*")
7708 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super,z10_super,*")])
7712 ; Block exclusive or (XC) patterns.
7716 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7717 (xor:BLK (match_dup 0)
7718 (match_operand:BLK 1 "memory_operand" "Q")))
7719 (use (match_operand 2 "const_int_operand" "n"))
7720 (clobber (reg:CC CC_REGNUM))]
7721 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7722 "xc\t%O0(%2,%R0),%S1"
7723 [(set_attr "op_type" "SS")])
7726 [(set (match_operand 0 "memory_operand" "")
7728 (match_operand 1 "memory_operand" "")))
7729 (clobber (reg:CC CC_REGNUM))]
7731 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7732 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7734 [(set (match_dup 0) (xor:BLK (match_dup 0) (match_dup 1)))
7736 (clobber (reg:CC CC_REGNUM))])]
7738 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7739 operands[0] = adjust_address (operands[0], BLKmode, 0);
7740 operands[1] = adjust_address (operands[1], BLKmode, 0);
7745 [(set (match_operand:BLK 0 "memory_operand" "")
7746 (xor:BLK (match_dup 0)
7747 (match_operand:BLK 1 "memory_operand" "")))
7748 (use (match_operand 2 "const_int_operand" ""))
7749 (clobber (reg:CC CC_REGNUM))])
7751 [(set (match_operand:BLK 3 "memory_operand" "")
7752 (xor:BLK (match_dup 3)
7753 (match_operand:BLK 4 "memory_operand" "")))
7754 (use (match_operand 5 "const_int_operand" ""))
7755 (clobber (reg:CC CC_REGNUM))])]
7756 "s390_offset_p (operands[0], operands[3], operands[2])
7757 && s390_offset_p (operands[1], operands[4], operands[2])
7758 && !s390_overlap_p (operands[0], operands[1],
7759 INTVAL (operands[2]) + INTVAL (operands[5]))
7760 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7762 [(set (match_dup 6) (xor:BLK (match_dup 6) (match_dup 7)))
7764 (clobber (reg:CC CC_REGNUM))])]
7765 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7766 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7767 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7770 ; Block xor (XC) patterns with src == dest.
7773 (define_insn "*xc_zero"
7774 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7776 (use (match_operand 1 "const_int_operand" "n"))
7777 (clobber (reg:CC CC_REGNUM))]
7778 "INTVAL (operands[1]) >= 1 && INTVAL (operands[1]) <= 256"
7779 "xc\t%O0(%1,%R0),%S0"
7780 [(set_attr "op_type" "SS")
7781 (set_attr "z196prop" "z196_cracked")])
7785 [(set (match_operand:BLK 0 "memory_operand" "")
7787 (use (match_operand 1 "const_int_operand" ""))
7788 (clobber (reg:CC CC_REGNUM))])
7790 [(set (match_operand:BLK 2 "memory_operand" "")
7792 (use (match_operand 3 "const_int_operand" ""))
7793 (clobber (reg:CC CC_REGNUM))])]
7794 "s390_offset_p (operands[0], operands[2], operands[1])
7795 && INTVAL (operands[1]) + INTVAL (operands[3]) <= 256"
7797 [(set (match_dup 4) (const_int 0))
7799 (clobber (reg:CC CC_REGNUM))])]
7800 "operands[4] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7801 operands[5] = GEN_INT (INTVAL (operands[1]) + INTVAL (operands[3]));")
7805 ;;- Negate instructions.
7809 ; neg(di|si)2 instruction pattern(s).
7812 (define_expand "neg<mode>2"
7814 [(set (match_operand:DSI 0 "register_operand" "=d")
7815 (neg:DSI (match_operand:DSI 1 "register_operand" "d")))
7816 (clobber (reg:CC CC_REGNUM))])]
7820 (define_insn "*negdi2_sign_cc"
7821 [(set (reg CC_REGNUM)
7822 (compare (neg:DI (ashiftrt:DI (ashift:DI (subreg:DI
7823 (match_operand:SI 1 "register_operand" "d") 0)
7824 (const_int 32)) (const_int 32)))
7826 (set (match_operand:DI 0 "register_operand" "=d")
7827 (neg:DI (sign_extend:DI (match_dup 1))))]
7828 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
7830 [(set_attr "op_type" "RRE")
7831 (set_attr "z10prop" "z10_c")])
7833 (define_insn "*negdi2_sign"
7834 [(set (match_operand:DI 0 "register_operand" "=d")
7835 (neg:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
7836 (clobber (reg:CC CC_REGNUM))]
7839 [(set_attr "op_type" "RRE")
7840 (set_attr "z10prop" "z10_c")])
7843 (define_insn "*neg<mode>2_cc"
7844 [(set (reg CC_REGNUM)
7845 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
7847 (set (match_operand:GPR 0 "register_operand" "=d")
7848 (neg:GPR (match_dup 1)))]
7849 "s390_match_ccmode (insn, CCAmode)"
7851 [(set_attr "op_type" "RR<E>")
7852 (set_attr "z10prop" "z10_super_c_E1")])
7855 (define_insn "*neg<mode>2_cconly"
7856 [(set (reg CC_REGNUM)
7857 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
7859 (clobber (match_scratch:GPR 0 "=d"))]
7860 "s390_match_ccmode (insn, CCAmode)"
7862 [(set_attr "op_type" "RR<E>")
7863 (set_attr "z10prop" "z10_super_c_E1")])
7866 (define_insn "*neg<mode>2"
7867 [(set (match_operand:GPR 0 "register_operand" "=d")
7868 (neg:GPR (match_operand:GPR 1 "register_operand" "d")))
7869 (clobber (reg:CC CC_REGNUM))]
7872 [(set_attr "op_type" "RR<E>")
7873 (set_attr "z10prop" "z10_super_c_E1")])
7875 (define_insn "*negdi2_31"
7876 [(set (match_operand:DI 0 "register_operand" "=d")
7877 (neg:DI (match_operand:DI 1 "register_operand" "d")))
7878 (clobber (reg:CC CC_REGNUM))]
7882 ; Split a DImode NEG on 31bit into 2 SImode NEGs
7884 ; Doing the twos complement separately on the SImode parts does an
7885 ; unwanted +1 on the high part which needs to be subtracted afterwards
7886 ; ... unless the +1 on the low part created an overflow.
7889 [(set (match_operand:DI 0 "register_operand" "")
7890 (neg:DI (match_operand:DI 1 "register_operand" "")))
7891 (clobber (reg:CC CC_REGNUM))]
7893 && (REGNO (operands[0]) == REGNO (operands[1])
7894 || s390_split_ok_p (operands[0], operands[1], DImode, 0))
7895 && reload_completed"
7897 [(set (match_dup 2) (neg:SI (match_dup 3)))
7898 (clobber (reg:CC CC_REGNUM))])
7900 [(set (reg:CCAP CC_REGNUM)
7901 (compare:CCAP (neg:SI (match_dup 5)) (const_int 0)))
7902 (set (match_dup 4) (neg:SI (match_dup 5)))])
7904 (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
7906 (label_ref (match_dup 6))))
7908 [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
7909 (clobber (reg:CC CC_REGNUM))])
7911 "operands[2] = operand_subword (operands[0], 0, 0, DImode);
7912 operands[3] = operand_subword (operands[1], 0, 0, DImode);
7913 operands[4] = operand_subword (operands[0], 1, 0, DImode);
7914 operands[5] = operand_subword (operands[1], 1, 0, DImode);
7915 operands[6] = gen_label_rtx ();")
7917 ; Like above but first make a copy of the low part of the src operand
7918 ; since it might overlap with the high part of the destination.
7921 [(set (match_operand:DI 0 "register_operand" "")
7922 (neg:DI (match_operand:DI 1 "register_operand" "")))
7923 (clobber (reg:CC CC_REGNUM))]
7925 && s390_split_ok_p (operands[0], operands[1], DImode, 1)
7926 && reload_completed"
7927 [; Make a backup of op5 first
7928 (set (match_dup 4) (match_dup 5))
7929 ; Setting op2 here might clobber op5
7931 [(set (match_dup 2) (neg:SI (match_dup 3)))
7932 (clobber (reg:CC CC_REGNUM))])
7934 [(set (reg:CCAP CC_REGNUM)
7935 (compare:CCAP (neg:SI (match_dup 4)) (const_int 0)))
7936 (set (match_dup 4) (neg:SI (match_dup 4)))])
7938 (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
7940 (label_ref (match_dup 6))))
7942 [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
7943 (clobber (reg:CC CC_REGNUM))])
7945 "operands[2] = operand_subword (operands[0], 0, 0, DImode);
7946 operands[3] = operand_subword (operands[1], 0, 0, DImode);
7947 operands[4] = operand_subword (operands[0], 1, 0, DImode);
7948 operands[5] = operand_subword (operands[1], 1, 0, DImode);
7949 operands[6] = gen_label_rtx ();")
7952 ; neg(df|sf)2 instruction pattern(s).
7955 (define_expand "neg<mode>2"
7957 [(set (match_operand:BFP 0 "register_operand" "=f")
7958 (neg:BFP (match_operand:BFP 1 "register_operand" "f")))
7959 (clobber (reg:CC CC_REGNUM))])]
7963 ; lcxbr, lcdbr, lcebr
7964 (define_insn "*neg<mode>2_cc"
7965 [(set (reg CC_REGNUM)
7966 (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f"))
7967 (match_operand:BFP 2 "const0_operand" "")))
7968 (set (match_operand:BFP 0 "register_operand" "=f")
7969 (neg:BFP (match_dup 1)))]
7970 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7972 [(set_attr "op_type" "RRE")
7973 (set_attr "type" "fsimp<mode>")])
7975 ; lcxbr, lcdbr, lcebr
7976 (define_insn "*neg<mode>2_cconly"
7977 [(set (reg CC_REGNUM)
7978 (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f"))
7979 (match_operand:BFP 2 "const0_operand" "")))
7980 (clobber (match_scratch:BFP 0 "=f"))]
7981 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7983 [(set_attr "op_type" "RRE")
7984 (set_attr "type" "fsimp<mode>")])
7987 (define_insn "*neg<mode>2_nocc"
7988 [(set (match_operand:FP 0 "register_operand" "=f")
7989 (neg:FP (match_operand:FP 1 "register_operand" "<fT0>")))]
7992 [(set_attr "op_type" "RRE")
7993 (set_attr "type" "fsimp<mode>")])
7995 ; lcxbr, lcdbr, lcebr
7996 ; FIXME: wflcdb does not clobber cc
7997 (define_insn "*neg<mode>2"
7998 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
7999 (neg:BFP (match_operand:BFP 1 "register_operand" "f,<vf>")))
8000 (clobber (reg:CC CC_REGNUM))]
8005 [(set_attr "op_type" "RRE,VRR")
8006 (set_attr "cpu_facility" "*,vec")
8007 (set_attr "type" "fsimp<mode>,*")])
8011 ;;- Absolute value instructions.
8015 ; abs(di|si)2 instruction pattern(s).
8018 (define_insn "*absdi2_sign_cc"
8019 [(set (reg CC_REGNUM)
8020 (compare (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
8021 (match_operand:SI 1 "register_operand" "d") 0)
8022 (const_int 32)) (const_int 32)))
8024 (set (match_operand:DI 0 "register_operand" "=d")
8025 (abs:DI (sign_extend:DI (match_dup 1))))]
8026 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
8028 [(set_attr "op_type" "RRE")
8029 (set_attr "z10prop" "z10_c")])
8031 (define_insn "*absdi2_sign"
8032 [(set (match_operand:DI 0 "register_operand" "=d")
8033 (abs:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
8034 (clobber (reg:CC CC_REGNUM))]
8037 [(set_attr "op_type" "RRE")
8038 (set_attr "z10prop" "z10_c")])
8041 (define_insn "*abs<mode>2_cc"
8042 [(set (reg CC_REGNUM)
8043 (compare (abs:GPR (match_operand:DI 1 "register_operand" "d"))
8045 (set (match_operand:GPR 0 "register_operand" "=d")
8046 (abs:GPR (match_dup 1)))]
8047 "s390_match_ccmode (insn, CCAmode)"
8049 [(set_attr "op_type" "RR<E>")
8050 (set_attr "z10prop" "z10_c")])
8053 (define_insn "*abs<mode>2_cconly"
8054 [(set (reg CC_REGNUM)
8055 (compare (abs:GPR (match_operand:GPR 1 "register_operand" "d"))
8057 (clobber (match_scratch:GPR 0 "=d"))]
8058 "s390_match_ccmode (insn, CCAmode)"
8060 [(set_attr "op_type" "RR<E>")
8061 (set_attr "z10prop" "z10_c")])
8064 (define_insn "abs<mode>2"
8065 [(set (match_operand:GPR 0 "register_operand" "=d")
8066 (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8067 (clobber (reg:CC CC_REGNUM))]
8070 [(set_attr "op_type" "RR<E>")
8071 (set_attr "z10prop" "z10_c")])
8074 ; abs(df|sf)2 instruction pattern(s).
8077 (define_expand "abs<mode>2"
8079 [(set (match_operand:BFP 0 "register_operand" "=f")
8080 (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8081 (clobber (reg:CC CC_REGNUM))])]
8085 ; lpxbr, lpdbr, lpebr
8086 (define_insn "*abs<mode>2_cc"
8087 [(set (reg CC_REGNUM)
8088 (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f"))
8089 (match_operand:BFP 2 "const0_operand" "")))
8090 (set (match_operand:BFP 0 "register_operand" "=f")
8091 (abs:BFP (match_dup 1)))]
8092 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8094 [(set_attr "op_type" "RRE")
8095 (set_attr "type" "fsimp<mode>")])
8097 ; lpxbr, lpdbr, lpebr
8098 (define_insn "*abs<mode>2_cconly"
8099 [(set (reg CC_REGNUM)
8100 (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f"))
8101 (match_operand:BFP 2 "const0_operand" "")))
8102 (clobber (match_scratch:BFP 0 "=f"))]
8103 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8105 [(set_attr "op_type" "RRE")
8106 (set_attr "type" "fsimp<mode>")])
8109 (define_insn "*abs<mode>2_nocc"
8110 [(set (match_operand:FP 0 "register_operand" "=f")
8111 (abs:FP (match_operand:FP 1 "register_operand" "<fT0>")))]
8114 [(set_attr "op_type" "RRE")
8115 (set_attr "type" "fsimp<mode>")])
8117 ; lpxbr, lpdbr, lpebr
8118 ; FIXME: wflpdb does not clobber cc
8119 (define_insn "*abs<mode>2"
8120 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
8121 (abs:BFP (match_operand:BFP 1 "register_operand" "f,<vf>")))
8122 (clobber (reg:CC CC_REGNUM))]
8127 [(set_attr "op_type" "RRE,VRR")
8128 (set_attr "cpu_facility" "*,vec")
8129 (set_attr "type" "fsimp<mode>,*")])
8133 ;;- Negated absolute value instructions
8140 (define_insn "*negabsdi2_sign_cc"
8141 [(set (reg CC_REGNUM)
8142 (compare (neg:DI (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
8143 (match_operand:SI 1 "register_operand" "d") 0)
8144 (const_int 32)) (const_int 32))))
8146 (set (match_operand:DI 0 "register_operand" "=d")
8147 (neg:DI (abs:DI (sign_extend:DI (match_dup 1)))))]
8148 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
8150 [(set_attr "op_type" "RRE")
8151 (set_attr "z10prop" "z10_c")])
8153 (define_insn "*negabsdi2_sign"
8154 [(set (match_operand:DI 0 "register_operand" "=d")
8155 (neg:DI (abs:DI (sign_extend:DI
8156 (match_operand:SI 1 "register_operand" "d")))))
8157 (clobber (reg:CC CC_REGNUM))]
8160 [(set_attr "op_type" "RRE")
8161 (set_attr "z10prop" "z10_c")])
8164 (define_insn "*negabs<mode>2_cc"
8165 [(set (reg CC_REGNUM)
8166 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8168 (set (match_operand:GPR 0 "register_operand" "=d")
8169 (neg:GPR (abs:GPR (match_dup 1))))]
8170 "s390_match_ccmode (insn, CCAmode)"
8172 [(set_attr "op_type" "RR<E>")
8173 (set_attr "z10prop" "z10_c")])
8176 (define_insn "*negabs<mode>2_cconly"
8177 [(set (reg CC_REGNUM)
8178 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8180 (clobber (match_scratch:GPR 0 "=d"))]
8181 "s390_match_ccmode (insn, CCAmode)"
8183 [(set_attr "op_type" "RR<E>")
8184 (set_attr "z10prop" "z10_c")])
8187 (define_insn "*negabs<mode>2"
8188 [(set (match_operand:GPR 0 "register_operand" "=d")
8189 (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d"))))
8190 (clobber (reg:CC CC_REGNUM))]
8193 [(set_attr "op_type" "RR<E>")
8194 (set_attr "z10prop" "z10_c")])
8200 ; lnxbr, lndbr, lnebr
8201 (define_insn "*negabs<mode>2_cc"
8202 [(set (reg CC_REGNUM)
8203 (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8204 (match_operand:BFP 2 "const0_operand" "")))
8205 (set (match_operand:BFP 0 "register_operand" "=f")
8206 (neg:BFP (abs:BFP (match_dup 1))))]
8207 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8209 [(set_attr "op_type" "RRE")
8210 (set_attr "type" "fsimp<mode>")])
8212 ; lnxbr, lndbr, lnebr
8213 (define_insn "*negabs<mode>2_cconly"
8214 [(set (reg CC_REGNUM)
8215 (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8216 (match_operand:BFP 2 "const0_operand" "")))
8217 (clobber (match_scratch:BFP 0 "=f"))]
8218 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8220 [(set_attr "op_type" "RRE")
8221 (set_attr "type" "fsimp<mode>")])
8224 (define_insn "*negabs<mode>2_nocc"
8225 [(set (match_operand:FP 0 "register_operand" "=f")
8226 (neg:FP (abs:FP (match_operand:BFP 1 "register_operand" "<fT0>"))))]
8229 [(set_attr "op_type" "RRE")
8230 (set_attr "type" "fsimp<mode>")])
8232 ; lnxbr, lndbr, lnebr
8233 ; FIXME: wflndb does not clobber cc
8234 (define_insn "*negabs<mode>2"
8235 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
8236 (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f,<vf>"))))
8237 (clobber (reg:CC CC_REGNUM))]
8242 [(set_attr "op_type" "RRE,VRR")
8243 (set_attr "cpu_facility" "*,vec")
8244 (set_attr "type" "fsimp<mode>,*")])
8247 ;;- Square root instructions.
8251 ; sqrt(df|sf)2 instruction pattern(s).
8254 ; sqxbr, sqdbr, sqebr, sqdb, sqeb
8255 (define_insn "sqrt<mode>2"
8256 [(set (match_operand:BFP 0 "register_operand" "=f, f,<vf>")
8257 (sqrt:BFP (match_operand:BFP 1 "general_operand" "f,<Rf>,<vf>")))]
8263 [(set_attr "op_type" "RRE,RXE,VRR")
8264 (set_attr "type" "fsqrt<mode>")
8265 (set_attr "cpu_facility" "*,*,vec")])
8269 ;;- One complement instructions.
8273 ; one_cmpl(di|si|hi|qi)2 instruction pattern(s).
8276 (define_expand "one_cmpl<mode>2"
8278 [(set (match_operand:INT 0 "register_operand" "")
8279 (xor:INT (match_operand:INT 1 "register_operand" "")
8281 (clobber (reg:CC CC_REGNUM))])]
8287 ;; Find leftmost bit instructions.
8290 (define_expand "clzdi2"
8291 [(set (match_operand:DI 0 "register_operand" "=d")
8292 (clz:DI (match_operand:DI 1 "register_operand" "d")))]
8293 "TARGET_EXTIMM && TARGET_ZARCH"
8295 rtx insn, clz_equal;
8296 rtx wide_reg = gen_reg_rtx (TImode);
8297 rtx msb = gen_rtx_CONST_INT (DImode, (unsigned HOST_WIDE_INT) 1 << 63);
8299 clz_equal = gen_rtx_CLZ (DImode, operands[1]);
8301 emit_insn (gen_clztidi2 (wide_reg, operands[1], msb));
8303 insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg));
8304 set_unique_reg_note (insn, REG_EQUAL, clz_equal);
8309 (define_insn "clztidi2"
8310 [(set (match_operand:TI 0 "register_operand" "=d")
8314 (xor:DI (match_operand:DI 1 "register_operand" "d")
8315 (lshiftrt (match_operand:DI 2 "const_int_operand" "")
8316 (subreg:SI (clz:DI (match_dup 1)) 4))))
8319 (zero_extend:TI (clz:DI (match_dup 1)))))
8320 (clobber (reg:CC CC_REGNUM))]
8321 "(unsigned HOST_WIDE_INT) INTVAL (operands[2])
8322 == (unsigned HOST_WIDE_INT) 1 << 63
8323 && TARGET_EXTIMM && TARGET_ZARCH"
8325 [(set_attr "op_type" "RRE")])
8329 ;;- Rotate instructions.
8333 ; rotl(di|si)3 instruction pattern(s).
8337 (define_insn "rotl<mode>3"
8338 [(set (match_operand:GPR 0 "register_operand" "=d")
8339 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
8340 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
8343 [(set_attr "op_type" "RSE")
8344 (set_attr "atype" "reg")
8345 (set_attr "z10prop" "z10_super_E1")])
8348 (define_insn "*rotl<mode>3_and"
8349 [(set (match_operand:GPR 0 "register_operand" "=d")
8350 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
8351 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8352 (match_operand:SI 3 "const_int_operand" "n"))))]
8353 "TARGET_CPU_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8355 [(set_attr "op_type" "RSE")
8356 (set_attr "atype" "reg")
8357 (set_attr "z10prop" "z10_super_E1")])
8361 ;;- Shift instructions.
8365 ; (ashl|lshr)(di|si)3 instruction pattern(s).
8366 ; Left shifts and logical right shifts
8368 (define_expand "<shift><mode>3"
8369 [(set (match_operand:DSI 0 "register_operand" "")
8370 (SHIFT:DSI (match_operand:DSI 1 "register_operand" "")
8371 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))]
8376 (define_insn "*<shift>di3_31"
8377 [(set (match_operand:DI 0 "register_operand" "=d")
8378 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
8379 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
8382 [(set_attr "op_type" "RS")
8383 (set_attr "atype" "reg")
8384 (set_attr "z196prop" "z196_cracked")])
8386 ; sll, srl, sllg, srlg, sllk, srlk
8387 (define_insn "*<shift><mode>3"
8388 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8389 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8390 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")))]
8393 s<lr>l<g>\t%0,<1>%Y2
8394 s<lr>l<gk>\t%0,%1,%Y2"
8395 [(set_attr "op_type" "RS<E>,RSY")
8396 (set_attr "atype" "reg,reg")
8397 (set_attr "cpu_facility" "*,z196")
8398 (set_attr "z10prop" "z10_super_E1,*")])
8401 (define_insn "*<shift>di3_31_and"
8402 [(set (match_operand:DI 0 "register_operand" "=d")
8403 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
8404 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8405 (match_operand:SI 3 "const_int_operand" "n"))))]
8406 "!TARGET_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8408 [(set_attr "op_type" "RS")
8409 (set_attr "atype" "reg")])
8411 ; sll, srl, sllg, srlg, sllk, srlk
8412 (define_insn "*<shift><mode>3_and"
8413 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8414 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8415 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8416 (match_operand:SI 3 "const_int_operand" "n,n"))))]
8417 "(INTVAL (operands[3]) & 63) == 63"
8419 s<lr>l<g>\t%0,<1>%Y2
8420 s<lr>l<gk>\t%0,%1,%Y2"
8421 [(set_attr "op_type" "RS<E>,RSY")
8422 (set_attr "atype" "reg,reg")
8423 (set_attr "cpu_facility" "*,z196")
8424 (set_attr "z10prop" "z10_super_E1,*")])
8427 ; ashr(di|si)3 instruction pattern(s).
8428 ; Arithmetic right shifts
8430 (define_expand "ashr<mode>3"
8432 [(set (match_operand:DSI 0 "register_operand" "")
8433 (ashiftrt:DSI (match_operand:DSI 1 "register_operand" "")
8434 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))
8435 (clobber (reg:CC CC_REGNUM))])]
8439 (define_insn "*ashrdi3_cc_31"
8440 [(set (reg CC_REGNUM)
8441 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8442 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
8444 (set (match_operand:DI 0 "register_operand" "=d")
8445 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8446 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)"
8448 [(set_attr "op_type" "RS")
8449 (set_attr "atype" "reg")])
8451 (define_insn "*ashrdi3_cconly_31"
8452 [(set (reg CC_REGNUM)
8453 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8454 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
8456 (clobber (match_scratch:DI 0 "=d"))]
8457 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)"
8459 [(set_attr "op_type" "RS")
8460 (set_attr "atype" "reg")])
8462 (define_insn "*ashrdi3_31"
8463 [(set (match_operand:DI 0 "register_operand" "=d")
8464 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8465 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))
8466 (clobber (reg:CC CC_REGNUM))]
8469 [(set_attr "op_type" "RS")
8470 (set_attr "atype" "reg")])
8473 (define_insn "*ashr<mode>3_cc"
8474 [(set (reg CC_REGNUM)
8475 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8476 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y"))
8478 (set (match_operand:GPR 0 "register_operand" "=d,d")
8479 (ashiftrt:GPR (match_dup 1) (match_dup 2)))]
8480 "s390_match_ccmode(insn, CCSmode)"
8484 [(set_attr "op_type" "RS<E>,RSY")
8485 (set_attr "atype" "reg,reg")
8486 (set_attr "cpu_facility" "*,z196")
8487 (set_attr "z10prop" "z10_super_E1,*")])
8490 (define_insn "*ashr<mode>3_cconly"
8491 [(set (reg CC_REGNUM)
8492 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8493 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y"))
8495 (clobber (match_scratch:GPR 0 "=d,d"))]
8496 "s390_match_ccmode(insn, CCSmode)"
8500 [(set_attr "op_type" "RS<E>,RSY")
8501 (set_attr "atype" "reg,reg")
8502 (set_attr "cpu_facility" "*,z196")
8503 (set_attr "z10prop" "z10_super_E1,*")])
8506 (define_insn "*ashr<mode>3"
8507 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8508 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8509 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")))
8510 (clobber (reg:CC CC_REGNUM))]
8515 [(set_attr "op_type" "RS<E>,RSY")
8516 (set_attr "atype" "reg,reg")
8517 (set_attr "cpu_facility" "*,z196")
8518 (set_attr "z10prop" "z10_super_E1,*")])
8521 ; shift pattern with implicit ANDs
8523 (define_insn "*ashrdi3_cc_31_and"
8524 [(set (reg CC_REGNUM)
8525 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8526 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8527 (match_operand:SI 3 "const_int_operand" "n")))
8529 (set (match_operand:DI 0 "register_operand" "=d")
8530 (ashiftrt:DI (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
8531 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)
8532 && (INTVAL (operands[3]) & 63) == 63"
8534 [(set_attr "op_type" "RS")
8535 (set_attr "atype" "reg")])
8537 (define_insn "*ashrdi3_cconly_31_and"
8538 [(set (reg CC_REGNUM)
8539 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8540 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8541 (match_operand:SI 3 "const_int_operand" "n")))
8543 (clobber (match_scratch:DI 0 "=d"))]
8544 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)
8545 && (INTVAL (operands[3]) & 63) == 63"
8547 [(set_attr "op_type" "RS")
8548 (set_attr "atype" "reg")])
8550 (define_insn "*ashrdi3_31_and"
8551 [(set (match_operand:DI 0 "register_operand" "=d")
8552 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8553 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8554 (match_operand:SI 3 "const_int_operand" "n"))))
8555 (clobber (reg:CC CC_REGNUM))]
8556 "!TARGET_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8558 [(set_attr "op_type" "RS")
8559 (set_attr "atype" "reg")])
8562 (define_insn "*ashr<mode>3_cc_and"
8563 [(set (reg CC_REGNUM)
8564 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8565 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8566 (match_operand:SI 3 "const_int_operand" "n,n")))
8568 (set (match_operand:GPR 0 "register_operand" "=d,d")
8569 (ashiftrt:GPR (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
8570 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
8574 [(set_attr "op_type" "RS<E>,RSY")
8575 (set_attr "atype" "reg,reg")
8576 (set_attr "cpu_facility" "*,z196")
8577 (set_attr "z10prop" "z10_super_E1,*")])
8580 (define_insn "*ashr<mode>3_cconly_and"
8581 [(set (reg CC_REGNUM)
8582 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8583 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8584 (match_operand:SI 3 "const_int_operand" "n,n")))
8586 (clobber (match_scratch:GPR 0 "=d,d"))]
8587 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
8591 [(set_attr "op_type" "RS<E>,RSY")
8592 (set_attr "atype" "reg,reg")
8593 (set_attr "cpu_facility" "*,z196")
8594 (set_attr "z10prop" "z10_super_E1,*")])
8597 (define_insn "*ashr<mode>3_and"
8598 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8599 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8600 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8601 (match_operand:SI 3 "const_int_operand" "n,n"))))
8602 (clobber (reg:CC CC_REGNUM))]
8603 "(INTVAL (operands[3]) & 63) == 63"
8607 [(set_attr "op_type" "RS<E>,RSY")
8608 (set_attr "atype" "reg,reg")
8609 (set_attr "cpu_facility" "*,z196")
8610 (set_attr "z10prop" "z10_super_E1,*")])
8614 ;; Branch instruction patterns.
8617 (define_expand "cbranch<mode>4"
8619 (if_then_else (match_operator 0 "comparison_operator"
8620 [(match_operand:GPR 1 "register_operand" "")
8621 (match_operand:GPR 2 "general_operand" "")])
8622 (label_ref (match_operand 3 "" ""))
8625 "s390_emit_jump (operands[3],
8626 s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2]));
8629 (define_expand "cbranch<mode>4"
8631 (if_then_else (match_operator 0 "comparison_operator"
8632 [(match_operand:FP 1 "register_operand" "")
8633 (match_operand:FP 2 "general_operand" "")])
8634 (label_ref (match_operand 3 "" ""))
8637 "s390_emit_jump (operands[3],
8638 s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2]));
8641 (define_expand "cbranchcc4"
8643 (if_then_else (match_operator 0 "s390_comparison"
8644 [(match_operand 1 "cc_reg_operand" "")
8645 (match_operand 2 "const_int_operand" "")])
8646 (label_ref (match_operand 3 "" ""))
8653 ;;- Conditional jump instructions.
8656 (define_insn "*cjump_64"
8659 (match_operator 1 "s390_comparison" [(reg CC_REGNUM)
8660 (match_operand 2 "const_int_operand" "")])
8661 (label_ref (match_operand 0 "" ""))
8665 if (get_attr_length (insn) == 4)
8668 return "jg%C1\t%l0";
8670 [(set_attr "op_type" "RI")
8671 (set_attr "type" "branch")
8672 (set (attr "length")
8673 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8674 (const_int 4) (const_int 6)))])
8676 (define_insn "*cjump_31"
8679 (match_operator 1 "s390_comparison" [(reg CC_REGNUM)
8680 (match_operand 2 "const_int_operand" "")])
8681 (label_ref (match_operand 0 "" ""))
8685 gcc_assert (get_attr_length (insn) == 4);
8688 [(set_attr "op_type" "RI")
8689 (set_attr "type" "branch")
8690 (set (attr "length")
8691 (if_then_else (not (match_test "flag_pic"))
8692 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8693 (const_int 4) (const_int 6))
8694 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8695 (const_int 4) (const_int 8))))])
8697 (define_insn "*cjump_long"
8700 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8701 (match_operand 0 "address_operand" "ZQZR")
8705 if (get_attr_op_type (insn) == OP_TYPE_RR)
8710 [(set (attr "op_type")
8711 (if_then_else (match_operand 0 "register_operand" "")
8712 (const_string "RR") (const_string "RX")))
8713 (set_attr "type" "branch")
8714 (set_attr "atype" "agen")])
8716 ;; A conditional return instruction.
8717 (define_insn "*c<code>"
8720 (match_operator 0 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8723 "s390_can_use_<code>_insn ()"
8725 [(set_attr "op_type" "RR")
8726 (set_attr "type" "jsr")
8727 (set_attr "atype" "agen")])
8730 ;;- Negated conditional jump instructions.
8733 (define_insn "*icjump_64"
8736 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8738 (label_ref (match_operand 0 "" ""))))]
8741 if (get_attr_length (insn) == 4)
8744 return "jg%D1\t%l0";
8746 [(set_attr "op_type" "RI")
8747 (set_attr "type" "branch")
8748 (set (attr "length")
8749 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8750 (const_int 4) (const_int 6)))])
8752 (define_insn "*icjump_31"
8755 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8757 (label_ref (match_operand 0 "" ""))))]
8760 gcc_assert (get_attr_length (insn) == 4);
8763 [(set_attr "op_type" "RI")
8764 (set_attr "type" "branch")
8765 (set (attr "length")
8766 (if_then_else (not (match_test "flag_pic"))
8767 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8768 (const_int 4) (const_int 6))
8769 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8770 (const_int 4) (const_int 8))))])
8772 (define_insn "*icjump_long"
8775 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8777 (match_operand 0 "address_operand" "ZQZR")))]
8780 if (get_attr_op_type (insn) == OP_TYPE_RR)
8785 [(set (attr "op_type")
8786 (if_then_else (match_operand 0 "register_operand" "")
8787 (const_string "RR") (const_string "RX")))
8788 (set_attr "type" "branch")
8789 (set_attr "atype" "agen")])
8792 ;;- Trap instructions.
8796 [(trap_if (const_int 1) (const_int 0))]
8799 [(set_attr "op_type" "RI")
8800 (set_attr "type" "branch")])
8802 (define_expand "ctrap<mode>4"
8803 [(trap_if (match_operator 0 "comparison_operator"
8804 [(match_operand:GPR 1 "register_operand" "")
8805 (match_operand:GPR 2 "general_operand" "")])
8806 (match_operand 3 "const0_operand" ""))]
8809 rtx cond = s390_emit_compare (GET_CODE (operands[0]),
8810 operands[1], operands[2]);
8811 emit_insn (gen_condtrap (cond, XEXP (cond, 0)));
8815 (define_expand "ctrap<mode>4"
8816 [(trap_if (match_operator 0 "comparison_operator"
8817 [(match_operand:FP 1 "register_operand" "")
8818 (match_operand:FP 2 "general_operand" "")])
8819 (match_operand 3 "const0_operand" ""))]
8822 rtx cond = s390_emit_compare (GET_CODE (operands[0]),
8823 operands[1], operands[2]);
8824 emit_insn (gen_condtrap (cond, XEXP (cond, 0)));
8828 (define_insn "condtrap"
8829 [(trap_if (match_operator 0 "s390_comparison"
8830 [(match_operand 1 "cc_reg_operand" "c")
8835 [(set_attr "op_type" "RI")
8836 (set_attr "type" "branch")])
8838 ; crt, cgrt, cit, cgit
8839 (define_insn "*cmp_and_trap_signed_int<mode>"
8840 [(trap_if (match_operator 0 "s390_signed_integer_comparison"
8841 [(match_operand:GPR 1 "register_operand" "d,d")
8842 (match_operand:GPR 2 "nonmemory_operand" "d,K")])
8848 [(set_attr "op_type" "RRF,RIE")
8849 (set_attr "type" "branch")
8850 (set_attr "z10prop" "z10_super_c,z10_super")])
8852 ; clrt, clgrt, clfit, clgit, clt, clgt
8853 (define_insn "*cmp_and_trap_unsigned_int<mode>"
8854 [(trap_if (match_operator 0 "s390_unsigned_integer_comparison"
8855 [(match_operand:GPR 1 "register_operand" "d,d, d")
8856 (match_operand:GPR 2 "general_operand" "d,D,RT")])
8863 [(set_attr "op_type" "RRF,RIE,RSY")
8864 (set_attr "type" "branch")
8865 (set_attr "z10prop" "z10_super_c,z10_super,*")
8866 (set_attr "cpu_facility" "z10,z10,zEC12")])
8869 (define_insn "*load_and_trap<mode>"
8870 [(trap_if (eq (match_operand:GPR 0 "memory_operand" "RT")
8873 (set (match_operand:GPR 1 "register_operand" "=d")
8877 [(set_attr "op_type" "RXY")])
8881 ;;- Loop instructions.
8883 ;; This is all complicated by the fact that since this is a jump insn
8884 ;; we must handle our own output reloads.
8888 ; This splitter will be matched by combine and has to add the 2 moves
8889 ; necessary to load the compare and the increment values into a
8890 ; register pair as needed by brxle.
8892 (define_insn_and_split "*brx_stage1_<GPR:mode>"
8895 (match_operator 6 "s390_brx_operator"
8896 [(plus:GPR (match_operand:GPR 1 "register_operand" "")
8897 (match_operand:GPR 2 "general_operand" ""))
8898 (match_operand:GPR 3 "register_operand" "")])
8899 (label_ref (match_operand 0 "" ""))
8901 (set (match_operand:GPR 4 "nonimmediate_operand" "")
8902 (plus:GPR (match_dup 1) (match_dup 2)))
8903 (clobber (match_scratch:GPR 5 ""))]
8906 "!reload_completed && !reload_in_progress"
8907 [(set (match_dup 7) (match_dup 2)) ; the increment
8908 (set (match_dup 8) (match_dup 3)) ; the comparison value
8909 (parallel [(set (pc)
8912 [(plus:GPR (match_dup 1) (match_dup 7))
8914 (label_ref (match_dup 0))
8917 (plus:GPR (match_dup 1) (match_dup 7)))
8918 (clobber (match_dup 5))
8919 (clobber (reg:CC CC_REGNUM))])]
8921 rtx dreg = gen_reg_rtx (word_mode == DImode ? TImode : DImode);
8922 operands[7] = gen_lowpart (<GPR:MODE>mode,
8923 gen_highpart (word_mode, dreg));
8924 operands[8] = gen_lowpart (<GPR:MODE>mode,
8925 gen_lowpart (word_mode, dreg));
8930 (define_insn_and_split "*brxg_64bit"
8933 (match_operator 5 "s390_brx_operator"
8934 [(plus:DI (match_operand:DI 1 "register_operand" "d,d,d")
8935 (subreg:DI (match_operand:TI 2 "register_operand" "d,d,d") 0))
8936 (subreg:DI (match_dup 2) 8)])
8937 (label_ref (match_operand 0 "" ""))
8939 (set (match_operand:DI 3 "nonimmediate_operand" "=1,?X,?X")
8940 (plus:DI (match_dup 1)
8941 (subreg:DI (match_dup 2) 0)))
8942 (clobber (match_scratch:DI 4 "=X,&1,&?d"))
8943 (clobber (reg:CC CC_REGNUM))]
8946 if (which_alternative != 0)
8948 else if (get_attr_length (insn) == 6)
8949 return "brx%E5g\t%1,%2,%l0";
8951 return "agr\t%1,%2\;cgr\t%1,%M2\;jg%C5\t%l0";
8953 "&& reload_completed
8954 && (!REG_P (operands[3])
8955 || !rtx_equal_p (operands[1], operands[3]))"
8956 [(set (match_dup 4) (match_dup 1))
8957 (parallel [(set (match_dup 4) (plus:DI (match_dup 4) (subreg:DI (match_dup 2) 0)))
8958 (clobber (reg:CC CC_REGNUM))])
8959 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:DI (match_dup 2) 8)))
8960 (set (match_dup 3) (match_dup 4))
8961 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
8962 (label_ref (match_dup 0))
8965 [(set_attr "op_type" "RIE")
8966 (set_attr "type" "branch")
8967 (set (attr "length")
8968 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8969 (const_int 6) (const_int 16)))])
8973 (define_insn_and_split "*brx_64bit"
8976 (match_operator 5 "s390_brx_operator"
8977 [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d")
8978 (subreg:SI (match_operand:TI 2 "register_operand" "d,d,d") 4))
8979 (subreg:SI (match_dup 2) 12)])
8980 (label_ref (match_operand 0 "" ""))
8982 (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X")
8983 (plus:SI (match_dup 1)
8984 (subreg:SI (match_dup 2) 4)))
8985 (clobber (match_scratch:SI 4 "=X,&1,&?d"))
8986 (clobber (reg:CC CC_REGNUM))]
8989 if (which_alternative != 0)
8991 else if (get_attr_length (insn) == 6)
8992 return "brx%C5\t%1,%2,%l0";
8994 return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0";
8996 "&& reload_completed
8997 && (!REG_P (operands[3])
8998 || !rtx_equal_p (operands[1], operands[3]))"
8999 [(set (match_dup 4) (match_dup 1))
9000 (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 4)))
9001 (clobber (reg:CC CC_REGNUM))])
9002 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 12)))
9003 (set (match_dup 3) (match_dup 4))
9004 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
9005 (label_ref (match_dup 0))
9008 [(set_attr "op_type" "RSI")
9009 (set_attr "type" "branch")
9010 (set (attr "length")
9011 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9012 (const_int 6) (const_int 14)))])
9016 (define_insn_and_split "*brx_31bit"
9019 (match_operator 5 "s390_brx_operator"
9020 [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d")
9021 (subreg:SI (match_operand:DI 2 "register_operand" "d,d,d") 0))
9022 (subreg:SI (match_dup 2) 4)])
9023 (label_ref (match_operand 0 "" ""))
9025 (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X")
9026 (plus:SI (match_dup 1)
9027 (subreg:SI (match_dup 2) 0)))
9028 (clobber (match_scratch:SI 4 "=X,&1,&?d"))
9029 (clobber (reg:CC CC_REGNUM))]
9030 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
9032 if (which_alternative != 0)
9034 else if (get_attr_length (insn) == 6)
9035 return "brx%C5\t%1,%2,%l0";
9037 return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0";
9039 "&& reload_completed
9040 && (!REG_P (operands[3])
9041 || !rtx_equal_p (operands[1], operands[3]))"
9042 [(set (match_dup 4) (match_dup 1))
9043 (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 0)))
9044 (clobber (reg:CC CC_REGNUM))])
9045 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 4)))
9046 (set (match_dup 3) (match_dup 4))
9047 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
9048 (label_ref (match_dup 0))
9051 [(set_attr "op_type" "RSI")
9052 (set_attr "type" "branch")
9053 (set (attr "length")
9054 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9055 (const_int 6) (const_int 14)))])
9060 (define_expand "doloop_end"
9061 [(use (match_operand 0 "" "")) ; loop pseudo
9062 (use (match_operand 1 "" ""))] ; label
9065 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
9066 emit_jump_insn (gen_doloop_si31 (operands[1], operands[0], operands[0]));
9067 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
9068 emit_jump_insn (gen_doloop_si64 (operands[1], operands[0], operands[0]));
9069 else if (GET_MODE (operands[0]) == DImode && TARGET_ZARCH)
9070 emit_jump_insn (gen_doloop_di (operands[1], operands[0], operands[0]));
9077 (define_insn_and_split "doloop_si64"
9080 (ne (match_operand:SI 1 "register_operand" "d,d,d")
9082 (label_ref (match_operand 0 "" ""))
9084 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?X,?X")
9085 (plus:SI (match_dup 1) (const_int -1)))
9086 (clobber (match_scratch:SI 3 "=X,&1,&?d"))
9087 (clobber (reg:CC CC_REGNUM))]
9090 if (which_alternative != 0)
9092 else if (get_attr_length (insn) == 4)
9093 return "brct\t%1,%l0";
9095 return "ahi\t%1,-1\;jgne\t%l0";
9097 "&& reload_completed
9098 && (! REG_P (operands[2])
9099 || ! rtx_equal_p (operands[1], operands[2]))"
9100 [(set (match_dup 3) (match_dup 1))
9101 (parallel [(set (reg:CCAN CC_REGNUM)
9102 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
9104 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
9105 (set (match_dup 2) (match_dup 3))
9106 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9107 (label_ref (match_dup 0))
9110 [(set_attr "op_type" "RI")
9111 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9112 ; hurt us in the (rare) case of ahi.
9113 (set_attr "z10prop" "z10_super_E1")
9114 (set_attr "type" "branch")
9115 (set (attr "length")
9116 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9117 (const_int 4) (const_int 10)))])
9119 (define_insn_and_split "doloop_si31"
9122 (ne (match_operand:SI 1 "register_operand" "d,d,d")
9124 (label_ref (match_operand 0 "" ""))
9126 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?X,?X")
9127 (plus:SI (match_dup 1) (const_int -1)))
9128 (clobber (match_scratch:SI 3 "=X,&1,&?d"))
9129 (clobber (reg:CC CC_REGNUM))]
9132 if (which_alternative != 0)
9134 else if (get_attr_length (insn) == 4)
9135 return "brct\t%1,%l0";
9139 "&& reload_completed
9140 && (! REG_P (operands[2])
9141 || ! rtx_equal_p (operands[1], operands[2]))"
9142 [(set (match_dup 3) (match_dup 1))
9143 (parallel [(set (reg:CCAN CC_REGNUM)
9144 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
9146 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
9147 (set (match_dup 2) (match_dup 3))
9148 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9149 (label_ref (match_dup 0))
9152 [(set_attr "op_type" "RI")
9153 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9154 ; hurt us in the (rare) case of ahi.
9155 (set_attr "z10prop" "z10_super_E1")
9156 (set_attr "type" "branch")
9157 (set (attr "length")
9158 (if_then_else (not (match_test "flag_pic"))
9159 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9160 (const_int 4) (const_int 6))
9161 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9162 (const_int 4) (const_int 8))))])
9164 (define_insn "*doloop_si_long"
9167 (ne (match_operand:SI 1 "register_operand" "d")
9169 (match_operand 0 "address_operand" "ZQZR")
9171 (set (match_operand:SI 2 "register_operand" "=1")
9172 (plus:SI (match_dup 1) (const_int -1)))
9173 (clobber (match_scratch:SI 3 "=X"))
9174 (clobber (reg:CC CC_REGNUM))]
9177 if (get_attr_op_type (insn) == OP_TYPE_RR)
9178 return "bctr\t%1,%0";
9180 return "bct\t%1,%a0";
9182 [(set (attr "op_type")
9183 (if_then_else (match_operand 0 "register_operand" "")
9184 (const_string "RR") (const_string "RX")))
9185 (set_attr "type" "branch")
9186 (set_attr "atype" "agen")
9187 (set_attr "z10prop" "z10_c")
9188 (set_attr "z196prop" "z196_cracked")])
9190 (define_insn_and_split "doloop_di"
9193 (ne (match_operand:DI 1 "register_operand" "d,d,d")
9195 (label_ref (match_operand 0 "" ""))
9197 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?X,?X")
9198 (plus:DI (match_dup 1) (const_int -1)))
9199 (clobber (match_scratch:DI 3 "=X,&1,&?d"))
9200 (clobber (reg:CC CC_REGNUM))]
9203 if (which_alternative != 0)
9205 else if (get_attr_length (insn) == 4)
9206 return "brctg\t%1,%l0";
9208 return "aghi\t%1,-1\;jgne\t%l0";
9210 "&& reload_completed
9211 && (! REG_P (operands[2])
9212 || ! rtx_equal_p (operands[1], operands[2]))"
9213 [(set (match_dup 3) (match_dup 1))
9214 (parallel [(set (reg:CCAN CC_REGNUM)
9215 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
9217 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
9218 (set (match_dup 2) (match_dup 3))
9219 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9220 (label_ref (match_dup 0))
9223 [(set_attr "op_type" "RI")
9224 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9225 ; hurt us in the (rare) case of ahi.
9226 (set_attr "z10prop" "z10_super_E1")
9227 (set_attr "type" "branch")
9228 (set (attr "length")
9229 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9230 (const_int 4) (const_int 10)))])
9233 ;;- Unconditional jump instructions.
9237 ; jump instruction pattern(s).
9240 (define_expand "jump"
9241 [(match_operand 0 "" "")]
9243 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
9245 (define_insn "*jump64"
9246 [(set (pc) (label_ref (match_operand 0 "" "")))]
9249 if (get_attr_length (insn) == 4)
9254 [(set_attr "op_type" "RI")
9255 (set_attr "type" "branch")
9256 (set (attr "length")
9257 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9258 (const_int 4) (const_int 6)))])
9260 (define_insn "*jump31"
9261 [(set (pc) (label_ref (match_operand 0 "" "")))]
9264 gcc_assert (get_attr_length (insn) == 4);
9267 [(set_attr "op_type" "RI")
9268 (set_attr "type" "branch")
9269 (set (attr "length")
9270 (if_then_else (not (match_test "flag_pic"))
9271 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9272 (const_int 4) (const_int 6))
9273 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9274 (const_int 4) (const_int 8))))])
9277 ; indirect-jump instruction pattern(s).
9280 (define_insn "indirect_jump"
9281 [(set (pc) (match_operand 0 "address_operand" "ZQZR"))]
9284 if (get_attr_op_type (insn) == OP_TYPE_RR)
9289 [(set (attr "op_type")
9290 (if_then_else (match_operand 0 "register_operand" "")
9291 (const_string "RR") (const_string "RX")))
9292 (set_attr "type" "branch")
9293 (set_attr "atype" "agen")])
9296 ; casesi instruction pattern(s).
9299 (define_insn "casesi_jump"
9300 [(set (pc) (match_operand 0 "address_operand" "ZQZR"))
9301 (use (label_ref (match_operand 1 "" "")))]
9304 if (get_attr_op_type (insn) == OP_TYPE_RR)
9309 [(set (attr "op_type")
9310 (if_then_else (match_operand 0 "register_operand" "")
9311 (const_string "RR") (const_string "RX")))
9312 (set_attr "type" "branch")
9313 (set_attr "atype" "agen")])
9315 (define_expand "casesi"
9316 [(match_operand:SI 0 "general_operand" "")
9317 (match_operand:SI 1 "general_operand" "")
9318 (match_operand:SI 2 "general_operand" "")
9319 (label_ref (match_operand 3 "" ""))
9320 (label_ref (match_operand 4 "" ""))]
9323 rtx index = gen_reg_rtx (SImode);
9324 rtx base = gen_reg_rtx (Pmode);
9325 rtx target = gen_reg_rtx (Pmode);
9327 emit_move_insn (index, operands[0]);
9328 emit_insn (gen_subsi3 (index, index, operands[1]));
9329 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
9332 if (Pmode != SImode)
9333 index = convert_to_mode (Pmode, index, 1);
9334 if (GET_CODE (index) != REG)
9335 index = copy_to_mode_reg (Pmode, index);
9338 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
9340 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
9342 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
9344 index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
9345 emit_move_insn (target, index);
9348 target = gen_rtx_PLUS (Pmode, base, target);
9349 emit_jump_insn (gen_casesi_jump (target, operands[3]));
9356 ;;- Jump to subroutine.
9361 ; untyped call instruction pattern(s).
9364 ;; Call subroutine returning any type.
9365 (define_expand "untyped_call"
9366 [(parallel [(call (match_operand 0 "" "")
9368 (match_operand 1 "" "")
9369 (match_operand 2 "" "")])]
9374 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
9376 for (i = 0; i < XVECLEN (operands[2], 0); i++)
9378 rtx set = XVECEXP (operands[2], 0, i);
9379 emit_move_insn (SET_DEST (set), SET_SRC (set));
9382 /* The optimizer does not know that the call sets the function value
9383 registers we stored in the result block. We avoid problems by
9384 claiming that all hard registers are used and clobbered at this
9386 emit_insn (gen_blockage ());
9391 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
9392 ;; all of memory. This blocks insns from being moved across this point.
9394 (define_insn "blockage"
9395 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
9398 [(set_attr "type" "none")
9399 (set_attr "length" "0")])
9405 (define_expand "sibcall"
9406 [(call (match_operand 0 "" "")
9407 (match_operand 1 "" ""))]
9410 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
9414 (define_insn "*sibcall_br"
9415 [(call (mem:QI (reg SIBCALL_REGNUM))
9416 (match_operand 0 "const_int_operand" "n"))]
9417 "SIBLING_CALL_P (insn)
9418 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
9420 [(set_attr "op_type" "RR")
9421 (set_attr "type" "branch")
9422 (set_attr "atype" "agen")])
9424 (define_insn "*sibcall_brc"
9425 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9426 (match_operand 1 "const_int_operand" "n"))]
9427 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
9429 [(set_attr "op_type" "RI")
9430 (set_attr "type" "branch")])
9432 (define_insn "*sibcall_brcl"
9433 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9434 (match_operand 1 "const_int_operand" "n"))]
9435 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
9437 [(set_attr "op_type" "RIL")
9438 (set_attr "type" "branch")])
9441 ; sibcall_value patterns
9444 (define_expand "sibcall_value"
9445 [(set (match_operand 0 "" "")
9446 (call (match_operand 1 "" "")
9447 (match_operand 2 "" "")))]
9450 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
9454 (define_insn "*sibcall_value_br"
9455 [(set (match_operand 0 "" "")
9456 (call (mem:QI (reg SIBCALL_REGNUM))
9457 (match_operand 1 "const_int_operand" "n")))]
9458 "SIBLING_CALL_P (insn)
9459 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
9461 [(set_attr "op_type" "RR")
9462 (set_attr "type" "branch")
9463 (set_attr "atype" "agen")])
9465 (define_insn "*sibcall_value_brc"
9466 [(set (match_operand 0 "" "")
9467 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9468 (match_operand 2 "const_int_operand" "n")))]
9469 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
9471 [(set_attr "op_type" "RI")
9472 (set_attr "type" "branch")])
9474 (define_insn "*sibcall_value_brcl"
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_CPU_ZARCH"
9480 [(set_attr "op_type" "RIL")
9481 (set_attr "type" "branch")])
9485 ; call instruction pattern(s).
9488 (define_expand "call"
9489 [(call (match_operand 0 "" "")
9490 (match_operand 1 "" ""))
9491 (use (match_operand 2 "" ""))]
9494 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
9495 gen_rtx_REG (Pmode, RETURN_REGNUM));
9499 (define_insn "*bras"
9500 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9501 (match_operand 1 "const_int_operand" "n"))
9502 (clobber (match_operand 2 "register_operand" "=r"))]
9503 "!SIBLING_CALL_P (insn)
9504 && TARGET_SMALL_EXEC
9505 && GET_MODE (operands[2]) == Pmode"
9507 [(set_attr "op_type" "RI")
9508 (set_attr "type" "jsr")
9509 (set_attr "z196prop" "z196_cracked")])
9511 (define_insn "*brasl"
9512 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9513 (match_operand 1 "const_int_operand" "n"))
9514 (clobber (match_operand 2 "register_operand" "=r"))]
9515 "!SIBLING_CALL_P (insn)
9517 && GET_MODE (operands[2]) == Pmode"
9519 [(set_attr "op_type" "RIL")
9520 (set_attr "type" "jsr")
9521 (set_attr "z196prop" "z196_cracked")])
9523 (define_insn "*basr"
9524 [(call (mem:QI (match_operand 0 "address_operand" "ZQZR"))
9525 (match_operand 1 "const_int_operand" "n"))
9526 (clobber (match_operand 2 "register_operand" "=r"))]
9527 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
9529 if (get_attr_op_type (insn) == OP_TYPE_RR)
9530 return "basr\t%2,%0";
9532 return "bas\t%2,%a0";
9534 [(set (attr "op_type")
9535 (if_then_else (match_operand 0 "register_operand" "")
9536 (const_string "RR") (const_string "RX")))
9537 (set_attr "type" "jsr")
9538 (set_attr "atype" "agen")
9539 (set_attr "z196prop" "z196_cracked")])
9542 ; call_value instruction pattern(s).
9545 (define_expand "call_value"
9546 [(set (match_operand 0 "" "")
9547 (call (match_operand 1 "" "")
9548 (match_operand 2 "" "")))
9549 (use (match_operand 3 "" ""))]
9552 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
9553 gen_rtx_REG (Pmode, RETURN_REGNUM));
9557 (define_insn "*bras_r"
9558 [(set (match_operand 0 "" "")
9559 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9560 (match_operand:SI 2 "const_int_operand" "n")))
9561 (clobber (match_operand 3 "register_operand" "=r"))]
9562 "!SIBLING_CALL_P (insn)
9563 && TARGET_SMALL_EXEC
9564 && GET_MODE (operands[3]) == Pmode"
9566 [(set_attr "op_type" "RI")
9567 (set_attr "type" "jsr")
9568 (set_attr "z196prop" "z196_cracked")])
9570 (define_insn "*brasl_r"
9571 [(set (match_operand 0 "" "")
9572 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9573 (match_operand 2 "const_int_operand" "n")))
9574 (clobber (match_operand 3 "register_operand" "=r"))]
9575 "!SIBLING_CALL_P (insn)
9577 && GET_MODE (operands[3]) == Pmode"
9579 [(set_attr "op_type" "RIL")
9580 (set_attr "type" "jsr")
9581 (set_attr "z196prop" "z196_cracked")])
9583 (define_insn "*basr_r"
9584 [(set (match_operand 0 "" "")
9585 (call (mem:QI (match_operand 1 "address_operand" "ZQZR"))
9586 (match_operand 2 "const_int_operand" "n")))
9587 (clobber (match_operand 3 "register_operand" "=r"))]
9588 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
9590 if (get_attr_op_type (insn) == OP_TYPE_RR)
9591 return "basr\t%3,%1";
9593 return "bas\t%3,%a1";
9595 [(set (attr "op_type")
9596 (if_then_else (match_operand 1 "register_operand" "")
9597 (const_string "RR") (const_string "RX")))
9598 (set_attr "type" "jsr")
9599 (set_attr "atype" "agen")
9600 (set_attr "z196prop" "z196_cracked")])
9603 ;;- Thread-local storage support.
9606 (define_expand "get_thread_pointer<mode>"
9607 [(set (match_operand:P 0 "nonimmediate_operand" "") (reg:P TP_REGNUM))]
9611 (define_expand "set_thread_pointer<mode>"
9612 [(set (reg:P TP_REGNUM) (match_operand:P 0 "nonimmediate_operand" ""))
9613 (set (reg:P TP_REGNUM) (unspec_volatile:P [(reg:P TP_REGNUM)] UNSPECV_SET_TP))]
9617 (define_insn "*set_tp"
9618 [(set (reg TP_REGNUM) (unspec_volatile [(reg TP_REGNUM)] UNSPECV_SET_TP))]
9621 [(set_attr "type" "none")
9622 (set_attr "length" "0")])
9624 (define_insn "*tls_load_64"
9625 [(set (match_operand:DI 0 "register_operand" "=d")
9626 (unspec:DI [(match_operand:DI 1 "memory_operand" "RT")
9627 (match_operand:DI 2 "" "")]
9631 [(set_attr "op_type" "RXE")
9632 (set_attr "z10prop" "z10_fwd_A3")])
9634 (define_insn "*tls_load_31"
9635 [(set (match_operand:SI 0 "register_operand" "=d,d")
9636 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
9637 (match_operand:SI 2 "" "")]
9643 [(set_attr "op_type" "RX,RXY")
9644 (set_attr "type" "load")
9645 (set_attr "z10prop" "z10_fwd_A3,z10_fwd_A3")])
9647 (define_insn "*bras_tls"
9648 [(set (match_operand 0 "" "")
9649 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9650 (match_operand 2 "const_int_operand" "n")))
9651 (clobber (match_operand 3 "register_operand" "=r"))
9652 (use (match_operand 4 "" ""))]
9653 "!SIBLING_CALL_P (insn)
9654 && TARGET_SMALL_EXEC
9655 && GET_MODE (operands[3]) == Pmode"
9657 [(set_attr "op_type" "RI")
9658 (set_attr "type" "jsr")
9659 (set_attr "z196prop" "z196_cracked")])
9661 (define_insn "*brasl_tls"
9662 [(set (match_operand 0 "" "")
9663 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9664 (match_operand 2 "const_int_operand" "n")))
9665 (clobber (match_operand 3 "register_operand" "=r"))
9666 (use (match_operand 4 "" ""))]
9667 "!SIBLING_CALL_P (insn)
9669 && GET_MODE (operands[3]) == Pmode"
9671 [(set_attr "op_type" "RIL")
9672 (set_attr "type" "jsr")
9673 (set_attr "z196prop" "z196_cracked")])
9675 (define_insn "*basr_tls"
9676 [(set (match_operand 0 "" "")
9677 (call (mem:QI (match_operand 1 "address_operand" "ZQZR"))
9678 (match_operand 2 "const_int_operand" "n")))
9679 (clobber (match_operand 3 "register_operand" "=r"))
9680 (use (match_operand 4 "" ""))]
9681 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
9683 if (get_attr_op_type (insn) == OP_TYPE_RR)
9684 return "basr\t%3,%1%J4";
9686 return "bas\t%3,%a1%J4";
9688 [(set (attr "op_type")
9689 (if_then_else (match_operand 1 "register_operand" "")
9690 (const_string "RR") (const_string "RX")))
9691 (set_attr "type" "jsr")
9692 (set_attr "atype" "agen")
9693 (set_attr "z196prop" "z196_cracked")])
9696 ;;- Atomic operations
9700 ; memory barrier patterns.
9703 (define_expand "mem_signal_fence"
9704 [(match_operand:SI 0 "const_int_operand")] ;; model
9707 /* The s390 memory model is strong enough not to require any
9708 barrier in order to synchronize a thread with itself. */
9712 (define_expand "mem_thread_fence"
9713 [(match_operand:SI 0 "const_int_operand")] ;; model
9716 /* Unless this is a SEQ_CST fence, the s390 memory model is strong
9717 enough not to require barriers of any kind. */
9718 if (is_mm_seq_cst (memmodel_from_int (INTVAL (operands[0]))))
9720 rtx mem = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
9721 MEM_VOLATILE_P (mem) = 1;
9722 emit_insn (gen_mem_thread_fence_1 (mem));
9727 ; Although bcr is superscalar on Z10, this variant will never
9728 ; become part of an execution group.
9729 ; With z196 we can make use of the fast-BCR-serialization facility.
9730 ; This allows for a slightly faster sync which is sufficient for our
9732 (define_insn "mem_thread_fence_1"
9733 [(set (match_operand:BLK 0 "" "")
9734 (unspec:BLK [(match_dup 0)] UNSPEC_MB))]
9742 [(set_attr "op_type" "RR")
9743 (set_attr "mnemonic" "bcr_flush")
9744 (set_attr "z196prop" "z196_alone")])
9747 ; atomic load/store operations
9750 ; Atomic loads need not examine the memory model at all.
9751 (define_expand "atomic_load<mode>"
9752 [(match_operand:DINT 0 "register_operand") ;; output
9753 (match_operand:DINT 1 "memory_operand") ;; memory
9754 (match_operand:SI 2 "const_int_operand")] ;; model
9757 if (MEM_ALIGN (operands[1]) < GET_MODE_BITSIZE (GET_MODE (operands[1])))
9760 if (<MODE>mode == TImode)
9761 emit_insn (gen_atomic_loadti_1 (operands[0], operands[1]));
9762 else if (<MODE>mode == DImode && !TARGET_ZARCH)
9763 emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1]));
9765 emit_move_insn (operands[0], operands[1]);
9769 ; Different from movdi_31 in that we want no splitters.
9770 (define_insn "atomic_loaddi_1"
9771 [(set (match_operand:DI 0 "register_operand" "=d,d,!*f,!*f")
9772 (unspec:DI [(match_operand:DI 1 "memory_operand" "Q,S,R,T")]
9780 [(set_attr "op_type" "RS,RSY,RS,RSY")
9781 (set_attr "type" "lm,lm,floaddf,floaddf")])
9783 (define_insn "atomic_loadti_1"
9784 [(set (match_operand:TI 0 "register_operand" "=r")
9785 (unspec:TI [(match_operand:TI 1 "memory_operand" "RT")]
9789 [(set_attr "op_type" "RXY")
9790 (set_attr "type" "other")])
9792 ; Atomic stores must(?) enforce sequential consistency.
9793 (define_expand "atomic_store<mode>"
9794 [(match_operand:DINT 0 "memory_operand") ;; memory
9795 (match_operand:DINT 1 "register_operand") ;; input
9796 (match_operand:SI 2 "const_int_operand")] ;; model
9799 enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
9801 if (MEM_ALIGN (operands[0]) < GET_MODE_BITSIZE (GET_MODE (operands[0])))
9804 if (<MODE>mode == TImode)
9805 emit_insn (gen_atomic_storeti_1 (operands[0], operands[1]));
9806 else if (<MODE>mode == DImode && !TARGET_ZARCH)
9807 emit_insn (gen_atomic_storedi_1 (operands[0], operands[1]));
9809 emit_move_insn (operands[0], operands[1]);
9810 if (is_mm_seq_cst (model))
9811 emit_insn (gen_mem_thread_fence (operands[2]));
9815 ; Different from movdi_31 in that we want no splitters.
9816 (define_insn "atomic_storedi_1"
9817 [(set (match_operand:DI 0 "memory_operand" "=Q,S,R,T")
9818 (unspec:DI [(match_operand:DI 1 "register_operand" "d,d,!*f,!*f")]
9826 [(set_attr "op_type" "RS,RSY,RS,RSY")
9827 (set_attr "type" "stm,stm,fstoredf,fstoredf")])
9829 (define_insn "atomic_storeti_1"
9830 [(set (match_operand:TI 0 "memory_operand" "=RT")
9831 (unspec:TI [(match_operand:TI 1 "register_operand" "r")]
9835 [(set_attr "op_type" "RXY")
9836 (set_attr "type" "other")])
9839 ; compare and swap patterns.
9842 (define_expand "atomic_compare_and_swap<mode>"
9843 [(match_operand:SI 0 "register_operand") ;; bool success output
9844 (match_operand:DGPR 1 "nonimmediate_operand");; oldval output
9845 (match_operand:DGPR 2 "memory_operand") ;; memory
9846 (match_operand:DGPR 3 "register_operand") ;; expected intput
9847 (match_operand:DGPR 4 "register_operand") ;; newval intput
9848 (match_operand:SI 5 "const_int_operand") ;; is_weak
9849 (match_operand:SI 6 "const_int_operand") ;; success model
9850 (match_operand:SI 7 "const_int_operand")] ;; failure model
9853 rtx cc, cmp, output = operands[1];
9855 if (!register_operand (output, <MODE>mode))
9856 output = gen_reg_rtx (<MODE>mode);
9858 if (MEM_ALIGN (operands[2]) < GET_MODE_BITSIZE (GET_MODE (operands[2])))
9861 emit_insn (gen_atomic_compare_and_swap<mode>_internal
9862 (output, operands[2], operands[3], operands[4]));
9864 /* We deliberately accept non-register operands in the predicate
9865 to ensure the write back to the output operand happens *before*
9866 the store-flags code below. This makes it easier for combine
9867 to merge the store-flags code with a potential test-and-branch
9868 pattern following (immediately!) afterwards. */
9869 if (output != operands[1])
9870 emit_move_insn (operands[1], output);
9872 cc = gen_rtx_REG (CCZ1mode, CC_REGNUM);
9873 cmp = gen_rtx_EQ (SImode, cc, const0_rtx);
9874 emit_insn (gen_cstorecc4 (operands[0], cmp, cc, const0_rtx));
9878 (define_expand "atomic_compare_and_swap<mode>"
9879 [(match_operand:SI 0 "register_operand") ;; bool success output
9880 (match_operand:HQI 1 "nonimmediate_operand") ;; oldval output
9881 (match_operand:HQI 2 "memory_operand") ;; memory
9882 (match_operand:HQI 3 "general_operand") ;; expected intput
9883 (match_operand:HQI 4 "general_operand") ;; newval intput
9884 (match_operand:SI 5 "const_int_operand") ;; is_weak
9885 (match_operand:SI 6 "const_int_operand") ;; success model
9886 (match_operand:SI 7 "const_int_operand")] ;; failure model
9889 s390_expand_cs_hqi (<MODE>mode, operands[0], operands[1], operands[2],
9890 operands[3], operands[4], INTVAL (operands[5]));
9894 (define_expand "atomic_compare_and_swap<mode>_internal"
9896 [(set (match_operand:DGPR 0 "register_operand")
9897 (match_operand:DGPR 1 "memory_operand"))
9899 (unspec_volatile:DGPR
9901 (match_operand:DGPR 2 "register_operand")
9902 (match_operand:DGPR 3 "register_operand")]
9904 (set (reg:CCZ1 CC_REGNUM)
9905 (compare:CCZ1 (match_dup 1) (match_dup 2)))])]
9909 (define_insn "*atomic_compare_and_swap<mode>_1"
9910 [(set (match_operand:TDI 0 "register_operand" "=r")
9911 (match_operand:TDI 1 "memory_operand" "+QS"))
9913 (unspec_volatile:TDI
9915 (match_operand:TDI 2 "register_operand" "0")
9916 (match_operand:TDI 3 "register_operand" "r")]
9918 (set (reg:CCZ1 CC_REGNUM)
9919 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9921 "c<td>sg\t%0,%3,%S1"
9922 [(set_attr "op_type" "RSY")
9923 (set_attr "type" "sem")])
9926 (define_insn "*atomic_compare_and_swapdi_2"
9927 [(set (match_operand:DI 0 "register_operand" "=r,r")
9928 (match_operand:DI 1 "memory_operand" "+Q,S"))
9932 (match_operand:DI 2 "register_operand" "0,0")
9933 (match_operand:DI 3 "register_operand" "r,r")]
9935 (set (reg:CCZ1 CC_REGNUM)
9936 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9941 [(set_attr "op_type" "RS,RSY")
9942 (set_attr "type" "sem")])
9945 (define_insn "*atomic_compare_and_swapsi_3"
9946 [(set (match_operand:SI 0 "register_operand" "=r,r")
9947 (match_operand:SI 1 "memory_operand" "+Q,S"))
9951 (match_operand:SI 2 "register_operand" "0,0")
9952 (match_operand:SI 3 "register_operand" "r,r")]
9954 (set (reg:CCZ1 CC_REGNUM)
9955 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9960 [(set_attr "op_type" "RS,RSY")
9961 (set_attr "type" "sem")])
9964 ; Other atomic instruction patterns.
9967 ; z196 load and add, xor, or and and instructions
9969 (define_expand "atomic_fetch_<atomic><mode>"
9970 [(match_operand:GPR 0 "register_operand") ;; val out
9972 (match_operand:GPR 1 "memory_operand") ;; memory
9973 (match_operand:GPR 2 "register_operand")) ;; val in
9974 (match_operand:SI 3 "const_int_operand")] ;; model
9977 if (MEM_ALIGN (operands[1]) < GET_MODE_BITSIZE (GET_MODE (operands[1])))
9980 emit_insn (gen_atomic_fetch_<atomic><mode>_iaf
9981 (operands[0], operands[1], operands[2]));
9985 ; lan, lang, lao, laog, lax, laxg, laa, laag
9986 (define_insn "atomic_fetch_<atomic><mode>_iaf"
9987 [(set (match_operand:GPR 0 "register_operand" "=d")
9988 (match_operand:GPR 1 "memory_operand" "+QS"))
9990 (unspec_volatile:GPR
9991 [(ATOMIC_Z196:GPR (match_dup 1)
9992 (match_operand:GPR 2 "general_operand" "d"))]
9994 (clobber (reg:CC CC_REGNUM))]
9996 "la<noxa><g>\t%0,%2,%1"
9997 [(set_attr "op_type" "RSY")
9998 (set_attr "type" "sem")])
10000 ;; For SImode and larger, the optabs.c code will do just fine in
10001 ;; expanding a compare-and-swap loop. For QI/HImode, we can do
10002 ;; better by expanding our own loop.
10004 (define_expand "atomic_<atomic><mode>"
10006 (match_operand:HQI 0 "memory_operand") ;; memory
10007 (match_operand:HQI 1 "general_operand")) ;; val in
10008 (match_operand:SI 2 "const_int_operand")] ;; model
10011 s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0],
10012 operands[1], false);
10016 (define_expand "atomic_fetch_<atomic><mode>"
10017 [(match_operand:HQI 0 "register_operand") ;; val out
10019 (match_operand:HQI 1 "memory_operand") ;; memory
10020 (match_operand:HQI 2 "general_operand")) ;; val in
10021 (match_operand:SI 3 "const_int_operand")] ;; model
10024 s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
10025 operands[2], false);
10029 (define_expand "atomic_<atomic>_fetch<mode>"
10030 [(match_operand:HQI 0 "register_operand") ;; val out
10032 (match_operand:HQI 1 "memory_operand") ;; memory
10033 (match_operand:HQI 2 "general_operand")) ;; val in
10034 (match_operand:SI 3 "const_int_operand")] ;; model
10037 s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
10038 operands[2], true);
10042 (define_expand "atomic_exchange<mode>"
10043 [(match_operand:HQI 0 "register_operand") ;; val out
10044 (match_operand:HQI 1 "memory_operand") ;; memory
10045 (match_operand:HQI 2 "general_operand") ;; val in
10046 (match_operand:SI 3 "const_int_operand")] ;; model
10049 s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1],
10050 operands[2], false);
10055 ;;- Miscellaneous instructions.
10059 ; allocate stack instruction pattern(s).
10062 (define_expand "allocate_stack"
10063 [(match_operand 0 "general_operand" "")
10064 (match_operand 1 "general_operand" "")]
10067 rtx temp = gen_reg_rtx (Pmode);
10069 emit_move_insn (temp, s390_back_chain_rtx ());
10070 anti_adjust_stack (operands[1]);
10071 emit_move_insn (s390_back_chain_rtx (), temp);
10073 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10079 ; setjmp instruction pattern.
10082 (define_expand "builtin_setjmp_receiver"
10083 [(match_operand 0 "" "")]
10086 emit_insn (s390_load_got ());
10087 emit_use (pic_offset_table_rtx);
10091 ;; These patterns say how to save and restore the stack pointer. We need not
10092 ;; save the stack pointer at function level since we are careful to
10093 ;; preserve the backchain. At block level, we have to restore the backchain
10094 ;; when we restore the stack pointer.
10096 ;; For nonlocal gotos, we must save both the stack pointer and its
10097 ;; backchain and restore both. Note that in the nonlocal case, the
10098 ;; save area is a memory location.
10100 (define_expand "save_stack_function"
10101 [(match_operand 0 "general_operand" "")
10102 (match_operand 1 "general_operand" "")]
10106 (define_expand "restore_stack_function"
10107 [(match_operand 0 "general_operand" "")
10108 (match_operand 1 "general_operand" "")]
10112 (define_expand "restore_stack_block"
10113 [(match_operand 0 "register_operand" "")
10114 (match_operand 1 "register_operand" "")]
10117 rtx temp = gen_reg_rtx (Pmode);
10119 emit_move_insn (temp, s390_back_chain_rtx ());
10120 emit_move_insn (operands[0], operands[1]);
10121 emit_move_insn (s390_back_chain_rtx (), temp);
10126 (define_expand "save_stack_nonlocal"
10127 [(match_operand 0 "memory_operand" "")
10128 (match_operand 1 "register_operand" "")]
10131 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
10133 /* Copy the backchain to the first word, sp to the second and the
10134 literal pool base to the third. */
10136 rtx save_bc = adjust_address (operands[0], Pmode, 0);
10137 rtx save_sp = adjust_address (operands[0], Pmode, GET_MODE_SIZE (Pmode));
10138 rtx save_bp = adjust_address (operands[0], Pmode, 2 * GET_MODE_SIZE (Pmode));
10140 if (TARGET_BACKCHAIN)
10141 emit_move_insn (save_bc, force_reg (Pmode, s390_back_chain_rtx ()));
10143 emit_move_insn (save_sp, operands[1]);
10144 emit_move_insn (save_bp, base);
10149 (define_expand "restore_stack_nonlocal"
10150 [(match_operand 0 "register_operand" "")
10151 (match_operand 1 "memory_operand" "")]
10154 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
10155 rtx temp = NULL_RTX;
10157 /* Restore the backchain from the first word, sp from the second and the
10158 literal pool base from the third. */
10160 rtx save_bc = adjust_address (operands[1], Pmode, 0);
10161 rtx save_sp = adjust_address (operands[1], Pmode, GET_MODE_SIZE (Pmode));
10162 rtx save_bp = adjust_address (operands[1], Pmode, 2 * GET_MODE_SIZE (Pmode));
10164 if (TARGET_BACKCHAIN)
10165 temp = force_reg (Pmode, save_bc);
10167 emit_move_insn (base, save_bp);
10168 emit_move_insn (operands[0], save_sp);
10171 emit_move_insn (s390_back_chain_rtx (), temp);
10177 (define_expand "exception_receiver"
10181 s390_set_has_landing_pad_p (true);
10186 ; nop instruction pattern(s).
10193 [(set_attr "op_type" "RR")
10194 (set_attr "z10prop" "z10_fr_E1")])
10196 (define_insn "nop1"
10200 [(set_attr "op_type" "RR")])
10202 ;;- Undeletable nops (used for hotpatching)
10204 (define_insn "nop_2_byte"
10205 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_2_BYTE)]
10208 [(set_attr "op_type" "RR")])
10210 (define_insn "nop_4_byte"
10211 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_4_BYTE)]
10214 [(set_attr "op_type" "RX")])
10216 (define_insn "nop_6_byte"
10217 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_6_BYTE)]
10220 [(set_attr "op_type" "RIL")])
10224 ; Special literal pool access instruction pattern(s).
10227 (define_insn "*pool_entry"
10228 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
10229 UNSPECV_POOL_ENTRY)]
10232 machine_mode mode = GET_MODE (PATTERN (insn));
10233 unsigned int align = GET_MODE_BITSIZE (mode);
10234 s390_output_pool_entry (operands[0], mode, align);
10237 [(set (attr "length")
10238 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
10240 (define_insn "pool_align"
10241 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")]
10242 UNSPECV_POOL_ALIGN)]
10245 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
10247 (define_insn "pool_section_start"
10248 [(unspec_volatile [(const_int 1)] UNSPECV_POOL_SECTION)]
10250 ".section\t.rodata"
10251 [(set_attr "length" "0")])
10253 (define_insn "pool_section_end"
10254 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_SECTION)]
10257 [(set_attr "length" "0")])
10259 (define_insn "main_base_31_small"
10260 [(set (match_operand 0 "register_operand" "=a")
10261 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
10262 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10264 [(set_attr "op_type" "RR")
10265 (set_attr "type" "la")
10266 (set_attr "z196prop" "z196_cracked")])
10268 (define_insn "main_base_31_large"
10269 [(set (match_operand 0 "register_operand" "=a")
10270 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
10271 (set (pc) (label_ref (match_operand 2 "" "")))]
10272 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10274 [(set_attr "op_type" "RI")
10275 (set_attr "z196prop" "z196_cracked")])
10277 (define_insn "main_base_64"
10278 [(set (match_operand 0 "register_operand" "=a")
10279 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
10280 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10282 [(set_attr "op_type" "RIL")
10283 (set_attr "type" "larl")
10284 (set_attr "z10prop" "z10_fwd_A1")])
10286 (define_insn "main_pool"
10287 [(set (match_operand 0 "register_operand" "=a")
10288 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
10289 "GET_MODE (operands[0]) == Pmode"
10291 gcc_unreachable ();
10293 [(set (attr "type")
10294 (if_then_else (match_test "TARGET_CPU_ZARCH")
10295 (const_string "larl") (const_string "la")))])
10297 (define_insn "reload_base_31"
10298 [(set (match_operand 0 "register_operand" "=a")
10299 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
10300 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10301 "basr\t%0,0\;la\t%0,%1-.(%0)"
10302 [(set_attr "length" "6")
10303 (set_attr "type" "la")
10304 (set_attr "z196prop" "z196_cracked")])
10306 (define_insn "reload_base_64"
10307 [(set (match_operand 0 "register_operand" "=a")
10308 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
10309 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10311 [(set_attr "op_type" "RIL")
10312 (set_attr "type" "larl")
10313 (set_attr "z10prop" "z10_fwd_A1")])
10315 (define_insn "pool"
10316 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
10319 gcc_unreachable ();
10321 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
10324 ;; Insns related to generating the function prologue and epilogue.
10328 (define_expand "prologue"
10329 [(use (const_int 0))]
10331 "s390_emit_prologue (); DONE;")
10333 (define_expand "epilogue"
10334 [(use (const_int 1))]
10336 "s390_emit_epilogue (false); DONE;")
10338 (define_expand "sibcall_epilogue"
10339 [(use (const_int 0))]
10341 "s390_emit_epilogue (true); DONE;")
10343 ;; A direct return instruction, without using an epilogue.
10344 (define_insn "<code>"
10346 "s390_can_use_<code>_insn ()"
10348 [(set_attr "op_type" "RR")
10349 (set_attr "type" "jsr")
10350 (set_attr "atype" "agen")])
10352 (define_insn "*return"
10354 (use (match_operand 0 "register_operand" "a"))]
10355 "GET_MODE (operands[0]) == Pmode"
10357 [(set_attr "op_type" "RR")
10358 (set_attr "type" "jsr")
10359 (set_attr "atype" "agen")])
10362 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
10363 ;; pointer. This is used for compatibility.
10365 (define_expand "ptr_extend"
10366 [(set (match_operand:DI 0 "register_operand" "=r")
10367 (match_operand:SI 1 "register_operand" "r"))]
10370 emit_insn (gen_anddi3 (operands[0],
10371 gen_lowpart (DImode, operands[1]),
10372 GEN_INT (0x7fffffff)));
10376 ;; Instruction definition to expand eh_return macro to support
10377 ;; swapping in special linkage return addresses.
10379 (define_expand "eh_return"
10380 [(use (match_operand 0 "register_operand" ""))]
10383 s390_emit_tpf_eh_return (operands[0]);
10388 ; Stack Protector Patterns
10391 (define_expand "stack_protect_set"
10392 [(set (match_operand 0 "memory_operand" "")
10393 (match_operand 1 "memory_operand" ""))]
10396 #ifdef TARGET_THREAD_SSP_OFFSET
10398 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
10399 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
10402 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
10404 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
10409 (define_insn "stack_protect_set<mode>"
10410 [(set (match_operand:DSI 0 "memory_operand" "=Q")
10411 (unspec:DSI [(match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_SET))]
10413 "mvc\t%O0(%G0,%R0),%S1"
10414 [(set_attr "op_type" "SS")])
10416 (define_expand "stack_protect_test"
10417 [(set (reg:CC CC_REGNUM)
10418 (compare (match_operand 0 "memory_operand" "")
10419 (match_operand 1 "memory_operand" "")))
10420 (match_operand 2 "" "")]
10424 #ifdef TARGET_THREAD_SSP_OFFSET
10426 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
10427 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
10430 emit_insn (gen_stack_protect_testdi (operands[0], operands[1]));
10432 emit_insn (gen_stack_protect_testsi (operands[0], operands[1]));
10434 cc_reg = gen_rtx_REG (CCZmode, CC_REGNUM);
10435 test = gen_rtx_EQ (VOIDmode, cc_reg, const0_rtx);
10436 emit_jump_insn (gen_cbranchcc4 (test, cc_reg, const0_rtx, operands[2]));
10440 (define_insn "stack_protect_test<mode>"
10441 [(set (reg:CCZ CC_REGNUM)
10442 (unspec:CCZ [(match_operand:DSI 0 "memory_operand" "Q")
10443 (match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_TEST))]
10445 "clc\t%O0(%G0,%R0),%S1"
10446 [(set_attr "op_type" "SS")])
10448 ; This is used in s390_emit_prologue in order to prevent insns
10449 ; adjusting the stack pointer to be moved over insns writing stack
10450 ; slots using a copy of the stack pointer in a different register.
10451 (define_insn "stack_tie"
10452 [(set (match_operand:BLK 0 "memory_operand" "+m")
10453 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
10456 [(set_attr "length" "0")])
10460 ; Data prefetch patterns
10463 (define_insn "prefetch"
10464 [(prefetch (match_operand 0 "address_operand" "ZQZRZSZT,X")
10465 (match_operand:SI 1 "const_int_operand" " n,n")
10466 (match_operand:SI 2 "const_int_operand" " n,n"))]
10469 switch (which_alternative)
10472 return INTVAL (operands[1]) == 1 ? "pfd\t2,%a0" : "pfd\t1,%a0";
10474 if (larl_operand (operands[0], Pmode))
10475 return INTVAL (operands[1]) == 1 ? "pfdrl\t2,%a0" : "pfdrl\t1,%a0";
10478 /* This might be reached for symbolic operands with an odd
10479 addend. We simply omit the prefetch for such rare cases. */
10484 [(set_attr "type" "load,larl")
10485 (set_attr "op_type" "RXY,RIL")
10486 (set_attr "z10prop" "z10_super")
10487 (set_attr "z196prop" "z196_alone")])
10491 ; Byte swap instructions
10494 ; FIXME: There is also mvcin but we cannot use it since src and target
10496 (define_insn "bswap<mode>2"
10497 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d, d,RT")
10498 (bswap:GPR (match_operand:GPR 1 "nonimmediate_operand" " d,RT, d")))]
10504 [(set_attr "type" "*,load,store")
10505 (set_attr "op_type" "RRE,RXY,RXY")
10506 (set_attr "z10prop" "z10_super")])
10508 (define_insn "bswaphi2"
10509 [(set (match_operand:HI 0 "nonimmediate_operand" "=d, d,RT")
10510 (bswap:HI (match_operand:HI 1 "nonimmediate_operand" " d,RT, d")))]
10516 [(set_attr "type" "*,load,store")
10517 (set_attr "op_type" "RRE,RXY,RXY")
10518 (set_attr "z10prop" "z10_super")])
10521 [(set (match_operand:HI 0 "register_operand" "")
10522 (bswap:HI (match_operand:HI 1 "register_operand" "")))]
10524 [(set (match_dup 2) (bswap:SI (match_dup 3)))
10525 (set (match_dup 2) (lshiftrt:SI (match_dup 2)
10527 (set (match_dup 0) (subreg:HI (match_dup 2) 2))]
10529 operands[2] = gen_reg_rtx (SImode);
10530 operands[3] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
10535 ; Population count instruction
10538 ; The S/390 popcount instruction counts the bits of op1 in 8 byte
10539 ; portions and stores the result in the corresponding bytes in op0.
10540 (define_insn "*popcount<mode>"
10541 [(set (match_operand:INT 0 "register_operand" "=d")
10542 (unspec:INT [(match_operand:INT 1 "register_operand" "d")] UNSPEC_POPCNT))
10543 (clobber (reg:CC CC_REGNUM))]
10546 [(set_attr "op_type" "RRE")])
10548 (define_expand "popcountdi2"
10550 (parallel [(set (match_operand:DI 0 "register_operand" "")
10551 (unspec:DI [(match_operand:DI 1 "register_operand")]
10553 (clobber (reg:CC CC_REGNUM))])
10554 ; sllg op2, op0, 32
10555 (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 32)))
10557 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10558 (clobber (reg:CC CC_REGNUM))])
10559 ; sllg op2, op0, 16
10561 (ashift:DI (match_dup 0) (const_int 16)))
10563 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10564 (clobber (reg:CC CC_REGNUM))])
10566 (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 8)))
10568 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10569 (clobber (reg:CC CC_REGNUM))])
10570 ; srlg op0, op0, 56
10571 (set (match_dup 0) (lshiftrt:DI (match_dup 0) (const_int 56)))]
10572 "TARGET_Z196 && TARGET_64BIT"
10573 "operands[2] = gen_reg_rtx (DImode);")
10575 (define_expand "popcountsi2"
10577 (parallel [(set (match_operand:SI 0 "register_operand" "")
10578 (unspec:SI [(match_operand:SI 1 "register_operand")]
10580 (clobber (reg:CC CC_REGNUM))])
10581 ; sllk op2, op0, 16
10583 (ashift:SI (match_dup 0) (const_int 16)))
10585 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10586 (clobber (reg:CC CC_REGNUM))])
10588 (set (match_dup 2) (ashift:SI (match_dup 0) (const_int 8)))
10590 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10591 (clobber (reg:CC CC_REGNUM))])
10593 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 24)))]
10595 "operands[2] = gen_reg_rtx (SImode);")
10597 (define_expand "popcounthi2"
10599 (parallel [(set (match_operand:HI 0 "register_operand" "")
10600 (unspec:HI [(match_operand:HI 1 "register_operand")]
10602 (clobber (reg:CC CC_REGNUM))])
10605 (ashift:SI (match_dup 0) (const_int 8)))
10607 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10608 (clobber (reg:CC CC_REGNUM))])
10610 (set (match_dup 0) (lshiftrt:HI (match_dup 0) (const_int 8)))]
10612 "operands[2] = gen_reg_rtx (SImode);")
10614 (define_expand "popcountqi2"
10616 (parallel [(set (match_operand:QI 0 "register_operand" "")
10617 (unspec:QI [(match_operand:QI 1 "register_operand")]
10619 (clobber (reg:CC CC_REGNUM))])]
10624 ;;- Copy sign instructions
10627 (define_insn "copysign<mode>3"
10628 [(set (match_operand:FP 0 "register_operand" "=f")
10629 (unspec:FP [(match_operand:FP 1 "register_operand" "<fT0>")
10630 (match_operand:FP 2 "register_operand" "f")]
10634 [(set_attr "op_type" "RRF")
10635 (set_attr "type" "fsimp<mode>")])
10639 ;;- Transactional execution instructions
10642 ; This splitter helps combine to make use of CC directly when
10643 ; comparing the integer result of a tbegin builtin with a constant.
10644 ; The unspec is already removed by canonicalize_comparison. So this
10645 ; splitters only job is to turn the PARALLEL into separate insns
10646 ; again. Unfortunately this only works with the very first cc/int
10647 ; compare since combine is not able to deal with data flow across
10648 ; basic block boundaries.
10650 ; It needs to be an insn pattern as well since combine does not apply
10651 ; the splitter directly. Combine would only use it if it actually
10652 ; would reduce the number of instructions.
10653 (define_insn_and_split "*ccraw_to_int"
10656 (match_operator 0 "s390_eqne_operator"
10657 [(reg:CCRAW CC_REGNUM)
10658 (match_operand 1 "const_int_operand" "")])
10659 (label_ref (match_operand 2 "" ""))
10661 (set (match_operand:SI 3 "register_operand" "=d")
10662 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
10666 [(set (match_dup 3)
10667 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))
10669 (if_then_else (match_op_dup 0 [(reg:CCRAW CC_REGNUM) (match_dup 1)])
10670 (label_ref (match_dup 2))
10674 ; Non-constrained transaction begin
10676 (define_expand "tbegin"
10677 [(match_operand:SI 0 "register_operand" "")
10678 (match_operand:BLK 1 "memory_operand" "")]
10681 s390_expand_tbegin (operands[0], operands[1], NULL_RTX, true);
10685 (define_expand "tbegin_nofloat"
10686 [(match_operand:SI 0 "register_operand" "")
10687 (match_operand:BLK 1 "memory_operand" "")]
10690 s390_expand_tbegin (operands[0], operands[1], NULL_RTX, false);
10694 (define_expand "tbegin_retry"
10695 [(match_operand:SI 0 "register_operand" "")
10696 (match_operand:BLK 1 "memory_operand" "")
10697 (match_operand:SI 2 "general_operand" "")]
10700 s390_expand_tbegin (operands[0], operands[1], operands[2], true);
10704 (define_expand "tbegin_retry_nofloat"
10705 [(match_operand:SI 0 "register_operand" "")
10706 (match_operand:BLK 1 "memory_operand" "")
10707 (match_operand:SI 2 "general_operand" "")]
10710 s390_expand_tbegin (operands[0], operands[1], operands[2], false);
10714 ; Clobber VRs since they don't get restored
10715 (define_insn "tbegin_1_z13"
10716 [(set (reg:CCRAW CC_REGNUM)
10717 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10719 (set (match_operand:BLK 1 "memory_operand" "=Q")
10720 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))
10721 (clobber (reg:TI 16)) (clobber (reg:TI 38))
10722 (clobber (reg:TI 17)) (clobber (reg:TI 39))
10723 (clobber (reg:TI 18)) (clobber (reg:TI 40))
10724 (clobber (reg:TI 19)) (clobber (reg:TI 41))
10725 (clobber (reg:TI 20)) (clobber (reg:TI 42))
10726 (clobber (reg:TI 21)) (clobber (reg:TI 43))
10727 (clobber (reg:TI 22)) (clobber (reg:TI 44))
10728 (clobber (reg:TI 23)) (clobber (reg:TI 45))
10729 (clobber (reg:TI 24)) (clobber (reg:TI 46))
10730 (clobber (reg:TI 25)) (clobber (reg:TI 47))
10731 (clobber (reg:TI 26)) (clobber (reg:TI 48))
10732 (clobber (reg:TI 27)) (clobber (reg:TI 49))
10733 (clobber (reg:TI 28)) (clobber (reg:TI 50))
10734 (clobber (reg:TI 29)) (clobber (reg:TI 51))
10735 (clobber (reg:TI 30)) (clobber (reg:TI 52))
10736 (clobber (reg:TI 31)) (clobber (reg:TI 53))]
10737 ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is
10738 ; not supposed to be used for immediates (see genpreds.c).
10739 "TARGET_VX && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10741 [(set_attr "op_type" "SIL")])
10743 (define_insn "tbegin_1"
10744 [(set (reg:CCRAW CC_REGNUM)
10745 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10747 (set (match_operand:BLK 1 "memory_operand" "=Q")
10748 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))
10749 (clobber (reg:DF 16))
10750 (clobber (reg:DF 17))
10751 (clobber (reg:DF 18))
10752 (clobber (reg:DF 19))
10753 (clobber (reg:DF 20))
10754 (clobber (reg:DF 21))
10755 (clobber (reg:DF 22))
10756 (clobber (reg:DF 23))
10757 (clobber (reg:DF 24))
10758 (clobber (reg:DF 25))
10759 (clobber (reg:DF 26))
10760 (clobber (reg:DF 27))
10761 (clobber (reg:DF 28))
10762 (clobber (reg:DF 29))
10763 (clobber (reg:DF 30))
10764 (clobber (reg:DF 31))]
10765 ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is
10766 ; not supposed to be used for immediates (see genpreds.c).
10767 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10769 [(set_attr "op_type" "SIL")])
10771 ; Same as above but without the FPR clobbers
10772 (define_insn "tbegin_nofloat_1"
10773 [(set (reg:CCRAW CC_REGNUM)
10774 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10776 (set (match_operand:BLK 1 "memory_operand" "=Q")
10777 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))]
10778 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10780 [(set_attr "op_type" "SIL")])
10783 ; Constrained transaction begin
10785 (define_expand "tbeginc"
10786 [(set (reg:CCRAW CC_REGNUM)
10787 (unspec_volatile:CCRAW [(const_int TBEGINC_MASK)]
10792 (define_insn "*tbeginc_1"
10793 [(set (reg:CCRAW CC_REGNUM)
10794 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" " D")]
10796 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10798 [(set_attr "op_type" "SIL")])
10802 (define_expand "tend"
10803 [(set (reg:CCRAW CC_REGNUM)
10804 (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))
10805 (set (match_operand:SI 0 "register_operand" "")
10806 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
10810 (define_insn "*tend_1"
10811 [(set (reg:CCRAW CC_REGNUM)
10812 (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))]
10815 [(set_attr "op_type" "S")])
10817 ; Transaction abort
10819 (define_expand "tabort"
10820 [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "")]
10822 "TARGET_HTM && operands != NULL"
10824 if (CONST_INT_P (operands[0])
10825 && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 255)
10827 error ("Invalid transaction abort code: " HOST_WIDE_INT_PRINT_DEC
10828 ". Values in range 0 through 255 are reserved.",
10829 INTVAL (operands[0]));
10834 (define_insn "*tabort_1"
10835 [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "Y")]
10837 "TARGET_HTM && operands != NULL"
10839 [(set_attr "op_type" "S")])
10841 ; Transaction extract nesting depth
10843 (define_insn "etnd"
10844 [(set (match_operand:SI 0 "register_operand" "=d")
10845 (unspec_volatile:SI [(const_int 0)] UNSPECV_ETND))]
10848 [(set_attr "op_type" "RRE")])
10850 ; Non-transactional store
10852 (define_insn "ntstg"
10853 [(set (match_operand:DI 0 "memory_operand" "=RT")
10854 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "d")]
10858 [(set_attr "op_type" "RXY")])
10860 ; Transaction perform processor assist
10862 (define_expand "tx_assist"
10863 [(unspec_volatile [(match_operand:SI 0 "register_operand" "")
10864 (reg:SI GPR0_REGNUM)
10870 (define_insn "*ppa"
10871 [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")
10872 (match_operand:SI 1 "register_operand" "d")
10873 (match_operand 2 "const_int_operand" "I")]
10875 "TARGET_HTM && INTVAL (operands[2]) < 16"
10877 [(set_attr "op_type" "RRF")])
10880 ; Set and get floating point control register
10882 (define_insn "sfpc"
10883 [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")]
10885 "TARGET_HARD_FLOAT"
10888 (define_insn "efpc"
10889 [(set (match_operand:SI 0 "register_operand" "=d")
10890 (unspec_volatile:SI [(const_int 0)] UNSPECV_EFPC))]
10891 "TARGET_HARD_FLOAT"
10895 ; Load count to block boundary
10897 (define_insn "lcbb"
10898 [(set (match_operand:SI 0 "register_operand" "=d")
10899 (unspec:SI [(match_operand:SI 1 "address_operand" "ZQZR")
10900 (match_operand:SI 2 "immediate_operand" "C")] UNSPEC_LCBB))
10901 (clobber (reg:CC CC_REGNUM))]
10904 [(set_attr "op_type" "VRX")])