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 ; GOT/PLT and lt-relative accesses
94 ; TLS relocation specifiers
110 ; Stack Smashing Protector
114 ; Test Data Class (TDC)
126 UNSPEC_FPINT_NEARBYINT
135 UNSPEC_VEC_SMULT_EVEN
136 UNSPEC_VEC_UMULT_EVEN
150 UNSPEC_VEC_INSERT_AND_ZERO
151 UNSPEC_VEC_LOAD_BNDRY
156 UNSPEC_VEC_PACK_SATURATE
157 UNSPEC_VEC_PACK_SATURATE_CC
158 UNSPEC_VEC_PACK_SATURATE_GENCC
159 UNSPEC_VEC_PACK_UNSIGNED_SATURATE
160 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_CC
161 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_GENCC
173 UNSPEC_VEC_ADDEC_U128
178 UNSPEC_VEC_GFMSUM_128
179 UNSPEC_VEC_GFMSUM_ACCUM
180 UNSPEC_VEC_GFMSUM_ACCUM_128
199 UNSPEC_VEC_SUBEC_U128
233 ;; UNSPEC_VOLATILE usage
236 (define_c_enum "unspecv" [
258 ; Hotpatching (unremovable NOPs)
263 ; Transactional Execution support
273 ; Set and get floating point control register
282 ; Registers with special meaning
286 ; Sibling call register.
288 ; Literal pool base register.
290 ; Return address register.
292 ; Condition code register.
294 ; Thread local storage pointer register.
298 ; Hardware register names
302 ; General purpose registers
305 ; Floating point registers.
330 ;; PFPO GPR0 argument format
335 ; PFPO operation type
336 (PFPO_CONVERT 0x1000000)
338 (PFPO_OP_TYPE_SF 0x5)
339 (PFPO_OP_TYPE_DF 0x6)
340 (PFPO_OP_TYPE_TF 0x7)
341 (PFPO_OP_TYPE_SD 0x8)
342 (PFPO_OP_TYPE_DD 0x9)
343 (PFPO_OP_TYPE_TD 0xa)
344 ; Bitposition of operand types
345 (PFPO_OP0_TYPE_SHIFT 16)
346 (PFPO_OP1_TYPE_SHIFT 8)
349 ; Immediate operands for tbegin and tbeginc
350 (define_constants [(TBEGIN_MASK 65292)]) ; 0xff0c
351 (define_constants [(TBEGINC_MASK 65288)]) ; 0xff08
353 ;; Instruction operand type as used in the Principles of Operation.
354 ;; Used to determine defaults for length and other attribute values.
356 (define_attr "op_type"
357 "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"
360 ;; Instruction type attribute used for scheduling.
362 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
363 cs,vs,store,sem,idiv,
364 imulhi,imulsi,imuldi,
365 branch,jsr,fsimptf,fsimpdf,fsimpsf,fhex,
366 floadtf,floaddf,floadsf,fstoredf,fstoresf,
367 fmultf,fmuldf,fmulsf,fdivtf,fdivdf,fdivsf,
368 ftoi,fsqrttf,fsqrtdf,fsqrtsf,
370 ftrunctf,ftruncdf, ftruncsd, ftruncdd,
371 itoftf, itofdf, itofsf, itofdd, itoftd,
372 fdivdd, fdivtd, floaddd, floadsd, fmuldd, fmultd,
373 fsimpdd, fsimpsd, fsimptd, fstoredd, fstoresd,
375 (cond [(eq_attr "op_type" "NN") (const_string "other")
376 (eq_attr "op_type" "SS") (const_string "cs")]
377 (const_string "integer")))
379 ;; Another attribute used for scheduling purposes:
380 ;; agen: Instruction uses the address generation unit
381 ;; reg: Instruction does not use the agen unit
383 (define_attr "atype" "agen,reg"
384 (if_then_else (eq_attr "op_type" "E,RR,RI,RRE,RSI,RIL,RIE,RRF,RRR")
386 (const_string "agen")))
388 ;; Properties concerning Z10 execution grouping and value forwarding.
389 ;; z10_super: instruction is superscalar.
390 ;; z10_super_c: instruction is superscalar and meets the condition of z10_c.
391 ;; z10_fwd: The instruction reads the value of an operand and stores it into a
392 ;; target register. It can forward this value to a second instruction that reads
393 ;; the same register if that second instruction is issued in the same group.
394 ;; z10_rec: The instruction is in the T pipeline and reads a register. If the
395 ;; instruction in the S pipe writes to the register, then the T instruction
396 ;; can immediately read the new value.
397 ;; z10_fr: union of Z10_fwd and z10_rec.
398 ;; z10_c: second operand of instruction is a register and read with complemented bits.
400 ;; An additional suffix A1, A3, or E1 indicates the respective AGI bypass.
403 (define_attr "z10prop" "none,
404 z10_super, z10_super_E1, z10_super_A1, z10_super_c, z10_super_c_E1,
405 z10_fwd, z10_fwd_A1, z10_fwd_A3, z10_fwd_E1,
407 z10_fr, z10_fr_A3, z10_fr_E1,
409 (const_string "none"))
411 ;; Properties concerning Z196 decoding
412 ;; z196_alone: must group alone
413 ;; z196_end: ends a group
414 ;; z196_cracked: instruction is cracked or expanded
415 (define_attr "z196prop" "none,
416 z196_alone, z196_ends,
418 (const_string "none"))
420 (define_attr "mnemonic" "bcr_flush,unknown" (const_string "unknown"))
424 (define_attr "length" ""
425 (cond [(eq_attr "op_type" "E,RR") (const_int 2)
426 (eq_attr "op_type" "RX,RI,RRE,RS,RSI,S,SI,RRF,RRR") (const_int 4)]
430 ;; Processor type. This attribute must exactly match the processor_type
431 ;; enumeration in s390.h. The current machine description does not
432 ;; distinguish between g5 and g6, but there are differences between the two
433 ;; CPUs could in theory be modeled.
435 (define_attr "cpu" "g5,g6,z900,z990,z9_109,z9_ec,z10,z196,zEC12,z13"
436 (const (symbol_ref "s390_tune_attr")))
438 (define_attr "cpu_facility"
439 "standard,ieee,zarch,cpu_zarch,longdisp,extimm,dfp,z10,z196,zEC12,vec"
440 (const_string "standard"))
442 (define_attr "enabled" ""
443 (cond [(eq_attr "cpu_facility" "standard")
446 (and (eq_attr "cpu_facility" "ieee")
447 (match_test "TARGET_CPU_IEEE_FLOAT"))
450 (and (eq_attr "cpu_facility" "zarch")
451 (match_test "TARGET_ZARCH"))
454 (and (eq_attr "cpu_facility" "longdisp")
455 (match_test "TARGET_LONG_DISPLACEMENT"))
458 (and (eq_attr "cpu_facility" "extimm")
459 (match_test "TARGET_EXTIMM"))
462 (and (eq_attr "cpu_facility" "dfp")
463 (match_test "TARGET_DFP"))
466 (and (eq_attr "cpu_facility" "cpu_zarch")
467 (match_test "TARGET_CPU_ZARCH"))
470 (and (eq_attr "cpu_facility" "z10")
471 (match_test "TARGET_Z10"))
474 (and (eq_attr "cpu_facility" "z196")
475 (match_test "TARGET_Z196"))
478 (and (eq_attr "cpu_facility" "zEC12")
479 (match_test "TARGET_ZEC12"))
482 (and (eq_attr "cpu_facility" "vec")
483 (match_test "TARGET_VX"))
487 ;; Pipeline description for z900. For lack of anything better,
488 ;; this description is also used for the g5 and g6.
491 ;; Pipeline description for z990, z9-109 and z9-ec.
494 ;; Pipeline description for z10
497 ;; Pipeline description for z196
500 ;; Pipeline description for zEC12
504 (include "predicates.md")
506 ;; Constraint definitions
507 (include "constraints.md")
514 (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])
516 ;; These mode iterators allow floating point patterns to be generated from the
518 (define_mode_iterator FP_ALL [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")
519 (SD "TARGET_HARD_DFP")])
520 (define_mode_iterator FP [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")])
521 (define_mode_iterator BFP [TF DF SF])
522 (define_mode_iterator DFP [TD DD])
523 (define_mode_iterator DFP_ALL [TD DD SD])
524 (define_mode_iterator DSF [DF SF])
525 (define_mode_iterator SD_SF [SF SD])
526 (define_mode_iterator DD_DF [DF DD])
527 (define_mode_iterator TD_TF [TF TD])
529 ;; These mode iterators allow 31-bit and 64-bit GPR patterns to be generated
530 ;; from the same template.
531 (define_mode_iterator GPR [(DI "TARGET_ZARCH") SI])
532 (define_mode_iterator DGPR [(TI "TARGET_ZARCH") DI SI])
533 (define_mode_iterator DSI [DI SI])
534 (define_mode_iterator TDI [TI DI])
536 ;; These mode iterators allow :P to be used for patterns that operate on
537 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
538 (define_mode_iterator P [(DI "TARGET_64BIT") (SI "!TARGET_64BIT")])
540 ;; These macros refer to the actual word_mode of the configuration.
541 ;; This is equal to Pmode except on 31-bit machines in zarch mode.
542 (define_mode_iterator DW [(TI "TARGET_ZARCH") (DI "!TARGET_ZARCH")])
543 (define_mode_iterator W [(DI "TARGET_ZARCH") (SI "!TARGET_ZARCH")])
545 ;; Used by the umul pattern to express modes having half the size.
546 (define_mode_attr DWH [(TI "DI") (DI "SI")])
547 (define_mode_attr dwh [(TI "di") (DI "si")])
549 ;; This mode iterator allows the QI and HI patterns to be defined from
550 ;; the same template.
551 (define_mode_iterator HQI [HI QI])
553 ;; This mode iterator allows the integer patterns to be defined from the
555 (define_mode_iterator INT [(DI "TARGET_ZARCH") SI HI QI])
556 (define_mode_iterator DINT [(TI "TARGET_ZARCH") DI SI HI QI])
558 ;; This iterator allows some 'ashift' and 'lshiftrt' pattern to be defined from
559 ;; the same template.
560 (define_code_iterator SHIFT [ashift lshiftrt])
562 ;; This iterator allows r[ox]sbg to be defined with the same template
563 (define_code_iterator IXOR [ior xor])
565 ;; This iterator is used to expand the patterns for the nearest
566 ;; integer functions.
567 (define_int_iterator FPINT [UNSPEC_FPINT_FLOOR UNSPEC_FPINT_BTRUNC
568 UNSPEC_FPINT_ROUND UNSPEC_FPINT_CEIL
569 UNSPEC_FPINT_NEARBYINT])
570 (define_int_attr fpint_name [(UNSPEC_FPINT_FLOOR "floor")
571 (UNSPEC_FPINT_BTRUNC "btrunc")
572 (UNSPEC_FPINT_ROUND "round")
573 (UNSPEC_FPINT_CEIL "ceil")
574 (UNSPEC_FPINT_NEARBYINT "nearbyint")])
575 (define_int_attr fpint_roundingmode [(UNSPEC_FPINT_FLOOR "7")
576 (UNSPEC_FPINT_BTRUNC "5")
577 (UNSPEC_FPINT_ROUND "1")
578 (UNSPEC_FPINT_CEIL "6")
579 (UNSPEC_FPINT_NEARBYINT "0")])
581 ;; This iterator and attribute allow to combine most atomic operations.
582 (define_code_iterator ATOMIC [and ior xor plus minus mult])
583 (define_code_iterator ATOMIC_Z196 [and ior xor plus])
584 (define_code_attr atomic [(and "and") (ior "or") (xor "xor")
585 (plus "add") (minus "sub") (mult "nand")])
586 (define_code_attr noxa [(and "n") (ior "o") (xor "x") (plus "a")])
588 ;; In FP templates, a string like "lt<de>br" will expand to "ltxbr" in
589 ;; TF/TDmode, "ltdbr" in DF/DDmode, and "ltebr" in SF/SDmode.
590 (define_mode_attr xde [(TF "x") (DF "d") (SF "e") (TD "x") (DD "d") (SD "e")])
592 ;; In FP templates, a <dee> in "m<dee><bt>r" will expand to "mx<bt>r" in
593 ;; TF/TDmode, "md<bt>r" in DF/DDmode, "mee<bt>r" in SFmode and "me<bt>r in
595 (define_mode_attr xdee [(TF "x") (DF "d") (SF "ee") (TD "x") (DD "d") (SD "e")])
597 ;; In FP templates, "<RRe>" will expand to "RRE" in TFmode and "RR" otherwise.
598 ;; Likewise for "<RXe>".
599 (define_mode_attr RRe [(TF "RRE") (DF "RR") (SF "RR")])
600 (define_mode_attr RXe [(TF "RXE") (DF "RX") (SF "RX")])
602 ;; The decimal floating point variants of add, sub, div and mul support 3
603 ;; fp register operands. The following attributes allow to merge the bfp and
604 ;; dfp variants in a single insn definition.
606 ;; This attribute is used to set op_type accordingly.
607 (define_mode_attr RRer [(TF "RRE") (DF "RRE") (SF "RRE") (TD "RRR")
608 (DD "RRR") (SD "RRR")])
610 ;; This attribute is used in the operand constraint list in order to have the
611 ;; first and the second operand match for bfp modes.
612 (define_mode_attr f0 [(TF "0") (DF "0") (SF "0") (TD "f") (DD "f") (DD "f")])
614 ;; This attribute is used to merge the scalar vector instructions into
615 ;; the FP patterns. For non-supported modes (all but DF) it expands
616 ;; to constraints which are supposed to be matched by an earlier
618 (define_mode_attr v0 [(TF "0") (DF "v") (SF "0") (TD "0") (DD "0") (DD "0") (TI "0") (DI "v") (SI "0")])
619 (define_mode_attr vf [(TF "f") (DF "v") (SF "f") (TD "f") (DD "f") (DD "f") (TI "f") (DI "v") (SI "f")])
620 (define_mode_attr vd [(TF "d") (DF "v") (SF "d") (TD "d") (DD "d") (DD "d") (TI "d") (DI "v") (SI "d")])
622 ;; This attribute is used in the operand list of the instruction to have an
623 ;; additional operand for the dfp instructions.
624 (define_mode_attr op1 [(TF "") (DF "") (SF "")
625 (TD "%1,") (DD "%1,") (SD "%1,")])
628 ;; This attribute is used in the operand constraint list
629 ;; for instructions dealing with the sign bit of 32 or 64bit fp values.
630 ;; TFmode values are represented by a fp register pair. Since the
631 ;; sign bit instructions only handle single source and target fp registers
632 ;; these instructions can only be used for TFmode values if the source and
633 ;; target operand uses the same fp register.
634 (define_mode_attr fT0 [(TF "0") (DF "f") (SF "f")])
636 ;; In FP templates, "<Rf>" will expand to "f" in TFmode and "R" otherwise.
637 ;; This is used to disable the memory alternative in TFmode patterns.
638 (define_mode_attr Rf [(TF "f") (DF "R") (SF "R") (TD "f") (DD "f") (SD "f")])
640 ;; This attribute adds b for bfp instructions and t for dfp instructions and is used
641 ;; within instruction mnemonics.
642 (define_mode_attr bt [(TF "b") (DF "b") (SF "b") (TD "t") (DD "t") (SD "t")])
644 ;; This attribute is used within instruction mnemonics. It evaluates to d for dfp
645 ;; modes and to an empty string for bfp modes.
646 (define_mode_attr _d [(TF "") (DF "") (SF "") (TD "d") (DD "d") (SD "d")])
648 ;; In GPR and P templates, a constraint like "<d0>" will expand to "d" in DImode
649 ;; and "0" in SImode. This allows to combine instructions of which the 31bit
650 ;; version only operates on one register.
651 (define_mode_attr d0 [(DI "d") (SI "0")])
653 ;; In combination with d0 this allows to combine instructions of which the 31bit
654 ;; version only operates on one register. The DImode version needs an additional
655 ;; register for the assembler output.
656 (define_mode_attr 1 [(DI "%1,") (SI "")])
658 ;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in
659 ;; 'ashift' and "srdl" in 'lshiftrt'.
660 (define_code_attr lr [(ashift "l") (lshiftrt "r")])
662 ;; In SHIFT templates, this attribute holds the correct standard name for the
663 ;; pattern itself and the corresponding function calls.
664 (define_code_attr shift [(ashift "ashl") (lshiftrt "lshr")])
666 ;; This attribute handles differences in the instruction 'type' and will result
667 ;; in "RRE" for DImode and "RR" for SImode.
668 (define_mode_attr E [(DI "E") (SI "")])
670 ;; This attribute handles differences in the instruction 'type' and makes RX<Y>
671 ;; to result in "RXY" for DImode and "RX" for SImode.
672 (define_mode_attr Y [(DI "Y") (SI "")])
674 ;; This attribute handles differences in the instruction 'type' and will result
675 ;; in "RSE" for TImode and "RS" for DImode.
676 (define_mode_attr TE [(TI "E") (DI "")])
678 ;; In GPR templates, a string like "lc<g>r" will expand to "lcgr" in DImode
679 ;; and "lcr" in SImode.
680 (define_mode_attr g [(DI "g") (SI "")])
682 ;; In GPR templates, a string like "sl<y>" will expand to "slg" in DImode
683 ;; and "sly" in SImode. This is useful because on 64bit the ..g instructions
684 ;; were enhanced with long displacements whereas 31bit instructions got a ..y
685 ;; variant for long displacements.
686 (define_mode_attr y [(DI "g") (SI "y")])
688 ;; In DW templates, a string like "cds<g>" will expand to "cdsg" in TImode
689 ;; and "cds" in DImode.
690 (define_mode_attr tg [(TI "g") (DI "")])
692 ;; In TDI templates, a string like "c<d>sg".
693 (define_mode_attr td [(TI "d") (DI "")])
695 ;; In GPR templates, a string like "c<gf>dbr" will expand to "cgdbr" in DImode
696 ;; and "cfdbr" in SImode.
697 (define_mode_attr gf [(DI "g") (SI "f")])
699 ;; In GPR templates, a string like sll<gk> will expand to sllg for DI
700 ;; and sllk for SI. This way it is possible to merge the new z196 SI
701 ;; 3 operands shift instructions into the existing patterns.
702 (define_mode_attr gk [(DI "g") (SI "k")])
704 ;; ICM mask required to load MODE value into the lowest subreg
705 ;; of a SImode register.
706 (define_mode_attr icm_lo [(HI "3") (QI "1")])
708 ;; In HQI templates, a string like "llg<hc>" will expand to "llgh" in
709 ;; HImode and "llgc" in QImode.
710 (define_mode_attr hc [(HI "h") (QI "c")])
712 ;; In P templates, the mode <DBL> will expand to "TI" in DImode and "DI"
714 (define_mode_attr DBL [(DI "TI") (SI "DI")])
716 ;; This attribute expands to DF for TFmode and to DD for TDmode . It is
717 ;; used for Txmode splitters splitting a Txmode copy into 2 Dxmode copies.
718 (define_mode_attr HALF_TMODE [(TF "DF") (TD "DD")])
720 ;; Maximum unsigned integer that fits in MODE.
721 (define_mode_attr max_uint [(HI "65535") (QI "255")])
723 ;; Start and end field computations for RISBG et al.
724 (define_mode_attr bfstart [(DI "s") (SI "t")])
725 (define_mode_attr bfend [(DI "e") (SI "f")])
727 ;; In place of GET_MODE_BITSIZE (<MODE>mode)
728 (define_mode_attr bitsize [(DI "64") (SI "32") (HI "16") (QI "8")])
730 ;; Allow return and simple_return to be defined from a single template.
731 (define_code_iterator ANY_RETURN [return simple_return])
735 ; Condition code modes generated by vector fp comparisons. These will
736 ; be used also in single element mode.
737 (define_mode_iterator VFCMP [CCVEQ CCVFH CCVFHE])
738 ; Used with VFCMP to expand part of the mnemonic
739 ; For fp we have a mismatch: eq in the insn name - e in asm
740 (define_mode_attr asm_fcmp [(CCVEQ "e") (CCVFH "h") (CCVFHE "he")])
741 (define_mode_attr insn_cmp [(CCVEQ "eq") (CCVH "h") (CCVHU "hl") (CCVFH "h") (CCVFHE "he")])
744 (include "vector.md")
747 ;;- Compare instructions.
750 ; Test-under-Mask instructions
752 (define_insn "*tmqi_mem"
753 [(set (reg CC_REGNUM)
754 (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S")
755 (match_operand:QI 1 "immediate_operand" "n,n"))
756 (match_operand:QI 2 "immediate_operand" "n,n")))]
757 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], false))"
761 [(set_attr "op_type" "SI,SIY")
762 (set_attr "z10prop" "z10_super,z10_super")])
764 (define_insn "*tmdi_reg"
765 [(set (reg CC_REGNUM)
766 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
767 (match_operand:DI 1 "immediate_operand"
768 "N0HD0,N1HD0,N2HD0,N3HD0"))
769 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
771 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
772 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
778 [(set_attr "op_type" "RI")
779 (set_attr "z10prop" "z10_super,z10_super,z10_super,z10_super")])
781 (define_insn "*tmsi_reg"
782 [(set (reg CC_REGNUM)
783 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
784 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
785 (match_operand:SI 2 "immediate_operand" "n,n")))]
786 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true))
787 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
791 [(set_attr "op_type" "RI")
792 (set_attr "z10prop" "z10_super,z10_super")])
794 (define_insn "*tm<mode>_full"
795 [(set (reg CC_REGNUM)
796 (compare (match_operand:HQI 0 "register_operand" "d")
797 (match_operand:HQI 1 "immediate_operand" "n")))]
798 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], true))"
800 [(set_attr "op_type" "RI")
801 (set_attr "z10prop" "z10_super")])
805 ; Load-and-Test instructions
808 ; tst(di|si) instruction pattern(s).
810 (define_insn "*tstdi_sign"
811 [(set (reg CC_REGNUM)
815 (subreg:DI (match_operand:SI 0 "nonimmediate_operand" "d,RT") 0)
816 (const_int 32)) (const_int 32))
817 (match_operand:DI 1 "const0_operand" "")))
818 (set (match_operand:DI 2 "register_operand" "=d,d")
819 (sign_extend:DI (match_dup 0)))]
820 "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH"
823 [(set_attr "op_type" "RRE,RXY")
824 (set_attr "cpu_facility" "*,z10")
825 (set_attr "z10prop" "z10_super_E1,z10_super_E1") ])
828 (define_insn "*tst<mode>_extimm"
829 [(set (reg CC_REGNUM)
830 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,RT")
831 (match_operand:GPR 1 "const0_operand" "")))
832 (set (match_operand:GPR 2 "register_operand" "=d,d")
834 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
838 [(set_attr "op_type" "RR<E>,RXY")
839 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3") ])
842 (define_insn "*tst<mode>_cconly_extimm"
843 [(set (reg CC_REGNUM)
844 (compare (match_operand:GPR 0 "nonimmediate_operand" "d,RT")
845 (match_operand:GPR 1 "const0_operand" "")))
846 (clobber (match_scratch:GPR 2 "=X,d"))]
847 "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM"
851 [(set_attr "op_type" "RR<E>,RXY")
852 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3")])
854 (define_insn "*tstdi"
855 [(set (reg CC_REGNUM)
856 (compare (match_operand:DI 0 "register_operand" "d")
857 (match_operand:DI 1 "const0_operand" "")))
858 (set (match_operand:DI 2 "register_operand" "=d")
860 "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH && !TARGET_EXTIMM"
862 [(set_attr "op_type" "RRE")
863 (set_attr "z10prop" "z10_fr_E1")])
865 (define_insn "*tstsi"
866 [(set (reg CC_REGNUM)
867 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
868 (match_operand:SI 1 "const0_operand" "")))
869 (set (match_operand:SI 2 "register_operand" "=d,d,d")
871 "s390_match_ccmode(insn, CCSmode) && !TARGET_EXTIMM"
876 [(set_attr "op_type" "RR,RS,RSY")
877 (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
879 (define_insn "*tstsi_cconly"
880 [(set (reg CC_REGNUM)
881 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
882 (match_operand:SI 1 "const0_operand" "")))
883 (clobber (match_scratch:SI 2 "=X,d,d"))]
884 "s390_match_ccmode(insn, CCSmode)"
889 [(set_attr "op_type" "RR,RS,RSY")
890 (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")])
892 (define_insn "*tstdi_cconly_31"
893 [(set (reg CC_REGNUM)
894 (compare (match_operand:DI 0 "register_operand" "d")
895 (match_operand:DI 1 "const0_operand" "")))]
896 "s390_match_ccmode(insn, CCSmode) && !TARGET_ZARCH"
898 [(set_attr "op_type" "RS")
899 (set_attr "atype" "reg")])
902 (define_insn "*tst<mode>_cconly2"
903 [(set (reg CC_REGNUM)
904 (compare (match_operand:GPR 0 "register_operand" "d")
905 (match_operand:GPR 1 "const0_operand" "")))]
906 "s390_match_ccmode(insn, CCSmode)"
908 [(set_attr "op_type" "RR<E>")
909 (set_attr "z10prop" "z10_fr_E1")])
911 ; tst(hi|qi) instruction pattern(s).
913 (define_insn "*tst<mode>CCT"
914 [(set (reg CC_REGNUM)
915 (compare (match_operand:HQI 0 "nonimmediate_operand" "?Q,?S,d")
916 (match_operand:HQI 1 "const0_operand" "")))
917 (set (match_operand:HQI 2 "register_operand" "=d,d,0")
919 "s390_match_ccmode(insn, CCTmode)"
922 icmy\t%2,<icm_lo>,%S0
924 [(set_attr "op_type" "RS,RSY,RI")
925 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
927 (define_insn "*tsthiCCT_cconly"
928 [(set (reg CC_REGNUM)
929 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
930 (match_operand:HI 1 "const0_operand" "")))
931 (clobber (match_scratch:HI 2 "=d,d,X"))]
932 "s390_match_ccmode(insn, CCTmode)"
937 [(set_attr "op_type" "RS,RSY,RI")
938 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")])
940 (define_insn "*tstqiCCT_cconly"
941 [(set (reg CC_REGNUM)
942 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
943 (match_operand:QI 1 "const0_operand" "")))]
944 "s390_match_ccmode(insn, CCTmode)"
949 [(set_attr "op_type" "SI,SIY,RI")
950 (set_attr "z10prop" "z10_super,z10_super,z10_super")])
952 (define_insn "*tst<mode>"
953 [(set (reg CC_REGNUM)
954 (compare (match_operand:HQI 0 "s_operand" "Q,S")
955 (match_operand:HQI 1 "const0_operand" "")))
956 (set (match_operand:HQI 2 "register_operand" "=d,d")
958 "s390_match_ccmode(insn, CCSmode)"
961 icmy\t%2,<icm_lo>,%S0"
962 [(set_attr "op_type" "RS,RSY")
963 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
965 (define_insn "*tst<mode>_cconly"
966 [(set (reg CC_REGNUM)
967 (compare (match_operand:HQI 0 "s_operand" "Q,S")
968 (match_operand:HQI 1 "const0_operand" "")))
969 (clobber (match_scratch:HQI 2 "=d,d"))]
970 "s390_match_ccmode(insn, CCSmode)"
973 icmy\t%2,<icm_lo>,%S0"
974 [(set_attr "op_type" "RS,RSY")
975 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
978 ; Compare (equality) instructions
980 (define_insn "*cmpdi_cct"
981 [(set (reg CC_REGNUM)
982 (compare (match_operand:DI 0 "nonimmediate_operand" "%d,d,d,d,Q")
983 (match_operand:DI 1 "general_operand" "d,K,Os,RT,BQ")))]
984 "s390_match_ccmode (insn, CCTmode) && TARGET_ZARCH"
991 [(set_attr "op_type" "RRE,RI,RIL,RXY,SS")
992 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,*")])
994 (define_insn "*cmpsi_cct"
995 [(set (reg CC_REGNUM)
996 (compare (match_operand:SI 0 "nonimmediate_operand" "%d,d,d,d,d,Q")
997 (match_operand:SI 1 "general_operand" "d,K,Os,R,T,BQ")))]
998 "s390_match_ccmode (insn, CCTmode)"
1006 [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS")
1007 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*")])
1009 ; Compare (signed) instructions
1011 (define_insn "*cmpdi_ccs_sign"
1012 [(set (reg CC_REGNUM)
1013 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand"
1015 (match_operand:DI 0 "register_operand" "d, d,d")))]
1016 "s390_match_ccmode(insn, CCSRmode) && TARGET_ZARCH"
1021 [(set_attr "op_type" "RRE,RXY,RIL")
1022 (set_attr "z10prop" "z10_c,*,*")
1023 (set_attr "type" "*,*,larl")])
1027 (define_insn "*cmpsi_ccs_sign"
1028 [(set (reg CC_REGNUM)
1029 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T,b"))
1030 (match_operand:SI 0 "register_operand" "d,d,d")))]
1031 "s390_match_ccmode(insn, CCSRmode)"
1036 [(set_attr "op_type" "RX,RXY,RIL")
1037 (set_attr "cpu_facility" "*,*,z10")
1038 (set_attr "type" "*,*,larl")
1039 (set_attr "z196prop" "z196_cracked,z196_cracked,z196_cracked")])
1041 (define_insn "*cmphi_ccs_z10"
1042 [(set (reg CC_REGNUM)
1043 (compare (match_operand:HI 0 "s_operand" "Q")
1044 (match_operand:HI 1 "immediate_operand" "K")))]
1045 "s390_match_ccmode(insn, CCSmode) && TARGET_Z10"
1047 [(set_attr "op_type" "SIL")
1048 (set_attr "z196prop" "z196_cracked")])
1050 (define_insn "*cmpdi_ccs_signhi_rl"
1051 [(set (reg CC_REGNUM)
1052 (compare (sign_extend:DI (match_operand:HI 1 "memory_operand" "RT,b"))
1053 (match_operand:GPR 0 "register_operand" "d,d")))]
1054 "s390_match_ccmode(insn, CCSRmode) && TARGET_Z10"
1058 [(set_attr "op_type" "RXY,RIL")
1059 (set_attr "type" "*,larl")])
1061 ; cr, chi, cfi, c, cy, cgr, cghi, cgfi, cg, chsi, cghsi, crl, cgrl
1062 (define_insn "*cmp<mode>_ccs"
1063 [(set (reg CC_REGNUM)
1064 (compare (match_operand:GPR 0 "nonimmediate_operand"
1066 (match_operand:GPR 1 "general_operand"
1067 "d,K,K,Os,R,T,b")))]
1068 "s390_match_ccmode(insn, CCSmode)"
1077 [(set_attr "op_type" "RR<E>,RI,SIL,RIL,RX<Y>,RXY,RIL")
1078 (set_attr "cpu_facility" "*,*,z10,extimm,*,*,z10")
1079 (set_attr "type" "*,*,*,*,*,*,larl")
1080 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,z10_super")])
1083 ; Compare (unsigned) instructions
1085 (define_insn "*cmpsi_ccu_zerohi_rlsi"
1086 [(set (reg CC_REGNUM)
1087 (compare (zero_extend:SI (mem:HI (match_operand:SI 1
1088 "larl_operand" "X")))
1089 (match_operand:SI 0 "register_operand" "d")))]
1090 "s390_match_ccmode(insn, CCURmode) && TARGET_Z10"
1092 [(set_attr "op_type" "RIL")
1093 (set_attr "type" "larl")
1094 (set_attr "z10prop" "z10_super")])
1097 (define_insn "*cmp<GPR:mode>_ccu_zerohi_rldi"
1098 [(set (reg CC_REGNUM)
1099 (compare (zero_extend:GPR (mem:HI (match_operand:DI 1
1100 "larl_operand" "X")))
1101 (match_operand:GPR 0 "register_operand" "d")))]
1102 "s390_match_ccmode(insn, CCURmode) && TARGET_Z10"
1104 [(set_attr "op_type" "RIL")
1105 (set_attr "type" "larl")
1106 (set_attr "z10prop" "z10_super")])
1108 (define_insn "*cmpdi_ccu_zero"
1109 [(set (reg CC_REGNUM)
1110 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand"
1112 (match_operand:DI 0 "register_operand" "d, d,d")))]
1113 "s390_match_ccmode (insn, CCURmode) && TARGET_ZARCH"
1118 [(set_attr "op_type" "RRE,RXY,RIL")
1119 (set_attr "cpu_facility" "*,*,z10")
1120 (set_attr "type" "*,*,larl")
1121 (set_attr "z10prop" "z10_super_c,z10_super_E1,z10_super")])
1123 (define_insn "*cmpdi_ccu"
1124 [(set (reg CC_REGNUM)
1125 (compare (match_operand:DI 0 "nonimmediate_operand"
1126 "d, d,d,Q, d, Q,BQ")
1127 (match_operand:DI 1 "general_operand"
1128 "d,Op,b,D,RT,BQ,Q")))]
1129 "s390_match_ccmode (insn, CCUmode) && TARGET_ZARCH"
1138 [(set_attr "op_type" "RRE,RIL,RIL,SIL,RXY,SS,SS")
1139 (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*")
1140 (set_attr "type" "*,*,larl,*,*,*,*")
1141 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*,*")])
1143 (define_insn "*cmpsi_ccu"
1144 [(set (reg CC_REGNUM)
1145 (compare (match_operand:SI 0 "nonimmediate_operand" "d, d,d,Q,d,d, Q,BQ")
1146 (match_operand:SI 1 "general_operand" "d,Os,b,D,R,T,BQ, Q")))]
1147 "s390_match_ccmode (insn, CCUmode)"
1157 [(set_attr "op_type" "RR,RIL,RIL,SIL,RX,RXY,SS,SS")
1158 (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*,*")
1159 (set_attr "type" "*,*,larl,*,*,*,*,*")
1160 (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,*,*")])
1162 (define_insn "*cmphi_ccu"
1163 [(set (reg CC_REGNUM)
1164 (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,Q,BQ")
1165 (match_operand:HI 1 "general_operand" "Q,S,D,BQ,Q")))]
1166 "s390_match_ccmode (insn, CCUmode)
1167 && !register_operand (operands[1], HImode)"
1174 [(set_attr "op_type" "RS,RSY,SIL,SS,SS")
1175 (set_attr "cpu_facility" "*,*,z10,*,*")
1176 (set_attr "z10prop" "*,*,z10_super,*,*")])
1178 (define_insn "*cmpqi_ccu"
1179 [(set (reg CC_REGNUM)
1180 (compare (match_operand:QI 0 "nonimmediate_operand" "d,d,Q,S,Q,BQ")
1181 (match_operand:QI 1 "general_operand" "Q,S,n,n,BQ,Q")))]
1182 "s390_match_ccmode (insn, CCUmode)
1183 && !register_operand (operands[1], QImode)"
1191 [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS")
1192 (set_attr "z10prop" "*,*,z10_super,z10_super,*,*")])
1195 ; Block compare (CLC) instruction patterns.
1198 [(set (reg CC_REGNUM)
1199 (compare (match_operand:BLK 0 "memory_operand" "Q")
1200 (match_operand:BLK 1 "memory_operand" "Q")))
1201 (use (match_operand 2 "const_int_operand" "n"))]
1202 "s390_match_ccmode (insn, CCUmode)
1203 && INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
1204 "clc\t%O0(%2,%R0),%S1"
1205 [(set_attr "op_type" "SS")])
1208 [(set (reg CC_REGNUM)
1209 (compare (match_operand 0 "memory_operand" "")
1210 (match_operand 1 "memory_operand" "")))]
1212 && s390_match_ccmode (insn, CCUmode)
1213 && GET_MODE (operands[0]) == GET_MODE (operands[1])
1214 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
1216 [(set (match_dup 0) (match_dup 1))
1217 (use (match_dup 2))])]
1219 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
1220 operands[0] = adjust_address (operands[0], BLKmode, 0);
1221 operands[1] = adjust_address (operands[1], BLKmode, 0);
1223 operands[1] = gen_rtx_COMPARE (GET_MODE (SET_DEST (PATTERN (curr_insn))),
1224 operands[0], operands[1]);
1225 operands[0] = SET_DEST (PATTERN (curr_insn));
1229 ; (TF|DF|SF|TD|DD|SD) instructions
1231 ; ltxbr, ltdbr, ltebr, ltxtr, ltdtr
1232 (define_insn "*cmp<mode>_ccs_0"
1233 [(set (reg CC_REGNUM)
1234 (compare (match_operand:FP 0 "register_operand" "f")
1235 (match_operand:FP 1 "const0_operand" "")))]
1236 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
1237 "lt<xde><bt>r\t%0,%0"
1238 [(set_attr "op_type" "RRE")
1239 (set_attr "type" "fsimp<mode>")])
1241 ; cxtr, cxbr, cdtr, cdbr, cebr, cdb, ceb
1242 (define_insn "*cmp<mode>_ccs"
1243 [(set (reg CC_REGNUM)
1244 (compare (match_operand:FP 0 "register_operand" "f,f")
1245 (match_operand:FP 1 "general_operand" "f,<Rf>")))]
1246 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
1250 [(set_attr "op_type" "RRE,RXE")
1251 (set_attr "type" "fsimp<mode>")])
1253 ; wfcedbs, wfchdbs, wfchedbs
1254 (define_insn "*vec_cmp<insn_cmp>df_cconly"
1255 [(set (reg:VFCMP CC_REGNUM)
1256 (compare:VFCMP (match_operand:DF 0 "register_operand" "v")
1257 (match_operand:DF 1 "register_operand" "v")))
1258 (clobber (match_scratch:V2DI 2 "=v"))]
1259 "TARGET_Z13 && TARGET_HARD_FLOAT"
1260 "wfc<asm_fcmp>dbs\t%v2,%v0,%v1"
1261 [(set_attr "op_type" "VRR")])
1263 ; Compare and Branch instructions
1265 ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
1266 ; The following instructions do a complementary access of their second
1267 ; operand (z01 only): crj_c, cgrjc, cr, cgr
1268 (define_insn "*cmp_and_br_signed_<mode>"
1270 (if_then_else (match_operator 0 "s390_signed_integer_comparison"
1271 [(match_operand:GPR 1 "register_operand" "d,d")
1272 (match_operand:GPR 2 "nonmemory_operand" "d,C")])
1273 (label_ref (match_operand 3 "" ""))
1275 (clobber (reg:CC CC_REGNUM))]
1276 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1278 if (get_attr_length (insn) == 6)
1279 return which_alternative ?
1280 "c<g>ij%C0\t%1,%c2,%l3" : "c<g>rj%C0\t%1,%2,%l3";
1282 return which_alternative ?
1283 "c<g>fi\t%1,%c2\;jg%C0\t%l3" : "c<g>r\t%1,%2\;jg%C0\t%l3";
1285 [(set_attr "op_type" "RIE")
1286 (set_attr "type" "branch")
1287 (set_attr "z10prop" "z10_super_c,z10_super")
1288 (set (attr "length")
1289 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1290 (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg
1291 ; 10 byte for cgr/jg
1293 ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr
1294 ; The following instructions do a complementary access of their second
1295 ; operand (z10 only): clrj, clgrj, clr, clgr
1296 (define_insn "*cmp_and_br_unsigned_<mode>"
1298 (if_then_else (match_operator 0 "s390_unsigned_integer_comparison"
1299 [(match_operand:GPR 1 "register_operand" "d,d")
1300 (match_operand:GPR 2 "nonmemory_operand" "d,I")])
1301 (label_ref (match_operand 3 "" ""))
1303 (clobber (reg:CC CC_REGNUM))]
1304 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1306 if (get_attr_length (insn) == 6)
1307 return which_alternative ?
1308 "cl<g>ij%C0\t%1,%b2,%l3" : "cl<g>rj%C0\t%1,%2,%l3";
1310 return which_alternative ?
1311 "cl<g>fi\t%1,%b2\;jg%C0\t%l3" : "cl<g>r\t%1,%2\;jg%C0\t%l3";
1313 [(set_attr "op_type" "RIE")
1314 (set_attr "type" "branch")
1315 (set_attr "z10prop" "z10_super_c,z10_super")
1316 (set (attr "length")
1317 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1318 (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg
1319 ; 10 byte for clgr/jg
1321 ; And now the same two patterns as above but with a negated CC mask.
1323 ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
1324 ; The following instructions do a complementary access of their second
1325 ; operand (z01 only): crj_c, cgrjc, cr, cgr
1326 (define_insn "*icmp_and_br_signed_<mode>"
1328 (if_then_else (match_operator 0 "s390_signed_integer_comparison"
1329 [(match_operand:GPR 1 "register_operand" "d,d")
1330 (match_operand:GPR 2 "nonmemory_operand" "d,C")])
1332 (label_ref (match_operand 3 "" ""))))
1333 (clobber (reg:CC CC_REGNUM))]
1334 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1336 if (get_attr_length (insn) == 6)
1337 return which_alternative ?
1338 "c<g>ij%D0\t%1,%c2,%l3" : "c<g>rj%D0\t%1,%2,%l3";
1340 return which_alternative ?
1341 "c<g>fi\t%1,%c2\;jg%D0\t%l3" : "c<g>r\t%1,%2\;jg%D0\t%l3";
1343 [(set_attr "op_type" "RIE")
1344 (set_attr "type" "branch")
1345 (set_attr "z10prop" "z10_super_c,z10_super")
1346 (set (attr "length")
1347 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1348 (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg
1349 ; 10 byte for cgr/jg
1351 ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr
1352 ; The following instructions do a complementary access of their second
1353 ; operand (z10 only): clrj, clgrj, clr, clgr
1354 (define_insn "*icmp_and_br_unsigned_<mode>"
1356 (if_then_else (match_operator 0 "s390_unsigned_integer_comparison"
1357 [(match_operand:GPR 1 "register_operand" "d,d")
1358 (match_operand:GPR 2 "nonmemory_operand" "d,I")])
1360 (label_ref (match_operand 3 "" ""))))
1361 (clobber (reg:CC CC_REGNUM))]
1362 "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH"
1364 if (get_attr_length (insn) == 6)
1365 return which_alternative ?
1366 "cl<g>ij%D0\t%1,%b2,%l3" : "cl<g>rj%D0\t%1,%2,%l3";
1368 return which_alternative ?
1369 "cl<g>fi\t%1,%b2\;jg%D0\t%l3" : "cl<g>r\t%1,%2\;jg%D0\t%l3";
1371 [(set_attr "op_type" "RIE")
1372 (set_attr "type" "branch")
1373 (set_attr "z10prop" "z10_super_c,z10_super")
1374 (set (attr "length")
1375 (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000))
1376 (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg
1377 ; 10 byte for clgr/jg
1380 ;;- Move instructions.
1384 ; movti instruction pattern(s).
1387 ; FIXME: More constants are possible by enabling jxx, jyy constraints
1388 ; for TImode (use double-int for the calculations)
1389 (define_insn "movti"
1390 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,v, v, v,v,d, v,QR, d,o")
1391 (match_operand:TI 1 "general_operand" "QS, d,v,j00,jm1,d,v,QR, v,dPRT,d"))]
1405 [(set_attr "op_type" "RSY,RSY,VRR,VRI,VRI,VRR,*,VRX,VRX,*,*")
1406 (set_attr "type" "lm,stm,*,*,*,*,*,*,*,*,*")
1407 (set_attr "cpu_facility" "*,*,vec,vec,vec,vec,vec,vec,vec,*,*")])
1410 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1411 (match_operand:TI 1 "general_operand" ""))]
1412 "TARGET_ZARCH && reload_completed
1413 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
1414 [(set (match_dup 2) (match_dup 4))
1415 (set (match_dup 3) (match_dup 5))]
1417 operands[2] = operand_subword (operands[0], 0, 0, TImode);
1418 operands[3] = operand_subword (operands[0], 1, 0, TImode);
1419 operands[4] = operand_subword (operands[1], 0, 0, TImode);
1420 operands[5] = operand_subword (operands[1], 1, 0, TImode);
1424 [(set (match_operand:TI 0 "nonimmediate_operand" "")
1425 (match_operand:TI 1 "general_operand" ""))]
1426 "TARGET_ZARCH && reload_completed
1427 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
1428 [(set (match_dup 2) (match_dup 4))
1429 (set (match_dup 3) (match_dup 5))]
1431 operands[2] = operand_subword (operands[0], 1, 0, TImode);
1432 operands[3] = operand_subword (operands[0], 0, 0, TImode);
1433 operands[4] = operand_subword (operands[1], 1, 0, TImode);
1434 operands[5] = operand_subword (operands[1], 0, 0, TImode);
1437 ; Use part of the TImode target reg to perform the address
1438 ; calculation. If the TImode value is supposed to be copied into a VR
1439 ; this splitter is not necessary.
1441 [(set (match_operand:TI 0 "register_operand" "")
1442 (match_operand:TI 1 "memory_operand" ""))]
1443 "TARGET_ZARCH && reload_completed
1444 && !VECTOR_REG_P (operands[0])
1445 && !s_operand (operands[1], VOIDmode)"
1446 [(set (match_dup 0) (match_dup 1))]
1448 rtx addr = operand_subword (operands[0], 1, 0, TImode);
1449 addr = gen_lowpart (Pmode, addr);
1450 s390_load_address (addr, XEXP (operands[1], 0));
1451 operands[1] = replace_equiv_address (operands[1], addr);
1455 ; Split a VR -> GPR TImode move into 2 vector load GR from VR element.
1456 ; For the higher order bits we do simply a DImode move while the
1457 ; second part is done via vec extract. Both will end up as vlgvg.
1459 [(set (match_operand:TI 0 "register_operand" "")
1460 (match_operand:TI 1 "register_operand" ""))]
1461 "TARGET_VX && reload_completed
1462 && GENERAL_REG_P (operands[0])
1463 && VECTOR_REG_P (operands[1])"
1464 [(set (match_dup 2) (match_dup 4))
1465 (set (match_dup 3) (unspec:DI [(match_dup 5) (const_int 1)]
1466 UNSPEC_VEC_EXTRACT))]
1468 operands[2] = operand_subword (operands[0], 0, 0, TImode);
1469 operands[3] = operand_subword (operands[0], 1, 0, TImode);
1470 operands[4] = gen_rtx_REG (DImode, REGNO (operands[1]));
1471 operands[5] = gen_rtx_REG (V2DImode, REGNO (operands[1]));
1475 ; Patterns used for secondary reloads
1478 ; z10 provides move instructions accepting larl memory operands.
1479 ; Unfortunately there is no such variant for QI, TI and FP mode moves.
1480 ; These patterns are also used for unaligned SI and DI accesses.
1482 (define_expand "reload<ALL:mode><P:mode>_tomem_z10"
1483 [(parallel [(match_operand:ALL 0 "memory_operand" "")
1484 (match_operand:ALL 1 "register_operand" "=d")
1485 (match_operand:P 2 "register_operand" "=&a")])]
1488 s390_reload_symref_address (operands[1], operands[0], operands[2], 1);
1492 (define_expand "reload<ALL:mode><P:mode>_toreg_z10"
1493 [(parallel [(match_operand:ALL 0 "register_operand" "=d")
1494 (match_operand:ALL 1 "memory_operand" "")
1495 (match_operand:P 2 "register_operand" "=a")])]
1498 s390_reload_symref_address (operands[0], operands[1], operands[2], 0);
1502 (define_expand "reload<P:mode>_larl_odd_addend_z10"
1503 [(parallel [(match_operand:P 0 "register_operand" "=d")
1504 (match_operand:P 1 "larl_operand" "")
1505 (match_operand:P 2 "register_operand" "=a")])]
1508 s390_reload_larl_operand (operands[0], operands[1], operands[2]);
1512 ; Handles loading a PLUS (load address) expression
1514 (define_expand "reload<mode>_plus"
1515 [(parallel [(match_operand:P 0 "register_operand" "=a")
1516 (match_operand:P 1 "s390_plus_operand" "")
1517 (match_operand:P 2 "register_operand" "=&a")])]
1520 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1524 ; Not all the indirect memory access instructions support the full
1525 ; format (long disp + index + base). So whenever a move from/to such
1526 ; an address is required and the instruction cannot deal with it we do
1527 ; a load address into a scratch register first and use this as the new
1529 ; This in particular is used for:
1530 ; - non-offsetable memory accesses for multiword moves
1531 ; - full vector reg moves with long displacements
1533 (define_expand "reload<mode>_la_in"
1534 [(parallel [(match_operand 0 "register_operand" "")
1535 (match_operand 1 "" "")
1536 (match_operand:P 2 "register_operand" "=&a")])]
1539 gcc_assert (MEM_P (operands[1]));
1540 s390_load_address (operands[2], find_replacement (&XEXP (operands[1], 0)));
1541 operands[1] = replace_equiv_address (operands[1], operands[2]);
1542 emit_move_insn (operands[0], operands[1]);
1546 (define_expand "reload<mode>_la_out"
1547 [(parallel [(match_operand 0 "" "")
1548 (match_operand 1 "register_operand" "")
1549 (match_operand:P 2 "register_operand" "=&a")])]
1552 gcc_assert (MEM_P (operands[0]));
1553 s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
1554 operands[0] = replace_equiv_address (operands[0], operands[2]);
1555 emit_move_insn (operands[0], operands[1]);
1559 (define_expand "reload<mode>_PIC_addr"
1560 [(parallel [(match_operand 0 "register_operand" "=d")
1561 (match_operand 1 "larl_operand" "")
1562 (match_operand:P 2 "register_operand" "=a")])]
1565 rtx new_rtx = legitimize_pic_address (operands[1], operands[2]);
1566 emit_move_insn (operands[0], new_rtx);
1570 ; movdi instruction pattern(s).
1573 (define_expand "movdi"
1574 [(set (match_operand:DI 0 "general_operand" "")
1575 (match_operand:DI 1 "general_operand" ""))]
1578 /* Handle symbolic constants. */
1580 && (SYMBOLIC_CONST (operands[1])
1581 || (GET_CODE (operands[1]) == PLUS
1582 && XEXP (operands[1], 0) == pic_offset_table_rtx
1583 && SYMBOLIC_CONST (XEXP (operands[1], 1)))))
1584 emit_symbolic_move (operands);
1587 (define_insn "*movdi_larl"
1588 [(set (match_operand:DI 0 "register_operand" "=d")
1589 (match_operand:DI 1 "larl_operand" "X"))]
1591 && !FP_REG_P (operands[0])"
1593 [(set_attr "op_type" "RIL")
1594 (set_attr "type" "larl")
1595 (set_attr "z10prop" "z10_super_A1")])
1597 (define_insn "*movdi_64"
1598 [(set (match_operand:DI 0 "nonimmediate_operand"
1599 "=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")
1600 (match_operand:DI 1 "general_operand"
1601 " 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"))]
1636 [(set_attr "op_type" "RI,RI,RI,RI,RI,RIL,RIL,RIL,RRE,RRE,RXY,RIL,RRE,RXY,
1637 RXY,RR,RX,RXY,RX,RXY,RIL,SIL,*,*,RS,RS,VRI,VRR,VRS,VRS,VRX,VRX")
1638 (set_attr "type" "*,*,*,*,*,*,*,*,floaddf,floaddf,la,larl,lr,load,store,
1639 floaddf,floaddf,floaddf,fstoredf,fstoredf,larl,*,*,*,*,
1641 (set_attr "cpu_facility" "*,*,*,*,*,extimm,extimm,extimm,dfp,dfp,longdisp,
1642 z10,*,*,*,*,*,longdisp,*,longdisp,
1643 z10,z10,*,*,*,*,vec,vec,vec,vec,vec,vec")
1644 (set_attr "z10prop" "z10_fwd_A1,
1673 [(set (match_operand:DI 0 "register_operand" "")
1674 (match_operand:DI 1 "register_operand" ""))]
1675 "TARGET_ZARCH && ACCESS_REG_P (operands[1])"
1676 [(set (match_dup 2) (match_dup 3))
1677 (set (match_dup 0) (ashift:DI (match_dup 0) (const_int 32)))
1678 (set (strict_low_part (match_dup 2)) (match_dup 4))]
1679 "operands[2] = gen_lowpart (SImode, operands[0]);
1680 s390_split_access_reg (operands[1], &operands[4], &operands[3]);")
1683 [(set (match_operand:DI 0 "register_operand" "")
1684 (match_operand:DI 1 "register_operand" ""))]
1685 "TARGET_ZARCH && ACCESS_REG_P (operands[0])
1686 && dead_or_set_p (insn, operands[1])"
1687 [(set (match_dup 3) (match_dup 2))
1688 (set (match_dup 1) (lshiftrt:DI (match_dup 1) (const_int 32)))
1689 (set (match_dup 4) (match_dup 2))]
1690 "operands[2] = gen_lowpart (SImode, operands[1]);
1691 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1694 [(set (match_operand:DI 0 "register_operand" "")
1695 (match_operand:DI 1 "register_operand" ""))]
1696 "TARGET_ZARCH && ACCESS_REG_P (operands[0])
1697 && !dead_or_set_p (insn, operands[1])"
1698 [(set (match_dup 3) (match_dup 2))
1699 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))
1700 (set (match_dup 4) (match_dup 2))
1701 (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))]
1702 "operands[2] = gen_lowpart (SImode, operands[1]);
1703 s390_split_access_reg (operands[0], &operands[3], &operands[4]);")
1705 (define_insn "*movdi_31"
1706 [(set (match_operand:DI 0 "nonimmediate_operand"
1707 "=d,d,Q,S,d ,o,!*f,!*f,!*f,!R,!T,d")
1708 (match_operand:DI 1 "general_operand"
1709 " Q,S,d,d,dPRT,d, *f, R, T,*f,*f,b"))]
1724 [(set_attr "op_type" "RS,RSY,RS,RSY,*,*,RR,RX,RXY,RX,RXY,*")
1725 (set_attr "type" "lm,lm,stm,stm,*,*,floaddf,floaddf,floaddf,fstoredf,fstoredf,*")
1726 (set_attr "cpu_facility" "*,*,*,*,*,*,*,*,*,*,*,z10")])
1728 ; For a load from a symbol ref we can use one of the target registers
1729 ; together with larl to load the address.
1731 [(set (match_operand:DI 0 "register_operand" "")
1732 (match_operand:DI 1 "memory_operand" ""))]
1733 "!TARGET_ZARCH && reload_completed && TARGET_Z10
1734 && larl_operand (XEXP (operands[1], 0), SImode)"
1735 [(set (match_dup 2) (match_dup 3))
1736 (set (match_dup 0) (match_dup 1))]
1738 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1739 operands[3] = XEXP (operands[1], 0);
1740 operands[1] = replace_equiv_address (operands[1], operands[2]);
1744 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1745 (match_operand:DI 1 "general_operand" ""))]
1746 "!TARGET_ZARCH && reload_completed
1747 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1748 [(set (match_dup 2) (match_dup 4))
1749 (set (match_dup 3) (match_dup 5))]
1751 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1752 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1753 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1754 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1758 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1759 (match_operand:DI 1 "general_operand" ""))]
1760 "!TARGET_ZARCH && reload_completed
1761 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1762 [(set (match_dup 2) (match_dup 4))
1763 (set (match_dup 3) (match_dup 5))]
1765 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1766 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1767 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1768 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1772 [(set (match_operand:DI 0 "register_operand" "")
1773 (match_operand:DI 1 "memory_operand" ""))]
1774 "!TARGET_ZARCH && reload_completed
1775 && !FP_REG_P (operands[0])
1776 && !s_operand (operands[1], VOIDmode)"
1777 [(set (match_dup 0) (match_dup 1))]
1779 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1780 s390_load_address (addr, XEXP (operands[1], 0));
1781 operands[1] = replace_equiv_address (operands[1], addr);
1785 [(set (match_operand:DI 0 "register_operand" "")
1786 (mem:DI (match_operand 1 "address_operand" "")))]
1788 && !FP_REG_P (operands[0])
1789 && GET_CODE (operands[1]) == SYMBOL_REF
1790 && CONSTANT_POOL_ADDRESS_P (operands[1])
1791 && get_pool_mode (operands[1]) == DImode
1792 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1793 [(set (match_dup 0) (match_dup 2))]
1794 "operands[2] = get_pool_constant (operands[1]);")
1796 (define_insn "*la_64"
1797 [(set (match_operand:DI 0 "register_operand" "=d,d")
1798 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))]
1803 [(set_attr "op_type" "RX,RXY")
1804 (set_attr "type" "la")
1805 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
1809 [(set (match_operand:DI 0 "register_operand" "")
1810 (match_operand:QI 1 "address_operand" ""))
1811 (clobber (reg:CC CC_REGNUM))])]
1813 && preferred_la_operand_p (operands[1], const0_rtx)"
1814 [(set (match_dup 0) (match_dup 1))]
1818 [(set (match_operand:DI 0 "register_operand" "")
1819 (match_operand:DI 1 "register_operand" ""))
1822 (plus:DI (match_dup 0)
1823 (match_operand:DI 2 "nonmemory_operand" "")))
1824 (clobber (reg:CC CC_REGNUM))])]
1826 && !reg_overlap_mentioned_p (operands[0], operands[2])
1827 && preferred_la_operand_p (operands[1], operands[2])"
1828 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1832 ; movsi instruction pattern(s).
1835 (define_expand "movsi"
1836 [(set (match_operand:SI 0 "general_operand" "")
1837 (match_operand:SI 1 "general_operand" ""))]
1840 /* Handle symbolic constants. */
1842 && (SYMBOLIC_CONST (operands[1])
1843 || (GET_CODE (operands[1]) == PLUS
1844 && XEXP (operands[1], 0) == pic_offset_table_rtx
1845 && SYMBOLIC_CONST (XEXP(operands[1], 1)))))
1846 emit_symbolic_move (operands);
1849 (define_insn "*movsi_larl"
1850 [(set (match_operand:SI 0 "register_operand" "=d")
1851 (match_operand:SI 1 "larl_operand" "X"))]
1852 "!TARGET_64BIT && TARGET_CPU_ZARCH
1853 && !FP_REG_P (operands[0])"
1855 [(set_attr "op_type" "RIL")
1856 (set_attr "type" "larl")
1857 (set_attr "z10prop" "z10_fwd_A1")])
1859 (define_insn "*movsi_zarch"
1860 [(set (match_operand:SI 0 "nonimmediate_operand"
1861 "=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")
1862 (match_operand:SI 1 "general_operand"
1863 " 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"))]
1896 [(set_attr "op_type" "RI,RI,RI,RIL,RXY,RIL,RR,RX,RXY,RX,RXY,
1897 RRE,RR,RXE,RX,RXY,RX,RXY,RRE,RRE,RS,RIL,SIL,RS,VRI,VRR,VRS,VRS,VRX,VRX")
1898 (set_attr "type" "*,
1922 (set_attr "cpu_facility" "*,*,*,extimm,longdisp,z10,*,*,longdisp,*,longdisp,
1923 vec,*,vec,*,longdisp,*,longdisp,*,*,*,z10,z10,*,vec,vec,vec,vec,vec,vec")
1924 (set_attr "z10prop" "z10_fwd_A1,
1949 (define_insn "*movsi_esa"
1950 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!*f,!*f,!R,d,t,Q,t")
1951 (match_operand:SI 1 "general_operand" "K,d,R,d, *f, *f, R, R,*f,t,d,t,Q"))]
1967 [(set_attr "op_type" "RI,RR,RX,RX,RRE,RR,RXE,RX,RX,RRE,RRE,RS,RS")
1968 (set_attr "type" "*,lr,load,store,floadsf,floadsf,floadsf,floadsf,fstoresf,*,*,*,*")
1969 (set_attr "z10prop" "z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_rec,*,*,*,*,*,z10_super_E1,
1971 (set_attr "cpu_facility" "*,*,*,*,vec,*,vec,*,*,*,*,*,*")
1975 [(set (match_operand:SI 0 "register_operand" "")
1976 (mem:SI (match_operand 1 "address_operand" "")))]
1977 "!FP_REG_P (operands[0])
1978 && GET_CODE (operands[1]) == SYMBOL_REF
1979 && CONSTANT_POOL_ADDRESS_P (operands[1])
1980 && get_pool_mode (operands[1]) == SImode
1981 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1982 [(set (match_dup 0) (match_dup 2))]
1983 "operands[2] = get_pool_constant (operands[1]);")
1985 (define_insn "*la_31"
1986 [(set (match_operand:SI 0 "register_operand" "=d,d")
1987 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))]
1988 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1992 [(set_attr "op_type" "RX,RXY")
1993 (set_attr "type" "la")
1994 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
1998 [(set (match_operand:SI 0 "register_operand" "")
1999 (match_operand:QI 1 "address_operand" ""))
2000 (clobber (reg:CC CC_REGNUM))])]
2002 && preferred_la_operand_p (operands[1], const0_rtx)"
2003 [(set (match_dup 0) (match_dup 1))]
2007 [(set (match_operand:SI 0 "register_operand" "")
2008 (match_operand:SI 1 "register_operand" ""))
2011 (plus:SI (match_dup 0)
2012 (match_operand:SI 2 "nonmemory_operand" "")))
2013 (clobber (reg:CC CC_REGNUM))])]
2015 && !reg_overlap_mentioned_p (operands[0], operands[2])
2016 && preferred_la_operand_p (operands[1], operands[2])"
2017 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
2020 (define_insn "*la_31_and"
2021 [(set (match_operand:SI 0 "register_operand" "=d,d")
2022 (and:SI (match_operand:QI 1 "address_operand" "ZQZR,ZSZT")
2023 (const_int 2147483647)))]
2028 [(set_attr "op_type" "RX,RXY")
2029 (set_attr "type" "la")
2030 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
2032 (define_insn_and_split "*la_31_and_cc"
2033 [(set (match_operand:SI 0 "register_operand" "=d")
2034 (and:SI (match_operand:QI 1 "address_operand" "p")
2035 (const_int 2147483647)))
2036 (clobber (reg:CC CC_REGNUM))]
2039 "&& reload_completed"
2041 (and:SI (match_dup 1) (const_int 2147483647)))]
2043 [(set_attr "op_type" "RX")
2044 (set_attr "type" "la")])
2046 (define_insn "force_la_31"
2047 [(set (match_operand:SI 0 "register_operand" "=d,d")
2048 (match_operand:QI 1 "address_operand" "ZQZR,ZSZT"))
2049 (use (const_int 0))]
2054 [(set_attr "op_type" "RX")
2055 (set_attr "type" "la")
2056 (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")])
2059 ; movhi instruction pattern(s).
2062 (define_expand "movhi"
2063 [(set (match_operand:HI 0 "nonimmediate_operand" "")
2064 (match_operand:HI 1 "general_operand" ""))]
2067 /* Make it explicit that loading a register from memory
2068 always sign-extends (at least) to SImode. */
2069 if (optimize && can_create_pseudo_p ()
2070 && register_operand (operands[0], VOIDmode)
2071 && GET_CODE (operands[1]) == MEM)
2073 rtx tmp = gen_reg_rtx (SImode);
2074 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
2075 emit_insn (gen_rtx_SET (tmp, ext));
2076 operands[1] = gen_lowpart (HImode, tmp);
2080 (define_insn "*movhi"
2081 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,d,R,T,b,Q,v,v,v,d, v,QR")
2082 (match_operand:HI 1 "general_operand" " d,n,R,T,b,d,d,d,K,K,v,d,v,QR, v"))]
2100 [(set_attr "op_type" "RR,RI,RX,RXY,RIL,RX,RXY,RIL,SIL,VRI,VRR,VRS,VRS,VRX,VRX")
2101 (set_attr "type" "lr,*,*,*,larl,store,store,store,*,*,*,*,*,*,*")
2102 (set_attr "cpu_facility" "*,*,*,*,z10,*,*,z10,z10,vec,vec,vec,vec,vec,vec")
2103 (set_attr "z10prop" "z10_fr_E1,
2111 z10_super,*,*,*,*,*,*")])
2114 [(set (match_operand:HI 0 "register_operand" "")
2115 (mem:HI (match_operand 1 "address_operand" "")))]
2116 "GET_CODE (operands[1]) == SYMBOL_REF
2117 && CONSTANT_POOL_ADDRESS_P (operands[1])
2118 && get_pool_mode (operands[1]) == HImode
2119 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
2120 [(set (match_dup 0) (match_dup 2))]
2121 "operands[2] = get_pool_constant (operands[1]);")
2124 ; movqi instruction pattern(s).
2127 (define_expand "movqi"
2128 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2129 (match_operand:QI 1 "general_operand" ""))]
2132 /* On z/Architecture, zero-extending from memory to register
2133 is just as fast as a QImode load. */
2134 if (TARGET_ZARCH && optimize && can_create_pseudo_p ()
2135 && register_operand (operands[0], VOIDmode)
2136 && GET_CODE (operands[1]) == MEM)
2138 rtx tmp = gen_reg_rtx (DImode);
2139 rtx ext = gen_rtx_ZERO_EXTEND (DImode, operands[1]);
2140 emit_insn (gen_rtx_SET (tmp, ext));
2141 operands[1] = gen_lowpart (QImode, tmp);
2145 (define_insn "*movqi"
2146 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q,v,v,v,d, v,QR")
2147 (match_operand:QI 1 "general_operand" " d,n,R,T,d,d,n,n,?Q,K,v,d,v,QR, v"))]
2165 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS,VRI,VRR,VRS,VRS,VRX,VRX")
2166 (set_attr "type" "lr,*,*,*,store,store,store,store,*,*,*,*,*,*,*")
2167 (set_attr "cpu_facility" "*,*,*,*,*,*,*,*,*,vec,vec,vec,vec,vec,vec")
2168 (set_attr "z10prop" "z10_fr_E1,
2179 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2180 (mem:QI (match_operand 1 "address_operand" "")))]
2181 "GET_CODE (operands[1]) == SYMBOL_REF
2182 && CONSTANT_POOL_ADDRESS_P (operands[1])
2183 && get_pool_mode (operands[1]) == QImode
2184 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
2185 [(set (match_dup 0) (match_dup 2))]
2186 "operands[2] = get_pool_constant (operands[1]);")
2189 ; movstrictqi instruction pattern(s).
2192 (define_insn "*movstrictqi"
2193 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
2194 (match_operand:QI 1 "memory_operand" "R,T"))]
2199 [(set_attr "op_type" "RX,RXY")
2200 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
2203 ; movstricthi instruction pattern(s).
2206 (define_insn "*movstricthi"
2207 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
2208 (match_operand:HI 1 "memory_operand" "Q,S"))
2209 (clobber (reg:CC CC_REGNUM))]
2214 [(set_attr "op_type" "RS,RSY")
2215 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
2218 ; movstrictsi instruction pattern(s).
2221 (define_insn "movstrictsi"
2222 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d,d"))
2223 (match_operand:SI 1 "general_operand" "d,R,T,t"))]
2230 [(set_attr "op_type" "RR,RX,RXY,RRE")
2231 (set_attr "type" "lr,load,load,*")
2232 (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_super_E1")])
2235 ; mov(tf|td) instruction pattern(s).
2238 (define_expand "mov<mode>"
2239 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2240 (match_operand:TD_TF 1 "general_operand" ""))]
2244 (define_insn "*mov<mode>_64"
2245 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o, d,QS, d,o")
2246 (match_operand:TD_TF 1 "general_operand" " G,f,o,f,QS, d,dRT,d"))]
2257 [(set_attr "op_type" "RRE,RRE,*,*,RSY,RSY,*,*")
2258 (set_attr "type" "fsimptf,fsimptf,*,*,lm,stm,*,*")
2259 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*")])
2261 (define_insn "*mov<mode>_31"
2262 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o")
2263 (match_operand:TD_TF 1 "general_operand" " G,f,o,f"))]
2270 [(set_attr "op_type" "RRE,RRE,*,*")
2271 (set_attr "type" "fsimptf,fsimptf,*,*")
2272 (set_attr "cpu_facility" "z196,*,*,*")])
2274 ; TFmode in GPRs splitters
2277 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2278 (match_operand:TD_TF 1 "general_operand" ""))]
2279 "TARGET_ZARCH && reload_completed
2280 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)"
2281 [(set (match_dup 2) (match_dup 4))
2282 (set (match_dup 3) (match_dup 5))]
2284 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
2285 operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode);
2286 operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode);
2287 operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode);
2291 [(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
2292 (match_operand:TD_TF 1 "general_operand" ""))]
2293 "TARGET_ZARCH && reload_completed
2294 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)"
2295 [(set (match_dup 2) (match_dup 4))
2296 (set (match_dup 3) (match_dup 5))]
2298 operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode);
2299 operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode);
2300 operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode);
2301 operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode);
2305 [(set (match_operand:TD_TF 0 "register_operand" "")
2306 (match_operand:TD_TF 1 "memory_operand" ""))]
2307 "TARGET_ZARCH && reload_completed
2308 && GENERAL_REG_P (operands[0])
2309 && !s_operand (operands[1], VOIDmode)"
2310 [(set (match_dup 0) (match_dup 1))]
2312 rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode);
2313 addr = gen_lowpart (Pmode, addr);
2314 s390_load_address (addr, XEXP (operands[1], 0));
2315 operands[1] = replace_equiv_address (operands[1], addr);
2318 ; TFmode in BFPs splitters
2321 [(set (match_operand:TD_TF 0 "register_operand" "")
2322 (match_operand:TD_TF 1 "memory_operand" ""))]
2323 "reload_completed && offsettable_memref_p (operands[1])
2324 && FP_REG_P (operands[0])"
2325 [(set (match_dup 2) (match_dup 4))
2326 (set (match_dup 3) (match_dup 5))]
2328 operands[2] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0],
2330 operands[3] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0],
2332 operands[4] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 0);
2333 operands[5] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 8);
2337 [(set (match_operand:TD_TF 0 "memory_operand" "")
2338 (match_operand:TD_TF 1 "register_operand" ""))]
2339 "reload_completed && offsettable_memref_p (operands[0])
2340 && FP_REG_P (operands[1])"
2341 [(set (match_dup 2) (match_dup 4))
2342 (set (match_dup 3) (match_dup 5))]
2344 operands[2] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 0);
2345 operands[3] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 8);
2346 operands[4] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1],
2348 operands[5] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1],
2353 ; mov(df|dd) instruction pattern(s).
2356 (define_expand "mov<mode>"
2357 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2358 (match_operand:DD_DF 1 "general_operand" ""))]
2362 (define_insn "*mov<mode>_64dfp"
2363 [(set (match_operand:DD_DF 0 "nonimmediate_operand"
2364 "=f,f,f,d,f,f,R,T,d,d,d, d,b,RT,v,v,d,v,QR")
2365 (match_operand:DD_DF 1 "general_operand"
2366 " G,f,d,f,R,T,f,f,G,d,b,RT,d, d,v,d,v,QR,v"))]
2388 [(set_attr "op_type" "RRE,RR,RRE,RRE,RX,RXY,RX,RXY,RI,RRE,RIL,RXY,RIL,RXY,VRR,VRS,VRS,VRX,VRX")
2389 (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,floaddf,floaddf,
2390 fstoredf,fstoredf,*,lr,load,load,store,store,*,*,*,load,store")
2391 (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,*,*,*,*,*")
2392 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*,z10,*,z10,*,vec,vec,vec,vec,vec")])
2394 (define_insn "*mov<mode>_64"
2395 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,d, d,b,RT,v,v,QR")
2396 (match_operand:DD_DF 1 "general_operand" " G,f,R,T,f,f,G,d,b,RT,d, d,v,QR,v"))]
2414 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RI,RRE,RIL,RXY,RIL,RXY,VRR,VRX,VRX")
2415 (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>,
2416 fstore<mode>,fstore<mode>,*,lr,load,load,store,store,*,load,store")
2417 (set_attr "z10prop" "*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,*,*,*")
2418 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,z10,*,z10,*,vec,vec,vec")])
2420 (define_insn "*mov<mode>_31"
2421 [(set (match_operand:DD_DF 0 "nonimmediate_operand"
2422 "=f,f,f,f,R,T,d,d,Q,S, d,o")
2423 (match_operand:DD_DF 1 "general_operand"
2424 " G,f,R,T,f,f,Q,S,d,d,dPRT,d"))]
2439 [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*")
2440 (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>,
2441 fstore<mode>,fstore<mode>,lm,lm,stm,stm,*,*")
2442 (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*,*,*,*,*")])
2445 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2446 (match_operand:DD_DF 1 "general_operand" ""))]
2447 "!TARGET_ZARCH && reload_completed
2448 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)"
2449 [(set (match_dup 2) (match_dup 4))
2450 (set (match_dup 3) (match_dup 5))]
2452 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
2453 operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode);
2454 operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode);
2455 operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode);
2459 [(set (match_operand:DD_DF 0 "nonimmediate_operand" "")
2460 (match_operand:DD_DF 1 "general_operand" ""))]
2461 "!TARGET_ZARCH && reload_completed
2462 && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)"
2463 [(set (match_dup 2) (match_dup 4))
2464 (set (match_dup 3) (match_dup 5))]
2466 operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode);
2467 operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode);
2468 operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode);
2469 operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode);
2473 [(set (match_operand:DD_DF 0 "register_operand" "")
2474 (match_operand:DD_DF 1 "memory_operand" ""))]
2475 "!TARGET_ZARCH && reload_completed
2476 && !FP_REG_P (operands[0])
2477 && !s_operand (operands[1], VOIDmode)"
2478 [(set (match_dup 0) (match_dup 1))]
2480 rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode);
2481 s390_load_address (addr, XEXP (operands[1], 0));
2482 operands[1] = replace_equiv_address (operands[1], addr);
2486 ; mov(sf|sd) instruction pattern(s).
2489 (define_insn "mov<mode>"
2490 [(set (match_operand:SD_SF 0 "nonimmediate_operand"
2491 "=f,f,f,f,f,f,R,T,d,d,d,d,d,b,R,T,v,v,v,d,v,QR")
2492 (match_operand:SD_SF 1 "general_operand"
2493 " G,f,f,R,R,T,f,f,G,d,b,R,T,d,d,d,v,G,d,v,QR,v"))]
2518 [(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")
2519 (set_attr "type" "fsimpsf,fsimpsf,fload<mode>,fload<mode>,fload<mode>,fload<mode>,
2520 fstore<mode>,fstore<mode>,*,lr,load,load,load,store,store,store,*,*,*,*,load,store")
2521 (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,z10_rec,*,*,*,*,*,*")
2522 (set_attr "cpu_facility" "z196,vec,*,vec,*,*,*,*,*,*,z10,*,*,z10,*,*,vec,vec,vec,vec,vec,vec")])
2525 ; movcc instruction pattern
2528 (define_insn "movcc"
2529 [(set (match_operand:CC 0 "nonimmediate_operand" "=d,c,d,d,d,R,T")
2530 (match_operand:CC 1 "nonimmediate_operand" " d,d,c,R,T,d,d"))]
2540 [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY")
2541 (set_attr "type" "lr,*,*,load,load,store,store")
2542 (set_attr "z10prop" "z10_fr_E1,z10_super,*,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec")
2543 (set_attr "z196prop" "*,*,z196_ends,*,*,*,*")])
2546 ; Block move (MVC) patterns.
2550 [(set (match_operand:BLK 0 "memory_operand" "=Q")
2551 (match_operand:BLK 1 "memory_operand" "Q"))
2552 (use (match_operand 2 "const_int_operand" "n"))]
2553 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
2554 "mvc\t%O0(%2,%R0),%S1"
2555 [(set_attr "op_type" "SS")])
2557 ; This splitter converts a QI to QI mode copy into a BLK mode copy in
2558 ; order to have it implemented with mvc.
2561 [(set (match_operand:QI 0 "memory_operand" "")
2562 (match_operand:QI 1 "memory_operand" ""))]
2565 [(set (match_dup 0) (match_dup 1))
2566 (use (const_int 1))])]
2568 operands[0] = adjust_address (operands[0], BLKmode, 0);
2569 operands[1] = adjust_address (operands[1], BLKmode, 0);
2575 [(set (match_operand:BLK 0 "memory_operand" "")
2576 (match_operand:BLK 1 "memory_operand" ""))
2577 (use (match_operand 2 "const_int_operand" ""))])
2579 [(set (match_operand:BLK 3 "memory_operand" "")
2580 (match_operand:BLK 4 "memory_operand" ""))
2581 (use (match_operand 5 "const_int_operand" ""))])]
2582 "s390_offset_p (operands[0], operands[3], operands[2])
2583 && s390_offset_p (operands[1], operands[4], operands[2])
2584 && !s390_overlap_p (operands[0], operands[1],
2585 INTVAL (operands[2]) + INTVAL (operands[5]))
2586 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
2588 [(set (match_dup 6) (match_dup 7))
2589 (use (match_dup 8))])]
2590 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
2591 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
2592 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
2596 ; load_multiple pattern(s).
2598 ; ??? Due to reload problems with replacing registers inside match_parallel
2599 ; we currently support load_multiple/store_multiple only after reload.
2602 (define_expand "load_multiple"
2603 [(match_par_dup 3 [(set (match_operand 0 "" "")
2604 (match_operand 1 "" ""))
2605 (use (match_operand 2 "" ""))])]
2614 /* Support only loading a constant number of fixed-point registers from
2615 memory and only bother with this if more than two */
2616 if (GET_CODE (operands[2]) != CONST_INT
2617 || INTVAL (operands[2]) < 2
2618 || INTVAL (operands[2]) > 16
2619 || GET_CODE (operands[1]) != MEM
2620 || GET_CODE (operands[0]) != REG
2621 || REGNO (operands[0]) >= 16)
2624 count = INTVAL (operands[2]);
2625 regno = REGNO (operands[0]);
2626 mode = GET_MODE (operands[0]);
2627 if (mode != SImode && (!TARGET_ZARCH || mode != DImode))
2630 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2631 if (!can_create_pseudo_p ())
2633 if (GET_CODE (XEXP (operands[1], 0)) == REG)
2635 from = XEXP (operands[1], 0);
2638 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
2639 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
2640 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
2642 from = XEXP (XEXP (operands[1], 0), 0);
2643 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
2650 from = force_reg (Pmode, XEXP (operands[1], 0));
2654 for (i = 0; i < count; i++)
2655 XVECEXP (operands[3], 0, i)
2656 = gen_rtx_SET (gen_rtx_REG (mode, regno + i),
2657 change_address (operands[1], mode,
2658 plus_constant (Pmode, from,
2659 off + i * GET_MODE_SIZE (mode))));
2662 (define_insn "*load_multiple_di"
2663 [(match_parallel 0 "load_multiple_operation"
2664 [(set (match_operand:DI 1 "register_operand" "=r")
2665 (match_operand:DI 2 "s_operand" "QS"))])]
2666 "reload_completed && TARGET_ZARCH"
2668 int words = XVECLEN (operands[0], 0);
2669 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
2670 return "lmg\t%1,%0,%S2";
2672 [(set_attr "op_type" "RSY")
2673 (set_attr "type" "lm")])
2675 (define_insn "*load_multiple_si"
2676 [(match_parallel 0 "load_multiple_operation"
2677 [(set (match_operand:SI 1 "register_operand" "=r,r")
2678 (match_operand:SI 2 "s_operand" "Q,S"))])]
2681 int words = XVECLEN (operands[0], 0);
2682 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
2683 return which_alternative == 0 ? "lm\t%1,%0,%S2" : "lmy\t%1,%0,%S2";
2685 [(set_attr "op_type" "RS,RSY")
2686 (set_attr "type" "lm")])
2689 ; store multiple pattern(s).
2692 (define_expand "store_multiple"
2693 [(match_par_dup 3 [(set (match_operand 0 "" "")
2694 (match_operand 1 "" ""))
2695 (use (match_operand 2 "" ""))])]
2704 /* Support only storing a constant number of fixed-point registers to
2705 memory and only bother with this if more than two. */
2706 if (GET_CODE (operands[2]) != CONST_INT
2707 || INTVAL (operands[2]) < 2
2708 || INTVAL (operands[2]) > 16
2709 || GET_CODE (operands[0]) != MEM
2710 || GET_CODE (operands[1]) != REG
2711 || REGNO (operands[1]) >= 16)
2714 count = INTVAL (operands[2]);
2715 regno = REGNO (operands[1]);
2716 mode = GET_MODE (operands[1]);
2717 if (mode != SImode && (!TARGET_ZARCH || mode != DImode))
2720 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
2722 if (!can_create_pseudo_p ())
2724 if (GET_CODE (XEXP (operands[0], 0)) == REG)
2726 to = XEXP (operands[0], 0);
2729 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
2730 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
2731 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
2733 to = XEXP (XEXP (operands[0], 0), 0);
2734 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
2741 to = force_reg (Pmode, XEXP (operands[0], 0));
2745 for (i = 0; i < count; i++)
2746 XVECEXP (operands[3], 0, i)
2747 = gen_rtx_SET (change_address (operands[0], mode,
2748 plus_constant (Pmode, to,
2749 off + i * GET_MODE_SIZE (mode))),
2750 gen_rtx_REG (mode, regno + i));
2753 (define_insn "*store_multiple_di"
2754 [(match_parallel 0 "store_multiple_operation"
2755 [(set (match_operand:DI 1 "s_operand" "=QS")
2756 (match_operand:DI 2 "register_operand" "r"))])]
2757 "reload_completed && TARGET_ZARCH"
2759 int words = XVECLEN (operands[0], 0);
2760 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
2761 return "stmg\t%2,%0,%S1";
2763 [(set_attr "op_type" "RSY")
2764 (set_attr "type" "stm")])
2767 (define_insn "*store_multiple_si"
2768 [(match_parallel 0 "store_multiple_operation"
2769 [(set (match_operand:SI 1 "s_operand" "=Q,S")
2770 (match_operand:SI 2 "register_operand" "r,r"))])]
2773 int words = XVECLEN (operands[0], 0);
2774 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
2775 return which_alternative == 0 ? "stm\t%2,%0,%S1" : "stmy\t%2,%0,%S1";
2777 [(set_attr "op_type" "RS,RSY")
2778 (set_attr "type" "stm")])
2781 ;; String instructions.
2784 (define_insn "*execute_rl"
2785 [(match_parallel 0 "execute_operation"
2786 [(unspec [(match_operand 1 "register_operand" "a")
2787 (match_operand 2 "" "")
2788 (match_operand:SI 3 "larl_operand" "X")] UNSPEC_EXECUTE)])]
2789 "TARGET_Z10 && GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
2790 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
2792 [(set_attr "op_type" "RIL")
2793 (set_attr "type" "cs")])
2795 (define_insn "*execute"
2796 [(match_parallel 0 "execute_operation"
2797 [(unspec [(match_operand 1 "register_operand" "a")
2798 (match_operand:BLK 2 "memory_operand" "R")
2799 (match_operand 3 "" "")] UNSPEC_EXECUTE)])]
2800 "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
2801 && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD"
2803 [(set_attr "op_type" "RX")
2804 (set_attr "type" "cs")])
2808 ; strlenM instruction pattern(s).
2811 (define_expand "strlen<mode>"
2812 [(match_operand:P 0 "register_operand" "") ; result
2813 (match_operand:BLK 1 "memory_operand" "") ; input string
2814 (match_operand:SI 2 "immediate_operand" "") ; search character
2815 (match_operand:SI 3 "immediate_operand" "")] ; known alignment
2818 if (!TARGET_VX || operands[2] != const0_rtx)
2819 emit_insn (gen_strlen_srst<mode> (operands[0], operands[1],
2820 operands[2], operands[3]));
2822 s390_expand_vec_strlen (operands[0], operands[1], operands[3]);
2827 (define_expand "strlen_srst<mode>"
2828 [(set (reg:SI 0) (match_operand:SI 2 "immediate_operand" ""))
2831 (unspec:P [(const_int 0)
2832 (match_operand:BLK 1 "memory_operand" "")
2834 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
2835 (clobber (scratch:P))
2836 (clobber (reg:CC CC_REGNUM))])
2838 [(set (match_operand:P 0 "register_operand" "")
2839 (minus:P (match_dup 4) (match_dup 5)))
2840 (clobber (reg:CC CC_REGNUM))])]
2843 operands[4] = gen_reg_rtx (Pmode);
2844 operands[5] = gen_reg_rtx (Pmode);
2845 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
2846 operands[1] = replace_equiv_address (operands[1], operands[5]);
2849 (define_insn "*strlen<mode>"
2850 [(set (match_operand:P 0 "register_operand" "=a")
2851 (unspec:P [(match_operand:P 2 "general_operand" "0")
2852 (mem:BLK (match_operand:P 3 "register_operand" "1"))
2854 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
2855 (clobber (match_scratch:P 1 "=a"))
2856 (clobber (reg:CC CC_REGNUM))]
2858 "srst\t%0,%1\;jo\t.-4"
2859 [(set_attr "length" "8")
2860 (set_attr "type" "vs")])
2863 ; cmpstrM instruction pattern(s).
2866 (define_expand "cmpstrsi"
2867 [(set (reg:SI 0) (const_int 0))
2869 [(clobber (match_operand 3 "" ""))
2870 (clobber (match_dup 4))
2871 (set (reg:CCU CC_REGNUM)
2872 (compare:CCU (match_operand:BLK 1 "memory_operand" "")
2873 (match_operand:BLK 2 "memory_operand" "")))
2876 [(set (match_operand:SI 0 "register_operand" "=d")
2877 (unspec:SI [(reg:CCU CC_REGNUM)] UNSPEC_STRCMPCC_TO_INT))
2878 (clobber (reg:CC CC_REGNUM))])]
2881 /* As the result of CMPINT is inverted compared to what we need,
2882 we have to swap the operands. */
2883 rtx op1 = operands[2];
2884 rtx op2 = operands[1];
2885 rtx addr1 = gen_reg_rtx (Pmode);
2886 rtx addr2 = gen_reg_rtx (Pmode);
2888 emit_move_insn (addr1, force_operand (XEXP (op1, 0), NULL_RTX));
2889 emit_move_insn (addr2, force_operand (XEXP (op2, 0), NULL_RTX));
2890 operands[1] = replace_equiv_address_nv (op1, addr1);
2891 operands[2] = replace_equiv_address_nv (op2, addr2);
2892 operands[3] = addr1;
2893 operands[4] = addr2;
2896 (define_insn "*cmpstr<mode>"
2897 [(clobber (match_operand:P 0 "register_operand" "=d"))
2898 (clobber (match_operand:P 1 "register_operand" "=d"))
2899 (set (reg:CCU CC_REGNUM)
2900 (compare:CCU (mem:BLK (match_operand:P 2 "register_operand" "0"))
2901 (mem:BLK (match_operand:P 3 "register_operand" "1"))))
2904 "clst\t%0,%1\;jo\t.-4"
2905 [(set_attr "length" "8")
2906 (set_attr "type" "vs")])
2909 ; movstr instruction pattern.
2912 (define_expand "movstr"
2913 [(match_operand 0 "register_operand" "")
2914 (match_operand 1 "memory_operand" "")
2915 (match_operand 2 "memory_operand" "")]
2919 emit_insn (gen_movstrdi (operands[0], operands[1], operands[2]));
2921 emit_insn (gen_movstrsi (operands[0], operands[1], operands[2]));
2925 (define_expand "movstr<P:mode>"
2926 [(set (reg:SI 0) (const_int 0))
2928 [(clobber (match_dup 3))
2929 (set (match_operand:BLK 1 "memory_operand" "")
2930 (match_operand:BLK 2 "memory_operand" ""))
2931 (set (match_operand:P 0 "register_operand" "")
2932 (unspec:P [(match_dup 1)
2934 (reg:SI 0)] UNSPEC_MVST))
2935 (clobber (reg:CC CC_REGNUM))])]
2938 rtx addr1 = gen_reg_rtx (Pmode);
2939 rtx addr2 = gen_reg_rtx (Pmode);
2941 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2942 emit_move_insn (addr2, force_operand (XEXP (operands[2], 0), NULL_RTX));
2943 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2944 operands[2] = replace_equiv_address_nv (operands[2], addr2);
2945 operands[3] = addr2;
2948 (define_insn "*movstr"
2949 [(clobber (match_operand:P 2 "register_operand" "=d"))
2950 (set (mem:BLK (match_operand:P 1 "register_operand" "0"))
2951 (mem:BLK (match_operand:P 3 "register_operand" "2")))
2952 (set (match_operand:P 0 "register_operand" "=d")
2953 (unspec:P [(mem:BLK (match_dup 1))
2954 (mem:BLK (match_dup 3))
2955 (reg:SI 0)] UNSPEC_MVST))
2956 (clobber (reg:CC CC_REGNUM))]
2958 "mvst\t%1,%2\;jo\t.-4"
2959 [(set_attr "length" "8")
2960 (set_attr "type" "vs")])
2964 ; movmemM instruction pattern(s).
2967 (define_expand "movmem<mode>"
2968 [(set (match_operand:BLK 0 "memory_operand" "") ; destination
2969 (match_operand:BLK 1 "memory_operand" "")) ; source
2970 (use (match_operand:GPR 2 "general_operand" "")) ; count
2971 (match_operand 3 "" "")]
2974 if (s390_expand_movmem (operands[0], operands[1], operands[2]))
2980 ; Move a block that is up to 256 bytes in length.
2981 ; The block length is taken as (operands[2] % 256) + 1.
2983 (define_expand "movmem_short"
2985 [(set (match_operand:BLK 0 "memory_operand" "")
2986 (match_operand:BLK 1 "memory_operand" ""))
2987 (use (match_operand 2 "nonmemory_operand" ""))
2988 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
2989 (clobber (match_dup 3))])]
2991 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2993 (define_insn "*movmem_short"
2994 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q")
2995 (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q"))
2996 (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
2997 (use (match_operand 3 "immediate_operand" "X,R,X,X"))
2998 (clobber (match_scratch:P 4 "=X,X,X,&a"))]
2999 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
3001 [(set_attr "type" "cs")
3002 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3005 [(set (match_operand:BLK 0 "memory_operand" "")
3006 (match_operand:BLK 1 "memory_operand" ""))
3007 (use (match_operand 2 "const_int_operand" ""))
3008 (use (match_operand 3 "immediate_operand" ""))
3009 (clobber (scratch))]
3012 [(set (match_dup 0) (match_dup 1))
3013 (use (match_dup 2))])]
3014 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
3017 [(set (match_operand:BLK 0 "memory_operand" "")
3018 (match_operand:BLK 1 "memory_operand" ""))
3019 (use (match_operand 2 "register_operand" ""))
3020 (use (match_operand 3 "memory_operand" ""))
3021 (clobber (scratch))]
3024 [(unspec [(match_dup 2) (match_dup 3)
3025 (const_int 0)] UNSPEC_EXECUTE)
3026 (set (match_dup 0) (match_dup 1))
3027 (use (const_int 1))])]
3031 [(set (match_operand:BLK 0 "memory_operand" "")
3032 (match_operand:BLK 1 "memory_operand" ""))
3033 (use (match_operand 2 "register_operand" ""))
3034 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3035 (clobber (scratch))]
3036 "TARGET_Z10 && reload_completed"
3038 [(unspec [(match_dup 2) (const_int 0)
3039 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3040 (set (match_dup 0) (match_dup 1))
3041 (use (const_int 1))])]
3042 "operands[3] = gen_label_rtx ();")
3045 [(set (match_operand:BLK 0 "memory_operand" "")
3046 (match_operand:BLK 1 "memory_operand" ""))
3047 (use (match_operand 2 "register_operand" ""))
3048 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3049 (clobber (match_operand 3 "register_operand" ""))]
3050 "reload_completed && TARGET_CPU_ZARCH"
3051 [(set (match_dup 3) (label_ref (match_dup 4)))
3053 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
3054 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3055 (set (match_dup 0) (match_dup 1))
3056 (use (const_int 1))])]
3057 "operands[4] = gen_label_rtx ();")
3059 ; Move a block of arbitrary length.
3061 (define_expand "movmem_long"
3063 [(clobber (match_dup 2))
3064 (clobber (match_dup 3))
3065 (set (match_operand:BLK 0 "memory_operand" "")
3066 (match_operand:BLK 1 "memory_operand" ""))
3067 (use (match_operand 2 "general_operand" ""))
3069 (clobber (reg:CC CC_REGNUM))])]
3072 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3073 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3074 rtx reg0 = gen_reg_rtx (dreg_mode);
3075 rtx reg1 = gen_reg_rtx (dreg_mode);
3076 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3077 rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1));
3078 rtx len0 = gen_lowpart (Pmode, reg0);
3079 rtx len1 = gen_lowpart (Pmode, reg1);
3081 emit_clobber (reg0);
3082 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3083 emit_move_insn (len0, operands[2]);
3085 emit_clobber (reg1);
3086 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
3087 emit_move_insn (len1, operands[2]);
3089 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3090 operands[1] = replace_equiv_address_nv (operands[1], addr1);
3095 (define_insn "*movmem_long"
3096 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3097 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
3098 (set (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
3099 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0)))
3102 (clobber (reg:CC CC_REGNUM))]
3103 "TARGET_64BIT || !TARGET_ZARCH"
3104 "mvcle\t%0,%1,0\;jo\t.-4"
3105 [(set_attr "length" "8")
3106 (set_attr "type" "vs")])
3108 (define_insn "*movmem_long_31z"
3109 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3110 (clobber (match_operand:TI 1 "register_operand" "=d"))
3111 (set (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4))
3112 (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4)))
3115 (clobber (reg:CC CC_REGNUM))]
3116 "!TARGET_64BIT && TARGET_ZARCH"
3117 "mvcle\t%0,%1,0\;jo\t.-4"
3118 [(set_attr "length" "8")
3119 (set_attr "type" "vs")])
3126 (define_expand "signbit<mode>2"
3127 [(set (reg:CCZ CC_REGNUM)
3128 (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
3131 (set (match_operand:SI 0 "register_operand" "=d")
3132 (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))]
3135 operands[2] = GEN_INT (S390_TDC_SIGNBIT_SET);
3138 (define_expand "isinf<mode>2"
3139 [(set (reg:CCZ CC_REGNUM)
3140 (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
3143 (set (match_operand:SI 0 "register_operand" "=d")
3144 (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))]
3147 operands[2] = GEN_INT (S390_TDC_INFINITY);
3150 ; This extracts CC into a GPR properly shifted. The actual IPM
3151 ; instruction will be issued by reload. The constraint of operand 1
3152 ; forces reload to use a GPR. So reload will issue a movcc insn for
3153 ; copying CC into a GPR first.
3154 (define_insn_and_split "*cc_to_int"
3155 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3156 (unspec:SI [(match_operand 1 "register_operand" "0")]
3161 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 28)))])
3163 ; This insn is used to generate all variants of the Test Data Class
3164 ; instruction, namely tcxb, tcdb, and tceb. The insn's first operand
3165 ; is the register to be tested and the second one is the bit mask
3166 ; specifying the required test(s).
3168 ; tcxb, tcdb, tceb, tdcxt, tdcdt, tdcet
3169 (define_insn "*TDC_insn_<mode>"
3170 [(set (reg:CCZ CC_REGNUM)
3171 (unspec:CCZ [(match_operand:FP_ALL 0 "register_operand" "f")
3172 (match_operand:SI 1 "const_int_operand")] UNSPEC_TDC_INSN))]
3174 "t<_d>c<xde><bt>\t%0,%1"
3175 [(set_attr "op_type" "RXE")
3176 (set_attr "type" "fsimp<mode>")])
3181 ; setmemM instruction pattern(s).
3184 (define_expand "setmem<mode>"
3185 [(set (match_operand:BLK 0 "memory_operand" "")
3186 (match_operand:QI 2 "general_operand" ""))
3187 (use (match_operand:GPR 1 "general_operand" ""))
3188 (match_operand 3 "" "")]
3190 "s390_expand_setmem (operands[0], operands[1], operands[2]); DONE;")
3192 ; Clear a block that is up to 256 bytes in length.
3193 ; The block length is taken as (operands[1] % 256) + 1.
3195 (define_expand "clrmem_short"
3197 [(set (match_operand:BLK 0 "memory_operand" "")
3199 (use (match_operand 1 "nonmemory_operand" ""))
3200 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3201 (clobber (match_dup 2))
3202 (clobber (reg:CC CC_REGNUM))])]
3204 "operands[2] = gen_rtx_SCRATCH (Pmode);")
3206 (define_insn "*clrmem_short"
3207 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q")
3209 (use (match_operand 1 "nonmemory_operand" "n,a,a,a"))
3210 (use (match_operand 2 "immediate_operand" "X,R,X,X"))
3211 (clobber (match_scratch:P 3 "=X,X,X,&a"))
3212 (clobber (reg:CC CC_REGNUM))]
3213 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)"
3215 [(set_attr "type" "cs")
3216 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3219 [(set (match_operand:BLK 0 "memory_operand" "")
3221 (use (match_operand 1 "const_int_operand" ""))
3222 (use (match_operand 2 "immediate_operand" ""))
3224 (clobber (reg:CC CC_REGNUM))]
3227 [(set (match_dup 0) (const_int 0))
3229 (clobber (reg:CC CC_REGNUM))])]
3230 "operands[1] = GEN_INT ((INTVAL (operands[1]) & 0xff) + 1);")
3233 [(set (match_operand:BLK 0 "memory_operand" "")
3235 (use (match_operand 1 "register_operand" ""))
3236 (use (match_operand 2 "memory_operand" ""))
3238 (clobber (reg:CC CC_REGNUM))]
3241 [(unspec [(match_dup 1) (match_dup 2)
3242 (const_int 0)] UNSPEC_EXECUTE)
3243 (set (match_dup 0) (const_int 0))
3245 (clobber (reg:CC CC_REGNUM))])]
3249 [(set (match_operand:BLK 0 "memory_operand" "")
3251 (use (match_operand 1 "register_operand" ""))
3252 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3254 (clobber (reg:CC CC_REGNUM))]
3255 "TARGET_Z10 && reload_completed"
3257 [(unspec [(match_dup 1) (const_int 0)
3258 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3259 (set (match_dup 0) (const_int 0))
3261 (clobber (reg:CC CC_REGNUM))])]
3262 "operands[3] = gen_label_rtx ();")
3265 [(set (match_operand:BLK 0 "memory_operand" "")
3267 (use (match_operand 1 "register_operand" ""))
3268 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3269 (clobber (match_operand 2 "register_operand" ""))
3270 (clobber (reg:CC CC_REGNUM))]
3271 "reload_completed && TARGET_CPU_ZARCH"
3272 [(set (match_dup 2) (label_ref (match_dup 3)))
3274 [(unspec [(match_dup 1) (mem:BLK (match_dup 2))
3275 (label_ref (match_dup 3))] UNSPEC_EXECUTE)
3276 (set (match_dup 0) (const_int 0))
3278 (clobber (reg:CC CC_REGNUM))])]
3279 "operands[3] = gen_label_rtx ();")
3281 ; Initialize a block of arbitrary length with (operands[2] % 256).
3283 (define_expand "setmem_long"
3285 [(clobber (match_dup 1))
3286 (set (match_operand:BLK 0 "memory_operand" "")
3287 (match_operand 2 "shift_count_or_setmem_operand" ""))
3288 (use (match_operand 1 "general_operand" ""))
3290 (clobber (reg:CC CC_REGNUM))])]
3293 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3294 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3295 rtx reg0 = gen_reg_rtx (dreg_mode);
3296 rtx reg1 = gen_reg_rtx (dreg_mode);
3297 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3298 rtx len0 = gen_lowpart (Pmode, reg0);
3300 emit_clobber (reg0);
3301 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3302 emit_move_insn (len0, operands[1]);
3304 emit_move_insn (reg1, const0_rtx);
3306 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3311 (define_insn "*setmem_long"
3312 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3313 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
3314 (match_operand 2 "shift_count_or_setmem_operand" "Y"))
3316 (use (match_operand:<DBL> 1 "register_operand" "d"))
3317 (clobber (reg:CC CC_REGNUM))]
3318 "TARGET_64BIT || !TARGET_ZARCH"
3319 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3320 [(set_attr "length" "8")
3321 (set_attr "type" "vs")])
3323 (define_insn "*setmem_long_and"
3324 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3325 (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0))
3326 (and (match_operand 2 "shift_count_or_setmem_operand" "Y")
3327 (match_operand 4 "const_int_operand" "n")))
3329 (use (match_operand:<DBL> 1 "register_operand" "d"))
3330 (clobber (reg:CC CC_REGNUM))]
3331 "(TARGET_64BIT || !TARGET_ZARCH) &&
3332 (INTVAL (operands[4]) & 255) == 255"
3333 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3334 [(set_attr "length" "8")
3335 (set_attr "type" "vs")])
3337 (define_insn "*setmem_long_31z"
3338 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3339 (set (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "0") 4))
3340 (match_operand 2 "shift_count_or_setmem_operand" "Y"))
3342 (use (match_operand:TI 1 "register_operand" "d"))
3343 (clobber (reg:CC CC_REGNUM))]
3344 "!TARGET_64BIT && TARGET_ZARCH"
3345 "mvcle\t%0,%1,%Y2\;jo\t.-4"
3346 [(set_attr "length" "8")
3347 (set_attr "type" "vs")])
3350 ; cmpmemM instruction pattern(s).
3353 (define_expand "cmpmemsi"
3354 [(set (match_operand:SI 0 "register_operand" "")
3355 (compare:SI (match_operand:BLK 1 "memory_operand" "")
3356 (match_operand:BLK 2 "memory_operand" "") ) )
3357 (use (match_operand:SI 3 "general_operand" ""))
3358 (use (match_operand:SI 4 "" ""))]
3361 if (s390_expand_cmpmem (operands[0], operands[1],
3362 operands[2], operands[3]))
3368 ; Compare a block that is up to 256 bytes in length.
3369 ; The block length is taken as (operands[2] % 256) + 1.
3371 (define_expand "cmpmem_short"
3373 [(set (reg:CCU CC_REGNUM)
3374 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3375 (match_operand:BLK 1 "memory_operand" "")))
3376 (use (match_operand 2 "nonmemory_operand" ""))
3377 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3378 (clobber (match_dup 3))])]
3380 "operands[3] = gen_rtx_SCRATCH (Pmode);")
3382 (define_insn "*cmpmem_short"
3383 [(set (reg:CCU CC_REGNUM)
3384 (compare:CCU (match_operand:BLK 0 "memory_operand" "Q,Q,Q,Q")
3385 (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q")))
3386 (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
3387 (use (match_operand 3 "immediate_operand" "X,R,X,X"))
3388 (clobber (match_scratch:P 4 "=X,X,X,&a"))]
3389 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
3391 [(set_attr "type" "cs")
3392 (set_attr "cpu_facility" "*,*,z10,cpu_zarch")])
3395 [(set (reg:CCU CC_REGNUM)
3396 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3397 (match_operand:BLK 1 "memory_operand" "")))
3398 (use (match_operand 2 "const_int_operand" ""))
3399 (use (match_operand 3 "immediate_operand" ""))
3400 (clobber (scratch))]
3403 [(set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3404 (use (match_dup 2))])]
3405 "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);")
3408 [(set (reg:CCU CC_REGNUM)
3409 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3410 (match_operand:BLK 1 "memory_operand" "")))
3411 (use (match_operand 2 "register_operand" ""))
3412 (use (match_operand 3 "memory_operand" ""))
3413 (clobber (scratch))]
3416 [(unspec [(match_dup 2) (match_dup 3)
3417 (const_int 0)] UNSPEC_EXECUTE)
3418 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3419 (use (const_int 1))])]
3423 [(set (reg:CCU CC_REGNUM)
3424 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3425 (match_operand:BLK 1 "memory_operand" "")))
3426 (use (match_operand 2 "register_operand" ""))
3427 (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3428 (clobber (scratch))]
3429 "TARGET_Z10 && reload_completed"
3431 [(unspec [(match_dup 2) (const_int 0)
3432 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3433 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3434 (use (const_int 1))])]
3435 "operands[4] = gen_label_rtx ();")
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 (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
3443 (clobber (match_operand 3 "register_operand" ""))]
3444 "reload_completed && TARGET_CPU_ZARCH"
3445 [(set (match_dup 3) (label_ref (match_dup 4)))
3447 [(unspec [(match_dup 2) (mem:BLK (match_dup 3))
3448 (label_ref (match_dup 4))] UNSPEC_EXECUTE)
3449 (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
3450 (use (const_int 1))])]
3451 "operands[4] = gen_label_rtx ();")
3453 ; Compare a block of arbitrary length.
3455 (define_expand "cmpmem_long"
3457 [(clobber (match_dup 2))
3458 (clobber (match_dup 3))
3459 (set (reg:CCU CC_REGNUM)
3460 (compare:CCU (match_operand:BLK 0 "memory_operand" "")
3461 (match_operand:BLK 1 "memory_operand" "")))
3462 (use (match_operand 2 "general_operand" ""))
3463 (use (match_dup 3))])]
3466 machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode;
3467 machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode;
3468 rtx reg0 = gen_reg_rtx (dreg_mode);
3469 rtx reg1 = gen_reg_rtx (dreg_mode);
3470 rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0));
3471 rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1));
3472 rtx len0 = gen_lowpart (Pmode, reg0);
3473 rtx len1 = gen_lowpart (Pmode, reg1);
3475 emit_clobber (reg0);
3476 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
3477 emit_move_insn (len0, operands[2]);
3479 emit_clobber (reg1);
3480 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
3481 emit_move_insn (len1, operands[2]);
3483 operands[0] = replace_equiv_address_nv (operands[0], addr0);
3484 operands[1] = replace_equiv_address_nv (operands[1], addr1);
3489 (define_insn "*cmpmem_long"
3490 [(clobber (match_operand:<DBL> 0 "register_operand" "=d"))
3491 (clobber (match_operand:<DBL> 1 "register_operand" "=d"))
3492 (set (reg:CCU CC_REGNUM)
3493 (compare:CCU (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0))
3494 (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0))))
3496 (use (match_dup 3))]
3497 "TARGET_64BIT || !TARGET_ZARCH"
3498 "clcle\t%0,%1,0\;jo\t.-4"
3499 [(set_attr "length" "8")
3500 (set_attr "type" "vs")])
3502 (define_insn "*cmpmem_long_31z"
3503 [(clobber (match_operand:TI 0 "register_operand" "=d"))
3504 (clobber (match_operand:TI 1 "register_operand" "=d"))
3505 (set (reg:CCU CC_REGNUM)
3506 (compare:CCU (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4))
3507 (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4))))
3509 (use (match_dup 3))]
3510 "!TARGET_64BIT && TARGET_ZARCH"
3511 "clcle\t%0,%1,0\;jo\t.-4"
3512 [(set_attr "op_type" "NN")
3513 (set_attr "type" "vs")
3514 (set_attr "length" "8")])
3516 ; Convert CCUmode condition code to integer.
3517 ; Result is zero if EQ, positive if LTU, negative if GTU.
3519 (define_insn_and_split "cmpint"
3520 [(set (match_operand:SI 0 "register_operand" "=d")
3521 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3522 UNSPEC_STRCMPCC_TO_INT))
3523 (clobber (reg:CC CC_REGNUM))]
3527 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
3529 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))
3530 (clobber (reg:CC CC_REGNUM))])])
3532 (define_insn_and_split "*cmpint_cc"
3533 [(set (reg CC_REGNUM)
3534 (compare (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3535 UNSPEC_STRCMPCC_TO_INT)
3537 (set (match_operand:SI 0 "register_operand" "=d")
3538 (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT))]
3539 "s390_match_ccmode (insn, CCSmode)"
3541 "&& reload_completed"
3542 [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2)))
3544 [(set (match_dup 2) (match_dup 3))
3545 (set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))])]
3547 rtx result = gen_rtx_ASHIFTRT (SImode, operands[0], GEN_INT (30));
3548 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
3549 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
3552 (define_insn_and_split "*cmpint_sign"
3553 [(set (match_operand:DI 0 "register_operand" "=d")
3554 (sign_extend:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3555 UNSPEC_STRCMPCC_TO_INT)))
3556 (clobber (reg:CC CC_REGNUM))]
3559 "&& reload_completed"
3560 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
3562 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))
3563 (clobber (reg:CC CC_REGNUM))])])
3565 (define_insn_and_split "*cmpint_sign_cc"
3566 [(set (reg CC_REGNUM)
3567 (compare (ashiftrt:DI (ashift:DI (subreg:DI
3568 (unspec:SI [(match_operand:CCU 1 "register_operand" "0")]
3569 UNSPEC_STRCMPCC_TO_INT) 0)
3570 (const_int 32)) (const_int 32))
3572 (set (match_operand:DI 0 "register_operand" "=d")
3573 (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT)))]
3574 "s390_match_ccmode (insn, CCSmode) && TARGET_ZARCH"
3576 "&& reload_completed"
3577 [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34)))
3579 [(set (match_dup 2) (match_dup 3))
3580 (set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))])]
3582 rtx result = gen_rtx_ASHIFTRT (DImode, operands[0], GEN_INT (62));
3583 operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0));
3584 operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx);
3589 ;;- Conversion instructions.
3592 (define_insn "*sethighpartsi"
3593 [(set (match_operand:SI 0 "register_operand" "=d,d")
3594 (unspec:SI [(match_operand:BLK 1 "s_operand" "Q,S")
3595 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
3596 (clobber (reg:CC CC_REGNUM))]
3601 [(set_attr "op_type" "RS,RSY")
3602 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3604 (define_insn "*sethighpartdi_64"
3605 [(set (match_operand:DI 0 "register_operand" "=d")
3606 (unspec:DI [(match_operand:BLK 1 "s_operand" "QS")
3607 (match_operand 2 "const_int_operand" "n")] UNSPEC_ICM))
3608 (clobber (reg:CC CC_REGNUM))]
3611 [(set_attr "op_type" "RSY")
3612 (set_attr "z10prop" "z10_super")])
3614 (define_insn "*sethighpartdi_31"
3615 [(set (match_operand:DI 0 "register_operand" "=d,d")
3616 (unspec:DI [(match_operand:BLK 1 "s_operand" "Q,S")
3617 (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM))
3618 (clobber (reg:CC CC_REGNUM))]
3623 [(set_attr "op_type" "RS,RSY")
3624 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
3627 ; extv instruction patterns
3630 ; FIXME: This expander needs to be converted from DI to GPR as well
3631 ; after resolving some issues with it.
3633 (define_expand "extzv"
3635 [(set (match_operand:DI 0 "register_operand" "=d")
3637 (match_operand:DI 1 "register_operand" "d")
3638 (match_operand 2 "const_int_operand" "") ; size
3639 (match_operand 3 "const_int_operand" ""))) ; start
3640 (clobber (reg:CC CC_REGNUM))])]
3643 /* Starting with zEC12 there is risbgn not clobbering CC. */
3646 emit_move_insn (operands[0],
3647 gen_rtx_ZERO_EXTRACT (DImode,
3655 (define_insn "*extzv<mode>_zEC12"
3656 [(set (match_operand:GPR 0 "register_operand" "=d")
3658 (match_operand:GPR 1 "register_operand" "d")
3659 (match_operand 2 "const_int_operand" "") ; size
3660 (match_operand 3 "const_int_operand" "")))] ; start]
3662 "risbgn\t%0,%1,64-%2,128+63,<bitsize>+%3+%2" ; dst, src, start, end, shift
3663 [(set_attr "op_type" "RIE")])
3665 (define_insn "*extzv<mode>_z10"
3666 [(set (match_operand:GPR 0 "register_operand" "=d")
3668 (match_operand:GPR 1 "register_operand" "d")
3669 (match_operand 2 "const_int_operand" "") ; size
3670 (match_operand 3 "const_int_operand" ""))) ; start
3671 (clobber (reg:CC CC_REGNUM))]
3673 "risbg\t%0,%1,64-%2,128+63,<bitsize>+%3+%2" ; dst, src, start, end, shift
3674 [(set_attr "op_type" "RIE")
3675 (set_attr "z10prop" "z10_super_E1")])
3677 (define_insn_and_split "*pre_z10_extzv<mode>"
3678 [(set (match_operand:GPR 0 "register_operand" "=d")
3679 (zero_extract:GPR (match_operand:QI 1 "s_operand" "QS")
3680 (match_operand 2 "nonzero_shift_count_operand" "")
3682 (clobber (reg:CC CC_REGNUM))]
3685 "&& reload_completed"
3687 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
3688 (clobber (reg:CC CC_REGNUM))])
3689 (set (match_dup 0) (lshiftrt:GPR (match_dup 0) (match_dup 2)))]
3691 int bitsize = INTVAL (operands[2]);
3692 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
3693 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
3695 operands[1] = adjust_address (operands[1], BLKmode, 0);
3696 set_mem_size (operands[1], size);
3697 operands[2] = GEN_INT (<GPR:bitsize> - bitsize);
3698 operands[3] = GEN_INT (mask);
3701 (define_insn_and_split "*pre_z10_extv<mode>"
3702 [(set (match_operand:GPR 0 "register_operand" "=d")
3703 (sign_extract:GPR (match_operand:QI 1 "s_operand" "QS")
3704 (match_operand 2 "nonzero_shift_count_operand" "")
3706 (clobber (reg:CC CC_REGNUM))]
3709 "&& reload_completed"
3711 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM))
3712 (clobber (reg:CC CC_REGNUM))])
3714 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
3715 (clobber (reg:CC CC_REGNUM))])]
3717 int bitsize = INTVAL (operands[2]);
3718 int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */
3719 int mask = ((1ul << size) - 1) << (GET_MODE_SIZE (SImode) - size);
3721 operands[1] = adjust_address (operands[1], BLKmode, 0);
3722 set_mem_size (operands[1], size);
3723 operands[2] = GEN_INT (<GPR:bitsize> - bitsize);
3724 operands[3] = GEN_INT (mask);
3728 ; insv instruction patterns
3731 (define_expand "insv"
3732 [(set (zero_extract (match_operand 0 "nonimmediate_operand" "")
3733 (match_operand 1 "const_int_operand" "")
3734 (match_operand 2 "const_int_operand" ""))
3735 (match_operand 3 "general_operand" ""))]
3738 if (s390_expand_insv (operands[0], operands[1], operands[2], operands[3]))
3744 ; The normal RTL expansion will never generate a zero_extract where
3745 ; the location operand isn't word mode. However, we do this in the
3746 ; back-end when generating atomic operations. See s390_two_part_insv.
3747 (define_insn "*insv<mode>_zEC12"
3748 [(set (zero_extract:GPR (match_operand:GPR 0 "nonimmediate_operand" "+d")
3749 (match_operand 1 "const_int_operand" "I") ; size
3750 (match_operand 2 "const_int_operand" "I")) ; pos
3751 (match_operand:GPR 3 "nonimmediate_operand" "d"))]
3753 && (INTVAL (operands[1]) + INTVAL (operands[2])) <= <bitsize>"
3754 "risbgn\t%0,%3,64-<bitsize>+%2,64-<bitsize>+%2+%1-1,<bitsize>-%2-%1"
3755 [(set_attr "op_type" "RIE")])
3757 (define_insn "*insv<mode>_z10"
3758 [(set (zero_extract:GPR (match_operand:GPR 0 "nonimmediate_operand" "+d")
3759 (match_operand 1 "const_int_operand" "I") ; size
3760 (match_operand 2 "const_int_operand" "I")) ; pos
3761 (match_operand:GPR 3 "nonimmediate_operand" "d"))
3762 (clobber (reg:CC CC_REGNUM))]
3764 && (INTVAL (operands[1]) + INTVAL (operands[2])) <= <bitsize>"
3765 "risbg\t%0,%3,64-<bitsize>+%2,64-<bitsize>+%2+%1-1,<bitsize>-%2-%1"
3766 [(set_attr "op_type" "RIE")
3767 (set_attr "z10prop" "z10_super_E1")])
3769 ; and op1 with a mask being 1 for the selected bits and 0 for the rest
3770 ; and op3=op0 with a mask being 0 for the selected bits and 1 for the rest
3771 (define_insn "*insv<mode>_zEC12_noshift"
3772 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3773 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3774 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3775 (and:GPR (match_operand:GPR 3 "nonimmediate_operand" "0")
3776 (match_operand:GPR 4 "const_int_operand" ""))))]
3777 "TARGET_ZEC12 && INTVAL (operands[2]) == ~INTVAL (operands[4])"
3778 "risbgn\t%0,%1,%<bfstart>2,%<bfend>2,0"
3779 [(set_attr "op_type" "RIE")])
3781 (define_insn "*insv<mode>_z10_noshift"
3782 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3783 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3784 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3785 (and:GPR (match_operand:GPR 3 "nonimmediate_operand" "0")
3786 (match_operand:GPR 4 "const_int_operand" ""))))
3787 (clobber (reg:CC CC_REGNUM))]
3788 "TARGET_Z10 && INTVAL (operands[2]) == ~INTVAL (operands[4])"
3789 "risbg\t%0,%1,%<bfstart>2,%<bfend>2,0"
3790 [(set_attr "op_type" "RIE")
3791 (set_attr "z10prop" "z10_super_E1")])
3793 ; Implement appending Y on the left of S bits of X
3794 ; x = (y << s) | (x & ((1 << s) - 1))
3795 (define_insn "*insv<mode>_zEC12_appendbitsleft"
3796 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3797 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "0")
3798 (match_operand:GPR 2 "immediate_operand" ""))
3799 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "d")
3800 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))]
3801 "TARGET_ZEC12 && UINTVAL (operands[2]) == (1UL << UINTVAL (operands[4])) - 1"
3802 "risbgn\t%0,%3,64-<bitsize>,64-%4-1,%4"
3803 [(set_attr "op_type" "RIE")
3804 (set_attr "z10prop" "z10_super_E1")])
3806 (define_insn "*insv<mode>_z10_appendbitsleft"
3807 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3808 (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "0")
3809 (match_operand:GPR 2 "immediate_operand" ""))
3810 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "d")
3811 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))
3812 (clobber (reg:CC CC_REGNUM))]
3813 "TARGET_Z10 && !TARGET_ZEC12 && UINTVAL (operands[2]) == (1UL << UINTVAL (operands[4])) - 1"
3814 "risbg\t%0,%3,64-<bitsize>,64-%4-1,%4"
3815 [(set_attr "op_type" "RIE")
3816 (set_attr "z10prop" "z10_super_E1")])
3818 ; z = (x << c) | (y >> d) with (x << c) and (y >> d) not overlapping after shifting
3819 ; -> z = y >> d; z = (x << c) | (z & ((1 << c) - 1))
3820 ; -> z = y >> d; z = risbg;
3823 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
3824 (ior:GPR (lshiftrt:GPR (match_operand:GPR 1 "nonimmediate_operand" "")
3825 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
3826 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "")
3827 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))]
3828 "TARGET_ZEC12 && UINTVAL (operands[2]) + UINTVAL (operands[4]) >= <bitsize>"
3830 (lshiftrt:GPR (match_dup 1) (match_dup 2)))
3832 (ior:GPR (and:GPR (match_dup 0) (match_dup 5))
3833 (ashift:GPR (match_dup 3) (match_dup 4))))]
3835 operands[5] = GEN_INT ((1UL << UINTVAL (operands[4])) - 1);
3840 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
3841 (ior:GPR (lshiftrt:GPR (match_operand:GPR 1 "nonimmediate_operand" "")
3842 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
3843 (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "")
3844 (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))
3845 (clobber (reg:CC CC_REGNUM))])]
3846 "TARGET_Z10 && !TARGET_ZEC12 && UINTVAL (operands[2]) + UINTVAL (operands[4]) >= <bitsize>"
3848 (lshiftrt:GPR (match_dup 1) (match_dup 2)))
3851 (ior:GPR (and:GPR (match_dup 0) (match_dup 5))
3852 (ashift:GPR (match_dup 3) (match_dup 4))))
3853 (clobber (reg:CC CC_REGNUM))])]
3855 operands[5] = GEN_INT ((1UL << UINTVAL (operands[4])) - 1);
3858 (define_insn "*r<noxa>sbg_<mode>_noshift"
3859 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3861 (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d")
3862 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3863 (match_operand:GPR 3 "nonimmediate_operand" "0")))
3864 (clobber (reg:CC CC_REGNUM))]
3866 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,0"
3867 [(set_attr "op_type" "RIE")])
3869 (define_insn "*r<noxa>sbg_di_rotl"
3870 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
3874 (match_operand:DI 1 "nonimmediate_operand" "d")
3875 (match_operand:DI 3 "const_int_operand" ""))
3876 (match_operand:DI 2 "contiguous_bitmask_operand" ""))
3877 (match_operand:DI 4 "nonimmediate_operand" "0")))
3878 (clobber (reg:CC CC_REGNUM))]
3880 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%b3"
3881 [(set_attr "op_type" "RIE")])
3883 (define_insn "*r<noxa>sbg_<mode>_srl"
3884 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3888 (match_operand:GPR 1 "nonimmediate_operand" "d")
3889 (match_operand:GPR 3 "nonzero_shift_count_operand" ""))
3890 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3891 (match_operand:GPR 4 "nonimmediate_operand" "0")))
3892 (clobber (reg:CC CC_REGNUM))]
3894 && s390_extzv_shift_ok (<bitsize>, 64 - INTVAL (operands[3]),
3895 INTVAL (operands[2]))"
3896 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,64-%3"
3897 [(set_attr "op_type" "RIE")])
3899 (define_insn "*r<noxa>sbg_<mode>_sll"
3900 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d")
3904 (match_operand:GPR 1 "nonimmediate_operand" "d")
3905 (match_operand:GPR 3 "nonzero_shift_count_operand" ""))
3906 (match_operand:GPR 2 "contiguous_bitmask_operand" ""))
3907 (match_operand:GPR 4 "nonimmediate_operand" "0")))
3908 (clobber (reg:CC CC_REGNUM))]
3910 && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[3]),
3911 INTVAL (operands[2]))"
3912 "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%3"
3913 [(set_attr "op_type" "RIE")])
3915 ;; These two are generated by combine for s.bf &= val.
3916 ;; ??? For bitfields smaller than 32-bits, we wind up with SImode
3917 ;; shifts and ands, which results in some truly awful patterns
3918 ;; including subregs of operations. Rather unnecessisarily, IMO.
3921 ;; (set (zero_extract:DI (reg/v:DI 50 [ s ])
3922 ;; (const_int 24 [0x18])
3923 ;; (const_int 0 [0]))
3924 ;; (subreg:DI (and:SI (subreg:SI (lshiftrt:DI (reg/v:DI 50 [ s ])
3925 ;; (const_int 40 [0x28])) 4)
3926 ;; (reg:SI 4 %r4 [ y+4 ])) 0))
3928 ;; we should instead generate
3930 ;; (set (zero_extract:DI (reg/v:DI 50 [ s ])
3931 ;; (const_int 24 [0x18])
3932 ;; (const_int 0 [0]))
3933 ;; (and:DI (lshiftrt:DI (reg/v:DI 50 [ s ])
3934 ;; (const_int 40 [0x28]))
3935 ;; (subreg:DI (reg:SI 4 %r4 [ y+4 ]) 0)))
3937 ;; by noticing that we can push down the outer paradoxical subreg
3938 ;; into the operation.
3940 (define_insn "*insv_rnsbg_noshift"
3941 [(set (zero_extract:DI
3942 (match_operand:DI 0 "nonimmediate_operand" "+d")
3943 (match_operand 1 "const_int_operand" "")
3944 (match_operand 2 "const_int_operand" ""))
3947 (match_operand:DI 3 "nonimmediate_operand" "d")))
3948 (clobber (reg:CC CC_REGNUM))]
3950 && INTVAL (operands[1]) + INTVAL (operands[2]) == 64"
3951 "rnsbg\t%0,%3,%2,63,0"
3952 [(set_attr "op_type" "RIE")])
3954 (define_insn "*insv_rnsbg_srl"
3955 [(set (zero_extract:DI
3956 (match_operand:DI 0 "nonimmediate_operand" "+d")
3957 (match_operand 1 "const_int_operand" "")
3958 (match_operand 2 "const_int_operand" ""))
3962 (match_operand 3 "const_int_operand" ""))
3963 (match_operand:DI 4 "nonimmediate_operand" "d")))
3964 (clobber (reg:CC CC_REGNUM))]
3966 && INTVAL (operands[3]) == 64 - INTVAL (operands[1]) - INTVAL (operands[2])"
3967 "rnsbg\t%0,%4,%2,%2+%1-1,%3"
3968 [(set_attr "op_type" "RIE")])
3970 (define_insn "*insv<mode>_mem_reg"
3971 [(set (zero_extract:W (match_operand:QI 0 "memory_operand" "+Q,S")
3972 (match_operand 1 "const_int_operand" "n,n")
3974 (match_operand:W 2 "register_operand" "d,d"))]
3975 "INTVAL (operands[1]) > 0
3976 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
3977 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
3979 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
3981 operands[1] = GEN_INT ((1ul << size) - 1);
3982 return (which_alternative == 0) ? "stcm\t%2,%1,%S0"
3983 : "stcmy\t%2,%1,%S0";
3985 [(set_attr "op_type" "RS,RSY")
3986 (set_attr "z10prop" "z10_super,z10_super")])
3988 (define_insn "*insvdi_mem_reghigh"
3989 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "+QS")
3990 (match_operand 1 "const_int_operand" "n")
3992 (lshiftrt:DI (match_operand:DI 2 "register_operand" "d")
3995 && INTVAL (operands[1]) > 0
3996 && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode)
3997 && INTVAL (operands[1]) % BITS_PER_UNIT == 0"
3999 int size = INTVAL (operands[1]) / BITS_PER_UNIT;
4001 operands[1] = GEN_INT ((1ul << size) - 1);
4002 return "stcmh\t%2,%1,%S0";
4004 [(set_attr "op_type" "RSY")
4005 (set_attr "z10prop" "z10_super")])
4007 (define_insn "*insvdi_reg_imm"
4008 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4010 (match_operand 1 "const_int_operand" "n"))
4011 (match_operand:DI 2 "const_int_operand" "n"))]
4013 && INTVAL (operands[1]) >= 0
4014 && INTVAL (operands[1]) < BITS_PER_WORD
4015 && INTVAL (operands[1]) % 16 == 0"
4017 switch (BITS_PER_WORD - INTVAL (operands[1]))
4019 case 64: return "iihh\t%0,%x2"; break;
4020 case 48: return "iihl\t%0,%x2"; break;
4021 case 32: return "iilh\t%0,%x2"; break;
4022 case 16: return "iill\t%0,%x2"; break;
4023 default: gcc_unreachable();
4026 [(set_attr "op_type" "RI")
4027 (set_attr "z10prop" "z10_super_E1")])
4029 ; Update the left-most 32 bit of a DI.
4030 (define_insn "*insv_h_di_reg_extimm"
4031 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4034 (match_operand:DI 1 "const_int_operand" "n"))]
4037 [(set_attr "op_type" "RIL")
4038 (set_attr "z10prop" "z10_fwd_E1")])
4040 ; Update the right-most 32 bit of a DI.
4041 (define_insn "*insv_l_di_reg_extimm"
4042 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d")
4045 (match_operand:DI 1 "const_int_operand" "n"))]
4048 [(set_attr "op_type" "RIL")
4049 (set_attr "z10prop" "z10_fwd_A1")])
4052 ; extendsidi2 instruction pattern(s).
4055 (define_expand "extendsidi2"
4056 [(set (match_operand:DI 0 "register_operand" "")
4057 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
4062 emit_clobber (operands[0]);
4063 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
4064 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
4065 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
4070 (define_insn "*extendsidi2"
4071 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4072 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,RT,b")))]
4078 [(set_attr "op_type" "RRE,RXY,RIL")
4079 (set_attr "type" "*,*,larl")
4080 (set_attr "cpu_facility" "*,*,z10")
4081 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
4084 ; extend(hi|qi)(si|di)2 instruction pattern(s).
4087 (define_expand "extend<HQI:mode><DSI:mode>2"
4088 [(set (match_operand:DSI 0 "register_operand" "")
4089 (sign_extend:DSI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4092 if (<DSI:MODE>mode == DImode && !TARGET_ZARCH)
4094 rtx tmp = gen_reg_rtx (SImode);
4095 emit_insn (gen_extend<HQI:mode>si2 (tmp, operands[1]));
4096 emit_insn (gen_extendsidi2 (operands[0], tmp));
4099 else if (!TARGET_EXTIMM)
4101 rtx bitcount = GEN_INT (<DSI:bitsize> - <HQI:bitsize>);
4103 operands[1] = gen_lowpart (<DSI:MODE>mode, operands[1]);
4104 emit_insn (gen_ashl<DSI:mode>3 (operands[0], operands[1], bitcount));
4105 emit_insn (gen_ashr<DSI:mode>3 (operands[0], operands[0], bitcount));
4111 ; extendhidi2 instruction pattern(s).
4114 (define_insn "*extendhidi2_extimm"
4115 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4116 (sign_extend:DI (match_operand:HI 1 "general_operand" "d,RT,b")))]
4117 "TARGET_ZARCH && TARGET_EXTIMM"
4122 [(set_attr "op_type" "RRE,RXY,RIL")
4123 (set_attr "type" "*,*,larl")
4124 (set_attr "cpu_facility" "extimm,extimm,z10")
4125 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")])
4127 (define_insn "*extendhidi2"
4128 [(set (match_operand:DI 0 "register_operand" "=d")
4129 (sign_extend:DI (match_operand:HI 1 "memory_operand" "RT")))]
4132 [(set_attr "op_type" "RXY")
4133 (set_attr "z10prop" "z10_super_E1")])
4136 ; extendhisi2 instruction pattern(s).
4139 (define_insn "*extendhisi2_extimm"
4140 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4141 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" " d,R,T,b")))]
4148 [(set_attr "op_type" "RRE,RX,RXY,RIL")
4149 (set_attr "type" "*,*,*,larl")
4150 (set_attr "cpu_facility" "extimm,extimm,extimm,z10")
4151 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")])
4153 (define_insn "*extendhisi2"
4154 [(set (match_operand:SI 0 "register_operand" "=d,d")
4155 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
4160 [(set_attr "op_type" "RX,RXY")
4161 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4164 ; extendqi(si|di)2 instruction pattern(s).
4167 ; lbr, lgbr, lb, lgb
4168 (define_insn "*extendqi<mode>2_extimm"
4169 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4170 (sign_extend:GPR (match_operand:QI 1 "nonimmediate_operand" "d,RT")))]
4175 [(set_attr "op_type" "RRE,RXY")
4176 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4179 (define_insn "*extendqi<mode>2"
4180 [(set (match_operand:GPR 0 "register_operand" "=d")
4181 (sign_extend:GPR (match_operand:QI 1 "memory_operand" "RT")))]
4182 "!TARGET_EXTIMM && TARGET_LONG_DISPLACEMENT"
4184 [(set_attr "op_type" "RXY")
4185 (set_attr "z10prop" "z10_super_E1")])
4187 (define_insn_and_split "*extendqi<mode>2_short_displ"
4188 [(set (match_operand:GPR 0 "register_operand" "=d")
4189 (sign_extend:GPR (match_operand:QI 1 "s_operand" "Q")))
4190 (clobber (reg:CC CC_REGNUM))]
4191 "!TARGET_EXTIMM && !TARGET_LONG_DISPLACEMENT"
4193 "&& reload_completed"
4195 [(set (match_dup 0) (unspec:GPR [(match_dup 1) (const_int 8)] UNSPEC_ICM))
4196 (clobber (reg:CC CC_REGNUM))])
4198 [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2)))
4199 (clobber (reg:CC CC_REGNUM))])]
4201 operands[1] = adjust_address (operands[1], BLKmode, 0);
4202 set_mem_size (operands[1], GET_MODE_SIZE (QImode));
4203 operands[2] = GEN_INT (<GPR:bitsize> - BITS_PER_UNIT);
4207 ; zero_extendsidi2 instruction pattern(s).
4210 (define_expand "zero_extendsidi2"
4211 [(set (match_operand:DI 0 "register_operand" "")
4212 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
4217 emit_clobber (operands[0]);
4218 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
4219 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
4224 (define_insn "*zero_extendsidi2"
4225 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4226 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,RT,b")))]
4232 [(set_attr "op_type" "RRE,RXY,RIL")
4233 (set_attr "type" "*,*,larl")
4234 (set_attr "cpu_facility" "*,*,z10")
4235 (set_attr "z10prop" "z10_fwd_E1,z10_fwd_A3,z10_fwd_A3")])
4238 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
4241 (define_insn "*llgt_sidi"
4242 [(set (match_operand:DI 0 "register_operand" "=d")
4243 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "RT") 0)
4244 (const_int 2147483647)))]
4247 [(set_attr "op_type" "RXE")
4248 (set_attr "z10prop" "z10_super_E1")])
4250 (define_insn_and_split "*llgt_sidi_split"
4251 [(set (match_operand:DI 0 "register_operand" "=d")
4252 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "RT") 0)
4253 (const_int 2147483647)))
4254 (clobber (reg:CC CC_REGNUM))]
4257 "&& reload_completed"
4259 (and:DI (subreg:DI (match_dup 1) 0)
4260 (const_int 2147483647)))]
4263 (define_insn "*llgt_sisi"
4264 [(set (match_operand:SI 0 "register_operand" "=d,d")
4265 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,RT")
4266 (const_int 2147483647)))]
4271 [(set_attr "op_type" "RRE,RXE")
4272 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4274 (define_insn "*llgt_didi"
4275 [(set (match_operand:DI 0 "register_operand" "=d,d")
4276 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
4277 (const_int 2147483647)))]
4282 [(set_attr "op_type" "RRE,RXE")
4283 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
4286 [(set (match_operand:DSI 0 "register_operand" "")
4287 (and:DSI (match_operand:DSI 1 "nonimmediate_operand" "")
4288 (const_int 2147483647)))
4289 (clobber (reg:CC CC_REGNUM))]
4290 "TARGET_ZARCH && reload_completed"
4292 (and:DSI (match_dup 1)
4293 (const_int 2147483647)))]
4297 ; zero_extend(hi|qi)(si|di)2 instruction pattern(s).
4300 (define_expand "zero_extend<mode>di2"
4301 [(set (match_operand:DI 0 "register_operand" "")
4302 (zero_extend:DI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4307 rtx tmp = gen_reg_rtx (SImode);
4308 emit_insn (gen_zero_extend<mode>si2 (tmp, operands[1]));
4309 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
4312 else if (!TARGET_EXTIMM)
4314 rtx bitcount = GEN_INT (64 - <HQI:bitsize>);
4315 operands[1] = gen_lowpart (DImode, operands[1]);
4316 emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount));
4317 emit_insn (gen_lshrdi3 (operands[0], operands[0], bitcount));
4322 (define_expand "zero_extend<mode>si2"
4323 [(set (match_operand:SI 0 "register_operand" "")
4324 (zero_extend:SI (match_operand:HQI 1 "nonimmediate_operand" "")))]
4329 operands[1] = gen_lowpart (SImode, operands[1]);
4330 emit_insn (gen_andsi3 (operands[0], operands[1],
4331 GEN_INT ((1 << <HQI:bitsize>) - 1)));
4337 (define_insn "*zero_extendhi<mode>2_z10"
4338 [(set (match_operand:GPR 0 "register_operand" "=d,d,d")
4339 (zero_extend:GPR (match_operand:HI 1 "nonimmediate_operand" "d,RT,b")))]
4345 [(set_attr "op_type" "RXY,RRE,RIL")
4346 (set_attr "type" "*,*,larl")
4347 (set_attr "cpu_facility" "*,*,z10")
4348 (set_attr "z10prop" "z10_super_E1,z10_fwd_A3,z10_fwd_A3")])
4350 ; llhr, llcr, llghr, llgcr, llh, llc, llgh, llgc
4351 (define_insn "*zero_extend<HQI:mode><GPR:mode>2_extimm"
4352 [(set (match_operand:GPR 0 "register_operand" "=d,d")
4353 (zero_extend:GPR (match_operand:HQI 1 "nonimmediate_operand" "d,RT")))]
4358 [(set_attr "op_type" "RRE,RXY")
4359 (set_attr "z10prop" "z10_super_E1,z10_fwd_A3")])
4362 (define_insn "*zero_extend<HQI:mode><GPR:mode>2"
4363 [(set (match_operand:GPR 0 "register_operand" "=d")
4364 (zero_extend:GPR (match_operand:HQI 1 "memory_operand" "RT")))]
4365 "TARGET_ZARCH && !TARGET_EXTIMM"
4367 [(set_attr "op_type" "RXY")
4368 (set_attr "z10prop" "z10_fwd_A3")])
4370 (define_insn_and_split "*zero_extendhisi2_31"
4371 [(set (match_operand:SI 0 "register_operand" "=&d")
4372 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
4373 (clobber (reg:CC CC_REGNUM))]
4376 "&& reload_completed"
4377 [(set (match_dup 0) (const_int 0))
4379 [(set (strict_low_part (match_dup 2)) (match_dup 1))
4380 (clobber (reg:CC CC_REGNUM))])]
4381 "operands[2] = gen_lowpart (HImode, operands[0]);")
4383 (define_insn_and_split "*zero_extendqisi2_31"
4384 [(set (match_operand:SI 0 "register_operand" "=&d")
4385 (zero_extend:SI (match_operand:QI 1 "memory_operand" "RT")))]
4388 "&& reload_completed"
4389 [(set (match_dup 0) (const_int 0))
4390 (set (strict_low_part (match_dup 2)) (match_dup 1))]
4391 "operands[2] = gen_lowpart (QImode, operands[0]);")
4394 ; zero_extendqihi2 instruction pattern(s).
4397 (define_expand "zero_extendqihi2"
4398 [(set (match_operand:HI 0 "register_operand" "")
4399 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
4400 "TARGET_ZARCH && !TARGET_EXTIMM"
4402 operands[1] = gen_lowpart (HImode, operands[1]);
4403 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
4407 (define_insn "*zero_extendqihi2_64"
4408 [(set (match_operand:HI 0 "register_operand" "=d")
4409 (zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))]
4410 "TARGET_ZARCH && !TARGET_EXTIMM"
4412 [(set_attr "op_type" "RXY")
4413 (set_attr "z10prop" "z10_fwd_A3")])
4415 (define_insn_and_split "*zero_extendqihi2_31"
4416 [(set (match_operand:HI 0 "register_operand" "=&d")
4417 (zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))]
4420 "&& reload_completed"
4421 [(set (match_dup 0) (const_int 0))
4422 (set (strict_low_part (match_dup 2)) (match_dup 1))]
4423 "operands[2] = gen_lowpart (QImode, operands[0]);")
4426 ; fixuns_trunc(dd|td)di2 instruction pattern(s).
4429 (define_expand "fixuns_truncdddi2"
4431 [(set (match_operand:DI 0 "register_operand" "")
4432 (unsigned_fix:DI (match_operand:DD 1 "register_operand" "")))
4433 (unspec:DI [(const_int 5)] UNSPEC_ROUND)
4434 (clobber (reg:CC CC_REGNUM))])]
4440 rtx_code_label *label1 = gen_label_rtx ();
4441 rtx_code_label *label2 = gen_label_rtx ();
4442 rtx temp = gen_reg_rtx (TDmode);
4443 REAL_VALUE_TYPE cmp, sub;
4445 decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */
4446 decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
4448 /* 2^63 can't be represented as 64bit DFP number with full precision. The
4449 solution is doing the check and the subtraction in TD mode and using a
4450 TD -> DI convert afterwards. */
4451 emit_insn (gen_extendddtd2 (temp, operands[1]));
4452 temp = force_reg (TDmode, temp);
4453 emit_cmp_and_jump_insns (temp,
4454 const_double_from_real_value (cmp, TDmode),
4455 LT, NULL_RTX, VOIDmode, 0, label1);
4456 emit_insn (gen_subtd3 (temp, temp,
4457 const_double_from_real_value (sub, TDmode)));
4458 emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, GEN_INT (11)));
4461 emit_label (label1);
4462 emit_insn (gen_fix_truncdddi2_dfp (operands[0], operands[1], GEN_INT (9)));
4463 emit_label (label2);
4468 (define_expand "fixuns_trunctddi2"
4470 [(set (match_operand:DI 0 "register_operand" "")
4471 (unsigned_fix:DI (match_operand:TD 1 "register_operand" "")))
4472 (unspec:DI [(const_int 5)] UNSPEC_ROUND)
4473 (clobber (reg:CC CC_REGNUM))])]
4479 rtx_code_label *label1 = gen_label_rtx ();
4480 rtx_code_label *label2 = gen_label_rtx ();
4481 rtx temp = gen_reg_rtx (TDmode);
4482 REAL_VALUE_TYPE cmp, sub;
4484 operands[1] = force_reg (TDmode, operands[1]);
4485 decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */
4486 decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */
4488 emit_cmp_and_jump_insns (operands[1],
4489 const_double_from_real_value (cmp, TDmode),
4490 LT, NULL_RTX, VOIDmode, 0, label1);
4491 emit_insn (gen_subtd3 (temp, operands[1],
4492 const_double_from_real_value (sub, TDmode)));
4493 emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, GEN_INT (11)));
4496 emit_label (label1);
4497 emit_insn (gen_fix_trunctddi2_dfp (operands[0], operands[1], GEN_INT (9)));
4498 emit_label (label2);
4504 ; fixuns_trunc(sf|df|tf)(si|di)2 and fix_trunc(sf|df|tf)(si|di)2
4505 ; instruction pattern(s).
4508 (define_expand "fixuns_trunc<BFP:mode><GPR:mode>2"
4510 [(set (match_operand:GPR 0 "register_operand" "")
4511 (unsigned_fix:GPR (match_operand:BFP 1 "register_operand" "")))
4512 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
4513 (clobber (reg:CC CC_REGNUM))])]
4518 rtx_code_label *label1 = gen_label_rtx ();
4519 rtx_code_label *label2 = gen_label_rtx ();
4520 rtx temp = gen_reg_rtx (<BFP:MODE>mode);
4521 REAL_VALUE_TYPE cmp, sub;
4523 operands[1] = force_reg (<BFP:MODE>mode, operands[1]);
4524 real_2expN (&cmp, <GPR:bitsize> - 1, <BFP:MODE>mode);
4525 real_2expN (&sub, <GPR:bitsize>, <BFP:MODE>mode);
4527 emit_cmp_and_jump_insns (operands[1],
4528 const_double_from_real_value (cmp, <BFP:MODE>mode),
4529 LT, NULL_RTX, VOIDmode, 0, label1);
4530 emit_insn (gen_sub<BFP:mode>3 (temp, operands[1],
4531 const_double_from_real_value (sub, <BFP:MODE>mode)));
4532 emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0], temp,
4536 emit_label (label1);
4537 emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0],
4538 operands[1], GEN_INT (5)));
4539 emit_label (label2);
4544 ; fixuns_trunc(td|dd)si2 expander
4545 (define_expand "fixuns_trunc<mode>si2"
4547 [(set (match_operand:SI 0 "register_operand" "")
4548 (unsigned_fix:SI (match_operand:DFP 1 "register_operand" "")))
4549 (unspec:SI [(const_int 5)] UNSPEC_ROUND)
4550 (clobber (reg:CC CC_REGNUM))])]
4551 "TARGET_Z196 && TARGET_HARD_DFP"
4554 ; fixuns_trunc(tf|df|sf|td|dd)(di|si)2 instruction patterns.
4556 (define_insn "*fixuns_truncdfdi2_z13"
4557 [(set (match_operand:DI 0 "register_operand" "=d,v")
4558 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "f,v")))
4559 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND)
4560 (clobber (reg:CC CC_REGNUM))]
4561 "TARGET_Z13 && TARGET_HARD_FLOAT"
4564 wclgdb\t%v0,%v1,0,%h2"
4565 [(set_attr "op_type" "RRF,VRR")
4566 (set_attr "type" "ftoi")])
4568 ; clfebr, clfdbr, clfxbr, clgebr, clgdbr, clgxbr
4569 ; clfdtr, clfxtr, clgdtr, clgxtr
4570 (define_insn "*fixuns_trunc<FP:mode><GPR:mode>2_z196"
4571 [(set (match_operand:GPR 0 "register_operand" "=d")
4572 (unsigned_fix:GPR (match_operand:FP 1 "register_operand" "f")))
4573 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4574 (clobber (reg:CC CC_REGNUM))]
4575 "TARGET_Z196 && TARGET_HARD_FLOAT
4576 && (!TARGET_Z13 || <GPR:MODE>mode != DImode || <FP:MODE>mode != DFmode)"
4577 "cl<GPR:gf><FP:xde><FP:bt>r\t%0,%h2,%1,0"
4578 [(set_attr "op_type" "RRF")
4579 (set_attr "type" "ftoi")])
4581 (define_expand "fix_trunc<DSF:mode><GPR:mode>2"
4582 [(set (match_operand:GPR 0 "register_operand" "")
4583 (fix:GPR (match_operand:DSF 1 "register_operand" "")))]
4586 emit_insn (gen_fix_trunc<DSF:mode><GPR:mode>2_bfp (operands[0], operands[1],
4591 (define_insn "*fix_truncdfdi2_bfp_z13"
4592 [(set (match_operand:DI 0 "register_operand" "=d,v")
4593 (fix:DI (match_operand:DF 1 "register_operand" "f,v")))
4594 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND)
4595 (clobber (reg:CC CC_REGNUM))]
4596 "TARGET_Z13 && TARGET_HARD_FLOAT"
4599 wcgdb\t%v0,%v1,0,%h2"
4600 [(set_attr "op_type" "RRE,VRR")
4601 (set_attr "type" "ftoi")])
4603 ; cgxbr, cgdbr, cgebr, cfxbr, cfdbr, cfebr
4604 (define_insn "*fix_trunc<BFP:mode><GPR:mode>2_bfp"
4605 [(set (match_operand:GPR 0 "register_operand" "=d")
4606 (fix:GPR (match_operand:BFP 1 "register_operand" "f")))
4607 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4608 (clobber (reg:CC CC_REGNUM))]
4610 && (!TARGET_VX || <GPR:MODE>mode != DImode || <BFP:MODE>mode != DFmode)"
4611 "c<GPR:gf><BFP:xde>br\t%0,%h2,%1"
4612 [(set_attr "op_type" "RRE")
4613 (set_attr "type" "ftoi")])
4615 (define_expand "fix_trunc<BFP:mode><GPR:mode>2_bfp"
4617 [(set (match_operand:GPR 0 "register_operand" "=d")
4618 (fix:GPR (match_operand:BFP 1 "register_operand" "f")))
4619 (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND)
4620 (clobber (reg:CC CC_REGNUM))])]
4621 "TARGET_HARD_FLOAT")
4623 ; fix_trunc(td|dd)di2 instruction pattern(s).
4626 (define_expand "fix_trunc<mode>di2"
4627 [(set (match_operand:DI 0 "register_operand" "")
4628 (fix:DI (match_operand:DFP 1 "nonimmediate_operand" "")))]
4629 "TARGET_ZARCH && TARGET_HARD_DFP"
4631 operands[1] = force_reg (<MODE>mode, operands[1]);
4632 emit_insn (gen_fix_trunc<mode>di2_dfp (operands[0], operands[1],
4638 (define_insn "fix_trunc<DFP:mode>di2_dfp"
4639 [(set (match_operand:DI 0 "register_operand" "=d")
4640 (fix:DI (match_operand:DFP 1 "register_operand" "f")))
4641 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
4642 (clobber (reg:CC CC_REGNUM))]
4643 "TARGET_ZARCH && TARGET_HARD_DFP"
4644 "cg<DFP:xde>tr\t%0,%h2,%1"
4645 [(set_attr "op_type" "RRF")
4646 (set_attr "type" "ftoidfp")])
4650 ; fix_trunctf(si|di)2 instruction pattern(s).
4653 (define_expand "fix_trunctf<mode>2"
4654 [(parallel [(set (match_operand:GPR 0 "register_operand" "")
4655 (fix:GPR (match_operand:TF 1 "register_operand" "")))
4656 (unspec:GPR [(const_int 5)] UNSPEC_ROUND)
4657 (clobber (reg:CC CC_REGNUM))])]
4663 ; float(si|di)(tf|df|sf|td|dd)2 instruction pattern(s).
4666 ; cxgbr, cdgbr, cegbr, cxgtr, cdgtr
4667 (define_insn "floatdi<mode>2"
4668 [(set (match_operand:FP 0 "register_operand" "=f,<vf>")
4669 (float:FP (match_operand:DI 1 "register_operand" "d,<vd>")))]
4670 "TARGET_ZARCH && TARGET_HARD_FLOAT"
4674 [(set_attr "op_type" "RRE,VRR")
4675 (set_attr "type" "itof<mode>" )
4676 (set_attr "cpu_facility" "*,vec")])
4678 ; cxfbr, cdfbr, cefbr
4679 (define_insn "floatsi<mode>2"
4680 [(set (match_operand:BFP 0 "register_operand" "=f")
4681 (float:BFP (match_operand:SI 1 "register_operand" "d")))]
4684 [(set_attr "op_type" "RRE")
4685 (set_attr "type" "itof<mode>" )])
4688 (define_insn "floatsi<mode>2"
4689 [(set (match_operand:DFP 0 "register_operand" "=f")
4690 (float:DFP (match_operand:SI 1 "register_operand" "d")))]
4691 "TARGET_Z196 && TARGET_HARD_FLOAT"
4692 "c<xde>ftr\t%0,0,%1,0"
4693 [(set_attr "op_type" "RRE")
4694 (set_attr "type" "itof<mode>" )])
4697 ; floatuns(si|di)(tf|df|sf|td|dd)2 instruction pattern(s).
4700 (define_insn "*floatunsdidf2_z13"
4701 [(set (match_operand:DF 0 "register_operand" "=f,v")
4702 (unsigned_float:DF (match_operand:DI 1 "register_operand" "d,v")))]
4703 "TARGET_Z13 && TARGET_HARD_FLOAT"
4706 wcdlgb\t%v0,%v1,0,0"
4707 [(set_attr "op_type" "RRE,VRR")
4708 (set_attr "type" "itofdf")])
4710 ; cxlgbr, cdlgbr, celgbr, cxlgtr, cdlgtr
4711 ; cxlfbr, cdlfbr, celfbr, cxlftr, cdlftr
4712 (define_insn "*floatuns<GPR:mode><FP:mode>2"
4713 [(set (match_operand:FP 0 "register_operand" "=f")
4714 (unsigned_float:FP (match_operand:GPR 1 "register_operand" "d")))]
4715 "TARGET_Z196 && TARGET_HARD_FLOAT
4716 && (!TARGET_VX || <FP:MODE>mode != DFmode || <GPR:MODE>mode != DImode)"
4717 "c<FP:xde>l<GPR:gf><FP:bt>r\t%0,0,%1,0"
4718 [(set_attr "op_type" "RRE")
4719 (set_attr "type" "itof<FP:mode>")])
4721 (define_expand "floatuns<GPR:mode><FP:mode>2"
4722 [(set (match_operand:FP 0 "register_operand" "")
4723 (unsigned_float:FP (match_operand:GPR 1 "register_operand" "")))]
4724 "TARGET_Z196 && TARGET_HARD_FLOAT")
4727 ; truncdfsf2 instruction pattern(s).
4730 (define_insn "truncdfsf2"
4731 [(set (match_operand:SF 0 "register_operand" "=f,v")
4732 (float_truncate:SF (match_operand:DF 1 "register_operand" "f,v")))]
4736 wledb\t%v0,%v1,0,0" ; IEEE inexact exception not suppressed
4737 ; According to BFP rounding mode
4738 [(set_attr "op_type" "RRE,VRR")
4739 (set_attr "type" "ftruncdf")
4740 (set_attr "cpu_facility" "*,vec")])
4743 ; trunctf(df|sf)2 instruction pattern(s).
4747 (define_insn "trunctf<mode>2"
4748 [(set (match_operand:DSF 0 "register_operand" "=f")
4749 (float_truncate:DSF (match_operand:TF 1 "register_operand" "f")))
4750 (clobber (match_scratch:TF 2 "=f"))]
4752 "l<xde>xbr\t%2,%1\;l<xde>r\t%0,%2"
4753 [(set_attr "length" "6")
4754 (set_attr "type" "ftrunctf")])
4757 ; trunctddd2 and truncddsd2 instruction pattern(s).
4760 (define_insn "trunctddd2"
4761 [(set (match_operand:DD 0 "register_operand" "=f")
4762 (float_truncate:DD (match_operand:TD 1 "register_operand" "f")))
4763 (clobber (match_scratch:TD 2 "=f"))]
4765 "ldxtr\t%2,0,%1,0\;ldr\t%0,%2"
4766 [(set_attr "length" "6")
4767 (set_attr "type" "ftruncdd")])
4769 (define_insn "truncddsd2"
4770 [(set (match_operand:SD 0 "register_operand" "=f")
4771 (float_truncate:SD (match_operand:DD 1 "register_operand" "f")))]
4774 [(set_attr "op_type" "RRF")
4775 (set_attr "type" "ftruncsd")])
4777 (define_expand "trunctdsd2"
4780 (float_truncate:DD (match_operand:TD 1 "register_operand" "")))
4781 (clobber (match_scratch:TD 2 ""))])
4782 (set (match_operand:SD 0 "register_operand" "")
4783 (float_truncate:SD (match_dup 3)))]
4786 operands[3] = gen_reg_rtx (DDmode);
4790 ; extend(sf|df)(df|tf)2 instruction pattern(s).
4793 (define_insn "*extendsfdf2_z13"
4794 [(set (match_operand:DF 0 "register_operand" "=f,f,v")
4795 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R,v")))]
4796 "TARGET_Z13 && TARGET_HARD_FLOAT"
4801 [(set_attr "op_type" "RRE,RXE,VRR")
4802 (set_attr "type" "fsimpdf, floaddf,fsimpdf")])
4804 ; ldebr, ldeb, lxdbr, lxdb, lxebr, lxeb
4805 (define_insn "*extend<DSF:mode><BFP:mode>2"
4806 [(set (match_operand:BFP 0 "register_operand" "=f,f")
4807 (float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "f,R")))]
4809 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DSF:MODE>mode)
4810 && (!TARGET_VX || <BFP:MODE>mode != DFmode || <DSF:MODE>mode != SFmode)"
4812 l<BFP:xde><DSF:xde>br\t%0,%1
4813 l<BFP:xde><DSF:xde>b\t%0,%1"
4814 [(set_attr "op_type" "RRE,RXE")
4815 (set_attr "type" "fsimp<BFP:mode>, fload<BFP:mode>")])
4817 (define_expand "extend<DSF:mode><BFP:mode>2"
4818 [(set (match_operand:BFP 0 "register_operand" "")
4819 (float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "")))]
4821 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DSF:MODE>mode)")
4824 ; extendddtd2 and extendsddd2 instruction pattern(s).
4827 (define_insn "extendddtd2"
4828 [(set (match_operand:TD 0 "register_operand" "=f")
4829 (float_extend:TD (match_operand:DD 1 "register_operand" "f")))]
4832 [(set_attr "op_type" "RRF")
4833 (set_attr "type" "fsimptf")])
4835 (define_insn "extendsddd2"
4836 [(set (match_operand:DD 0 "register_operand" "=f")
4837 (float_extend:DD (match_operand:SD 1 "register_operand" "f")))]
4840 [(set_attr "op_type" "RRF")
4841 (set_attr "type" "fsimptf")])
4843 (define_expand "extendsdtd2"
4845 (float_extend:DD (match_operand:SD 1 "register_operand" "")))
4846 (set (match_operand:TD 0 "register_operand" "")
4847 (float_extend:TD (match_dup 2)))]
4850 operands[2] = gen_reg_rtx (DDmode);
4853 ; Binary Floating Point - load fp integer
4855 ; Expanders for: floor, btrunc, round, ceil, and nearbyint
4856 ; For all of them the inexact exceptions are suppressed.
4858 ; fiebra, fidbra, fixbra
4859 (define_insn "<FPINT:fpint_name><BFP:mode>2"
4860 [(set (match_operand:BFP 0 "register_operand" "=f")
4861 (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
4864 "fi<BFP:xde>bra\t%0,<FPINT:fpint_roundingmode>,%1,4"
4865 [(set_attr "op_type" "RRF")
4866 (set_attr "type" "fsimp<BFP:mode>")])
4868 ; rint is supposed to raise an inexact exception so we can use the
4869 ; older instructions.
4871 ; fiebr, fidbr, fixbr
4872 (define_insn "rint<BFP:mode>2"
4873 [(set (match_operand:BFP 0 "register_operand" "=f")
4874 (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
4875 UNSPEC_FPINT_RINT))]
4877 "fi<BFP:xde>br\t%0,0,%1"
4878 [(set_attr "op_type" "RRF")
4879 (set_attr "type" "fsimp<BFP:mode>")])
4882 ; Decimal Floating Point - load fp integer
4885 (define_insn "<FPINT:fpint_name><DFP:mode>2"
4886 [(set (match_operand:DFP 0 "register_operand" "=f")
4887 (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")]
4890 "fi<DFP:xde>tr\t%0,<FPINT:fpint_roundingmode>,%1,4"
4891 [(set_attr "op_type" "RRF")
4892 (set_attr "type" "fsimp<DFP:mode>")])
4895 (define_insn "rint<DFP:mode>2"
4896 [(set (match_operand:DFP 0 "register_operand" "=f")
4897 (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")]
4898 UNSPEC_FPINT_RINT))]
4900 "fi<DFP:xde>tr\t%0,0,%1,0"
4901 [(set_attr "op_type" "RRF")
4902 (set_attr "type" "fsimp<DFP:mode>")])
4905 ; Binary <-> Decimal floating point trunc patterns
4908 (define_insn "*trunc<BFP:mode><DFP_ALL:mode>2"
4909 [(set (reg:DFP_ALL FPR0_REGNUM)
4910 (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM)))
4911 (use (reg:SI GPR0_REGNUM))
4912 (clobber (reg:CC CC_REGNUM))
4913 (clobber (reg:SI GPR1_REGNUM))]
4917 (define_insn "*trunc<DFP_ALL:mode><BFP:mode>2"
4918 [(set (reg:BFP FPR0_REGNUM)
4919 (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM)))
4920 (use (reg:SI GPR0_REGNUM))
4921 (clobber (reg:CC CC_REGNUM))
4922 (clobber (reg:SI GPR1_REGNUM))]
4926 (define_expand "trunc<BFP:mode><DFP_ALL:mode>2"
4927 [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
4928 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4930 [(set (reg:DFP_ALL FPR0_REGNUM)
4931 (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM)))
4932 (use (reg:SI GPR0_REGNUM))
4933 (clobber (reg:CC CC_REGNUM))
4934 (clobber (reg:SI GPR1_REGNUM))])
4935 (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "")
4936 (reg:DFP_ALL FPR0_REGNUM))]
4938 && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DFP_ALL:MODE>mode)"
4940 HOST_WIDE_INT flags;
4942 flags = (PFPO_CONVERT |
4943 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT |
4944 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT);
4946 operands[2] = GEN_INT (flags);
4949 (define_expand "trunc<DFP_ALL:mode><BFP:mode>2"
4950 [(set (reg:DFP_ALL FPR4_REGNUM)
4951 (match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
4952 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4954 [(set (reg:BFP FPR0_REGNUM) (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM)))
4955 (use (reg:SI GPR0_REGNUM))
4956 (clobber (reg:CC CC_REGNUM))
4957 (clobber (reg:SI GPR1_REGNUM))])
4958 (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))]
4960 && GET_MODE_SIZE (<DFP_ALL:MODE>mode) >= GET_MODE_SIZE (<BFP:MODE>mode)"
4962 HOST_WIDE_INT flags;
4964 flags = (PFPO_CONVERT |
4965 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT |
4966 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT);
4968 operands[2] = GEN_INT (flags);
4972 ; Binary <-> Decimal floating point extend patterns
4975 (define_insn "*extend<BFP:mode><DFP_ALL:mode>2"
4976 [(set (reg:DFP_ALL FPR0_REGNUM) (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM)))
4977 (use (reg:SI GPR0_REGNUM))
4978 (clobber (reg:CC CC_REGNUM))
4979 (clobber (reg:SI GPR1_REGNUM))]
4983 (define_insn "*extend<DFP_ALL:mode><BFP:mode>2"
4984 [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM)))
4985 (use (reg:SI GPR0_REGNUM))
4986 (clobber (reg:CC CC_REGNUM))
4987 (clobber (reg:SI GPR1_REGNUM))]
4991 (define_expand "extend<BFP:mode><DFP_ALL:mode>2"
4992 [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
4993 (set (reg:SI GPR0_REGNUM) (match_dup 2))
4995 [(set (reg:DFP_ALL FPR0_REGNUM)
4996 (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM)))
4997 (use (reg:SI GPR0_REGNUM))
4998 (clobber (reg:CC CC_REGNUM))
4999 (clobber (reg:SI GPR1_REGNUM))])
5000 (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "")
5001 (reg:DFP_ALL FPR0_REGNUM))]
5003 && GET_MODE_SIZE (<BFP:MODE>mode) <= GET_MODE_SIZE (<DFP_ALL:MODE>mode)"
5005 HOST_WIDE_INT flags;
5007 flags = (PFPO_CONVERT |
5008 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT |
5009 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT);
5011 operands[2] = GEN_INT (flags);
5014 (define_expand "extend<DFP_ALL:mode><BFP:mode>2"
5015 [(set (reg:DFP_ALL FPR4_REGNUM)
5016 (match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
5017 (set (reg:SI GPR0_REGNUM) (match_dup 2))
5019 [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM)))
5020 (use (reg:SI GPR0_REGNUM))
5021 (clobber (reg:CC CC_REGNUM))
5022 (clobber (reg:SI GPR1_REGNUM))])
5023 (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))]
5025 && GET_MODE_SIZE (<DFP_ALL:MODE>mode) < GET_MODE_SIZE (<BFP:MODE>mode)"
5027 HOST_WIDE_INT flags;
5029 flags = (PFPO_CONVERT |
5030 PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT |
5031 PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT);
5033 operands[2] = GEN_INT (flags);
5038 ;; ARITHMETIC OPERATIONS
5040 ; arithmetic operations set the ConditionCode,
5041 ; because of unpredictable Bits in Register for Halfword and Byte
5042 ; the ConditionCode can be set wrong in operations for Halfword and Byte
5045 ;;- Add instructions.
5049 ; addti3 instruction pattern(s).
5052 (define_expand "addti3"
5054 [(set (match_operand:TI 0 "register_operand" "")
5055 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "")
5056 (match_operand:TI 2 "general_operand" "") ) )
5057 (clobber (reg:CC CC_REGNUM))])]
5060 /* For z13 we have vaq which doesn't set CC. */
5063 emit_insn (gen_rtx_SET (operands[0],
5064 gen_rtx_PLUS (TImode,
5065 copy_to_mode_reg (TImode, operands[1]),
5066 copy_to_mode_reg (TImode, operands[2]))));
5071 (define_insn_and_split "*addti3"
5072 [(set (match_operand:TI 0 "register_operand" "=&d")
5073 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
5074 (match_operand:TI 2 "general_operand" "do") ) )
5075 (clobber (reg:CC CC_REGNUM))]
5078 "&& reload_completed"
5080 [(set (reg:CCL1 CC_REGNUM)
5081 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
5083 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
5085 [(set (match_dup 3) (plus:DI
5086 (plus:DI (ltu:DI (reg:CCL1 CC_REGNUM) (const_int 0))
5087 (match_dup 4)) (match_dup 5)))
5088 (clobber (reg:CC CC_REGNUM))])]
5089 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
5090 operands[4] = operand_subword (operands[1], 0, 0, TImode);
5091 operands[5] = operand_subword (operands[2], 0, 0, TImode);
5092 operands[6] = operand_subword (operands[0], 1, 0, TImode);
5093 operands[7] = operand_subword (operands[1], 1, 0, TImode);
5094 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
5095 [(set_attr "op_type" "*")
5096 (set_attr "cpu_facility" "*")])
5099 ; adddi3 instruction pattern(s).
5102 (define_expand "adddi3"
5104 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5105 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
5106 (match_operand:DI 2 "general_operand" "")))
5107 (clobber (reg:CC CC_REGNUM))])]
5111 (define_insn "*adddi3_sign"
5112 [(set (match_operand:DI 0 "register_operand" "=d,d")
5113 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5114 (match_operand:DI 1 "register_operand" "0,0")))
5115 (clobber (reg:CC CC_REGNUM))]
5120 [(set_attr "op_type" "RRE,RXY")
5121 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5123 (define_insn "*adddi3_zero_cc"
5124 [(set (reg CC_REGNUM)
5125 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5126 (match_operand:DI 1 "register_operand" "0,0"))
5128 (set (match_operand:DI 0 "register_operand" "=d,d")
5129 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
5130 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5134 [(set_attr "op_type" "RRE,RXY")
5135 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5137 (define_insn "*adddi3_zero_cconly"
5138 [(set (reg CC_REGNUM)
5139 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5140 (match_operand:DI 1 "register_operand" "0,0"))
5142 (clobber (match_scratch:DI 0 "=d,d"))]
5143 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5147 [(set_attr "op_type" "RRE,RXY")
5148 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5150 (define_insn "*adddi3_zero"
5151 [(set (match_operand:DI 0 "register_operand" "=d,d")
5152 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
5153 (match_operand:DI 1 "register_operand" "0,0")))
5154 (clobber (reg:CC CC_REGNUM))]
5159 [(set_attr "op_type" "RRE,RXY")
5160 (set_attr "z10prop" "z10_super_E1,z10_super_E1")])
5162 (define_insn_and_split "*adddi3_31z"
5163 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
5164 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5165 (match_operand:DI 2 "general_operand" "do") ) )
5166 (clobber (reg:CC CC_REGNUM))]
5167 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
5169 "&& reload_completed"
5171 [(set (reg:CCL1 CC_REGNUM)
5172 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
5174 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
5176 [(set (match_dup 3) (plus:SI
5177 (plus:SI (ltu:SI (reg:CCL1 CC_REGNUM) (const_int 0))
5178 (match_dup 4)) (match_dup 5)))
5179 (clobber (reg:CC CC_REGNUM))])]
5180 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5181 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5182 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5183 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5184 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5185 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
5187 (define_insn_and_split "*adddi3_31"
5188 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
5189 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
5190 (match_operand:DI 2 "general_operand" "do") ) )
5191 (clobber (reg:CC CC_REGNUM))]
5194 "&& reload_completed"
5196 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
5197 (clobber (reg:CC CC_REGNUM))])
5199 [(set (reg:CCL1 CC_REGNUM)
5200 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
5202 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
5204 (if_then_else (ltu (reg:CCL1 CC_REGNUM) (const_int 0))
5206 (label_ref (match_dup 9))))
5208 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
5209 (clobber (reg:CC CC_REGNUM))])
5211 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5212 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5213 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5214 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5215 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5216 operands[8] = operand_subword (operands[2], 1, 0, DImode);
5217 operands[9] = gen_label_rtx ();")
5220 ; addsi3 instruction pattern(s).
5223 (define_expand "addsi3"
5225 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5226 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "")
5227 (match_operand:SI 2 "general_operand" "")))
5228 (clobber (reg:CC CC_REGNUM))])]
5232 (define_insn "*addsi3_sign"
5233 [(set (match_operand:SI 0 "register_operand" "=d,d")
5234 (plus:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
5235 (match_operand:SI 1 "register_operand" "0,0")))
5236 (clobber (reg:CC CC_REGNUM))]
5241 [(set_attr "op_type" "RX,RXY")
5242 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5245 ; add(di|si)3 instruction pattern(s).
5248 ; ark, agrk, ar, ahi, ahik, aghik, alfi, slfi, a, ay, agr, aghi, algfi, slgfi, ag, asi, agsi
5249 (define_insn "*add<mode>3"
5250 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d,d,d, d, d,d,d,QS")
5251 (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,d, 0, 0,0,0, 0")
5252 (match_operand:GPR 2 "general_operand" " d,d,K,K,Op,On,R,T, C") ) )
5253 (clobber (reg:CC CC_REGNUM))]
5265 [(set_attr "op_type" "RR<E>,RRF,RI,RIE,RIL,RIL,RX<Y>,RXY,SIY")
5266 (set_attr "cpu_facility" "*,z196,*,z196,extimm,extimm,*,*,z10")
5267 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,z10_super_E1,z10_super_E1,
5268 z10_super_E1,z10_super_E1,z10_super_E1")])
5270 ; alr, alfi, slfi, al, aly, alrk, alhsik, algr, algfi, slgfi, alg, alsi, algsi, algrk, alghsik
5271 (define_insn "*add<mode>3_carry1_cc"
5272 [(set (reg CC_REGNUM)
5273 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0,0")
5274 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T,C"))
5276 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,d")
5277 (plus:GPR (match_dup 1) (match_dup 2)))]
5278 "s390_match_ccmode (insn, CCL1mode)"
5284 al<g>hsik\t%0,%1,%h2
5288 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5289 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5290 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*,
5291 z10_super_E1,z10_super_E1,z10_super_E1")])
5293 ; alr, al, aly, algr, alg, alrk, algrk
5294 (define_insn "*add<mode>3_carry1_cconly"
5295 [(set (reg CC_REGNUM)
5296 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5297 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5299 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5300 "s390_match_ccmode (insn, CCL1mode)"
5306 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5307 (set_attr "cpu_facility" "*,z196,*,*")
5308 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5310 ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik
5311 (define_insn "*add<mode>3_carry2_cc"
5312 [(set (reg CC_REGNUM)
5313 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0, 0")
5314 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T, C"))
5316 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,RS")
5317 (plus:GPR (match_dup 1) (match_dup 2)))]
5318 "s390_match_ccmode (insn, CCL1mode)"
5324 al<g>hsik\t%0,%1,%h2
5328 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5329 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5330 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*,
5331 z10_super_E1,z10_super_E1,z10_super_E1")])
5333 ; alr, al, aly, algr, alg, alrk, algrk
5334 (define_insn "*add<mode>3_carry2_cconly"
5335 [(set (reg CC_REGNUM)
5336 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5337 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5339 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5340 "s390_match_ccmode (insn, CCL1mode)"
5346 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5347 (set_attr "cpu_facility" "*,z196,*,*")
5348 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5350 ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik
5351 (define_insn "*add<mode>3_cc"
5352 [(set (reg CC_REGNUM)
5353 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0, 0")
5354 (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T, C"))
5356 (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,RS")
5357 (plus:GPR (match_dup 1) (match_dup 2)))]
5358 "s390_match_ccmode (insn, CCLmode)"
5364 al<g>hsik\t%0,%1,%h2
5368 [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY")
5369 (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,*,z10")
5370 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,
5371 *,z10_super_E1,z10_super_E1,z10_super_E1")])
5373 ; alr, al, aly, algr, alg, alrk, algrk
5374 (define_insn "*add<mode>3_cconly"
5375 [(set (reg CC_REGNUM)
5376 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5377 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5379 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5380 "s390_match_ccmode (insn, CCLmode)"
5386 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5387 (set_attr "cpu_facility" "*,z196,*,*")
5388 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5390 ; alr, al, aly, algr, alg, alrk, algrk
5391 (define_insn "*add<mode>3_cconly2"
5392 [(set (reg CC_REGNUM)
5393 (compare (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0")
5394 (neg:GPR (match_operand:GPR 2 "general_operand" "d,d,R,T"))))
5395 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5396 "s390_match_ccmode(insn, CCLmode)"
5402 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5403 (set_attr "cpu_facility" "*,z196,*,*")
5404 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5406 ; ahi, afi, aghi, agfi, asi, agsi
5407 (define_insn "*add<mode>3_imm_cc"
5408 [(set (reg CC_REGNUM)
5409 (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" " 0, d,0, 0")
5410 (match_operand:GPR 2 "const_int_operand" " K, K,Os, C"))
5412 (set (match_operand:GPR 0 "nonimmediate_operand" "=d, d,d,QS")
5413 (plus:GPR (match_dup 1) (match_dup 2)))]
5414 "s390_match_ccmode (insn, CCAmode)
5415 && (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")
5416 || (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'O', \"Os\")
5417 /* Avoid INT32_MIN on 32 bit. */
5418 && (!TARGET_ZARCH || INTVAL (operands[2]) != -0x7fffffff - 1)))"
5424 [(set_attr "op_type" "RI,RIE,RIL,SIY")
5425 (set_attr "cpu_facility" "*,z196,extimm,z10")
5426 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
5429 ; add(tf|df|sf|td|dd)3 instruction pattern(s).
5432 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5433 ; FIXME: wfadb does not clobber cc
5434 (define_insn "add<mode>3"
5435 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
5436 (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>, 0,<v0>")
5437 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))
5438 (clobber (reg:CC CC_REGNUM))]
5441 a<xde><bt>r\t%0,<op1>%2
5444 [(set_attr "op_type" "<RRer>,RXE,VRR")
5445 (set_attr "type" "fsimp<mode>")
5446 (set_attr "cpu_facility" "*,*,vec")])
5448 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5449 (define_insn "*add<mode>3_cc"
5450 [(set (reg CC_REGNUM)
5451 (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
5452 (match_operand:FP 2 "general_operand" " f,<Rf>"))
5453 (match_operand:FP 3 "const0_operand" "")))
5454 (set (match_operand:FP 0 "register_operand" "=f,f")
5455 (plus:FP (match_dup 1) (match_dup 2)))]
5456 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5458 a<xde><bt>r\t%0,<op1>%2
5460 [(set_attr "op_type" "<RRer>,RXE")
5461 (set_attr "type" "fsimp<mode>")])
5463 ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
5464 (define_insn "*add<mode>3_cconly"
5465 [(set (reg CC_REGNUM)
5466 (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0")
5467 (match_operand:FP 2 "general_operand" " f,<Rf>"))
5468 (match_operand:FP 3 "const0_operand" "")))
5469 (clobber (match_scratch:FP 0 "=f,f"))]
5470 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5472 a<xde><bt>r\t%0,<op1>%2
5474 [(set_attr "op_type" "<RRer>,RXE")
5475 (set_attr "type" "fsimp<mode>")])
5478 ; Pointer add instruction patterns
5481 ; This will match "*la_64"
5482 (define_expand "addptrdi3"
5483 [(set (match_operand:DI 0 "register_operand" "")
5484 (plus:DI (match_operand:DI 1 "register_operand" "")
5485 (match_operand:DI 2 "nonmemory_operand" "")))]
5488 if (GET_CODE (operands[2]) == CONST_INT)
5490 HOST_WIDE_INT c = INTVAL (operands[2]);
5492 if (!CONST_OK_FOR_CONSTRAINT_P (c, 'K', "K")
5493 && !CONST_OK_FOR_CONSTRAINT_P (c, 'O', "Os"))
5495 operands[2] = force_const_mem (DImode, operands[2]);
5496 operands[2] = force_reg (DImode, operands[2]);
5498 else if (!DISP_IN_RANGE (INTVAL (operands[2])))
5499 operands[2] = force_reg (DImode, operands[2]);
5503 ; For 31 bit we have to prevent the generated pattern from matching
5504 ; normal ADDs since la only does a 31 bit add. This is supposed to
5505 ; match "force_la_31".
5506 (define_expand "addptrsi3"
5508 [(set (match_operand:SI 0 "register_operand" "")
5509 (plus:SI (match_operand:SI 1 "register_operand" "")
5510 (match_operand:SI 2 "nonmemory_operand" "")))
5511 (use (const_int 0))])]
5514 if (GET_CODE (operands[2]) == CONST_INT)
5516 HOST_WIDE_INT c = INTVAL (operands[2]);
5518 if (!CONST_OK_FOR_CONSTRAINT_P (c, 'K', "K")
5519 && !CONST_OK_FOR_CONSTRAINT_P (c, 'O', "Os"))
5521 operands[2] = force_const_mem (SImode, operands[2]);
5522 operands[2] = force_reg (SImode, operands[2]);
5524 else if (!DISP_IN_RANGE (INTVAL (operands[2])))
5525 operands[2] = force_reg (SImode, operands[2]);
5530 ;;- Subtract instructions.
5534 ; subti3 instruction pattern(s).
5537 (define_expand "subti3"
5539 [(set (match_operand:TI 0 "register_operand" "")
5540 (minus:TI (match_operand:TI 1 "register_operand" "")
5541 (match_operand:TI 2 "general_operand" "") ) )
5542 (clobber (reg:CC CC_REGNUM))])]
5545 /* For z13 we have vaq which doesn't set CC. */
5548 emit_insn (gen_rtx_SET (operands[0],
5549 gen_rtx_MINUS (TImode,
5551 copy_to_mode_reg (TImode, operands[2]))));
5556 (define_insn_and_split "*subti3"
5557 [(set (match_operand:TI 0 "register_operand" "=&d")
5558 (minus:TI (match_operand:TI 1 "register_operand" "0")
5559 (match_operand:TI 2 "general_operand" "do") ) )
5560 (clobber (reg:CC CC_REGNUM))]
5563 "&& reload_completed"
5565 [(set (reg:CCL2 CC_REGNUM)
5566 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
5568 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
5570 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
5571 (gtu:DI (reg:CCL2 CC_REGNUM) (const_int 0))))
5572 (clobber (reg:CC CC_REGNUM))])]
5573 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
5574 operands[4] = operand_subword (operands[1], 0, 0, TImode);
5575 operands[5] = operand_subword (operands[2], 0, 0, TImode);
5576 operands[6] = operand_subword (operands[0], 1, 0, TImode);
5577 operands[7] = operand_subword (operands[1], 1, 0, TImode);
5578 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
5579 [(set_attr "op_type" "*")
5580 (set_attr "cpu_facility" "*")])
5583 ; subdi3 instruction pattern(s).
5586 (define_expand "subdi3"
5588 [(set (match_operand:DI 0 "register_operand" "")
5589 (minus:DI (match_operand:DI 1 "register_operand" "")
5590 (match_operand:DI 2 "general_operand" "")))
5591 (clobber (reg:CC CC_REGNUM))])]
5595 (define_insn "*subdi3_sign"
5596 [(set (match_operand:DI 0 "register_operand" "=d,d")
5597 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5598 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))))
5599 (clobber (reg:CC CC_REGNUM))]
5604 [(set_attr "op_type" "RRE,RXY")
5605 (set_attr "z10prop" "z10_c,*")
5606 (set_attr "z196prop" "z196_cracked")])
5608 (define_insn "*subdi3_zero_cc"
5609 [(set (reg CC_REGNUM)
5610 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5611 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT")))
5613 (set (match_operand:DI 0 "register_operand" "=d,d")
5614 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
5615 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5619 [(set_attr "op_type" "RRE,RXY")
5620 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5622 (define_insn "*subdi3_zero_cconly"
5623 [(set (reg CC_REGNUM)
5624 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5625 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT")))
5627 (clobber (match_scratch:DI 0 "=d,d"))]
5628 "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH"
5632 [(set_attr "op_type" "RRE,RXY")
5633 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5635 (define_insn "*subdi3_zero"
5636 [(set (match_operand:DI 0 "register_operand" "=d,d")
5637 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
5638 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))))
5639 (clobber (reg:CC CC_REGNUM))]
5644 [(set_attr "op_type" "RRE,RXY")
5645 (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")])
5647 (define_insn_and_split "*subdi3_31z"
5648 [(set (match_operand:DI 0 "register_operand" "=&d")
5649 (minus:DI (match_operand:DI 1 "register_operand" "0")
5650 (match_operand:DI 2 "general_operand" "do") ) )
5651 (clobber (reg:CC CC_REGNUM))]
5652 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
5654 "&& reload_completed"
5656 [(set (reg:CCL2 CC_REGNUM)
5657 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
5659 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
5661 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
5662 (gtu:SI (reg:CCL2 CC_REGNUM) (const_int 0))))
5663 (clobber (reg:CC CC_REGNUM))])]
5664 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5665 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5666 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5667 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5668 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5669 operands[8] = operand_subword (operands[2], 1, 0, DImode);")
5671 (define_insn_and_split "*subdi3_31"
5672 [(set (match_operand:DI 0 "register_operand" "=&d")
5673 (minus:DI (match_operand:DI 1 "register_operand" "0")
5674 (match_operand:DI 2 "general_operand" "do") ) )
5675 (clobber (reg:CC CC_REGNUM))]
5678 "&& reload_completed"
5680 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
5681 (clobber (reg:CC CC_REGNUM))])
5683 [(set (reg:CCL2 CC_REGNUM)
5684 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
5686 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
5688 (if_then_else (gtu (reg:CCL2 CC_REGNUM) (const_int 0))
5690 (label_ref (match_dup 9))))
5692 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
5693 (clobber (reg:CC CC_REGNUM))])
5695 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
5696 operands[4] = operand_subword (operands[1], 0, 0, DImode);
5697 operands[5] = operand_subword (operands[2], 0, 0, DImode);
5698 operands[6] = operand_subword (operands[0], 1, 0, DImode);
5699 operands[7] = operand_subword (operands[1], 1, 0, DImode);
5700 operands[8] = operand_subword (operands[2], 1, 0, DImode);
5701 operands[9] = gen_label_rtx ();")
5704 ; subsi3 instruction pattern(s).
5707 (define_expand "subsi3"
5709 [(set (match_operand:SI 0 "register_operand" "")
5710 (minus:SI (match_operand:SI 1 "register_operand" "")
5711 (match_operand:SI 2 "general_operand" "")))
5712 (clobber (reg:CC CC_REGNUM))])]
5716 (define_insn "*subsi3_sign"
5717 [(set (match_operand:SI 0 "register_operand" "=d,d")
5718 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
5719 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
5720 (clobber (reg:CC CC_REGNUM))]
5725 [(set_attr "op_type" "RX,RXY")
5726 (set_attr "z196prop" "z196_cracked,z196_cracked")])
5729 ; sub(di|si)3 instruction pattern(s).
5732 ; sr, s, sy, sgr, sg, srk, sgrk
5733 (define_insn "*sub<mode>3"
5734 [(set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5735 (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5736 (match_operand:GPR 2 "general_operand" "d,d,R,T") ) )
5737 (clobber (reg:CC CC_REGNUM))]
5744 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5745 (set_attr "cpu_facility" "*,z196,*,*")
5746 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5748 ; slr, sl, sly, slgr, slg, slrk, slgrk
5749 (define_insn "*sub<mode>3_borrow_cc"
5750 [(set (reg CC_REGNUM)
5751 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5752 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5754 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5755 (minus:GPR (match_dup 1) (match_dup 2)))]
5756 "s390_match_ccmode (insn, CCL2mode)"
5762 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5763 (set_attr "cpu_facility" "*,z196,*,*")
5764 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5766 ; slr, sl, sly, slgr, slg, slrk, slgrk
5767 (define_insn "*sub<mode>3_borrow_cconly"
5768 [(set (reg CC_REGNUM)
5769 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5770 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5772 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5773 "s390_match_ccmode (insn, CCL2mode)"
5779 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5780 (set_attr "cpu_facility" "*,z196,*,*")
5781 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5783 ; slr, sl, sly, slgr, slg, slrk, slgrk
5784 (define_insn "*sub<mode>3_cc"
5785 [(set (reg CC_REGNUM)
5786 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5787 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5789 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5790 (minus:GPR (match_dup 1) (match_dup 2)))]
5791 "s390_match_ccmode (insn, CCLmode)"
5797 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5798 (set_attr "cpu_facility" "*,z196,*,*")
5799 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5801 ; slr, sl, sly, slgr, slg, slrk, slgrk
5802 (define_insn "*sub<mode>3_cc2"
5803 [(set (reg CC_REGNUM)
5804 (compare (match_operand:GPR 1 "register_operand" "0,d,0,0")
5805 (match_operand:GPR 2 "general_operand" "d,d,R,T")))
5806 (set (match_operand:GPR 0 "register_operand" "=d,d,d,d")
5807 (minus:GPR (match_dup 1) (match_dup 2)))]
5808 "s390_match_ccmode (insn, CCL3mode)"
5814 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5815 (set_attr "cpu_facility" "*,z196,*,*")
5816 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5818 ; slr, sl, sly, slgr, slg, slrk, slgrk
5819 (define_insn "*sub<mode>3_cconly"
5820 [(set (reg CC_REGNUM)
5821 (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0")
5822 (match_operand:GPR 2 "general_operand" "d,d,R,T"))
5824 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5825 "s390_match_ccmode (insn, CCLmode)"
5831 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5832 (set_attr "cpu_facility" "*,z196,*,*")
5833 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5836 ; slr, sl, sly, slgr, slg, slrk, slgrk
5837 (define_insn "*sub<mode>3_cconly2"
5838 [(set (reg CC_REGNUM)
5839 (compare (match_operand:GPR 1 "register_operand" "0,d,0,0")
5840 (match_operand:GPR 2 "general_operand" "d,d,R,T")))
5841 (clobber (match_scratch:GPR 0 "=d,d,d,d"))]
5842 "s390_match_ccmode (insn, CCL3mode)"
5848 [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY")
5849 (set_attr "cpu_facility" "*,z196,*,*")
5850 (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")])
5854 ; sub(tf|df|sf|td|dd)3 instruction pattern(s).
5857 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5858 (define_insn "sub<mode>3"
5859 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
5860 (minus:FP (match_operand:FP 1 "register_operand" "<f0>, 0,<v0>")
5861 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))
5862 (clobber (reg:CC CC_REGNUM))]
5865 s<xde><bt>r\t%0,<op1>%2
5868 [(set_attr "op_type" "<RRer>,RXE,VRR")
5869 (set_attr "type" "fsimp<mode>")
5870 (set_attr "cpu_facility" "*,*,vec")])
5872 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5873 (define_insn "*sub<mode>3_cc"
5874 [(set (reg CC_REGNUM)
5875 (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "<f0>,0")
5876 (match_operand:FP 2 "general_operand" "f,<Rf>"))
5877 (match_operand:FP 3 "const0_operand" "")))
5878 (set (match_operand:FP 0 "register_operand" "=f,f")
5879 (minus:FP (match_dup 1) (match_dup 2)))]
5880 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5882 s<xde><bt>r\t%0,<op1>%2
5884 [(set_attr "op_type" "<RRer>,RXE")
5885 (set_attr "type" "fsimp<mode>")])
5887 ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
5888 (define_insn "*sub<mode>3_cconly"
5889 [(set (reg CC_REGNUM)
5890 (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "<f0>,0")
5891 (match_operand:FP 2 "general_operand" "f,<Rf>"))
5892 (match_operand:FP 3 "const0_operand" "")))
5893 (clobber (match_scratch:FP 0 "=f,f"))]
5894 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
5896 s<xde><bt>r\t%0,<op1>%2
5898 [(set_attr "op_type" "<RRer>,RXE")
5899 (set_attr "type" "fsimp<mode>")])
5903 ;;- Conditional add/subtract instructions.
5907 ; add(di|si)cc instruction pattern(s).
5910 ; the following 4 patterns are used when the result of an add with
5911 ; carry is checked for an overflow condition
5913 ; op1 + op2 + c < op1
5915 ; alcr, alc, alcgr, alcg
5916 (define_insn "*add<mode>3_alc_carry1_cc"
5917 [(set (reg CC_REGNUM)
5919 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5920 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5921 (match_operand:GPR 2 "general_operand" "d,RT"))
5923 (set (match_operand:GPR 0 "register_operand" "=d,d")
5924 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5925 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5929 [(set_attr "op_type" "RRE,RXY")
5930 (set_attr "z196prop" "z196_alone,z196_alone")])
5932 ; alcr, alc, alcgr, alcg
5933 (define_insn "*add<mode>3_alc_carry1_cconly"
5934 [(set (reg CC_REGNUM)
5936 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5937 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5938 (match_operand:GPR 2 "general_operand" "d,RT"))
5940 (clobber (match_scratch:GPR 0 "=d,d"))]
5941 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5945 [(set_attr "op_type" "RRE,RXY")
5946 (set_attr "z196prop" "z196_alone,z196_alone")])
5948 ; op1 + op2 + c < op2
5950 ; alcr, alc, alcgr, alcg
5951 (define_insn "*add<mode>3_alc_carry2_cc"
5952 [(set (reg CC_REGNUM)
5954 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5955 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5956 (match_operand:GPR 2 "general_operand" "d,RT"))
5958 (set (match_operand:GPR 0 "register_operand" "=d,d")
5959 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5960 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5964 [(set_attr "op_type" "RRE,RXY")])
5966 ; alcr, alc, alcgr, alcg
5967 (define_insn "*add<mode>3_alc_carry2_cconly"
5968 [(set (reg CC_REGNUM)
5970 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5971 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5972 (match_operand:GPR 2 "general_operand" "d,RT"))
5974 (clobber (match_scratch:GPR 0 "=d,d"))]
5975 "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
5979 [(set_attr "op_type" "RRE,RXY")])
5981 ; alcr, alc, alcgr, alcg
5982 (define_insn "*add<mode>3_alc_cc"
5983 [(set (reg CC_REGNUM)
5985 (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
5986 (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
5987 (match_operand:GPR 2 "general_operand" "d,RT"))
5989 (set (match_operand:GPR 0 "register_operand" "=d,d")
5990 (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
5991 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
5995 [(set_attr "op_type" "RRE,RXY")])
5997 ; alcr, alc, alcgr, alcg
5998 (define_insn "*add<mode>3_alc"
5999 [(set (match_operand:GPR 0 "register_operand" "=d,d")
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")))
6003 (clobber (reg:CC CC_REGNUM))]
6008 [(set_attr "op_type" "RRE,RXY")])
6010 ; slbr, slb, slbgr, slbg
6011 (define_insn "*sub<mode>3_slb_cc"
6012 [(set (reg CC_REGNUM)
6014 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
6015 (match_operand:GPR 2 "general_operand" "d,RT"))
6016 (match_operand:GPR 3 "s390_slb_comparison" ""))
6018 (set (match_operand:GPR 0 "register_operand" "=d,d")
6019 (minus:GPR (minus:GPR (match_dup 1) (match_dup 2)) (match_dup 3)))]
6020 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
6024 [(set_attr "op_type" "RRE,RXY")
6025 (set_attr "z10prop" "z10_c,*")])
6027 ; slbr, slb, slbgr, slbg
6028 (define_insn "*sub<mode>3_slb"
6029 [(set (match_operand:GPR 0 "register_operand" "=d,d")
6030 (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0")
6031 (match_operand:GPR 2 "general_operand" "d,RT"))
6032 (match_operand:GPR 3 "s390_slb_comparison" "")))
6033 (clobber (reg:CC CC_REGNUM))]
6038 [(set_attr "op_type" "RRE,RXY")
6039 (set_attr "z10prop" "z10_c,*")])
6041 (define_expand "add<mode>cc"
6042 [(match_operand:GPR 0 "register_operand" "")
6043 (match_operand 1 "comparison_operator" "")
6044 (match_operand:GPR 2 "register_operand" "")
6045 (match_operand:GPR 3 "const_int_operand" "")]
6047 "if (!s390_expand_addcc (GET_CODE (operands[1]),
6048 XEXP (operands[1], 0), XEXP (operands[1], 1),
6049 operands[0], operands[2],
6050 operands[3])) FAIL; DONE;")
6053 ; scond instruction pattern(s).
6056 (define_insn_and_split "*scond<mode>"
6057 [(set (match_operand:GPR 0 "register_operand" "=&d")
6058 (match_operand:GPR 1 "s390_alc_comparison" ""))
6059 (clobber (reg:CC CC_REGNUM))]
6062 "&& reload_completed"
6063 [(set (match_dup 0) (const_int 0))
6065 [(set (match_dup 0) (plus:GPR (plus:GPR (match_dup 1) (match_dup 0))
6067 (clobber (reg:CC CC_REGNUM))])]
6070 (define_insn_and_split "*scond<mode>_neg"
6071 [(set (match_operand:GPR 0 "register_operand" "=&d")
6072 (match_operand:GPR 1 "s390_slb_comparison" ""))
6073 (clobber (reg:CC CC_REGNUM))]
6076 "&& reload_completed"
6077 [(set (match_dup 0) (const_int 0))
6079 [(set (match_dup 0) (minus:GPR (minus:GPR (match_dup 0) (match_dup 0))
6081 (clobber (reg:CC CC_REGNUM))])
6083 [(set (match_dup 0) (neg:GPR (match_dup 0)))
6084 (clobber (reg:CC CC_REGNUM))])]
6088 (define_expand "cstore<mode>4"
6089 [(set (match_operand:SI 0 "register_operand" "")
6090 (match_operator:SI 1 "s390_scond_operator"
6091 [(match_operand:GPR 2 "register_operand" "")
6092 (match_operand:GPR 3 "general_operand" "")]))]
6094 "if (!s390_expand_addcc (GET_CODE (operands[1]), operands[2], operands[3],
6095 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
6097 (define_expand "cstorecc4"
6099 [(set (match_operand:SI 0 "register_operand" "")
6100 (match_operator:SI 1 "s390_eqne_operator"
6101 [(match_operand:CCZ1 2 "register_operand")
6102 (match_operand 3 "const0_operand")]))
6103 (clobber (reg:CC CC_REGNUM))])]
6105 "emit_insn (gen_sne (operands[0], operands[2]));
6106 if (GET_CODE (operands[1]) == EQ)
6107 emit_insn (gen_xorsi3 (operands[0], operands[0], const1_rtx));
6110 (define_insn_and_split "sne"
6111 [(set (match_operand:SI 0 "register_operand" "=d")
6112 (ne:SI (match_operand:CCZ1 1 "register_operand" "0")
6114 (clobber (reg:CC CC_REGNUM))]
6119 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 28)))
6120 (clobber (reg:CC CC_REGNUM))])])
6124 ;; - Conditional move instructions (introduced with z196)
6127 (define_expand "mov<mode>cc"
6128 [(set (match_operand:GPR 0 "nonimmediate_operand" "")
6129 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6130 (match_operand:GPR 2 "nonimmediate_operand" "")
6131 (match_operand:GPR 3 "nonimmediate_operand" "")))]
6134 /* Emit the comparison insn in case we do not already have a comparison result. */
6135 if (!s390_comparison (operands[1], VOIDmode))
6136 operands[1] = s390_emit_compare (GET_CODE (operands[1]),
6137 XEXP (operands[1], 0),
6138 XEXP (operands[1], 1));
6141 ; locr, loc, stoc, locgr, locg, stocg
6142 (define_insn_and_split "*mov<mode>cc"
6143 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,QS,QS,&d")
6145 (match_operator 1 "s390_comparison"
6146 [(match_operand 2 "cc_reg_operand" " c,c, c, c, c, c, c")
6147 (match_operand 5 "const_int_operand" "")])
6148 (match_operand:GPR 3 "nonimmediate_operand" " d,0,QS, 0, d, 0,QS")
6149 (match_operand:GPR 4 "nonimmediate_operand" " 0,d, 0,QS, 0, d,QS")))]
6159 "&& reload_completed
6160 && MEM_P (operands[3]) && MEM_P (operands[4])"
6163 (match_op_dup 1 [(match_dup 2) (const_int 0)])
6168 (match_op_dup 1 [(match_dup 2) (const_int 0)])
6172 [(set_attr "op_type" "RRF,RRF,RSY,RSY,RSY,RSY,*")])
6175 ;;- Multiply instructions.
6179 ; muldi3 instruction pattern(s).
6182 (define_insn "*muldi3_sign"
6183 [(set (match_operand:DI 0 "register_operand" "=d,d")
6184 (mult:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,RT"))
6185 (match_operand:DI 1 "register_operand" "0,0")))]
6190 [(set_attr "op_type" "RRE,RXY")
6191 (set_attr "type" "imuldi")])
6193 (define_insn "muldi3"
6194 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d")
6195 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0,0")
6196 (match_operand:DI 2 "general_operand" "d,K,RT,Os")))]
6203 [(set_attr "op_type" "RRE,RI,RXY,RIL")
6204 (set_attr "type" "imuldi")
6205 (set_attr "cpu_facility" "*,*,*,z10")])
6208 ; mulsi3 instruction pattern(s).
6211 (define_insn "*mulsi3_sign"
6212 [(set (match_operand:SI 0 "register_operand" "=d,d")
6213 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))
6214 (match_operand:SI 1 "register_operand" "0,0")))]
6219 [(set_attr "op_type" "RX,RXY")
6220 (set_attr "type" "imulhi")
6221 (set_attr "cpu_facility" "*,z10")])
6223 (define_insn "mulsi3"
6224 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
6225 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0")
6226 (match_operand:SI 2 "general_operand" "d,K,R,T,Os")))]
6234 [(set_attr "op_type" "RRE,RI,RX,RXY,RIL")
6235 (set_attr "type" "imulsi,imulhi,imulsi,imulsi,imulsi")
6236 (set_attr "cpu_facility" "*,*,*,*,z10")])
6239 ; mulsidi3 instruction pattern(s).
6242 (define_insn "mulsidi3"
6243 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
6244 (mult:DI (sign_extend:DI
6245 (match_operand:SI 1 "register_operand" "%0,0,0"))
6247 (match_operand:SI 2 "nonimmediate_operand" "d,R,T"))))]
6253 [(set_attr "op_type" "RR,RX,RXY")
6254 (set_attr "type" "imulsi")
6255 (set_attr "cpu_facility" "*,*,z10")])
6258 ; umul instruction pattern(s).
6261 ; mlr, ml, mlgr, mlg
6262 (define_insn "umul<dwh><mode>3"
6263 [(set (match_operand:DW 0 "register_operand" "=d, d")
6264 (mult:DW (zero_extend:DW
6265 (match_operand:<DWH> 1 "register_operand" "%0, 0"))
6267 (match_operand:<DWH> 2 "nonimmediate_operand" " d,RT"))))]
6272 [(set_attr "op_type" "RRE,RXY")
6273 (set_attr "type" "imul<dwh>")])
6276 ; mul(tf|df|sf|td|dd)3 instruction pattern(s).
6279 ; mxbr, mdbr, meebr, mxb, mxb, meeb, mdtr, mxtr
6280 (define_insn "mul<mode>3"
6281 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
6282 (mult:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>, 0,<v0>")
6283 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))]
6286 m<xdee><bt>r\t%0,<op1>%2
6289 [(set_attr "op_type" "<RRer>,RXE,VRR")
6290 (set_attr "type" "fmul<mode>")
6291 (set_attr "cpu_facility" "*,*,vec")])
6293 ; madbr, maebr, maxb, madb, maeb
6294 (define_insn "fma<mode>4"
6295 [(set (match_operand:DSF 0 "register_operand" "=f,f,<vf>")
6296 (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,<vf>")
6297 (match_operand:DSF 2 "nonimmediate_operand" "f,R,<vf>")
6298 (match_operand:DSF 3 "register_operand" "0,0,<v0>")))]
6303 wfmadb\t%v0,%v1,%v2,%v3"
6304 [(set_attr "op_type" "RRE,RXE,VRR")
6305 (set_attr "type" "fmadd<mode>")
6306 (set_attr "cpu_facility" "*,*,vec")])
6308 ; msxbr, msdbr, msebr, msxb, msdb, mseb
6309 (define_insn "fms<mode>4"
6310 [(set (match_operand:DSF 0 "register_operand" "=f,f,<vf>")
6311 (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,<vf>")
6312 (match_operand:DSF 2 "nonimmediate_operand" "f,R,<vf>")
6313 (neg:DSF (match_operand:DSF 3 "register_operand" "0,0,<v0>"))))]
6318 wfmsdb\t%v0,%v1,%v2,%v3"
6319 [(set_attr "op_type" "RRE,RXE,VRR")
6320 (set_attr "type" "fmadd<mode>")
6321 (set_attr "cpu_facility" "*,*,vec")])
6324 ;;- Divide and modulo instructions.
6328 ; divmoddi4 instruction pattern(s).
6331 (define_expand "divmoddi4"
6332 [(parallel [(set (match_operand:DI 0 "general_operand" "")
6333 (div:DI (match_operand:DI 1 "register_operand" "")
6334 (match_operand:DI 2 "general_operand" "")))
6335 (set (match_operand:DI 3 "general_operand" "")
6336 (mod:DI (match_dup 1) (match_dup 2)))])
6337 (clobber (match_dup 4))]
6340 rtx insn, div_equal, mod_equal;
6342 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
6343 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
6345 operands[4] = gen_reg_rtx(TImode);
6346 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
6348 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
6349 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6351 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
6352 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6357 (define_insn "divmodtidi3"
6358 [(set (match_operand:TI 0 "register_operand" "=d,d")
6362 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6363 (match_operand:DI 2 "general_operand" "d,RT")))
6365 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
6370 [(set_attr "op_type" "RRE,RXY")
6371 (set_attr "type" "idiv")])
6373 (define_insn "divmodtisi3"
6374 [(set (match_operand:TI 0 "register_operand" "=d,d")
6378 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6380 (match_operand:SI 2 "nonimmediate_operand" "d,RT"))))
6383 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
6388 [(set_attr "op_type" "RRE,RXY")
6389 (set_attr "type" "idiv")])
6392 ; udivmoddi4 instruction pattern(s).
6395 (define_expand "udivmoddi4"
6396 [(parallel [(set (match_operand:DI 0 "general_operand" "")
6397 (udiv:DI (match_operand:DI 1 "general_operand" "")
6398 (match_operand:DI 2 "nonimmediate_operand" "")))
6399 (set (match_operand:DI 3 "general_operand" "")
6400 (umod:DI (match_dup 1) (match_dup 2)))])
6401 (clobber (match_dup 4))]
6404 rtx insn, div_equal, mod_equal, equal;
6406 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
6407 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
6408 equal = gen_rtx_IOR (TImode,
6409 gen_rtx_ASHIFT (TImode,
6410 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
6412 gen_rtx_ZERO_EXTEND (TImode, div_equal));
6414 operands[4] = gen_reg_rtx(TImode);
6415 emit_clobber (operands[4]);
6416 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
6417 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
6419 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
6420 set_unique_reg_note (insn, REG_EQUAL, equal);
6422 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
6423 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6425 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
6426 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6431 (define_insn "udivmodtidi3"
6432 [(set (match_operand:TI 0 "register_operand" "=d,d")
6437 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
6439 (match_operand:DI 2 "nonimmediate_operand" "d,RT")))))
6443 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
6448 [(set_attr "op_type" "RRE,RXY")
6449 (set_attr "type" "idiv")])
6452 ; divmodsi4 instruction pattern(s).
6455 (define_expand "divmodsi4"
6456 [(parallel [(set (match_operand:SI 0 "general_operand" "")
6457 (div:SI (match_operand:SI 1 "general_operand" "")
6458 (match_operand:SI 2 "nonimmediate_operand" "")))
6459 (set (match_operand:SI 3 "general_operand" "")
6460 (mod:SI (match_dup 1) (match_dup 2)))])
6461 (clobber (match_dup 4))]
6464 rtx insn, div_equal, mod_equal, equal;
6466 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
6467 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
6468 equal = gen_rtx_IOR (DImode,
6469 gen_rtx_ASHIFT (DImode,
6470 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
6472 gen_rtx_ZERO_EXTEND (DImode, div_equal));
6474 operands[4] = gen_reg_rtx(DImode);
6475 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
6477 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
6478 set_unique_reg_note (insn, REG_EQUAL, equal);
6480 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
6481 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6483 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
6484 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6489 (define_insn "divmoddisi3"
6490 [(set (match_operand:DI 0 "register_operand" "=d,d")
6495 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
6497 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
6501 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
6506 [(set_attr "op_type" "RR,RX")
6507 (set_attr "type" "idiv")])
6510 ; udivsi3 and umodsi3 instruction pattern(s).
6513 (define_expand "udivmodsi4"
6514 [(parallel [(set (match_operand:SI 0 "general_operand" "")
6515 (udiv:SI (match_operand:SI 1 "general_operand" "")
6516 (match_operand:SI 2 "nonimmediate_operand" "")))
6517 (set (match_operand:SI 3 "general_operand" "")
6518 (umod:SI (match_dup 1) (match_dup 2)))])
6519 (clobber (match_dup 4))]
6520 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
6522 rtx insn, div_equal, mod_equal, equal;
6524 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6525 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6526 equal = gen_rtx_IOR (DImode,
6527 gen_rtx_ASHIFT (DImode,
6528 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
6530 gen_rtx_ZERO_EXTEND (DImode, div_equal));
6532 operands[4] = gen_reg_rtx(DImode);
6533 emit_clobber (operands[4]);
6534 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
6535 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
6537 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
6538 set_unique_reg_note (insn, REG_EQUAL, equal);
6540 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
6541 set_unique_reg_note (insn, REG_EQUAL, div_equal);
6543 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
6544 set_unique_reg_note (insn, REG_EQUAL, mod_equal);
6549 (define_insn "udivmoddisi3"
6550 [(set (match_operand:DI 0 "register_operand" "=d,d")
6555 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
6557 (match_operand:SI 2 "nonimmediate_operand" "d,RT")))))
6561 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
6562 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
6566 [(set_attr "op_type" "RRE,RXY")
6567 (set_attr "type" "idiv")])
6569 (define_expand "udivsi3"
6570 [(set (match_operand:SI 0 "register_operand" "=d")
6571 (udiv:SI (match_operand:SI 1 "general_operand" "")
6572 (match_operand:SI 2 "general_operand" "")))
6573 (clobber (match_dup 3))]
6574 "!TARGET_ZARCH && !TARGET_CPU_ZARCH"
6576 rtx insn, udiv_equal, umod_equal, equal;
6578 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6579 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6580 equal = gen_rtx_IOR (DImode,
6581 gen_rtx_ASHIFT (DImode,
6582 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
6584 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
6586 operands[3] = gen_reg_rtx (DImode);
6588 if (CONSTANT_P (operands[2]))
6590 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
6592 rtx_code_label *label1 = gen_label_rtx ();
6594 operands[1] = make_safe_from (operands[1], operands[0]);
6595 emit_move_insn (operands[0], const0_rtx);
6596 emit_cmp_and_jump_insns (operands[1], operands[2], LT, NULL_RTX,
6598 emit_move_insn (operands[0], const1_rtx);
6599 emit_label (label1);
6603 operands[2] = force_reg (SImode, operands[2]);
6604 operands[2] = make_safe_from (operands[2], operands[0]);
6606 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6607 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6609 set_unique_reg_note (insn, REG_EQUAL, equal);
6611 insn = emit_move_insn (operands[0],
6612 gen_lowpart (SImode, operands[3]));
6613 set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
6618 rtx_code_label *label1 = gen_label_rtx ();
6619 rtx_code_label *label2 = gen_label_rtx ();
6620 rtx_code_label *label3 = gen_label_rtx ();
6622 operands[1] = force_reg (SImode, operands[1]);
6623 operands[1] = make_safe_from (operands[1], operands[0]);
6624 operands[2] = force_reg (SImode, operands[2]);
6625 operands[2] = make_safe_from (operands[2], operands[0]);
6627 emit_move_insn (operands[0], const0_rtx);
6628 emit_cmp_and_jump_insns (operands[2], operands[1], GT, NULL_RTX,
6630 emit_cmp_and_jump_insns (operands[2], const0_rtx, LT, NULL_RTX,
6632 emit_cmp_and_jump_insns (operands[2], const1_rtx, EQ, NULL_RTX,
6634 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6635 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6637 set_unique_reg_note (insn, REG_EQUAL, equal);
6639 insn = emit_move_insn (operands[0],
6640 gen_lowpart (SImode, operands[3]));
6641 set_unique_reg_note (insn, REG_EQUAL, udiv_equal);
6644 emit_label (label1);
6645 emit_move_insn (operands[0], operands[1]);
6647 emit_label (label2);
6648 emit_move_insn (operands[0], const1_rtx);
6649 emit_label (label3);
6651 emit_move_insn (operands[0], operands[0]);
6655 (define_expand "umodsi3"
6656 [(set (match_operand:SI 0 "register_operand" "=d")
6657 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
6658 (match_operand:SI 2 "nonimmediate_operand" "")))
6659 (clobber (match_dup 3))]
6660 "!TARGET_ZARCH && !TARGET_CPU_ZARCH"
6662 rtx insn, udiv_equal, umod_equal, equal;
6664 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
6665 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
6666 equal = gen_rtx_IOR (DImode,
6667 gen_rtx_ASHIFT (DImode,
6668 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
6670 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
6672 operands[3] = gen_reg_rtx (DImode);
6674 if (CONSTANT_P (operands[2]))
6676 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
6678 rtx_code_label *label1 = gen_label_rtx ();
6680 operands[1] = make_safe_from (operands[1], operands[0]);
6681 emit_move_insn (operands[0], operands[1]);
6682 emit_cmp_and_jump_insns (operands[0], operands[2], LT, NULL_RTX,
6684 emit_insn (gen_abssi2 (operands[0], operands[2]));
6685 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
6686 emit_label (label1);
6690 operands[2] = force_reg (SImode, operands[2]);
6691 operands[2] = make_safe_from (operands[2], operands[0]);
6693 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6694 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6696 set_unique_reg_note (insn, REG_EQUAL, equal);
6698 insn = emit_move_insn (operands[0],
6699 gen_highpart (SImode, operands[3]));
6700 set_unique_reg_note (insn, REG_EQUAL, umod_equal);
6705 rtx_code_label *label1 = gen_label_rtx ();
6706 rtx_code_label *label2 = gen_label_rtx ();
6707 rtx_code_label *label3 = gen_label_rtx ();
6709 operands[1] = force_reg (SImode, operands[1]);
6710 operands[1] = make_safe_from (operands[1], operands[0]);
6711 operands[2] = force_reg (SImode, operands[2]);
6712 operands[2] = make_safe_from (operands[2], operands[0]);
6714 emit_move_insn(operands[0], operands[1]);
6715 emit_cmp_and_jump_insns (operands[2], operands[1], GT, NULL_RTX,
6717 emit_cmp_and_jump_insns (operands[2], const0_rtx, LT, NULL_RTX,
6719 emit_cmp_and_jump_insns (operands[2], const1_rtx, EQ, NULL_RTX,
6721 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
6722 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
6724 set_unique_reg_note (insn, REG_EQUAL, equal);
6726 insn = emit_move_insn (operands[0],
6727 gen_highpart (SImode, operands[3]));
6728 set_unique_reg_note (insn, REG_EQUAL, umod_equal);
6731 emit_label (label1);
6732 emit_move_insn (operands[0], const0_rtx);
6734 emit_label (label2);
6735 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
6736 emit_label (label3);
6742 ; div(df|sf)3 instruction pattern(s).
6745 ; dxbr, ddbr, debr, dxb, ddb, deb, ddtr, dxtr
6746 (define_insn "div<mode>3"
6747 [(set (match_operand:FP 0 "register_operand" "=f, f,<vf>")
6748 (div:FP (match_operand:FP 1 "register_operand" "<f0>, 0,<v0>")
6749 (match_operand:FP 2 "general_operand" "f,<Rf>,<vf>")))]
6752 d<xde><bt>r\t%0,<op1>%2
6755 [(set_attr "op_type" "<RRer>,RXE,VRR")
6756 (set_attr "type" "fdiv<mode>")
6757 (set_attr "cpu_facility" "*,*,vec")])
6761 ;;- And instructions.
6764 (define_expand "and<mode>3"
6765 [(set (match_operand:INT 0 "nonimmediate_operand" "")
6766 (and:INT (match_operand:INT 1 "nonimmediate_operand" "")
6767 (match_operand:INT 2 "general_operand" "")))
6768 (clobber (reg:CC CC_REGNUM))]
6770 "s390_expand_logical_operator (AND, <MODE>mode, operands); DONE;")
6773 ; anddi3 instruction pattern(s).
6776 (define_insn "*anddi3_cc"
6777 [(set (reg CC_REGNUM)
6779 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0, d")
6780 (match_operand:DI 2 "general_operand" " d,d,RT,NxxDq"))
6782 (set (match_operand:DI 0 "register_operand" "=d,d, d, d")
6783 (and:DI (match_dup 1) (match_dup 2)))]
6784 "TARGET_ZARCH && s390_match_ccmode(insn, CCTmode)"
6789 risbg\t%0,%1,%s2,128+%e2,0"
6790 [(set_attr "op_type" "RRE,RRF,RXY,RIE")
6791 (set_attr "cpu_facility" "*,z196,*,z10")
6792 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
6794 (define_insn "*anddi3_cconly"
6795 [(set (reg CC_REGNUM)
6797 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0, d")
6798 (match_operand:DI 2 "general_operand" " d,d,RT,NxxDq"))
6800 (clobber (match_scratch:DI 0 "=d,d, d, d"))]
6802 && s390_match_ccmode(insn, CCTmode)
6803 /* Do not steal TM patterns. */
6804 && s390_single_part (operands[2], DImode, HImode, 0) < 0"
6809 risbg\t%0,%1,%s2,128+%e2,0"
6810 [(set_attr "op_type" "RRE,RRF,RXY,RIE")
6811 (set_attr "cpu_facility" "*,z196,*,z10")
6812 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")])
6814 (define_insn "*anddi3"
6815 [(set (match_operand:DI 0 "nonimmediate_operand"
6816 "=d,d, d, d, d, d, d, d,d,d, d, d, AQ,Q")
6818 (match_operand:DI 1 "nonimmediate_operand"
6819 "%d,o, 0, 0, 0, 0, 0, 0,0,d, 0, d, 0,0")
6820 (match_operand:DI 2 "general_operand"
6821 "M, M,N0HDF,N1HDF,N2HDF,N3HDF,N0SDF,N1SDF,d,d,RT,NxxDq,NxQDF,Q")))
6822 (clobber (reg:CC CC_REGNUM))]
6823 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6836 risbg\t%0,%1,%s2,128+%e2,0
6839 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,RIE,SI,SS")
6840 (set_attr "cpu_facility" "*,*,*,*,*,*,extimm,extimm,*,z196,*,z10,*,*")
6841 (set_attr "z10prop" "*,
6857 [(set (match_operand:DI 0 "s_operand" "")
6858 (and:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
6859 (clobber (reg:CC CC_REGNUM))]
6862 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
6863 (clobber (reg:CC CC_REGNUM))])]
6864 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
6866 ;; These two are what combine generates for (ashift (zero_extract)).
6867 (define_insn "*extzv_<mode>_srl"
6868 [(set (match_operand:GPR 0 "register_operand" "=d")
6869 (and:GPR (lshiftrt:GPR
6870 (match_operand:GPR 1 "register_operand" "d")
6871 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
6872 (match_operand:GPR 3 "contiguous_bitmask_operand" "")))
6873 (clobber (reg:CC CC_REGNUM))]
6875 /* Note that even for the SImode pattern, the rotate is always DImode. */
6876 && s390_extzv_shift_ok (<bitsize>, -INTVAL (operands[2]),
6877 INTVAL (operands[3]))"
6878 "risbg\t%0,%1,%<bfstart>3,128+%<bfend>3,64-%2"
6879 [(set_attr "op_type" "RIE")
6880 (set_attr "z10prop" "z10_super_E1")])
6882 (define_insn "*extzv_<mode>_sll"
6883 [(set (match_operand:GPR 0 "register_operand" "=d")
6884 (and:GPR (ashift:GPR
6885 (match_operand:GPR 1 "register_operand" "d")
6886 (match_operand:GPR 2 "nonzero_shift_count_operand" ""))
6887 (match_operand:GPR 3 "contiguous_bitmask_operand" "")))
6888 (clobber (reg:CC CC_REGNUM))]
6890 && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[2]),
6891 INTVAL (operands[3]))"
6892 "risbg\t%0,%1,%<bfstart>3,128+%<bfend>3,%2"
6893 [(set_attr "op_type" "RIE")
6894 (set_attr "z10prop" "z10_super_E1")])
6898 ; andsi3 instruction pattern(s).
6901 (define_insn "*andsi3_cc"
6902 [(set (reg CC_REGNUM)
6905 (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d")
6906 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq"))
6908 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d, d")
6909 (and:SI (match_dup 1) (match_dup 2)))]
6910 "s390_match_ccmode(insn, CCTmode)"
6917 risbg\t%0,%1,%t2,128+%f2,0"
6918 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE")
6919 (set_attr "cpu_facility" "*,*,z196,*,*,z10")
6920 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
6921 z10_super_E1,z10_super_E1,z10_super_E1")])
6923 (define_insn "*andsi3_cconly"
6924 [(set (reg CC_REGNUM)
6927 (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d")
6928 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq"))
6930 (clobber (match_scratch:SI 0 "=d,d,d,d,d, d"))]
6931 "s390_match_ccmode(insn, CCTmode)
6932 /* Do not steal TM patterns. */
6933 && s390_single_part (operands[2], SImode, HImode, 0) < 0"
6940 risbg\t%0,%1,%t2,128+%f2,0"
6941 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE")
6942 (set_attr "cpu_facility" "*,*,z196,*,*,z10")
6943 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
6944 z10_super_E1,z10_super_E1,z10_super_E1")])
6946 (define_insn "*andsi3_zarch"
6947 [(set (match_operand:SI 0 "nonimmediate_operand"
6948 "=d,d, d, d, d,d,d,d,d, d, AQ,Q")
6949 (and:SI (match_operand:SI 1 "nonimmediate_operand"
6950 "%d,o, 0, 0, 0,0,d,0,0, d, 0,0")
6951 (match_operand:SI 2 "general_operand"
6952 " M,M,N0HSF,N1HSF,Os,d,d,R,T,NxxSq,NxQSF,Q")))
6953 (clobber (reg:CC CC_REGNUM))]
6954 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6965 risbg\t%0,%1,%t2,128+%f2,0
6968 [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RRF,RX,RXY,RIE,SI,SS")
6969 (set_attr "cpu_facility" "*,*,*,*,*,*,z196,*,*,z10,*,*")
6970 (set_attr "z10prop" "*,
6983 (define_insn "*andsi3_esa"
6984 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d, AQ,Q")
6985 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0, 0,0")
6986 (match_operand:SI 2 "general_operand" " d,R,NxQSF,Q")))
6987 (clobber (reg:CC CC_REGNUM))]
6988 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
6994 [(set_attr "op_type" "RR,RX,SI,SS")
6995 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
6999 [(set (match_operand:SI 0 "s_operand" "")
7000 (and:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7001 (clobber (reg:CC CC_REGNUM))]
7004 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
7005 (clobber (reg:CC CC_REGNUM))])]
7006 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
7009 ; andhi3 instruction pattern(s).
7012 (define_insn "*andhi3_zarch"
7013 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7014 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0")
7015 (match_operand:HI 2 "general_operand" " d,d,n,NxQHF,Q")))
7016 (clobber (reg:CC CC_REGNUM))]
7017 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7024 [(set_attr "op_type" "RR,RRF,RI,SI,SS")
7025 (set_attr "cpu_facility" "*,z196,*,*,*")
7026 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*")
7029 (define_insn "*andhi3_esa"
7030 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
7031 (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
7032 (match_operand:HI 2 "general_operand" "d,NxQHF,Q")))
7033 (clobber (reg:CC CC_REGNUM))]
7034 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7039 [(set_attr "op_type" "RR,SI,SS")
7040 (set_attr "z10prop" "z10_super_E1,*,*")
7044 [(set (match_operand:HI 0 "s_operand" "")
7045 (and:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7046 (clobber (reg:CC CC_REGNUM))]
7049 [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1)))
7050 (clobber (reg:CC CC_REGNUM))])]
7051 "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);")
7054 ; andqi3 instruction pattern(s).
7057 (define_insn "*andqi3_zarch"
7058 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7059 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0")
7060 (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q")))
7061 (clobber (reg:CC CC_REGNUM))]
7062 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7070 [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS")
7071 (set_attr "cpu_facility" "*,z196,*,*,*,*")
7072 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super,z10_super,*")])
7074 (define_insn "*andqi3_esa"
7075 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
7076 (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
7077 (match_operand:QI 2 "general_operand" "d,n,Q")))
7078 (clobber (reg:CC CC_REGNUM))]
7079 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7084 [(set_attr "op_type" "RR,SI,SS")
7085 (set_attr "z10prop" "z10_super_E1,z10_super,*")])
7088 ; Block and (NC) patterns.
7092 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7093 (and:BLK (match_dup 0)
7094 (match_operand:BLK 1 "memory_operand" "Q")))
7095 (use (match_operand 2 "const_int_operand" "n"))
7096 (clobber (reg:CC CC_REGNUM))]
7097 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7098 "nc\t%O0(%2,%R0),%S1"
7099 [(set_attr "op_type" "SS")
7100 (set_attr "z196prop" "z196_cracked")])
7103 [(set (match_operand 0 "memory_operand" "")
7105 (match_operand 1 "memory_operand" "")))
7106 (clobber (reg:CC CC_REGNUM))]
7108 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7109 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7111 [(set (match_dup 0) (and:BLK (match_dup 0) (match_dup 1)))
7113 (clobber (reg:CC CC_REGNUM))])]
7115 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7116 operands[0] = adjust_address (operands[0], BLKmode, 0);
7117 operands[1] = adjust_address (operands[1], BLKmode, 0);
7122 [(set (match_operand:BLK 0 "memory_operand" "")
7123 (and:BLK (match_dup 0)
7124 (match_operand:BLK 1 "memory_operand" "")))
7125 (use (match_operand 2 "const_int_operand" ""))
7126 (clobber (reg:CC CC_REGNUM))])
7128 [(set (match_operand:BLK 3 "memory_operand" "")
7129 (and:BLK (match_dup 3)
7130 (match_operand:BLK 4 "memory_operand" "")))
7131 (use (match_operand 5 "const_int_operand" ""))
7132 (clobber (reg:CC CC_REGNUM))])]
7133 "s390_offset_p (operands[0], operands[3], operands[2])
7134 && s390_offset_p (operands[1], operands[4], operands[2])
7135 && !s390_overlap_p (operands[0], operands[1],
7136 INTVAL (operands[2]) + INTVAL (operands[5]))
7137 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7139 [(set (match_dup 6) (and:BLK (match_dup 6) (match_dup 7)))
7141 (clobber (reg:CC CC_REGNUM))])]
7142 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7143 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7144 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7148 ;;- Bit set (inclusive or) instructions.
7151 (define_expand "ior<mode>3"
7152 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7153 (ior:INT (match_operand:INT 1 "nonimmediate_operand" "")
7154 (match_operand:INT 2 "general_operand" "")))
7155 (clobber (reg:CC CC_REGNUM))]
7157 "s390_expand_logical_operator (IOR, <MODE>mode, operands); DONE;")
7160 ; iordi3 instruction pattern(s).
7163 (define_insn "*iordi3_cc"
7164 [(set (reg CC_REGNUM)
7165 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7166 (match_operand:DI 2 "general_operand" " d,d,RT"))
7168 (set (match_operand:DI 0 "register_operand" "=d,d, d")
7169 (ior:DI (match_dup 1) (match_dup 2)))]
7170 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7175 [(set_attr "op_type" "RRE,RRF,RXY")
7176 (set_attr "cpu_facility" "*,z196,*")
7177 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7179 (define_insn "*iordi3_cconly"
7180 [(set (reg CC_REGNUM)
7181 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0")
7182 (match_operand:DI 2 "general_operand" " d,d,RT"))
7184 (clobber (match_scratch:DI 0 "=d,d,d"))]
7185 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7190 [(set_attr "op_type" "RRE,RRF,RXY")
7191 (set_attr "cpu_facility" "*,z196,*")
7192 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7194 (define_insn "*iordi3"
7195 [(set (match_operand:DI 0 "nonimmediate_operand"
7196 "=d, d, d, d, d, d,d,d, d, AQ,Q")
7197 (ior:DI (match_operand:DI 1 "nonimmediate_operand"
7198 " %0, 0, 0, 0, 0, 0,0,d, 0, 0,0")
7199 (match_operand:DI 2 "general_operand"
7200 "N0HD0,N1HD0,N2HD0,N3HD0,N0SD0,N1SD0,d,d,RT,NxQD0,Q")))
7201 (clobber (reg:CC CC_REGNUM))]
7202 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7215 [(set_attr "op_type" "RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,SI,SS")
7216 (set_attr "cpu_facility" "*,*,*,*,extimm,extimm,*,z196,*,*,*")
7217 (set_attr "z10prop" "z10_super_E1,
7230 [(set (match_operand:DI 0 "s_operand" "")
7231 (ior:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
7232 (clobber (reg:CC CC_REGNUM))]
7235 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7236 (clobber (reg:CC CC_REGNUM))])]
7237 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7240 ; iorsi3 instruction pattern(s).
7243 (define_insn "*iorsi3_cc"
7244 [(set (reg CC_REGNUM)
7245 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7246 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7248 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
7249 (ior:SI (match_dup 1) (match_dup 2)))]
7250 "s390_match_ccmode(insn, CCTmode)"
7257 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7258 (set_attr "cpu_facility" "*,*,z196,*,*")
7259 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")])
7261 (define_insn "*iorsi3_cconly"
7262 [(set (reg CC_REGNUM)
7263 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7264 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7266 (clobber (match_scratch:SI 0 "=d,d,d,d,d"))]
7267 "s390_match_ccmode(insn, CCTmode)"
7274 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7275 (set_attr "cpu_facility" "*,*,z196,*,*")
7276 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")])
7278 (define_insn "*iorsi3_zarch"
7279 [(set (match_operand:SI 0 "nonimmediate_operand" "=d, d, d,d,d,d,d, AQ,Q")
7280 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0, 0, 0,0,d,0,0, 0,0")
7281 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,Os,d,d,R,T,NxQS0,Q")))
7282 (clobber (reg:CC CC_REGNUM))]
7283 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7294 [(set_attr "op_type" "RI,RI,RIL,RR,RRF,RX,RXY,SI,SS")
7295 (set_attr "cpu_facility" "*,*,*,*,z196,*,*,*,*")
7296 (set_attr "z10prop" "z10_super_E1,
7306 (define_insn "*iorsi3_esa"
7307 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q")
7308 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
7309 (match_operand:SI 2 "general_operand" "d,R,NxQS0,Q")))
7310 (clobber (reg:CC CC_REGNUM))]
7311 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7317 [(set_attr "op_type" "RR,RX,SI,SS")
7318 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")])
7321 [(set (match_operand:SI 0 "s_operand" "")
7322 (ior:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7323 (clobber (reg:CC CC_REGNUM))]
7326 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7327 (clobber (reg:CC CC_REGNUM))])]
7328 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7331 ; iorhi3 instruction pattern(s).
7334 (define_insn "*iorhi3_zarch"
7335 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7336 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0")
7337 (match_operand:HI 2 "general_operand" " d,d,n,NxQH0,Q")))
7338 (clobber (reg:CC CC_REGNUM))]
7339 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7346 [(set_attr "op_type" "RR,RRF,RI,SI,SS")
7347 (set_attr "cpu_facility" "*,z196,*,*,*")
7348 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*")])
7350 (define_insn "*iorhi3_esa"
7351 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q")
7352 (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0")
7353 (match_operand:HI 2 "general_operand" "d,NxQH0,Q")))
7354 (clobber (reg:CC CC_REGNUM))]
7355 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7360 [(set_attr "op_type" "RR,SI,SS")
7361 (set_attr "z10prop" "z10_super_E1,*,*")])
7364 [(set (match_operand:HI 0 "s_operand" "")
7365 (ior:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" "")))
7366 (clobber (reg:CC CC_REGNUM))]
7369 [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1)))
7370 (clobber (reg:CC CC_REGNUM))])]
7371 "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);")
7374 ; iorqi3 instruction pattern(s).
7377 (define_insn "*iorqi3_zarch"
7378 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7379 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0")
7380 (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q")))
7381 (clobber (reg:CC CC_REGNUM))]
7382 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7390 [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS")
7391 (set_attr "cpu_facility" "*,z196,*,*,*,*")
7392 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,
7393 z10_super,z10_super,*")])
7395 (define_insn "*iorqi3_esa"
7396 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q")
7397 (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
7398 (match_operand:QI 2 "general_operand" "d,n,Q")))
7399 (clobber (reg:CC CC_REGNUM))]
7400 "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7405 [(set_attr "op_type" "RR,SI,SS")
7406 (set_attr "z10prop" "z10_super_E1,z10_super,*")])
7409 ; Block inclusive or (OC) patterns.
7413 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7414 (ior:BLK (match_dup 0)
7415 (match_operand:BLK 1 "memory_operand" "Q")))
7416 (use (match_operand 2 "const_int_operand" "n"))
7417 (clobber (reg:CC CC_REGNUM))]
7418 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7419 "oc\t%O0(%2,%R0),%S1"
7420 [(set_attr "op_type" "SS")
7421 (set_attr "z196prop" "z196_cracked")])
7424 [(set (match_operand 0 "memory_operand" "")
7426 (match_operand 1 "memory_operand" "")))
7427 (clobber (reg:CC CC_REGNUM))]
7429 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7430 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7432 [(set (match_dup 0) (ior:BLK (match_dup 0) (match_dup 1)))
7434 (clobber (reg:CC CC_REGNUM))])]
7436 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7437 operands[0] = adjust_address (operands[0], BLKmode, 0);
7438 operands[1] = adjust_address (operands[1], BLKmode, 0);
7443 [(set (match_operand:BLK 0 "memory_operand" "")
7444 (ior:BLK (match_dup 0)
7445 (match_operand:BLK 1 "memory_operand" "")))
7446 (use (match_operand 2 "const_int_operand" ""))
7447 (clobber (reg:CC CC_REGNUM))])
7449 [(set (match_operand:BLK 3 "memory_operand" "")
7450 (ior:BLK (match_dup 3)
7451 (match_operand:BLK 4 "memory_operand" "")))
7452 (use (match_operand 5 "const_int_operand" ""))
7453 (clobber (reg:CC CC_REGNUM))])]
7454 "s390_offset_p (operands[0], operands[3], operands[2])
7455 && s390_offset_p (operands[1], operands[4], operands[2])
7456 && !s390_overlap_p (operands[0], operands[1],
7457 INTVAL (operands[2]) + INTVAL (operands[5]))
7458 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7460 [(set (match_dup 6) (ior:BLK (match_dup 6) (match_dup 7)))
7462 (clobber (reg:CC CC_REGNUM))])]
7463 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7464 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7465 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7469 ;;- Xor instructions.
7472 (define_expand "xor<mode>3"
7473 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7474 (xor:INT (match_operand:INT 1 "nonimmediate_operand" "")
7475 (match_operand:INT 2 "general_operand" "")))
7476 (clobber (reg:CC CC_REGNUM))]
7478 "s390_expand_logical_operator (XOR, <MODE>mode, operands); DONE;")
7480 ; Combine replaces (xor (x) (const_int -1)) with (not (x)) when doing
7481 ; simplifications. So its better to have something matching.
7483 [(set (match_operand:INT 0 "nonimmediate_operand" "")
7484 (not:INT (match_operand:INT 1 "nonimmediate_operand" "")))]
7487 [(set (match_dup 0) (xor:INT (match_dup 1) (match_dup 2)))
7488 (clobber (reg:CC CC_REGNUM))])]
7490 operands[2] = constm1_rtx;
7491 if (!s390_logical_operator_ok_p (operands))
7496 ; xordi3 instruction pattern(s).
7499 (define_insn "*xordi3_cc"
7500 [(set (reg CC_REGNUM)
7501 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7502 (match_operand:DI 2 "general_operand" " d,d,RT"))
7504 (set (match_operand:DI 0 "register_operand" "=d,d, d")
7505 (xor:DI (match_dup 1) (match_dup 2)))]
7506 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7511 [(set_attr "op_type" "RRE,RRF,RXY")
7512 (set_attr "cpu_facility" "*,z196,*")
7513 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7515 (define_insn "*xordi3_cconly"
7516 [(set (reg CC_REGNUM)
7517 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d, 0")
7518 (match_operand:DI 2 "general_operand" " d,d,RT"))
7520 (clobber (match_scratch:DI 0 "=d,d, d"))]
7521 "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH"
7526 [(set_attr "op_type" "RRE,RRF,RXY")
7527 (set_attr "cpu_facility" "*,z196,*")
7528 (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")])
7530 (define_insn "*xordi3"
7531 [(set (match_operand:DI 0 "nonimmediate_operand" "=d, d,d,d, d, AQ,Q")
7532 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0, 0,0,d, 0, 0,0")
7533 (match_operand:DI 2 "general_operand" "N0SD0,N1SD0,d,d,RT,NxQD0,Q")))
7534 (clobber (reg:CC CC_REGNUM))]
7535 "TARGET_ZARCH && s390_logical_operator_ok_p (operands)"
7544 [(set_attr "op_type" "RIL,RIL,RRE,RRF,RXY,SI,SS")
7545 (set_attr "cpu_facility" "extimm,extimm,*,z196,*,*,*")
7546 (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,
7547 *,z10_super_E1,*,*")])
7550 [(set (match_operand:DI 0 "s_operand" "")
7551 (xor:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" "")))
7552 (clobber (reg:CC CC_REGNUM))]
7555 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7556 (clobber (reg:CC CC_REGNUM))])]
7557 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7560 ; xorsi3 instruction pattern(s).
7563 (define_insn "*xorsi3_cc"
7564 [(set (reg CC_REGNUM)
7565 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7566 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7568 (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
7569 (xor:SI (match_dup 1) (match_dup 2)))]
7570 "s390_match_ccmode(insn, CCTmode)"
7577 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7578 (set_attr "cpu_facility" "*,*,z196,*,*")
7579 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7580 z10_super_E1,z10_super_E1")])
7582 (define_insn "*xorsi3_cconly"
7583 [(set (reg CC_REGNUM)
7584 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0")
7585 (match_operand:SI 2 "general_operand" "Os,d,d,R,T"))
7587 (clobber (match_scratch:SI 0 "=d,d,d,d,d"))]
7588 "s390_match_ccmode(insn, CCTmode)"
7595 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY")
7596 (set_attr "cpu_facility" "*,*,z196,*,*")
7597 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7598 z10_super_E1,z10_super_E1")])
7600 (define_insn "*xorsi3"
7601 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d, AQ,Q")
7602 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, 0,0")
7603 (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxQS0,Q")))
7604 (clobber (reg:CC CC_REGNUM))]
7605 "s390_logical_operator_ok_p (operands)"
7614 [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,SI,SS")
7615 (set_attr "cpu_facility" "*,*,z196,*,*,*,*")
7616 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,
7617 z10_super_E1,z10_super_E1,*,*")])
7620 [(set (match_operand:SI 0 "s_operand" "")
7621 (xor:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" "")))
7622 (clobber (reg:CC CC_REGNUM))]
7625 [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1)))
7626 (clobber (reg:CC CC_REGNUM))])]
7627 "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);")
7630 ; xorhi3 instruction pattern(s).
7633 (define_insn "*xorhi3"
7634 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q")
7635 (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,d, 0,0")
7636 (match_operand:HI 2 "general_operand" "Os,d,d,NxQH0,Q")))
7637 (clobber (reg:CC CC_REGNUM))]
7638 "s390_logical_operator_ok_p (operands)"
7645 [(set_attr "op_type" "RIL,RR,RRF,SI,SS")
7646 (set_attr "cpu_facility" "*,*,z196,*,*")
7647 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*,*")])
7650 [(set (match_operand:HI 0 "s_operand" "")
7651 (xor:HI (match_dup 0) (match_operand:HI 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 ; xorqi3 instruction pattern(s).
7663 (define_insn "*xorqi3"
7664 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q")
7665 (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,d,0,0,0")
7666 (match_operand:QI 2 "general_operand" "Os,d,d,n,n,Q")))
7667 (clobber (reg:CC CC_REGNUM))]
7668 "s390_logical_operator_ok_p (operands)"
7676 [(set_attr "op_type" "RIL,RR,RRF,SI,SIY,SS")
7677 (set_attr "cpu_facility" "*,*,z196,*,*,*")
7678 (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super,z10_super,*")])
7682 ; Block exclusive or (XC) patterns.
7686 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7687 (xor:BLK (match_dup 0)
7688 (match_operand:BLK 1 "memory_operand" "Q")))
7689 (use (match_operand 2 "const_int_operand" "n"))
7690 (clobber (reg:CC CC_REGNUM))]
7691 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256"
7692 "xc\t%O0(%2,%R0),%S1"
7693 [(set_attr "op_type" "SS")])
7696 [(set (match_operand 0 "memory_operand" "")
7698 (match_operand 1 "memory_operand" "")))
7699 (clobber (reg:CC CC_REGNUM))]
7701 && GET_MODE (operands[0]) == GET_MODE (operands[1])
7702 && GET_MODE_SIZE (GET_MODE (operands[0])) > 0"
7704 [(set (match_dup 0) (xor:BLK (match_dup 0) (match_dup 1)))
7706 (clobber (reg:CC CC_REGNUM))])]
7708 operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));
7709 operands[0] = adjust_address (operands[0], BLKmode, 0);
7710 operands[1] = adjust_address (operands[1], BLKmode, 0);
7715 [(set (match_operand:BLK 0 "memory_operand" "")
7716 (xor:BLK (match_dup 0)
7717 (match_operand:BLK 1 "memory_operand" "")))
7718 (use (match_operand 2 "const_int_operand" ""))
7719 (clobber (reg:CC CC_REGNUM))])
7721 [(set (match_operand:BLK 3 "memory_operand" "")
7722 (xor:BLK (match_dup 3)
7723 (match_operand:BLK 4 "memory_operand" "")))
7724 (use (match_operand 5 "const_int_operand" ""))
7725 (clobber (reg:CC CC_REGNUM))])]
7726 "s390_offset_p (operands[0], operands[3], operands[2])
7727 && s390_offset_p (operands[1], operands[4], operands[2])
7728 && !s390_overlap_p (operands[0], operands[1],
7729 INTVAL (operands[2]) + INTVAL (operands[5]))
7730 && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256"
7732 [(set (match_dup 6) (xor:BLK (match_dup 6) (match_dup 7)))
7734 (clobber (reg:CC CC_REGNUM))])]
7735 "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7736 operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0));
7737 operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));")
7740 ; Block xor (XC) patterns with src == dest.
7743 (define_insn "*xc_zero"
7744 [(set (match_operand:BLK 0 "memory_operand" "=Q")
7746 (use (match_operand 1 "const_int_operand" "n"))
7747 (clobber (reg:CC CC_REGNUM))]
7748 "INTVAL (operands[1]) >= 1 && INTVAL (operands[1]) <= 256"
7749 "xc\t%O0(%1,%R0),%S0"
7750 [(set_attr "op_type" "SS")
7751 (set_attr "z196prop" "z196_cracked")])
7755 [(set (match_operand:BLK 0 "memory_operand" "")
7757 (use (match_operand 1 "const_int_operand" ""))
7758 (clobber (reg:CC CC_REGNUM))])
7760 [(set (match_operand:BLK 2 "memory_operand" "")
7762 (use (match_operand 3 "const_int_operand" ""))
7763 (clobber (reg:CC CC_REGNUM))])]
7764 "s390_offset_p (operands[0], operands[2], operands[1])
7765 && INTVAL (operands[1]) + INTVAL (operands[3]) <= 256"
7767 [(set (match_dup 4) (const_int 0))
7769 (clobber (reg:CC CC_REGNUM))])]
7770 "operands[4] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0));
7771 operands[5] = GEN_INT (INTVAL (operands[1]) + INTVAL (operands[3]));")
7775 ;;- Negate instructions.
7779 ; neg(di|si)2 instruction pattern(s).
7782 (define_expand "neg<mode>2"
7784 [(set (match_operand:DSI 0 "register_operand" "=d")
7785 (neg:DSI (match_operand:DSI 1 "register_operand" "d")))
7786 (clobber (reg:CC CC_REGNUM))])]
7790 (define_insn "*negdi2_sign_cc"
7791 [(set (reg CC_REGNUM)
7792 (compare (neg:DI (ashiftrt:DI (ashift:DI (subreg:DI
7793 (match_operand:SI 1 "register_operand" "d") 0)
7794 (const_int 32)) (const_int 32)))
7796 (set (match_operand:DI 0 "register_operand" "=d")
7797 (neg:DI (sign_extend:DI (match_dup 1))))]
7798 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
7800 [(set_attr "op_type" "RRE")
7801 (set_attr "z10prop" "z10_c")])
7803 (define_insn "*negdi2_sign"
7804 [(set (match_operand:DI 0 "register_operand" "=d")
7805 (neg:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
7806 (clobber (reg:CC CC_REGNUM))]
7809 [(set_attr "op_type" "RRE")
7810 (set_attr "z10prop" "z10_c")])
7813 (define_insn "*neg<mode>2_cc"
7814 [(set (reg CC_REGNUM)
7815 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
7817 (set (match_operand:GPR 0 "register_operand" "=d")
7818 (neg:GPR (match_dup 1)))]
7819 "s390_match_ccmode (insn, CCAmode)"
7821 [(set_attr "op_type" "RR<E>")
7822 (set_attr "z10prop" "z10_super_c_E1")])
7825 (define_insn "*neg<mode>2_cconly"
7826 [(set (reg CC_REGNUM)
7827 (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d"))
7829 (clobber (match_scratch:GPR 0 "=d"))]
7830 "s390_match_ccmode (insn, CCAmode)"
7832 [(set_attr "op_type" "RR<E>")
7833 (set_attr "z10prop" "z10_super_c_E1")])
7836 (define_insn "*neg<mode>2"
7837 [(set (match_operand:GPR 0 "register_operand" "=d")
7838 (neg:GPR (match_operand:GPR 1 "register_operand" "d")))
7839 (clobber (reg:CC CC_REGNUM))]
7842 [(set_attr "op_type" "RR<E>")
7843 (set_attr "z10prop" "z10_super_c_E1")])
7845 (define_insn "*negdi2_31"
7846 [(set (match_operand:DI 0 "register_operand" "=d")
7847 (neg:DI (match_operand:DI 1 "register_operand" "d")))
7848 (clobber (reg:CC CC_REGNUM))]
7852 ; Split a DImode NEG on 31bit into 2 SImode NEGs
7854 ; Doing the twos complement separately on the SImode parts does an
7855 ; unwanted +1 on the high part which needs to be subtracted afterwards
7856 ; ... unless the +1 on the low part created an overflow.
7859 [(set (match_operand:DI 0 "register_operand" "")
7860 (neg:DI (match_operand:DI 1 "register_operand" "")))
7861 (clobber (reg:CC CC_REGNUM))]
7863 && (REGNO (operands[0]) == REGNO (operands[1])
7864 || s390_split_ok_p (operands[0], operands[1], DImode, 0))
7865 && reload_completed"
7867 [(set (match_dup 2) (neg:SI (match_dup 3)))
7868 (clobber (reg:CC CC_REGNUM))])
7870 [(set (reg:CCAP CC_REGNUM)
7871 (compare:CCAP (neg:SI (match_dup 5)) (const_int 0)))
7872 (set (match_dup 4) (neg:SI (match_dup 5)))])
7874 (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
7876 (label_ref (match_dup 6))))
7878 [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
7879 (clobber (reg:CC CC_REGNUM))])
7881 "operands[2] = operand_subword (operands[0], 0, 0, DImode);
7882 operands[3] = operand_subword (operands[1], 0, 0, DImode);
7883 operands[4] = operand_subword (operands[0], 1, 0, DImode);
7884 operands[5] = operand_subword (operands[1], 1, 0, DImode);
7885 operands[6] = gen_label_rtx ();")
7887 ; Like above but first make a copy of the low part of the src operand
7888 ; since it might overlap with the high part of the destination.
7891 [(set (match_operand:DI 0 "register_operand" "")
7892 (neg:DI (match_operand:DI 1 "register_operand" "")))
7893 (clobber (reg:CC CC_REGNUM))]
7895 && s390_split_ok_p (operands[0], operands[1], DImode, 1)
7896 && reload_completed"
7897 [; Make a backup of op5 first
7898 (set (match_dup 4) (match_dup 5))
7899 ; Setting op2 here might clobber op5
7901 [(set (match_dup 2) (neg:SI (match_dup 3)))
7902 (clobber (reg:CC CC_REGNUM))])
7904 [(set (reg:CCAP CC_REGNUM)
7905 (compare:CCAP (neg:SI (match_dup 4)) (const_int 0)))
7906 (set (match_dup 4) (neg:SI (match_dup 4)))])
7908 (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
7910 (label_ref (match_dup 6))))
7912 [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
7913 (clobber (reg:CC CC_REGNUM))])
7915 "operands[2] = operand_subword (operands[0], 0, 0, DImode);
7916 operands[3] = operand_subword (operands[1], 0, 0, DImode);
7917 operands[4] = operand_subword (operands[0], 1, 0, DImode);
7918 operands[5] = operand_subword (operands[1], 1, 0, DImode);
7919 operands[6] = gen_label_rtx ();")
7922 ; neg(df|sf)2 instruction pattern(s).
7925 (define_expand "neg<mode>2"
7927 [(set (match_operand:BFP 0 "register_operand" "=f")
7928 (neg:BFP (match_operand:BFP 1 "register_operand" "f")))
7929 (clobber (reg:CC CC_REGNUM))])]
7933 ; lcxbr, lcdbr, lcebr
7934 (define_insn "*neg<mode>2_cc"
7935 [(set (reg CC_REGNUM)
7936 (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f"))
7937 (match_operand:BFP 2 "const0_operand" "")))
7938 (set (match_operand:BFP 0 "register_operand" "=f")
7939 (neg:BFP (match_dup 1)))]
7940 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7942 [(set_attr "op_type" "RRE")
7943 (set_attr "type" "fsimp<mode>")])
7945 ; lcxbr, lcdbr, lcebr
7946 (define_insn "*neg<mode>2_cconly"
7947 [(set (reg CC_REGNUM)
7948 (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f"))
7949 (match_operand:BFP 2 "const0_operand" "")))
7950 (clobber (match_scratch:BFP 0 "=f"))]
7951 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
7953 [(set_attr "op_type" "RRE")
7954 (set_attr "type" "fsimp<mode>")])
7957 (define_insn "*neg<mode>2_nocc"
7958 [(set (match_operand:FP 0 "register_operand" "=f")
7959 (neg:FP (match_operand:FP 1 "register_operand" "<fT0>")))]
7962 [(set_attr "op_type" "RRE")
7963 (set_attr "type" "fsimp<mode>")])
7965 ; lcxbr, lcdbr, lcebr
7966 ; FIXME: wflcdb does not clobber cc
7967 (define_insn "*neg<mode>2"
7968 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
7969 (neg:BFP (match_operand:BFP 1 "register_operand" "f,<vf>")))
7970 (clobber (reg:CC CC_REGNUM))]
7975 [(set_attr "op_type" "RRE,VRR")
7976 (set_attr "cpu_facility" "*,vec")
7977 (set_attr "type" "fsimp<mode>,*")])
7981 ;;- Absolute value instructions.
7985 ; abs(di|si)2 instruction pattern(s).
7988 (define_insn "*absdi2_sign_cc"
7989 [(set (reg CC_REGNUM)
7990 (compare (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
7991 (match_operand:SI 1 "register_operand" "d") 0)
7992 (const_int 32)) (const_int 32)))
7994 (set (match_operand:DI 0 "register_operand" "=d")
7995 (abs:DI (sign_extend:DI (match_dup 1))))]
7996 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
7998 [(set_attr "op_type" "RRE")
7999 (set_attr "z10prop" "z10_c")])
8001 (define_insn "*absdi2_sign"
8002 [(set (match_operand:DI 0 "register_operand" "=d")
8003 (abs:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))))
8004 (clobber (reg:CC CC_REGNUM))]
8007 [(set_attr "op_type" "RRE")
8008 (set_attr "z10prop" "z10_c")])
8011 (define_insn "*abs<mode>2_cc"
8012 [(set (reg CC_REGNUM)
8013 (compare (abs:GPR (match_operand:DI 1 "register_operand" "d"))
8015 (set (match_operand:GPR 0 "register_operand" "=d")
8016 (abs:GPR (match_dup 1)))]
8017 "s390_match_ccmode (insn, CCAmode)"
8019 [(set_attr "op_type" "RR<E>")
8020 (set_attr "z10prop" "z10_c")])
8023 (define_insn "*abs<mode>2_cconly"
8024 [(set (reg CC_REGNUM)
8025 (compare (abs:GPR (match_operand:GPR 1 "register_operand" "d"))
8027 (clobber (match_scratch:GPR 0 "=d"))]
8028 "s390_match_ccmode (insn, CCAmode)"
8030 [(set_attr "op_type" "RR<E>")
8031 (set_attr "z10prop" "z10_c")])
8034 (define_insn "abs<mode>2"
8035 [(set (match_operand:GPR 0 "register_operand" "=d")
8036 (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8037 (clobber (reg:CC CC_REGNUM))]
8040 [(set_attr "op_type" "RR<E>")
8041 (set_attr "z10prop" "z10_c")])
8044 ; abs(df|sf)2 instruction pattern(s).
8047 (define_expand "abs<mode>2"
8049 [(set (match_operand:BFP 0 "register_operand" "=f")
8050 (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8051 (clobber (reg:CC CC_REGNUM))])]
8055 ; lpxbr, lpdbr, lpebr
8056 (define_insn "*abs<mode>2_cc"
8057 [(set (reg CC_REGNUM)
8058 (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f"))
8059 (match_operand:BFP 2 "const0_operand" "")))
8060 (set (match_operand:BFP 0 "register_operand" "=f")
8061 (abs:BFP (match_dup 1)))]
8062 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8064 [(set_attr "op_type" "RRE")
8065 (set_attr "type" "fsimp<mode>")])
8067 ; lpxbr, lpdbr, lpebr
8068 (define_insn "*abs<mode>2_cconly"
8069 [(set (reg CC_REGNUM)
8070 (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f"))
8071 (match_operand:BFP 2 "const0_operand" "")))
8072 (clobber (match_scratch:BFP 0 "=f"))]
8073 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8075 [(set_attr "op_type" "RRE")
8076 (set_attr "type" "fsimp<mode>")])
8079 (define_insn "*abs<mode>2_nocc"
8080 [(set (match_operand:FP 0 "register_operand" "=f")
8081 (abs:FP (match_operand:FP 1 "register_operand" "<fT0>")))]
8084 [(set_attr "op_type" "RRE")
8085 (set_attr "type" "fsimp<mode>")])
8087 ; lpxbr, lpdbr, lpebr
8088 ; FIXME: wflpdb does not clobber cc
8089 (define_insn "*abs<mode>2"
8090 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
8091 (abs:BFP (match_operand:BFP 1 "register_operand" "f,<vf>")))
8092 (clobber (reg:CC CC_REGNUM))]
8097 [(set_attr "op_type" "RRE,VRR")
8098 (set_attr "cpu_facility" "*,vec")
8099 (set_attr "type" "fsimp<mode>,*")])
8103 ;;- Negated absolute value instructions
8110 (define_insn "*negabsdi2_sign_cc"
8111 [(set (reg CC_REGNUM)
8112 (compare (neg:DI (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI
8113 (match_operand:SI 1 "register_operand" "d") 0)
8114 (const_int 32)) (const_int 32))))
8116 (set (match_operand:DI 0 "register_operand" "=d")
8117 (neg:DI (abs:DI (sign_extend:DI (match_dup 1)))))]
8118 "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)"
8120 [(set_attr "op_type" "RRE")
8121 (set_attr "z10prop" "z10_c")])
8123 (define_insn "*negabsdi2_sign"
8124 [(set (match_operand:DI 0 "register_operand" "=d")
8125 (neg:DI (abs:DI (sign_extend:DI
8126 (match_operand:SI 1 "register_operand" "d")))))
8127 (clobber (reg:CC CC_REGNUM))]
8130 [(set_attr "op_type" "RRE")
8131 (set_attr "z10prop" "z10_c")])
8134 (define_insn "*negabs<mode>2_cc"
8135 [(set (reg CC_REGNUM)
8136 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8138 (set (match_operand:GPR 0 "register_operand" "=d")
8139 (neg:GPR (abs:GPR (match_dup 1))))]
8140 "s390_match_ccmode (insn, CCAmode)"
8142 [(set_attr "op_type" "RR<E>")
8143 (set_attr "z10prop" "z10_c")])
8146 (define_insn "*negabs<mode>2_cconly"
8147 [(set (reg CC_REGNUM)
8148 (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))
8150 (clobber (match_scratch:GPR 0 "=d"))]
8151 "s390_match_ccmode (insn, CCAmode)"
8153 [(set_attr "op_type" "RR<E>")
8154 (set_attr "z10prop" "z10_c")])
8157 (define_insn "*negabs<mode>2"
8158 [(set (match_operand:GPR 0 "register_operand" "=d")
8159 (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d"))))
8160 (clobber (reg:CC CC_REGNUM))]
8163 [(set_attr "op_type" "RR<E>")
8164 (set_attr "z10prop" "z10_c")])
8170 ; lnxbr, lndbr, lnebr
8171 (define_insn "*negabs<mode>2_cc"
8172 [(set (reg CC_REGNUM)
8173 (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8174 (match_operand:BFP 2 "const0_operand" "")))
8175 (set (match_operand:BFP 0 "register_operand" "=f")
8176 (neg:BFP (abs:BFP (match_dup 1))))]
8177 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8179 [(set_attr "op_type" "RRE")
8180 (set_attr "type" "fsimp<mode>")])
8182 ; lnxbr, lndbr, lnebr
8183 (define_insn "*negabs<mode>2_cconly"
8184 [(set (reg CC_REGNUM)
8185 (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f")))
8186 (match_operand:BFP 2 "const0_operand" "")))
8187 (clobber (match_scratch:BFP 0 "=f"))]
8188 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
8190 [(set_attr "op_type" "RRE")
8191 (set_attr "type" "fsimp<mode>")])
8194 (define_insn "*negabs<mode>2_nocc"
8195 [(set (match_operand:FP 0 "register_operand" "=f")
8196 (neg:FP (abs:FP (match_operand:BFP 1 "register_operand" "<fT0>"))))]
8199 [(set_attr "op_type" "RRE")
8200 (set_attr "type" "fsimp<mode>")])
8202 ; lnxbr, lndbr, lnebr
8203 ; FIXME: wflndb does not clobber cc
8204 (define_insn "*negabs<mode>2"
8205 [(set (match_operand:BFP 0 "register_operand" "=f,<vf>")
8206 (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f,<vf>"))))
8207 (clobber (reg:CC CC_REGNUM))]
8212 [(set_attr "op_type" "RRE,VRR")
8213 (set_attr "cpu_facility" "*,vec")
8214 (set_attr "type" "fsimp<mode>,*")])
8217 ;;- Square root instructions.
8221 ; sqrt(df|sf)2 instruction pattern(s).
8224 ; sqxbr, sqdbr, sqebr, sqdb, sqeb
8225 (define_insn "sqrt<mode>2"
8226 [(set (match_operand:BFP 0 "register_operand" "=f, f,<vf>")
8227 (sqrt:BFP (match_operand:BFP 1 "general_operand" "f,<Rf>,<vf>")))]
8233 [(set_attr "op_type" "RRE,RXE,VRR")
8234 (set_attr "type" "fsqrt<mode>")
8235 (set_attr "cpu_facility" "*,*,vec")])
8239 ;;- One complement instructions.
8243 ; one_cmpl(di|si|hi|qi)2 instruction pattern(s).
8246 (define_expand "one_cmpl<mode>2"
8248 [(set (match_operand:INT 0 "register_operand" "")
8249 (xor:INT (match_operand:INT 1 "register_operand" "")
8251 (clobber (reg:CC CC_REGNUM))])]
8257 ;; Find leftmost bit instructions.
8260 (define_expand "clzdi2"
8261 [(set (match_operand:DI 0 "register_operand" "=d")
8262 (clz:DI (match_operand:DI 1 "register_operand" "d")))]
8263 "TARGET_EXTIMM && TARGET_ZARCH"
8265 rtx insn, clz_equal;
8266 rtx wide_reg = gen_reg_rtx (TImode);
8267 rtx msb = gen_rtx_CONST_INT (DImode, (unsigned HOST_WIDE_INT) 1 << 63);
8269 clz_equal = gen_rtx_CLZ (DImode, operands[1]);
8271 emit_insn (gen_clztidi2 (wide_reg, operands[1], msb));
8273 insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg));
8274 set_unique_reg_note (insn, REG_EQUAL, clz_equal);
8279 (define_insn "clztidi2"
8280 [(set (match_operand:TI 0 "register_operand" "=d")
8284 (xor:DI (match_operand:DI 1 "register_operand" "d")
8285 (lshiftrt (match_operand:DI 2 "const_int_operand" "")
8286 (subreg:SI (clz:DI (match_dup 1)) 4))))
8289 (zero_extend:TI (clz:DI (match_dup 1)))))
8290 (clobber (reg:CC CC_REGNUM))]
8291 "(unsigned HOST_WIDE_INT) INTVAL (operands[2])
8292 == (unsigned HOST_WIDE_INT) 1 << 63
8293 && TARGET_EXTIMM && TARGET_ZARCH"
8295 [(set_attr "op_type" "RRE")])
8299 ;;- Rotate instructions.
8303 ; rotl(di|si)3 instruction pattern(s).
8307 (define_insn "rotl<mode>3"
8308 [(set (match_operand:GPR 0 "register_operand" "=d")
8309 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
8310 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
8313 [(set_attr "op_type" "RSE")
8314 (set_attr "atype" "reg")
8315 (set_attr "z10prop" "z10_super_E1")])
8318 (define_insn "*rotl<mode>3_and"
8319 [(set (match_operand:GPR 0 "register_operand" "=d")
8320 (rotate:GPR (match_operand:GPR 1 "register_operand" "d")
8321 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8322 (match_operand:SI 3 "const_int_operand" "n"))))]
8323 "TARGET_CPU_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8325 [(set_attr "op_type" "RSE")
8326 (set_attr "atype" "reg")
8327 (set_attr "z10prop" "z10_super_E1")])
8331 ;;- Shift instructions.
8335 ; (ashl|lshr)(di|si)3 instruction pattern(s).
8336 ; Left shifts and logical right shifts
8338 (define_expand "<shift><mode>3"
8339 [(set (match_operand:DSI 0 "register_operand" "")
8340 (SHIFT:DSI (match_operand:DSI 1 "register_operand" "")
8341 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))]
8346 (define_insn "*<shift>di3_31"
8347 [(set (match_operand:DI 0 "register_operand" "=d")
8348 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
8349 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))]
8352 [(set_attr "op_type" "RS")
8353 (set_attr "atype" "reg")
8354 (set_attr "z196prop" "z196_cracked")])
8356 ; sll, srl, sllg, srlg, sllk, srlk
8357 (define_insn "*<shift><mode>3"
8358 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8359 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8360 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")))]
8363 s<lr>l<g>\t%0,<1>%Y2
8364 s<lr>l<gk>\t%0,%1,%Y2"
8365 [(set_attr "op_type" "RS<E>,RSY")
8366 (set_attr "atype" "reg,reg")
8367 (set_attr "cpu_facility" "*,z196")
8368 (set_attr "z10prop" "z10_super_E1,*")])
8371 (define_insn "*<shift>di3_31_and"
8372 [(set (match_operand:DI 0 "register_operand" "=d")
8373 (SHIFT:DI (match_operand:DI 1 "register_operand" "0")
8374 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8375 (match_operand:SI 3 "const_int_operand" "n"))))]
8376 "!TARGET_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8378 [(set_attr "op_type" "RS")
8379 (set_attr "atype" "reg")])
8381 ; sll, srl, sllg, srlg, sllk, srlk
8382 (define_insn "*<shift><mode>3_and"
8383 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8384 (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8385 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8386 (match_operand:SI 3 "const_int_operand" "n,n"))))]
8387 "(INTVAL (operands[3]) & 63) == 63"
8389 s<lr>l<g>\t%0,<1>%Y2
8390 s<lr>l<gk>\t%0,%1,%Y2"
8391 [(set_attr "op_type" "RS<E>,RSY")
8392 (set_attr "atype" "reg,reg")
8393 (set_attr "cpu_facility" "*,z196")
8394 (set_attr "z10prop" "z10_super_E1,*")])
8397 ; ashr(di|si)3 instruction pattern(s).
8398 ; Arithmetic right shifts
8400 (define_expand "ashr<mode>3"
8402 [(set (match_operand:DSI 0 "register_operand" "")
8403 (ashiftrt:DSI (match_operand:DSI 1 "register_operand" "")
8404 (match_operand:SI 2 "shift_count_or_setmem_operand" "")))
8405 (clobber (reg:CC CC_REGNUM))])]
8409 (define_insn "*ashrdi3_cc_31"
8410 [(set (reg CC_REGNUM)
8411 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8412 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
8414 (set (match_operand:DI 0 "register_operand" "=d")
8415 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8416 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)"
8418 [(set_attr "op_type" "RS")
8419 (set_attr "atype" "reg")])
8421 (define_insn "*ashrdi3_cconly_31"
8422 [(set (reg CC_REGNUM)
8423 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8424 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y"))
8426 (clobber (match_scratch:DI 0 "=d"))]
8427 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)"
8429 [(set_attr "op_type" "RS")
8430 (set_attr "atype" "reg")])
8432 (define_insn "*ashrdi3_31"
8433 [(set (match_operand:DI 0 "register_operand" "=d")
8434 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8435 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")))
8436 (clobber (reg:CC CC_REGNUM))]
8439 [(set_attr "op_type" "RS")
8440 (set_attr "atype" "reg")])
8443 (define_insn "*ashr<mode>3_cc"
8444 [(set (reg CC_REGNUM)
8445 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8446 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y"))
8448 (set (match_operand:GPR 0 "register_operand" "=d,d")
8449 (ashiftrt:GPR (match_dup 1) (match_dup 2)))]
8450 "s390_match_ccmode(insn, CCSmode)"
8454 [(set_attr "op_type" "RS<E>,RSY")
8455 (set_attr "atype" "reg,reg")
8456 (set_attr "cpu_facility" "*,z196")
8457 (set_attr "z10prop" "z10_super_E1,*")])
8460 (define_insn "*ashr<mode>3_cconly"
8461 [(set (reg CC_REGNUM)
8462 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8463 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y"))
8465 (clobber (match_scratch:GPR 0 "=d,d"))]
8466 "s390_match_ccmode(insn, CCSmode)"
8470 [(set_attr "op_type" "RS<E>,RSY")
8471 (set_attr "atype" "reg,reg")
8472 (set_attr "cpu_facility" "*,z196")
8473 (set_attr "z10prop" "z10_super_E1,*")])
8476 (define_insn "*ashr<mode>3"
8477 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8478 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8479 (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")))
8480 (clobber (reg:CC CC_REGNUM))]
8485 [(set_attr "op_type" "RS<E>,RSY")
8486 (set_attr "atype" "reg,reg")
8487 (set_attr "cpu_facility" "*,z196")
8488 (set_attr "z10prop" "z10_super_E1,*")])
8491 ; shift pattern with implicit ANDs
8493 (define_insn "*ashrdi3_cc_31_and"
8494 [(set (reg CC_REGNUM)
8495 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8496 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8497 (match_operand:SI 3 "const_int_operand" "n")))
8499 (set (match_operand:DI 0 "register_operand" "=d")
8500 (ashiftrt:DI (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
8501 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)
8502 && (INTVAL (operands[3]) & 63) == 63"
8504 [(set_attr "op_type" "RS")
8505 (set_attr "atype" "reg")])
8507 (define_insn "*ashrdi3_cconly_31_and"
8508 [(set (reg CC_REGNUM)
8509 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8510 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8511 (match_operand:SI 3 "const_int_operand" "n")))
8513 (clobber (match_scratch:DI 0 "=d"))]
8514 "!TARGET_ZARCH && s390_match_ccmode(insn, CCSmode)
8515 && (INTVAL (operands[3]) & 63) == 63"
8517 [(set_attr "op_type" "RS")
8518 (set_attr "atype" "reg")])
8520 (define_insn "*ashrdi3_31_and"
8521 [(set (match_operand:DI 0 "register_operand" "=d")
8522 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
8523 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y")
8524 (match_operand:SI 3 "const_int_operand" "n"))))
8525 (clobber (reg:CC CC_REGNUM))]
8526 "!TARGET_ZARCH && (INTVAL (operands[3]) & 63) == 63"
8528 [(set_attr "op_type" "RS")
8529 (set_attr "atype" "reg")])
8532 (define_insn "*ashr<mode>3_cc_and"
8533 [(set (reg CC_REGNUM)
8534 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8535 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8536 (match_operand:SI 3 "const_int_operand" "n,n")))
8538 (set (match_operand:GPR 0 "register_operand" "=d,d")
8539 (ashiftrt:GPR (match_dup 1) (and:SI (match_dup 2) (match_dup 3))))]
8540 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
8544 [(set_attr "op_type" "RS<E>,RSY")
8545 (set_attr "atype" "reg,reg")
8546 (set_attr "cpu_facility" "*,z196")
8547 (set_attr "z10prop" "z10_super_E1,*")])
8550 (define_insn "*ashr<mode>3_cconly_and"
8551 [(set (reg CC_REGNUM)
8552 (compare (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8553 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8554 (match_operand:SI 3 "const_int_operand" "n,n")))
8556 (clobber (match_scratch:GPR 0 "=d,d"))]
8557 "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63"
8561 [(set_attr "op_type" "RS<E>,RSY")
8562 (set_attr "atype" "reg,reg")
8563 (set_attr "cpu_facility" "*,z196")
8564 (set_attr "z10prop" "z10_super_E1,*")])
8567 (define_insn "*ashr<mode>3_and"
8568 [(set (match_operand:GPR 0 "register_operand" "=d,d")
8569 (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>,d")
8570 (and:SI (match_operand:SI 2 "shift_count_or_setmem_operand" "Y,Y")
8571 (match_operand:SI 3 "const_int_operand" "n,n"))))
8572 (clobber (reg:CC CC_REGNUM))]
8573 "(INTVAL (operands[3]) & 63) == 63"
8577 [(set_attr "op_type" "RS<E>,RSY")
8578 (set_attr "atype" "reg,reg")
8579 (set_attr "cpu_facility" "*,z196")
8580 (set_attr "z10prop" "z10_super_E1,*")])
8584 ;; Branch instruction patterns.
8587 (define_expand "cbranch<mode>4"
8589 (if_then_else (match_operator 0 "comparison_operator"
8590 [(match_operand:GPR 1 "register_operand" "")
8591 (match_operand:GPR 2 "general_operand" "")])
8592 (label_ref (match_operand 3 "" ""))
8595 "s390_emit_jump (operands[3],
8596 s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2]));
8599 (define_expand "cbranch<mode>4"
8601 (if_then_else (match_operator 0 "comparison_operator"
8602 [(match_operand:FP 1 "register_operand" "")
8603 (match_operand:FP 2 "general_operand" "")])
8604 (label_ref (match_operand 3 "" ""))
8607 "s390_emit_jump (operands[3],
8608 s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2]));
8611 (define_expand "cbranchcc4"
8613 (if_then_else (match_operator 0 "s390_comparison"
8614 [(match_operand 1 "cc_reg_operand" "")
8615 (match_operand 2 "const_int_operand" "")])
8616 (label_ref (match_operand 3 "" ""))
8623 ;;- Conditional jump instructions.
8626 (define_insn "*cjump_64"
8629 (match_operator 1 "s390_comparison" [(reg CC_REGNUM)
8630 (match_operand 2 "const_int_operand" "")])
8631 (label_ref (match_operand 0 "" ""))
8635 if (get_attr_length (insn) == 4)
8638 return "jg%C1\t%l0";
8640 [(set_attr "op_type" "RI")
8641 (set_attr "type" "branch")
8642 (set (attr "length")
8643 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8644 (const_int 4) (const_int 6)))])
8646 (define_insn "*cjump_31"
8649 (match_operator 1 "s390_comparison" [(reg CC_REGNUM)
8650 (match_operand 2 "const_int_operand" "")])
8651 (label_ref (match_operand 0 "" ""))
8655 gcc_assert (get_attr_length (insn) == 4);
8658 [(set_attr "op_type" "RI")
8659 (set_attr "type" "branch")
8660 (set (attr "length")
8661 (if_then_else (not (match_test "flag_pic"))
8662 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8663 (const_int 4) (const_int 6))
8664 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8665 (const_int 4) (const_int 8))))])
8667 (define_insn "*cjump_long"
8670 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8671 (match_operand 0 "address_operand" "ZQZR")
8675 if (get_attr_op_type (insn) == OP_TYPE_RR)
8680 [(set (attr "op_type")
8681 (if_then_else (match_operand 0 "register_operand" "")
8682 (const_string "RR") (const_string "RX")))
8683 (set_attr "type" "branch")
8684 (set_attr "atype" "agen")])
8686 ;; A conditional return instruction.
8687 (define_insn "*c<code>"
8690 (match_operator 0 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8693 "s390_can_use_<code>_insn ()"
8695 [(set_attr "op_type" "RR")
8696 (set_attr "type" "jsr")
8697 (set_attr "atype" "agen")])
8700 ;;- Negated conditional jump instructions.
8703 (define_insn "*icjump_64"
8706 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8708 (label_ref (match_operand 0 "" ""))))]
8711 if (get_attr_length (insn) == 4)
8714 return "jg%D1\t%l0";
8716 [(set_attr "op_type" "RI")
8717 (set_attr "type" "branch")
8718 (set (attr "length")
8719 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8720 (const_int 4) (const_int 6)))])
8722 (define_insn "*icjump_31"
8725 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8727 (label_ref (match_operand 0 "" ""))))]
8730 gcc_assert (get_attr_length (insn) == 4);
8733 [(set_attr "op_type" "RI")
8734 (set_attr "type" "branch")
8735 (set (attr "length")
8736 (if_then_else (not (match_test "flag_pic"))
8737 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8738 (const_int 4) (const_int 6))
8739 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8740 (const_int 4) (const_int 8))))])
8742 (define_insn "*icjump_long"
8745 (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
8747 (match_operand 0 "address_operand" "ZQZR")))]
8750 if (get_attr_op_type (insn) == OP_TYPE_RR)
8755 [(set (attr "op_type")
8756 (if_then_else (match_operand 0 "register_operand" "")
8757 (const_string "RR") (const_string "RX")))
8758 (set_attr "type" "branch")
8759 (set_attr "atype" "agen")])
8762 ;;- Trap instructions.
8766 [(trap_if (const_int 1) (const_int 0))]
8769 [(set_attr "op_type" "RI")
8770 (set_attr "type" "branch")])
8772 (define_expand "ctrap<mode>4"
8773 [(trap_if (match_operator 0 "comparison_operator"
8774 [(match_operand:GPR 1 "register_operand" "")
8775 (match_operand:GPR 2 "general_operand" "")])
8776 (match_operand 3 "const0_operand" ""))]
8779 rtx cond = s390_emit_compare (GET_CODE (operands[0]),
8780 operands[1], operands[2]);
8781 emit_insn (gen_condtrap (cond, XEXP (cond, 0)));
8785 (define_expand "ctrap<mode>4"
8786 [(trap_if (match_operator 0 "comparison_operator"
8787 [(match_operand:FP 1 "register_operand" "")
8788 (match_operand:FP 2 "general_operand" "")])
8789 (match_operand 3 "const0_operand" ""))]
8792 rtx cond = s390_emit_compare (GET_CODE (operands[0]),
8793 operands[1], operands[2]);
8794 emit_insn (gen_condtrap (cond, XEXP (cond, 0)));
8798 (define_insn "condtrap"
8799 [(trap_if (match_operator 0 "s390_comparison"
8800 [(match_operand 1 "cc_reg_operand" "c")
8805 [(set_attr "op_type" "RI")
8806 (set_attr "type" "branch")])
8808 ; crt, cgrt, cit, cgit
8809 (define_insn "*cmp_and_trap_signed_int<mode>"
8810 [(trap_if (match_operator 0 "s390_signed_integer_comparison"
8811 [(match_operand:GPR 1 "register_operand" "d,d")
8812 (match_operand:GPR 2 "nonmemory_operand" "d,K")])
8818 [(set_attr "op_type" "RRF,RIE")
8819 (set_attr "type" "branch")
8820 (set_attr "z10prop" "z10_super_c,z10_super")])
8822 ; clrt, clgrt, clfit, clgit, clt, clgt
8823 (define_insn "*cmp_and_trap_unsigned_int<mode>"
8824 [(trap_if (match_operator 0 "s390_unsigned_integer_comparison"
8825 [(match_operand:GPR 1 "register_operand" "d,d, d")
8826 (match_operand:GPR 2 "general_operand" "d,D,RT")])
8833 [(set_attr "op_type" "RRF,RIE,RSY")
8834 (set_attr "type" "branch")
8835 (set_attr "z10prop" "z10_super_c,z10_super,*")
8836 (set_attr "cpu_facility" "z10,z10,zEC12")])
8839 (define_insn "*load_and_trap<mode>"
8840 [(trap_if (eq (match_operand:GPR 0 "memory_operand" "RT")
8843 (set (match_operand:GPR 1 "register_operand" "=d")
8847 [(set_attr "op_type" "RXY")])
8851 ;;- Loop instructions.
8853 ;; This is all complicated by the fact that since this is a jump insn
8854 ;; we must handle our own output reloads.
8858 ; This splitter will be matched by combine and has to add the 2 moves
8859 ; necessary to load the compare and the increment values into a
8860 ; register pair as needed by brxle.
8862 (define_insn_and_split "*brx_stage1_<GPR:mode>"
8865 (match_operator 6 "s390_brx_operator"
8866 [(plus:GPR (match_operand:GPR 1 "register_operand" "")
8867 (match_operand:GPR 2 "general_operand" ""))
8868 (match_operand:GPR 3 "register_operand" "")])
8869 (label_ref (match_operand 0 "" ""))
8871 (set (match_operand:GPR 4 "nonimmediate_operand" "")
8872 (plus:GPR (match_dup 1) (match_dup 2)))
8873 (clobber (match_scratch:GPR 5 ""))]
8876 "!reload_completed && !reload_in_progress"
8877 [(set (match_dup 7) (match_dup 2)) ; the increment
8878 (set (match_dup 8) (match_dup 3)) ; the comparison value
8879 (parallel [(set (pc)
8882 [(plus:GPR (match_dup 1) (match_dup 7))
8884 (label_ref (match_dup 0))
8887 (plus:GPR (match_dup 1) (match_dup 7)))
8888 (clobber (match_dup 5))
8889 (clobber (reg:CC CC_REGNUM))])]
8891 rtx dreg = gen_reg_rtx (word_mode == DImode ? TImode : DImode);
8892 operands[7] = gen_lowpart (<GPR:MODE>mode,
8893 gen_highpart (word_mode, dreg));
8894 operands[8] = gen_lowpart (<GPR:MODE>mode,
8895 gen_lowpart (word_mode, dreg));
8900 (define_insn_and_split "*brxg_64bit"
8903 (match_operator 5 "s390_brx_operator"
8904 [(plus:DI (match_operand:DI 1 "register_operand" "d,d,d")
8905 (subreg:DI (match_operand:TI 2 "register_operand" "d,d,d") 0))
8906 (subreg:DI (match_dup 2) 8)])
8907 (label_ref (match_operand 0 "" ""))
8909 (set (match_operand:DI 3 "nonimmediate_operand" "=1,?X,?X")
8910 (plus:DI (match_dup 1)
8911 (subreg:DI (match_dup 2) 0)))
8912 (clobber (match_scratch:DI 4 "=X,&1,&?d"))
8913 (clobber (reg:CC CC_REGNUM))]
8916 if (which_alternative != 0)
8918 else if (get_attr_length (insn) == 6)
8919 return "brx%E5g\t%1,%2,%l0";
8921 return "agr\t%1,%2\;cgr\t%1,%M2\;jg%C5\t%l0";
8923 "&& reload_completed
8924 && (!REG_P (operands[3])
8925 || !rtx_equal_p (operands[1], operands[3]))"
8926 [(set (match_dup 4) (match_dup 1))
8927 (parallel [(set (match_dup 4) (plus:DI (match_dup 4) (subreg:DI (match_dup 2) 0)))
8928 (clobber (reg:CC CC_REGNUM))])
8929 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:DI (match_dup 2) 8)))
8930 (set (match_dup 3) (match_dup 4))
8931 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
8932 (label_ref (match_dup 0))
8935 [(set_attr "op_type" "RIE")
8936 (set_attr "type" "branch")
8937 (set (attr "length")
8938 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8939 (const_int 6) (const_int 16)))])
8943 (define_insn_and_split "*brx_64bit"
8946 (match_operator 5 "s390_brx_operator"
8947 [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d")
8948 (subreg:SI (match_operand:TI 2 "register_operand" "d,d,d") 4))
8949 (subreg:SI (match_dup 2) 12)])
8950 (label_ref (match_operand 0 "" ""))
8952 (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X")
8953 (plus:SI (match_dup 1)
8954 (subreg:SI (match_dup 2) 4)))
8955 (clobber (match_scratch:SI 4 "=X,&1,&?d"))
8956 (clobber (reg:CC CC_REGNUM))]
8959 if (which_alternative != 0)
8961 else if (get_attr_length (insn) == 6)
8962 return "brx%C5\t%1,%2,%l0";
8964 return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0";
8966 "&& reload_completed
8967 && (!REG_P (operands[3])
8968 || !rtx_equal_p (operands[1], operands[3]))"
8969 [(set (match_dup 4) (match_dup 1))
8970 (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 4)))
8971 (clobber (reg:CC CC_REGNUM))])
8972 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 12)))
8973 (set (match_dup 3) (match_dup 4))
8974 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
8975 (label_ref (match_dup 0))
8978 [(set_attr "op_type" "RSI")
8979 (set_attr "type" "branch")
8980 (set (attr "length")
8981 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
8982 (const_int 6) (const_int 14)))])
8986 (define_insn_and_split "*brx_31bit"
8989 (match_operator 5 "s390_brx_operator"
8990 [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d")
8991 (subreg:SI (match_operand:DI 2 "register_operand" "d,d,d") 0))
8992 (subreg:SI (match_dup 2) 4)])
8993 (label_ref (match_operand 0 "" ""))
8995 (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X")
8996 (plus:SI (match_dup 1)
8997 (subreg:SI (match_dup 2) 0)))
8998 (clobber (match_scratch:SI 4 "=X,&1,&?d"))
8999 (clobber (reg:CC CC_REGNUM))]
9000 "!TARGET_ZARCH && TARGET_CPU_ZARCH"
9002 if (which_alternative != 0)
9004 else if (get_attr_length (insn) == 6)
9005 return "brx%C5\t%1,%2,%l0";
9007 return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0";
9009 "&& reload_completed
9010 && (!REG_P (operands[3])
9011 || !rtx_equal_p (operands[1], operands[3]))"
9012 [(set (match_dup 4) (match_dup 1))
9013 (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 0)))
9014 (clobber (reg:CC CC_REGNUM))])
9015 (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 4)))
9016 (set (match_dup 3) (match_dup 4))
9017 (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)])
9018 (label_ref (match_dup 0))
9021 [(set_attr "op_type" "RSI")
9022 (set_attr "type" "branch")
9023 (set (attr "length")
9024 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9025 (const_int 6) (const_int 14)))])
9030 (define_expand "doloop_end"
9031 [(use (match_operand 0 "" "")) ; loop pseudo
9032 (use (match_operand 1 "" ""))] ; label
9035 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
9036 emit_jump_insn (gen_doloop_si31 (operands[1], operands[0], operands[0]));
9037 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
9038 emit_jump_insn (gen_doloop_si64 (operands[1], operands[0], operands[0]));
9039 else if (GET_MODE (operands[0]) == DImode && TARGET_ZARCH)
9040 emit_jump_insn (gen_doloop_di (operands[1], operands[0], operands[0]));
9047 (define_insn_and_split "doloop_si64"
9050 (ne (match_operand:SI 1 "register_operand" "d,d,d")
9052 (label_ref (match_operand 0 "" ""))
9054 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?X,?X")
9055 (plus:SI (match_dup 1) (const_int -1)))
9056 (clobber (match_scratch:SI 3 "=X,&1,&?d"))
9057 (clobber (reg:CC CC_REGNUM))]
9060 if (which_alternative != 0)
9062 else if (get_attr_length (insn) == 4)
9063 return "brct\t%1,%l0";
9065 return "ahi\t%1,-1\;jgne\t%l0";
9067 "&& reload_completed
9068 && (! REG_P (operands[2])
9069 || ! rtx_equal_p (operands[1], operands[2]))"
9070 [(set (match_dup 3) (match_dup 1))
9071 (parallel [(set (reg:CCAN CC_REGNUM)
9072 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
9074 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
9075 (set (match_dup 2) (match_dup 3))
9076 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9077 (label_ref (match_dup 0))
9080 [(set_attr "op_type" "RI")
9081 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9082 ; hurt us in the (rare) case of ahi.
9083 (set_attr "z10prop" "z10_super_E1")
9084 (set_attr "type" "branch")
9085 (set (attr "length")
9086 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9087 (const_int 4) (const_int 10)))])
9089 (define_insn_and_split "doloop_si31"
9092 (ne (match_operand:SI 1 "register_operand" "d,d,d")
9094 (label_ref (match_operand 0 "" ""))
9096 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?X,?X")
9097 (plus:SI (match_dup 1) (const_int -1)))
9098 (clobber (match_scratch:SI 3 "=X,&1,&?d"))
9099 (clobber (reg:CC CC_REGNUM))]
9102 if (which_alternative != 0)
9104 else if (get_attr_length (insn) == 4)
9105 return "brct\t%1,%l0";
9109 "&& reload_completed
9110 && (! REG_P (operands[2])
9111 || ! rtx_equal_p (operands[1], operands[2]))"
9112 [(set (match_dup 3) (match_dup 1))
9113 (parallel [(set (reg:CCAN CC_REGNUM)
9114 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
9116 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
9117 (set (match_dup 2) (match_dup 3))
9118 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9119 (label_ref (match_dup 0))
9122 [(set_attr "op_type" "RI")
9123 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9124 ; hurt us in the (rare) case of ahi.
9125 (set_attr "z10prop" "z10_super_E1")
9126 (set_attr "type" "branch")
9127 (set (attr "length")
9128 (if_then_else (not (match_test "flag_pic"))
9129 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9130 (const_int 4) (const_int 6))
9131 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9132 (const_int 4) (const_int 8))))])
9134 (define_insn "*doloop_si_long"
9137 (ne (match_operand:SI 1 "register_operand" "d")
9139 (match_operand 0 "address_operand" "ZQZR")
9141 (set (match_operand:SI 2 "register_operand" "=1")
9142 (plus:SI (match_dup 1) (const_int -1)))
9143 (clobber (match_scratch:SI 3 "=X"))
9144 (clobber (reg:CC CC_REGNUM))]
9147 if (get_attr_op_type (insn) == OP_TYPE_RR)
9148 return "bctr\t%1,%0";
9150 return "bct\t%1,%a0";
9152 [(set (attr "op_type")
9153 (if_then_else (match_operand 0 "register_operand" "")
9154 (const_string "RR") (const_string "RX")))
9155 (set_attr "type" "branch")
9156 (set_attr "atype" "agen")
9157 (set_attr "z10prop" "z10_c")
9158 (set_attr "z196prop" "z196_cracked")])
9160 (define_insn_and_split "doloop_di"
9163 (ne (match_operand:DI 1 "register_operand" "d,d,d")
9165 (label_ref (match_operand 0 "" ""))
9167 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?X,?X")
9168 (plus:DI (match_dup 1) (const_int -1)))
9169 (clobber (match_scratch:DI 3 "=X,&1,&?d"))
9170 (clobber (reg:CC CC_REGNUM))]
9173 if (which_alternative != 0)
9175 else if (get_attr_length (insn) == 4)
9176 return "brctg\t%1,%l0";
9178 return "aghi\t%1,-1\;jgne\t%l0";
9180 "&& reload_completed
9181 && (! REG_P (operands[2])
9182 || ! rtx_equal_p (operands[1], operands[2]))"
9183 [(set (match_dup 3) (match_dup 1))
9184 (parallel [(set (reg:CCAN CC_REGNUM)
9185 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
9187 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
9188 (set (match_dup 2) (match_dup 3))
9189 (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0))
9190 (label_ref (match_dup 0))
9193 [(set_attr "op_type" "RI")
9194 ; Strictly speaking, the z10 properties are valid for brct only, however, it does not
9195 ; hurt us in the (rare) case of ahi.
9196 (set_attr "z10prop" "z10_super_E1")
9197 (set_attr "type" "branch")
9198 (set (attr "length")
9199 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9200 (const_int 4) (const_int 10)))])
9203 ;;- Unconditional jump instructions.
9207 ; jump instruction pattern(s).
9210 (define_expand "jump"
9211 [(match_operand 0 "" "")]
9213 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
9215 (define_insn "*jump64"
9216 [(set (pc) (label_ref (match_operand 0 "" "")))]
9219 if (get_attr_length (insn) == 4)
9224 [(set_attr "op_type" "RI")
9225 (set_attr "type" "branch")
9226 (set (attr "length")
9227 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9228 (const_int 4) (const_int 6)))])
9230 (define_insn "*jump31"
9231 [(set (pc) (label_ref (match_operand 0 "" "")))]
9234 gcc_assert (get_attr_length (insn) == 4);
9237 [(set_attr "op_type" "RI")
9238 (set_attr "type" "branch")
9239 (set (attr "length")
9240 (if_then_else (not (match_test "flag_pic"))
9241 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9242 (const_int 4) (const_int 6))
9243 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
9244 (const_int 4) (const_int 8))))])
9247 ; indirect-jump instruction pattern(s).
9250 (define_insn "indirect_jump"
9251 [(set (pc) (match_operand 0 "address_operand" "ZQZR"))]
9254 if (get_attr_op_type (insn) == OP_TYPE_RR)
9259 [(set (attr "op_type")
9260 (if_then_else (match_operand 0 "register_operand" "")
9261 (const_string "RR") (const_string "RX")))
9262 (set_attr "type" "branch")
9263 (set_attr "atype" "agen")])
9266 ; casesi instruction pattern(s).
9269 (define_insn "casesi_jump"
9270 [(set (pc) (match_operand 0 "address_operand" "ZQZR"))
9271 (use (label_ref (match_operand 1 "" "")))]
9274 if (get_attr_op_type (insn) == OP_TYPE_RR)
9279 [(set (attr "op_type")
9280 (if_then_else (match_operand 0 "register_operand" "")
9281 (const_string "RR") (const_string "RX")))
9282 (set_attr "type" "branch")
9283 (set_attr "atype" "agen")])
9285 (define_expand "casesi"
9286 [(match_operand:SI 0 "general_operand" "")
9287 (match_operand:SI 1 "general_operand" "")
9288 (match_operand:SI 2 "general_operand" "")
9289 (label_ref (match_operand 3 "" ""))
9290 (label_ref (match_operand 4 "" ""))]
9293 rtx index = gen_reg_rtx (SImode);
9294 rtx base = gen_reg_rtx (Pmode);
9295 rtx target = gen_reg_rtx (Pmode);
9297 emit_move_insn (index, operands[0]);
9298 emit_insn (gen_subsi3 (index, index, operands[1]));
9299 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
9302 if (Pmode != SImode)
9303 index = convert_to_mode (Pmode, index, 1);
9304 if (GET_CODE (index) != REG)
9305 index = copy_to_mode_reg (Pmode, index);
9308 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
9310 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
9312 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
9314 index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index));
9315 emit_move_insn (target, index);
9318 target = gen_rtx_PLUS (Pmode, base, target);
9319 emit_jump_insn (gen_casesi_jump (target, operands[3]));
9326 ;;- Jump to subroutine.
9331 ; untyped call instruction pattern(s).
9334 ;; Call subroutine returning any type.
9335 (define_expand "untyped_call"
9336 [(parallel [(call (match_operand 0 "" "")
9338 (match_operand 1 "" "")
9339 (match_operand 2 "" "")])]
9344 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
9346 for (i = 0; i < XVECLEN (operands[2], 0); i++)
9348 rtx set = XVECEXP (operands[2], 0, i);
9349 emit_move_insn (SET_DEST (set), SET_SRC (set));
9352 /* The optimizer does not know that the call sets the function value
9353 registers we stored in the result block. We avoid problems by
9354 claiming that all hard registers are used and clobbered at this
9356 emit_insn (gen_blockage ());
9361 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
9362 ;; all of memory. This blocks insns from being moved across this point.
9364 (define_insn "blockage"
9365 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
9368 [(set_attr "type" "none")
9369 (set_attr "length" "0")])
9375 (define_expand "sibcall"
9376 [(call (match_operand 0 "" "")
9377 (match_operand 1 "" ""))]
9380 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
9384 (define_insn "*sibcall_br"
9385 [(call (mem:QI (reg SIBCALL_REGNUM))
9386 (match_operand 0 "const_int_operand" "n"))]
9387 "SIBLING_CALL_P (insn)
9388 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
9390 [(set_attr "op_type" "RR")
9391 (set_attr "type" "branch")
9392 (set_attr "atype" "agen")])
9394 (define_insn "*sibcall_brc"
9395 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9396 (match_operand 1 "const_int_operand" "n"))]
9397 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
9399 [(set_attr "op_type" "RI")
9400 (set_attr "type" "branch")])
9402 (define_insn "*sibcall_brcl"
9403 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9404 (match_operand 1 "const_int_operand" "n"))]
9405 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
9407 [(set_attr "op_type" "RIL")
9408 (set_attr "type" "branch")])
9411 ; sibcall_value patterns
9414 (define_expand "sibcall_value"
9415 [(set (match_operand 0 "" "")
9416 (call (match_operand 1 "" "")
9417 (match_operand 2 "" "")))]
9420 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
9424 (define_insn "*sibcall_value_br"
9425 [(set (match_operand 0 "" "")
9426 (call (mem:QI (reg SIBCALL_REGNUM))
9427 (match_operand 1 "const_int_operand" "n")))]
9428 "SIBLING_CALL_P (insn)
9429 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
9431 [(set_attr "op_type" "RR")
9432 (set_attr "type" "branch")
9433 (set_attr "atype" "agen")])
9435 (define_insn "*sibcall_value_brc"
9436 [(set (match_operand 0 "" "")
9437 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9438 (match_operand 2 "const_int_operand" "n")))]
9439 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
9441 [(set_attr "op_type" "RI")
9442 (set_attr "type" "branch")])
9444 (define_insn "*sibcall_value_brcl"
9445 [(set (match_operand 0 "" "")
9446 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9447 (match_operand 2 "const_int_operand" "n")))]
9448 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
9450 [(set_attr "op_type" "RIL")
9451 (set_attr "type" "branch")])
9455 ; call instruction pattern(s).
9458 (define_expand "call"
9459 [(call (match_operand 0 "" "")
9460 (match_operand 1 "" ""))
9461 (use (match_operand 2 "" ""))]
9464 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
9465 gen_rtx_REG (Pmode, RETURN_REGNUM));
9469 (define_insn "*bras"
9470 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9471 (match_operand 1 "const_int_operand" "n"))
9472 (clobber (match_operand 2 "register_operand" "=r"))]
9473 "!SIBLING_CALL_P (insn)
9474 && TARGET_SMALL_EXEC
9475 && GET_MODE (operands[2]) == Pmode"
9477 [(set_attr "op_type" "RI")
9478 (set_attr "type" "jsr")
9479 (set_attr "z196prop" "z196_cracked")])
9481 (define_insn "*brasl"
9482 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
9483 (match_operand 1 "const_int_operand" "n"))
9484 (clobber (match_operand 2 "register_operand" "=r"))]
9485 "!SIBLING_CALL_P (insn)
9487 && GET_MODE (operands[2]) == Pmode"
9489 [(set_attr "op_type" "RIL")
9490 (set_attr "type" "jsr")
9491 (set_attr "z196prop" "z196_cracked")])
9493 (define_insn "*basr"
9494 [(call (mem:QI (match_operand 0 "address_operand" "ZQZR"))
9495 (match_operand 1 "const_int_operand" "n"))
9496 (clobber (match_operand 2 "register_operand" "=r"))]
9497 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
9499 if (get_attr_op_type (insn) == OP_TYPE_RR)
9500 return "basr\t%2,%0";
9502 return "bas\t%2,%a0";
9504 [(set (attr "op_type")
9505 (if_then_else (match_operand 0 "register_operand" "")
9506 (const_string "RR") (const_string "RX")))
9507 (set_attr "type" "jsr")
9508 (set_attr "atype" "agen")
9509 (set_attr "z196prop" "z196_cracked")])
9512 ; call_value instruction pattern(s).
9515 (define_expand "call_value"
9516 [(set (match_operand 0 "" "")
9517 (call (match_operand 1 "" "")
9518 (match_operand 2 "" "")))
9519 (use (match_operand 3 "" ""))]
9522 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
9523 gen_rtx_REG (Pmode, RETURN_REGNUM));
9527 (define_insn "*bras_r"
9528 [(set (match_operand 0 "" "")
9529 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9530 (match_operand:SI 2 "const_int_operand" "n")))
9531 (clobber (match_operand 3 "register_operand" "=r"))]
9532 "!SIBLING_CALL_P (insn)
9533 && TARGET_SMALL_EXEC
9534 && GET_MODE (operands[3]) == Pmode"
9536 [(set_attr "op_type" "RI")
9537 (set_attr "type" "jsr")
9538 (set_attr "z196prop" "z196_cracked")])
9540 (define_insn "*brasl_r"
9541 [(set (match_operand 0 "" "")
9542 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9543 (match_operand 2 "const_int_operand" "n")))
9544 (clobber (match_operand 3 "register_operand" "=r"))]
9545 "!SIBLING_CALL_P (insn)
9547 && GET_MODE (operands[3]) == Pmode"
9549 [(set_attr "op_type" "RIL")
9550 (set_attr "type" "jsr")
9551 (set_attr "z196prop" "z196_cracked")])
9553 (define_insn "*basr_r"
9554 [(set (match_operand 0 "" "")
9555 (call (mem:QI (match_operand 1 "address_operand" "ZQZR"))
9556 (match_operand 2 "const_int_operand" "n")))
9557 (clobber (match_operand 3 "register_operand" "=r"))]
9558 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
9560 if (get_attr_op_type (insn) == OP_TYPE_RR)
9561 return "basr\t%3,%1";
9563 return "bas\t%3,%a1";
9565 [(set (attr "op_type")
9566 (if_then_else (match_operand 1 "register_operand" "")
9567 (const_string "RR") (const_string "RX")))
9568 (set_attr "type" "jsr")
9569 (set_attr "atype" "agen")
9570 (set_attr "z196prop" "z196_cracked")])
9573 ;;- Thread-local storage support.
9576 (define_expand "get_thread_pointer<mode>"
9577 [(set (match_operand:P 0 "nonimmediate_operand" "") (reg:P TP_REGNUM))]
9581 (define_expand "set_thread_pointer<mode>"
9582 [(set (reg:P TP_REGNUM) (match_operand:P 0 "nonimmediate_operand" ""))
9583 (set (reg:P TP_REGNUM) (unspec_volatile:P [(reg:P TP_REGNUM)] UNSPECV_SET_TP))]
9587 (define_insn "*set_tp"
9588 [(set (reg TP_REGNUM) (unspec_volatile [(reg TP_REGNUM)] UNSPECV_SET_TP))]
9591 [(set_attr "type" "none")
9592 (set_attr "length" "0")])
9594 (define_insn "*tls_load_64"
9595 [(set (match_operand:DI 0 "register_operand" "=d")
9596 (unspec:DI [(match_operand:DI 1 "memory_operand" "RT")
9597 (match_operand:DI 2 "" "")]
9601 [(set_attr "op_type" "RXE")
9602 (set_attr "z10prop" "z10_fwd_A3")])
9604 (define_insn "*tls_load_31"
9605 [(set (match_operand:SI 0 "register_operand" "=d,d")
9606 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
9607 (match_operand:SI 2 "" "")]
9613 [(set_attr "op_type" "RX,RXY")
9614 (set_attr "type" "load")
9615 (set_attr "z10prop" "z10_fwd_A3,z10_fwd_A3")])
9617 (define_insn "*bras_tls"
9618 [(set (match_operand 0 "" "")
9619 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9620 (match_operand 2 "const_int_operand" "n")))
9621 (clobber (match_operand 3 "register_operand" "=r"))
9622 (use (match_operand 4 "" ""))]
9623 "!SIBLING_CALL_P (insn)
9624 && TARGET_SMALL_EXEC
9625 && GET_MODE (operands[3]) == Pmode"
9627 [(set_attr "op_type" "RI")
9628 (set_attr "type" "jsr")
9629 (set_attr "z196prop" "z196_cracked")])
9631 (define_insn "*brasl_tls"
9632 [(set (match_operand 0 "" "")
9633 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
9634 (match_operand 2 "const_int_operand" "n")))
9635 (clobber (match_operand 3 "register_operand" "=r"))
9636 (use (match_operand 4 "" ""))]
9637 "!SIBLING_CALL_P (insn)
9639 && GET_MODE (operands[3]) == Pmode"
9641 [(set_attr "op_type" "RIL")
9642 (set_attr "type" "jsr")
9643 (set_attr "z196prop" "z196_cracked")])
9645 (define_insn "*basr_tls"
9646 [(set (match_operand 0 "" "")
9647 (call (mem:QI (match_operand 1 "address_operand" "ZQZR"))
9648 (match_operand 2 "const_int_operand" "n")))
9649 (clobber (match_operand 3 "register_operand" "=r"))
9650 (use (match_operand 4 "" ""))]
9651 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
9653 if (get_attr_op_type (insn) == OP_TYPE_RR)
9654 return "basr\t%3,%1%J4";
9656 return "bas\t%3,%a1%J4";
9658 [(set (attr "op_type")
9659 (if_then_else (match_operand 1 "register_operand" "")
9660 (const_string "RR") (const_string "RX")))
9661 (set_attr "type" "jsr")
9662 (set_attr "atype" "agen")
9663 (set_attr "z196prop" "z196_cracked")])
9666 ;;- Atomic operations
9670 ; memory barrier patterns.
9673 (define_expand "mem_signal_fence"
9674 [(match_operand:SI 0 "const_int_operand")] ;; model
9677 /* The s390 memory model is strong enough not to require any
9678 barrier in order to synchronize a thread with itself. */
9682 (define_expand "mem_thread_fence"
9683 [(match_operand:SI 0 "const_int_operand")] ;; model
9686 /* Unless this is a SEQ_CST fence, the s390 memory model is strong
9687 enough not to require barriers of any kind. */
9688 if (is_mm_seq_cst (memmodel_from_int (INTVAL (operands[0]))))
9690 rtx mem = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
9691 MEM_VOLATILE_P (mem) = 1;
9692 emit_insn (gen_mem_thread_fence_1 (mem));
9697 ; Although bcr is superscalar on Z10, this variant will never
9698 ; become part of an execution group.
9699 ; With z196 we can make use of the fast-BCR-serialization facility.
9700 ; This allows for a slightly faster sync which is sufficient for our
9702 (define_insn "mem_thread_fence_1"
9703 [(set (match_operand:BLK 0 "" "")
9704 (unspec:BLK [(match_dup 0)] UNSPEC_MB))]
9712 [(set_attr "op_type" "RR")
9713 (set_attr "mnemonic" "bcr_flush")
9714 (set_attr "z196prop" "z196_alone")])
9717 ; atomic load/store operations
9720 ; Atomic loads need not examine the memory model at all.
9721 (define_expand "atomic_load<mode>"
9722 [(match_operand:DINT 0 "register_operand") ;; output
9723 (match_operand:DINT 1 "memory_operand") ;; memory
9724 (match_operand:SI 2 "const_int_operand")] ;; model
9727 if (MEM_ALIGN (operands[1]) < GET_MODE_BITSIZE (GET_MODE (operands[1])))
9730 if (<MODE>mode == TImode)
9731 emit_insn (gen_atomic_loadti_1 (operands[0], operands[1]));
9732 else if (<MODE>mode == DImode && !TARGET_ZARCH)
9733 emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1]));
9735 emit_move_insn (operands[0], operands[1]);
9739 ; Different from movdi_31 in that we want no splitters.
9740 (define_insn "atomic_loaddi_1"
9741 [(set (match_operand:DI 0 "register_operand" "=d,d,!*f,!*f")
9742 (unspec:DI [(match_operand:DI 1 "memory_operand" "Q,S,R,T")]
9750 [(set_attr "op_type" "RS,RSY,RS,RSY")
9751 (set_attr "type" "lm,lm,floaddf,floaddf")])
9753 (define_insn "atomic_loadti_1"
9754 [(set (match_operand:TI 0 "register_operand" "=r")
9755 (unspec:TI [(match_operand:TI 1 "memory_operand" "RT")]
9759 [(set_attr "op_type" "RXY")
9760 (set_attr "type" "other")])
9762 ; Atomic stores must(?) enforce sequential consistency.
9763 (define_expand "atomic_store<mode>"
9764 [(match_operand:DINT 0 "memory_operand") ;; memory
9765 (match_operand:DINT 1 "register_operand") ;; input
9766 (match_operand:SI 2 "const_int_operand")] ;; model
9769 enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
9771 if (MEM_ALIGN (operands[0]) < GET_MODE_BITSIZE (GET_MODE (operands[0])))
9774 if (<MODE>mode == TImode)
9775 emit_insn (gen_atomic_storeti_1 (operands[0], operands[1]));
9776 else if (<MODE>mode == DImode && !TARGET_ZARCH)
9777 emit_insn (gen_atomic_storedi_1 (operands[0], operands[1]));
9779 emit_move_insn (operands[0], operands[1]);
9780 if (is_mm_seq_cst (model))
9781 emit_insn (gen_mem_thread_fence (operands[2]));
9785 ; Different from movdi_31 in that we want no splitters.
9786 (define_insn "atomic_storedi_1"
9787 [(set (match_operand:DI 0 "memory_operand" "=Q,S,R,T")
9788 (unspec:DI [(match_operand:DI 1 "register_operand" "d,d,!*f,!*f")]
9796 [(set_attr "op_type" "RS,RSY,RS,RSY")
9797 (set_attr "type" "stm,stm,fstoredf,fstoredf")])
9799 (define_insn "atomic_storeti_1"
9800 [(set (match_operand:TI 0 "memory_operand" "=RT")
9801 (unspec:TI [(match_operand:TI 1 "register_operand" "r")]
9805 [(set_attr "op_type" "RXY")
9806 (set_attr "type" "other")])
9809 ; compare and swap patterns.
9812 (define_expand "atomic_compare_and_swap<mode>"
9813 [(match_operand:SI 0 "register_operand") ;; bool success output
9814 (match_operand:DGPR 1 "nonimmediate_operand");; oldval output
9815 (match_operand:DGPR 2 "memory_operand") ;; memory
9816 (match_operand:DGPR 3 "register_operand") ;; expected intput
9817 (match_operand:DGPR 4 "register_operand") ;; newval intput
9818 (match_operand:SI 5 "const_int_operand") ;; is_weak
9819 (match_operand:SI 6 "const_int_operand") ;; success model
9820 (match_operand:SI 7 "const_int_operand")] ;; failure model
9823 rtx cc, cmp, output = operands[1];
9825 if (!register_operand (output, <MODE>mode))
9826 output = gen_reg_rtx (<MODE>mode);
9828 if (MEM_ALIGN (operands[2]) < GET_MODE_BITSIZE (GET_MODE (operands[2])))
9831 emit_insn (gen_atomic_compare_and_swap<mode>_internal
9832 (output, operands[2], operands[3], operands[4]));
9834 /* We deliberately accept non-register operands in the predicate
9835 to ensure the write back to the output operand happens *before*
9836 the store-flags code below. This makes it easier for combine
9837 to merge the store-flags code with a potential test-and-branch
9838 pattern following (immediately!) afterwards. */
9839 if (output != operands[1])
9840 emit_move_insn (operands[1], output);
9842 cc = gen_rtx_REG (CCZ1mode, CC_REGNUM);
9843 cmp = gen_rtx_EQ (SImode, cc, const0_rtx);
9844 emit_insn (gen_cstorecc4 (operands[0], cmp, cc, const0_rtx));
9848 (define_expand "atomic_compare_and_swap<mode>"
9849 [(match_operand:SI 0 "register_operand") ;; bool success output
9850 (match_operand:HQI 1 "nonimmediate_operand") ;; oldval output
9851 (match_operand:HQI 2 "memory_operand") ;; memory
9852 (match_operand:HQI 3 "general_operand") ;; expected intput
9853 (match_operand:HQI 4 "general_operand") ;; newval intput
9854 (match_operand:SI 5 "const_int_operand") ;; is_weak
9855 (match_operand:SI 6 "const_int_operand") ;; success model
9856 (match_operand:SI 7 "const_int_operand")] ;; failure model
9859 s390_expand_cs_hqi (<MODE>mode, operands[0], operands[1], operands[2],
9860 operands[3], operands[4], INTVAL (operands[5]));
9864 (define_expand "atomic_compare_and_swap<mode>_internal"
9866 [(set (match_operand:DGPR 0 "register_operand")
9867 (match_operand:DGPR 1 "memory_operand"))
9869 (unspec_volatile:DGPR
9871 (match_operand:DGPR 2 "register_operand")
9872 (match_operand:DGPR 3 "register_operand")]
9874 (set (reg:CCZ1 CC_REGNUM)
9875 (compare:CCZ1 (match_dup 1) (match_dup 2)))])]
9879 (define_insn "*atomic_compare_and_swap<mode>_1"
9880 [(set (match_operand:TDI 0 "register_operand" "=r")
9881 (match_operand:TDI 1 "memory_operand" "+QS"))
9883 (unspec_volatile:TDI
9885 (match_operand:TDI 2 "register_operand" "0")
9886 (match_operand:TDI 3 "register_operand" "r")]
9888 (set (reg:CCZ1 CC_REGNUM)
9889 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9891 "c<td>sg\t%0,%3,%S1"
9892 [(set_attr "op_type" "RSY")
9893 (set_attr "type" "sem")])
9896 (define_insn "*atomic_compare_and_swapdi_2"
9897 [(set (match_operand:DI 0 "register_operand" "=r,r")
9898 (match_operand:DI 1 "memory_operand" "+Q,S"))
9902 (match_operand:DI 2 "register_operand" "0,0")
9903 (match_operand:DI 3 "register_operand" "r,r")]
9905 (set (reg:CCZ1 CC_REGNUM)
9906 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9911 [(set_attr "op_type" "RS,RSY")
9912 (set_attr "type" "sem")])
9915 (define_insn "*atomic_compare_and_swapsi_3"
9916 [(set (match_operand:SI 0 "register_operand" "=r,r")
9917 (match_operand:SI 1 "memory_operand" "+Q,S"))
9921 (match_operand:SI 2 "register_operand" "0,0")
9922 (match_operand:SI 3 "register_operand" "r,r")]
9924 (set (reg:CCZ1 CC_REGNUM)
9925 (compare:CCZ1 (match_dup 1) (match_dup 2)))]
9930 [(set_attr "op_type" "RS,RSY")
9931 (set_attr "type" "sem")])
9934 ; Other atomic instruction patterns.
9937 ; z196 load and add, xor, or and and instructions
9939 (define_expand "atomic_fetch_<atomic><mode>"
9940 [(match_operand:GPR 0 "register_operand") ;; val out
9942 (match_operand:GPR 1 "memory_operand") ;; memory
9943 (match_operand:GPR 2 "register_operand")) ;; val in
9944 (match_operand:SI 3 "const_int_operand")] ;; model
9947 if (MEM_ALIGN (operands[1]) < GET_MODE_BITSIZE (GET_MODE (operands[1])))
9950 emit_insn (gen_atomic_fetch_<atomic><mode>_iaf
9951 (operands[0], operands[1], operands[2]));
9955 ; lan, lang, lao, laog, lax, laxg, laa, laag
9956 (define_insn "atomic_fetch_<atomic><mode>_iaf"
9957 [(set (match_operand:GPR 0 "register_operand" "=d")
9958 (match_operand:GPR 1 "memory_operand" "+QS"))
9960 (unspec_volatile:GPR
9961 [(ATOMIC_Z196:GPR (match_dup 1)
9962 (match_operand:GPR 2 "general_operand" "d"))]
9964 (clobber (reg:CC CC_REGNUM))]
9966 "la<noxa><g>\t%0,%2,%1"
9967 [(set_attr "op_type" "RSY")
9968 (set_attr "type" "sem")])
9970 ;; For SImode and larger, the optabs.c code will do just fine in
9971 ;; expanding a compare-and-swap loop. For QI/HImode, we can do
9972 ;; better by expanding our own loop.
9974 (define_expand "atomic_<atomic><mode>"
9976 (match_operand:HQI 0 "memory_operand") ;; memory
9977 (match_operand:HQI 1 "general_operand")) ;; val in
9978 (match_operand:SI 2 "const_int_operand")] ;; model
9981 s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0],
9982 operands[1], false);
9986 (define_expand "atomic_fetch_<atomic><mode>"
9987 [(match_operand:HQI 0 "register_operand") ;; val out
9989 (match_operand:HQI 1 "memory_operand") ;; memory
9990 (match_operand:HQI 2 "general_operand")) ;; val in
9991 (match_operand:SI 3 "const_int_operand")] ;; model
9994 s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
9995 operands[2], false);
9999 (define_expand "atomic_<atomic>_fetch<mode>"
10000 [(match_operand:HQI 0 "register_operand") ;; val out
10002 (match_operand:HQI 1 "memory_operand") ;; memory
10003 (match_operand:HQI 2 "general_operand")) ;; val in
10004 (match_operand:SI 3 "const_int_operand")] ;; model
10007 s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1],
10008 operands[2], true);
10012 (define_expand "atomic_exchange<mode>"
10013 [(match_operand:HQI 0 "register_operand") ;; val out
10014 (match_operand:HQI 1 "memory_operand") ;; memory
10015 (match_operand:HQI 2 "general_operand") ;; val in
10016 (match_operand:SI 3 "const_int_operand")] ;; model
10019 s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1],
10020 operands[2], false);
10025 ;;- Miscellaneous instructions.
10029 ; allocate stack instruction pattern(s).
10032 (define_expand "allocate_stack"
10033 [(match_operand 0 "general_operand" "")
10034 (match_operand 1 "general_operand" "")]
10037 rtx temp = gen_reg_rtx (Pmode);
10039 emit_move_insn (temp, s390_back_chain_rtx ());
10040 anti_adjust_stack (operands[1]);
10041 emit_move_insn (s390_back_chain_rtx (), temp);
10043 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10049 ; setjmp instruction pattern.
10052 (define_expand "builtin_setjmp_receiver"
10053 [(match_operand 0 "" "")]
10056 emit_insn (s390_load_got ());
10057 emit_use (pic_offset_table_rtx);
10061 ;; These patterns say how to save and restore the stack pointer. We need not
10062 ;; save the stack pointer at function level since we are careful to
10063 ;; preserve the backchain. At block level, we have to restore the backchain
10064 ;; when we restore the stack pointer.
10066 ;; For nonlocal gotos, we must save both the stack pointer and its
10067 ;; backchain and restore both. Note that in the nonlocal case, the
10068 ;; save area is a memory location.
10070 (define_expand "save_stack_function"
10071 [(match_operand 0 "general_operand" "")
10072 (match_operand 1 "general_operand" "")]
10076 (define_expand "restore_stack_function"
10077 [(match_operand 0 "general_operand" "")
10078 (match_operand 1 "general_operand" "")]
10082 (define_expand "restore_stack_block"
10083 [(match_operand 0 "register_operand" "")
10084 (match_operand 1 "register_operand" "")]
10087 rtx temp = gen_reg_rtx (Pmode);
10089 emit_move_insn (temp, s390_back_chain_rtx ());
10090 emit_move_insn (operands[0], operands[1]);
10091 emit_move_insn (s390_back_chain_rtx (), temp);
10096 (define_expand "save_stack_nonlocal"
10097 [(match_operand 0 "memory_operand" "")
10098 (match_operand 1 "register_operand" "")]
10101 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
10103 /* Copy the backchain to the first word, sp to the second and the
10104 literal pool base to the third. */
10106 rtx save_bc = adjust_address (operands[0], Pmode, 0);
10107 rtx save_sp = adjust_address (operands[0], Pmode, GET_MODE_SIZE (Pmode));
10108 rtx save_bp = adjust_address (operands[0], Pmode, 2 * GET_MODE_SIZE (Pmode));
10110 if (TARGET_BACKCHAIN)
10111 emit_move_insn (save_bc, force_reg (Pmode, s390_back_chain_rtx ()));
10113 emit_move_insn (save_sp, operands[1]);
10114 emit_move_insn (save_bp, base);
10119 (define_expand "restore_stack_nonlocal"
10120 [(match_operand 0 "register_operand" "")
10121 (match_operand 1 "memory_operand" "")]
10124 rtx base = gen_rtx_REG (Pmode, BASE_REGNUM);
10125 rtx temp = NULL_RTX;
10127 /* Restore the backchain from the first word, sp from the second and the
10128 literal pool base from the third. */
10130 rtx save_bc = adjust_address (operands[1], Pmode, 0);
10131 rtx save_sp = adjust_address (operands[1], Pmode, GET_MODE_SIZE (Pmode));
10132 rtx save_bp = adjust_address (operands[1], Pmode, 2 * GET_MODE_SIZE (Pmode));
10134 if (TARGET_BACKCHAIN)
10135 temp = force_reg (Pmode, save_bc);
10137 emit_move_insn (base, save_bp);
10138 emit_move_insn (operands[0], save_sp);
10141 emit_move_insn (s390_back_chain_rtx (), temp);
10147 (define_expand "exception_receiver"
10151 s390_set_has_landing_pad_p (true);
10156 ; nop instruction pattern(s).
10163 [(set_attr "op_type" "RR")
10164 (set_attr "z10prop" "z10_fr_E1")])
10166 (define_insn "nop1"
10170 [(set_attr "op_type" "RR")])
10172 ;;- Undeletable nops (used for hotpatching)
10174 (define_insn "nop_2_byte"
10175 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_2_BYTE)]
10178 [(set_attr "op_type" "RR")])
10180 (define_insn "nop_4_byte"
10181 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_4_BYTE)]
10184 [(set_attr "op_type" "RX")])
10186 (define_insn "nop_6_byte"
10187 [(unspec_volatile [(const_int 0)] UNSPECV_NOP_6_BYTE)]
10190 [(set_attr "op_type" "RIL")])
10194 ; Special literal pool access instruction pattern(s).
10197 (define_insn "*pool_entry"
10198 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
10199 UNSPECV_POOL_ENTRY)]
10202 machine_mode mode = GET_MODE (PATTERN (insn));
10203 unsigned int align = GET_MODE_BITSIZE (mode);
10204 s390_output_pool_entry (operands[0], mode, align);
10207 [(set (attr "length")
10208 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
10210 (define_insn "pool_align"
10211 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")]
10212 UNSPECV_POOL_ALIGN)]
10215 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
10217 (define_insn "pool_section_start"
10218 [(unspec_volatile [(const_int 1)] UNSPECV_POOL_SECTION)]
10220 ".section\t.rodata"
10221 [(set_attr "length" "0")])
10223 (define_insn "pool_section_end"
10224 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_SECTION)]
10227 [(set_attr "length" "0")])
10229 (define_insn "main_base_31_small"
10230 [(set (match_operand 0 "register_operand" "=a")
10231 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
10232 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10234 [(set_attr "op_type" "RR")
10235 (set_attr "type" "la")
10236 (set_attr "z196prop" "z196_cracked")])
10238 (define_insn "main_base_31_large"
10239 [(set (match_operand 0 "register_operand" "=a")
10240 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
10241 (set (pc) (label_ref (match_operand 2 "" "")))]
10242 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10244 [(set_attr "op_type" "RI")
10245 (set_attr "z196prop" "z196_cracked")])
10247 (define_insn "main_base_64"
10248 [(set (match_operand 0 "register_operand" "=a")
10249 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
10250 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10252 [(set_attr "op_type" "RIL")
10253 (set_attr "type" "larl")
10254 (set_attr "z10prop" "z10_fwd_A1")])
10256 (define_insn "main_pool"
10257 [(set (match_operand 0 "register_operand" "=a")
10258 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
10259 "GET_MODE (operands[0]) == Pmode"
10261 gcc_unreachable ();
10263 [(set (attr "type")
10264 (if_then_else (match_test "TARGET_CPU_ZARCH")
10265 (const_string "larl") (const_string "la")))])
10267 (define_insn "reload_base_31"
10268 [(set (match_operand 0 "register_operand" "=a")
10269 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
10270 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10271 "basr\t%0,0\;la\t%0,%1-.(%0)"
10272 [(set_attr "length" "6")
10273 (set_attr "type" "la")
10274 (set_attr "z196prop" "z196_cracked")])
10276 (define_insn "reload_base_64"
10277 [(set (match_operand 0 "register_operand" "=a")
10278 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
10279 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
10281 [(set_attr "op_type" "RIL")
10282 (set_attr "type" "larl")
10283 (set_attr "z10prop" "z10_fwd_A1")])
10285 (define_insn "pool"
10286 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
10289 gcc_unreachable ();
10291 [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
10294 ;; Insns related to generating the function prologue and epilogue.
10298 (define_expand "prologue"
10299 [(use (const_int 0))]
10301 "s390_emit_prologue (); DONE;")
10303 (define_expand "epilogue"
10304 [(use (const_int 1))]
10306 "s390_emit_epilogue (false); DONE;")
10308 (define_expand "sibcall_epilogue"
10309 [(use (const_int 0))]
10311 "s390_emit_epilogue (true); DONE;")
10313 ;; A direct return instruction, without using an epilogue.
10314 (define_insn "<code>"
10316 "s390_can_use_<code>_insn ()"
10318 [(set_attr "op_type" "RR")
10319 (set_attr "type" "jsr")
10320 (set_attr "atype" "agen")])
10322 (define_insn "*return"
10324 (use (match_operand 0 "register_operand" "a"))]
10325 "GET_MODE (operands[0]) == Pmode"
10327 [(set_attr "op_type" "RR")
10328 (set_attr "type" "jsr")
10329 (set_attr "atype" "agen")])
10332 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
10333 ;; pointer. This is used for compatibility.
10335 (define_expand "ptr_extend"
10336 [(set (match_operand:DI 0 "register_operand" "=r")
10337 (match_operand:SI 1 "register_operand" "r"))]
10340 emit_insn (gen_anddi3 (operands[0],
10341 gen_lowpart (DImode, operands[1]),
10342 GEN_INT (0x7fffffff)));
10346 ;; Instruction definition to expand eh_return macro to support
10347 ;; swapping in special linkage return addresses.
10349 (define_expand "eh_return"
10350 [(use (match_operand 0 "register_operand" ""))]
10353 s390_emit_tpf_eh_return (operands[0]);
10358 ; Stack Protector Patterns
10361 (define_expand "stack_protect_set"
10362 [(set (match_operand 0 "memory_operand" "")
10363 (match_operand 1 "memory_operand" ""))]
10366 #ifdef TARGET_THREAD_SSP_OFFSET
10368 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
10369 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
10372 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
10374 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
10379 (define_insn "stack_protect_set<mode>"
10380 [(set (match_operand:DSI 0 "memory_operand" "=Q")
10381 (unspec:DSI [(match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_SET))]
10383 "mvc\t%O0(%G0,%R0),%S1"
10384 [(set_attr "op_type" "SS")])
10386 (define_expand "stack_protect_test"
10387 [(set (reg:CC CC_REGNUM)
10388 (compare (match_operand 0 "memory_operand" "")
10389 (match_operand 1 "memory_operand" "")))
10390 (match_operand 2 "" "")]
10394 #ifdef TARGET_THREAD_SSP_OFFSET
10396 = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (),
10397 GEN_INT (TARGET_THREAD_SSP_OFFSET)));
10400 emit_insn (gen_stack_protect_testdi (operands[0], operands[1]));
10402 emit_insn (gen_stack_protect_testsi (operands[0], operands[1]));
10404 cc_reg = gen_rtx_REG (CCZmode, CC_REGNUM);
10405 test = gen_rtx_EQ (VOIDmode, cc_reg, const0_rtx);
10406 emit_jump_insn (gen_cbranchcc4 (test, cc_reg, const0_rtx, operands[2]));
10410 (define_insn "stack_protect_test<mode>"
10411 [(set (reg:CCZ CC_REGNUM)
10412 (unspec:CCZ [(match_operand:DSI 0 "memory_operand" "Q")
10413 (match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_TEST))]
10415 "clc\t%O0(%G0,%R0),%S1"
10416 [(set_attr "op_type" "SS")])
10418 ; This is used in s390_emit_prologue in order to prevent insns
10419 ; adjusting the stack pointer to be moved over insns writing stack
10420 ; slots using a copy of the stack pointer in a different register.
10421 (define_insn "stack_tie"
10422 [(set (match_operand:BLK 0 "memory_operand" "+m")
10423 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
10426 [(set_attr "length" "0")])
10430 ; Data prefetch patterns
10433 (define_insn "prefetch"
10434 [(prefetch (match_operand 0 "address_operand" "ZQZRZSZT,X")
10435 (match_operand:SI 1 "const_int_operand" " n,n")
10436 (match_operand:SI 2 "const_int_operand" " n,n"))]
10439 switch (which_alternative)
10442 return INTVAL (operands[1]) == 1 ? "pfd\t2,%a0" : "pfd\t1,%a0";
10444 if (larl_operand (operands[0], Pmode))
10445 return INTVAL (operands[1]) == 1 ? "pfdrl\t2,%a0" : "pfdrl\t1,%a0";
10448 /* This might be reached for symbolic operands with an odd
10449 addend. We simply omit the prefetch for such rare cases. */
10454 [(set_attr "type" "load,larl")
10455 (set_attr "op_type" "RXY,RIL")
10456 (set_attr "z10prop" "z10_super")
10457 (set_attr "z196prop" "z196_alone")])
10461 ; Byte swap instructions
10464 ; FIXME: There is also mvcin but we cannot use it since src and target
10466 (define_insn "bswap<mode>2"
10467 [(set (match_operand:GPR 0 "nonimmediate_operand" "=d, d,RT")
10468 (bswap:GPR (match_operand:GPR 1 "nonimmediate_operand" " d,RT, d")))]
10474 [(set_attr "type" "*,load,store")
10475 (set_attr "op_type" "RRE,RXY,RXY")
10476 (set_attr "z10prop" "z10_super")])
10478 (define_insn "bswaphi2"
10479 [(set (match_operand:HI 0 "nonimmediate_operand" "=d, d,RT")
10480 (bswap:HI (match_operand:HI 1 "nonimmediate_operand" " d,RT, d")))]
10486 [(set_attr "type" "*,load,store")
10487 (set_attr "op_type" "RRE,RXY,RXY")
10488 (set_attr "z10prop" "z10_super")])
10491 [(set (match_operand:HI 0 "register_operand" "")
10492 (bswap:HI (match_operand:HI 1 "register_operand" "")))]
10494 [(set (match_dup 2) (bswap:SI (match_dup 3)))
10495 (set (match_dup 2) (lshiftrt:SI (match_dup 2)
10497 (set (match_dup 0) (subreg:HI (match_dup 2) 2))]
10499 operands[2] = gen_reg_rtx (SImode);
10500 operands[3] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
10505 ; Population count instruction
10508 ; The S/390 popcount instruction counts the bits of op1 in 8 byte
10509 ; portions and stores the result in the corresponding bytes in op0.
10510 (define_insn "*popcount<mode>"
10511 [(set (match_operand:INT 0 "register_operand" "=d")
10512 (unspec:INT [(match_operand:INT 1 "register_operand" "d")] UNSPEC_POPCNT))
10513 (clobber (reg:CC CC_REGNUM))]
10516 [(set_attr "op_type" "RRE")])
10518 (define_expand "popcountdi2"
10520 (parallel [(set (match_operand:DI 0 "register_operand" "")
10521 (unspec:DI [(match_operand:DI 1 "register_operand")]
10523 (clobber (reg:CC CC_REGNUM))])
10524 ; sllg op2, op0, 32
10525 (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 32)))
10527 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10528 (clobber (reg:CC CC_REGNUM))])
10529 ; sllg op2, op0, 16
10531 (ashift:DI (match_dup 0) (const_int 16)))
10533 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10534 (clobber (reg:CC CC_REGNUM))])
10536 (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 8)))
10538 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
10539 (clobber (reg:CC CC_REGNUM))])
10540 ; srlg op0, op0, 56
10541 (set (match_dup 0) (lshiftrt:DI (match_dup 0) (const_int 56)))]
10542 "TARGET_Z196 && TARGET_64BIT"
10543 "operands[2] = gen_reg_rtx (DImode);")
10545 (define_expand "popcountsi2"
10547 (parallel [(set (match_operand:SI 0 "register_operand" "")
10548 (unspec:SI [(match_operand:SI 1 "register_operand")]
10550 (clobber (reg:CC CC_REGNUM))])
10551 ; sllk op2, op0, 16
10553 (ashift:SI (match_dup 0) (const_int 16)))
10555 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10556 (clobber (reg:CC CC_REGNUM))])
10558 (set (match_dup 2) (ashift:SI (match_dup 0) (const_int 8)))
10560 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10561 (clobber (reg:CC CC_REGNUM))])
10563 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 24)))]
10565 "operands[2] = gen_reg_rtx (SImode);")
10567 (define_expand "popcounthi2"
10569 (parallel [(set (match_operand:HI 0 "register_operand" "")
10570 (unspec:HI [(match_operand:HI 1 "register_operand")]
10572 (clobber (reg:CC CC_REGNUM))])
10575 (ashift:SI (match_dup 0) (const_int 8)))
10577 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
10578 (clobber (reg:CC CC_REGNUM))])
10580 (set (match_dup 0) (lshiftrt:HI (match_dup 0) (const_int 8)))]
10582 "operands[2] = gen_reg_rtx (SImode);")
10584 (define_expand "popcountqi2"
10586 (parallel [(set (match_operand:QI 0 "register_operand" "")
10587 (unspec:QI [(match_operand:QI 1 "register_operand")]
10589 (clobber (reg:CC CC_REGNUM))])]
10594 ;;- Copy sign instructions
10597 (define_insn "copysign<mode>3"
10598 [(set (match_operand:FP 0 "register_operand" "=f")
10599 (unspec:FP [(match_operand:FP 1 "register_operand" "<fT0>")
10600 (match_operand:FP 2 "register_operand" "f")]
10604 [(set_attr "op_type" "RRF")
10605 (set_attr "type" "fsimp<mode>")])
10609 ;;- Transactional execution instructions
10612 ; This splitter helps combine to make use of CC directly when
10613 ; comparing the integer result of a tbegin builtin with a constant.
10614 ; The unspec is already removed by canonicalize_comparison. So this
10615 ; splitters only job is to turn the PARALLEL into separate insns
10616 ; again. Unfortunately this only works with the very first cc/int
10617 ; compare since combine is not able to deal with data flow across
10618 ; basic block boundaries.
10620 ; It needs to be an insn pattern as well since combine does not apply
10621 ; the splitter directly. Combine would only use it if it actually
10622 ; would reduce the number of instructions.
10623 (define_insn_and_split "*ccraw_to_int"
10626 (match_operator 0 "s390_eqne_operator"
10627 [(reg:CCRAW CC_REGNUM)
10628 (match_operand 1 "const_int_operand" "")])
10629 (label_ref (match_operand 2 "" ""))
10631 (set (match_operand:SI 3 "register_operand" "=d")
10632 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
10636 [(set (match_dup 3)
10637 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))
10639 (if_then_else (match_op_dup 0 [(reg:CCRAW CC_REGNUM) (match_dup 1)])
10640 (label_ref (match_dup 2))
10644 ; Non-constrained transaction begin
10646 (define_expand "tbegin"
10647 [(match_operand:SI 0 "register_operand" "")
10648 (match_operand:BLK 1 "memory_operand" "")]
10651 s390_expand_tbegin (operands[0], operands[1], NULL_RTX, true);
10655 (define_expand "tbegin_nofloat"
10656 [(match_operand:SI 0 "register_operand" "")
10657 (match_operand:BLK 1 "memory_operand" "")]
10660 s390_expand_tbegin (operands[0], operands[1], NULL_RTX, false);
10664 (define_expand "tbegin_retry"
10665 [(match_operand:SI 0 "register_operand" "")
10666 (match_operand:BLK 1 "memory_operand" "")
10667 (match_operand:SI 2 "general_operand" "")]
10670 s390_expand_tbegin (operands[0], operands[1], operands[2], true);
10674 (define_expand "tbegin_retry_nofloat"
10675 [(match_operand:SI 0 "register_operand" "")
10676 (match_operand:BLK 1 "memory_operand" "")
10677 (match_operand:SI 2 "general_operand" "")]
10680 s390_expand_tbegin (operands[0], operands[1], operands[2], false);
10684 ; Clobber VRs since they don't get restored
10685 (define_insn "tbegin_1_z13"
10686 [(set (reg:CCRAW CC_REGNUM)
10687 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10689 (set (match_operand:BLK 1 "memory_operand" "=Q")
10690 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))
10691 (clobber (reg:TI 16)) (clobber (reg:TI 38))
10692 (clobber (reg:TI 17)) (clobber (reg:TI 39))
10693 (clobber (reg:TI 18)) (clobber (reg:TI 40))
10694 (clobber (reg:TI 19)) (clobber (reg:TI 41))
10695 (clobber (reg:TI 20)) (clobber (reg:TI 42))
10696 (clobber (reg:TI 21)) (clobber (reg:TI 43))
10697 (clobber (reg:TI 22)) (clobber (reg:TI 44))
10698 (clobber (reg:TI 23)) (clobber (reg:TI 45))
10699 (clobber (reg:TI 24)) (clobber (reg:TI 46))
10700 (clobber (reg:TI 25)) (clobber (reg:TI 47))
10701 (clobber (reg:TI 26)) (clobber (reg:TI 48))
10702 (clobber (reg:TI 27)) (clobber (reg:TI 49))
10703 (clobber (reg:TI 28)) (clobber (reg:TI 50))
10704 (clobber (reg:TI 29)) (clobber (reg:TI 51))
10705 (clobber (reg:TI 30)) (clobber (reg:TI 52))
10706 (clobber (reg:TI 31)) (clobber (reg:TI 53))]
10707 ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is
10708 ; not supposed to be used for immediates (see genpreds.c).
10709 "TARGET_VX && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10711 [(set_attr "op_type" "SIL")])
10713 (define_insn "tbegin_1"
10714 [(set (reg:CCRAW CC_REGNUM)
10715 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10717 (set (match_operand:BLK 1 "memory_operand" "=Q")
10718 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))
10719 (clobber (reg:DF 16))
10720 (clobber (reg:DF 17))
10721 (clobber (reg:DF 18))
10722 (clobber (reg:DF 19))
10723 (clobber (reg:DF 20))
10724 (clobber (reg:DF 21))
10725 (clobber (reg:DF 22))
10726 (clobber (reg:DF 23))
10727 (clobber (reg:DF 24))
10728 (clobber (reg:DF 25))
10729 (clobber (reg:DF 26))
10730 (clobber (reg:DF 27))
10731 (clobber (reg:DF 28))
10732 (clobber (reg:DF 29))
10733 (clobber (reg:DF 30))
10734 (clobber (reg:DF 31))]
10735 ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is
10736 ; not supposed to be used for immediates (see genpreds.c).
10737 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10739 [(set_attr "op_type" "SIL")])
10741 ; Same as above but without the FPR clobbers
10742 (define_insn "tbegin_nofloat_1"
10743 [(set (reg:CCRAW CC_REGNUM)
10744 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
10746 (set (match_operand:BLK 1 "memory_operand" "=Q")
10747 (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))]
10748 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10750 [(set_attr "op_type" "SIL")])
10753 ; Constrained transaction begin
10755 (define_expand "tbeginc"
10756 [(set (reg:CCRAW CC_REGNUM)
10757 (unspec_volatile:CCRAW [(const_int TBEGINC_MASK)]
10762 (define_insn "*tbeginc_1"
10763 [(set (reg:CCRAW CC_REGNUM)
10764 (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" " D")]
10766 "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
10768 [(set_attr "op_type" "SIL")])
10772 (define_expand "tend"
10773 [(set (reg:CCRAW CC_REGNUM)
10774 (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))
10775 (set (match_operand:SI 0 "register_operand" "")
10776 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
10780 (define_insn "*tend_1"
10781 [(set (reg:CCRAW CC_REGNUM)
10782 (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))]
10785 [(set_attr "op_type" "S")])
10787 ; Transaction abort
10789 (define_expand "tabort"
10790 [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "")]
10792 "TARGET_HTM && operands != NULL"
10794 if (CONST_INT_P (operands[0])
10795 && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 255)
10797 error ("Invalid transaction abort code: " HOST_WIDE_INT_PRINT_DEC
10798 ". Values in range 0 through 255 are reserved.",
10799 INTVAL (operands[0]));
10804 (define_insn "*tabort_1"
10805 [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "Y")]
10807 "TARGET_HTM && operands != NULL"
10809 [(set_attr "op_type" "S")])
10811 ; Transaction extract nesting depth
10813 (define_insn "etnd"
10814 [(set (match_operand:SI 0 "register_operand" "=d")
10815 (unspec_volatile:SI [(const_int 0)] UNSPECV_ETND))]
10818 [(set_attr "op_type" "RRE")])
10820 ; Non-transactional store
10822 (define_insn "ntstg"
10823 [(set (match_operand:DI 0 "memory_operand" "=RT")
10824 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "d")]
10828 [(set_attr "op_type" "RXY")])
10830 ; Transaction perform processor assist
10832 (define_expand "tx_assist"
10833 [(unspec_volatile [(match_operand:SI 0 "register_operand" "")
10834 (reg:SI GPR0_REGNUM)
10840 (define_insn "*ppa"
10841 [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")
10842 (match_operand:SI 1 "register_operand" "d")
10843 (match_operand 2 "const_int_operand" "I")]
10845 "TARGET_HTM && INTVAL (operands[2]) < 16"
10847 [(set_attr "op_type" "RRF")])
10850 ; Set and get floating point control register
10852 (define_insn "sfpc"
10853 [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")]
10855 "TARGET_HARD_FLOAT"
10858 (define_insn "efpc"
10859 [(set (match_operand:SI 0 "register_operand" "=d")
10860 (unspec_volatile:SI [(const_int 0)] UNSPECV_EFPC))]
10861 "TARGET_HARD_FLOAT"
10865 ; Load count to block boundary
10867 (define_insn "lcbb"
10868 [(set (match_operand:SI 0 "register_operand" "=d")
10869 (unspec:SI [(match_operand:SI 1 "address_operand" "ZQZR")
10870 (match_operand:SI 2 "immediate_operand" "C")] UNSPEC_LCBB))
10871 (clobber (reg:CC CC_REGNUM))]
10874 [(set_attr "op_type" "VRX")])