1 ;;- Machine description for GNU compiler -- S/390 / zSeries version.
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
3 ;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and
4 ;; Ulrich Weigand (uweigand@de.ibm.com).
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it under
9 ;; the terms of the GNU General Public License as published by the Free
10 ;; Software Foundation; either version 2, or (at your option) any later
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to the Free
20 ;; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 ;; Special constraints for s/390 machine description:
26 ;; a -- Any address register from 1 to 15.
27 ;; d -- Any register from 0 to 15.
28 ;; I -- An 8-bit constant (0..255).
29 ;; J -- A 12-bit constant (0..4095).
30 ;; K -- A 16-bit constant (-32768..32767).
31 ;; Q -- A memory reference without index-register.
32 ;; S -- Valid operand for the LARL instruction.
34 ;; Special formats used for outputting 390 instructions.
36 ;; %b -- Print a constant byte integer. xy
37 ;; %h -- Print a signed 16-bit. wxyz
38 ;; %N -- Print next register (second word of a DImode reg) or next word.
39 ;; %M -- Print next register (second word of a TImode reg) or next word.
40 ;; %O -- Print the offset of a memory reference (PLUS (REG) (CONST_INT)).
41 ;; %R -- Print the register of a memory reference (PLUS (REG) (CONST_INT)).
43 ;; We have a special constraint for pattern matching.
45 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
57 ; GOT/PLT and lt-relative accesses
58 (UNSPEC_LTREL_OFFSET 100)
59 (UNSPEC_LTREL_BASE 101)
67 (UNSPEC_RELOAD_BASE 210)
68 (UNSPEC_MAIN_BASE 211)
70 ; TLS relocation specifiers
75 (UNSPEC_GOTNTPOFF 504)
76 (UNSPEC_INDNTPOFF 505)
80 (UNSPEC_TLSLDM_NTPOFF 511)
85 ;; UNSPEC_VOLATILE usage
94 (UNSPECV_POOL_START 201)
95 (UNSPECV_POOL_END 202)
96 (UNSPECV_POOL_ENTRY 203)
97 (UNSPECV_MAIN_POOL 300)
104 ;; Processor type. This attribute must exactly match the processor_type
105 ;; enumeration in s390.h.
107 (define_attr "cpu" "g5,g6,z900,z990"
108 (const (symbol_ref "s390_tune")))
110 ;; Define an insn type attribute. This is used in function unit delay
113 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
114 cs,vs,store,imul,idiv,
115 branch,jsr,fsimpd,fsimps,
116 floadd,floads,fstored, fstores,
117 fmuld,fmuls,fdivd,fdivs,
118 ftoi,itof,fsqrtd,fsqrts,
120 (const_string "integer"))
122 ;; Operand type. Used to default length attribute values
124 (define_attr "op_type"
125 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
128 ;; Insn are devide in two classes:
129 ;; agen: Insn using agen
130 ;; reg: Insn not using agen
132 (define_attr "atype" "agen,reg"
133 (cond [ (eq_attr "op_type" "E") (const_string "reg")
134 (eq_attr "op_type" "RR") (const_string "reg")
135 (eq_attr "op_type" "RX") (const_string "agen")
136 (eq_attr "op_type" "RI") (const_string "reg")
137 (eq_attr "op_type" "RRE") (const_string "reg")
138 (eq_attr "op_type" "RS") (const_string "agen")
139 (eq_attr "op_type" "RSI") (const_string "agen")
140 (eq_attr "op_type" "S") (const_string "agen")
141 (eq_attr "op_type" "SI") (const_string "agen")
142 (eq_attr "op_type" "SS") (const_string "agen")
143 (eq_attr "op_type" "SSE") (const_string "agen")
144 (eq_attr "op_type" "RXE") (const_string "agen")
145 (eq_attr "op_type" "RSE") (const_string "agen")
146 (eq_attr "op_type" "RIL") (const_string "agen")
147 (eq_attr "op_type" "RXY") (const_string "agen")
148 (eq_attr "op_type" "RSY") (const_string "agen")
149 (eq_attr "op_type" "SIY") (const_string "agen")]
150 (const_string "reg")))
152 ;; Generic pipeline function unit.
154 (define_function_unit "integer" 1 0
155 (eq_attr "type" "none") 0 0)
157 (define_function_unit "integer" 1 0
158 (eq_attr "type" "integer") 1 1)
160 (define_function_unit "integer" 1 0
161 (eq_attr "type" "fsimpd") 1 1)
163 (define_function_unit "integer" 1 0
164 (eq_attr "type" "fsimps") 1 1)
166 (define_function_unit "integer" 1 0
167 (eq_attr "type" "load") 1 1)
169 (define_function_unit "integer" 1 0
170 (eq_attr "type" "floadd") 1 1)
172 (define_function_unit "integer" 1 0
173 (eq_attr "type" "floads") 1 1)
175 (define_function_unit "integer" 1 0
176 (eq_attr "type" "la") 1 1)
178 (define_function_unit "integer" 1 0
179 (eq_attr "type" "larl") 1 1)
181 (define_function_unit "integer" 1 0
182 (eq_attr "type" "lr") 1 1)
184 (define_function_unit "integer" 1 0
185 (eq_attr "type" "branch") 1 1)
187 (define_function_unit "integer" 1 0
188 (eq_attr "type" "store") 1 1)
190 (define_function_unit "integer" 1 0
191 (eq_attr "type" "fstored") 1 1)
193 (define_function_unit "integer" 1 0
194 (eq_attr "type" "fstores") 1 1)
196 (define_function_unit "integer" 1 0
197 (eq_attr "type" "lm") 2 2)
199 (define_function_unit "integer" 1 0
200 (eq_attr "type" "stm") 2 2)
202 (define_function_unit "integer" 1 0
203 (eq_attr "type" "cs") 5 5)
205 (define_function_unit "integer" 1 0
206 (eq_attr "type" "vs") 30 30)
208 (define_function_unit "integer" 1 0
209 (eq_attr "type" "jsr") 5 5)
211 (define_function_unit "integer" 1 0
212 (eq_attr "type" "imul") 7 7)
214 (define_function_unit "integer" 1 0
215 (eq_attr "type" "fmuld") 6 6)
217 (define_function_unit "integer" 1 0
218 (eq_attr "type" "fmuls") 6 6)
220 (define_function_unit "integer" 1 0
221 (eq_attr "type" "idiv") 33 33)
223 (define_function_unit "integer" 1 0
224 (eq_attr "type" "fdivd") 33 33)
226 (define_function_unit "integer" 1 0
227 (eq_attr "type" "fdivs") 33 33)
229 (define_function_unit "integer" 1 0
230 (eq_attr "type" "fsqrtd") 30 30)
232 (define_function_unit "integer" 1 0
233 (eq_attr "type" "fsqrts") 30 30)
235 (define_function_unit "integer" 1 0
236 (eq_attr "type" "ftoi") 2 2)
238 (define_function_unit "integer" 1 0
239 (eq_attr "type" "itof") 2 2)
241 (define_function_unit "integer" 1 0
242 (eq_attr "type" "o2") 2 2)
244 (define_function_unit "integer" 1 0
245 (eq_attr "type" "o3") 3 3)
247 (define_function_unit "integer" 1 0
248 (eq_attr "type" "other") 5 5)
250 ;; Pipeline description for z900
257 (define_attr "length" ""
258 (cond [ (eq_attr "op_type" "E") (const_int 2)
259 (eq_attr "op_type" "RR") (const_int 2)
260 (eq_attr "op_type" "RX") (const_int 4)
261 (eq_attr "op_type" "RI") (const_int 4)
262 (eq_attr "op_type" "RRE") (const_int 4)
263 (eq_attr "op_type" "RS") (const_int 4)
264 (eq_attr "op_type" "RSI") (const_int 4)
265 (eq_attr "op_type" "S") (const_int 4)
266 (eq_attr "op_type" "SI") (const_int 4)
267 (eq_attr "op_type" "SS") (const_int 6)
268 (eq_attr "op_type" "SSE") (const_int 6)
269 (eq_attr "op_type" "RXE") (const_int 6)
270 (eq_attr "op_type" "RSE") (const_int 6)
271 (eq_attr "op_type" "RIL") (const_int 6)
272 (eq_attr "op_type" "RXY") (const_int 6)
273 (eq_attr "op_type" "RSY") (const_int 6)
274 (eq_attr "op_type" "SIY") (const_int 6)]
277 ;; Define attributes for `asm' insns.
279 (define_asm_attributes [(set_attr "type" "other")
280 (set_attr "op_type" "NN")])
286 ; CCL: Zero Nonzero Zero Nonzero (AL, ALR, SL, SLR, N, NC, NI, NR, O, OC, OI, OR, X, XC, XI, XR)
287 ; CCA: Zero <Zero >Zero Overflow (A, AR, AH, AHI, S, SR, SH, SHI, LTR, LCR, LNR, LPR, SLA, SLDA, SLA, SRDA)
288 ; CCU: Equal ULess UGreater -- (CL, CLR, CLI, CLM)
289 ; CCS: Equal SLess SGreater -- (C, CR, CH, CHI, ICM)
290 ; CCT: Zero Mixed Mixed Ones (TM, TMH, TML)
293 ; CCZ1 -> CCA/CCU/CCS/CCT
296 ; String: CLC, CLCL, CLCLE, CLST, CUSE, MVCL, MVCLE, MVPG, MVST, SRST
297 ; Clobber: CKSM, CFC, CS, CDS, CUUTF, CUTFU, PLO, SPM, STCK, STCKE, TS, TRT, TRE, UPT
301 ;;- Compare instructions.
304 (define_expand "cmpdi"
306 (compare:CC (match_operand:DI 0 "register_operand" "")
307 (match_operand:DI 1 "general_operand" "")))]
310 s390_compare_op0 = operands[0];
311 s390_compare_op1 = operands[1];
315 (define_expand "cmpsi"
317 (compare:CC (match_operand:SI 0 "register_operand" "")
318 (match_operand:SI 1 "general_operand" "")))]
321 s390_compare_op0 = operands[0];
322 s390_compare_op1 = operands[1];
326 (define_expand "cmpdf"
328 (compare:CC (match_operand:DF 0 "register_operand" "")
329 (match_operand:DF 1 "general_operand" "")))]
332 s390_compare_op0 = operands[0];
333 s390_compare_op1 = operands[1];
337 (define_expand "cmpsf"
339 (compare:CC (match_operand:SF 0 "register_operand" "")
340 (match_operand:SF 1 "general_operand" "")))]
343 s390_compare_op0 = operands[0];
344 s390_compare_op1 = operands[1];
349 ; Test-under-Mask (zero_extract) instructions
351 (define_insn "*tmdi_ext"
353 (compare (zero_extract:DI (match_operand:DI 0 "register_operand" "d")
354 (match_operand:DI 1 "const_int_operand" "n")
355 (match_operand:DI 2 "const_int_operand" "n"))
357 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
358 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
359 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 64
360 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
361 == INTVAL (operands[2]) >> 4"
363 int part = INTVAL (operands[2]) >> 4;
364 int block = (1 << INTVAL (operands[1])) - 1;
365 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
367 operands[2] = GEN_INT (block << shift);
371 case 0: return "tmhh\t%0,%x2";
372 case 1: return "tmhl\t%0,%x2";
373 case 2: return "tmlh\t%0,%x2";
374 case 3: return "tmll\t%0,%x2";
378 [(set_attr "op_type" "RI")])
380 (define_insn "*tmsi_ext"
382 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
383 (match_operand:SI 1 "const_int_operand" "n")
384 (match_operand:SI 2 "const_int_operand" "n"))
386 "s390_match_ccmode(insn, CCTmode)
387 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
388 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
389 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
390 == INTVAL (operands[2]) >> 4"
392 int part = INTVAL (operands[2]) >> 4;
393 int block = (1 << INTVAL (operands[1])) - 1;
394 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
396 operands[2] = GEN_INT (block << shift);
400 case 0: return "tmh\t%0,%x2";
401 case 1: return "tml\t%0,%x2";
405 [(set_attr "op_type" "RI")])
407 (define_insn "*tmqi_ext"
409 (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,S")
410 (match_operand:SI 1 "const_int_operand" "n,n")
411 (match_operand:SI 2 "const_int_operand" "n,n"))
413 "s390_match_ccmode(insn, CCTmode)
414 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
415 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
417 int block = (1 << INTVAL (operands[1])) - 1;
418 int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
420 operands[2] = GEN_INT (block << shift);
421 return which_alternative == 0 ? "tm\t%0,%b2" : "tmy\t%0,%b2";
423 [(set_attr "op_type" "SI,SIY")])
425 ; Test-under-Mask instructions
427 (define_insn "*tmdi_mem"
429 (compare (and:DI (match_operand:DI 0 "memory_operand" "Q,S")
430 (match_operand:DI 1 "immediate_operand" "n,n"))
431 (match_operand:DI 2 "immediate_operand" "n,n")))]
433 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
434 && s390_single_qi (operands[1], DImode, 0) >= 0"
436 int part = s390_single_qi (operands[1], DImode, 0);
437 operands[1] = GEN_INT (s390_extract_qi (operands[1], DImode, part));
439 operands[0] = gen_rtx_MEM (QImode,
440 plus_constant (XEXP (operands[0], 0), part));
441 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
443 [(set_attr "op_type" "SI,SIY")])
445 (define_insn "*tmsi_mem"
447 (compare (and:SI (match_operand:SI 0 "memory_operand" "Q,S")
448 (match_operand:SI 1 "immediate_operand" "n,n"))
449 (match_operand:SI 2 "immediate_operand" "n,n")))]
450 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
451 && s390_single_qi (operands[1], SImode, 0) >= 0"
453 int part = s390_single_qi (operands[1], SImode, 0);
454 operands[1] = GEN_INT (s390_extract_qi (operands[1], SImode, part));
456 operands[0] = gen_rtx_MEM (QImode,
457 plus_constant (XEXP (operands[0], 0), part));
458 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
460 [(set_attr "op_type" "SI")])
462 (define_insn "*tmhi_mem"
464 (compare (and:SI (subreg:SI (match_operand:HI 0 "memory_operand" "Q,S") 0)
465 (match_operand:SI 1 "immediate_operand" "n,n"))
466 (match_operand:SI 2 "immediate_operand" "n,n")))]
467 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
468 && s390_single_qi (operands[1], HImode, 0) >= 0"
470 int part = s390_single_qi (operands[1], HImode, 0);
471 operands[1] = GEN_INT (s390_extract_qi (operands[1], HImode, part));
473 operands[0] = gen_rtx_MEM (QImode,
474 plus_constant (XEXP (operands[0], 0), part));
475 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
477 [(set_attr "op_type" "SI")])
479 (define_insn "*tmqi_mem"
481 (compare (and:SI (subreg:SI (match_operand:QI 0 "memory_operand" "Q,S") 0)
482 (match_operand:SI 1 "immediate_operand" "n,n"))
483 (match_operand:SI 2 "immediate_operand" "n,n")))]
484 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))"
488 [(set_attr "op_type" "SI,SIY")])
490 (define_insn "*tmdi_reg"
492 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d")
493 (match_operand:DI 1 "immediate_operand" "n"))
494 (match_operand:DI 2 "immediate_operand" "n")))]
496 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
497 && s390_single_hi (operands[1], DImode, 0) >= 0"
499 int part = s390_single_hi (operands[1], DImode, 0);
500 operands[1] = GEN_INT (s390_extract_hi (operands[1], DImode, part));
504 case 0: return "tmhh\t%0,%x1";
505 case 1: return "tmhl\t%0,%x1";
506 case 2: return "tmlh\t%0,%x1";
507 case 3: return "tmll\t%0,%x1";
511 [(set_attr "op_type" "RI")])
513 (define_insn "*tmsi_reg"
515 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d")
516 (match_operand:SI 1 "immediate_operand" "n"))
517 (match_operand:SI 2 "immediate_operand" "n")))]
518 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
519 && s390_single_hi (operands[1], SImode, 0) >= 0"
521 int part = s390_single_hi (operands[1], SImode, 0);
522 operands[1] = GEN_INT (s390_extract_hi (operands[1], SImode, part));
526 case 0: return "tmh\t%0,%x1";
527 case 1: return "tml\t%0,%x1";
531 [(set_attr "op_type" "RI")])
533 (define_insn "*tmhi_full"
535 (compare (match_operand:HI 0 "register_operand" "d")
536 (match_operand:HI 1 "immediate_operand" "n")))]
537 "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
539 [(set_attr "op_type" "RX")])
541 (define_insn "*tmqi_full"
543 (compare (match_operand:QI 0 "register_operand" "d")
544 (match_operand:QI 1 "immediate_operand" "n")))]
545 "s390_match_ccmode (insn, s390_tm_ccmode (GEN_INT (-1), operands[1], 1))"
547 [(set_attr "op_type" "RI")])
550 ; Load-and-Test instructions
552 (define_insn "*tstdi_sign"
554 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
555 (const_int 32)) (const_int 32))
556 (match_operand:DI 1 "const0_operand" "")))
557 (set (match_operand:DI 2 "register_operand" "=d")
558 (sign_extend:DI (match_dup 0)))]
559 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
561 [(set_attr "op_type" "RRE")])
563 (define_insn "*tstdi"
565 (compare (match_operand:DI 0 "register_operand" "d")
566 (match_operand:DI 1 "const0_operand" "")))
567 (set (match_operand:DI 2 "register_operand" "=d")
569 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
571 [(set_attr "op_type" "RRE")])
573 (define_insn "*tstdi_cconly"
575 (compare (match_operand:DI 0 "register_operand" "d")
576 (match_operand:DI 1 "const0_operand" "")))]
577 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
579 [(set_attr "op_type" "RRE")])
581 (define_insn "*tstdi_cconly_31"
583 (compare (match_operand:DI 0 "register_operand" "d")
584 (match_operand:DI 1 "const0_operand" "")))]
585 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
587 [(set_attr "op_type" "RS")
588 (set_attr "atype" "reg")])
591 (define_insn "*tstsi"
593 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
594 (match_operand:SI 1 "const0_operand" "")))
595 (set (match_operand:SI 2 "register_operand" "=d,d,d")
597 "s390_match_ccmode(insn, CCSmode)"
602 [(set_attr "op_type" "RR,RS,RSY")])
604 (define_insn "*tstsi_cconly"
606 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
607 (match_operand:SI 1 "const0_operand" "")))
608 (clobber (match_scratch:SI 2 "=X,d,d"))]
609 "s390_match_ccmode(insn, CCSmode)"
614 [(set_attr "op_type" "RR,RS,RSY")])
616 (define_insn "*tstsi_cconly2"
618 (compare (match_operand:SI 0 "register_operand" "d")
619 (match_operand:SI 1 "const0_operand" "")))]
620 "s390_match_ccmode(insn, CCSmode)"
622 [(set_attr "op_type" "RR")])
624 (define_insn "*tsthiCCT"
626 (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d")
627 (match_operand:HI 1 "const0_operand" "")))
628 (set (match_operand:HI 2 "register_operand" "=d,d,0")
630 "s390_match_ccmode(insn, CCTmode)"
635 [(set_attr "op_type" "RS,RSY,RI")])
637 (define_insn "*tsthiCCT_cconly"
639 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
640 (match_operand:HI 1 "const0_operand" "")))
641 (clobber (match_scratch:HI 2 "=d,d,X"))]
642 "s390_match_ccmode(insn, CCTmode)"
647 [(set_attr "op_type" "RS,RSY,RI")])
649 (define_insn "*tsthi"
651 (compare (match_operand:HI 0 "s_operand" "Q,S")
652 (match_operand:HI 1 "const0_operand" "")))
653 (set (match_operand:HI 2 "register_operand" "=d,d")
655 "s390_match_ccmode(insn, CCSmode)"
659 [(set_attr "op_type" "RS,RSY")])
661 (define_insn "*tsthi_cconly"
663 (compare (match_operand:HI 0 "s_operand" "Q,S")
664 (match_operand:HI 1 "const0_operand" "")))
665 (clobber (match_scratch:HI 2 "=d,d"))]
666 "s390_match_ccmode(insn, CCSmode)"
670 [(set_attr "op_type" "RS,RSY")])
672 (define_insn "*tstqiCCT"
674 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
675 (match_operand:QI 1 "const0_operand" "")))
676 (set (match_operand:QI 2 "register_operand" "=d,d,0")
678 "s390_match_ccmode(insn, CCTmode)"
683 [(set_attr "op_type" "RS,RSY,RI")])
685 (define_insn "*tstqiCCT_cconly"
687 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
688 (match_operand:QI 1 "const0_operand" "")))]
689 "s390_match_ccmode(insn, CCTmode)"
694 [(set_attr "op_type" "SI,SIY,RI")])
696 (define_insn "*tstqi"
698 (compare (match_operand:QI 0 "s_operand" "Q,S")
699 (match_operand:QI 1 "const0_operand" "")))
700 (set (match_operand:QI 2 "register_operand" "=d,d")
702 "s390_match_ccmode(insn, CCSmode)"
706 [(set_attr "op_type" "RS,RSY")])
708 (define_insn "*tstqi_cconly"
710 (compare (match_operand:QI 0 "s_operand" "Q,S")
711 (match_operand:QI 1 "const0_operand" "")))
712 (clobber (match_scratch:QI 2 "=d,d"))]
713 "s390_match_ccmode(insn, CCSmode)"
717 [(set_attr "op_type" "RS,RSY")])
720 ; Compare (signed) instructions
722 (define_insn "*cmpdi_ccs_sign"
724 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
725 (match_operand:DI 0 "register_operand" "d,d")))]
726 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
730 [(set_attr "op_type" "RRE,RXY")])
732 (define_insn "*cmpdi_ccs"
734 (compare (match_operand:DI 0 "register_operand" "d,d,d")
735 (match_operand:DI 1 "general_operand" "d,K,m")))]
736 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
741 [(set_attr "op_type" "RRE,RI,RXY")])
743 (define_insn "*cmpsi_ccs_sign"
745 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
746 (match_operand:SI 0 "register_operand" "d,d")))]
747 "s390_match_ccmode(insn, CCSRmode)"
751 [(set_attr "op_type" "RX,RXY")])
753 (define_insn "*cmpsi_ccs"
755 (compare (match_operand:SI 0 "register_operand" "d,d,d,d")
756 (match_operand:SI 1 "general_operand" "d,K,R,T")))]
757 "s390_match_ccmode(insn, CCSmode)"
763 [(set_attr "op_type" "RR,RI,RX,RXY")])
766 ; Compare (unsigned) instructions
768 (define_insn "*cmpdi_ccu_zero"
770 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
771 (match_operand:DI 0 "register_operand" "d,d")))]
772 "s390_match_ccmode(insn, CCURmode) && TARGET_64BIT"
776 [(set_attr "op_type" "RRE,RXY")])
778 (define_insn "*cmpdi_ccu"
780 (compare (match_operand:DI 0 "register_operand" "d,d")
781 (match_operand:DI 1 "general_operand" "d,m")))]
782 "s390_match_ccmode(insn, CCUmode) && TARGET_64BIT"
786 [(set_attr "op_type" "RRE,RXY")])
788 (define_insn "*cmpsi_ccu"
790 (compare (match_operand:SI 0 "register_operand" "d,d,d")
791 (match_operand:SI 1 "general_operand" "d,R,T")))]
792 "s390_match_ccmode(insn, CCUmode)"
797 [(set_attr "op_type" "RR,RX,RXY")])
799 (define_insn "*cmphi_ccu"
801 (compare (match_operand:HI 0 "register_operand" "d,d")
802 (match_operand:HI 1 "s_imm_operand" "Q,S")))]
803 "s390_match_ccmode(insn, CCUmode)"
807 [(set_attr "op_type" "RS,RSY")])
809 (define_insn "*cmpqi_ccu"
811 (compare (match_operand:QI 0 "register_operand" "d,d")
812 (match_operand:QI 1 "s_imm_operand" "Q,S")))]
813 "s390_match_ccmode(insn, CCUmode)"
817 [(set_attr "op_type" "RS,RSY")])
821 (compare (match_operand:QI 0 "memory_operand" "Q,S")
822 (match_operand:QI 1 "immediate_operand" "n,n")))]
823 "s390_match_ccmode (insn, CCUmode)"
827 [(set_attr "op_type" "SI,SIY")])
829 (define_insn "*cmpdi_ccu_mem"
831 (compare (match_operand:DI 0 "s_operand" "Q")
832 (match_operand:DI 1 "s_imm_operand" "Q")))]
833 "s390_match_ccmode(insn, CCUmode)"
835 [(set_attr "op_type" "SS")])
837 (define_insn "*cmpsi_ccu_mem"
839 (compare (match_operand:SI 0 "s_operand" "Q")
840 (match_operand:SI 1 "s_imm_operand" "Q")))]
841 "s390_match_ccmode(insn, CCUmode)"
843 [(set_attr "op_type" "SS")])
845 (define_insn "*cmphi_ccu_mem"
847 (compare (match_operand:HI 0 "s_operand" "Q")
848 (match_operand:HI 1 "s_imm_operand" "Q")))]
849 "s390_match_ccmode(insn, CCUmode)"
851 [(set_attr "op_type" "SS")])
853 (define_insn "*cmpqi_ccu_mem"
855 (compare (match_operand:QI 0 "s_operand" "Q")
856 (match_operand:QI 1 "s_imm_operand" "Q")))]
857 "s390_match_ccmode(insn, CCUmode)"
859 [(set_attr "op_type" "SS")])
864 (define_insn "*cmpdf_ccs_0"
866 (compare (match_operand:DF 0 "register_operand" "f")
867 (match_operand:DF 1 "const0_operand" "")))]
868 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
870 [(set_attr "op_type" "RRE")
871 (set_attr "type" "fsimpd")])
873 (define_insn "*cmpdf_ccs_0_ibm"
875 (compare (match_operand:DF 0 "register_operand" "f")
876 (match_operand:DF 1 "const0_operand" "")))]
877 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
879 [(set_attr "op_type" "RR")
880 (set_attr "type" "fsimpd")])
882 (define_insn "*cmpdf_ccs"
884 (compare (match_operand:DF 0 "register_operand" "f,f")
885 (match_operand:DF 1 "general_operand" "f,R")))]
886 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
890 [(set_attr "op_type" "RRE,RXE")
891 (set_attr "type" "fsimpd")])
893 (define_insn "*cmpdf_ccs_ibm"
895 (compare (match_operand:DF 0 "register_operand" "f,f")
896 (match_operand:DF 1 "general_operand" "f,R")))]
897 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
901 [(set_attr "op_type" "RR,RX")
902 (set_attr "type" "fsimpd")])
907 (define_insn "*cmpsf_ccs_0"
909 (compare (match_operand:SF 0 "register_operand" "f")
910 (match_operand:SF 1 "const0_operand" "")))]
911 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
913 [(set_attr "op_type" "RRE")
914 (set_attr "type" "fsimps")])
916 (define_insn "*cmpsf_ccs_0_ibm"
918 (compare (match_operand:SF 0 "register_operand" "f")
919 (match_operand:SF 1 "const0_operand" "")))]
920 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
922 [(set_attr "op_type" "RR")
923 (set_attr "type" "fsimps")])
925 (define_insn "*cmpsf_ccs"
927 (compare (match_operand:SF 0 "register_operand" "f,f")
928 (match_operand:SF 1 "general_operand" "f,R")))]
929 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
933 [(set_attr "op_type" "RRE,RXE")
934 (set_attr "type" "fsimps")])
936 (define_insn "*cmpsf_ccs"
938 (compare (match_operand:SF 0 "register_operand" "f,f")
939 (match_operand:SF 1 "general_operand" "f,R")))]
940 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
944 [(set_attr "op_type" "RR,RX")
945 (set_attr "type" "fsimps")])
949 ;;- Move instructions.
953 ; movti instruction pattern(s).
957 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
958 (match_operand:TI 1 "general_operand" "QS,d,dKm,d,Q"))]
966 [(set_attr "op_type" "RSY,RSY,NN,NN,SS")
967 (set_attr "type" "lm,stm,*,*,cs")])
970 [(set (match_operand:TI 0 "nonimmediate_operand" "")
971 (match_operand:TI 1 "general_operand" ""))]
972 "TARGET_64BIT && reload_completed
973 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
974 [(set (match_dup 2) (match_dup 4))
975 (set (match_dup 3) (match_dup 5))]
977 operands[2] = operand_subword (operands[0], 0, 0, TImode);
978 operands[3] = operand_subword (operands[0], 1, 0, TImode);
979 operands[4] = operand_subword (operands[1], 0, 0, TImode);
980 operands[5] = operand_subword (operands[1], 1, 0, TImode);
984 [(set (match_operand:TI 0 "nonimmediate_operand" "")
985 (match_operand:TI 1 "general_operand" ""))]
986 "TARGET_64BIT && reload_completed
987 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
988 [(set (match_dup 2) (match_dup 4))
989 (set (match_dup 3) (match_dup 5))]
991 operands[2] = operand_subword (operands[0], 1, 0, TImode);
992 operands[3] = operand_subword (operands[0], 0, 0, TImode);
993 operands[4] = operand_subword (operands[1], 1, 0, TImode);
994 operands[5] = operand_subword (operands[1], 0, 0, TImode);
998 [(set (match_operand:TI 0 "register_operand" "")
999 (match_operand:TI 1 "memory_operand" ""))]
1000 "TARGET_64BIT && reload_completed
1001 && !s_operand (operands[1], VOIDmode)"
1002 [(set (match_dup 0) (match_dup 1))]
1004 rtx addr = operand_subword (operands[0], 1, 0, TImode);
1005 s390_load_address (addr, XEXP (operands[1], 0));
1006 operands[1] = replace_equiv_address (operands[1], addr);
1009 (define_expand "reload_outti"
1010 [(parallel [(match_operand:TI 0 "memory_operand" "")
1011 (match_operand:TI 1 "register_operand" "d")
1012 (match_operand:DI 2 "register_operand" "=&a")])]
1015 s390_load_address (operands[2], XEXP (operands[0], 0));
1016 operands[0] = replace_equiv_address (operands[0], operands[2]);
1017 emit_move_insn (operands[0], operands[1]);
1022 ; movdi instruction pattern(s).
1025 (define_expand "movdi"
1026 [(set (match_operand:DI 0 "general_operand" "")
1027 (match_operand:DI 1 "general_operand" ""))]
1030 /* Handle symbolic constants. */
1031 if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1032 emit_symbolic_move (operands);
1034 /* During and after reload, we need to force constants
1035 to the literal pool ourselves, if necessary. */
1036 if ((reload_in_progress || reload_completed)
1037 && CONSTANT_P (operands[1])
1038 && (!legitimate_reload_constant_p (operands[1])
1039 || FP_REG_P (operands[0])))
1040 operands[1] = force_const_mem (DImode, operands[1]);
1043 (define_insn "*movdi_lhi"
1044 [(set (match_operand:DI 0 "register_operand" "=d")
1045 (match_operand:DI 1 "immediate_operand" "K"))]
1047 && GET_CODE (operands[1]) == CONST_INT
1048 && CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K')
1049 && !FP_REG_P (operands[0])"
1051 [(set_attr "op_type" "RI")])
1053 (define_insn "*movdi_lli"
1054 [(set (match_operand:DI 0 "register_operand" "=d")
1055 (match_operand:DI 1 "immediate_operand" "n"))]
1056 "TARGET_64BIT && s390_single_hi (operands[1], DImode, 0) >= 0
1057 && !FP_REG_P (operands[0])"
1059 int part = s390_single_hi (operands[1], DImode, 0);
1060 operands[1] = GEN_INT (s390_extract_hi (operands[1], DImode, part));
1064 case 0: return "llihh\t%0,%x1";
1065 case 1: return "llihl\t%0,%x1";
1066 case 2: return "llilh\t%0,%x1";
1067 case 3: return "llill\t%0,%x1";
1071 [(set_attr "op_type" "RI")])
1073 (define_insn "*movdi_lay"
1074 [(set (match_operand:DI 0 "register_operand" "=d")
1075 (match_operand:DI 1 "address_operand" "p"))]
1077 && TARGET_LONG_DISPLACEMENT
1078 && GET_CODE (operands[1]) == CONST_INT
1079 && !FP_REG_P (operands[0])"
1081 [(set_attr "op_type" "RXY")
1082 (set_attr "type" "la")])
1084 (define_insn "*movdi_larl"
1085 [(set (match_operand:DI 0 "register_operand" "=d")
1086 (match_operand:DI 1 "larl_operand" "X"))]
1088 && !FP_REG_P (operands[0])"
1090 [(set_attr "op_type" "RIL")
1091 (set_attr "type" "larl")])
1093 (define_insn "*movdi_64"
1094 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,m,!*f,!*f,!*f,!R,!T,?Q")
1095 (match_operand:DI 1 "general_operand" "d,m,d,*f,R,T,*f,*f,?Q"))]
1107 [(set_attr "op_type" "RRE,RXY,RXY,RR,RX,RXY,RX,RXY,SS")
1108 (set_attr "type" "lr,load,store,floadd,floadd,floadd,fstored,fstored,cs")])
1110 (define_insn "*movdi_31"
1111 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,o,!*f,!*f,!*f,!R,!T,Q")
1112 (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,R,T,*f,*f,Q"))]
1125 [(set_attr "op_type" "RS,RS,NN,NN,RR,RX,RXY,RX,RXY,SS")
1126 (set_attr "type" "lm,stm,*,*,floadd,floadd,floadd,fstored,fstored,cs")])
1129 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1130 (match_operand:DI 1 "general_operand" ""))]
1131 "!TARGET_64BIT && reload_completed
1132 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1133 [(set (match_dup 2) (match_dup 4))
1134 (set (match_dup 3) (match_dup 5))]
1136 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1137 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1138 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1139 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1143 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1144 (match_operand:DI 1 "general_operand" ""))]
1145 "!TARGET_64BIT && reload_completed
1146 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1147 [(set (match_dup 2) (match_dup 4))
1148 (set (match_dup 3) (match_dup 5))]
1150 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1151 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1152 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1153 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1157 [(set (match_operand:DI 0 "register_operand" "")
1158 (match_operand:DI 1 "memory_operand" ""))]
1159 "!TARGET_64BIT && reload_completed
1160 && !FP_REG_P (operands[0])
1161 && !s_operand (operands[1], VOIDmode)"
1162 [(set (match_dup 0) (match_dup 1))]
1164 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1165 s390_load_address (addr, XEXP (operands[1], 0));
1166 operands[1] = replace_equiv_address (operands[1], addr);
1169 (define_expand "reload_outdi"
1170 [(parallel [(match_operand:DI 0 "memory_operand" "")
1171 (match_operand:DI 1 "register_operand" "d")
1172 (match_operand:SI 2 "register_operand" "=&a")])]
1175 s390_load_address (operands[2], XEXP (operands[0], 0));
1176 operands[0] = replace_equiv_address (operands[0], operands[2]);
1177 emit_move_insn (operands[0], operands[1]);
1182 [(set (match_operand:DI 0 "register_operand" "")
1183 (mem:DI (match_operand 1 "address_operand" "")))]
1185 && !FP_REG_P (operands[0])
1186 && GET_CODE (operands[1]) == SYMBOL_REF
1187 && CONSTANT_POOL_ADDRESS_P (operands[1])
1188 && get_pool_mode (operands[1]) == DImode
1189 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1190 [(set (match_dup 0) (match_dup 2))]
1191 "operands[2] = get_pool_constant (operands[1]);")
1194 ; movsi instruction pattern(s).
1197 (define_expand "movsi"
1198 [(set (match_operand:SI 0 "general_operand" "")
1199 (match_operand:SI 1 "general_operand" ""))]
1202 /* Handle symbolic constants. */
1203 if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1204 emit_symbolic_move (operands);
1206 /* expr.c tries to load an effective address using
1207 force_reg. This fails because we don't have a
1208 generic load_address pattern. Convert the move
1209 to a proper arithmetic operation instead, unless
1210 it is guaranteed to be OK. */
1211 if (GET_CODE (operands[1]) == PLUS
1212 && !legitimate_la_operand_p (operands[1]))
1214 operands[1] = force_operand (operands[1], operands[0]);
1215 if (operands[1] == operands[0])
1219 /* During and after reload, we need to force constants
1220 to the literal pool ourselves, if necessary. */
1221 if ((reload_in_progress || reload_completed)
1222 && CONSTANT_P (operands[1])
1223 && (!legitimate_reload_constant_p (operands[1])
1224 || FP_REG_P (operands[0])))
1225 operands[1] = force_const_mem (SImode, operands[1]);
1228 (define_insn "*movsi_lhi"
1229 [(set (match_operand:SI 0 "register_operand" "=d")
1230 (match_operand:SI 1 "immediate_operand" "K"))]
1231 "GET_CODE (operands[1]) == CONST_INT
1232 && CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K')
1233 && !FP_REG_P (operands[0])"
1235 [(set_attr "op_type" "RI")])
1237 (define_insn "*movsi_lli"
1238 [(set (match_operand:SI 0 "register_operand" "=d")
1239 (match_operand:SI 1 "immediate_operand" "n"))]
1240 "TARGET_64BIT && s390_single_hi (operands[1], SImode, 0) >= 0
1241 && !FP_REG_P (operands[0])"
1243 int part = s390_single_hi (operands[1], SImode, 0);
1244 operands[1] = GEN_INT (s390_extract_hi (operands[1], SImode, part));
1248 case 0: return "llilh\t%0,%x1";
1249 case 1: return "llill\t%0,%x1";
1253 [(set_attr "op_type" "RI")])
1255 (define_insn "*movsi_lay"
1256 [(set (match_operand:SI 0 "register_operand" "=d")
1257 (match_operand:SI 1 "address_operand" "p"))]
1258 "TARGET_LONG_DISPLACEMENT
1259 && GET_CODE (operands[1]) == CONST_INT
1260 && !FP_REG_P (operands[0])"
1262 [(set_attr "op_type" "RXY")
1263 (set_attr "type" "la")])
1265 (define_insn "*movsi"
1266 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,T,!*f,!*f,!*f,!R,!T,?Q")
1267 (match_operand:SI 1 "general_operand" "d,R,T,d,d,*f,R,T,*f,*f,?Q"))]
1281 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1282 (set_attr "type" "lr,load,load,store,store,floads,floads,floads,fstores,fstores,cs")])
1285 [(set (match_operand:SI 0 "register_operand" "")
1286 (mem:SI (match_operand 1 "address_operand" "")))]
1287 "!FP_REG_P (operands[0])
1288 && GET_CODE (operands[1]) == SYMBOL_REF
1289 && CONSTANT_POOL_ADDRESS_P (operands[1])
1290 && get_pool_mode (operands[1]) == SImode
1291 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1292 [(set (match_dup 0) (match_dup 2))]
1293 "operands[2] = get_pool_constant (operands[1]);")
1296 ; movhi instruction pattern(s).
1299 (define_expand "movhi"
1300 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1301 (match_operand:HI 1 "general_operand" ""))]
1304 /* Make it explicit that loading a register from memory
1305 always sign-extends (at least) to SImode. */
1306 if (optimize && !no_new_pseudos
1307 && register_operand (operands[0], VOIDmode)
1308 && memory_operand (operands[1], VOIDmode))
1310 rtx tmp = gen_reg_rtx (SImode);
1311 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1312 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1313 operands[1] = gen_lowpart (HImode, tmp);
1317 (define_insn "*movhi"
1318 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1319 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1329 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1330 (set_attr "type" "lr,*,*,*,store,store,cs")])
1333 [(set (match_operand:HI 0 "register_operand" "")
1334 (mem:HI (match_operand 1 "address_operand" "")))]
1335 "GET_CODE (operands[1]) == SYMBOL_REF
1336 && CONSTANT_POOL_ADDRESS_P (operands[1])
1337 && get_pool_mode (operands[1]) == HImode
1338 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1339 [(set (match_dup 0) (match_dup 2))]
1340 "operands[2] = get_pool_constant (operands[1]);")
1343 ; movqi instruction pattern(s).
1346 (define_expand "movqi"
1347 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1348 (match_operand:QI 1 "general_operand" ""))]
1351 /* On 64-bit, zero-extending from memory to register
1352 is just as fast as a QImode load. */
1353 if (TARGET_64BIT && optimize && !no_new_pseudos
1354 && register_operand (operands[0], VOIDmode)
1355 && memory_operand (operands[1], VOIDmode))
1357 rtx tmp = gen_reg_rtx (DImode);
1358 rtx ext = gen_rtx_ZERO_EXTEND (DImode, operands[1]);
1359 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1360 operands[1] = gen_lowpart (QImode, tmp);
1364 (define_insn "*movqi"
1365 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1366 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1378 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1379 (set_attr "type" "lr,*,*,*,store,store,store,store,cs")])
1382 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1383 (mem:QI (match_operand 1 "address_operand" "")))]
1384 "GET_CODE (operands[1]) == SYMBOL_REF
1385 && CONSTANT_POOL_ADDRESS_P (operands[1])
1386 && get_pool_mode (operands[1]) == QImode
1387 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1388 [(set (match_dup 0) (match_dup 2))]
1389 "operands[2] = get_pool_constant (operands[1]);")
1392 ; movstrictqi instruction pattern(s).
1395 (define_insn "*movstrictqi"
1396 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1397 (match_operand:QI 1 "memory_operand" "R,T"))]
1402 [(set_attr "op_type" "RX,RXY")])
1405 ; movstricthi instruction pattern(s).
1408 (define_insn "*movstricthi"
1409 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1410 (match_operand:HI 1 "s_imm_operand" "Q,S"))
1411 (clobber (reg:CC 33))]
1416 [(set_attr "op_type" "RS,RSY")])
1419 ; movstrictsi instruction pattern(s).
1422 (define_insn "movstrictsi"
1423 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d"))
1424 (match_operand:SI 1 "general_operand" "d,R,T"))]
1430 [(set_attr "op_type" "RR,RX,RXY")
1431 (set_attr "type" "lr,load,load")])
1434 ; movdf instruction pattern(s).
1437 (define_expand "movdf"
1438 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1439 (match_operand:DF 1 "general_operand" ""))]
1442 /* During and after reload, we need to force constants
1443 to the literal pool ourselves, if necessary. */
1444 if ((reload_in_progress || reload_completed)
1445 && CONSTANT_P (operands[1]))
1446 operands[1] = force_const_mem (DFmode, operands[1]);
1449 (define_insn "*movdf_64"
1450 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1451 (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1463 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1464 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,cs")])
1466 (define_insn "*movdf_31"
1467 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1468 (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1481 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,NN,NN,SS")
1482 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,cs")])
1485 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1486 (match_operand:DF 1 "general_operand" ""))]
1487 "!TARGET_64BIT && reload_completed
1488 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1489 [(set (match_dup 2) (match_dup 4))
1490 (set (match_dup 3) (match_dup 5))]
1492 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1493 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1494 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1495 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1499 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1500 (match_operand:DF 1 "general_operand" ""))]
1501 "!TARGET_64BIT && reload_completed
1502 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1503 [(set (match_dup 2) (match_dup 4))
1504 (set (match_dup 3) (match_dup 5))]
1506 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1507 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1508 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1509 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1513 [(set (match_operand:DF 0 "register_operand" "")
1514 (match_operand:DF 1 "memory_operand" ""))]
1515 "!TARGET_64BIT && reload_completed
1516 && !FP_REG_P (operands[0])
1517 && !s_operand (operands[1], VOIDmode)"
1518 [(set (match_dup 0) (match_dup 1))]
1520 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1521 s390_load_address (addr, XEXP (operands[1], 0));
1522 operands[1] = replace_equiv_address (operands[1], addr);
1525 (define_expand "reload_outdf"
1526 [(parallel [(match_operand:DF 0 "memory_operand" "")
1527 (match_operand:DF 1 "register_operand" "d")
1528 (match_operand:SI 2 "register_operand" "=&a")])]
1531 s390_load_address (operands[2], XEXP (operands[0], 0));
1532 operands[0] = replace_equiv_address (operands[0], operands[2]);
1533 emit_move_insn (operands[0], operands[1]);
1538 ; movsf instruction pattern(s).
1541 (define_expand "movsf"
1542 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1543 (match_operand:SF 1 "general_operand" ""))]
1546 /* During and after reload, we need to force constants
1547 to the literal pool ourselves, if necessary. */
1548 if ((reload_in_progress || reload_completed)
1549 && CONSTANT_P (operands[1]))
1550 operands[1] = force_const_mem (SFmode, operands[1]);
1553 (define_insn "*movsf"
1554 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1555 (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1569 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1570 (set_attr "type" "floads,floads,floads,fstores,fstores,lr,load,load,store,store,cs")])
1573 ; load_multiple pattern(s).
1576 (define_expand "load_multiple"
1577 [(match_par_dup 3 [(set (match_operand 0 "" "")
1578 (match_operand 1 "" ""))
1579 (use (match_operand 2 "" ""))])]
1587 /* Support only loading a constant number of fixed-point registers from
1588 memory and only bother with this if more than two */
1589 if (GET_CODE (operands[2]) != CONST_INT
1590 || INTVAL (operands[2]) < 2
1591 || INTVAL (operands[2]) > 16
1592 || GET_CODE (operands[1]) != MEM
1593 || GET_CODE (operands[0]) != REG
1594 || REGNO (operands[0]) >= 16)
1597 count = INTVAL (operands[2]);
1598 regno = REGNO (operands[0]);
1600 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1603 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1605 from = XEXP (operands[1], 0);
1608 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1609 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1610 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1612 from = XEXP (XEXP (operands[1], 0), 0);
1613 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1618 if (from == frame_pointer_rtx || from == arg_pointer_rtx)
1623 from = force_reg (Pmode, XEXP (operands[1], 0));
1627 for (i = 0; i < count; i++)
1628 XVECEXP (operands[3], 0, i)
1629 = gen_rtx_SET (VOIDmode, gen_rtx_REG (Pmode, regno + i),
1630 change_address (operands[1], Pmode,
1631 plus_constant (from,
1632 off + i * UNITS_PER_WORD)));
1635 (define_insn "*load_multiple_di"
1636 [(match_parallel 0 "load_multiple_operation"
1637 [(set (match_operand:DI 1 "register_operand" "=r")
1638 (match_operand:DI 2 "s_operand" "QS"))])]
1641 int words = XVECLEN (operands[0], 0);
1642 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1643 return "lmg\t%1,%0,%2";
1645 [(set_attr "op_type" "RSY")
1646 (set_attr "type" "lm")])
1648 (define_insn "*load_multiple_si"
1649 [(match_parallel 0 "load_multiple_operation"
1650 [(set (match_operand:SI 1 "register_operand" "=r,r")
1651 (match_operand:SI 2 "s_operand" "Q,S"))])]
1654 int words = XVECLEN (operands[0], 0);
1655 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1656 return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1658 [(set_attr "op_type" "RS,RSY")
1659 (set_attr "type" "lm")])
1662 ; store multiple pattern(s).
1665 (define_expand "store_multiple"
1666 [(match_par_dup 3 [(set (match_operand 0 "" "")
1667 (match_operand 1 "" ""))
1668 (use (match_operand 2 "" ""))])]
1676 /* Support only storing a constant number of fixed-point registers to
1677 memory and only bother with this if more than two. */
1678 if (GET_CODE (operands[2]) != CONST_INT
1679 || INTVAL (operands[2]) < 2
1680 || INTVAL (operands[2]) > 16
1681 || GET_CODE (operands[0]) != MEM
1682 || GET_CODE (operands[1]) != REG
1683 || REGNO (operands[1]) >= 16)
1686 count = INTVAL (operands[2]);
1687 regno = REGNO (operands[1]);
1689 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1693 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1695 to = XEXP (operands[0], 0);
1698 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1699 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1700 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1702 to = XEXP (XEXP (operands[0], 0), 0);
1703 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1708 if (to == frame_pointer_rtx || to == arg_pointer_rtx)
1713 to = force_reg (Pmode, XEXP (operands[0], 0));
1717 for (i = 0; i < count; i++)
1718 XVECEXP (operands[3], 0, i)
1719 = gen_rtx_SET (VOIDmode,
1720 change_address (operands[0], Pmode,
1722 off + i * UNITS_PER_WORD)),
1723 gen_rtx_REG (Pmode, regno + i));
1726 (define_insn "*store_multiple_di"
1727 [(match_parallel 0 "store_multiple_operation"
1728 [(set (match_operand:DI 1 "s_operand" "=QS")
1729 (match_operand:DI 2 "register_operand" "r"))])]
1732 int words = XVECLEN (operands[0], 0);
1733 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1734 return "stmg\t%2,%0,%1";
1736 [(set_attr "op_type" "RSY")
1737 (set_attr "type" "stm")])
1740 (define_insn "*store_multiple_si"
1741 [(match_parallel 0 "store_multiple_operation"
1742 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1743 (match_operand:SI 2 "register_operand" "r,r"))])]
1746 int words = XVECLEN (operands[0], 0);
1747 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1748 return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1750 [(set_attr "op_type" "RS,RSY")
1751 (set_attr "type" "stm")])
1754 ;; String instructions.
1758 ; movstrM instruction pattern(s).
1761 (define_expand "movstrdi"
1762 [(set (match_operand:BLK 0 "memory_operand" "")
1763 (match_operand:BLK 1 "memory_operand" ""))
1764 (use (match_operand:DI 2 "general_operand" ""))
1765 (match_operand 3 "" "")]
1767 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1769 (define_expand "movstrsi"
1770 [(set (match_operand:BLK 0 "memory_operand" "")
1771 (match_operand:BLK 1 "memory_operand" ""))
1772 (use (match_operand:SI 2 "general_operand" ""))
1773 (match_operand 3 "" "")]
1775 "s390_expand_movstr (operands[0], operands[1], operands[2]); DONE;")
1777 ; Move a block that is up to 256 bytes in length.
1778 ; The block length is taken as (operands[2] % 256) + 1.
1780 (define_insn "movstr_short_64"
1781 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1782 (match_operand:BLK 1 "memory_operand" "Q,Q"))
1783 (use (match_operand:DI 2 "nonmemory_operand" "n,a"))
1784 (clobber (match_scratch:DI 3 "=X,&a"))]
1787 switch (which_alternative)
1790 return "mvc\t%O0(%b2+1,%R0),%1";
1793 output_asm_insn ("bras\t%3,.+10", operands);
1794 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
1795 return "ex\t%2,0(%3)";
1801 [(set_attr "op_type" "SS,NN")
1802 (set_attr "type" "cs,cs")
1803 (set_attr "atype" "*,agen")
1804 (set_attr "length" "*,14")])
1806 (define_insn "movstr_short_31"
1807 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1808 (match_operand:BLK 1 "memory_operand" "Q,Q"))
1809 (use (match_operand:SI 2 "nonmemory_operand" "n,a"))
1810 (clobber (match_scratch:SI 3 "=X,&a"))]
1813 switch (which_alternative)
1816 return "mvc\t%O0(%b2+1,%R0),%1";
1819 output_asm_insn ("bras\t%3,.+10", operands);
1820 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
1821 return "ex\t%2,0(%3)";
1827 [(set_attr "op_type" "SS,NN")
1828 (set_attr "type" "cs,cs")
1829 (set_attr "atype" "*,agen")
1830 (set_attr "length" "*,14")])
1832 ; Move a block of arbitrary length.
1834 (define_insn "movstr_long_64"
1835 [(set (match_operand:TI 0 "register_operand" "=d")
1836 (ashift:TI (plus:TI (match_operand:TI 2 "register_operand" "0")
1837 (lshiftrt:TI (match_dup 2) (const_int 64)))
1839 (set (match_operand:TI 1 "register_operand" "=d")
1840 (ashift:TI (plus:TI (match_operand:TI 3 "register_operand" "1")
1841 (lshiftrt:TI (match_dup 3) (const_int 64)))
1843 (set (mem:BLK (subreg:DI (match_dup 2) 0))
1844 (mem:BLK (subreg:DI (match_dup 3) 0)))
1845 (clobber (reg:CC 33))]
1847 "mvcle\t%0,%1,0\;jo\t.-4"
1848 [(set_attr "op_type" "NN")
1849 (set_attr "type" "vs")
1850 (set_attr "length" "8")])
1852 (define_insn "movstr_long_31"
1853 [(set (match_operand:DI 0 "register_operand" "=d")
1854 (ashift:DI (plus:DI (match_operand:DI 2 "register_operand" "0")
1855 (lshiftrt:DI (match_dup 2) (const_int 32)))
1857 (set (match_operand:DI 1 "register_operand" "=d")
1858 (ashift:DI (plus:DI (match_operand:DI 3 "register_operand" "1")
1859 (lshiftrt:DI (match_dup 3) (const_int 32)))
1861 (set (mem:BLK (subreg:SI (match_dup 2) 0))
1862 (mem:BLK (subreg:SI (match_dup 3) 0)))
1863 (clobber (reg:CC 33))]
1865 "mvcle\t%0,%1,0\;jo\t.-4"
1866 [(set_attr "op_type" "NN")
1867 (set_attr "type" "vs")
1868 (set_attr "length" "8")])
1871 ; clrstrM instruction pattern(s).
1874 (define_expand "clrstrdi"
1875 [(set (match_operand:BLK 0 "memory_operand" "")
1877 (use (match_operand:DI 1 "general_operand" ""))
1878 (match_operand 2 "" "")]
1880 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
1882 (define_expand "clrstrsi"
1883 [(set (match_operand:BLK 0 "memory_operand" "")
1885 (use (match_operand:SI 1 "general_operand" ""))
1886 (match_operand 2 "" "")]
1888 "s390_expand_clrstr (operands[0], operands[1]); DONE;")
1890 ; Clear a block that is up to 256 bytes in length.
1891 ; The block length is taken as (operands[2] % 256) + 1.
1893 (define_insn "clrstr_short_64"
1894 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1896 (use (match_operand:DI 1 "nonmemory_operand" "n,a"))
1897 (clobber (match_scratch:DI 2 "=X,&a"))
1898 (clobber (reg:CC 33))]
1901 switch (which_alternative)
1904 return "xc\t%O0(%b1+1,%R0),%0";
1907 output_asm_insn ("bras\t%2,.+10", operands);
1908 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
1909 return "ex\t%1,0(%2)";
1915 [(set_attr "op_type" "SS,NN")
1916 (set_attr "type" "cs,cs")
1917 (set_attr "atype" "*,agen")
1918 (set_attr "length" "*,14")])
1920 (define_insn "clrstr_short_31"
1921 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1923 (use (match_operand:SI 1 "nonmemory_operand" "n,a"))
1924 (clobber (match_scratch:SI 2 "=X,&a"))
1925 (clobber (reg:CC 33))]
1928 switch (which_alternative)
1931 return "xc\t%O0(%b1+1,%R0),%0";
1934 output_asm_insn ("bras\t%2,.+10", operands);
1935 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
1936 return "ex\t%1,0(%2)";
1942 [(set_attr "op_type" "SS,NN")
1943 (set_attr "type" "cs,cs")
1944 (set_attr "atype" "*,agen")
1945 (set_attr "length" "*,14")])
1947 ; Clear a block of arbitrary length.
1949 (define_insn "clrstr_long_64"
1950 [(set (match_operand:TI 0 "register_operand" "=d")
1951 (ashift:TI (plus:TI (match_operand:TI 2 "register_operand" "0")
1952 (lshiftrt:TI (match_dup 2) (const_int 64)))
1954 (set (mem:BLK (subreg:DI (match_dup 2) 0))
1956 (use (match_operand:TI 1 "register_operand" "d"))
1957 (clobber (reg:CC 33))]
1959 "mvcle\t%0,%1,0\;jo\t.-4"
1960 [(set_attr "op_type" "NN")
1961 (set_attr "type" "vs")
1962 (set_attr "length" "8")])
1964 (define_insn "clrstr_long_31"
1965 [(set (match_operand:DI 0 "register_operand" "=d")
1966 (ashift:DI (plus:DI (match_operand:DI 2 "register_operand" "0")
1967 (lshiftrt:DI (match_dup 2) (const_int 32)))
1969 (set (mem:BLK (subreg:SI (match_dup 2) 0))
1971 (use (match_operand:DI 1 "register_operand" "d"))
1972 (clobber (reg:CC 33))]
1974 "mvcle\t%0,%1,0\;jo\t.-4"
1975 [(set_attr "op_type" "NN")
1976 (set_attr "type" "vs")
1977 (set_attr "length" "8")])
1980 ; cmpmemM instruction pattern(s).
1983 (define_expand "cmpmemdi"
1984 [(set (match_operand:DI 0 "register_operand" "")
1985 (compare:DI (match_operand:BLK 1 "memory_operand" "")
1986 (match_operand:BLK 2 "memory_operand" "") ) )
1987 (use (match_operand:DI 3 "general_operand" ""))
1988 (use (match_operand:DI 4 "" ""))]
1990 "s390_expand_cmpmem (operands[0], operands[1],
1991 operands[2], operands[3]); DONE;")
1993 (define_expand "cmpmemsi"
1994 [(set (match_operand:SI 0 "register_operand" "")
1995 (compare:SI (match_operand:BLK 1 "memory_operand" "")
1996 (match_operand:BLK 2 "memory_operand" "") ) )
1997 (use (match_operand:SI 3 "general_operand" ""))
1998 (use (match_operand:SI 4 "" ""))]
2000 "s390_expand_cmpmem (operands[0], operands[1],
2001 operands[2], operands[3]); DONE;")
2003 ; Compare a block that is up to 256 bytes in length.
2004 ; The block length is taken as (operands[2] % 256) + 1.
2006 (define_insn "cmpmem_short_64"
2008 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2009 (match_operand:BLK 1 "memory_operand" "Q,Q")))
2010 (use (match_operand:DI 2 "nonmemory_operand" "n,a"))
2011 (clobber (match_scratch:DI 3 "=X,&a"))]
2014 switch (which_alternative)
2017 return "clc\t%O0(%b2+1,%R0),%1";
2020 output_asm_insn ("bras\t%3,.+10", operands);
2021 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2022 return "ex\t%2,0(%3)";
2028 [(set_attr "op_type" "SS,NN")
2029 (set_attr "type" "cs,cs")
2030 (set_attr "atype" "*,agen")
2031 (set_attr "length" "*,14")])
2033 (define_insn "cmpmem_short_31"
2035 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2036 (match_operand:BLK 1 "memory_operand" "Q,Q")))
2037 (use (match_operand:SI 2 "nonmemory_operand" "n,a"))
2038 (clobber (match_scratch:SI 3 "=X,&a"))]
2041 switch (which_alternative)
2044 return "clc\t%O0(%b2+1,%R0),%1";
2047 output_asm_insn ("bras\t%3,.+10", operands);
2048 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2049 return "ex\t%2,0(%3)";
2055 [(set_attr "op_type" "SS,NN")
2056 (set_attr "type" "cs,cs")
2057 (set_attr "atype" "*,agen")
2058 (set_attr "length" "*,14")])
2060 ; Compare a block of arbitrary length.
2062 (define_insn "cmpmem_long_64"
2063 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2064 (clobber (match_operand:TI 1 "register_operand" "=d"))
2066 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2067 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2069 (use (match_dup 3))]
2072 [(set_attr "op_type" "RR")
2073 (set_attr "type" "vs")])
2075 (define_insn "cmpmem_long_31"
2076 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2077 (clobber (match_operand:DI 1 "register_operand" "=d"))
2079 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2080 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2082 (use (match_dup 3))]
2085 [(set_attr "op_type" "RR")
2086 (set_attr "type" "vs")])
2088 ; Convert condition code to integer in range (-1, 0, 1)
2090 (define_insn "cmpint_si"
2091 [(set (match_operand:SI 0 "register_operand" "=d")
2092 (compare:SI (reg:CCS 33) (const_int 0)))]
2095 output_asm_insn ("lhi\t%0,1", operands);
2096 output_asm_insn ("jh\t.+12", operands);
2097 output_asm_insn ("jl\t.+6", operands);
2098 output_asm_insn ("sr\t%0,%0", operands);
2099 return "lcr\t%0,%0";
2101 [(set_attr "op_type" "NN")
2102 (set_attr "length" "16")
2103 (set_attr "type" "other")])
2105 (define_insn "cmpint_di"
2106 [(set (match_operand:DI 0 "register_operand" "=d")
2107 (compare:DI (reg:CCS 33) (const_int 0)))]
2110 output_asm_insn ("lghi\t%0,1", operands);
2111 output_asm_insn ("jh\t.+12", operands);
2112 output_asm_insn ("jl\t.+6", operands);
2113 output_asm_insn ("sgr\t%0,%0", operands);
2114 return "lcgr\t%0,%0";
2116 [(set_attr "op_type" "NN")
2117 (set_attr "length" "22")
2118 (set_attr "type" "other")])
2122 ;;- Conversion instructions.
2125 (define_insn "*sethighqisi"
2126 [(set (match_operand:SI 0 "register_operand" "=d,d")
2127 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2128 (clobber (reg:CC 33))]
2133 [(set_attr "op_type" "RS,RSY")])
2135 (define_insn "*sethighhisi"
2136 [(set (match_operand:SI 0 "register_operand" "=d,d")
2137 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2138 (clobber (reg:CC 33))]
2143 [(set_attr "op_type" "RS,RSY")])
2145 (define_insn "*sethighqidi_64"
2146 [(set (match_operand:DI 0 "register_operand" "=d")
2147 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2148 (clobber (reg:CC 33))]
2151 [(set_attr "op_type" "RSY")])
2153 (define_insn "*sethighqidi_31"
2154 [(set (match_operand:DI 0 "register_operand" "=d,d")
2155 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2156 (clobber (reg:CC 33))]
2161 [(set_attr "op_type" "RS,RSY")])
2163 (define_insn_and_split "*extractqi"
2164 [(set (match_operand:SI 0 "register_operand" "=d")
2165 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2166 (match_operand 2 "const_int_operand" "n")
2168 (clobber (reg:CC 33))]
2170 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2172 "&& reload_completed"
2174 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2175 (clobber (reg:CC 33))])
2176 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2178 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2179 operands[1] = change_address (operands[1], QImode, 0);
2181 [(set_attr "atype" "agen")])
2183 (define_insn_and_split "*extracthi"
2184 [(set (match_operand:SI 0 "register_operand" "=d")
2185 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2186 (match_operand 2 "const_int_operand" "n")
2188 (clobber (reg:CC 33))]
2190 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2192 "&& reload_completed"
2194 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2195 (clobber (reg:CC 33))])
2196 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2198 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2199 operands[1] = change_address (operands[1], HImode, 0);
2201 [(set_attr "atype" "agen")])
2204 ; extendsidi2 instruction pattern(s).
2207 (define_expand "extendsidi2"
2208 [(set (match_operand:DI 0 "register_operand" "")
2209 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2215 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2216 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2217 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2218 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2224 (define_insn "*extendsidi2"
2225 [(set (match_operand:DI 0 "register_operand" "=d,d")
2226 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2231 [(set_attr "op_type" "RRE,RXY")])
2234 ; extendhidi2 instruction pattern(s).
2237 (define_expand "extendhidi2"
2238 [(set (match_operand:DI 0 "register_operand" "")
2239 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2245 rtx tmp = gen_reg_rtx (SImode);
2246 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2247 emit_insn (gen_extendsidi2 (operands[0], tmp));
2252 operands[1] = gen_lowpart (DImode, operands[1]);
2253 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2254 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2260 (define_insn "*extendhidi2"
2261 [(set (match_operand:DI 0 "register_operand" "=d")
2262 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2265 [(set_attr "op_type" "RXY")])
2268 ; extendqidi2 instruction pattern(s).
2271 (define_expand "extendqidi2"
2272 [(set (match_operand:DI 0 "register_operand" "")
2273 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2279 rtx tmp = gen_reg_rtx (SImode);
2280 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2281 emit_insn (gen_extendsidi2 (operands[0], tmp));
2286 operands[1] = gen_lowpart (DImode, operands[1]);
2287 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2288 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2294 (define_insn "*extendqidi2"
2295 [(set (match_operand:DI 0 "register_operand" "=d")
2296 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2297 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2299 [(set_attr "op_type" "RXY")])
2302 [(set (match_operand:DI 0 "register_operand" "")
2303 (sign_extend:DI (match_operand:QI 1 "s_operand" "")))]
2304 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT && !reload_completed"
2306 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2307 (clobber (reg:CC 33))])
2309 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2310 (clobber (reg:CC 33))])]
2314 ; extendhisi2 instruction pattern(s).
2317 (define_expand "extendhisi2"
2318 [(set (match_operand:SI 0 "register_operand" "")
2319 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2323 operands[1] = gen_lowpart (SImode, operands[1]);
2324 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2325 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2330 (define_insn "*extendhisi2"
2331 [(set (match_operand:SI 0 "register_operand" "=d,d")
2332 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2337 [(set_attr "op_type" "RX,RXY")])
2340 ; extendqisi2 instruction pattern(s).
2343 (define_expand "extendqisi2"
2344 [(set (match_operand:SI 0 "register_operand" "")
2345 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2349 operands[1] = gen_lowpart (SImode, operands[1]);
2350 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2351 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2356 (define_insn "*extendqisi2"
2357 [(set (match_operand:SI 0 "register_operand" "=d")
2358 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2359 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2361 [(set_attr "op_type" "RXY")])
2364 [(set (match_operand:SI 0 "register_operand" "")
2365 (sign_extend:SI (match_operand:QI 1 "s_operand" "")))]
2366 "(!TARGET_64BIT || !TARGET_LONG_DISPLACEMENT) && !reload_completed"
2368 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2369 (clobber (reg:CC 33))])
2371 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2372 (clobber (reg:CC 33))])]
2376 ; extendqihi2 instruction pattern(s).
2381 ; zero_extendsidi2 instruction pattern(s).
2384 (define_expand "zero_extendsidi2"
2385 [(set (match_operand:DI 0 "register_operand" "")
2386 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2392 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2393 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2394 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2400 (define_insn "*zero_extendsidi2"
2401 [(set (match_operand:DI 0 "register_operand" "=d,d")
2402 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2407 [(set_attr "op_type" "RRE,RXY")])
2410 ; zero_extendhidi2 instruction pattern(s).
2413 (define_expand "zero_extendhidi2"
2414 [(set (match_operand:DI 0 "register_operand" "")
2415 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2421 rtx tmp = gen_reg_rtx (SImode);
2422 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2423 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2428 operands[1] = gen_lowpart (DImode, operands[1]);
2429 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2430 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2436 (define_insn "*zero_extendhidi2"
2437 [(set (match_operand:DI 0 "register_operand" "=d")
2438 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2441 [(set_attr "op_type" "RXY")])
2444 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2447 (define_insn "*llgt_sisi"
2448 [(set (match_operand:SI 0 "register_operand" "=d,d")
2449 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2450 (const_int 2147483647)))]
2455 [(set_attr "op_type" "RRE,RXE")])
2457 (define_insn_and_split "*llgt_sisi_split"
2458 [(set (match_operand:SI 0 "register_operand" "=d,d")
2459 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2460 (const_int 2147483647)))
2461 (clobber (reg:CC 33))]
2464 "&& reload_completed"
2466 (and:SI (match_dup 1)
2467 (const_int 2147483647)))]
2470 (define_insn "*llgt_didi"
2471 [(set (match_operand:DI 0 "register_operand" "=d,d")
2472 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2473 (const_int 2147483647)))]
2478 [(set_attr "op_type" "RRE,RXE")])
2480 (define_insn_and_split "*llgt_didi_split"
2481 [(set (match_operand:DI 0 "register_operand" "=d,d")
2482 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2483 (const_int 2147483647)))
2484 (clobber (reg:CC 33))]
2487 "&& reload_completed"
2489 (and:DI (match_dup 1)
2490 (const_int 2147483647)))]
2493 (define_insn "*llgt_sidi"
2494 [(set (match_operand:DI 0 "register_operand" "=d")
2495 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2496 (const_int 2147483647)))]
2499 [(set_attr "op_type" "RXE")])
2501 (define_insn_and_split "*llgt_sidi_split"
2502 [(set (match_operand:DI 0 "register_operand" "=d")
2503 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2504 (const_int 2147483647)))
2505 (clobber (reg:CC 33))]
2508 "&& reload_completed"
2510 (and:DI (subreg:DI (match_dup 1) 0)
2511 (const_int 2147483647)))]
2515 ; zero_extendqidi2 instruction pattern(s)
2518 (define_expand "zero_extendqidi2"
2519 [(set (match_operand:DI 0 "register_operand" "")
2520 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2526 rtx tmp = gen_reg_rtx (SImode);
2527 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2528 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2533 operands[1] = gen_lowpart (DImode, operands[1]);
2534 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2535 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2541 (define_insn "*zero_extendqidi2"
2542 [(set (match_operand:DI 0 "register_operand" "=d")
2543 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2546 [(set_attr "op_type" "RXY")])
2549 ; zero_extendhisi2 instruction pattern(s).
2552 (define_expand "zero_extendhisi2"
2553 [(set (match_operand:SI 0 "register_operand" "")
2554 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2558 operands[1] = gen_lowpart (SImode, operands[1]);
2559 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2564 (define_insn "*zero_extendhisi2_64"
2565 [(set (match_operand:SI 0 "register_operand" "=d")
2566 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2569 [(set_attr "op_type" "RXY")])
2571 (define_insn_and_split "*zero_extendhisi2_31"
2572 [(set (match_operand:SI 0 "register_operand" "=&d")
2573 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2574 (clobber (reg:CC 33))]
2577 "&& reload_completed"
2578 [(set (match_dup 0) (const_int 0))
2580 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2581 (clobber (reg:CC 33))])]
2582 "operands[2] = gen_lowpart (HImode, operands[0]);"
2583 [(set_attr "atype" "agen")])
2586 ; zero_extendqisi2 instruction pattern(s).
2589 (define_expand "zero_extendqisi2"
2590 [(set (match_operand:SI 0 "register_operand" "")
2591 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2595 operands[1] = gen_lowpart (SImode, operands[1]);
2596 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2601 (define_insn "*zero_extendqisi2_64"
2602 [(set (match_operand:SI 0 "register_operand" "=d")
2603 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2606 [(set_attr "op_type" "RXY")])
2608 (define_insn_and_split "*zero_extendqisi2_31"
2609 [(set (match_operand:SI 0 "register_operand" "=&d")
2610 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2613 "&& reload_completed"
2614 [(set (match_dup 0) (const_int 0))
2615 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2616 "operands[2] = gen_lowpart (QImode, operands[0]);"
2617 [(set_attr "atype" "agen")])
2620 ; zero_extendqihi2 instruction pattern(s).
2623 (define_expand "zero_extendqihi2"
2624 [(set (match_operand:HI 0 "register_operand" "")
2625 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2629 operands[1] = gen_lowpart (HImode, operands[1]);
2630 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2635 (define_insn "*zero_extendqihi2_64"
2636 [(set (match_operand:HI 0 "register_operand" "=d")
2637 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2640 [(set_attr "op_type" "RXY")])
2642 (define_insn_and_split "*zero_extendqihi2_31"
2643 [(set (match_operand:HI 0 "register_operand" "=&d")
2644 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2647 "&& reload_completed"
2648 [(set (match_dup 0) (const_int 0))
2649 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2650 "operands[2] = gen_lowpart (QImode, operands[0]);"
2651 [(set_attr "atype" "agen")])
2655 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2658 (define_expand "fixuns_truncdfdi2"
2659 [(set (match_operand:DI 0 "register_operand" "")
2660 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2661 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2663 rtx label1 = gen_label_rtx ();
2664 rtx label2 = gen_label_rtx ();
2665 rtx temp = gen_reg_rtx (DFmode);
2666 operands[1] = force_reg (DFmode, operands[1]);
2668 emit_insn (gen_cmpdf (operands[1],
2669 CONST_DOUBLE_FROM_REAL_VALUE (
2670 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2671 emit_jump_insn (gen_blt (label1));
2672 emit_insn (gen_subdf3 (temp, operands[1],
2673 CONST_DOUBLE_FROM_REAL_VALUE (
2674 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2675 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2678 emit_label (label1);
2679 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2680 emit_label (label2);
2684 (define_expand "fix_truncdfdi2"
2685 [(set (match_operand:DI 0 "register_operand" "")
2686 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2687 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2689 operands[1] = force_reg (DFmode, operands[1]);
2690 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2694 (define_insn "fix_truncdfdi2_ieee"
2695 [(set (match_operand:DI 0 "register_operand" "=d")
2696 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2697 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2698 (clobber (reg:CC 33))]
2699 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2701 [(set_attr "op_type" "RRE")
2702 (set_attr "type" "ftoi")])
2705 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2708 (define_expand "fixuns_truncdfsi2"
2709 [(set (match_operand:SI 0 "register_operand" "")
2710 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2711 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2713 rtx label1 = gen_label_rtx ();
2714 rtx label2 = gen_label_rtx ();
2715 rtx temp = gen_reg_rtx (DFmode);
2717 operands[1] = force_reg (DFmode,operands[1]);
2718 emit_insn (gen_cmpdf (operands[1],
2719 CONST_DOUBLE_FROM_REAL_VALUE (
2720 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2721 emit_jump_insn (gen_blt (label1));
2722 emit_insn (gen_subdf3 (temp, operands[1],
2723 CONST_DOUBLE_FROM_REAL_VALUE (
2724 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2725 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2728 emit_label (label1);
2729 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2730 emit_label (label2);
2734 (define_expand "fix_truncdfsi2"
2735 [(set (match_operand:SI 0 "register_operand" "")
2736 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2739 if (TARGET_IBM_FLOAT)
2741 /* This is the algorithm from POP chapter A.5.7.2. */
2743 rtx temp = assign_stack_local (BLKmode, 2 * UNITS_PER_WORD, BITS_PER_WORD);
2744 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2745 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2747 operands[1] = force_reg (DFmode, operands[1]);
2748 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2749 two31r, two32, temp));
2753 operands[1] = force_reg (DFmode, operands[1]);
2754 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2760 (define_insn "fix_truncdfsi2_ieee"
2761 [(set (match_operand:SI 0 "register_operand" "=d")
2762 (fix:SI (match_operand:DF 1 "register_operand" "f")))
2763 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2764 (clobber (reg:CC 33))]
2765 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2767 [(set_attr "op_type" "RRE")
2768 (set_attr "type" "other" )])
2770 (define_insn "fix_truncdfsi2_ibm"
2771 [(set (match_operand:SI 0 "register_operand" "=d")
2772 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2773 (use (match_operand:DI 2 "immediate_operand" "m"))
2774 (use (match_operand:DI 3 "immediate_operand" "m"))
2775 (use (match_operand:BLK 4 "memory_operand" "m"))
2776 (clobber (reg:CC 33))]
2777 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2779 output_asm_insn ("sd\t%1,%2", operands);
2780 output_asm_insn ("aw\t%1,%3", operands);
2781 output_asm_insn ("std\t%1,%4", operands);
2782 output_asm_insn ("xi\t%N4,128", operands);
2785 [(set_attr "op_type" "NN")
2786 (set_attr "type" "ftoi")
2787 (set_attr "atype" "agen")
2788 (set_attr "length" "20")])
2791 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
2794 (define_expand "fixuns_truncsfdi2"
2795 [(set (match_operand:DI 0 "register_operand" "")
2796 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2797 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2799 rtx label1 = gen_label_rtx ();
2800 rtx label2 = gen_label_rtx ();
2801 rtx temp = gen_reg_rtx (SFmode);
2803 operands[1] = force_reg (SFmode, operands[1]);
2804 emit_insn (gen_cmpsf (operands[1],
2805 CONST_DOUBLE_FROM_REAL_VALUE (
2806 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
2807 emit_jump_insn (gen_blt (label1));
2809 emit_insn (gen_subsf3 (temp, operands[1],
2810 CONST_DOUBLE_FROM_REAL_VALUE (
2811 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
2812 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
2815 emit_label (label1);
2816 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2817 emit_label (label2);
2821 (define_expand "fix_truncsfdi2"
2822 [(set (match_operand:DI 0 "register_operand" "")
2823 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
2824 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2826 operands[1] = force_reg (SFmode, operands[1]);
2827 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2831 (define_insn "fix_truncsfdi2_ieee"
2832 [(set (match_operand:DI 0 "register_operand" "=d")
2833 (fix:DI (match_operand:SF 1 "register_operand" "f")))
2834 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2835 (clobber (reg:CC 33))]
2836 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2838 [(set_attr "op_type" "RRE")
2839 (set_attr "type" "ftoi")])
2842 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
2845 (define_expand "fixuns_truncsfsi2"
2846 [(set (match_operand:SI 0 "register_operand" "")
2847 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
2848 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2850 rtx label1 = gen_label_rtx ();
2851 rtx label2 = gen_label_rtx ();
2852 rtx temp = gen_reg_rtx (SFmode);
2854 operands[1] = force_reg (SFmode, operands[1]);
2855 emit_insn (gen_cmpsf (operands[1],
2856 CONST_DOUBLE_FROM_REAL_VALUE (
2857 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
2858 emit_jump_insn (gen_blt (label1));
2859 emit_insn (gen_subsf3 (temp, operands[1],
2860 CONST_DOUBLE_FROM_REAL_VALUE (
2861 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
2862 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
2865 emit_label (label1);
2866 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2867 emit_label (label2);
2871 (define_expand "fix_truncsfsi2"
2872 [(set (match_operand:SI 0 "register_operand" "")
2873 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
2876 if (TARGET_IBM_FLOAT)
2878 /* Convert to DFmode and then use the POP algorithm. */
2879 rtx temp = gen_reg_rtx (DFmode);
2880 emit_insn (gen_extendsfdf2 (temp, operands[1]));
2881 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
2885 operands[1] = force_reg (SFmode, operands[1]);
2886 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2892 (define_insn "fix_truncsfsi2_ieee"
2893 [(set (match_operand:SI 0 "register_operand" "=d")
2894 (fix:SI (match_operand:SF 1 "register_operand" "f")))
2895 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2896 (clobber (reg:CC 33))]
2897 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2899 [(set_attr "op_type" "RRE")
2900 (set_attr "type" "ftoi")])
2903 ; floatdidf2 instruction pattern(s).
2906 (define_insn "floatdidf2"
2907 [(set (match_operand:DF 0 "register_operand" "=f")
2908 (float:DF (match_operand:DI 1 "register_operand" "d")))
2909 (clobber (reg:CC 33))]
2910 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2912 [(set_attr "op_type" "RRE")
2913 (set_attr "type" "itof" )])
2916 ; floatdisf2 instruction pattern(s).
2919 (define_insn "floatdisf2"
2920 [(set (match_operand:SF 0 "register_operand" "=f")
2921 (float:SF (match_operand:DI 1 "register_operand" "d")))
2922 (clobber (reg:CC 33))]
2923 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2925 [(set_attr "op_type" "RRE")
2926 (set_attr "type" "itof" )])
2929 ; floatsidf2 instruction pattern(s).
2932 (define_expand "floatsidf2"
2934 [(set (match_operand:DF 0 "register_operand" "")
2935 (float:DF (match_operand:SI 1 "register_operand" "")))
2936 (clobber (reg:CC 33))])]
2939 if (TARGET_IBM_FLOAT)
2941 /* This is the algorithm from POP chapter A.5.7.1. */
2943 rtx temp = assign_stack_local (BLKmode, 2 * UNITS_PER_WORD, BITS_PER_WORD);
2944 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
2946 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
2951 (define_insn "floatsidf2_ieee"
2952 [(set (match_operand:DF 0 "register_operand" "=f")
2953 (float:DF (match_operand:SI 1 "register_operand" "d")))
2954 (clobber (reg:CC 33))]
2955 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2957 [(set_attr "op_type" "RRE")
2958 (set_attr "type" "itof" )])
2960 (define_insn "floatsidf2_ibm"
2961 [(set (match_operand:DF 0 "register_operand" "=f")
2962 (float:DF (match_operand:SI 1 "register_operand" "d")))
2963 (use (match_operand:DI 2 "immediate_operand" "m"))
2964 (use (match_operand:BLK 3 "memory_operand" "m"))
2965 (clobber (reg:CC 33))]
2966 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2968 output_asm_insn ("st\t%1,%N3", operands);
2969 output_asm_insn ("xi\t%N3,128", operands);
2970 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
2971 output_asm_insn ("ld\t%0,%3", operands);
2974 [(set_attr "op_type" "NN")
2975 (set_attr "type" "other" )
2976 (set_attr "atype" "agen")
2977 (set_attr "length" "20")])
2980 ; floatsisf2 instruction pattern(s).
2983 (define_expand "floatsisf2"
2985 [(set (match_operand:SF 0 "register_operand" "")
2986 (float:SF (match_operand:SI 1 "register_operand" "")))
2987 (clobber (reg:CC 33))])]
2990 if (TARGET_IBM_FLOAT)
2992 /* Use the POP algorithm to convert to DFmode and then truncate. */
2993 rtx temp = gen_reg_rtx (DFmode);
2994 emit_insn (gen_floatsidf2 (temp, operands[1]));
2995 emit_insn (gen_truncdfsf2 (operands[0], temp));
3000 (define_insn "floatsisf2_ieee"
3001 [(set (match_operand:SF 0 "register_operand" "=f")
3002 (float:SF (match_operand:SI 1 "register_operand" "d")))
3003 (clobber (reg:CC 33))]
3004 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3006 [(set_attr "op_type" "RRE")
3007 (set_attr "type" "itof" )])
3010 ; truncdfsf2 instruction pattern(s).
3013 (define_expand "truncdfsf2"
3014 [(set (match_operand:SF 0 "register_operand" "")
3015 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3019 (define_insn "truncdfsf2_ieee"
3020 [(set (match_operand:SF 0 "register_operand" "=f")
3021 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3022 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3024 [(set_attr "op_type" "RRE")])
3026 (define_insn "truncdfsf2_ibm"
3027 [(set (match_operand:SF 0 "register_operand" "=f,f")
3028 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3029 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3033 [(set_attr "op_type" "RR,RX")
3034 (set_attr "type" "floads,floads")])
3037 ; extendsfdf2 instruction pattern(s).
3040 (define_expand "extendsfdf2"
3041 [(set (match_operand:DF 0 "register_operand" "")
3042 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3045 if (TARGET_IBM_FLOAT)
3047 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3052 (define_insn "extendsfdf2_ieee"
3053 [(set (match_operand:DF 0 "register_operand" "=f,f")
3054 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3055 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3059 [(set_attr "op_type" "RRE,RXE")
3060 (set_attr "type" "floads,floads")])
3062 (define_insn "extendsfdf2_ibm"
3063 [(set (match_operand:DF 0 "register_operand" "=f,f")
3064 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3065 (clobber (reg:CC 33))]
3066 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3068 sdr\t%0,%0\;ler\t%0,%1
3069 sdr\t%0,%0\;le\t%0,%1"
3070 [(set_attr "op_type" "NN,NN")
3071 (set_attr "atype" "reg,agen")
3072 (set_attr "length" "4,6")
3073 (set_attr "type" "o2,o2")])
3077 ;; ARITHMETIC OPERATIONS
3079 ; arithmetic operations set the ConditionCode,
3080 ; because of unpredictable Bits in Register for Halfword and Byte
3081 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3084 ;;- Add instructions.
3088 ; adddi3 instruction pattern(s).
3091 (define_insn "*adddi3_sign"
3092 [(set (match_operand:DI 0 "register_operand" "=d,d")
3093 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3094 (match_operand:DI 1 "register_operand" "0,0")))
3095 (clobber (reg:CC 33))]
3100 [(set_attr "op_type" "RRE,RXY")])
3102 (define_insn "*adddi3_zero_cc"
3104 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3105 (match_operand:DI 1 "register_operand" "0,0"))
3107 (set (match_operand:DI 0 "register_operand" "=d,d")
3108 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3109 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3113 [(set_attr "op_type" "RRE,RXY")])
3115 (define_insn "*adddi3_zero_cconly"
3117 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3118 (match_operand:DI 1 "register_operand" "0,0"))
3120 (clobber (match_scratch:DI 0 "=d,d"))]
3121 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3125 [(set_attr "op_type" "RRE,RXY")])
3127 (define_insn "*adddi3_zero"
3128 [(set (match_operand:DI 0 "register_operand" "=d,d")
3129 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3130 (match_operand:DI 1 "register_operand" "0,0")))
3131 (clobber (reg:CC 33))]
3136 [(set_attr "op_type" "RRE,RXY")])
3138 (define_insn "*adddi3_imm_cc"
3140 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3141 (match_operand:DI 2 "const_int_operand" "K"))
3143 (set (match_operand:DI 0 "register_operand" "=d")
3144 (plus:DI (match_dup 1) (match_dup 2)))]
3146 && s390_match_ccmode (insn, CCAmode)
3147 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
3149 [(set_attr "op_type" "RI")])
3151 (define_insn "*adddi3_cc"
3153 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3154 (match_operand:DI 2 "general_operand" "d,m"))
3156 (set (match_operand:DI 0 "register_operand" "=d,d")
3157 (plus:DI (match_dup 1) (match_dup 2)))]
3158 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3162 [(set_attr "op_type" "RRE,RXY")])
3164 (define_insn "*adddi3_cconly"
3166 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3167 (match_operand:DI 2 "general_operand" "d,m"))
3169 (clobber (match_scratch:DI 0 "=d,d"))]
3170 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3174 [(set_attr "op_type" "RRE,RXY")])
3176 (define_insn "*adddi3_cconly2"
3178 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3179 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3180 (clobber (match_scratch:DI 0 "=d,d"))]
3181 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3185 [(set_attr "op_type" "RRE,RXY")])
3187 (define_insn "*adddi3_64"
3188 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3189 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3190 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3191 (clobber (reg:CC 33))]
3197 [(set_attr "op_type" "RRE,RI,RXY")])
3199 (define_insn_and_split "*adddi3_31"
3200 [(set (match_operand:DI 0 "register_operand" "=&d")
3201 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3202 (match_operand:DI 2 "general_operand" "do") ) )
3203 (clobber (reg:CC 33))]
3206 "&& reload_completed"
3208 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3209 (clobber (reg:CC 33))])
3212 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3214 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3216 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3218 (label_ref (match_dup 9))))
3220 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3221 (clobber (reg:CC 33))])
3223 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3224 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3225 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3226 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3227 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3228 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3229 operands[9] = gen_label_rtx ();"
3230 [(set_attr "op_type" "NN")])
3232 (define_expand "adddi3"
3234 [(set (match_operand:DI 0 "register_operand" "")
3235 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3236 (match_operand:DI 2 "general_operand" "")))
3237 (clobber (reg:CC 33))])]
3241 (define_insn "*la_64"
3242 [(set (match_operand:DI 0 "register_operand" "=d,d")
3243 (match_operand:QI 1 "address_operand" "U,W"))]
3248 [(set_attr "op_type" "RX,RXY")
3249 (set_attr "type" "la")])
3253 [(set (match_operand:DI 0 "register_operand" "")
3254 (match_operand:QI 1 "address_operand" ""))
3255 (clobber (reg:CC 33))])]
3257 && strict_memory_address_p (VOIDmode, operands[1])
3258 && preferred_la_operand_p (operands[1])"
3259 [(set (match_dup 0) (match_dup 1))]
3263 [(set (match_operand:DI 0 "register_operand" "")
3264 (match_operand:DI 1 "register_operand" ""))
3267 (plus:DI (match_dup 0)
3268 (match_operand:DI 2 "nonmemory_operand" "")))
3269 (clobber (reg:CC 33))])]
3271 && !reg_overlap_mentioned_p (operands[0], operands[2])
3272 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (DImode, operands[1], operands[2]))
3273 && preferred_la_operand_p (gen_rtx_PLUS (DImode, operands[1], operands[2]))"
3274 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3277 (define_expand "reload_indi"
3278 [(parallel [(match_operand:DI 0 "register_operand" "=a")
3279 (match_operand:DI 1 "s390_plus_operand" "")
3280 (match_operand:DI 2 "register_operand" "=&a")])]
3283 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3289 ; addsi3 instruction pattern(s).
3292 (define_insn "*addsi3_imm_cc"
3294 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3295 (match_operand:SI 2 "const_int_operand" "K"))
3297 (set (match_operand:SI 0 "register_operand" "=d")
3298 (plus:SI (match_dup 1) (match_dup 2)))]
3299 "s390_match_ccmode (insn, CCAmode)
3300 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')"
3302 [(set_attr "op_type" "RI")])
3304 (define_insn "*addsi3_carry1_cc"
3306 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3307 (match_operand:SI 2 "general_operand" "d,R,T"))
3309 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3310 (plus:SI (match_dup 1) (match_dup 2)))]
3311 "s390_match_ccmode (insn, CCL1mode)"
3316 [(set_attr "op_type" "RR,RX,RXY")])
3318 (define_insn "*addsi3_carry1_cconly"
3320 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3321 (match_operand:SI 2 "general_operand" "d,R,T"))
3323 (clobber (match_scratch:SI 0 "=d,d,d"))]
3324 "s390_match_ccmode (insn, CCL1mode)"
3329 [(set_attr "op_type" "RR,RX,RXY")])
3331 (define_insn "*addsi3_carry2_cc"
3333 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3334 (match_operand:SI 2 "general_operand" "d,R,T"))
3336 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3337 (plus:SI (match_dup 1) (match_dup 2)))]
3338 "s390_match_ccmode (insn, CCL1mode)"
3343 [(set_attr "op_type" "RR,RX,RXY")])
3345 (define_insn "*addsi3_carry2_cconly"
3347 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3348 (match_operand:SI 2 "general_operand" "d,R,T"))
3350 (clobber (match_scratch:SI 0 "=d,d,d"))]
3351 "s390_match_ccmode (insn, CCL1mode)"
3356 [(set_attr "op_type" "RR,RX,RXY")])
3358 (define_insn "*addsi3_cc"
3360 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3361 (match_operand:SI 2 "general_operand" "d,R,T"))
3363 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3364 (plus:SI (match_dup 1) (match_dup 2)))]
3365 "s390_match_ccmode (insn, CCLmode)"
3370 [(set_attr "op_type" "RR,RX,RXY")])
3372 (define_insn "*addsi3_cconly"
3374 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3375 (match_operand:SI 2 "general_operand" "d,R,T"))
3377 (clobber (match_scratch:SI 0 "=d,d,d"))]
3378 "s390_match_ccmode (insn, CCLmode)"
3383 [(set_attr "op_type" "RR,RX,RXY")])
3385 (define_insn "*addsi3_cconly2"
3387 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3388 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3389 (clobber (match_scratch:SI 0 "=d,d,d"))]
3390 "s390_match_ccmode(insn, CCLmode)"
3395 [(set_attr "op_type" "RR,RX,RXY")])
3397 (define_insn "*addsi3_sign"
3398 [(set (match_operand:SI 0 "register_operand" "=d,d")
3399 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3400 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3401 (clobber (reg:CC 33))]
3406 [(set_attr "op_type" "RX,RXY")])
3408 (define_insn "*addsi3_sub"
3409 [(set (match_operand:SI 0 "register_operand" "=d,d")
3410 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3411 (subreg:SI (match_operand:HI 2 "memory_operand" "R,T") 0)))
3412 (clobber (reg:CC 33))]
3417 [(set_attr "op_type" "RX,RXY")])
3419 (define_insn "addsi3"
3420 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3421 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3422 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3423 (clobber (reg:CC 33))]
3430 [(set_attr "op_type" "RR,RI,RX,RXY")])
3432 (define_insn "*la_31"
3433 [(set (match_operand:SI 0 "register_operand" "=d,d")
3434 (match_operand:QI 1 "address_operand" "U,W"))]
3435 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
3439 [(set_attr "op_type" "RX,RXY")
3440 (set_attr "type" "la")])
3444 [(set (match_operand:SI 0 "register_operand" "")
3445 (match_operand:QI 1 "address_operand" ""))
3446 (clobber (reg:CC 33))])]
3448 && strict_memory_address_p (VOIDmode, operands[1])
3449 && preferred_la_operand_p (operands[1])"
3450 [(set (match_dup 0) (match_dup 1))]
3454 [(set (match_operand:SI 0 "register_operand" "")
3455 (match_operand:SI 1 "register_operand" ""))
3458 (plus:SI (match_dup 0)
3459 (match_operand:SI 2 "nonmemory_operand" "")))
3460 (clobber (reg:CC 33))])]
3462 && !reg_overlap_mentioned_p (operands[0], operands[2])
3463 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
3464 && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
3465 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
3468 (define_insn "*la_31_and"
3469 [(set (match_operand:SI 0 "register_operand" "=d,d")
3470 (and:SI (match_operand:QI 1 "address_operand" "U,W")
3471 (const_int 2147483647)))]
3476 [(set_attr "op_type" "RX,RXY")
3477 (set_attr "type" "la")])
3479 (define_insn_and_split "*la_31_and_cc"
3480 [(set (match_operand:SI 0 "register_operand" "=d")
3481 (and:SI (match_operand:QI 1 "address_operand" "p")
3482 (const_int 2147483647)))
3483 (clobber (reg:CC 33))]
3486 "&& reload_completed"
3488 (and:SI (match_dup 1) (const_int 2147483647)))]
3490 [(set_attr "op_type" "RX")
3491 (set_attr "type" "la")])
3493 (define_insn "force_la_31"
3494 [(set (match_operand:SI 0 "register_operand" "=d,d")
3495 (match_operand:QI 1 "address_operand" "U,W"))
3496 (use (const_int 0))]
3501 [(set_attr "op_type" "RX")
3502 (set_attr "type" "la")])
3504 (define_expand "reload_insi"
3505 [(parallel [(match_operand:SI 0 "register_operand" "=a")
3506 (match_operand:SI 1 "s390_plus_operand" "")
3507 (match_operand:SI 2 "register_operand" "=&a")])]
3510 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
3516 ; adddf3 instruction pattern(s).
3519 (define_expand "adddf3"
3521 [(set (match_operand:DF 0 "register_operand" "=f,f")
3522 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3523 (match_operand:DF 2 "general_operand" "f,R")))
3524 (clobber (reg:CC 33))])]
3528 (define_insn "*adddf3"
3529 [(set (match_operand:DF 0 "register_operand" "=f,f")
3530 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3531 (match_operand:DF 2 "general_operand" "f,R")))
3532 (clobber (reg:CC 33))]
3533 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3537 [(set_attr "op_type" "RRE,RXE")
3538 (set_attr "type" "fsimpd,fsimpd")])
3540 (define_insn "*adddf3_cc"
3542 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3543 (match_operand:DF 2 "general_operand" "f,R"))
3544 (match_operand:DF 3 "const0_operand" "")))
3545 (set (match_operand:DF 0 "register_operand" "=f,f")
3546 (plus:DF (match_dup 1) (match_dup 2)))]
3547 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3551 [(set_attr "op_type" "RRE,RXE")
3552 (set_attr "type" "fsimpd,fsimpd")])
3554 (define_insn "*adddf3_cconly"
3556 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3557 (match_operand:DF 2 "general_operand" "f,R"))
3558 (match_operand:DF 3 "const0_operand" "")))
3559 (clobber (match_scratch:DF 0 "=f,f"))]
3560 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3564 [(set_attr "op_type" "RRE,RXE")
3565 (set_attr "type" "fsimpd,fsimpd")])
3567 (define_insn "*adddf3_ibm"
3568 [(set (match_operand:DF 0 "register_operand" "=f,f")
3569 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3570 (match_operand:DF 2 "general_operand" "f,R")))
3571 (clobber (reg:CC 33))]
3572 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3576 [(set_attr "op_type" "RR,RX")
3577 (set_attr "type" "fsimpd,fsimpd")])
3580 ; addsf3 instruction pattern(s).
3583 (define_expand "addsf3"
3585 [(set (match_operand:SF 0 "register_operand" "=f,f")
3586 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3587 (match_operand:SF 2 "general_operand" "f,R")))
3588 (clobber (reg:CC 33))])]
3592 (define_insn "*addsf3"
3593 [(set (match_operand:SF 0 "register_operand" "=f,f")
3594 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3595 (match_operand:SF 2 "general_operand" "f,R")))
3596 (clobber (reg:CC 33))]
3597 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3601 [(set_attr "op_type" "RRE,RXE")
3602 (set_attr "type" "fsimps,fsimps")])
3604 (define_insn "*addsf3_cc"
3606 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3607 (match_operand:SF 2 "general_operand" "f,R"))
3608 (match_operand:SF 3 "const0_operand" "")))
3609 (set (match_operand:SF 0 "register_operand" "=f,f")
3610 (plus:SF (match_dup 1) (match_dup 2)))]
3611 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3615 [(set_attr "op_type" "RRE,RXE")
3616 (set_attr "type" "fsimps,fsimps")])
3618 (define_insn "*addsf3_cconly"
3620 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3621 (match_operand:SF 2 "general_operand" "f,R"))
3622 (match_operand:SF 3 "const0_operand" "")))
3623 (clobber (match_scratch:SF 0 "=f,f"))]
3624 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3628 [(set_attr "op_type" "RRE,RXE")
3629 (set_attr "type" "fsimps,fsimps")])
3631 (define_insn "*addsf3"
3632 [(set (match_operand:SF 0 "register_operand" "=f,f")
3633 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3634 (match_operand:SF 2 "general_operand" "f,R")))
3635 (clobber (reg:CC 33))]
3636 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3640 [(set_attr "op_type" "RR,RX")
3641 (set_attr "type" "fsimps,fsimps")])
3645 ;;- Subtract instructions.
3649 ; subdi3 instruction pattern(s).
3652 (define_insn "*subdi3_sign"
3653 [(set (match_operand:DI 0 "register_operand" "=d,d")
3654 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3655 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3656 (clobber (reg:CC 33))]
3661 [(set_attr "op_type" "RRE,RXY")])
3663 (define_insn "*subdi3_zero_cc"
3665 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3666 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3668 (set (match_operand:DI 0 "register_operand" "=d,d")
3669 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3670 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3674 [(set_attr "op_type" "RRE,RXY")])
3676 (define_insn "*subdi3_zero_cconly"
3678 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3679 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3681 (clobber (match_scratch:DI 0 "=d,d"))]
3682 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3686 [(set_attr "op_type" "RRE,RXY")])
3688 (define_insn "*subdi3_zero"
3689 [(set (match_operand:DI 0 "register_operand" "=d,d")
3690 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3691 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3692 (clobber (reg:CC 33))]
3697 [(set_attr "op_type" "RRE,RXY")])
3699 (define_insn "*subdi3_cc"
3701 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3702 (match_operand:DI 2 "general_operand" "d,m"))
3704 (set (match_operand:DI 0 "register_operand" "=d,d")
3705 (minus:DI (match_dup 1) (match_dup 2)))]
3706 "s390_match_ccmode (insn, CCLmode)"
3710 [(set_attr "op_type" "RRE,RXY")])
3712 (define_insn "*subdi3_cconly"
3714 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3715 (match_operand:DI 2 "general_operand" "d,m"))
3717 (clobber (match_scratch:DI 0 "=d,d"))]
3718 "s390_match_ccmode (insn, CCLmode)"
3722 [(set_attr "op_type" "RRE,RXY")])
3724 (define_insn "*subdi3_64"
3725 [(set (match_operand:DI 0 "register_operand" "=d,d")
3726 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3727 (match_operand:DI 2 "general_operand" "d,m") ) )
3728 (clobber (reg:CC 33))]
3733 [(set_attr "op_type" "RRE,RRE")])
3735 (define_insn_and_split "*subdi3_31"
3736 [(set (match_operand:DI 0 "register_operand" "=&d")
3737 (minus:DI (match_operand:DI 1 "register_operand" "0")
3738 (match_operand:DI 2 "general_operand" "do") ) )
3739 (clobber (reg:CC 33))]
3742 "&& reload_completed"
3744 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3745 (clobber (reg:CC 33))])
3748 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3750 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3752 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3754 (label_ref (match_dup 9))))
3756 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3757 (clobber (reg:CC 33))])
3759 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3760 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3761 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3762 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3763 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3764 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3765 operands[9] = gen_label_rtx ();"
3766 [(set_attr "op_type" "NN")])
3768 (define_expand "subdi3"
3770 [(set (match_operand:DI 0 "register_operand" "")
3771 (minus:DI (match_operand:DI 1 "register_operand" "")
3772 (match_operand:DI 2 "general_operand" "")))
3773 (clobber (reg:CC 33))])]
3778 ; subsi3 instruction pattern(s).
3781 (define_insn "*subsi3_borrow_cc"
3783 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3784 (match_operand:SI 2 "general_operand" "d,R,T"))
3786 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3787 (minus:SI (match_dup 1) (match_dup 2)))]
3788 "s390_match_ccmode(insn, CCL2mode)"
3793 [(set_attr "op_type" "RR,RX,RXY")])
3795 (define_insn "*subsi3_borrow_cconly"
3797 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3798 (match_operand:SI 2 "general_operand" "d,R,T"))
3800 (clobber (match_scratch:SI 0 "=d,d,d"))]
3801 "s390_match_ccmode(insn, CCL2mode)"
3806 [(set_attr "op_type" "RR,RX,RXE")])
3808 (define_insn "*subsi3_cc"
3810 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3811 (match_operand:SI 2 "general_operand" "d,R,T"))
3813 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3814 (minus:SI (match_dup 1) (match_dup 2)))]
3815 "s390_match_ccmode(insn, CCLmode)"
3820 [(set_attr "op_type" "RR,RX,RXY")])
3822 (define_insn "*subsi3_cconly"
3824 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3825 (match_operand:SI 2 "general_operand" "d,R,T"))
3827 (clobber (match_scratch:SI 0 "=d,d,d"))]
3828 "s390_match_ccmode(insn, CCLmode)"
3833 [(set_attr "op_type" "RR,RX,RXY")])
3835 (define_insn "*subsi3_sign"
3836 [(set (match_operand:SI 0 "register_operand" "=d,d")
3837 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3838 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3839 (clobber (reg:CC 33))]
3844 [(set_attr "op_type" "RX,RXY")])
3846 (define_insn "*subsi3_sub"
3847 [(set (match_operand:SI 0 "register_operand" "=d,d")
3848 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
3849 (subreg:SI (match_operand:HI 2 "memory_operand" "R,T") 0)))
3850 (clobber (reg:CC 33))]
3855 [(set_attr "op_type" "RX,RXY")])
3857 (define_insn "subsi3"
3858 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
3859 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
3860 (match_operand:SI 2 "general_operand" "d,R,T")))
3861 (clobber (reg:CC 33))]
3867 [(set_attr "op_type" "RR,RX,RXY")])
3871 ; subdf3 instruction pattern(s).
3874 (define_expand "subdf3"
3876 [(set (match_operand:DF 0 "register_operand" "=f,f")
3877 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3878 (match_operand:DF 2 "general_operand" "f,R")))
3879 (clobber (reg:CC 33))])]
3883 (define_insn "*subdf3"
3884 [(set (match_operand:DF 0 "register_operand" "=f,f")
3885 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3886 (match_operand:DF 2 "general_operand" "f,R")))
3887 (clobber (reg:CC 33))]
3888 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3892 [(set_attr "op_type" "RRE,RXE")
3893 (set_attr "type" "fsimpd,fsimpd")])
3895 (define_insn "*subdf3_cc"
3897 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3898 (match_operand:DF 2 "general_operand" "f,R"))
3899 (match_operand:DF 3 "const0_operand" "")))
3900 (set (match_operand:DF 0 "register_operand" "=f,f")
3901 (plus:DF (match_dup 1) (match_dup 2)))]
3902 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3906 [(set_attr "op_type" "RRE,RXE")
3907 (set_attr "type" "fsimpd,fsimpd")])
3909 (define_insn "*subdf3_cconly"
3911 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3912 (match_operand:DF 2 "general_operand" "f,R"))
3913 (match_operand:DF 3 "const0_operand" "")))
3914 (clobber (match_scratch:DF 0 "=f,f"))]
3915 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3919 [(set_attr "op_type" "RRE,RXE")
3920 (set_attr "type" "fsimpd,fsimpd")])
3922 (define_insn "*subdf3_ibm"
3923 [(set (match_operand:DF 0 "register_operand" "=f,f")
3924 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
3925 (match_operand:DF 2 "general_operand" "f,R")))
3926 (clobber (reg:CC 33))]
3927 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3931 [(set_attr "op_type" "RR,RX")
3932 (set_attr "type" "fsimpd,fsimpd")])
3935 ; subsf3 instruction pattern(s).
3938 (define_expand "subsf3"
3940 [(set (match_operand:SF 0 "register_operand" "=f,f")
3941 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
3942 (match_operand:SF 2 "general_operand" "f,R")))
3943 (clobber (reg:CC 33))])]
3947 (define_insn "*subsf3"
3948 [(set (match_operand:SF 0 "register_operand" "=f,f")
3949 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
3950 (match_operand:SF 2 "general_operand" "f,R")))
3951 (clobber (reg:CC 33))]
3952 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3956 [(set_attr "op_type" "RRE,RXE")
3957 (set_attr "type" "fsimps,fsimps")])
3959 (define_insn "*subsf3_cc"
3961 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3962 (match_operand:SF 2 "general_operand" "f,R"))
3963 (match_operand:SF 3 "const0_operand" "")))
3964 (set (match_operand:SF 0 "register_operand" "=f,f")
3965 (minus:SF (match_dup 1) (match_dup 2)))]
3966 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3970 [(set_attr "op_type" "RRE,RXE")
3971 (set_attr "type" "fsimps,fsimps")])
3973 (define_insn "*subsf3_cconly"
3975 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3976 (match_operand:SF 2 "general_operand" "f,R"))
3977 (match_operand:SF 3 "const0_operand" "")))
3978 (clobber (match_scratch:SF 0 "=f,f"))]
3979 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3983 [(set_attr "op_type" "RRE,RXE")
3984 (set_attr "type" "fsimps,fsimps")])
3986 (define_insn "*subsf3_ibm"
3987 [(set (match_operand:SF 0 "register_operand" "=f,f")
3988 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
3989 (match_operand:SF 2 "general_operand" "f,R")))
3990 (clobber (reg:CC 33))]
3991 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3995 [(set_attr "op_type" "RR,RX")
3996 (set_attr "type" "fsimps,fsimps")])
4000 ;;- Multiply instructions.
4004 ; muldi3 instruction pattern(s).
4007 (define_insn "*muldi3_sign"
4008 [(set (match_operand:DI 0 "register_operand" "=d,d")
4009 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4010 (match_operand:DI 1 "register_operand" "0,0")))]
4015 [(set_attr "op_type" "RRE,RXY")
4016 (set_attr "type" "imul")])
4019 (define_insn "muldi3"
4020 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4021 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4022 (match_operand:DI 2 "general_operand" "d,K,m")))]
4028 [(set_attr "op_type" "RRE,RI,RXY")
4029 (set_attr "type" "imul")])
4032 ; mulsi3 instruction pattern(s).
4035 (define_insn "mulsi3"
4036 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4037 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4038 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4045 [(set_attr "op_type" "RRE,RI,RX,RXY")
4046 (set_attr "type" "imul")])
4049 ; mulsidi3 instruction pattern(s).
4052 (define_expand "mulsidi3"
4053 [(set (match_operand:DI 0 "register_operand" "")
4054 (mult:DI (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" ""))
4055 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" ""))))]
4060 emit_insn (gen_zero_extendsidi2 (operands[0], operands[1]));
4061 insn = emit_insn (gen_mulsi_6432 (operands[0], operands[0], operands[2]));
4064 gen_rtx_EXPR_LIST (REG_EQUAL,
4065 gen_rtx_MULT (DImode,
4066 gen_rtx_SIGN_EXTEND (DImode, operands[1]),
4067 gen_rtx_SIGN_EXTEND (DImode, operands[2])),
4072 (define_insn "mulsi_6432"
4073 [(set (match_operand:DI 0 "register_operand" "=d,d")
4074 (mult:DI (sign_extend:DI
4075 (truncate:SI (match_operand:DI 1 "register_operand" "0,0")))
4077 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4082 [(set_attr "op_type" "RR,RX")
4083 (set_attr "type" "imul")])
4086 ; muldf3 instruction pattern(s).
4089 (define_expand "muldf3"
4091 [(set (match_operand:DF 0 "register_operand" "=f,f")
4092 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4093 (match_operand:DF 2 "general_operand" "f,R")))
4094 (clobber (reg:CC 33))])]
4098 (define_insn "*muldf3"
4099 [(set (match_operand:DF 0 "register_operand" "=f,f")
4100 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4101 (match_operand:DF 2 "general_operand" "f,R")))
4102 (clobber (reg:CC 33))]
4103 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4107 [(set_attr "op_type" "RRE,RXE")
4108 (set_attr "type" "fmuld")])
4110 (define_insn "*muldf3_ibm"
4111 [(set (match_operand:DF 0 "register_operand" "=f,f")
4112 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4113 (match_operand:DF 2 "general_operand" "f,R")))
4114 (clobber (reg:CC 33))]
4115 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4119 [(set_attr "op_type" "RR,RX")
4120 (set_attr "type" "fmuld")])
4122 (define_insn "*fmadddf"
4123 [(set (match_operand:DF 0 "register_operand" "=f,f")
4124 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4125 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4126 (match_operand:DF 3 "register_operand" "0,0")))]
4127 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && flag_unsafe_math_optimizations"
4131 [(set_attr "op_type" "RRE,RXE")
4132 (set_attr "type" "fmuld")])
4134 (define_insn "*fmsubdf"
4135 [(set (match_operand:DF 0 "register_operand" "=f,f")
4136 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4137 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4138 (match_operand:DF 3 "register_operand" "0,0")))]
4139 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && flag_unsafe_math_optimizations"
4143 [(set_attr "op_type" "RRE,RXE")
4144 (set_attr "type" "fmuld")])
4147 ; mulsf3 instruction pattern(s).
4150 (define_expand "mulsf3"
4152 [(set (match_operand:SF 0 "register_operand" "=f,f")
4153 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4154 (match_operand:SF 2 "general_operand" "f,R")))
4155 (clobber (reg:CC 33))])]
4159 (define_insn "*mulsf3"
4160 [(set (match_operand:SF 0 "register_operand" "=f,f")
4161 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4162 (match_operand:SF 2 "general_operand" "f,R")))
4163 (clobber (reg:CC 33))]
4164 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4168 [(set_attr "op_type" "RRE,RXE")
4169 (set_attr "type" "fmuls")])
4171 (define_insn "*mulsf3_ibm"
4172 [(set (match_operand:SF 0 "register_operand" "=f,f")
4173 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4174 (match_operand:SF 2 "general_operand" "f,R")))
4175 (clobber (reg:CC 33))]
4176 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4180 [(set_attr "op_type" "RR,RX")
4181 (set_attr "type" "fmuls")])
4183 (define_insn "*fmaddsf"
4184 [(set (match_operand:SF 0 "register_operand" "=f,f")
4185 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4186 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4187 (match_operand:SF 3 "register_operand" "0,0")))]
4188 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && flag_unsafe_math_optimizations"
4192 [(set_attr "op_type" "RRE,RXE")
4193 (set_attr "type" "fmuls")])
4195 (define_insn "*fmsubsf"
4196 [(set (match_operand:SF 0 "register_operand" "=f,f")
4197 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4198 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4199 (match_operand:SF 3 "register_operand" "0,0")))]
4200 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && flag_unsafe_math_optimizations"
4204 [(set_attr "op_type" "RRE,RXE")
4205 (set_attr "type" "fmuls")])
4208 ;;- Divide and modulo instructions.
4212 ; divmoddi4 instruction pattern(s).
4215 (define_expand "divmoddi4"
4216 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4217 (div:DI (match_operand:DI 1 "general_operand" "")
4218 (match_operand:DI 2 "general_operand" "")))
4219 (set (match_operand:DI 3 "general_operand" "")
4220 (mod:DI (match_dup 1) (match_dup 2)))])
4221 (clobber (match_dup 4))]
4224 rtx insn, div_equal, mod_equal, equal;
4226 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4227 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4228 equal = gen_rtx_IOR (TImode,
4229 gen_rtx_ZERO_EXTEND (TImode, div_equal),
4230 gen_rtx_ASHIFT (TImode,
4231 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4234 operands[4] = gen_reg_rtx(TImode);
4235 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4236 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4237 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4238 insn = emit_insn (gen_divmodtidi3 (operands[4], operands[4], operands[2]));
4240 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4242 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4244 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4246 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4248 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4253 (define_insn "divmodtidi3"
4254 [(set (match_operand:TI 0 "register_operand" "=d,d")
4257 (div:DI (truncate:DI (match_operand:TI 1 "register_operand" "0,0"))
4258 (match_operand:DI 2 "general_operand" "d,m")))
4261 (mod:DI (truncate:DI (match_dup 1))
4268 [(set_attr "op_type" "RRE,RXY")
4269 (set_attr "type" "idiv")])
4271 (define_insn "divmodtisi3"
4272 [(set (match_operand:TI 0 "register_operand" "=d,d")
4275 (div:DI (truncate:DI (match_operand:TI 1 "register_operand" "0,0"))
4276 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4279 (mod:DI (truncate:DI (match_dup 1))
4280 (sign_extend:DI (match_dup 2))))
4286 [(set_attr "op_type" "RRE,RXY")
4287 (set_attr "type" "idiv")])
4290 ; udivmoddi4 instruction pattern(s).
4293 (define_expand "udivmoddi4"
4294 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4295 (udiv:DI (match_operand:DI 1 "general_operand" "")
4296 (match_operand:DI 2 "nonimmediate_operand" "")))
4297 (set (match_operand:DI 3 "general_operand" "")
4298 (umod:DI (match_dup 1) (match_dup 2)))])
4299 (clobber (match_dup 4))]
4302 rtx insn, div_equal, mod_equal, equal;
4304 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4305 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4306 equal = gen_rtx_IOR (TImode,
4307 gen_rtx_ZERO_EXTEND (TImode, div_equal),
4308 gen_rtx_ASHIFT (TImode,
4309 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4312 operands[4] = gen_reg_rtx(TImode);
4313 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4314 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4315 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4316 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4318 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4320 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4322 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4324 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4326 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4331 (define_insn "udivmodtidi3"
4332 [(set (match_operand:TI 0 "register_operand" "=d,d")
4333 (ior:TI (zero_extend:TI
4335 (udiv:TI (match_operand:TI 1 "register_operand" "0,0")
4337 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4341 (umod:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))
4347 [(set_attr "op_type" "RRE,RXY")
4348 (set_attr "type" "idiv")])
4351 ; divmodsi4 instruction pattern(s).
4354 (define_expand "divmodsi4"
4355 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4356 (div:SI (match_operand:SI 1 "general_operand" "")
4357 (match_operand:SI 2 "nonimmediate_operand" "")))
4358 (set (match_operand:SI 3 "general_operand" "")
4359 (mod:SI (match_dup 1) (match_dup 2)))])
4360 (clobber (match_dup 4))]
4363 rtx insn, div_equal, mod_equal, equal;
4365 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4366 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4367 equal = gen_rtx_IOR (DImode,
4368 gen_rtx_ZERO_EXTEND (DImode, div_equal),
4369 gen_rtx_ASHIFT (DImode,
4370 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4373 operands[4] = gen_reg_rtx(DImode);
4374 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4375 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4377 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4379 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4381 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4383 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4385 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4390 (define_insn "divmoddisi3"
4391 [(set (match_operand:DI 0 "register_operand" "=d,d")
4392 (ior:DI (zero_extend:DI
4394 (div:DI (match_operand:DI 1 "register_operand" "0,0")
4396 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4400 (mod:DI (match_dup 1) (sign_extend:SI (match_dup 2)))))
4406 [(set_attr "op_type" "RR,RX")
4407 (set_attr "type" "idiv")])
4410 ; udivsi3 and umodsi3 instruction pattern(s).
4414 (define_expand "udivsi3"
4415 [(set (match_operand:SI 0 "register_operand" "=d")
4416 (udiv:SI (match_operand:SI 1 "general_operand" "")
4417 (match_operand:SI 2 "general_operand" "")))
4418 (clobber (match_dup 3))]
4421 rtx insn, udiv_equal, umod_equal, equal;
4423 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4424 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4425 equal = gen_rtx_IOR (DImode,
4426 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4427 gen_rtx_ASHIFT (DImode,
4428 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4431 operands[3] = gen_reg_rtx (DImode);
4433 if (CONSTANT_P (operands[2]))
4435 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4437 rtx label1 = gen_label_rtx ();
4439 operands[1] = make_safe_from (operands[1], operands[0]);
4440 emit_move_insn (operands[0], const0_rtx);
4441 emit_insn (gen_cmpsi (operands[1], operands[2]));
4442 emit_jump_insn (gen_bltu (label1));
4443 emit_move_insn (operands[0], const1_rtx);
4444 emit_label (label1);
4448 operands[2] = force_reg (SImode, operands[2]);
4449 operands[2] = make_safe_from (operands[2], operands[0]);
4451 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4452 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4455 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4457 insn = emit_move_insn (operands[0],
4458 gen_lowpart (SImode, operands[3]));
4460 gen_rtx_EXPR_LIST (REG_EQUAL,
4461 udiv_equal, REG_NOTES (insn));
4466 rtx label1 = gen_label_rtx ();
4467 rtx label2 = gen_label_rtx ();
4468 rtx label3 = gen_label_rtx ();
4470 operands[1] = force_reg (SImode, operands[1]);
4471 operands[1] = make_safe_from (operands[1], operands[0]);
4472 operands[2] = force_reg (SImode, operands[2]);
4473 operands[2] = make_safe_from (operands[2], operands[0]);
4475 emit_move_insn (operands[0], const0_rtx);
4476 emit_insn (gen_cmpsi (operands[2], operands[1]));
4477 emit_jump_insn (gen_bgtu (label3));
4478 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4479 emit_jump_insn (gen_blt (label2));
4480 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4481 emit_jump_insn (gen_beq (label1));
4482 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4483 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4486 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4488 insn = emit_move_insn (operands[0],
4489 gen_lowpart (SImode, operands[3]));
4491 gen_rtx_EXPR_LIST (REG_EQUAL,
4492 udiv_equal, REG_NOTES (insn));
4494 emit_label (label1);
4495 emit_move_insn (operands[0], operands[1]);
4497 emit_label (label2);
4498 emit_move_insn (operands[0], const1_rtx);
4499 emit_label (label3);
4501 emit_move_insn (operands[0], operands[0]);
4505 (define_expand "umodsi3"
4506 [(set (match_operand:SI 0 "register_operand" "=d")
4507 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
4508 (match_operand:SI 2 "nonimmediate_operand" "")))
4509 (clobber (match_dup 3))]
4512 rtx insn, udiv_equal, umod_equal, equal;
4514 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4515 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4516 equal = gen_rtx_IOR (DImode,
4517 gen_rtx_ZERO_EXTEND (DImode, udiv_equal),
4518 gen_rtx_ASHIFT (DImode,
4519 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4522 operands[3] = gen_reg_rtx (DImode);
4524 if (CONSTANT_P (operands[2]))
4526 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
4528 rtx label1 = gen_label_rtx ();
4530 operands[1] = make_safe_from (operands[1], operands[0]);
4531 emit_move_insn (operands[0], operands[1]);
4532 emit_insn (gen_cmpsi (operands[0], operands[2]));
4533 emit_jump_insn (gen_bltu (label1));
4534 emit_insn (gen_abssi2 (operands[0], operands[2]));
4535 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
4536 emit_label (label1);
4540 operands[2] = force_reg (SImode, operands[2]);
4541 operands[2] = make_safe_from (operands[2], operands[0]);
4543 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4544 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4547 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4549 insn = emit_move_insn (operands[0],
4550 gen_highpart (SImode, operands[3]));
4552 gen_rtx_EXPR_LIST (REG_EQUAL,
4553 umod_equal, REG_NOTES (insn));
4558 rtx label1 = gen_label_rtx ();
4559 rtx label2 = gen_label_rtx ();
4560 rtx label3 = gen_label_rtx ();
4562 operands[1] = force_reg (SImode, operands[1]);
4563 operands[1] = make_safe_from (operands[1], operands[0]);
4564 operands[2] = force_reg (SImode, operands[2]);
4565 operands[2] = make_safe_from (operands[2], operands[0]);
4567 emit_move_insn(operands[0], operands[1]);
4568 emit_insn (gen_cmpsi (operands[2], operands[1]));
4569 emit_jump_insn (gen_bgtu (label3));
4570 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4571 emit_jump_insn (gen_blt (label2));
4572 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4573 emit_jump_insn (gen_beq (label1));
4574 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4575 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4578 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4580 insn = emit_move_insn (operands[0],
4581 gen_highpart (SImode, operands[3]));
4583 gen_rtx_EXPR_LIST (REG_EQUAL,
4584 umod_equal, REG_NOTES (insn));
4586 emit_label (label1);
4587 emit_move_insn (operands[0], const0_rtx);
4589 emit_label (label2);
4590 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
4591 emit_label (label3);
4597 ; divdf3 instruction pattern(s).
4600 (define_expand "divdf3"
4602 [(set (match_operand:DF 0 "register_operand" "=f,f")
4603 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4604 (match_operand:DF 2 "general_operand" "f,R")))
4605 (clobber (reg:CC 33))])]
4609 (define_insn "*divdf3"
4610 [(set (match_operand:DF 0 "register_operand" "=f,f")
4611 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4612 (match_operand:DF 2 "general_operand" "f,R")))
4613 (clobber (reg:CC 33))]
4614 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4618 [(set_attr "op_type" "RRE,RXE")
4619 (set_attr "type" "fdivd")])
4621 (define_insn "*divdf3_ibm"
4622 [(set (match_operand:DF 0 "register_operand" "=f,f")
4623 (div:DF (match_operand:DF 1 "register_operand" "0,0")
4624 (match_operand:DF 2 "general_operand" "f,R")))
4625 (clobber (reg:CC 33))]
4626 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4630 [(set_attr "op_type" "RR,RX")
4631 (set_attr "type" "fdivd")])
4634 ; divsf3 instruction pattern(s).
4637 (define_expand "divsf3"
4639 [(set (match_operand:SF 0 "register_operand" "=f,f")
4640 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4641 (match_operand:SF 2 "general_operand" "f,R")))
4642 (clobber (reg:CC 33))])]
4646 (define_insn "*divsf3"
4647 [(set (match_operand:SF 0 "register_operand" "=f,f")
4648 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4649 (match_operand:SF 2 "general_operand" "f,R")))
4650 (clobber (reg:CC 33))]
4651 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4655 [(set_attr "op_type" "RRE,RXE")
4656 (set_attr "type" "fdivs")])
4658 (define_insn "*divsf3"
4659 [(set (match_operand:SF 0 "register_operand" "=f,f")
4660 (div:SF (match_operand:SF 1 "register_operand" "0,0")
4661 (match_operand:SF 2 "general_operand" "f,R")))
4662 (clobber (reg:CC 33))]
4663 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4667 [(set_attr "op_type" "RR,RX")
4668 (set_attr "type" "fdivs")])
4672 ;;- And instructions.
4676 ; anddi3 instruction pattern(s).
4679 (define_insn "*anddi3_cc"
4681 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4682 (match_operand:DI 2 "general_operand" "d,m"))
4684 (set (match_operand:DI 0 "register_operand" "=d,d")
4685 (and:DI (match_dup 1) (match_dup 2)))]
4686 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4690 [(set_attr "op_type" "RRE,RXY")])
4692 (define_insn "*anddi3_cconly"
4694 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4695 (match_operand:DI 2 "general_operand" "d,m"))
4697 (clobber (match_scratch:DI 0 "=d,d"))]
4698 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4702 [(set_attr "op_type" "RRE,RXY")])
4704 (define_insn "*anddi3_ni"
4705 [(set (match_operand:DI 0 "register_operand" "=d")
4706 (and:DI (match_operand:DI 1 "nonimmediate_operand" "0")
4707 (match_operand:DI 2 "immediate_operand" "n")))
4708 (clobber (reg:CC 33))]
4709 "TARGET_64BIT && s390_single_hi (operands[2], DImode, -1) >= 0"
4711 int part = s390_single_hi (operands[2], DImode, -1);
4712 operands[2] = GEN_INT (s390_extract_hi (operands[2], DImode, part));
4716 case 0: return "nihh\t%0,%x2";
4717 case 1: return "nihl\t%0,%x2";
4718 case 2: return "nilh\t%0,%x2";
4719 case 3: return "nill\t%0,%x2";
4723 [(set_attr "op_type" "RI")])
4725 (define_insn "anddi3"
4726 [(set (match_operand:DI 0 "register_operand" "=d,d")
4727 (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4728 (match_operand:DI 2 "general_operand" "d,m")))
4729 (clobber (reg:CC 33))]
4734 [(set_attr "op_type" "RRE,RXY")])
4736 (define_insn "*anddi3_ss"
4737 [(set (match_operand:DI 0 "s_operand" "=Q")
4738 (and:DI (match_dup 0)
4739 (match_operand:DI 1 "s_imm_operand" "Q")))
4740 (clobber (reg:CC 33))]
4743 [(set_attr "op_type" "SS")])
4745 (define_insn "*anddi3_ss_inv"
4746 [(set (match_operand:DI 0 "s_operand" "=Q")
4747 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
4749 (clobber (reg:CC 33))]
4752 [(set_attr "op_type" "SS")])
4755 ; andsi3 instruction pattern(s).
4758 (define_insn "*andsi3_cc"
4760 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
4761 (match_operand:SI 2 "general_operand" "d,R,T"))
4763 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4764 (and:SI (match_dup 1) (match_dup 2)))]
4765 "s390_match_ccmode(insn, CCTmode)"
4770 [(set_attr "op_type" "RR,RX,RXY")])
4772 (define_insn "*andsi3_cconly"
4774 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
4775 (match_operand:SI 2 "general_operand" "d,R,T"))
4777 (clobber (match_scratch:SI 0 "=d,d,d"))]
4778 "s390_match_ccmode(insn, CCTmode)"
4783 [(set_attr "op_type" "RR,RX,RXY")])
4785 (define_insn "*andsi3_ni"
4786 [(set (match_operand:SI 0 "register_operand" "=d")
4787 (and:SI (match_operand:SI 1 "nonimmediate_operand" "0")
4788 (match_operand:SI 2 "immediate_operand" "n")))
4789 (clobber (reg:CC 33))]
4790 "TARGET_64BIT && s390_single_hi (operands[2], SImode, -1) >= 0"
4792 int part = s390_single_hi (operands[2], SImode, -1);
4793 operands[2] = GEN_INT (s390_extract_hi (operands[2], SImode, part));
4797 case 0: return "nilh\t%0,%x2";
4798 case 1: return "nill\t%0,%x2";
4802 [(set_attr "op_type" "RI")])
4804 (define_insn "andsi3"
4805 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4806 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
4807 (match_operand:SI 2 "general_operand" "d,R,T")))
4808 (clobber (reg:CC 33))]
4814 [(set_attr "op_type" "RR,RX,RXY")])
4816 (define_insn "*andsi3_ss"
4817 [(set (match_operand:SI 0 "s_operand" "=Q")
4818 (and:SI (match_dup 0)
4819 (match_operand:SI 1 "s_imm_operand" "Q")))
4820 (clobber (reg:CC 33))]
4823 [(set_attr "op_type" "SS")])
4825 (define_insn "*andsi3_ss_inv"
4826 [(set (match_operand:SI 0 "s_operand" "=Q")
4827 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
4829 (clobber (reg:CC 33))]
4832 [(set_attr "op_type" "SS")])
4835 ; andhi3 instruction pattern(s).
4838 (define_insn "*andhi3_ni"
4839 [(set (match_operand:HI 0 "register_operand" "=d,d")
4840 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
4841 (match_operand:HI 2 "nonmemory_operand" "d,n")))
4842 (clobber (reg:CC 33))]
4847 [(set_attr "op_type" "RR,RI")])
4849 (define_insn "andhi3"
4850 [(set (match_operand:HI 0 "register_operand" "=d")
4851 (and:HI (match_operand:HI 1 "register_operand" "%0")
4852 (match_operand:HI 2 "nonmemory_operand" "d")))
4853 (clobber (reg:CC 33))]
4856 [(set_attr "op_type" "RR")])
4858 (define_insn "*andhi3_ss"
4859 [(set (match_operand:HI 0 "s_operand" "=Q")
4860 (and:HI (match_dup 0)
4861 (match_operand:HI 1 "s_imm_operand" "Q")))
4862 (clobber (reg:CC 33))]
4865 [(set_attr "op_type" "SS")])
4867 (define_insn "*andhi3_ss_inv"
4868 [(set (match_operand:HI 0 "s_operand" "=Q")
4869 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
4871 (clobber (reg:CC 33))]
4874 [(set_attr "op_type" "SS")])
4877 ; andqi3 instruction pattern(s).
4880 (define_insn "*andqi3_ni"
4881 [(set (match_operand:QI 0 "register_operand" "=d,d")
4882 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
4883 (match_operand:QI 2 "nonmemory_operand" "d,n")))
4884 (clobber (reg:CC 33))]
4889 [(set_attr "op_type" "RR,RI")])
4891 (define_insn "andqi3"
4892 [(set (match_operand:QI 0 "register_operand" "=d")
4893 (and:QI (match_operand:QI 1 "register_operand" "%0")
4894 (match_operand:QI 2 "nonmemory_operand" "d")))
4895 (clobber (reg:CC 33))]
4898 [(set_attr "op_type" "RR")])
4900 (define_insn "*andqi3_ss"
4901 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
4902 (and:QI (match_dup 0)
4903 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
4904 (clobber (reg:CC 33))]
4910 [(set_attr "op_type" "SI,SIY,SS")])
4912 (define_insn "*andqi3_ss_inv"
4913 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
4914 (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
4916 (clobber (reg:CC 33))]
4922 [(set_attr "op_type" "SI,SIY,SS")])
4926 ;;- Bit set (inclusive or) instructions.
4930 ; iordi3 instruction pattern(s).
4933 (define_insn "*iordi3_cc"
4935 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4936 (match_operand:DI 2 "general_operand" "d,m"))
4938 (set (match_operand:DI 0 "register_operand" "=d,d")
4939 (ior:DI (match_dup 1) (match_dup 2)))]
4940 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4944 [(set_attr "op_type" "RRE,RXY")])
4946 (define_insn "*iordi3_cconly"
4948 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4949 (match_operand:DI 2 "general_operand" "d,m"))
4951 (clobber (match_scratch:DI 0 "=d,d"))]
4952 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
4956 [(set_attr "op_type" "RRE,RXY")])
4958 (define_insn "*iordi3_oi"
4959 [(set (match_operand:DI 0 "register_operand" "=d")
4960 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0")
4961 (match_operand:DI 2 "immediate_operand" "n")))
4962 (clobber (reg:CC 33))]
4963 "TARGET_64BIT && s390_single_hi (operands[2], DImode, 0) >= 0"
4965 int part = s390_single_hi (operands[2], DImode, 0);
4966 operands[2] = GEN_INT (s390_extract_hi (operands[2], DImode, part));
4970 case 0: return "oihh\t%0,%x2";
4971 case 1: return "oihl\t%0,%x2";
4972 case 2: return "oilh\t%0,%x2";
4973 case 3: return "oill\t%0,%x2";
4977 [(set_attr "op_type" "RI")])
4979 (define_insn "iordi3"
4980 [(set (match_operand:DI 0 "register_operand" "=d,d")
4981 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4982 (match_operand:DI 2 "general_operand" "d,m")))
4983 (clobber (reg:CC 33))]
4988 [(set_attr "op_type" "RRE,RXY")])
4990 (define_insn "*iordi3_ss"
4991 [(set (match_operand:DI 0 "s_operand" "=Q")
4992 (ior:DI (match_dup 0)
4993 (match_operand:DI 1 "s_imm_operand" "Q")))
4994 (clobber (reg:CC 33))]
4997 [(set_attr "op_type" "SS")])
4999 (define_insn "*iordi3_ss_inv"
5000 [(set (match_operand:DI 0 "s_operand" "=Q")
5001 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5003 (clobber (reg:CC 33))]
5006 [(set_attr "op_type" "SS")])
5009 ; iorsi3 instruction pattern(s).
5012 (define_insn "*iorsi3_cc"
5014 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5015 (match_operand:SI 2 "general_operand" "d,R,T"))
5017 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5018 (ior:SI (match_dup 1) (match_dup 2)))]
5019 "s390_match_ccmode(insn, CCTmode)"
5024 [(set_attr "op_type" "RR,RX,RXY")])
5026 (define_insn "*iorsi3_cconly"
5028 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5029 (match_operand:SI 2 "general_operand" "d,R,T"))
5031 (clobber (match_scratch:SI 0 "=d,d,d"))]
5032 "s390_match_ccmode(insn, CCTmode)"
5037 [(set_attr "op_type" "RR,RX,RXY")])
5039 (define_insn "*iorsi3_oi"
5040 [(set (match_operand:SI 0 "register_operand" "=d")
5041 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0")
5042 (match_operand:SI 2 "immediate_operand" "n")))
5043 (clobber (reg:CC 33))]
5044 "TARGET_64BIT && s390_single_hi (operands[2], SImode, 0) >= 0"
5046 int part = s390_single_hi (operands[2], SImode, 0);
5047 operands[2] = GEN_INT (s390_extract_hi (operands[2], SImode, part));
5051 case 0: return "oilh\t%0,%x2";
5052 case 1: return "oill\t%0,%x2";
5056 [(set_attr "op_type" "RI")])
5058 (define_insn "iorsi3"
5059 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5060 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5061 (match_operand:SI 2 "general_operand" "d,R,T")))
5062 (clobber (reg:CC 33))]
5068 [(set_attr "op_type" "RR,RX,RXY")])
5070 (define_insn "*iorsi3_ss"
5071 [(set (match_operand:SI 0 "s_operand" "=Q")
5072 (ior:SI (match_dup 0)
5073 (match_operand:SI 1 "s_imm_operand" "Q")))
5074 (clobber (reg:CC 33))]
5077 [(set_attr "op_type" "SS")])
5079 (define_insn "*iorsi3_ss_inv"
5080 [(set (match_operand:SI 0 "s_operand" "=Q")
5081 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5083 (clobber (reg:CC 33))]
5086 [(set_attr "op_type" "SS")])
5089 ; iorhi3 instruction pattern(s).
5092 (define_insn "*iorhi3_oi"
5093 [(set (match_operand:HI 0 "register_operand" "=d,d")
5094 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5095 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5096 (clobber (reg:CC 33))]
5101 [(set_attr "op_type" "RR,RI")])
5103 (define_insn "iorhi3"
5104 [(set (match_operand:HI 0 "register_operand" "=d")
5105 (ior:HI (match_operand:HI 1 "register_operand" "%0")
5106 (match_operand:HI 2 "nonmemory_operand" "d")))
5107 (clobber (reg:CC 33))]
5110 [(set_attr "op_type" "RR")])
5112 (define_insn "*iorhi3_ss"
5113 [(set (match_operand:HI 0 "s_operand" "=Q")
5114 (ior:HI (match_dup 0)
5115 (match_operand:HI 1 "s_imm_operand" "Q")))
5116 (clobber (reg:CC 33))]
5119 [(set_attr "op_type" "SS")])
5121 (define_insn "*iorhi3_ss_inv"
5122 [(set (match_operand:HI 0 "s_operand" "=Q")
5123 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5125 (clobber (reg:CC 33))]
5128 [(set_attr "op_type" "SS")])
5131 ; iorqi3 instruction pattern(s).
5134 (define_insn "*iorqi3_oi"
5135 [(set (match_operand:QI 0 "register_operand" "=d,d")
5136 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5137 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5138 (clobber (reg:CC 33))]
5143 [(set_attr "op_type" "RR,RI")])
5145 (define_insn "iorqi3"
5146 [(set (match_operand:QI 0 "register_operand" "=d")
5147 (ior:QI (match_operand:QI 1 "register_operand" "%0")
5148 (match_operand:QI 2 "nonmemory_operand" "d")))
5149 (clobber (reg:CC 33))]
5152 [(set_attr "op_type" "RR")])
5154 (define_insn "*iorqi3_ss"
5155 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5156 (ior:QI (match_dup 0)
5157 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5158 (clobber (reg:CC 33))]
5164 [(set_attr "op_type" "SI,SIY,SS")])
5166 (define_insn "*iorqi3_ss_inv"
5167 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5168 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5170 (clobber (reg:CC 33))]
5176 [(set_attr "op_type" "SI,SIY,SS")])
5180 ;;- Xor instructions.
5184 ; xordi3 instruction pattern(s).
5187 (define_insn "*xordi3_cc"
5189 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5190 (match_operand:DI 2 "general_operand" "d,m"))
5192 (set (match_operand:DI 0 "register_operand" "=d,d")
5193 (xor:DI (match_dup 1) (match_dup 2)))]
5194 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5198 [(set_attr "op_type" "RRE,RXY")])
5200 (define_insn "*xordi3_cconly"
5202 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5203 (match_operand:DI 2 "general_operand" "d,m"))
5205 (clobber (match_scratch:DI 0 "=d,d"))]
5206 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5210 [(set_attr "op_type" "RRE,RXY")])
5212 (define_insn "xordi3"
5213 [(set (match_operand:DI 0 "register_operand" "=d,d")
5214 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5215 (match_operand:DI 2 "general_operand" "d,m")))
5216 (clobber (reg:CC 33))]
5221 [(set_attr "op_type" "RRE,RXY")])
5223 (define_insn "*xordi3_ss"
5224 [(set (match_operand:DI 0 "s_operand" "=Q")
5225 (xor:DI (match_dup 0)
5226 (match_operand:DI 1 "s_imm_operand" "Q")))
5227 (clobber (reg:CC 33))]
5230 [(set_attr "op_type" "SS")])
5232 (define_insn "*xordi3_ss_inv"
5233 [(set (match_operand:DI 0 "s_operand" "=Q")
5234 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5236 (clobber (reg:CC 33))]
5239 [(set_attr "op_type" "SS")])
5242 ; xorsi3 instruction pattern(s).
5245 (define_insn "*xorsi3_cc"
5247 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5248 (match_operand:SI 2 "general_operand" "d,R,T"))
5250 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5251 (xor:SI (match_dup 1) (match_dup 2)))]
5252 "s390_match_ccmode(insn, CCTmode)"
5257 [(set_attr "op_type" "RR,RX,RXY")])
5259 (define_insn "*xorsi3_cconly"
5261 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5262 (match_operand:SI 2 "general_operand" "d,R,T"))
5264 (clobber (match_scratch:SI 0 "=d,d,d"))]
5265 "s390_match_ccmode(insn, CCTmode)"
5270 [(set_attr "op_type" "RR,RX,RXY")])
5272 (define_insn "xorsi3"
5273 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5274 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5275 (match_operand:SI 2 "general_operand" "d,R,T")))
5276 (clobber (reg:CC 33))]
5282 [(set_attr "op_type" "RR,RX,RXY")])
5284 (define_insn "*xorsi3_ss"
5285 [(set (match_operand:SI 0 "s_operand" "=Q")
5286 (xor:SI (match_dup 0)
5287 (match_operand:SI 1 "s_imm_operand" "Q")))
5288 (clobber (reg:CC 33))]
5291 [(set_attr "op_type" "SS")])
5293 (define_insn "*xorsi3_ss_inv"
5294 [(set (match_operand:SI 0 "s_operand" "=Q")
5295 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5297 (clobber (reg:CC 33))]
5300 [(set_attr "op_type" "SS")])
5303 ; xorhi3 instruction pattern(s).
5306 (define_insn "xorhi3"
5307 [(set (match_operand:HI 0 "register_operand" "=d")
5308 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5309 (match_operand:HI 2 "nonmemory_operand" "d")))
5310 (clobber (reg:CC 33))]
5313 [(set_attr "op_type" "RR")])
5315 (define_insn "*xorhi3_ss"
5316 [(set (match_operand:HI 0 "s_operand" "=Q")
5317 (xor:HI (match_dup 0)
5318 (match_operand:HI 1 "s_imm_operand" "Q")))
5319 (clobber (reg:CC 33))]
5322 [(set_attr "op_type" "SS")])
5324 (define_insn "*xorhi3_ss_inv"
5325 [(set (match_operand:HI 0 "s_operand" "=Q")
5326 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5328 (clobber (reg:CC 33))]
5331 [(set_attr "op_type" "SS")])
5334 ; xorqi3 instruction pattern(s).
5337 (define_insn "xorqi3"
5338 [(set (match_operand:QI 0 "register_operand" "=d")
5339 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5340 (match_operand:QI 2 "nonmemory_operand" "d")))
5341 (clobber (reg:CC 33))]
5344 [(set_attr "op_type" "RR")])
5346 (define_insn "*xorqi3_ss"
5347 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5348 (xor:QI (match_dup 0)
5349 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5350 (clobber (reg:CC 33))]
5356 [(set_attr "op_type" "SI,SIY,SS")])
5358 (define_insn "*xorqi3_ss_inv"
5359 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5360 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5362 (clobber (reg:CC 33))]
5368 [(set_attr "op_type" "SI,SIY,SS")])
5372 ;;- Negate instructions.
5376 ; negdi2 instruction pattern(s).
5379 (define_expand "negdi2"
5381 [(set (match_operand:DI 0 "register_operand" "=d")
5382 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5383 (clobber (reg:CC 33))])]
5387 (define_insn "*negdi2_64"
5388 [(set (match_operand:DI 0 "register_operand" "=d")
5389 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5390 (clobber (reg:CC 33))]
5393 [(set_attr "op_type" "RR")])
5395 (define_insn "*negdi2_31"
5396 [(set (match_operand:DI 0 "register_operand" "=d")
5397 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5398 (clobber (reg:CC 33))]
5402 xop[0] = gen_label_rtx ();
5403 output_asm_insn ("lcr\t%0,%1", operands);
5404 output_asm_insn ("lcr\t%N0,%N1", operands);
5405 output_asm_insn ("je\t%l0", xop);
5406 output_asm_insn ("bctr\t%0,0", operands);
5407 targetm.asm_out.internal_label (asm_out_file, "L",
5408 CODE_LABEL_NUMBER (xop[0]));
5411 [(set_attr "op_type" "NN")
5412 (set_attr "type" "other")
5413 (set_attr "length" "10")])
5416 ; negsi2 instruction pattern(s).
5419 (define_insn "negsi2"
5420 [(set (match_operand:SI 0 "register_operand" "=d")
5421 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5422 (clobber (reg:CC 33))]
5425 [(set_attr "op_type" "RR")])
5428 ; negdf2 instruction pattern(s).
5431 (define_expand "negdf2"
5433 [(set (match_operand:DF 0 "register_operand" "=f")
5434 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5435 (clobber (reg:CC 33))])]
5439 (define_insn "*negdf2"
5440 [(set (match_operand:DF 0 "register_operand" "=f")
5441 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5442 (clobber (reg:CC 33))]
5443 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5445 [(set_attr "op_type" "RRE")
5446 (set_attr "type" "fsimpd")])
5448 (define_insn "*negdf2_ibm"
5449 [(set (match_operand:DF 0 "register_operand" "=f")
5450 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5451 (clobber (reg:CC 33))]
5452 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5454 [(set_attr "op_type" "RR")
5455 (set_attr "type" "fsimpd")])
5458 ; negsf2 instruction pattern(s).
5461 (define_expand "negsf2"
5463 [(set (match_operand:SF 0 "register_operand" "=f")
5464 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5465 (clobber (reg:CC 33))])]
5469 (define_insn "*negsf2"
5470 [(set (match_operand:SF 0 "register_operand" "=f")
5471 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5472 (clobber (reg:CC 33))]
5473 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5475 [(set_attr "op_type" "RRE")
5476 (set_attr "type" "fsimps")])
5478 (define_insn "*negsf2"
5479 [(set (match_operand:SF 0 "register_operand" "=f")
5480 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5481 (clobber (reg:CC 33))]
5482 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5484 [(set_attr "op_type" "RR")
5485 (set_attr "type" "fsimps")])
5489 ;;- Absolute value instructions.
5493 ; absdi2 instruction pattern(s).
5496 (define_insn "absdi2"
5497 [(set (match_operand:DI 0 "register_operand" "=d")
5498 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5499 (clobber (reg:CC 33))]
5502 [(set_attr "op_type" "RRE")])
5505 ; abssi2 instruction pattern(s).
5508 (define_insn "abssi2"
5509 [(set (match_operand:SI 0 "register_operand" "=d")
5510 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5511 (clobber (reg:CC 33))]
5514 [(set_attr "op_type" "RR")])
5517 ; absdf2 instruction pattern(s).
5520 (define_expand "absdf2"
5522 [(set (match_operand:DF 0 "register_operand" "=f")
5523 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5524 (clobber (reg:CC 33))])]
5528 (define_insn "*absdf2"
5529 [(set (match_operand:DF 0 "register_operand" "=f")
5530 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5531 (clobber (reg:CC 33))]
5532 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5534 [(set_attr "op_type" "RRE")
5535 (set_attr "type" "fsimpd")])
5537 (define_insn "*absdf2_ibm"
5538 [(set (match_operand:DF 0 "register_operand" "=f")
5539 (abs:DF (match_operand:DF 1 "register_operand" "f")))
5540 (clobber (reg:CC 33))]
5541 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5543 [(set_attr "op_type" "RR")
5544 (set_attr "type" "fsimpd")])
5547 ; abssf2 instruction pattern(s).
5550 (define_expand "abssf2"
5552 [(set (match_operand:SF 0 "register_operand" "=f")
5553 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5554 (clobber (reg:CC 33))])]
5558 (define_insn "*abssf2"
5559 [(set (match_operand:SF 0 "register_operand" "=f")
5560 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5561 (clobber (reg:CC 33))]
5562 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5564 [(set_attr "op_type" "RRE")
5565 (set_attr "type" "fsimps")])
5567 (define_insn "*abssf2_ibm"
5568 [(set (match_operand:SF 0 "register_operand" "=f")
5569 (abs:SF (match_operand:SF 1 "register_operand" "f")))
5570 (clobber (reg:CC 33))]
5571 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5573 [(set_attr "op_type" "RR")
5574 (set_attr "type" "fsimps")])
5577 ;;- Negated absolute value instructions
5584 (define_insn "*negabssi2"
5585 [(set (match_operand:SI 0 "register_operand" "=d")
5586 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
5587 (clobber (reg:CC 33))]
5590 [(set_attr "op_type" "RR")])
5592 (define_insn "*negabsdi2"
5593 [(set (match_operand:DI 0 "register_operand" "=d")
5594 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
5595 (clobber (reg:CC 33))]
5598 [(set_attr "op_type" "RRE")])
5604 (define_insn "*negabssf2"
5605 [(set (match_operand:SF 0 "register_operand" "=f")
5606 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
5607 (clobber (reg:CC 33))]
5608 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5610 [(set_attr "op_type" "RRE")
5611 (set_attr "type" "fsimps")])
5613 (define_insn "*negabsdf2"
5614 [(set (match_operand:DF 0 "register_operand" "=f")
5615 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
5616 (clobber (reg:CC 33))]
5617 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5619 [(set_attr "op_type" "RRE")
5620 (set_attr "type" "fsimpd")])
5623 ;;- Square root instructions.
5627 ; sqrtdf2 instruction pattern(s).
5630 (define_insn "sqrtdf2"
5631 [(set (match_operand:DF 0 "register_operand" "=f,f")
5632 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
5633 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5637 [(set_attr "op_type" "RRE,RXE")])
5640 ; sqrtsf2 instruction pattern(s).
5643 (define_insn "sqrtsf2"
5644 [(set (match_operand:SF 0 "register_operand" "=f,f")
5645 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
5646 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5650 [(set_attr "op_type" "RRE,RXE")])
5653 ;;- One complement instructions.
5657 ; one_cmpldi2 instruction pattern(s).
5660 (define_expand "one_cmpldi2"
5662 [(set (match_operand:DI 0 "register_operand" "")
5663 (xor:DI (match_operand:DI 1 "register_operand" "")
5665 (clobber (reg:CC 33))])]
5670 ; one_cmplsi2 instruction pattern(s).
5673 (define_expand "one_cmplsi2"
5675 [(set (match_operand:SI 0 "register_operand" "")
5676 (xor:SI (match_operand:SI 1 "register_operand" "")
5678 (clobber (reg:CC 33))])]
5683 ; one_cmplhi2 instruction pattern(s).
5686 (define_expand "one_cmplhi2"
5688 [(set (match_operand:HI 0 "register_operand" "")
5689 (xor:HI (match_operand:HI 1 "register_operand" "")
5691 (clobber (reg:CC 33))])]
5696 ; one_cmplqi2 instruction pattern(s).
5699 (define_expand "one_cmplqi2"
5701 [(set (match_operand:QI 0 "register_operand" "")
5702 (xor:QI (match_operand:QI 1 "register_operand" "")
5704 (clobber (reg:CC 33))])]
5710 ;;- Rotate instructions.
5714 ; rotldi3 instruction pattern(s).
5717 (define_insn "rotldi3"
5718 [(set (match_operand:DI 0 "register_operand" "=d,d")
5719 (rotate:DI (match_operand:DI 1 "register_operand" "d,d")
5720 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5725 [(set_attr "op_type" "RSE")
5726 (set_attr "atype" "reg")])
5729 ; rotlsi3 instruction pattern(s).
5732 (define_insn "rotlsi3"
5733 [(set (match_operand:SI 0 "register_operand" "=d,d")
5734 (rotate:SI (match_operand:SI 1 "register_operand" "d,d")
5735 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5740 [(set_attr "op_type" "RSE")
5741 (set_attr "atype" "reg")])
5745 ;;- Arithmetic shift instructions.
5749 ; ashldi3 instruction pattern(s).
5752 (define_expand "ashldi3"
5753 [(set (match_operand:DI 0 "register_operand" "")
5754 (ashift:DI (match_operand:DI 1 "register_operand" "")
5755 (match_operand:SI 2 "nonmemory_operand" "")))]
5759 (define_insn "*ashldi3_31"
5760 [(set (match_operand:DI 0 "register_operand" "=d,d")
5761 (ashift:DI (match_operand:DI 1 "register_operand" "0,0")
5762 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5767 [(set_attr "op_type" "RS")
5768 (set_attr "atype" "reg")])
5770 (define_insn "*ashldi3_64"
5771 [(set (match_operand:DI 0 "register_operand" "=d,d")
5772 (ashift:DI (match_operand:DI 1 "register_operand" "d,d")
5773 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5778 [(set_attr "op_type" "RSE")
5779 (set_attr "atype" "reg")])
5782 ; ashrdi3 instruction pattern(s).
5785 (define_expand "ashrdi3"
5787 [(set (match_operand:DI 0 "register_operand" "")
5788 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
5789 (match_operand:SI 2 "nonmemory_operand" "")))
5790 (clobber (reg:CC 33))])]
5794 (define_insn "*ashrdi3_cc_31"
5796 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
5797 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5799 (set (match_operand:DI 0 "register_operand" "=d,d")
5800 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
5801 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
5805 [(set_attr "op_type" "RS")
5806 (set_attr "atype" "reg")])
5808 (define_insn "*ashrdi3_cconly_31"
5810 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
5811 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5813 (clobber (match_scratch:DI 0 "=d,d"))]
5814 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
5818 [(set_attr "op_type" "RS")
5819 (set_attr "atype" "reg")])
5821 (define_insn "*ashrdi3_31"
5822 [(set (match_operand:DI 0 "register_operand" "=d,d")
5823 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
5824 (match_operand:SI 2 "nonmemory_operand" "J,a")))
5825 (clobber (reg:CC 33))]
5830 [(set_attr "op_type" "RS")
5831 (set_attr "atype" "reg")])
5833 (define_insn "*ashrdi3_cc_64"
5835 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
5836 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5838 (set (match_operand:DI 0 "register_operand" "=d,d")
5839 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
5840 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
5844 [(set_attr "op_type" "RSE")
5845 (set_attr "atype" "reg")])
5847 (define_insn "*ashrdi3_cconly_64"
5849 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
5850 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5852 (clobber (match_scratch:DI 0 "=d,d"))]
5853 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
5857 [(set_attr "op_type" "RSE")
5858 (set_attr "atype" "reg")])
5860 (define_insn "*ashrdi3_64"
5861 [(set (match_operand:DI 0 "register_operand" "=d,d")
5862 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
5863 (match_operand:SI 2 "nonmemory_operand" "J,a")))
5864 (clobber (reg:CC 33))]
5869 [(set_attr "op_type" "RSE")
5870 (set_attr "atype" "reg")])
5874 ; ashlsi3 instruction pattern(s).
5877 (define_insn "ashlsi3"
5878 [(set (match_operand:SI 0 "register_operand" "=d,d")
5879 (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
5880 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5885 [(set_attr "op_type" "RS")
5886 (set_attr "atype" "reg")])
5889 ; ashrsi3 instruction pattern(s).
5892 (define_insn "*ashrsi3_cc"
5894 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
5895 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5897 (set (match_operand:SI 0 "register_operand" "=d,d")
5898 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5899 "s390_match_ccmode(insn, CCSmode)"
5903 [(set_attr "op_type" "RS")
5904 (set_attr "atype" "reg")])
5907 (define_insn "*ashrsi3_cconly"
5909 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
5910 (match_operand:SI 2 "nonmemory_operand" "J,a"))
5912 (clobber (match_scratch:SI 0 "=d,d"))]
5913 "s390_match_ccmode(insn, CCSmode)"
5917 [(set_attr "op_type" "RS")
5918 (set_attr "atype" "reg")])
5920 (define_insn "ashrsi3"
5921 [(set (match_operand:SI 0 "register_operand" "=d,d")
5922 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
5923 (match_operand:SI 2 "nonmemory_operand" "J,a")))
5924 (clobber (reg:CC 33))]
5929 [(set_attr "op_type" "RS")
5930 (set_attr "atype" "reg")])
5934 ;;- logical shift instructions.
5938 ; lshrdi3 instruction pattern(s).
5941 (define_expand "lshrdi3"
5942 [(set (match_operand:DI 0 "register_operand" "")
5943 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5944 (match_operand:SI 2 "nonmemory_operand" "")))]
5948 (define_insn "*lshrdi3_31"
5949 [(set (match_operand:DI 0 "register_operand" "=d,d")
5950 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
5951 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5956 [(set_attr "op_type" "RS,RS")
5957 (set_attr "atype" "reg")])
5959 (define_insn "*lshrdi3_64"
5960 [(set (match_operand:DI 0 "register_operand" "=d,d")
5961 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
5962 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5967 [(set_attr "op_type" "RSE,RSE")
5968 (set_attr "atype" "reg")])
5971 ; lshrsi3 instruction pattern(s).
5974 (define_insn "lshrsi3"
5975 [(set (match_operand:SI 0 "register_operand" "=d,d")
5976 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
5977 (match_operand:SI 2 "nonmemory_operand" "J,a")))]
5982 [(set_attr "op_type" "RS")
5983 (set_attr "atype" "reg")])
5987 ;; Branch instruction patterns.
5990 (define_expand "beq"
5991 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
5993 (if_then_else (eq (reg:CCZ 33) (const_int 0))
5994 (label_ref (match_operand 0 "" ""))
5997 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
5999 (define_expand "bne"
6000 [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2)))
6002 (if_then_else (ne (reg:CCZ 33) (const_int 0))
6003 (label_ref (match_operand 0 "" ""))
6006 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6008 (define_expand "bgt"
6009 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6011 (if_then_else (gt (reg:CCS 33) (const_int 0))
6012 (label_ref (match_operand 0 "" ""))
6015 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6017 (define_expand "bgtu"
6018 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6020 (if_then_else (gtu (reg:CCU 33) (const_int 0))
6021 (label_ref (match_operand 0 "" ""))
6024 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6026 (define_expand "blt"
6027 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6029 (if_then_else (lt (reg:CCS 33) (const_int 0))
6030 (label_ref (match_operand 0 "" ""))
6033 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6035 (define_expand "bltu"
6036 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6038 (if_then_else (ltu (reg:CCU 33) (const_int 0))
6039 (label_ref (match_operand 0 "" ""))
6042 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6044 (define_expand "bge"
6045 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6047 (if_then_else (ge (reg:CCS 33) (const_int 0))
6048 (label_ref (match_operand 0 "" ""))
6051 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6053 (define_expand "bgeu"
6054 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6056 (if_then_else (geu (reg:CCU 33) (const_int 0))
6057 (label_ref (match_operand 0 "" ""))
6060 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6062 (define_expand "ble"
6063 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6065 (if_then_else (le (reg:CCS 33) (const_int 0))
6066 (label_ref (match_operand 0 "" ""))
6069 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6071 (define_expand "bleu"
6072 [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2)))
6074 (if_then_else (leu (reg:CCU 33) (const_int 0))
6075 (label_ref (match_operand 0 "" ""))
6078 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6080 (define_expand "bunordered"
6081 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6083 (if_then_else (unordered (reg:CCS 33) (const_int 0))
6084 (label_ref (match_operand 0 "" ""))
6087 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6089 (define_expand "bordered"
6090 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6092 (if_then_else (ordered (reg:CCS 33) (const_int 0))
6093 (label_ref (match_operand 0 "" ""))
6096 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6098 (define_expand "buneq"
6099 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6101 (if_then_else (uneq (reg:CCS 33) (const_int 0))
6102 (label_ref (match_operand 0 "" ""))
6105 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6107 (define_expand "bungt"
6108 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6110 (if_then_else (ungt (reg:CCS 33) (const_int 0))
6111 (label_ref (match_operand 0 "" ""))
6114 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6116 (define_expand "bunlt"
6117 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6119 (if_then_else (unlt (reg:CCS 33) (const_int 0))
6120 (label_ref (match_operand 0 "" ""))
6123 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6125 (define_expand "bunge"
6126 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6128 (if_then_else (unge (reg:CCS 33) (const_int 0))
6129 (label_ref (match_operand 0 "" ""))
6132 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6134 (define_expand "bunle"
6135 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6137 (if_then_else (unle (reg:CCS 33) (const_int 0))
6138 (label_ref (match_operand 0 "" ""))
6141 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6143 (define_expand "bltgt"
6144 [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2)))
6146 (if_then_else (ltgt (reg:CCS 33) (const_int 0))
6147 (label_ref (match_operand 0 "" ""))
6150 "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;")
6154 ;;- Conditional jump instructions.
6157 (define_insn "cjump"
6160 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6161 (label_ref (match_operand 0 "" ""))
6165 if (get_attr_length (insn) == 4)
6167 else if (TARGET_64BIT)
6168 return "jg%C1\t%l0";
6172 [(set_attr "op_type" "RI")
6173 (set_attr "type" "branch")
6174 (set (attr "length")
6175 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6177 (ne (symbol_ref "TARGET_64BIT") (const_int 0))
6179 (eq (symbol_ref "flag_pic") (const_int 0))
6180 (const_int 6)] (const_int 8)))])
6182 (define_insn "*cjump_long"
6185 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6186 (match_operand 0 "address_operand" "U")
6190 if (get_attr_op_type (insn) == OP_TYPE_RR)
6195 [(set (attr "op_type")
6196 (if_then_else (match_operand 0 "register_operand" "")
6197 (const_string "RR") (const_string "RX")))
6198 (set_attr "type" "branch")
6199 (set_attr "atype" "agen")])
6203 ;;- Negated conditional jump instructions.
6206 (define_insn "icjump"
6209 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6211 (label_ref (match_operand 0 "" ""))))]
6214 if (get_attr_length (insn) == 4)
6216 else if (TARGET_64BIT)
6217 return "jg%D1\t%l0";
6221 [(set_attr "op_type" "RI")
6222 (set_attr "type" "branch")
6223 (set (attr "length")
6224 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6226 (ne (symbol_ref "TARGET_64BIT") (const_int 0))
6228 (eq (symbol_ref "flag_pic") (const_int 0))
6229 (const_int 6)] (const_int 8)))])
6231 (define_insn "*icjump_long"
6234 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6236 (match_operand 0 "address_operand" "U")))]
6239 if (get_attr_op_type (insn) == OP_TYPE_RR)
6244 [(set (attr "op_type")
6245 (if_then_else (match_operand 0 "register_operand" "")
6246 (const_string "RR") (const_string "RX")))
6247 (set_attr "type" "branch")
6248 (set_attr "atype" "agen")])
6251 ;;- Trap instructions.
6255 [(trap_if (const_int 1) (const_int 0))]
6258 [(set_attr "op_type" "RX")
6259 (set_attr "type" "branch")])
6261 (define_expand "conditional_trap"
6262 [(set (match_dup 2) (match_dup 3))
6263 (trap_if (match_operator 0 "comparison_operator"
6264 [(match_dup 2) (const_int 0)])
6265 (match_operand:SI 1 "general_operand" ""))]
6268 enum machine_mode ccmode;
6270 if (operands[1] != const0_rtx) FAIL;
6272 ccmode = s390_select_ccmode (GET_CODE (operands[0]),
6273 s390_compare_op0, s390_compare_op1);
6274 operands[2] = gen_rtx_REG (ccmode, 33);
6275 operands[3] = gen_rtx_COMPARE (ccmode, s390_compare_op0, s390_compare_op1);
6278 (define_insn "*trap"
6279 [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6283 [(set_attr "op_type" "RI")
6284 (set_attr "type" "branch")])
6287 ;;- Loop instructions.
6289 ;; This is all complicated by the fact that since this is a jump insn
6290 ;; we must handle our own output reloads.
6292 (define_expand "doloop_end"
6293 [(use (match_operand 0 "" "")) ; loop pseudo
6294 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6295 (use (match_operand 2 "" "")) ; max iterations
6296 (use (match_operand 3 "" "")) ; loop level
6297 (use (match_operand 4 "" ""))] ; label
6300 if (GET_MODE (operands[0]) == SImode)
6301 emit_jump_insn (gen_doloop_si (operands[4], operands[0], operands[0]));
6302 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6303 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6310 (define_insn "doloop_si"
6313 (ne (match_operand:SI 1 "register_operand" "d,d")
6315 (label_ref (match_operand 0 "" ""))
6317 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6318 (plus:SI (match_dup 1) (const_int -1)))
6319 (clobber (match_scratch:SI 3 "=X,&d"))
6320 (clobber (reg:CC 33))]
6323 if (which_alternative != 0)
6325 else if (get_attr_length (insn) == 4)
6326 return "brct\t%1,%l0";
6330 [(set_attr "op_type" "RI")
6331 (set_attr "type" "branch")
6332 (set (attr "length")
6333 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6335 (ne (symbol_ref "TARGET_64BIT") (const_int 0))
6337 (eq (symbol_ref "flag_pic") (const_int 0))
6338 (const_int 6)] (const_int 8)))])
6340 (define_insn "*doloop_si_long"
6343 (ne (match_operand:SI 1 "register_operand" "d,d")
6345 (match_operand 0 "address_operand" "U,U")
6347 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6348 (plus:SI (match_dup 1) (const_int -1)))
6349 (clobber (match_scratch:SI 3 "=X,&d"))
6350 (clobber (reg:CC 33))]
6353 if (get_attr_op_type (insn) == OP_TYPE_RR)
6354 return "bctr\t%1,%0";
6356 return "bct\t%1,%a0";
6358 [(set (attr "op_type")
6359 (if_then_else (match_operand 0 "register_operand" "")
6360 (const_string "RR") (const_string "RX")))
6361 (set_attr "type" "branch")
6362 (set_attr "atype" "agen")])
6366 (if_then_else (ne (match_operand:SI 1 "register_operand" "")
6368 (match_operand 0 "" "")
6370 (set (match_operand:SI 2 "nonimmediate_operand" "")
6371 (plus:SI (match_dup 1) (const_int -1)))
6372 (clobber (match_scratch:SI 3 ""))
6373 (clobber (reg:CC 33))]
6375 && (! REG_P (operands[2])
6376 || ! rtx_equal_p (operands[1], operands[2]))"
6377 [(set (match_dup 3) (match_dup 1))
6378 (parallel [(set (reg:CCAN 33)
6379 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6381 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6382 (set (match_dup 2) (match_dup 3))
6383 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6388 (define_insn "doloop_di"
6391 (ne (match_operand:DI 1 "register_operand" "d,d")
6393 (label_ref (match_operand 0 "" ""))
6395 (set (match_operand:DI 2 "register_operand" "=1,?*m*r")
6396 (plus:DI (match_dup 1) (const_int -1)))
6397 (clobber (match_scratch:DI 3 "=X,&d"))
6398 (clobber (reg:CC 33))]
6401 if (which_alternative != 0)
6403 else if (get_attr_length (insn) == 4)
6404 return "brctg\t%1,%l0";
6408 [(set_attr "op_type" "RI")
6409 (set_attr "type" "branch")
6410 (set (attr "length")
6411 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6412 (const_int 4) (const_int 12)))])
6414 (define_insn "*doloop_di_long"
6417 (ne (match_operand:DI 1 "register_operand" "d,d")
6419 (match_operand 0 "address_operand" "U,U")
6421 (set (match_operand:DI 2 "register_operand" "=1,?*m*d")
6422 (plus:DI (match_dup 1) (const_int -1)))
6423 (clobber (match_scratch:DI 3 "=X,&d"))
6424 (clobber (reg:CC 33))]
6427 if (get_attr_op_type (insn) == OP_TYPE_RRE)
6428 return "bctgr\t%1,%0";
6430 return "bctg\t%1,%a0";
6432 [(set (attr "op_type")
6433 (if_then_else (match_operand 0 "register_operand" "")
6434 (const_string "RRE") (const_string "RXE")))
6435 (set_attr "type" "branch")
6436 (set_attr "atype" "agen")])
6440 (if_then_else (ne (match_operand:DI 1 "register_operand" "")
6442 (match_operand 0 "" "")
6444 (set (match_operand:DI 2 "nonimmediate_operand" "")
6445 (plus:DI (match_dup 1) (const_int -1)))
6446 (clobber (match_scratch:DI 3 ""))
6447 (clobber (reg:CC 33))]
6449 && (! REG_P (operands[2])
6450 || ! rtx_equal_p (operands[1], operands[2]))"
6451 [(set (match_dup 3) (match_dup 1))
6452 (parallel [(set (reg:CCAN 33)
6453 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6455 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6456 (set (match_dup 2) (match_dup 3))
6457 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6463 ;;- Unconditional jump instructions.
6467 ; jump instruction pattern(s).
6471 [(set (pc) (label_ref (match_operand 0 "" "")))]
6474 if (get_attr_length (insn) == 4)
6476 else if (TARGET_64BIT)
6481 [(set_attr "op_type" "RI")
6482 (set_attr "type" "branch")
6483 (set (attr "length")
6484 (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6486 (ne (symbol_ref "TARGET_64BIT") (const_int 0))
6488 (eq (symbol_ref "flag_pic") (const_int 0))
6489 (const_int 6)] (const_int 8)))])
6492 ; indirect-jump instruction pattern(s).
6495 (define_insn "indirect_jump"
6496 [(set (pc) (match_operand 0 "address_operand" "U"))]
6499 if (get_attr_op_type (insn) == OP_TYPE_RR)
6504 [(set (attr "op_type")
6505 (if_then_else (match_operand 0 "register_operand" "")
6506 (const_string "RR") (const_string "RX")))
6507 (set_attr "type" "branch")
6508 (set_attr "atype" "agen")])
6511 ; casesi instruction pattern(s).
6514 (define_insn "casesi_jump"
6515 [(set (pc) (match_operand 0 "address_operand" "U"))
6516 (use (label_ref (match_operand 1 "" "")))]
6519 if (get_attr_op_type (insn) == OP_TYPE_RR)
6524 [(set (attr "op_type")
6525 (if_then_else (match_operand 0 "register_operand" "")
6526 (const_string "RR") (const_string "RX")))
6527 (set_attr "type" "branch")
6528 (set_attr "atype" "agen")])
6530 (define_expand "casesi"
6531 [(match_operand:SI 0 "general_operand" "")
6532 (match_operand:SI 1 "general_operand" "")
6533 (match_operand:SI 2 "general_operand" "")
6534 (label_ref (match_operand 3 "" ""))
6535 (label_ref (match_operand 4 "" ""))]
6538 rtx index = gen_reg_rtx (SImode);
6539 rtx base = gen_reg_rtx (Pmode);
6540 rtx target = gen_reg_rtx (Pmode);
6542 emit_move_insn (index, operands[0]);
6543 emit_insn (gen_subsi3 (index, index, operands[1]));
6544 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6547 if (Pmode != SImode)
6548 index = convert_to_mode (Pmode, index, 1);
6549 if (GET_CODE (index) != REG)
6550 index = copy_to_mode_reg (Pmode, index);
6553 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6555 emit_insn (gen_ashlsi3 (index, index, GEN_INT (2)));
6557 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6559 index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
6560 emit_move_insn (target, index);
6563 target = gen_rtx_PLUS (Pmode, base, target);
6564 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6571 ;;- Jump to subroutine.
6576 ; untyped call instruction pattern(s).
6579 ;; Call subroutine returning any type.
6580 (define_expand "untyped_call"
6581 [(parallel [(call (match_operand 0 "" "")
6583 (match_operand 1 "" "")
6584 (match_operand 2 "" "")])]
6589 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
6591 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6593 rtx set = XVECEXP (operands[2], 0, i);
6594 emit_move_insn (SET_DEST (set), SET_SRC (set));
6597 /* The optimizer does not know that the call sets the function value
6598 registers we stored in the result block. We avoid problems by
6599 claiming that all hard registers are used and clobbered at this
6601 emit_insn (gen_blockage ());
6606 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6607 ;; all of memory. This blocks insns from being moved across this point.
6609 (define_insn "blockage"
6610 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6613 [(set_attr "type" "none")
6614 (set_attr "length" "0")])
6619 ; call instruction pattern(s).
6622 (define_expand "call"
6623 [(call (match_operand 0 "" "")
6624 (match_operand 1 "" ""))
6625 (use (match_operand 2 "" ""))]
6630 /* Direct function calls need special treatment. */
6631 if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
6633 rtx sym = XEXP (operands[0], 0);
6635 /* When calling a global routine in PIC mode, we must
6636 replace the symbol itself with the PLT stub. */
6637 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
6639 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
6640 sym = gen_rtx_CONST (Pmode, sym);
6643 /* Unless we can use the bras(l) insn, force the
6644 routine address into a register. */
6645 if (!TARGET_SMALL_EXEC && !TARGET_64BIT)
6648 sym = legitimize_pic_address (sym, 0);
6650 sym = force_reg (Pmode, sym);
6653 operands[0] = gen_rtx_MEM (QImode, sym);
6657 insn = emit_call_insn (gen_call_exp (operands[0], operands[1],
6658 gen_rtx_REG (Pmode, RETURN_REGNUM)));
6662 (define_expand "call_exp"
6663 [(parallel [(call (match_operand 0 "" "")
6664 (match_operand 1 "" ""))
6665 (clobber (match_operand 2 "" ""))])]
6669 (define_insn "brasl"
6670 [(call (mem:QI (match_operand:DI 0 "bras_sym_operand" "X"))
6671 (match_operand:SI 1 "const_int_operand" "n"))
6672 (clobber (match_operand:DI 2 "register_operand" "=r"))]
6675 [(set_attr "op_type" "RIL")
6676 (set_attr "type" "jsr")])
6679 [(call (mem:QI (match_operand:SI 0 "bras_sym_operand" "X"))
6680 (match_operand:SI 1 "const_int_operand" "n"))
6681 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6684 [(set_attr "op_type" "RI")
6685 (set_attr "type" "jsr")])
6687 (define_insn "basr_64"
6688 [(call (mem:QI (match_operand:DI 0 "register_operand" "a"))
6689 (match_operand:SI 1 "const_int_operand" "n"))
6690 (clobber (match_operand:DI 2 "register_operand" "=r"))]
6693 [(set_attr "op_type" "RR")
6694 (set_attr "type" "jsr")
6695 (set_attr "atype" "agen")])
6697 (define_insn "basr_31"
6698 [(call (mem:QI (match_operand:SI 0 "register_operand" "a"))
6699 (match_operand:SI 1 "const_int_operand" "n"))
6700 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6703 [(set_attr "op_type" "RR")
6704 (set_attr "type" "jsr")
6705 (set_attr "atype" "agen")])
6707 (define_insn "bas_64"
6708 [(call (mem:QI (match_operand:QI 0 "address_operand" "U"))
6709 (match_operand:SI 1 "const_int_operand" "n"))
6710 (clobber (match_operand:DI 2 "register_operand" "=r"))]
6713 [(set_attr "op_type" "RX")
6714 (set_attr "type" "jsr")])
6716 (define_insn "bas_31"
6717 [(call (mem:QI (match_operand:QI 0 "address_operand" "U"))
6718 (match_operand:SI 1 "const_int_operand" "n"))
6719 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6722 [(set_attr "op_type" "RX")
6723 (set_attr "type" "jsr")])
6727 ; call_value instruction pattern(s).
6730 (define_expand "call_value"
6731 [(set (match_operand 0 "" "")
6732 (call (match_operand 1 "" "")
6733 (match_operand 2 "" "")))
6734 (use (match_operand 3 "" ""))]
6739 /* Direct function calls need special treatment. */
6740 if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
6742 rtx sym = XEXP (operands[1], 0);
6744 /* When calling a global routine in PIC mode, we must
6745 replace the symbol itself with the PLT stub. */
6746 if (flag_pic && !SYMBOL_REF_LOCAL_P (sym))
6748 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
6749 sym = gen_rtx_CONST (Pmode, sym);
6752 /* Unless we can use the bras(l) insn, force the
6753 routine address into a register. */
6754 if (!TARGET_SMALL_EXEC && !TARGET_64BIT)
6757 sym = legitimize_pic_address (sym, 0);
6759 sym = force_reg (Pmode, sym);
6762 operands[1] = gen_rtx_MEM (QImode, sym);
6766 insn = emit_call_insn (
6767 gen_call_value_exp (operands[0], operands[1], operands[2],
6768 gen_rtx_REG (Pmode, RETURN_REGNUM)));
6772 (define_expand "call_value_exp"
6773 [(parallel [(set (match_operand 0 "" "")
6774 (call (match_operand 1 "" "")
6775 (match_operand 2 "" "")))
6776 (clobber (match_operand 3 "" ""))])]
6780 (define_insn "brasl_r"
6781 [(set (match_operand 0 "register_operand" "=df")
6782 (call (mem:QI (match_operand:DI 1 "bras_sym_operand" "X"))
6783 (match_operand:SI 2 "const_int_operand" "n")))
6784 (clobber (match_operand:DI 3 "register_operand" "=r"))]
6787 [(set_attr "op_type" "RIL")
6788 (set_attr "type" "jsr")])
6790 (define_insn "bras_r"
6791 [(set (match_operand 0 "register_operand" "=df")
6792 (call (mem:QI (match_operand:SI 1 "bras_sym_operand" "X"))
6793 (match_operand:SI 2 "const_int_operand" "n")))
6794 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6797 [(set_attr "op_type" "RI")
6798 (set_attr "type" "jsr")])
6800 (define_insn "basr_r_64"
6801 [(set (match_operand 0 "register_operand" "=df")
6802 (call (mem:QI (match_operand:DI 1 "register_operand" "a"))
6803 (match_operand:SI 2 "const_int_operand" "n")))
6804 (clobber (match_operand:DI 3 "register_operand" "=r"))]
6807 [(set_attr "op_type" "RR")
6808 (set_attr "type" "jsr")
6809 (set_attr "atype" "agen")])
6811 (define_insn "basr_r_31"
6812 [(set (match_operand 0 "register_operand" "=df")
6813 (call (mem:QI (match_operand:SI 1 "register_operand" "a"))
6814 (match_operand:SI 2 "const_int_operand" "n")))
6815 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6818 [(set_attr "op_type" "RR")
6819 (set_attr "type" "jsr")
6820 (set_attr "atype" "agen")])
6822 (define_insn "bas_r_64"
6823 [(set (match_operand 0 "register_operand" "=df")
6824 (call (mem:QI (match_operand:QI 1 "address_operand" "U"))
6825 (match_operand:SI 2 "const_int_operand" "n")))
6826 (clobber (match_operand:DI 3 "register_operand" "=r"))]
6829 [(set_attr "op_type" "RX")
6830 (set_attr "type" "jsr")])
6832 (define_insn "bas_r_31"
6833 [(set (match_operand 0 "register_operand" "=df")
6834 (call (mem:QI (match_operand:QI 1 "address_operand" "U"))
6835 (match_operand:SI 2 "const_int_operand" "n")))
6836 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6839 [(set_attr "op_type" "RX")
6840 (set_attr "type" "jsr")])
6844 ;;- Thread-local storage support.
6847 (define_insn "get_tp_64"
6848 [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
6849 (unspec:DI [(const_int 0)] UNSPEC_TP))]
6852 ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
6854 [(set_attr "op_type" "NN,RS")
6855 (set_attr "atype" "reg,*")
6856 (set_attr "type" "o3,*")
6857 (set_attr "length" "14,*")])
6859 (define_insn "get_tp_31"
6860 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
6861 (unspec:SI [(const_int 0)] UNSPEC_TP))]
6866 [(set_attr "op_type" "RRE,RS")])
6868 (define_insn "set_tp_64"
6869 [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
6870 (clobber (match_scratch:SI 1 "=d,X"))]
6873 sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
6875 [(set_attr "op_type" "NN,RS")
6876 (set_attr "atype" "reg,*")
6877 (set_attr "type" "o3,*")
6878 (set_attr "length" "14,*")])
6880 (define_insn "set_tp_31"
6881 [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
6886 [(set_attr "op_type" "RRE,RS")])
6888 (define_insn "*tls_load_64"
6889 [(set (match_operand:DI 0 "register_operand" "=d")
6890 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
6891 (match_operand:DI 2 "" "")]
6895 [(set_attr "op_type" "RXE")])
6897 (define_insn "*tls_load_31"
6898 [(set (match_operand:SI 0 "register_operand" "=d,d")
6899 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
6900 (match_operand:SI 2 "" "")]
6906 [(set_attr "op_type" "RX,RXY")])
6908 (define_expand "call_value_tls"
6909 [(set (match_operand 0 "" "")
6910 (call (const_int 0) (const_int 0)))
6911 (use (match_operand 1 "" ""))]
6919 sym = s390_tls_get_offset ();
6920 sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), UNSPEC_PLT);
6921 sym = gen_rtx_CONST (Pmode, sym);
6923 /* Unless we can use the bras(l) insn, force the
6924 routine address into a register. */
6925 if (!TARGET_SMALL_EXEC && !TARGET_64BIT)
6928 sym = legitimize_pic_address (sym, 0);
6930 sym = force_reg (Pmode, sym);
6933 sym = gen_rtx_MEM (QImode, sym);
6936 insn = emit_call_insn (
6937 gen_call_value_tls_exp (operands[0], sym, const0_rtx,
6938 gen_rtx_REG (Pmode, RETURN_REGNUM),
6941 /* The calling convention of __tls_get_offset uses the
6942 GOT register implicitly. */
6943 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
6944 use_reg (&CALL_INSN_FUNCTION_USAGE (insn), operands[0]);
6945 CONST_OR_PURE_CALL_P (insn) = 1;
6950 (define_expand "call_value_tls_exp"
6951 [(parallel [(set (match_operand 0 "" "")
6952 (call (match_operand 1 "" "")
6953 (match_operand 2 "" "")))
6954 (clobber (match_operand 3 "" ""))
6955 (use (match_operand 4 "" ""))])]
6959 (define_insn "brasl_tls"
6960 [(set (match_operand 0 "register_operand" "=df")
6961 (call (mem:QI (match_operand:DI 1 "bras_sym_operand" "X"))
6962 (match_operand:SI 2 "const_int_operand" "n")))
6963 (clobber (match_operand:DI 3 "register_operand" "=r"))
6964 (use (match_operand:DI 4 "" ""))]
6967 [(set_attr "op_type" "RIL")
6968 (set_attr "type" "jsr")])
6970 (define_insn "bras_tls"
6971 [(set (match_operand 0 "register_operand" "=df")
6972 (call (mem:QI (match_operand:SI 1 "bras_sym_operand" "X"))
6973 (match_operand:SI 2 "const_int_operand" "n")))
6974 (clobber (match_operand:SI 3 "register_operand" "=r"))
6975 (use (match_operand:SI 4 "" ""))]
6978 [(set_attr "op_type" "RI")
6979 (set_attr "type" "jsr")])
6981 (define_insn "basr_tls_64"
6982 [(set (match_operand 0 "register_operand" "=df")
6983 (call (mem:QI (match_operand:DI 1 "register_operand" "a"))
6984 (match_operand:SI 2 "const_int_operand" "n")))
6985 (clobber (match_operand:DI 3 "register_operand" "=r"))
6986 (use (match_operand:DI 4 "" ""))]
6989 [(set_attr "op_type" "RR")
6990 (set_attr "type" "jsr")])
6992 (define_insn "basr_tls_31"
6993 [(set (match_operand 0 "register_operand" "=df")
6994 (call (mem:QI (match_operand:SI 1 "register_operand" "a"))
6995 (match_operand:SI 2 "const_int_operand" "n")))
6996 (clobber (match_operand:SI 3 "register_operand" "=r"))
6997 (use (match_operand:SI 4 "" ""))]
7000 [(set_attr "op_type" "RR")
7001 (set_attr "type" "jsr")
7002 (set_attr "atype" "agen")])
7004 (define_insn "bas_tls_64"
7005 [(set (match_operand 0 "register_operand" "=df")
7006 (call (mem:QI (match_operand:QI 1 "address_operand" "U"))
7007 (match_operand:SI 2 "const_int_operand" "n")))
7008 (clobber (match_operand:DI 3 "register_operand" "=r"))
7009 (use (match_operand:DI 4 "" ""))]
7012 [(set_attr "op_type" "RX")
7013 (set_attr "type" "jsr")
7014 (set_attr "atype" "agen")])
7016 (define_insn "bas_tls_31"
7017 [(set (match_operand 0 "register_operand" "=df")
7018 (call (mem:QI (match_operand:QI 1 "address_operand" "U"))
7019 (match_operand:SI 2 "const_int_operand" "n")))
7020 (clobber (match_operand:SI 3 "register_operand" "=r"))
7021 (use (match_operand:SI 4 "" ""))]
7024 [(set_attr "op_type" "RX")
7025 (set_attr "type" "jsr")
7026 (set_attr "atype" "agen")])
7029 ;;- Miscellaneous instructions.
7033 ; allocate stack instruction pattern(s).
7036 (define_expand "allocate_stack"
7038 (plus (reg 15) (match_operand 1 "general_operand" "")))
7039 (set (match_operand 0 "general_operand" "")
7043 rtx stack = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
7044 rtx chain = gen_rtx (MEM, Pmode, stack);
7045 rtx temp = gen_reg_rtx (Pmode);
7047 emit_move_insn (temp, chain);
7050 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7052 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7054 emit_move_insn (chain, temp);
7056 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7062 ; setjmp/longjmp instruction pattern(s).
7065 (define_expand "builtin_setjmp_setup"
7066 [(match_operand 0 "register_operand" "")]
7069 rtx base = gen_rtx_MEM (Pmode, plus_constant (operands[0], 4 * GET_MODE_SIZE (Pmode)));
7070 rtx basereg = gen_rtx_REG (Pmode, BASE_REGISTER);
7072 emit_move_insn (base, basereg);
7076 (define_expand "builtin_setjmp_receiver"
7077 [(match_operand 0 "" "")]
7080 s390_load_got (false);
7081 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7085 (define_expand "builtin_longjmp"
7086 [(match_operand 0 "register_operand" "")]
7089 /* The elements of the buffer are, in order: */
7090 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
7091 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], GET_MODE_SIZE (Pmode)));
7092 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 2 * GET_MODE_SIZE (Pmode)));
7093 rtx base = gen_rtx_MEM (Pmode, plus_constant (operands[0], 4 * GET_MODE_SIZE (Pmode)));
7094 rtx basereg = gen_rtx_REG (Pmode, BASE_REGISTER);
7095 rtx jmp = gen_reg_rtx (Pmode);
7097 emit_move_insn (jmp, lab);
7098 emit_move_insn (basereg, base);
7099 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
7100 emit_move_insn (hard_frame_pointer_rtx, fp);
7102 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
7103 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
7104 emit_insn (gen_rtx_USE (VOIDmode, basereg));
7105 emit_indirect_jump (jmp);
7110 ;; These patterns say how to save and restore the stack pointer. We need not
7111 ;; save the stack pointer at function level since we are careful to
7112 ;; preserve the backchain. At block level, we have to restore the backchain
7113 ;; when we restore the stack pointer.
7115 ;; For nonlocal gotos, we must save both the stack pointer and its
7116 ;; backchain and restore both. Note that in the nonlocal case, the
7117 ;; save area is a memory location.
7119 (define_expand "save_stack_function"
7120 [(match_operand 0 "general_operand" "")
7121 (match_operand 1 "general_operand" "")]
7125 (define_expand "restore_stack_function"
7126 [(match_operand 0 "general_operand" "")
7127 (match_operand 1 "general_operand" "")]
7131 (define_expand "restore_stack_block"
7132 [(use (match_operand 0 "register_operand" ""))
7133 (set (match_dup 2) (match_dup 3))
7134 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7135 (set (match_dup 3) (match_dup 2))]
7138 operands[2] = gen_reg_rtx (Pmode);
7139 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7142 (define_expand "save_stack_nonlocal"
7143 [(match_operand 0 "memory_operand" "")
7144 (match_operand 1 "register_operand" "")]
7147 rtx temp = gen_reg_rtx (Pmode);
7149 /* Copy the backchain to the first word, sp to the second. */
7150 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7151 emit_move_insn (operand_subword (operands[0], 0, 0,
7152 TARGET_64BIT ? TImode : DImode),
7154 emit_move_insn (operand_subword (operands[0], 1, 0,
7155 TARGET_64BIT ? TImode : DImode),
7160 (define_expand "restore_stack_nonlocal"
7161 [(match_operand 0 "register_operand" "")
7162 (match_operand 1 "memory_operand" "")]
7165 rtx temp = gen_reg_rtx (Pmode);
7167 /* Restore the backchain from the first word, sp from the second. */
7168 emit_move_insn (temp,
7169 operand_subword (operands[1], 0, 0,
7170 TARGET_64BIT ? TImode : DImode));
7171 emit_move_insn (operands[0],
7172 operand_subword (operands[1], 1, 0,
7173 TARGET_64BIT ? TImode : DImode));
7174 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7180 ; nop instruction pattern(s).
7187 [(set_attr "op_type" "RR")])
7191 ; Special literal pool access instruction pattern(s).
7194 (define_insn "*pool_entry"
7195 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7196 UNSPECV_POOL_ENTRY)]
7199 enum machine_mode mode = GET_MODE (PATTERN (insn));
7200 unsigned int align = GET_MODE_BITSIZE (mode);
7201 s390_output_pool_entry (asm_out_file, operands[0], mode, align);
7204 [(set_attr "op_type" "NN")
7205 (set (attr "length")
7206 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7208 (define_insn "pool_start_31"
7209 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7212 [(set_attr "op_type" "NN")
7213 (set_attr "length" "2")])
7215 (define_insn "pool_end_31"
7216 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7219 [(set_attr "op_type" "NN")
7220 (set_attr "length" "2")])
7222 (define_insn "pool_start_64"
7223 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7225 ".section\t.rodata\;.align\t8"
7226 [(set_attr "op_type" "NN")
7227 (set_attr "length" "0")])
7229 (define_insn "pool_end_64"
7230 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7233 [(set_attr "op_type" "NN")
7234 (set_attr "length" "0")])
7236 (define_insn "main_base_31_small"
7237 [(set (match_operand:SI 0 "register_operand" "=a")
7238 (unspec:SI [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7241 [(set_attr "op_type" "RR")
7242 (set_attr "type" "la")])
7244 (define_insn "main_base_31_large"
7245 [(set (match_operand:SI 0 "register_operand" "=a")
7246 (unspec:SI [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7247 (set (pc) (label_ref (match_operand 2 "" "")))]
7250 [(set_attr "op_type" "RI")])
7252 (define_insn "main_base_64"
7253 [(set (match_operand:DI 0 "register_operand" "=a")
7254 (unspec:DI [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7257 [(set_attr "op_type" "RIL")
7258 (set_attr "type" "larl")])
7260 (define_insn "main_pool"
7261 [(unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL)]
7264 [(set_attr "op_type" "NN")])
7266 (define_insn "reload_base_31"
7267 [(set (match_operand:SI 0 "register_operand" "=a")
7268 (unspec:SI [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7270 "basr\t%0,0\;la\t%0,%1-.(%0)"
7271 [(set_attr "op_type" "NN")
7272 (set_attr "type" "la")
7273 (set_attr "length" "6")])
7275 (define_insn "reload_base_64"
7276 [(set (match_operand:DI 0 "register_operand" "=a")
7277 (unspec:DI [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7280 [(set_attr "op_type" "RIL")
7281 (set_attr "type" "larl")])
7284 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7287 [(set_attr "op_type" "NN")
7288 (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7291 ;; Insns related to generating the function prologue and epilogue.
7295 (define_expand "prologue"
7296 [(use (const_int 0))]
7298 "s390_emit_prologue (); DONE;")
7300 (define_expand "epilogue"
7301 [(use (const_int 1))]
7303 "s390_emit_epilogue (); DONE;")
7306 (define_insn "*return_si"
7308 (use (match_operand:SI 0 "register_operand" "a"))]
7311 [(set_attr "op_type" "RR")
7312 (set_attr "type" "jsr")
7313 (set_attr "atype" "agen")])
7315 (define_insn "*return_di"
7317 (use (match_operand:DI 0 "register_operand" "a"))]
7320 [(set_attr "op_type" "RR")
7321 (set_attr "type" "jsr")
7322 (set_attr "atype" "agen")])
7324 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7325 ;; pointer. This is used for compatability.
7327 (define_expand "ptr_extend"
7328 [(set (match_operand:DI 0 "register_operand" "=r")
7329 (match_operand:SI 1 "register_operand" "r"))]
7332 emit_insn (gen_anddi3 (operands[0],
7333 gen_lowpart (DImode, operands[1]),
7334 GEN_INT (0x7fffffff)));