builtins.c: Rename movstr*, except for movstrict*, to movmem* and clrstr* to clrmem*.
[gcc.git] / gcc / config / s390 / s390.md
1 ;;- Machine description for GNU compiler -- S/390 / zSeries version.
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and
5 ;; Ulrich Weigand (uweigand@de.ibm.com).
6
7 ;; This file is part of GCC.
8
9 ;; GCC is free software; you can redistribute it and/or modify it under
10 ;; the terms of the GNU General Public License as published by the Free
11 ;; Software Foundation; either version 2, or (at your option) any later
12 ;; version.
13
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 ;; for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING. If not, write to the Free
21 ;; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 ;; 02111-1307, USA.
23
24 ;;
25 ;; Special constraints for s/390 machine description:
26 ;;
27 ;; a -- Any address register from 1 to 15.
28 ;; d -- Any register from 0 to 15.
29 ;; I -- An 8-bit constant (0..255).
30 ;; J -- A 12-bit constant (0..4095).
31 ;; K -- A 16-bit constant (-32768..32767).
32 ;; L -- Value appropriate as displacement.
33 ;; (0..4095) for short displacement
34 ;; (-524288..524287) for long displacement
35 ;; M -- Constant integer with a value of 0x7fffffff.
36 ;; N -- Multiple letter constraint followed by 4 parameter letters.
37 ;; 0..9: number of the part counting from most to least significant
38 ;; H,Q: mode of the part
39 ;; D,S,H: mode of the containing operand
40 ;; 0,F: value of the other parts (F - all bits set)
41 ;;
42 ;; The constraint matches if the specified part of a constant
43 ;; has a value different from its other parts.
44 ;; Q -- Memory reference without index register and with short displacement.
45 ;; R -- Memory reference with index register and short displacement.
46 ;; S -- Memory reference without index register but with long displacement.
47 ;; T -- Memory reference with index register and long displacement.
48 ;; U -- Pointer with short displacement.
49 ;; W -- Pointer with long displacement.
50 ;; Y -- Shift count operand.
51 ;;
52 ;; Special formats used for outputting 390 instructions.
53 ;;
54 ;; %C: print opcode suffix for branch condition.
55 ;; %D: print opcode suffix for inverse branch condition.
56 ;; %J: print tls_load/tls_gdcall/tls_ldcall suffix
57 ;; %O: print only the displacement of a memory reference.
58 ;; %R: print only the base register of a memory reference.
59 ;; %N: print the second word of a DImode operand.
60 ;; %M: print the second word of a TImode operand.
61
62 ;; %b: print integer X as if it's an unsigned byte.
63 ;; %x: print integer X as if it's an unsigned word.
64 ;; %h: print integer X as if it's a signed word.
65 ;; %i: print the first nonzero HImode part of X
66 ;; %j: print the first HImode part unequal to 0xffff of X
67
68 ;;
69 ;; We have a special constraint for pattern matching.
70 ;;
71 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
72 ;;
73
74 ;;
75 ;; UNSPEC usage
76 ;;
77
78 (define_constants
79 [; Miscellaneous
80 (UNSPEC_ROUND 1)
81 (UNSPEC_SETHIGH 10)
82
83 ; GOT/PLT and lt-relative accesses
84 (UNSPEC_LTREL_OFFSET 100)
85 (UNSPEC_LTREL_BASE 101)
86 (UNSPEC_GOTENT 110)
87 (UNSPEC_GOT 111)
88 (UNSPEC_GOTOFF 112)
89 (UNSPEC_PLT 113)
90 (UNSPEC_PLTOFF 114)
91
92 ; Literal pool
93 (UNSPEC_RELOAD_BASE 210)
94 (UNSPEC_MAIN_BASE 211)
95 (UNSPEC_LTREF 212)
96
97 ; TLS relocation specifiers
98 (UNSPEC_TLSGD 500)
99 (UNSPEC_TLSLDM 501)
100 (UNSPEC_NTPOFF 502)
101 (UNSPEC_DTPOFF 503)
102 (UNSPEC_GOTNTPOFF 504)
103 (UNSPEC_INDNTPOFF 505)
104
105 ; TLS support
106 (UNSPEC_TP 510)
107 (UNSPEC_TLSLDM_NTPOFF 511)
108 (UNSPEC_TLS_LOAD 512)
109
110 ; String Functions
111 (UNSPEC_SRST 600)
112 ])
113
114 ;;
115 ;; UNSPEC_VOLATILE usage
116 ;;
117
118 (define_constants
119 [; Blockage
120 (UNSPECV_BLOCKAGE 0)
121
122 ; TPF Support
123 (UNSPECV_TPF_PROLOGUE 20)
124 (UNSPECV_TPF_EPILOGUE 21)
125
126 ; Literal pool
127 (UNSPECV_POOL 200)
128 (UNSPECV_POOL_START 201)
129 (UNSPECV_POOL_END 202)
130 (UNSPECV_POOL_ENTRY 203)
131 (UNSPECV_MAIN_POOL 300)
132
133 ; TLS support
134 (UNSPECV_SET_TP 500)
135 ])
136
137
138 ;; Processor type. This attribute must exactly match the processor_type
139 ;; enumeration in s390.h. The current machine description does not
140 ;; distinguish between g5 and g6, but there are differences between the two
141 ;; CPUs could in theory be modeled.
142
143 (define_attr "cpu" "g5,g6,z900,z990"
144 (const (symbol_ref "s390_tune")))
145
146 ;; Define an insn type attribute. This is used in function unit delay
147 ;; computations.
148
149 (define_attr "type" "none,integer,load,lr,la,larl,lm,stm,
150 cs,vs,store,imul,idiv,
151 branch,jsr,fsimpd,fsimps,
152 floadd,floads,fstored, fstores,
153 fmuld,fmuls,fdivd,fdivs,
154 ftoi,itof,fsqrtd,fsqrts,
155 other,o2,o3"
156 (const_string "integer"))
157
158 ;; Operand type. Used to default length attribute values
159
160 (define_attr "op_type"
161 "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY"
162 (const_string "RX"))
163
164 ;; Insn are devide in two classes:
165 ;; agen: Insn using agen
166 ;; reg: Insn not using agen
167
168 (define_attr "atype" "agen,reg"
169 (cond [ (eq_attr "op_type" "E") (const_string "reg")
170 (eq_attr "op_type" "RR") (const_string "reg")
171 (eq_attr "op_type" "RX") (const_string "agen")
172 (eq_attr "op_type" "RI") (const_string "reg")
173 (eq_attr "op_type" "RRE") (const_string "reg")
174 (eq_attr "op_type" "RS") (const_string "agen")
175 (eq_attr "op_type" "RSI") (const_string "agen")
176 (eq_attr "op_type" "S") (const_string "agen")
177 (eq_attr "op_type" "SI") (const_string "agen")
178 (eq_attr "op_type" "SS") (const_string "agen")
179 (eq_attr "op_type" "SSE") (const_string "agen")
180 (eq_attr "op_type" "RXE") (const_string "agen")
181 (eq_attr "op_type" "RSE") (const_string "agen")
182 (eq_attr "op_type" "RIL") (const_string "agen")
183 (eq_attr "op_type" "RXY") (const_string "agen")
184 (eq_attr "op_type" "RSY") (const_string "agen")
185 (eq_attr "op_type" "SIY") (const_string "agen")]
186 (const_string "reg")))
187
188 ;; Pipeline description for z900. For lack of anything better,
189 ;; this description is also used for the g5 and g6.
190 (include "2064.md")
191
192 ;; Pipeline description for z990.
193 (include "2084.md")
194
195 ;; Length in bytes.
196
197 (define_attr "length" ""
198 (cond [ (eq_attr "op_type" "E") (const_int 2)
199 (eq_attr "op_type" "RR") (const_int 2)
200 (eq_attr "op_type" "RX") (const_int 4)
201 (eq_attr "op_type" "RI") (const_int 4)
202 (eq_attr "op_type" "RRE") (const_int 4)
203 (eq_attr "op_type" "RS") (const_int 4)
204 (eq_attr "op_type" "RSI") (const_int 4)
205 (eq_attr "op_type" "S") (const_int 4)
206 (eq_attr "op_type" "SI") (const_int 4)
207 (eq_attr "op_type" "SS") (const_int 6)
208 (eq_attr "op_type" "SSE") (const_int 6)
209 (eq_attr "op_type" "RXE") (const_int 6)
210 (eq_attr "op_type" "RSE") (const_int 6)
211 (eq_attr "op_type" "RIL") (const_int 6)
212 (eq_attr "op_type" "RXY") (const_int 6)
213 (eq_attr "op_type" "RSY") (const_int 6)
214 (eq_attr "op_type" "SIY") (const_int 6)]
215 (const_int 4)))
216
217 ;; Define attributes for `asm' insns.
218
219 (define_asm_attributes [(set_attr "type" "other")
220 (set_attr "op_type" "NN")])
221
222 ;;
223 ;; Condition Codes
224 ;;
225 ;
226 ; CCL: Zero Nonzero Zero Nonzero (AL, ALR, SL, SLR, N, NC, NI, NR, O, OC, OI, OR, X, XC, XI, XR)
227 ; CCA: Zero <Zero >Zero Overflow (A, AR, AH, AHI, S, SR, SH, SHI, LTR, LCR, LNR, LPR, SLA, SLDA, SLA, SRDA)
228 ; CCU: Equal ULess UGreater -- (CL, CLR, CLI, CLM)
229 ; CCS: Equal SLess SGreater -- (C, CR, CH, CHI, ICM)
230 ; CCT: Zero Mixed Mixed Ones (TM, TMH, TML)
231
232 ; CCZ -> CCL / CCZ1
233 ; CCZ1 -> CCA/CCU/CCS/CCT
234 ; CCS -> CCA
235
236 ; String: CLC, CLCL, CLCLE, CLST, CUSE, MVCL, MVCLE, MVPG, MVST, SRST
237 ; Clobber: CKSM, CFC, CS, CDS, CUUTF, CUTFU, PLO, SPM, STCK, STCKE, TS, TRT, TRE, UPT
238
239
240 ;;
241 ;;- Compare instructions.
242 ;;
243
244 (define_expand "cmpdi"
245 [(set (reg:CC 33)
246 (compare:CC (match_operand:DI 0 "register_operand" "")
247 (match_operand:DI 1 "general_operand" "")))]
248 "TARGET_64BIT"
249 {
250 s390_compare_op0 = operands[0];
251 s390_compare_op1 = operands[1];
252 DONE;
253 })
254
255 (define_expand "cmpsi"
256 [(set (reg:CC 33)
257 (compare:CC (match_operand:SI 0 "register_operand" "")
258 (match_operand:SI 1 "general_operand" "")))]
259 ""
260 {
261 s390_compare_op0 = operands[0];
262 s390_compare_op1 = operands[1];
263 DONE;
264 })
265
266 (define_expand "cmpdf"
267 [(set (reg:CC 33)
268 (compare:CC (match_operand:DF 0 "register_operand" "")
269 (match_operand:DF 1 "general_operand" "")))]
270 "TARGET_HARD_FLOAT"
271 {
272 s390_compare_op0 = operands[0];
273 s390_compare_op1 = operands[1];
274 DONE;
275 })
276
277 (define_expand "cmpsf"
278 [(set (reg:CC 33)
279 (compare:CC (match_operand:SF 0 "register_operand" "")
280 (match_operand:SF 1 "general_operand" "")))]
281 "TARGET_HARD_FLOAT"
282 {
283 s390_compare_op0 = operands[0];
284 s390_compare_op1 = operands[1];
285 DONE;
286 })
287
288
289 ; Test-under-Mask (zero_extract) instructions
290
291 (define_insn "*tmdi_ext"
292 [(set (reg 33)
293 (compare (zero_extract:DI (match_operand:DI 0 "register_operand" "d")
294 (match_operand:DI 1 "const_int_operand" "n")
295 (match_operand:DI 2 "const_int_operand" "n"))
296 (const_int 0)))]
297 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT
298 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
299 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 64
300 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
301 == INTVAL (operands[2]) >> 4"
302 {
303 int part = INTVAL (operands[2]) >> 4;
304 int block = (1 << INTVAL (operands[1])) - 1;
305 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
306
307 operands[2] = GEN_INT (block << shift);
308
309 switch (part)
310 {
311 case 0: return "tmhh\t%0,%x2";
312 case 1: return "tmhl\t%0,%x2";
313 case 2: return "tmlh\t%0,%x2";
314 case 3: return "tmll\t%0,%x2";
315 default: abort ();
316 }
317 }
318 [(set_attr "op_type" "RI")])
319
320 (define_insn "*tmsi_ext"
321 [(set (reg 33)
322 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
323 (match_operand:SI 1 "const_int_operand" "n")
324 (match_operand:SI 2 "const_int_operand" "n"))
325 (const_int 0)))]
326 "s390_match_ccmode(insn, CCTmode)
327 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
328 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 32
329 && (INTVAL (operands[1]) + INTVAL (operands[2]) - 1) >> 4
330 == INTVAL (operands[2]) >> 4"
331 {
332 int part = INTVAL (operands[2]) >> 4;
333 int block = (1 << INTVAL (operands[1])) - 1;
334 int shift = 16 - INTVAL (operands[1]) - (INTVAL (operands[2]) & 15);
335
336 operands[2] = GEN_INT (block << shift);
337
338 switch (part)
339 {
340 case 0: return "tmh\t%0,%x2";
341 case 1: return "tml\t%0,%x2";
342 default: abort ();
343 }
344 }
345 [(set_attr "op_type" "RI")])
346
347 (define_insn "*tmqisi_ext"
348 [(set (reg 33)
349 (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,S")
350 (match_operand:SI 1 "const_int_operand" "n,n")
351 (match_operand:SI 2 "const_int_operand" "n,n"))
352 (const_int 0)))]
353 "!TARGET_64BIT && s390_match_ccmode(insn, CCTmode)
354 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
355 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
356 {
357 int block = (1 << INTVAL (operands[1])) - 1;
358 int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
359
360 operands[2] = GEN_INT (block << shift);
361 return which_alternative == 0 ? "tm\t%0,%b2" : "tmy\t%0,%b2";
362 }
363 [(set_attr "op_type" "SI,SIY")])
364
365 (define_insn "*tmqidi_ext"
366 [(set (reg 33)
367 (compare (zero_extract:DI (match_operand:QI 0 "memory_operand" "Q,S")
368 (match_operand:SI 1 "const_int_operand" "n,n")
369 (match_operand:SI 2 "const_int_operand" "n,n"))
370 (const_int 0)))]
371 "TARGET_64BIT && s390_match_ccmode(insn, CCTmode)
372 && INTVAL (operands[1]) >= 1 && INTVAL (operands[2]) >= 0
373 && INTVAL (operands[1]) + INTVAL (operands[2]) <= 8"
374 {
375 int block = (1 << INTVAL (operands[1])) - 1;
376 int shift = 8 - INTVAL (operands[1]) - INTVAL (operands[2]);
377
378 operands[2] = GEN_INT (block << shift);
379 return which_alternative == 0 ? "tm\t%0,%b2" : "tmy\t%0,%b2";
380 }
381 [(set_attr "op_type" "SI,SIY")])
382
383
384 ; Test-under-Mask instructions
385
386 (define_insn "*tmdi_mem"
387 [(set (reg 33)
388 (compare (and:DI (match_operand:DI 0 "memory_operand" "Q,S")
389 (match_operand:DI 1 "immediate_operand" "n,n"))
390 (match_operand:DI 2 "immediate_operand" "n,n")))]
391 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
392 && s390_single_part (operands[1], DImode, QImode, 0) >= 0"
393 {
394 int part = s390_single_part (operands[1], DImode, QImode, 0);
395 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
396
397 operands[0] = gen_rtx_MEM (QImode,
398 plus_constant (XEXP (operands[0], 0), part));
399 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
400 }
401 [(set_attr "op_type" "SI,SIY")])
402
403 (define_insn "*tmsi_mem"
404 [(set (reg 33)
405 (compare (and:SI (match_operand:SI 0 "memory_operand" "Q,S")
406 (match_operand:SI 1 "immediate_operand" "n,n"))
407 (match_operand:SI 2 "immediate_operand" "n,n")))]
408 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
409 && s390_single_part (operands[1], SImode, QImode, 0) >= 0"
410 {
411 int part = s390_single_part (operands[1], SImode, QImode, 0);
412 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
413
414 operands[0] = gen_rtx_MEM (QImode,
415 plus_constant (XEXP (operands[0], 0), part));
416 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
417 }
418 [(set_attr "op_type" "SI")])
419
420 (define_insn "*tmhi_mem"
421 [(set (reg 33)
422 (compare (and:SI (subreg:SI (match_operand:HI 0 "memory_operand" "Q,S") 0)
423 (match_operand:SI 1 "immediate_operand" "n,n"))
424 (match_operand:SI 2 "immediate_operand" "n,n")))]
425 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))
426 && s390_single_part (operands[1], HImode, QImode, 0) >= 0"
427 {
428 int part = s390_single_part (operands[1], HImode, QImode, 0);
429 operands[1] = GEN_INT (s390_extract_part (operands[1], QImode, 0));
430
431 operands[0] = gen_rtx_MEM (QImode,
432 plus_constant (XEXP (operands[0], 0), part));
433 return which_alternative == 0 ? "tm\t%0,%b1" : "tmy\t%0,%b1";
434 }
435 [(set_attr "op_type" "SI")])
436
437 (define_insn "*tmqi_mem"
438 [(set (reg 33)
439 (compare (and:SI (subreg:SI (match_operand:QI 0 "memory_operand" "Q,S") 0)
440 (match_operand:SI 1 "immediate_operand" "n,n"))
441 (match_operand:SI 2 "immediate_operand" "n,n")))]
442 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 0))"
443 "@
444 tm\t%0,%b1
445 tmy\t%0,%b1"
446 [(set_attr "op_type" "SI,SIY")])
447
448 (define_insn "*tmdi_reg"
449 [(set (reg 33)
450 (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d")
451 (match_operand:DI 1 "immediate_operand"
452 "N0HD0,N1HD0,N2HD0,N3HD0"))
453 (match_operand:DI 2 "immediate_operand" "n,n,n,n")))]
454 "TARGET_64BIT
455 && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
456 && s390_single_part (operands[1], DImode, HImode, 0) >= 0"
457 "@
458 tmhh\t%0,%i1
459 tmhl\t%0,%i1
460 tmlh\t%0,%i1
461 tmll\t%0,%i1"
462 [(set_attr "op_type" "RI")])
463
464 (define_insn "*tmsi_reg"
465 [(set (reg 33)
466 (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d")
467 (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0"))
468 (match_operand:SI 2 "immediate_operand" "n,n")))]
469 "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], 1))
470 && s390_single_part (operands[1], SImode, HImode, 0) >= 0"
471 "@
472 tmh\t%0,%i1
473 tml\t%0,%i1"
474 [(set_attr "op_type" "RI")])
475
476 (define_insn "*tmhi_full"
477 [(set (reg 33)
478 (compare (match_operand:HI 0 "register_operand" "d")
479 (match_operand:HI 1 "immediate_operand" "n")))]
480 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
481 "tml\t%0,65535"
482 [(set_attr "op_type" "RX")])
483
484 (define_insn "*tmqi_full"
485 [(set (reg 33)
486 (compare (match_operand:QI 0 "register_operand" "d")
487 (match_operand:QI 1 "immediate_operand" "n")))]
488 "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], 1))"
489 "tml\t%0,255"
490 [(set_attr "op_type" "RI")])
491
492
493 ; Load-and-Test instructions
494
495 (define_insn "*tstdi_sign"
496 [(set (reg 33)
497 (compare (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 0 "register_operand" "d") 0)
498 (const_int 32)) (const_int 32))
499 (match_operand:DI 1 "const0_operand" "")))
500 (set (match_operand:DI 2 "register_operand" "=d")
501 (sign_extend:DI (match_dup 0)))]
502 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
503 "ltgfr\t%2,%0"
504 [(set_attr "op_type" "RRE")])
505
506 (define_insn "*tstdi"
507 [(set (reg 33)
508 (compare (match_operand:DI 0 "register_operand" "d")
509 (match_operand:DI 1 "const0_operand" "")))
510 (set (match_operand:DI 2 "register_operand" "=d")
511 (match_dup 0))]
512 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
513 "ltgr\t%2,%0"
514 [(set_attr "op_type" "RRE")])
515
516 (define_insn "*tstdi_cconly"
517 [(set (reg 33)
518 (compare (match_operand:DI 0 "register_operand" "d")
519 (match_operand:DI 1 "const0_operand" "")))]
520 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
521 "ltgr\t%0,%0"
522 [(set_attr "op_type" "RRE")])
523
524 (define_insn "*tstdi_cconly_31"
525 [(set (reg 33)
526 (compare (match_operand:DI 0 "register_operand" "d")
527 (match_operand:DI 1 "const0_operand" "")))]
528 "s390_match_ccmode(insn, CCSmode) && !TARGET_64BIT"
529 "srda\t%0,0"
530 [(set_attr "op_type" "RS")
531 (set_attr "atype" "reg")])
532
533
534 (define_insn "*tstsi"
535 [(set (reg 33)
536 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
537 (match_operand:SI 1 "const0_operand" "")))
538 (set (match_operand:SI 2 "register_operand" "=d,d,d")
539 (match_dup 0))]
540 "s390_match_ccmode(insn, CCSmode)"
541 "@
542 ltr\t%2,%0
543 icm\t%2,15,%0
544 icmy\t%2,15,%0"
545 [(set_attr "op_type" "RR,RS,RSY")])
546
547 (define_insn "*tstsi_cconly"
548 [(set (reg 33)
549 (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S")
550 (match_operand:SI 1 "const0_operand" "")))
551 (clobber (match_scratch:SI 2 "=X,d,d"))]
552 "s390_match_ccmode(insn, CCSmode)"
553 "@
554 ltr\t%0,%0
555 icm\t%2,15,%0
556 icmy\t%2,15,%0"
557 [(set_attr "op_type" "RR,RS,RSY")])
558
559 (define_insn "*tstsi_cconly2"
560 [(set (reg 33)
561 (compare (match_operand:SI 0 "register_operand" "d")
562 (match_operand:SI 1 "const0_operand" "")))]
563 "s390_match_ccmode(insn, CCSmode)"
564 "ltr\t%0,%0"
565 [(set_attr "op_type" "RR")])
566
567 (define_insn "*tsthiCCT"
568 [(set (reg 33)
569 (compare (match_operand:HI 0 "nonimmediate_operand" "?Q,?S,d")
570 (match_operand:HI 1 "const0_operand" "")))
571 (set (match_operand:HI 2 "register_operand" "=d,d,0")
572 (match_dup 0))]
573 "s390_match_ccmode(insn, CCTmode)"
574 "@
575 icm\t%2,3,%0
576 icmy\t%2,3,%0
577 tml\t%0,65535"
578 [(set_attr "op_type" "RS,RSY,RI")])
579
580 (define_insn "*tsthiCCT_cconly"
581 [(set (reg 33)
582 (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d")
583 (match_operand:HI 1 "const0_operand" "")))
584 (clobber (match_scratch:HI 2 "=d,d,X"))]
585 "s390_match_ccmode(insn, CCTmode)"
586 "@
587 icm\t%2,3,%0
588 icmy\t%2,3,%0
589 tml\t%0,65535"
590 [(set_attr "op_type" "RS,RSY,RI")])
591
592 (define_insn "*tsthi"
593 [(set (reg 33)
594 (compare (match_operand:HI 0 "s_operand" "Q,S")
595 (match_operand:HI 1 "const0_operand" "")))
596 (set (match_operand:HI 2 "register_operand" "=d,d")
597 (match_dup 0))]
598 "s390_match_ccmode(insn, CCSmode)"
599 "@
600 icm\t%2,3,%0
601 icmy\t%2,3,%0"
602 [(set_attr "op_type" "RS,RSY")])
603
604 (define_insn "*tsthi_cconly"
605 [(set (reg 33)
606 (compare (match_operand:HI 0 "s_operand" "Q,S")
607 (match_operand:HI 1 "const0_operand" "")))
608 (clobber (match_scratch:HI 2 "=d,d"))]
609 "s390_match_ccmode(insn, CCSmode)"
610 "@
611 icm\t%2,3,%0
612 icmy\t%2,3,%0"
613 [(set_attr "op_type" "RS,RSY")])
614
615 (define_insn "*tstqiCCT"
616 [(set (reg 33)
617 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
618 (match_operand:QI 1 "const0_operand" "")))
619 (set (match_operand:QI 2 "register_operand" "=d,d,0")
620 (match_dup 0))]
621 "s390_match_ccmode(insn, CCTmode)"
622 "@
623 icm\t%2,1,%0
624 icmy\t%2,1,%0
625 tml\t%0,255"
626 [(set_attr "op_type" "RS,RSY,RI")])
627
628 (define_insn "*tstqiCCT_cconly"
629 [(set (reg 33)
630 (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d")
631 (match_operand:QI 1 "const0_operand" "")))]
632 "s390_match_ccmode(insn, CCTmode)"
633 "@
634 cli\t%0,0
635 cliy\t%0,0
636 tml\t%0,255"
637 [(set_attr "op_type" "SI,SIY,RI")])
638
639 (define_insn "*tstqi"
640 [(set (reg 33)
641 (compare (match_operand:QI 0 "s_operand" "Q,S")
642 (match_operand:QI 1 "const0_operand" "")))
643 (set (match_operand:QI 2 "register_operand" "=d,d")
644 (match_dup 0))]
645 "s390_match_ccmode(insn, CCSmode)"
646 "@
647 icm\t%2,1,%0
648 icmy\t%2,1,%0"
649 [(set_attr "op_type" "RS,RSY")])
650
651 (define_insn "*tstqi_cconly"
652 [(set (reg 33)
653 (compare (match_operand:QI 0 "s_operand" "Q,S")
654 (match_operand:QI 1 "const0_operand" "")))
655 (clobber (match_scratch:QI 2 "=d,d"))]
656 "s390_match_ccmode(insn, CCSmode)"
657 "@
658 icm\t%2,1,%0
659 icmy\t%2,1,%0"
660 [(set_attr "op_type" "RS,RSY")])
661
662
663 ; Compare (signed) instructions
664
665 (define_insn "*cmpdi_ccs_sign"
666 [(set (reg 33)
667 (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
668 (match_operand:DI 0 "register_operand" "d,d")))]
669 "s390_match_ccmode(insn, CCSRmode) && TARGET_64BIT"
670 "@
671 cgfr\t%0,%1
672 cgf\t%0,%1"
673 [(set_attr "op_type" "RRE,RXY")])
674
675 (define_insn "*cmpdi_ccs"
676 [(set (reg 33)
677 (compare (match_operand:DI 0 "register_operand" "d,d,d")
678 (match_operand:DI 1 "general_operand" "d,K,m")))]
679 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
680 "@
681 cgr\t%0,%1
682 cghi\t%0,%c1
683 cg\t%0,%1"
684 [(set_attr "op_type" "RRE,RI,RXY")])
685
686 (define_insn "*cmpsi_ccs_sign"
687 [(set (reg 33)
688 (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T"))
689 (match_operand:SI 0 "register_operand" "d,d")))]
690 "s390_match_ccmode(insn, CCSRmode)"
691 "@
692 ch\t%0,%1
693 chy\t%0,%1"
694 [(set_attr "op_type" "RX,RXY")])
695
696 (define_insn "*cmpsi_ccs"
697 [(set (reg 33)
698 (compare (match_operand:SI 0 "register_operand" "d,d,d,d")
699 (match_operand:SI 1 "general_operand" "d,K,R,T")))]
700 "s390_match_ccmode(insn, CCSmode)"
701 "@
702 cr\t%0,%1
703 chi\t%0,%c1
704 c\t%0,%1
705 cy\t%0,%1"
706 [(set_attr "op_type" "RR,RI,RX,RXY")])
707
708
709 ; Compare (unsigned) instructions
710
711 (define_insn "*cmpdi_ccu_zero"
712 [(set (reg 33)
713 (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m"))
714 (match_operand:DI 0 "register_operand" "d,d")))]
715 "s390_match_ccmode(insn, CCURmode) && TARGET_64BIT"
716 "@
717 clgfr\t%0,%1
718 clgf\t%0,%1"
719 [(set_attr "op_type" "RRE,RXY")])
720
721 (define_insn "*cmpdi_ccu"
722 [(set (reg 33)
723 (compare (match_operand:DI 0 "register_operand" "d,d")
724 (match_operand:DI 1 "general_operand" "d,m")))]
725 "s390_match_ccmode(insn, CCUmode) && TARGET_64BIT"
726 "@
727 clgr\t%0,%1
728 clg\t%0,%1"
729 [(set_attr "op_type" "RRE,RXY")])
730
731 (define_insn "*cmpsi_ccu"
732 [(set (reg 33)
733 (compare (match_operand:SI 0 "register_operand" "d,d,d")
734 (match_operand:SI 1 "general_operand" "d,R,T")))]
735 "s390_match_ccmode(insn, CCUmode)"
736 "@
737 clr\t%0,%1
738 cl\t%0,%1
739 cly\t%0,%1"
740 [(set_attr "op_type" "RR,RX,RXY")])
741
742 (define_insn "*cmphi_ccu"
743 [(set (reg 33)
744 (compare (match_operand:HI 0 "register_operand" "d,d")
745 (match_operand:HI 1 "s_imm_operand" "Q,S")))]
746 "s390_match_ccmode(insn, CCUmode)"
747 "@
748 clm\t%0,3,%1
749 clmy\t%0,3,%1"
750 [(set_attr "op_type" "RS,RSY")])
751
752 (define_insn "*cmpqi_ccu"
753 [(set (reg 33)
754 (compare (match_operand:QI 0 "register_operand" "d,d")
755 (match_operand:QI 1 "s_imm_operand" "Q,S")))]
756 "s390_match_ccmode(insn, CCUmode)"
757 "@
758 clm\t%0,1,%1
759 clmy\t%0,1,%1"
760 [(set_attr "op_type" "RS,RSY")])
761
762 (define_insn "*cli"
763 [(set (reg 33)
764 (compare (match_operand:QI 0 "memory_operand" "Q,S")
765 (match_operand:QI 1 "immediate_operand" "n,n")))]
766 "s390_match_ccmode (insn, CCUmode)"
767 "@
768 cli\t%0,%b1
769 cliy\t%0,%b1"
770 [(set_attr "op_type" "SI,SIY")])
771
772 (define_insn "*cmpdi_ccu_mem"
773 [(set (reg 33)
774 (compare (match_operand:DI 0 "s_operand" "Q")
775 (match_operand:DI 1 "s_imm_operand" "Q")))]
776 "s390_match_ccmode(insn, CCUmode)"
777 "clc\t%O0(8,%R0),%1"
778 [(set_attr "op_type" "SS")])
779
780 (define_insn "*cmpsi_ccu_mem"
781 [(set (reg 33)
782 (compare (match_operand:SI 0 "s_operand" "Q")
783 (match_operand:SI 1 "s_imm_operand" "Q")))]
784 "s390_match_ccmode(insn, CCUmode)"
785 "clc\t%O0(4,%R0),%1"
786 [(set_attr "op_type" "SS")])
787
788 (define_insn "*cmphi_ccu_mem"
789 [(set (reg 33)
790 (compare (match_operand:HI 0 "s_operand" "Q")
791 (match_operand:HI 1 "s_imm_operand" "Q")))]
792 "s390_match_ccmode(insn, CCUmode)"
793 "clc\t%O0(2,%R0),%1"
794 [(set_attr "op_type" "SS")])
795
796 (define_insn "*cmpqi_ccu_mem"
797 [(set (reg 33)
798 (compare (match_operand:QI 0 "s_operand" "Q")
799 (match_operand:QI 1 "s_imm_operand" "Q")))]
800 "s390_match_ccmode(insn, CCUmode)"
801 "clc\t%O0(1,%R0),%1"
802 [(set_attr "op_type" "SS")])
803
804
805 ; DF instructions
806
807 (define_insn "*cmpdf_ccs_0"
808 [(set (reg 33)
809 (compare (match_operand:DF 0 "register_operand" "f")
810 (match_operand:DF 1 "const0_operand" "")))]
811 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
812 "ltdbr\t%0,%0"
813 [(set_attr "op_type" "RRE")
814 (set_attr "type" "fsimpd")])
815
816 (define_insn "*cmpdf_ccs_0_ibm"
817 [(set (reg 33)
818 (compare (match_operand:DF 0 "register_operand" "f")
819 (match_operand:DF 1 "const0_operand" "")))]
820 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
821 "ltdr\t%0,%0"
822 [(set_attr "op_type" "RR")
823 (set_attr "type" "fsimpd")])
824
825 (define_insn "*cmpdf_ccs"
826 [(set (reg 33)
827 (compare (match_operand:DF 0 "register_operand" "f,f")
828 (match_operand:DF 1 "general_operand" "f,R")))]
829 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
830 "@
831 cdbr\t%0,%1
832 cdb\t%0,%1"
833 [(set_attr "op_type" "RRE,RXE")
834 (set_attr "type" "fsimpd")])
835
836 (define_insn "*cmpdf_ccs_ibm"
837 [(set (reg 33)
838 (compare (match_operand:DF 0 "register_operand" "f,f")
839 (match_operand:DF 1 "general_operand" "f,R")))]
840 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
841 "@
842 cdr\t%0,%1
843 cd\t%0,%1"
844 [(set_attr "op_type" "RR,RX")
845 (set_attr "type" "fsimpd")])
846
847
848 ; SF instructions
849
850 (define_insn "*cmpsf_ccs_0"
851 [(set (reg 33)
852 (compare (match_operand:SF 0 "register_operand" "f")
853 (match_operand:SF 1 "const0_operand" "")))]
854 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
855 "ltebr\t%0,%0"
856 [(set_attr "op_type" "RRE")
857 (set_attr "type" "fsimps")])
858
859 (define_insn "*cmpsf_ccs_0_ibm"
860 [(set (reg 33)
861 (compare (match_operand:SF 0 "register_operand" "f")
862 (match_operand:SF 1 "const0_operand" "")))]
863 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
864 "lter\t%0,%0"
865 [(set_attr "op_type" "RR")
866 (set_attr "type" "fsimps")])
867
868 (define_insn "*cmpsf_ccs"
869 [(set (reg 33)
870 (compare (match_operand:SF 0 "register_operand" "f,f")
871 (match_operand:SF 1 "general_operand" "f,R")))]
872 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
873 "@
874 cebr\t%0,%1
875 ceb\t%0,%1"
876 [(set_attr "op_type" "RRE,RXE")
877 (set_attr "type" "fsimps")])
878
879 (define_insn "*cmpsf_ccs"
880 [(set (reg 33)
881 (compare (match_operand:SF 0 "register_operand" "f,f")
882 (match_operand:SF 1 "general_operand" "f,R")))]
883 "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
884 "@
885 cer\t%0,%1
886 ce\t%0,%1"
887 [(set_attr "op_type" "RR,RX")
888 (set_attr "type" "fsimps")])
889
890
891 ;;
892 ;;- Move instructions.
893 ;;
894
895 ;
896 ; movti instruction pattern(s).
897 ;
898
899 (define_insn "movti"
900 [(set (match_operand:TI 0 "nonimmediate_operand" "=d,QS,d,o,Q")
901 (match_operand:TI 1 "general_operand" "QS,d,dKm,d,Q"))]
902 "TARGET_64BIT"
903 "@
904 lmg\t%0,%N0,%1
905 stmg\t%1,%N1,%0
906 #
907 #
908 mvc\t%O0(16,%R0),%1"
909 [(set_attr "op_type" "RSY,RSY,NN,NN,SS")
910 (set_attr "type" "lm,stm,*,*,cs")])
911
912 (define_split
913 [(set (match_operand:TI 0 "nonimmediate_operand" "")
914 (match_operand:TI 1 "general_operand" ""))]
915 "TARGET_64BIT && reload_completed
916 && s390_split_ok_p (operands[0], operands[1], TImode, 0)"
917 [(set (match_dup 2) (match_dup 4))
918 (set (match_dup 3) (match_dup 5))]
919 {
920 operands[2] = operand_subword (operands[0], 0, 0, TImode);
921 operands[3] = operand_subword (operands[0], 1, 0, TImode);
922 operands[4] = operand_subword (operands[1], 0, 0, TImode);
923 operands[5] = operand_subword (operands[1], 1, 0, TImode);
924 })
925
926 (define_split
927 [(set (match_operand:TI 0 "nonimmediate_operand" "")
928 (match_operand:TI 1 "general_operand" ""))]
929 "TARGET_64BIT && reload_completed
930 && s390_split_ok_p (operands[0], operands[1], TImode, 1)"
931 [(set (match_dup 2) (match_dup 4))
932 (set (match_dup 3) (match_dup 5))]
933 {
934 operands[2] = operand_subword (operands[0], 1, 0, TImode);
935 operands[3] = operand_subword (operands[0], 0, 0, TImode);
936 operands[4] = operand_subword (operands[1], 1, 0, TImode);
937 operands[5] = operand_subword (operands[1], 0, 0, TImode);
938 })
939
940 (define_split
941 [(set (match_operand:TI 0 "register_operand" "")
942 (match_operand:TI 1 "memory_operand" ""))]
943 "TARGET_64BIT && reload_completed
944 && !s_operand (operands[1], VOIDmode)"
945 [(set (match_dup 0) (match_dup 1))]
946 {
947 rtx addr = operand_subword (operands[0], 1, 0, TImode);
948 s390_load_address (addr, XEXP (operands[1], 0));
949 operands[1] = replace_equiv_address (operands[1], addr);
950 })
951
952 (define_expand "reload_outti"
953 [(parallel [(match_operand:TI 0 "memory_operand" "")
954 (match_operand:TI 1 "register_operand" "d")
955 (match_operand:DI 2 "register_operand" "=&a")])]
956 "TARGET_64BIT"
957 {
958 s390_load_address (operands[2], XEXP (operands[0], 0));
959 operands[0] = replace_equiv_address (operands[0], operands[2]);
960 emit_move_insn (operands[0], operands[1]);
961 DONE;
962 })
963
964 ;
965 ; movdi instruction pattern(s).
966 ;
967
968 (define_expand "movdi"
969 [(set (match_operand:DI 0 "general_operand" "")
970 (match_operand:DI 1 "general_operand" ""))]
971 ""
972 {
973 /* Handle symbolic constants. */
974 if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
975 emit_symbolic_move (operands);
976
977 /* During and after reload, we need to force constants
978 to the literal pool ourselves, if necessary. */
979 if ((reload_in_progress || reload_completed)
980 && CONSTANT_P (operands[1])
981 && (!legitimate_reload_constant_p (operands[1])
982 || FP_REG_P (operands[0])))
983 operands[1] = force_const_mem (DImode, operands[1]);
984 })
985
986 (define_insn "*movdi_larl"
987 [(set (match_operand:DI 0 "register_operand" "=d")
988 (match_operand:DI 1 "larl_operand" "X"))]
989 "TARGET_64BIT
990 && !FP_REG_P (operands[0])"
991 "larl\t%0,%1"
992 [(set_attr "op_type" "RIL")
993 (set_attr "type" "larl")])
994
995 (define_insn "*movdi_64"
996 [(set (match_operand:DI 0 "nonimmediate_operand"
997 "=d,d,d,d,d,d,d,d,m,!*f,!*f,!*f,!R,!T,?Q")
998 (match_operand:DI 1 "general_operand"
999 "K,N0HD0,N1HD0,N2HD0,N3HD0,L,d,m,d,*f,R,T,*f,*f,?Q"))]
1000 "TARGET_64BIT"
1001 "@
1002 lghi\t%0,%h1
1003 llihh\t%0,%i1
1004 llihl\t%0,%i1
1005 llilh\t%0,%i1
1006 llill\t%0,%i1
1007 lay\t%0,%a1
1008 lgr\t%0,%1
1009 lg\t%0,%1
1010 stg\t%1,%0
1011 ldr\t%0,%1
1012 ld\t%0,%1
1013 ldy\t%0,%1
1014 std\t%1,%0
1015 stdy\t%1,%0
1016 mvc\t%O0(8,%R0),%1"
1017 [(set_attr "op_type" "RI,RI,RI,RI,RI,RXY,RRE,RXY,RXY,RR,RX,RXY,RX,RXY,SS")
1018 (set_attr "type" "*,*,*,*,*,la,lr,load,store,floadd,floadd,floadd,
1019 fstored,fstored,cs")])
1020
1021 (define_insn "*movdi_31"
1022 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,Q,d,o,!*f,!*f,!*f,!R,!T,Q")
1023 (match_operand:DI 1 "general_operand" "Q,d,dKm,d,*f,R,T,*f,*f,Q"))]
1024 "!TARGET_64BIT"
1025 "@
1026 lm\t%0,%N0,%1
1027 stm\t%1,%N1,%0
1028 #
1029 #
1030 ldr\t%0,%1
1031 ld\t%0,%1
1032 ldy\t%0,%1
1033 std\t%1,%0
1034 stdy\t%1,%0
1035 mvc\t%O0(8,%R0),%1"
1036 [(set_attr "op_type" "RS,RS,NN,NN,RR,RX,RXY,RX,RXY,SS")
1037 (set_attr "type" "lm,stm,*,*,floadd,floadd,floadd,fstored,fstored,cs")])
1038
1039 (define_split
1040 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1041 (match_operand:DI 1 "general_operand" ""))]
1042 "!TARGET_64BIT && reload_completed
1043 && s390_split_ok_p (operands[0], operands[1], DImode, 0)"
1044 [(set (match_dup 2) (match_dup 4))
1045 (set (match_dup 3) (match_dup 5))]
1046 {
1047 operands[2] = operand_subword (operands[0], 0, 0, DImode);
1048 operands[3] = operand_subword (operands[0], 1, 0, DImode);
1049 operands[4] = operand_subword (operands[1], 0, 0, DImode);
1050 operands[5] = operand_subword (operands[1], 1, 0, DImode);
1051 })
1052
1053 (define_split
1054 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1055 (match_operand:DI 1 "general_operand" ""))]
1056 "!TARGET_64BIT && reload_completed
1057 && s390_split_ok_p (operands[0], operands[1], DImode, 1)"
1058 [(set (match_dup 2) (match_dup 4))
1059 (set (match_dup 3) (match_dup 5))]
1060 {
1061 operands[2] = operand_subword (operands[0], 1, 0, DImode);
1062 operands[3] = operand_subword (operands[0], 0, 0, DImode);
1063 operands[4] = operand_subword (operands[1], 1, 0, DImode);
1064 operands[5] = operand_subword (operands[1], 0, 0, DImode);
1065 })
1066
1067 (define_split
1068 [(set (match_operand:DI 0 "register_operand" "")
1069 (match_operand:DI 1 "memory_operand" ""))]
1070 "!TARGET_64BIT && reload_completed
1071 && !FP_REG_P (operands[0])
1072 && !s_operand (operands[1], VOIDmode)"
1073 [(set (match_dup 0) (match_dup 1))]
1074 {
1075 rtx addr = operand_subword (operands[0], 1, 0, DImode);
1076 s390_load_address (addr, XEXP (operands[1], 0));
1077 operands[1] = replace_equiv_address (operands[1], addr);
1078 })
1079
1080 (define_expand "reload_outdi"
1081 [(parallel [(match_operand:DI 0 "memory_operand" "")
1082 (match_operand:DI 1 "register_operand" "d")
1083 (match_operand:SI 2 "register_operand" "=&a")])]
1084 "!TARGET_64BIT"
1085 {
1086 s390_load_address (operands[2], XEXP (operands[0], 0));
1087 operands[0] = replace_equiv_address (operands[0], operands[2]);
1088 emit_move_insn (operands[0], operands[1]);
1089 DONE;
1090 })
1091
1092 (define_peephole2
1093 [(set (match_operand:DI 0 "register_operand" "")
1094 (mem:DI (match_operand 1 "address_operand" "")))]
1095 "TARGET_64BIT
1096 && !FP_REG_P (operands[0])
1097 && GET_CODE (operands[1]) == SYMBOL_REF
1098 && CONSTANT_POOL_ADDRESS_P (operands[1])
1099 && get_pool_mode (operands[1]) == DImode
1100 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1101 [(set (match_dup 0) (match_dup 2))]
1102 "operands[2] = get_pool_constant (operands[1]);")
1103
1104 (define_insn "*la_64"
1105 [(set (match_operand:DI 0 "register_operand" "=d,d")
1106 (match_operand:QI 1 "address_operand" "U,W"))]
1107 "TARGET_64BIT"
1108 "@
1109 la\t%0,%a1
1110 lay\t%0,%a1"
1111 [(set_attr "op_type" "RX,RXY")
1112 (set_attr "type" "la")])
1113
1114 (define_peephole2
1115 [(parallel
1116 [(set (match_operand:DI 0 "register_operand" "")
1117 (match_operand:QI 1 "address_operand" ""))
1118 (clobber (reg:CC 33))])]
1119 "TARGET_64BIT
1120 && strict_memory_address_p (VOIDmode, operands[1])
1121 && preferred_la_operand_p (operands[1])"
1122 [(set (match_dup 0) (match_dup 1))]
1123 "")
1124
1125 (define_peephole2
1126 [(set (match_operand:DI 0 "register_operand" "")
1127 (match_operand:DI 1 "register_operand" ""))
1128 (parallel
1129 [(set (match_dup 0)
1130 (plus:DI (match_dup 0)
1131 (match_operand:DI 2 "nonmemory_operand" "")))
1132 (clobber (reg:CC 33))])]
1133 "TARGET_64BIT
1134 && !reg_overlap_mentioned_p (operands[0], operands[2])
1135 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (DImode, operands[1], operands[2]))
1136 && preferred_la_operand_p (gen_rtx_PLUS (DImode, operands[1], operands[2]))"
1137 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))]
1138 "")
1139
1140 (define_expand "reload_indi"
1141 [(parallel [(match_operand:DI 0 "register_operand" "=a")
1142 (match_operand:DI 1 "s390_plus_operand" "")
1143 (match_operand:DI 2 "register_operand" "=&a")])]
1144 "TARGET_64BIT"
1145 {
1146 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1147 DONE;
1148 })
1149
1150 ;
1151 ; movsi instruction pattern(s).
1152 ;
1153
1154 (define_expand "movsi"
1155 [(set (match_operand:SI 0 "general_operand" "")
1156 (match_operand:SI 1 "general_operand" ""))]
1157 ""
1158 {
1159 /* Handle symbolic constants. */
1160 if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
1161 emit_symbolic_move (operands);
1162
1163 /* expr.c tries to load an effective address using
1164 force_reg. This fails because we don't have a
1165 generic load_address pattern. Convert the move
1166 to a proper arithmetic operation instead, unless
1167 it is guaranteed to be OK. */
1168 if (GET_CODE (operands[1]) == PLUS
1169 && !legitimate_la_operand_p (operands[1]))
1170 {
1171 operands[1] = force_operand (operands[1], operands[0]);
1172 if (operands[1] == operands[0])
1173 DONE;
1174 }
1175
1176 /* During and after reload, we need to force constants
1177 to the literal pool ourselves, if necessary. */
1178 if ((reload_in_progress || reload_completed)
1179 && CONSTANT_P (operands[1])
1180 && (!legitimate_reload_constant_p (operands[1])
1181 || FP_REG_P (operands[0])))
1182 operands[1] = force_const_mem (SImode, operands[1]);
1183 })
1184
1185 (define_insn "*movsi_larl"
1186 [(set (match_operand:SI 0 "register_operand" "=d")
1187 (match_operand:SI 1 "larl_operand" "X"))]
1188 "!TARGET_64BIT && TARGET_CPU_ZARCH
1189 && !FP_REG_P (operands[0])"
1190 "larl\t%0,%1"
1191 [(set_attr "op_type" "RIL")
1192 (set_attr "type" "larl")])
1193
1194 (define_insn "*movsi_zarch"
1195 [(set (match_operand:SI 0 "nonimmediate_operand"
1196 "=d,d,d,d,d,d,d,R,T,!*f,!*f,!*f,!R,!T,?Q")
1197 (match_operand:SI 1 "general_operand"
1198 "K,N0HS0,N1HS0,L,d,R,T,d,d,*f,R,T,*f,*f,?Q"))]
1199 "TARGET_ZARCH"
1200 "@
1201 lhi\t%0,%h1
1202 llilh\t%0,%i1
1203 llill\t%0,%i1
1204 lay\t%0,%a1
1205 lr\t%0,%1
1206 l\t%0,%1
1207 ly\t%0,%1
1208 st\t%1,%0
1209 sty\t%1,%0
1210 ler\t%0,%1
1211 le\t%0,%1
1212 ley\t%0,%1
1213 ste\t%1,%0
1214 stey\t%1,%0
1215 mvc\t%O0(4,%R0),%1"
1216 [(set_attr "op_type" "RI,RI,RI,RXY,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1217 (set_attr "type" "*,*,*,la,lr,load,load,store,store,floads,floads,floads,fstores,fstores,cs")])
1218
1219 (define_insn "*movsi_esa"
1220 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,?Q")
1221 (match_operand:SI 1 "general_operand" "K,d,R,d,*f,R,*f,?Q"))]
1222 "!TARGET_ZARCH"
1223 "@
1224 lhi\t%0,%h1
1225 lr\t%0,%1
1226 l\t%0,%1
1227 st\t%1,%0
1228 ler\t%0,%1
1229 le\t%0,%1
1230 ste\t%1,%0
1231 mvc\t%O0(4,%R0),%1"
1232 [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,SS")
1233 (set_attr "type" "*,lr,load,store,floads,floads,fstores,cs")])
1234
1235 (define_peephole2
1236 [(set (match_operand:SI 0 "register_operand" "")
1237 (mem:SI (match_operand 1 "address_operand" "")))]
1238 "!FP_REG_P (operands[0])
1239 && GET_CODE (operands[1]) == SYMBOL_REF
1240 && CONSTANT_POOL_ADDRESS_P (operands[1])
1241 && get_pool_mode (operands[1]) == SImode
1242 && legitimate_reload_constant_p (get_pool_constant (operands[1]))"
1243 [(set (match_dup 0) (match_dup 2))]
1244 "operands[2] = get_pool_constant (operands[1]);")
1245
1246 (define_insn "*la_31"
1247 [(set (match_operand:SI 0 "register_operand" "=d,d")
1248 (match_operand:QI 1 "address_operand" "U,W"))]
1249 "!TARGET_64BIT && legitimate_la_operand_p (operands[1])"
1250 "@
1251 la\t%0,%a1
1252 lay\t%0,%a1"
1253 [(set_attr "op_type" "RX,RXY")
1254 (set_attr "type" "la")])
1255
1256 (define_peephole2
1257 [(parallel
1258 [(set (match_operand:SI 0 "register_operand" "")
1259 (match_operand:QI 1 "address_operand" ""))
1260 (clobber (reg:CC 33))])]
1261 "!TARGET_64BIT
1262 && strict_memory_address_p (VOIDmode, operands[1])
1263 && preferred_la_operand_p (operands[1])"
1264 [(set (match_dup 0) (match_dup 1))]
1265 "")
1266
1267 (define_peephole2
1268 [(set (match_operand:SI 0 "register_operand" "")
1269 (match_operand:SI 1 "register_operand" ""))
1270 (parallel
1271 [(set (match_dup 0)
1272 (plus:SI (match_dup 0)
1273 (match_operand:SI 2 "nonmemory_operand" "")))
1274 (clobber (reg:CC 33))])]
1275 "!TARGET_64BIT
1276 && !reg_overlap_mentioned_p (operands[0], operands[2])
1277 && strict_memory_address_p (VOIDmode, gen_rtx_PLUS (SImode, operands[1], operands[2]))
1278 && preferred_la_operand_p (gen_rtx_PLUS (SImode, operands[1], operands[2]))"
1279 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
1280 "")
1281
1282 (define_insn "*la_31_and"
1283 [(set (match_operand:SI 0 "register_operand" "=d,d")
1284 (and:SI (match_operand:QI 1 "address_operand" "U,W")
1285 (const_int 2147483647)))]
1286 "!TARGET_64BIT"
1287 "@
1288 la\t%0,%a1
1289 lay\t%0,%a1"
1290 [(set_attr "op_type" "RX,RXY")
1291 (set_attr "type" "la")])
1292
1293 (define_insn_and_split "*la_31_and_cc"
1294 [(set (match_operand:SI 0 "register_operand" "=d")
1295 (and:SI (match_operand:QI 1 "address_operand" "p")
1296 (const_int 2147483647)))
1297 (clobber (reg:CC 33))]
1298 "!TARGET_64BIT"
1299 "#"
1300 "&& reload_completed"
1301 [(set (match_dup 0)
1302 (and:SI (match_dup 1) (const_int 2147483647)))]
1303 ""
1304 [(set_attr "op_type" "RX")
1305 (set_attr "type" "la")])
1306
1307 (define_insn "force_la_31"
1308 [(set (match_operand:SI 0 "register_operand" "=d,d")
1309 (match_operand:QI 1 "address_operand" "U,W"))
1310 (use (const_int 0))]
1311 "!TARGET_64BIT"
1312 "@
1313 la\t%0,%a1
1314 lay\t%0,%a1"
1315 [(set_attr "op_type" "RX")
1316 (set_attr "type" "la")])
1317
1318 (define_expand "reload_insi"
1319 [(parallel [(match_operand:SI 0 "register_operand" "=a")
1320 (match_operand:SI 1 "s390_plus_operand" "")
1321 (match_operand:SI 2 "register_operand" "=&a")])]
1322 "!TARGET_64BIT"
1323 {
1324 s390_expand_plus_operand (operands[0], operands[1], operands[2]);
1325 DONE;
1326 })
1327
1328 ;
1329 ; movhi instruction pattern(s).
1330 ;
1331
1332 (define_expand "movhi"
1333 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1334 (match_operand:HI 1 "general_operand" ""))]
1335 ""
1336 {
1337 /* Make it explicit that loading a register from memory
1338 always sign-extends (at least) to SImode. */
1339 if (optimize && !no_new_pseudos
1340 && register_operand (operands[0], VOIDmode)
1341 && GET_CODE (operands[1]) == MEM)
1342 {
1343 rtx tmp = gen_reg_rtx (SImode);
1344 rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
1345 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1346 operands[1] = gen_lowpart (HImode, tmp);
1347 }
1348 })
1349
1350 (define_insn "*movhi"
1351 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,T,?Q")
1352 (match_operand:HI 1 "general_operand" "d,n,R,T,d,d,?Q"))]
1353 ""
1354 "@
1355 lr\t%0,%1
1356 lhi\t%0,%h1
1357 lh\t%0,%1
1358 lhy\t%0,%1
1359 sth\t%1,%0
1360 sthy\t%1,%0
1361 mvc\t%O0(2,%R0),%1"
1362 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SS")
1363 (set_attr "type" "lr,*,*,*,store,store,cs")])
1364
1365 (define_peephole2
1366 [(set (match_operand:HI 0 "register_operand" "")
1367 (mem:HI (match_operand 1 "address_operand" "")))]
1368 "GET_CODE (operands[1]) == SYMBOL_REF
1369 && CONSTANT_POOL_ADDRESS_P (operands[1])
1370 && get_pool_mode (operands[1]) == HImode
1371 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1372 [(set (match_dup 0) (match_dup 2))]
1373 "operands[2] = get_pool_constant (operands[1]);")
1374
1375 ;
1376 ; movqi instruction pattern(s).
1377 ;
1378
1379 (define_expand "movqi"
1380 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1381 (match_operand:QI 1 "general_operand" ""))]
1382 ""
1383 {
1384 /* On z/Architecture, zero-extending from memory to register
1385 is just as fast as a QImode load. */
1386 if (TARGET_ZARCH && optimize && !no_new_pseudos
1387 && register_operand (operands[0], VOIDmode)
1388 && GET_CODE (operands[1]) == MEM)
1389 {
1390 rtx tmp = gen_reg_rtx (word_mode);
1391 rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
1392 emit_insn (gen_rtx_SET (VOIDmode, tmp, ext));
1393 operands[1] = gen_lowpart (QImode, tmp);
1394 }
1395 })
1396
1397 (define_insn "*movqi"
1398 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q")
1399 (match_operand:QI 1 "general_operand" "d,n,R,T,d,d,n,n,?Q"))]
1400 ""
1401 "@
1402 lr\t%0,%1
1403 lhi\t%0,%b1
1404 ic\t%0,%1
1405 icy\t%0,%1
1406 stc\t%1,%0
1407 stcy\t%1,%0
1408 mvi\t%0,%b1
1409 mviy\t%0,%b1
1410 mvc\t%O0(1,%R0),%1"
1411 [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS")
1412 (set_attr "type" "lr,*,*,*,store,store,store,store,cs")])
1413
1414 (define_peephole2
1415 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1416 (mem:QI (match_operand 1 "address_operand" "")))]
1417 "GET_CODE (operands[1]) == SYMBOL_REF
1418 && CONSTANT_POOL_ADDRESS_P (operands[1])
1419 && get_pool_mode (operands[1]) == QImode
1420 && GET_CODE (get_pool_constant (operands[1])) == CONST_INT"
1421 [(set (match_dup 0) (match_dup 2))]
1422 "operands[2] = get_pool_constant (operands[1]);")
1423
1424 ;
1425 ; movstrictqi instruction pattern(s).
1426 ;
1427
1428 (define_insn "*movstrictqi"
1429 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d"))
1430 (match_operand:QI 1 "memory_operand" "R,T"))]
1431 ""
1432 "@
1433 ic\t%0,%1
1434 icy\t%0,%1"
1435 [(set_attr "op_type" "RX,RXY")])
1436
1437 ;
1438 ; movstricthi instruction pattern(s).
1439 ;
1440
1441 (define_insn "*movstricthi"
1442 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d"))
1443 (match_operand:HI 1 "s_imm_operand" "Q,S"))
1444 (clobber (reg:CC 33))]
1445 ""
1446 "@
1447 icm\t%0,3,%1
1448 icmy\t%0,3,%1"
1449 [(set_attr "op_type" "RS,RSY")])
1450
1451 ;
1452 ; movstrictsi instruction pattern(s).
1453 ;
1454
1455 (define_insn "movstrictsi"
1456 [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d"))
1457 (match_operand:SI 1 "general_operand" "d,R,T"))]
1458 "TARGET_64BIT"
1459 "@
1460 lr\t%0,%1
1461 l\t%0,%1
1462 ly\t%0,%1"
1463 [(set_attr "op_type" "RR,RX,RXY")
1464 (set_attr "type" "lr,load,load")])
1465
1466 ;
1467 ; movdf instruction pattern(s).
1468 ;
1469
1470 (define_expand "movdf"
1471 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1472 (match_operand:DF 1 "general_operand" ""))]
1473 ""
1474 {
1475 /* During and after reload, we need to force constants
1476 to the literal pool ourselves, if necessary. */
1477 if ((reload_in_progress || reload_completed)
1478 && CONSTANT_P (operands[1]))
1479 operands[1] = force_const_mem (DFmode, operands[1]);
1480 })
1481
1482 (define_insn "*movdf_64"
1483 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
1484 (match_operand:DF 1 "general_operand" "f,R,T,f,f,d,m,d,?Q"))]
1485 "TARGET_64BIT"
1486 "@
1487 ldr\t%0,%1
1488 ld\t%0,%1
1489 ldy\t%0,%1
1490 std\t%1,%0
1491 stdy\t%1,%0
1492 lgr\t%0,%1
1493 lg\t%0,%1
1494 stg\t%1,%0
1495 mvc\t%O0(8,%R0),%1"
1496 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS")
1497 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lr,load,store,cs")])
1498
1499 (define_insn "*movdf_31"
1500 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,Q,d,o,Q")
1501 (match_operand:DF 1 "general_operand" "f,R,T,f,f,Q,d,dKm,d,Q"))]
1502 "!TARGET_64BIT"
1503 "@
1504 ldr\t%0,%1
1505 ld\t%0,%1
1506 ldy\t%0,%1
1507 std\t%1,%0
1508 stdy\t%1,%0
1509 lm\t%0,%N0,%1
1510 stm\t%1,%N1,%0
1511 #
1512 #
1513 mvc\t%O0(8,%R0),%1"
1514 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RS,RS,NN,NN,SS")
1515 (set_attr "type" "floadd,floadd,floadd,fstored,fstored,lm,stm,*,*,cs")])
1516
1517 (define_split
1518 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1519 (match_operand:DF 1 "general_operand" ""))]
1520 "!TARGET_64BIT && reload_completed
1521 && s390_split_ok_p (operands[0], operands[1], DFmode, 0)"
1522 [(set (match_dup 2) (match_dup 4))
1523 (set (match_dup 3) (match_dup 5))]
1524 {
1525 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
1526 operands[3] = operand_subword (operands[0], 1, 0, DFmode);
1527 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
1528 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
1529 })
1530
1531 (define_split
1532 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1533 (match_operand:DF 1 "general_operand" ""))]
1534 "!TARGET_64BIT && reload_completed
1535 && s390_split_ok_p (operands[0], operands[1], DFmode, 1)"
1536 [(set (match_dup 2) (match_dup 4))
1537 (set (match_dup 3) (match_dup 5))]
1538 {
1539 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
1540 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
1541 operands[4] = operand_subword (operands[1], 1, 0, DFmode);
1542 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
1543 })
1544
1545 (define_split
1546 [(set (match_operand:DF 0 "register_operand" "")
1547 (match_operand:DF 1 "memory_operand" ""))]
1548 "!TARGET_64BIT && reload_completed
1549 && !FP_REG_P (operands[0])
1550 && !s_operand (operands[1], VOIDmode)"
1551 [(set (match_dup 0) (match_dup 1))]
1552 {
1553 rtx addr = operand_subword (operands[0], 1, 0, DFmode);
1554 s390_load_address (addr, XEXP (operands[1], 0));
1555 operands[1] = replace_equiv_address (operands[1], addr);
1556 })
1557
1558 (define_expand "reload_outdf"
1559 [(parallel [(match_operand:DF 0 "memory_operand" "")
1560 (match_operand:DF 1 "register_operand" "d")
1561 (match_operand:SI 2 "register_operand" "=&a")])]
1562 "!TARGET_64BIT"
1563 {
1564 s390_load_address (operands[2], XEXP (operands[0], 0));
1565 operands[0] = replace_equiv_address (operands[0], operands[2]);
1566 emit_move_insn (operands[0], operands[1]);
1567 DONE;
1568 })
1569
1570 ;
1571 ; movsf instruction pattern(s).
1572 ;
1573
1574 (define_expand "movsf"
1575 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1576 (match_operand:SF 1 "general_operand" ""))]
1577 ""
1578 {
1579 /* During and after reload, we need to force constants
1580 to the literal pool ourselves, if necessary. */
1581 if ((reload_in_progress || reload_completed)
1582 && CONSTANT_P (operands[1]))
1583 operands[1] = force_const_mem (SFmode, operands[1]);
1584 })
1585
1586 (define_insn "*movsf"
1587 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
1588 (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
1589 ""
1590 "@
1591 ler\t%0,%1
1592 le\t%0,%1
1593 ley\t%0,%1
1594 ste\t%1,%0
1595 stey\t%1,%0
1596 lr\t%0,%1
1597 l\t%0,%1
1598 ly\t%0,%1
1599 st\t%1,%0
1600 sty\t%1,%0
1601 mvc\t%O0(4,%R0),%1"
1602 [(set_attr "op_type" "RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS")
1603 (set_attr "type" "floads,floads,floads,fstores,fstores,lr,load,load,store,store,cs")])
1604
1605 ;
1606 ; load_multiple pattern(s).
1607 ;
1608 ; ??? Due to reload problems with replacing registers inside match_parallel
1609 ; we currently support load_multiple/store_multiple only after reload.
1610 ;
1611
1612 (define_expand "load_multiple"
1613 [(match_par_dup 3 [(set (match_operand 0 "" "")
1614 (match_operand 1 "" ""))
1615 (use (match_operand 2 "" ""))])]
1616 "reload_completed"
1617 {
1618 enum machine_mode mode;
1619 int regno;
1620 int count;
1621 rtx from;
1622 int i, off;
1623
1624 /* Support only loading a constant number of fixed-point registers from
1625 memory and only bother with this if more than two */
1626 if (GET_CODE (operands[2]) != CONST_INT
1627 || INTVAL (operands[2]) < 2
1628 || INTVAL (operands[2]) > 16
1629 || GET_CODE (operands[1]) != MEM
1630 || GET_CODE (operands[0]) != REG
1631 || REGNO (operands[0]) >= 16)
1632 FAIL;
1633
1634 count = INTVAL (operands[2]);
1635 regno = REGNO (operands[0]);
1636 mode = GET_MODE (operands[0]);
1637 if (mode != SImode && mode != word_mode)
1638 FAIL;
1639
1640 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1641 if (no_new_pseudos)
1642 {
1643 if (GET_CODE (XEXP (operands[1], 0)) == REG)
1644 {
1645 from = XEXP (operands[1], 0);
1646 off = 0;
1647 }
1648 else if (GET_CODE (XEXP (operands[1], 0)) == PLUS
1649 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG
1650 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT)
1651 {
1652 from = XEXP (XEXP (operands[1], 0), 0);
1653 off = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1654 }
1655 else
1656 FAIL;
1657
1658 if (from == frame_pointer_rtx || from == arg_pointer_rtx)
1659 FAIL;
1660 }
1661 else
1662 {
1663 from = force_reg (Pmode, XEXP (operands[1], 0));
1664 off = 0;
1665 }
1666
1667 for (i = 0; i < count; i++)
1668 XVECEXP (operands[3], 0, i)
1669 = gen_rtx_SET (VOIDmode, gen_rtx_REG (mode, regno + i),
1670 change_address (operands[1], mode,
1671 plus_constant (from, off + i * GET_MODE_SIZE (mode))));
1672 })
1673
1674 (define_insn "*load_multiple_di"
1675 [(match_parallel 0 "load_multiple_operation"
1676 [(set (match_operand:DI 1 "register_operand" "=r")
1677 (match_operand:DI 2 "s_operand" "QS"))])]
1678 "reload_completed && word_mode == DImode"
1679 {
1680 int words = XVECLEN (operands[0], 0);
1681 operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1);
1682 return "lmg\t%1,%0,%2";
1683 }
1684 [(set_attr "op_type" "RSY")
1685 (set_attr "type" "lm")])
1686
1687 (define_insn "*load_multiple_si"
1688 [(match_parallel 0 "load_multiple_operation"
1689 [(set (match_operand:SI 1 "register_operand" "=r,r")
1690 (match_operand:SI 2 "s_operand" "Q,S"))])]
1691 "reload_completed"
1692 {
1693 int words = XVECLEN (operands[0], 0);
1694 operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1);
1695 return which_alternative == 0 ? "lm\t%1,%0,%2" : "lmy\t%1,%0,%2";
1696 }
1697 [(set_attr "op_type" "RS,RSY")
1698 (set_attr "type" "lm")])
1699
1700 ;
1701 ; store multiple pattern(s).
1702 ;
1703
1704 (define_expand "store_multiple"
1705 [(match_par_dup 3 [(set (match_operand 0 "" "")
1706 (match_operand 1 "" ""))
1707 (use (match_operand 2 "" ""))])]
1708 "reload_completed"
1709 {
1710 enum machine_mode mode;
1711 int regno;
1712 int count;
1713 rtx to;
1714 int i, off;
1715
1716 /* Support only storing a constant number of fixed-point registers to
1717 memory and only bother with this if more than two. */
1718 if (GET_CODE (operands[2]) != CONST_INT
1719 || INTVAL (operands[2]) < 2
1720 || INTVAL (operands[2]) > 16
1721 || GET_CODE (operands[0]) != MEM
1722 || GET_CODE (operands[1]) != REG
1723 || REGNO (operands[1]) >= 16)
1724 FAIL;
1725
1726 count = INTVAL (operands[2]);
1727 regno = REGNO (operands[1]);
1728 mode = GET_MODE (operands[1]);
1729 if (mode != SImode && mode != word_mode)
1730 FAIL;
1731
1732 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1733
1734 if (no_new_pseudos)
1735 {
1736 if (GET_CODE (XEXP (operands[0], 0)) == REG)
1737 {
1738 to = XEXP (operands[0], 0);
1739 off = 0;
1740 }
1741 else if (GET_CODE (XEXP (operands[0], 0)) == PLUS
1742 && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG
1743 && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
1744 {
1745 to = XEXP (XEXP (operands[0], 0), 0);
1746 off = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1747 }
1748 else
1749 FAIL;
1750
1751 if (to == frame_pointer_rtx || to == arg_pointer_rtx)
1752 FAIL;
1753 }
1754 else
1755 {
1756 to = force_reg (Pmode, XEXP (operands[0], 0));
1757 off = 0;
1758 }
1759
1760 for (i = 0; i < count; i++)
1761 XVECEXP (operands[3], 0, i)
1762 = gen_rtx_SET (VOIDmode,
1763 change_address (operands[0], mode,
1764 plus_constant (to, off + i * GET_MODE_SIZE (mode))),
1765 gen_rtx_REG (mode, regno + i));
1766 })
1767
1768 (define_insn "*store_multiple_di"
1769 [(match_parallel 0 "store_multiple_operation"
1770 [(set (match_operand:DI 1 "s_operand" "=QS")
1771 (match_operand:DI 2 "register_operand" "r"))])]
1772 "reload_completed && word_mode == DImode"
1773 {
1774 int words = XVECLEN (operands[0], 0);
1775 operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1);
1776 return "stmg\t%2,%0,%1";
1777 }
1778 [(set_attr "op_type" "RSY")
1779 (set_attr "type" "stm")])
1780
1781
1782 (define_insn "*store_multiple_si"
1783 [(match_parallel 0 "store_multiple_operation"
1784 [(set (match_operand:SI 1 "s_operand" "=Q,S")
1785 (match_operand:SI 2 "register_operand" "r,r"))])]
1786 "reload_completed"
1787 {
1788 int words = XVECLEN (operands[0], 0);
1789 operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1);
1790 return which_alternative == 0 ? "stm\t%2,%0,%1" : "stmy\t%2,%0,%1";
1791 }
1792 [(set_attr "op_type" "RS,RSY")
1793 (set_attr "type" "stm")])
1794
1795 ;;
1796 ;; String instructions.
1797 ;;
1798
1799 ;
1800 ; strlenM instruction pattern(s).
1801 ;
1802
1803 (define_expand "strlendi"
1804 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1805 (parallel
1806 [(set (match_dup 4)
1807 (unspec:DI [(const_int 0)
1808 (match_operand:BLK 1 "memory_operand" "")
1809 (reg:QI 0)
1810 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1811 (clobber (scratch:DI))
1812 (clobber (reg:CC 33))])
1813 (parallel
1814 [(set (match_operand:DI 0 "register_operand" "")
1815 (minus:DI (match_dup 4) (match_dup 5)))
1816 (clobber (reg:CC 33))])]
1817 "TARGET_64BIT"
1818 {
1819 operands[4] = gen_reg_rtx (DImode);
1820 operands[5] = gen_reg_rtx (DImode);
1821 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1822 operands[1] = replace_equiv_address (operands[1], operands[5]);
1823 })
1824
1825 (define_insn "*strlendi"
1826 [(set (match_operand:DI 0 "register_operand" "=a")
1827 (unspec:DI [(match_operand:DI 2 "general_operand" "0")
1828 (mem:BLK (match_operand:DI 3 "register_operand" "1"))
1829 (reg:QI 0)
1830 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1831 (clobber (match_scratch:DI 1 "=a"))
1832 (clobber (reg:CC 33))]
1833 "TARGET_64BIT"
1834 "srst\t%0,%1\;jo\t.-4"
1835 [(set_attr "op_type" "NN")
1836 (set_attr "type" "vs")
1837 (set_attr "length" "8")])
1838
1839 (define_expand "strlensi"
1840 [(set (reg:QI 0) (match_operand:QI 2 "immediate_operand" ""))
1841 (parallel
1842 [(set (match_dup 4)
1843 (unspec:SI [(const_int 0)
1844 (match_operand:BLK 1 "memory_operand" "")
1845 (reg:QI 0)
1846 (match_operand 3 "immediate_operand" "")] UNSPEC_SRST))
1847 (clobber (scratch:SI))
1848 (clobber (reg:CC 33))])
1849 (parallel
1850 [(set (match_operand:SI 0 "register_operand" "")
1851 (minus:SI (match_dup 4) (match_dup 5)))
1852 (clobber (reg:CC 33))])]
1853 "!TARGET_64BIT"
1854 {
1855 operands[4] = gen_reg_rtx (SImode);
1856 operands[5] = gen_reg_rtx (SImode);
1857 emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX));
1858 operands[1] = replace_equiv_address (operands[1], operands[5]);
1859 })
1860
1861 (define_insn "*strlensi"
1862 [(set (match_operand:SI 0 "register_operand" "=a")
1863 (unspec:SI [(match_operand:SI 2 "general_operand" "0")
1864 (mem:BLK (match_operand:SI 3 "register_operand" "1"))
1865 (reg:QI 0)
1866 (match_operand 4 "immediate_operand" "")] UNSPEC_SRST))
1867 (clobber (match_scratch:SI 1 "=a"))
1868 (clobber (reg:CC 33))]
1869 "!TARGET_64BIT"
1870 "srst\t%0,%1\;jo\t.-4"
1871 [(set_attr "op_type" "NN")
1872 (set_attr "type" "vs")
1873 (set_attr "length" "8")])
1874
1875 ;
1876 ; movmemM instruction pattern(s).
1877 ;
1878
1879 (define_expand "movmemdi"
1880 [(set (match_operand:BLK 0 "memory_operand" "")
1881 (match_operand:BLK 1 "memory_operand" ""))
1882 (use (match_operand:DI 2 "general_operand" ""))
1883 (match_operand 3 "" "")]
1884 "TARGET_64BIT"
1885 "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
1886
1887 (define_expand "movmemsi"
1888 [(set (match_operand:BLK 0 "memory_operand" "")
1889 (match_operand:BLK 1 "memory_operand" ""))
1890 (use (match_operand:SI 2 "general_operand" ""))
1891 (match_operand 3 "" "")]
1892 ""
1893 "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
1894
1895 ; Move a block that is up to 256 bytes in length.
1896 ; The block length is taken as (operands[2] % 256) + 1.
1897
1898 (define_expand "movmem_short"
1899 [(parallel
1900 [(set (match_operand:BLK 0 "memory_operand" "")
1901 (match_operand:BLK 1 "memory_operand" ""))
1902 (use (match_operand 2 "nonmemory_operand" ""))
1903 (clobber (match_dup 3))])]
1904 ""
1905 "operands[3] = gen_rtx_SCRATCH (Pmode);")
1906
1907 (define_insn "*movmem_short"
1908 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
1909 (match_operand:BLK 1 "memory_operand" "Q,Q"))
1910 (use (match_operand 2 "nonmemory_operand" "n,a"))
1911 (clobber (match_scratch 3 "=X,&a"))]
1912 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
1913 && GET_MODE (operands[3]) == Pmode"
1914 {
1915 switch (which_alternative)
1916 {
1917 case 0:
1918 return "mvc\t%O0(%b2+1,%R0),%1";
1919
1920 case 1:
1921 output_asm_insn ("bras\t%3,.+10", operands);
1922 output_asm_insn ("mvc\t%O0(1,%R0),%1", operands);
1923 return "ex\t%2,0(%3)";
1924
1925 default:
1926 abort ();
1927 }
1928 }
1929 [(set_attr "op_type" "SS,NN")
1930 (set_attr "type" "cs,cs")
1931 (set_attr "atype" "*,agen")
1932 (set_attr "length" "*,14")])
1933
1934 ; Move a block of arbitrary length.
1935
1936 (define_expand "movmem_long"
1937 [(parallel
1938 [(clobber (match_dup 2))
1939 (clobber (match_dup 3))
1940 (set (match_operand:BLK 0 "memory_operand" "")
1941 (match_operand:BLK 1 "memory_operand" ""))
1942 (use (match_operand 2 "general_operand" ""))
1943 (use (match_dup 3))
1944 (clobber (reg:CC 33))])]
1945 ""
1946 {
1947 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
1948 rtx reg0 = gen_reg_rtx (dword_mode);
1949 rtx reg1 = gen_reg_rtx (dword_mode);
1950 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
1951 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
1952 rtx len0 = gen_lowpart (Pmode, reg0);
1953 rtx len1 = gen_lowpart (Pmode, reg1);
1954
1955 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
1956 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
1957 emit_move_insn (len0, operands[2]);
1958
1959 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
1960 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1961 emit_move_insn (len1, operands[2]);
1962
1963 operands[0] = replace_equiv_address_nv (operands[0], addr0);
1964 operands[1] = replace_equiv_address_nv (operands[1], addr1);
1965 operands[2] = reg0;
1966 operands[3] = reg1;
1967 })
1968
1969 (define_insn "*movmem_long_64"
1970 [(clobber (match_operand:TI 0 "register_operand" "=d"))
1971 (clobber (match_operand:TI 1 "register_operand" "=d"))
1972 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
1973 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0)))
1974 (use (match_dup 2))
1975 (use (match_dup 3))
1976 (clobber (reg:CC 33))]
1977 "TARGET_64BIT"
1978 "mvcle\t%0,%1,0\;jo\t.-4"
1979 [(set_attr "op_type" "NN")
1980 (set_attr "type" "vs")
1981 (set_attr "length" "8")])
1982
1983 (define_insn "*movmem_long_31"
1984 [(clobber (match_operand:DI 0 "register_operand" "=d"))
1985 (clobber (match_operand:DI 1 "register_operand" "=d"))
1986 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
1987 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0)))
1988 (use (match_dup 2))
1989 (use (match_dup 3))
1990 (clobber (reg:CC 33))]
1991 "!TARGET_64BIT"
1992 "mvcle\t%0,%1,0\;jo\t.-4"
1993 [(set_attr "op_type" "NN")
1994 (set_attr "type" "vs")
1995 (set_attr "length" "8")])
1996
1997 ;
1998 ; clrmemM instruction pattern(s).
1999 ;
2000
2001 (define_expand "clrmemdi"
2002 [(set (match_operand:BLK 0 "memory_operand" "")
2003 (const_int 0))
2004 (use (match_operand:DI 1 "general_operand" ""))
2005 (match_operand 2 "" "")]
2006 "TARGET_64BIT"
2007 "s390_expand_clrmem (operands[0], operands[1]); DONE;")
2008
2009 (define_expand "clrmemsi"
2010 [(set (match_operand:BLK 0 "memory_operand" "")
2011 (const_int 0))
2012 (use (match_operand:SI 1 "general_operand" ""))
2013 (match_operand 2 "" "")]
2014 ""
2015 "s390_expand_clrmem (operands[0], operands[1]); DONE;")
2016
2017 ; Clear a block that is up to 256 bytes in length.
2018 ; The block length is taken as (operands[1] % 256) + 1.
2019
2020 (define_expand "clrmem_short"
2021 [(parallel
2022 [(set (match_operand:BLK 0 "memory_operand" "")
2023 (const_int 0))
2024 (use (match_operand 1 "nonmemory_operand" ""))
2025 (clobber (match_dup 2))
2026 (clobber (reg:CC 33))])]
2027 ""
2028 "operands[2] = gen_rtx_SCRATCH (Pmode);")
2029
2030 (define_insn "*clrmem_short"
2031 [(set (match_operand:BLK 0 "memory_operand" "=Q,Q")
2032 (const_int 0))
2033 (use (match_operand 1 "nonmemory_operand" "n,a"))
2034 (clobber (match_scratch 2 "=X,&a"))
2035 (clobber (reg:CC 33))]
2036 "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
2037 && GET_MODE (operands[2]) == Pmode"
2038 {
2039 switch (which_alternative)
2040 {
2041 case 0:
2042 return "xc\t%O0(%b1+1,%R0),%0";
2043
2044 case 1:
2045 output_asm_insn ("bras\t%2,.+10", operands);
2046 output_asm_insn ("xc\t%O0(1,%R0),%0", operands);
2047 return "ex\t%1,0(%2)";
2048
2049 default:
2050 abort ();
2051 }
2052 }
2053 [(set_attr "op_type" "SS,NN")
2054 (set_attr "type" "cs,cs")
2055 (set_attr "atype" "*,agen")
2056 (set_attr "length" "*,14")])
2057
2058 ; Clear a block of arbitrary length.
2059
2060 (define_expand "clrmem_long"
2061 [(parallel
2062 [(clobber (match_dup 1))
2063 (set (match_operand:BLK 0 "memory_operand" "")
2064 (const_int 0))
2065 (use (match_operand 1 "general_operand" ""))
2066 (use (match_dup 2))
2067 (clobber (reg:CC 33))])]
2068 ""
2069 {
2070 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2071 rtx reg0 = gen_reg_rtx (dword_mode);
2072 rtx reg1 = gen_reg_rtx (dword_mode);
2073 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2074 rtx len0 = gen_lowpart (Pmode, reg0);
2075
2076 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2077 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2078 emit_move_insn (len0, operands[1]);
2079
2080 emit_move_insn (reg1, const0_rtx);
2081
2082 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2083 operands[1] = reg0;
2084 operands[2] = reg1;
2085 })
2086
2087 (define_insn "*clrmem_long_64"
2088 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2089 (set (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2090 (const_int 0))
2091 (use (match_dup 2))
2092 (use (match_operand:TI 1 "register_operand" "d"))
2093 (clobber (reg:CC 33))]
2094 "TARGET_64BIT"
2095 "mvcle\t%0,%1,0\;jo\t.-4"
2096 [(set_attr "op_type" "NN")
2097 (set_attr "type" "vs")
2098 (set_attr "length" "8")])
2099
2100 (define_insn "*clrmem_long_31"
2101 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2102 (set (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2103 (const_int 0))
2104 (use (match_dup 2))
2105 (use (match_operand:DI 1 "register_operand" "d"))
2106 (clobber (reg:CC 33))]
2107 "!TARGET_64BIT"
2108 "mvcle\t%0,%1,0\;jo\t.-4"
2109 [(set_attr "op_type" "NN")
2110 (set_attr "type" "vs")
2111 (set_attr "length" "8")])
2112
2113 ;
2114 ; cmpmemM instruction pattern(s).
2115 ;
2116
2117 (define_expand "cmpmemdi"
2118 [(set (match_operand:DI 0 "register_operand" "")
2119 (compare:DI (match_operand:BLK 1 "memory_operand" "")
2120 (match_operand:BLK 2 "memory_operand" "") ) )
2121 (use (match_operand:DI 3 "general_operand" ""))
2122 (use (match_operand:DI 4 "" ""))]
2123 "TARGET_64BIT"
2124 "s390_expand_cmpmem (operands[0], operands[1],
2125 operands[2], operands[3]); DONE;")
2126
2127 (define_expand "cmpmemsi"
2128 [(set (match_operand:SI 0 "register_operand" "")
2129 (compare:SI (match_operand:BLK 1 "memory_operand" "")
2130 (match_operand:BLK 2 "memory_operand" "") ) )
2131 (use (match_operand:SI 3 "general_operand" ""))
2132 (use (match_operand:SI 4 "" ""))]
2133 ""
2134 "s390_expand_cmpmem (operands[0], operands[1],
2135 operands[2], operands[3]); DONE;")
2136
2137 ; Compare a block that is up to 256 bytes in length.
2138 ; The block length is taken as (operands[2] % 256) + 1.
2139
2140 (define_expand "cmpmem_short"
2141 [(parallel
2142 [(set (reg:CCS 33)
2143 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2144 (match_operand:BLK 1 "memory_operand" "")))
2145 (use (match_operand 2 "nonmemory_operand" ""))
2146 (clobber (match_dup 3))])]
2147 ""
2148 "operands[3] = gen_rtx_SCRATCH (Pmode);")
2149
2150 (define_insn "*cmpmem_short"
2151 [(set (reg:CCS 33)
2152 (compare:CCS (match_operand:BLK 0 "memory_operand" "=Q,Q")
2153 (match_operand:BLK 1 "memory_operand" "Q,Q")))
2154 (use (match_operand 2 "nonmemory_operand" "n,a"))
2155 (clobber (match_scratch 3 "=X,&a"))]
2156 "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
2157 && GET_MODE (operands[3]) == Pmode"
2158 {
2159 switch (which_alternative)
2160 {
2161 case 0:
2162 return "clc\t%O0(%b2+1,%R0),%1";
2163
2164 case 1:
2165 output_asm_insn ("bras\t%3,.+10", operands);
2166 output_asm_insn ("clc\t%O0(1,%R0),%1", operands);
2167 return "ex\t%2,0(%3)";
2168
2169 default:
2170 abort ();
2171 }
2172 }
2173 [(set_attr "op_type" "SS,NN")
2174 (set_attr "type" "cs,cs")
2175 (set_attr "atype" "*,agen")
2176 (set_attr "length" "*,14")])
2177
2178 ; Compare a block of arbitrary length.
2179
2180 (define_expand "cmpmem_long"
2181 [(parallel
2182 [(clobber (match_dup 2))
2183 (clobber (match_dup 3))
2184 (set (reg:CCS 33)
2185 (compare:CCS (match_operand:BLK 0 "memory_operand" "")
2186 (match_operand:BLK 1 "memory_operand" "")))
2187 (use (match_operand 2 "general_operand" ""))
2188 (use (match_dup 3))])]
2189 ""
2190 {
2191 enum machine_mode dword_mode = word_mode == DImode ? TImode : DImode;
2192 rtx reg0 = gen_reg_rtx (dword_mode);
2193 rtx reg1 = gen_reg_rtx (dword_mode);
2194 rtx addr0 = gen_lowpart (Pmode, gen_highpart (word_mode, reg0));
2195 rtx addr1 = gen_lowpart (Pmode, gen_highpart (word_mode, reg1));
2196 rtx len0 = gen_lowpart (Pmode, reg0);
2197 rtx len1 = gen_lowpart (Pmode, reg1);
2198
2199 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg0));
2200 emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX));
2201 emit_move_insn (len0, operands[2]);
2202
2203 emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
2204 emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
2205 emit_move_insn (len1, operands[2]);
2206
2207 operands[0] = replace_equiv_address_nv (operands[0], addr0);
2208 operands[1] = replace_equiv_address_nv (operands[1], addr1);
2209 operands[2] = reg0;
2210 operands[3] = reg1;
2211 })
2212
2213 (define_insn "*cmpmem_long_64"
2214 [(clobber (match_operand:TI 0 "register_operand" "=d"))
2215 (clobber (match_operand:TI 1 "register_operand" "=d"))
2216 (set (reg:CCS 33)
2217 (compare:CCS (mem:BLK (subreg:DI (match_operand:TI 2 "register_operand" "0") 0))
2218 (mem:BLK (subreg:DI (match_operand:TI 3 "register_operand" "1") 0))))
2219 (use (match_dup 2))
2220 (use (match_dup 3))]
2221 "TARGET_64BIT"
2222 "clcle\t%0,%1,0\;jo\t.-4"
2223 [(set_attr "op_type" "NN")
2224 (set_attr "type" "vs")
2225 (set_attr "length" "8")])
2226
2227 (define_insn "*cmpmem_long_31"
2228 [(clobber (match_operand:DI 0 "register_operand" "=d"))
2229 (clobber (match_operand:DI 1 "register_operand" "=d"))
2230 (set (reg:CCS 33)
2231 (compare:CCS (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "0") 0))
2232 (mem:BLK (subreg:SI (match_operand:DI 3 "register_operand" "1") 0))))
2233 (use (match_dup 2))
2234 (use (match_dup 3))]
2235 "!TARGET_64BIT"
2236 "clcle\t%0,%1,0\;jo\t.-4"
2237 [(set_attr "op_type" "NN")
2238 (set_attr "type" "vs")
2239 (set_attr "length" "8")])
2240
2241 ; Convert condition code to integer in range (-1, 0, 1)
2242
2243 (define_insn "cmpint_si"
2244 [(set (match_operand:SI 0 "register_operand" "=d")
2245 (compare:SI (reg:CCS 33) (const_int 0)))]
2246 ""
2247 {
2248 output_asm_insn ("lhi\t%0,1", operands);
2249 output_asm_insn ("jh\t.+12", operands);
2250 output_asm_insn ("jl\t.+6", operands);
2251 output_asm_insn ("sr\t%0,%0", operands);
2252 return "lcr\t%0,%0";
2253 }
2254 [(set_attr "op_type" "NN")
2255 (set_attr "length" "16")
2256 (set_attr "type" "other")])
2257
2258 (define_insn "cmpint_di"
2259 [(set (match_operand:DI 0 "register_operand" "=d")
2260 (compare:DI (reg:CCS 33) (const_int 0)))]
2261 "TARGET_64BIT"
2262 {
2263 output_asm_insn ("lghi\t%0,1", operands);
2264 output_asm_insn ("jh\t.+16", operands);
2265 output_asm_insn ("jl\t.+8", operands);
2266 output_asm_insn ("sgr\t%0,%0", operands);
2267 return "lcgr\t%0,%0";
2268 }
2269 [(set_attr "op_type" "NN")
2270 (set_attr "length" "20")
2271 (set_attr "type" "other")])
2272
2273
2274 ;;
2275 ;;- Conversion instructions.
2276 ;;
2277
2278 (define_insn "*sethighqisi"
2279 [(set (match_operand:SI 0 "register_operand" "=d,d")
2280 (unspec:SI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2281 (clobber (reg:CC 33))]
2282 ""
2283 "@
2284 icm\t%0,8,%1
2285 icmy\t%0,8,%1"
2286 [(set_attr "op_type" "RS,RSY")])
2287
2288 (define_insn "*sethighhisi"
2289 [(set (match_operand:SI 0 "register_operand" "=d,d")
2290 (unspec:SI [(match_operand:HI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2291 (clobber (reg:CC 33))]
2292 ""
2293 "@
2294 icm\t%0,12,%1
2295 icmy\t%0,12,%1"
2296 [(set_attr "op_type" "RS,RSY")])
2297
2298 (define_insn "*sethighqidi_64"
2299 [(set (match_operand:DI 0 "register_operand" "=d")
2300 (unspec:DI [(match_operand:QI 1 "s_operand" "QS")] UNSPEC_SETHIGH))
2301 (clobber (reg:CC 33))]
2302 "TARGET_64BIT"
2303 "icmh\t%0,8,%1"
2304 [(set_attr "op_type" "RSY")])
2305
2306 (define_insn "*sethighqidi_31"
2307 [(set (match_operand:DI 0 "register_operand" "=d,d")
2308 (unspec:DI [(match_operand:QI 1 "s_operand" "Q,S")] UNSPEC_SETHIGH))
2309 (clobber (reg:CC 33))]
2310 "!TARGET_64BIT"
2311 "@
2312 icm\t%0,8,%1
2313 icmy\t%0,8,%1"
2314 [(set_attr "op_type" "RS,RSY")])
2315
2316 (define_insn_and_split "*extractqi"
2317 [(set (match_operand:SI 0 "register_operand" "=d")
2318 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2319 (match_operand 2 "const_int_operand" "n")
2320 (const_int 0)))
2321 (clobber (reg:CC 33))]
2322 "!TARGET_64BIT
2323 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 8"
2324 "#"
2325 "&& reload_completed"
2326 [(parallel
2327 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2328 (clobber (reg:CC 33))])
2329 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2330 {
2331 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2332 operands[1] = change_address (operands[1], QImode, 0);
2333 }
2334 [(set_attr "atype" "agen")])
2335
2336 (define_insn_and_split "*extracthi"
2337 [(set (match_operand:SI 0 "register_operand" "=d")
2338 (zero_extract:SI (match_operand:QI 1 "s_operand" "Q")
2339 (match_operand 2 "const_int_operand" "n")
2340 (const_int 0)))
2341 (clobber (reg:CC 33))]
2342 "!TARGET_64BIT
2343 && INTVAL (operands[2]) >= 8 && INTVAL (operands[2]) < 16"
2344 "#"
2345 "&& reload_completed"
2346 [(parallel
2347 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2348 (clobber (reg:CC 33))])
2349 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
2350 {
2351 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
2352 operands[1] = change_address (operands[1], HImode, 0);
2353 }
2354 [(set_attr "atype" "agen")])
2355
2356 ;
2357 ; extendsidi2 instruction pattern(s).
2358 ;
2359
2360 (define_expand "extendsidi2"
2361 [(set (match_operand:DI 0 "register_operand" "")
2362 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2363 ""
2364 "
2365 {
2366 if (!TARGET_64BIT)
2367 {
2368 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2369 emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]);
2370 emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx);
2371 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32)));
2372 DONE;
2373 }
2374 }
2375 ")
2376
2377 (define_insn "*extendsidi2"
2378 [(set (match_operand:DI 0 "register_operand" "=d,d")
2379 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2380 "TARGET_64BIT"
2381 "@
2382 lgfr\t%0,%1
2383 lgf\t%0,%1"
2384 [(set_attr "op_type" "RRE,RXY")])
2385
2386 ;
2387 ; extendhidi2 instruction pattern(s).
2388 ;
2389
2390 (define_expand "extendhidi2"
2391 [(set (match_operand:DI 0 "register_operand" "")
2392 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
2393 ""
2394 "
2395 {
2396 if (!TARGET_64BIT)
2397 {
2398 rtx tmp = gen_reg_rtx (SImode);
2399 emit_insn (gen_extendhisi2 (tmp, operands[1]));
2400 emit_insn (gen_extendsidi2 (operands[0], tmp));
2401 DONE;
2402 }
2403 else
2404 {
2405 operands[1] = gen_lowpart (DImode, operands[1]);
2406 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2407 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (48)));
2408 DONE;
2409 }
2410 }
2411 ")
2412
2413 (define_insn "*extendhidi2"
2414 [(set (match_operand:DI 0 "register_operand" "=d")
2415 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2416 "TARGET_64BIT"
2417 "lgh\t%0,%1"
2418 [(set_attr "op_type" "RXY")])
2419
2420 ;
2421 ; extendqidi2 instruction pattern(s).
2422 ;
2423
2424 (define_expand "extendqidi2"
2425 [(set (match_operand:DI 0 "register_operand" "")
2426 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
2427 ""
2428 "
2429 {
2430 if (!TARGET_64BIT)
2431 {
2432 rtx tmp = gen_reg_rtx (SImode);
2433 emit_insn (gen_extendqisi2 (tmp, operands[1]));
2434 emit_insn (gen_extendsidi2 (operands[0], tmp));
2435 DONE;
2436 }
2437 else
2438 {
2439 operands[1] = gen_lowpart (DImode, operands[1]);
2440 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2441 emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (56)));
2442 DONE;
2443 }
2444 }
2445 ")
2446
2447 (define_insn "*extendqidi2"
2448 [(set (match_operand:DI 0 "register_operand" "=d")
2449 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2450 "TARGET_64BIT && TARGET_LONG_DISPLACEMENT"
2451 "lgb\t%0,%1"
2452 [(set_attr "op_type" "RXY")])
2453
2454 (define_insn_and_split "*extendqidi2_short_displ"
2455 [(set (match_operand:DI 0 "register_operand" "=d")
2456 (sign_extend:DI (match_operand:QI 1 "s_operand" "Q")))
2457 (clobber (reg:CC 33))]
2458 "TARGET_64BIT && !TARGET_LONG_DISPLACEMENT"
2459 "#"
2460 "&& reload_completed"
2461 [(parallel
2462 [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_SETHIGH))
2463 (clobber (reg:CC 33))])
2464 (parallel
2465 [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 56)))
2466 (clobber (reg:CC 33))])]
2467 "")
2468
2469 ;
2470 ; extendhisi2 instruction pattern(s).
2471 ;
2472
2473 (define_expand "extendhisi2"
2474 [(set (match_operand:SI 0 "register_operand" "")
2475 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
2476 ""
2477 "
2478 {
2479 operands[1] = gen_lowpart (SImode, operands[1]);
2480 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (16)));
2481 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (16)));
2482 DONE;
2483 }
2484 ")
2485
2486 (define_insn "*extendhisi2"
2487 [(set (match_operand:SI 0 "register_operand" "=d,d")
2488 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))]
2489 ""
2490 "@
2491 lh\t%0,%1
2492 lhy\t%0,%1"
2493 [(set_attr "op_type" "RX,RXY")])
2494
2495 ;
2496 ; extendqisi2 instruction pattern(s).
2497 ;
2498
2499 (define_expand "extendqisi2"
2500 [(set (match_operand:SI 0 "register_operand" "")
2501 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
2502 ""
2503 "
2504 {
2505 operands[1] = gen_lowpart (SImode, operands[1]);
2506 emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (24)));
2507 emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (24)));
2508 DONE;
2509 }
2510 ")
2511
2512 (define_insn "*extendqisi2"
2513 [(set (match_operand:SI 0 "register_operand" "=d")
2514 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2515 "TARGET_LONG_DISPLACEMENT"
2516 "lb\t%0,%1"
2517 [(set_attr "op_type" "RXY")])
2518
2519 (define_insn_and_split "*extendqisi2_short_displ"
2520 [(set (match_operand:SI 0 "register_operand" "=d")
2521 (sign_extend:SI (match_operand:QI 1 "s_operand" "Q")))
2522 (clobber (reg:CC 33))]
2523 "!TARGET_LONG_DISPLACEMENT"
2524 "#"
2525 "&& reload_completed"
2526 [(parallel
2527 [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_SETHIGH))
2528 (clobber (reg:CC 33))])
2529 (parallel
2530 [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))
2531 (clobber (reg:CC 33))])]
2532 "")
2533
2534 ;
2535 ; extendqihi2 instruction pattern(s).
2536 ;
2537
2538
2539 ;
2540 ; zero_extendsidi2 instruction pattern(s).
2541 ;
2542
2543 (define_expand "zero_extendsidi2"
2544 [(set (match_operand:DI 0 "register_operand" "")
2545 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2546 ""
2547 "
2548 {
2549 if (!TARGET_64BIT)
2550 {
2551 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[0]));
2552 emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]);
2553 emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx);
2554 DONE;
2555 }
2556 }
2557 ")
2558
2559 (define_insn "*zero_extendsidi2"
2560 [(set (match_operand:DI 0 "register_operand" "=d,d")
2561 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
2562 "TARGET_64BIT"
2563 "@
2564 llgfr\t%0,%1
2565 llgf\t%0,%1"
2566 [(set_attr "op_type" "RRE,RXY")])
2567
2568 ;
2569 ; zero_extendhidi2 instruction pattern(s).
2570 ;
2571
2572 (define_expand "zero_extendhidi2"
2573 [(set (match_operand:DI 0 "register_operand" "")
2574 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
2575 ""
2576 "
2577 {
2578 if (!TARGET_64BIT)
2579 {
2580 rtx tmp = gen_reg_rtx (SImode);
2581 emit_insn (gen_zero_extendhisi2 (tmp, operands[1]));
2582 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2583 DONE;
2584 }
2585 else
2586 {
2587 operands[1] = gen_lowpart (DImode, operands[1]);
2588 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (48)));
2589 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (48)));
2590 DONE;
2591 }
2592 }
2593 ")
2594
2595 (define_insn "*zero_extendhidi2"
2596 [(set (match_operand:DI 0 "register_operand" "=d")
2597 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
2598 "TARGET_64BIT"
2599 "llgh\t%0,%1"
2600 [(set_attr "op_type" "RXY")])
2601
2602 ;
2603 ; LLGT-type instructions (zero-extend from 31 bit to 64 bit).
2604 ;
2605
2606 (define_insn "*llgt_sisi"
2607 [(set (match_operand:SI 0 "register_operand" "=d,d")
2608 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,m")
2609 (const_int 2147483647)))]
2610 "TARGET_64BIT"
2611 "@
2612 llgtr\t%0,%1
2613 llgt\t%0,%1"
2614 [(set_attr "op_type" "RRE,RXE")])
2615
2616 (define_split
2617 [(set (match_operand:SI 0 "register_operand" "")
2618 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2619 (const_int 2147483647)))
2620 (clobber (reg:CC 33))]
2621 "TARGET_64BIT && reload_completed"
2622 [(set (match_dup 0)
2623 (and:SI (match_dup 1)
2624 (const_int 2147483647)))]
2625 "")
2626
2627 (define_insn "*llgt_didi"
2628 [(set (match_operand:DI 0 "register_operand" "=d,d")
2629 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o")
2630 (const_int 2147483647)))]
2631 "TARGET_64BIT"
2632 "@
2633 llgtr\t%0,%1
2634 llgt\t%0,%N1"
2635 [(set_attr "op_type" "RRE,RXE")])
2636
2637 (define_split
2638 [(set (match_operand:DI 0 "register_operand" "")
2639 (and:DI (match_operand:DI 1 "nonimmediate_operand" "")
2640 (const_int 2147483647)))
2641 (clobber (reg:CC 33))]
2642 "TARGET_64BIT && reload_completed"
2643 [(set (match_dup 0)
2644 (and:DI (match_dup 1)
2645 (const_int 2147483647)))]
2646 "")
2647
2648 (define_insn "*llgt_sidi"
2649 [(set (match_operand:DI 0 "register_operand" "=d")
2650 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2651 (const_int 2147483647)))]
2652 "TARGET_64BIT"
2653 "llgt\t%0,%1"
2654 [(set_attr "op_type" "RXE")])
2655
2656 (define_insn_and_split "*llgt_sidi_split"
2657 [(set (match_operand:DI 0 "register_operand" "=d")
2658 (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "m") 0)
2659 (const_int 2147483647)))
2660 (clobber (reg:CC 33))]
2661 "TARGET_64BIT"
2662 "#"
2663 "&& reload_completed"
2664 [(set (match_dup 0)
2665 (and:DI (subreg:DI (match_dup 1) 0)
2666 (const_int 2147483647)))]
2667 "")
2668
2669 ;
2670 ; zero_extendqidi2 instruction pattern(s)
2671 ;
2672
2673 (define_expand "zero_extendqidi2"
2674 [(set (match_operand:DI 0 "register_operand" "")
2675 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
2676 ""
2677 "
2678 {
2679 if (!TARGET_64BIT)
2680 {
2681 rtx tmp = gen_reg_rtx (SImode);
2682 emit_insn (gen_zero_extendqisi2 (tmp, operands[1]));
2683 emit_insn (gen_zero_extendsidi2 (operands[0], tmp));
2684 DONE;
2685 }
2686 else
2687 {
2688 operands[1] = gen_lowpart (DImode, operands[1]);
2689 emit_insn (gen_ashldi3 (operands[0], operands[1], GEN_INT (56)));
2690 emit_insn (gen_lshrdi3 (operands[0], operands[0], GEN_INT (56)));
2691 DONE;
2692 }
2693 }
2694 ")
2695
2696 (define_insn "*zero_extendqidi2"
2697 [(set (match_operand:DI 0 "register_operand" "=d")
2698 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
2699 "TARGET_64BIT"
2700 "llgc\t%0,%1"
2701 [(set_attr "op_type" "RXY")])
2702
2703 ;
2704 ; zero_extendhisi2 instruction pattern(s).
2705 ;
2706
2707 (define_expand "zero_extendhisi2"
2708 [(set (match_operand:SI 0 "register_operand" "")
2709 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
2710 ""
2711 "
2712 {
2713 operands[1] = gen_lowpart (SImode, operands[1]);
2714 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xffff)));
2715 DONE;
2716 }
2717 ")
2718
2719 (define_insn "*zero_extendhisi2_64"
2720 [(set (match_operand:SI 0 "register_operand" "=d")
2721 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
2722 "TARGET_64BIT"
2723 "llgh\t%0,%1"
2724 [(set_attr "op_type" "RXY")])
2725
2726 (define_insn_and_split "*zero_extendhisi2_31"
2727 [(set (match_operand:SI 0 "register_operand" "=&d")
2728 (zero_extend:SI (match_operand:HI 1 "s_operand" "QS")))
2729 (clobber (reg:CC 33))]
2730 "!TARGET_64BIT"
2731 "#"
2732 "&& reload_completed"
2733 [(set (match_dup 0) (const_int 0))
2734 (parallel
2735 [(set (strict_low_part (match_dup 2)) (match_dup 1))
2736 (clobber (reg:CC 33))])]
2737 "operands[2] = gen_lowpart (HImode, operands[0]);"
2738 [(set_attr "atype" "agen")])
2739
2740 ;
2741 ; zero_extendqisi2 instruction pattern(s).
2742 ;
2743
2744 (define_expand "zero_extendqisi2"
2745 [(set (match_operand:SI 0 "register_operand" "")
2746 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
2747 ""
2748 "
2749 {
2750 operands[1] = gen_lowpart (SImode, operands[1]);
2751 emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT (0xff)));
2752 DONE;
2753 }
2754 ")
2755
2756 (define_insn "*zero_extendqisi2_64"
2757 [(set (match_operand:SI 0 "register_operand" "=d")
2758 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2759 "TARGET_ZARCH"
2760 "llgc\t%0,%1"
2761 [(set_attr "op_type" "RXY")])
2762
2763 (define_insn_and_split "*zero_extendqisi2_31"
2764 [(set (match_operand:SI 0 "register_operand" "=&d")
2765 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
2766 "!TARGET_ZARCH"
2767 "#"
2768 "&& reload_completed"
2769 [(set (match_dup 0) (const_int 0))
2770 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2771 "operands[2] = gen_lowpart (QImode, operands[0]);"
2772 [(set_attr "atype" "agen")])
2773
2774 ;
2775 ; zero_extendqihi2 instruction pattern(s).
2776 ;
2777
2778 (define_expand "zero_extendqihi2"
2779 [(set (match_operand:HI 0 "register_operand" "")
2780 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
2781 "TARGET_ZARCH"
2782 "
2783 {
2784 operands[1] = gen_lowpart (HImode, operands[1]);
2785 emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff)));
2786 DONE;
2787 }
2788 ")
2789
2790 (define_insn "*zero_extendqihi2_64"
2791 [(set (match_operand:HI 0 "register_operand" "=d")
2792 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2793 "TARGET_ZARCH"
2794 "llgc\t%0,%1"
2795 [(set_attr "op_type" "RXY")])
2796
2797 (define_insn_and_split "*zero_extendqihi2_31"
2798 [(set (match_operand:HI 0 "register_operand" "=&d")
2799 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
2800 "!TARGET_ZARCH"
2801 "#"
2802 "&& reload_completed"
2803 [(set (match_dup 0) (const_int 0))
2804 (set (strict_low_part (match_dup 2)) (match_dup 1))]
2805 "operands[2] = gen_lowpart (QImode, operands[0]);"
2806 [(set_attr "atype" "agen")])
2807
2808
2809 ;
2810 ; fixuns_truncdfdi2 and fix_truncdfsi2 instruction pattern(s).
2811 ;
2812
2813 (define_expand "fixuns_truncdfdi2"
2814 [(set (match_operand:DI 0 "register_operand" "")
2815 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2816 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2817 {
2818 rtx label1 = gen_label_rtx ();
2819 rtx label2 = gen_label_rtx ();
2820 rtx temp = gen_reg_rtx (DFmode);
2821 operands[1] = force_reg (DFmode, operands[1]);
2822
2823 emit_insn (gen_cmpdf (operands[1],
2824 CONST_DOUBLE_FROM_REAL_VALUE (
2825 REAL_VALUE_ATOF ("9223372036854775808.0", DFmode), DFmode)));
2826 emit_jump_insn (gen_blt (label1));
2827 emit_insn (gen_subdf3 (temp, operands[1],
2828 CONST_DOUBLE_FROM_REAL_VALUE (
2829 REAL_VALUE_ATOF ("18446744073709551616.0", DFmode), DFmode)));
2830 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], temp, GEN_INT(7)));
2831 emit_jump (label2);
2832
2833 emit_label (label1);
2834 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2835 emit_label (label2);
2836 DONE;
2837 })
2838
2839 (define_expand "fix_truncdfdi2"
2840 [(set (match_operand:DI 0 "register_operand" "")
2841 (fix:DI (match_operand:DF 1 "nonimmediate_operand" "")))]
2842 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2843 {
2844 operands[1] = force_reg (DFmode, operands[1]);
2845 emit_insn (gen_fix_truncdfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2846 DONE;
2847 })
2848
2849 (define_insn "fix_truncdfdi2_ieee"
2850 [(set (match_operand:DI 0 "register_operand" "=d")
2851 (fix:DI (match_operand:DF 1 "register_operand" "f")))
2852 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2853 (clobber (reg:CC 33))]
2854 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2855 "cgdbr\t%0,%h2,%1"
2856 [(set_attr "op_type" "RRE")
2857 (set_attr "type" "ftoi")])
2858
2859 ;
2860 ; fixuns_truncdfsi2 and fix_truncdfsi2 instruction pattern(s).
2861 ;
2862
2863 (define_expand "fixuns_truncdfsi2"
2864 [(set (match_operand:SI 0 "register_operand" "")
2865 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2866 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2867 {
2868 rtx label1 = gen_label_rtx ();
2869 rtx label2 = gen_label_rtx ();
2870 rtx temp = gen_reg_rtx (DFmode);
2871
2872 operands[1] = force_reg (DFmode,operands[1]);
2873 emit_insn (gen_cmpdf (operands[1],
2874 CONST_DOUBLE_FROM_REAL_VALUE (
2875 REAL_VALUE_ATOF ("2147483648.0", DFmode), DFmode)));
2876 emit_jump_insn (gen_blt (label1));
2877 emit_insn (gen_subdf3 (temp, operands[1],
2878 CONST_DOUBLE_FROM_REAL_VALUE (
2879 REAL_VALUE_ATOF ("4294967296.0", DFmode), DFmode)));
2880 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], temp, GEN_INT (7)));
2881 emit_jump (label2);
2882
2883 emit_label (label1);
2884 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2885 emit_label (label2);
2886 DONE;
2887 })
2888
2889 (define_expand "fix_truncdfsi2"
2890 [(set (match_operand:SI 0 "register_operand" "")
2891 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "")))]
2892 "TARGET_HARD_FLOAT"
2893 {
2894 if (TARGET_IBM_FLOAT)
2895 {
2896 /* This is the algorithm from POP chapter A.5.7.2. */
2897
2898 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
2899 rtx two31r = s390_gen_rtx_const_DI (0x4f000000, 0x08000000);
2900 rtx two32 = s390_gen_rtx_const_DI (0x4e000001, 0x00000000);
2901
2902 operands[1] = force_reg (DFmode, operands[1]);
2903 emit_insn (gen_fix_truncdfsi2_ibm (operands[0], operands[1],
2904 two31r, two32, temp));
2905 }
2906 else
2907 {
2908 operands[1] = force_reg (DFmode, operands[1]);
2909 emit_insn (gen_fix_truncdfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
2910 }
2911
2912 DONE;
2913 })
2914
2915 (define_insn "fix_truncdfsi2_ieee"
2916 [(set (match_operand:SI 0 "register_operand" "=d")
2917 (fix:SI (match_operand:DF 1 "register_operand" "f")))
2918 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2919 (clobber (reg:CC 33))]
2920 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2921 "cfdbr\t%0,%h2,%1"
2922 [(set_attr "op_type" "RRE")
2923 (set_attr "type" "other" )])
2924
2925 (define_insn "fix_truncdfsi2_ibm"
2926 [(set (match_operand:SI 0 "register_operand" "=d")
2927 (fix:SI (match_operand:DF 1 "nonimmediate_operand" "+f")))
2928 (use (match_operand:DI 2 "immediate_operand" "m"))
2929 (use (match_operand:DI 3 "immediate_operand" "m"))
2930 (use (match_operand:BLK 4 "memory_operand" "m"))
2931 (clobber (reg:CC 33))]
2932 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
2933 {
2934 output_asm_insn ("sd\t%1,%2", operands);
2935 output_asm_insn ("aw\t%1,%3", operands);
2936 output_asm_insn ("std\t%1,%4", operands);
2937 output_asm_insn ("xi\t%N4,128", operands);
2938 return "l\t%0,%N4";
2939 }
2940 [(set_attr "op_type" "NN")
2941 (set_attr "type" "ftoi")
2942 (set_attr "atype" "agen")
2943 (set_attr "length" "20")])
2944
2945 ;
2946 ; fixuns_truncsfdi2 and fix_truncsfdi2 instruction pattern(s).
2947 ;
2948
2949 (define_expand "fixuns_truncsfdi2"
2950 [(set (match_operand:DI 0 "register_operand" "")
2951 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2952 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2953 {
2954 rtx label1 = gen_label_rtx ();
2955 rtx label2 = gen_label_rtx ();
2956 rtx temp = gen_reg_rtx (SFmode);
2957
2958 operands[1] = force_reg (SFmode, operands[1]);
2959 emit_insn (gen_cmpsf (operands[1],
2960 CONST_DOUBLE_FROM_REAL_VALUE (
2961 REAL_VALUE_ATOF ("9223372036854775808.0", SFmode), SFmode)));
2962 emit_jump_insn (gen_blt (label1));
2963
2964 emit_insn (gen_subsf3 (temp, operands[1],
2965 CONST_DOUBLE_FROM_REAL_VALUE (
2966 REAL_VALUE_ATOF ("18446744073709551616.0", SFmode), SFmode)));
2967 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], temp, GEN_INT(7)));
2968 emit_jump (label2);
2969
2970 emit_label (label1);
2971 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2972 emit_label (label2);
2973 DONE;
2974 })
2975
2976 (define_expand "fix_truncsfdi2"
2977 [(set (match_operand:DI 0 "register_operand" "")
2978 (fix:DI (match_operand:SF 1 "nonimmediate_operand" "")))]
2979 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2980 {
2981 operands[1] = force_reg (SFmode, operands[1]);
2982 emit_insn (gen_fix_truncsfdi2_ieee (operands[0], operands[1], GEN_INT(5)));
2983 DONE;
2984 })
2985
2986 (define_insn "fix_truncsfdi2_ieee"
2987 [(set (match_operand:DI 0 "register_operand" "=d")
2988 (fix:DI (match_operand:SF 1 "register_operand" "f")))
2989 (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND)
2990 (clobber (reg:CC 33))]
2991 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
2992 "cgebr\t%0,%h2,%1"
2993 [(set_attr "op_type" "RRE")
2994 (set_attr "type" "ftoi")])
2995
2996 ;
2997 ; fixuns_truncsfsi2 and fix_truncsfsi2 instruction pattern(s).
2998 ;
2999
3000 (define_expand "fixuns_truncsfsi2"
3001 [(set (match_operand:SI 0 "register_operand" "")
3002 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
3003 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3004 {
3005 rtx label1 = gen_label_rtx ();
3006 rtx label2 = gen_label_rtx ();
3007 rtx temp = gen_reg_rtx (SFmode);
3008
3009 operands[1] = force_reg (SFmode, operands[1]);
3010 emit_insn (gen_cmpsf (operands[1],
3011 CONST_DOUBLE_FROM_REAL_VALUE (
3012 REAL_VALUE_ATOF ("2147483648.0", SFmode), SFmode)));
3013 emit_jump_insn (gen_blt (label1));
3014 emit_insn (gen_subsf3 (temp, operands[1],
3015 CONST_DOUBLE_FROM_REAL_VALUE (
3016 REAL_VALUE_ATOF ("4294967296.0", SFmode), SFmode)));
3017 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], temp, GEN_INT (7)));
3018 emit_jump (label2);
3019
3020 emit_label (label1);
3021 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3022 emit_label (label2);
3023 DONE;
3024 })
3025
3026 (define_expand "fix_truncsfsi2"
3027 [(set (match_operand:SI 0 "register_operand" "")
3028 (fix:SI (match_operand:SF 1 "nonimmediate_operand" "")))]
3029 "TARGET_HARD_FLOAT"
3030 {
3031 if (TARGET_IBM_FLOAT)
3032 {
3033 /* Convert to DFmode and then use the POP algorithm. */
3034 rtx temp = gen_reg_rtx (DFmode);
3035 emit_insn (gen_extendsfdf2 (temp, operands[1]));
3036 emit_insn (gen_fix_truncdfsi2 (operands[0], temp));
3037 }
3038 else
3039 {
3040 operands[1] = force_reg (SFmode, operands[1]);
3041 emit_insn (gen_fix_truncsfsi2_ieee (operands[0], operands[1], GEN_INT (5)));
3042 }
3043
3044 DONE;
3045 })
3046
3047 (define_insn "fix_truncsfsi2_ieee"
3048 [(set (match_operand:SI 0 "register_operand" "=d")
3049 (fix:SI (match_operand:SF 1 "register_operand" "f")))
3050 (unspec:SI [(match_operand:SI 2 "immediate_operand" "K")] UNSPEC_ROUND)
3051 (clobber (reg:CC 33))]
3052 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3053 "cfebr\t%0,%h2,%1"
3054 [(set_attr "op_type" "RRE")
3055 (set_attr "type" "ftoi")])
3056
3057 ;
3058 ; floatdidf2 instruction pattern(s).
3059 ;
3060
3061 (define_insn "floatdidf2"
3062 [(set (match_operand:DF 0 "register_operand" "=f")
3063 (float:DF (match_operand:DI 1 "register_operand" "d")))
3064 (clobber (reg:CC 33))]
3065 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3066 "cdgbr\t%0,%1"
3067 [(set_attr "op_type" "RRE")
3068 (set_attr "type" "itof" )])
3069
3070 ;
3071 ; floatdisf2 instruction pattern(s).
3072 ;
3073
3074 (define_insn "floatdisf2"
3075 [(set (match_operand:SF 0 "register_operand" "=f")
3076 (float:SF (match_operand:DI 1 "register_operand" "d")))
3077 (clobber (reg:CC 33))]
3078 "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3079 "cegbr\t%0,%1"
3080 [(set_attr "op_type" "RRE")
3081 (set_attr "type" "itof" )])
3082
3083 ;
3084 ; floatsidf2 instruction pattern(s).
3085 ;
3086
3087 (define_expand "floatsidf2"
3088 [(parallel
3089 [(set (match_operand:DF 0 "register_operand" "")
3090 (float:DF (match_operand:SI 1 "register_operand" "")))
3091 (clobber (reg:CC 33))])]
3092 "TARGET_HARD_FLOAT"
3093 {
3094 if (TARGET_IBM_FLOAT)
3095 {
3096 /* This is the algorithm from POP chapter A.5.7.1. */
3097
3098 rtx temp = assign_stack_local (BLKmode, 8, BITS_PER_WORD);
3099 rtx two31 = s390_gen_rtx_const_DI (0x4e000000, 0x80000000);
3100
3101 emit_insn (gen_floatsidf2_ibm (operands[0], operands[1], two31, temp));
3102 DONE;
3103 }
3104 })
3105
3106 (define_insn "floatsidf2_ieee"
3107 [(set (match_operand:DF 0 "register_operand" "=f")
3108 (float:DF (match_operand:SI 1 "register_operand" "d")))
3109 (clobber (reg:CC 33))]
3110 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3111 "cdfbr\t%0,%1"
3112 [(set_attr "op_type" "RRE")
3113 (set_attr "type" "itof" )])
3114
3115 (define_insn "floatsidf2_ibm"
3116 [(set (match_operand:DF 0 "register_operand" "=f")
3117 (float:DF (match_operand:SI 1 "register_operand" "d")))
3118 (use (match_operand:DI 2 "immediate_operand" "m"))
3119 (use (match_operand:BLK 3 "memory_operand" "m"))
3120 (clobber (reg:CC 33))]
3121 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3122 {
3123 output_asm_insn ("st\t%1,%N3", operands);
3124 output_asm_insn ("xi\t%N3,128", operands);
3125 output_asm_insn ("mvc\t%O3(4,%R3),%2", operands);
3126 output_asm_insn ("ld\t%0,%3", operands);
3127 return "sd\t%0,%2";
3128 }
3129 [(set_attr "op_type" "NN")
3130 (set_attr "type" "other" )
3131 (set_attr "atype" "agen")
3132 (set_attr "length" "20")])
3133
3134 ;
3135 ; floatsisf2 instruction pattern(s).
3136 ;
3137
3138 (define_expand "floatsisf2"
3139 [(parallel
3140 [(set (match_operand:SF 0 "register_operand" "")
3141 (float:SF (match_operand:SI 1 "register_operand" "")))
3142 (clobber (reg:CC 33))])]
3143 "TARGET_HARD_FLOAT"
3144 {
3145 if (TARGET_IBM_FLOAT)
3146 {
3147 /* Use the POP algorithm to convert to DFmode and then truncate. */
3148 rtx temp = gen_reg_rtx (DFmode);
3149 emit_insn (gen_floatsidf2 (temp, operands[1]));
3150 emit_insn (gen_truncdfsf2 (operands[0], temp));
3151 DONE;
3152 }
3153 })
3154
3155 (define_insn "floatsisf2_ieee"
3156 [(set (match_operand:SF 0 "register_operand" "=f")
3157 (float:SF (match_operand:SI 1 "register_operand" "d")))
3158 (clobber (reg:CC 33))]
3159 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3160 "cefbr\t%0,%1"
3161 [(set_attr "op_type" "RRE")
3162 (set_attr "type" "itof" )])
3163
3164 ;
3165 ; truncdfsf2 instruction pattern(s).
3166 ;
3167
3168 (define_expand "truncdfsf2"
3169 [(set (match_operand:SF 0 "register_operand" "")
3170 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))]
3171 "TARGET_HARD_FLOAT"
3172 "")
3173
3174 (define_insn "truncdfsf2_ieee"
3175 [(set (match_operand:SF 0 "register_operand" "=f")
3176 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
3177 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3178 "ledbr\t%0,%1"
3179 [(set_attr "op_type" "RRE")])
3180
3181 (define_insn "truncdfsf2_ibm"
3182 [(set (match_operand:SF 0 "register_operand" "=f,f")
3183 (float_truncate:SF (match_operand:DF 1 "general_operand" "f,R")))]
3184 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3185 "@
3186 lrer\t%0,%1
3187 le\t%0,%1"
3188 [(set_attr "op_type" "RR,RX")
3189 (set_attr "type" "floads,floads")])
3190
3191 ;
3192 ; extendsfdf2 instruction pattern(s).
3193 ;
3194
3195 (define_expand "extendsfdf2"
3196 [(set (match_operand:DF 0 "register_operand" "")
3197 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
3198 "TARGET_HARD_FLOAT"
3199 {
3200 if (TARGET_IBM_FLOAT)
3201 {
3202 emit_insn (gen_extendsfdf2_ibm (operands[0], operands[1]));
3203 DONE;
3204 }
3205 })
3206
3207 (define_insn "extendsfdf2_ieee"
3208 [(set (match_operand:DF 0 "register_operand" "=f,f")
3209 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))]
3210 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3211 "@
3212 ldebr\t%0,%1
3213 ldeb\t%0,%1"
3214 [(set_attr "op_type" "RRE,RXE")
3215 (set_attr "type" "floads,floads")])
3216
3217 (define_insn "extendsfdf2_ibm"
3218 [(set (match_operand:DF 0 "register_operand" "=f,f")
3219 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R")))
3220 (clobber (reg:CC 33))]
3221 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3222 "@
3223 sdr\t%0,%0\;ler\t%0,%1
3224 sdr\t%0,%0\;le\t%0,%1"
3225 [(set_attr "op_type" "NN,NN")
3226 (set_attr "atype" "reg,agen")
3227 (set_attr "length" "4,6")
3228 (set_attr "type" "o2,o2")])
3229
3230
3231 ;;
3232 ;; ARITHMETIC OPERATIONS
3233 ;;
3234 ; arithmetic operations set the ConditionCode,
3235 ; because of unpredictable Bits in Register for Halfword and Byte
3236 ; the ConditionCode can be set wrong in operations for Halfword and Byte
3237
3238 ;;
3239 ;;- Add instructions.
3240 ;;
3241
3242 ;
3243 ; addti3 instruction pattern(s).
3244 ;
3245
3246 (define_insn_and_split "addti3"
3247 [(set (match_operand:TI 0 "register_operand" "=&d")
3248 (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0")
3249 (match_operand:TI 2 "general_operand" "do") ) )
3250 (clobber (reg:CC 33))]
3251 "TARGET_64BIT"
3252 "#"
3253 "&& reload_completed"
3254 [(parallel
3255 [(set (reg:CCL1 33)
3256 (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8))
3257 (match_dup 7)))
3258 (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
3259 (parallel
3260 [(set (match_dup 3) (plus:DI (plus:DI (match_dup 4) (match_dup 5))
3261 (ltu:DI (reg:CCL1 33) (const_int 0))))
3262 (clobber (reg:CC 33))])]
3263 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3264 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3265 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3266 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3267 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3268 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
3269 [(set_attr "op_type" "NN")])
3270
3271 ;
3272 ; adddi3 instruction pattern(s).
3273 ;
3274
3275 (define_insn "*adddi3_sign"
3276 [(set (match_operand:DI 0 "register_operand" "=d,d")
3277 (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3278 (match_operand:DI 1 "register_operand" "0,0")))
3279 (clobber (reg:CC 33))]
3280 "TARGET_64BIT"
3281 "@
3282 agfr\t%0,%2
3283 agf\t%0,%2"
3284 [(set_attr "op_type" "RRE,RXY")])
3285
3286 (define_insn "*adddi3_zero_cc"
3287 [(set (reg 33)
3288 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3289 (match_operand:DI 1 "register_operand" "0,0"))
3290 (const_int 0)))
3291 (set (match_operand:DI 0 "register_operand" "=d,d")
3292 (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))]
3293 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3294 "@
3295 algfr\t%0,%2
3296 algf\t%0,%2"
3297 [(set_attr "op_type" "RRE,RXY")])
3298
3299 (define_insn "*adddi3_zero_cconly"
3300 [(set (reg 33)
3301 (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3302 (match_operand:DI 1 "register_operand" "0,0"))
3303 (const_int 0)))
3304 (clobber (match_scratch:DI 0 "=d,d"))]
3305 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3306 "@
3307 algfr\t%0,%2
3308 algf\t%0,%2"
3309 [(set_attr "op_type" "RRE,RXY")])
3310
3311 (define_insn "*adddi3_zero"
3312 [(set (match_operand:DI 0 "register_operand" "=d,d")
3313 (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))
3314 (match_operand:DI 1 "register_operand" "0,0")))
3315 (clobber (reg:CC 33))]
3316 "TARGET_64BIT"
3317 "@
3318 algfr\t%0,%2
3319 algf\t%0,%2"
3320 [(set_attr "op_type" "RRE,RXY")])
3321
3322 (define_insn "*adddi3_imm_cc"
3323 [(set (reg 33)
3324 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
3325 (match_operand:DI 2 "const_int_operand" "K"))
3326 (const_int 0)))
3327 (set (match_operand:DI 0 "register_operand" "=d")
3328 (plus:DI (match_dup 1) (match_dup 2)))]
3329 "TARGET_64BIT
3330 && s390_match_ccmode (insn, CCAmode)
3331 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3332 "aghi\t%0,%h2"
3333 [(set_attr "op_type" "RI")])
3334
3335 (define_insn "*adddi3_carry1_cc"
3336 [(set (reg 33)
3337 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3338 (match_operand:DI 2 "general_operand" "d,m"))
3339 (match_dup 1)))
3340 (set (match_operand:DI 0 "register_operand" "=d,d")
3341 (plus:DI (match_dup 1) (match_dup 2)))]
3342 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3343 "@
3344 algr\t%0,%2
3345 alg\t%0,%2"
3346 [(set_attr "op_type" "RRE,RXY")])
3347
3348 (define_insn "*adddi3_carry1_cconly"
3349 [(set (reg 33)
3350 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3351 (match_operand:DI 2 "general_operand" "d,m"))
3352 (match_dup 1)))
3353 (clobber (match_scratch:DI 0 "=d,d"))]
3354 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3355 "@
3356 algr\t%0,%2
3357 alg\t%0,%2"
3358 [(set_attr "op_type" "RRE,RXY")])
3359
3360 (define_insn "*adddi3_carry2_cc"
3361 [(set (reg 33)
3362 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3363 (match_operand:DI 2 "general_operand" "d,m"))
3364 (match_dup 2)))
3365 (set (match_operand:DI 0 "register_operand" "=d,d")
3366 (plus:DI (match_dup 1) (match_dup 2)))]
3367 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3368 "@
3369 algr\t%0,%2
3370 alg\t%0,%2"
3371 [(set_attr "op_type" "RRE,RXY")])
3372
3373 (define_insn "*adddi3_carry2_cconly"
3374 [(set (reg 33)
3375 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3376 (match_operand:DI 2 "general_operand" "d,m"))
3377 (match_dup 2)))
3378 (clobber (match_scratch:DI 0 "=d,d"))]
3379 "s390_match_ccmode (insn, CCL1mode) && TARGET_64BIT"
3380 "@
3381 algr\t%0,%2
3382 alg\t%0,%2"
3383 [(set_attr "op_type" "RRE,RXY")])
3384
3385 (define_insn "*adddi3_cc"
3386 [(set (reg 33)
3387 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3388 (match_operand:DI 2 "general_operand" "d,m"))
3389 (const_int 0)))
3390 (set (match_operand:DI 0 "register_operand" "=d,d")
3391 (plus:DI (match_dup 1) (match_dup 2)))]
3392 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3393 "@
3394 algr\t%0,%2
3395 alg\t%0,%2"
3396 [(set_attr "op_type" "RRE,RXY")])
3397
3398 (define_insn "*adddi3_cconly"
3399 [(set (reg 33)
3400 (compare (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3401 (match_operand:DI 2 "general_operand" "d,m"))
3402 (const_int 0)))
3403 (clobber (match_scratch:DI 0 "=d,d"))]
3404 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3405 "@
3406 algr\t%0,%2
3407 alg\t%0,%2"
3408 [(set_attr "op_type" "RRE,RXY")])
3409
3410 (define_insn "*adddi3_cconly2"
3411 [(set (reg 33)
3412 (compare (match_operand:DI 1 "nonimmediate_operand" "%0,0")
3413 (neg:SI (match_operand:DI 2 "general_operand" "d,m"))))
3414 (clobber (match_scratch:DI 0 "=d,d"))]
3415 "s390_match_ccmode(insn, CCLmode) && TARGET_64BIT"
3416 "@
3417 algr\t%0,%2
3418 alg\t%0,%2"
3419 [(set_attr "op_type" "RRE,RXY")])
3420
3421 (define_insn "*adddi3_64"
3422 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
3423 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
3424 (match_operand:DI 2 "general_operand" "d,K,m") ) )
3425 (clobber (reg:CC 33))]
3426 "TARGET_64BIT"
3427 "@
3428 agr\t%0,%2
3429 aghi\t%0,%h2
3430 ag\t%0,%2"
3431 [(set_attr "op_type" "RRE,RI,RXY")])
3432
3433 (define_insn_and_split "*adddi3_31z"
3434 [(set (match_operand:DI 0 "register_operand" "=&d")
3435 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3436 (match_operand:DI 2 "general_operand" "do") ) )
3437 (clobber (reg:CC 33))]
3438 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3439 "#"
3440 "&& reload_completed"
3441 [(parallel
3442 [(set (reg:CCL1 33)
3443 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3444 (match_dup 7)))
3445 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3446 (parallel
3447 [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
3448 (ltu:SI (reg:CCL1 33) (const_int 0))))
3449 (clobber (reg:CC 33))])]
3450 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3451 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3452 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3453 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3454 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3455 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3456 [(set_attr "op_type" "NN")])
3457
3458 (define_insn_and_split "*adddi3_31"
3459 [(set (match_operand:DI 0 "register_operand" "=&d")
3460 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
3461 (match_operand:DI 2 "general_operand" "do") ) )
3462 (clobber (reg:CC 33))]
3463 "!TARGET_CPU_ZARCH"
3464 "#"
3465 "&& reload_completed"
3466 [(parallel
3467 [(set (match_dup 3) (plus:SI (match_dup 4) (match_dup 5)))
3468 (clobber (reg:CC 33))])
3469 (parallel
3470 [(set (reg:CCL1 33)
3471 (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8))
3472 (match_dup 7)))
3473 (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
3474 (set (pc)
3475 (if_then_else (ltu (reg:CCL1 33) (const_int 0))
3476 (pc)
3477 (label_ref (match_dup 9))))
3478 (parallel
3479 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int 1)))
3480 (clobber (reg:CC 33))])
3481 (match_dup 9)]
3482 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3483 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3484 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3485 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3486 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3487 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3488 operands[9] = gen_label_rtx ();"
3489 [(set_attr "op_type" "NN")])
3490
3491 (define_expand "adddi3"
3492 [(parallel
3493 [(set (match_operand:DI 0 "register_operand" "")
3494 (plus:DI (match_operand:DI 1 "nonimmediate_operand" "")
3495 (match_operand:DI 2 "general_operand" "")))
3496 (clobber (reg:CC 33))])]
3497 ""
3498 "")
3499
3500 ;
3501 ; addsi3 instruction pattern(s).
3502 ;
3503
3504 (define_insn "*addsi3_imm_cc"
3505 [(set (reg 33)
3506 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
3507 (match_operand:SI 2 "const_int_operand" "K"))
3508 (const_int 0)))
3509 (set (match_operand:SI 0 "register_operand" "=d")
3510 (plus:SI (match_dup 1) (match_dup 2)))]
3511 "s390_match_ccmode (insn, CCAmode)
3512 && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\")"
3513 "ahi\t%0,%h2"
3514 [(set_attr "op_type" "RI")])
3515
3516 (define_insn "*addsi3_carry1_cc"
3517 [(set (reg 33)
3518 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3519 (match_operand:SI 2 "general_operand" "d,R,T"))
3520 (match_dup 1)))
3521 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3522 (plus:SI (match_dup 1) (match_dup 2)))]
3523 "s390_match_ccmode (insn, CCL1mode)"
3524 "@
3525 alr\t%0,%2
3526 al\t%0,%2
3527 aly\t%0,%2"
3528 [(set_attr "op_type" "RR,RX,RXY")])
3529
3530 (define_insn "*addsi3_carry1_cconly"
3531 [(set (reg 33)
3532 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3533 (match_operand:SI 2 "general_operand" "d,R,T"))
3534 (match_dup 1)))
3535 (clobber (match_scratch:SI 0 "=d,d,d"))]
3536 "s390_match_ccmode (insn, CCL1mode)"
3537 "@
3538 alr\t%0,%2
3539 al\t%0,%2
3540 aly\t%0,%2"
3541 [(set_attr "op_type" "RR,RX,RXY")])
3542
3543 (define_insn "*addsi3_carry2_cc"
3544 [(set (reg 33)
3545 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3546 (match_operand:SI 2 "general_operand" "d,R,T"))
3547 (match_dup 2)))
3548 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3549 (plus:SI (match_dup 1) (match_dup 2)))]
3550 "s390_match_ccmode (insn, CCL1mode)"
3551 "@
3552 alr\t%0,%2
3553 al\t%0,%2
3554 aly\t%0,%2"
3555 [(set_attr "op_type" "RR,RX,RXY")])
3556
3557 (define_insn "*addsi3_carry2_cconly"
3558 [(set (reg 33)
3559 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3560 (match_operand:SI 2 "general_operand" "d,R,T"))
3561 (match_dup 2)))
3562 (clobber (match_scratch:SI 0 "=d,d,d"))]
3563 "s390_match_ccmode (insn, CCL1mode)"
3564 "@
3565 alr\t%0,%2
3566 al\t%0,%2
3567 aly\t%0,%2"
3568 [(set_attr "op_type" "RR,RX,RXY")])
3569
3570 (define_insn "*addsi3_cc"
3571 [(set (reg 33)
3572 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3573 (match_operand:SI 2 "general_operand" "d,R,T"))
3574 (const_int 0)))
3575 (set (match_operand:SI 0 "register_operand" "=d,d,d")
3576 (plus:SI (match_dup 1) (match_dup 2)))]
3577 "s390_match_ccmode (insn, CCLmode)"
3578 "@
3579 alr\t%0,%2
3580 al\t%0,%2
3581 aly\t%0,%2"
3582 [(set_attr "op_type" "RR,RX,RXY")])
3583
3584 (define_insn "*addsi3_cconly"
3585 [(set (reg 33)
3586 (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3587 (match_operand:SI 2 "general_operand" "d,R,T"))
3588 (const_int 0)))
3589 (clobber (match_scratch:SI 0 "=d,d,d"))]
3590 "s390_match_ccmode (insn, CCLmode)"
3591 "@
3592 alr\t%0,%2
3593 al\t%0,%2
3594 aly\t%0,%2"
3595 [(set_attr "op_type" "RR,RX,RXY")])
3596
3597 (define_insn "*addsi3_cconly2"
3598 [(set (reg 33)
3599 (compare (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
3600 (neg:SI (match_operand:SI 2 "general_operand" "d,R,T"))))
3601 (clobber (match_scratch:SI 0 "=d,d,d"))]
3602 "s390_match_ccmode (insn, CCLmode)"
3603 "@
3604 alr\t%0,%2
3605 al\t%0,%2
3606 aly\t%0,%2"
3607 [(set_attr "op_type" "RR,RX,RXY")])
3608
3609 (define_insn "*addsi3_sign"
3610 [(set (match_operand:SI 0 "register_operand" "=d,d")
3611 (plus:SI (match_operand:SI 1 "register_operand" "0,0")
3612 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
3613 (clobber (reg:CC 33))]
3614 ""
3615 "@
3616 ah\t%0,%2
3617 ahy\t%0,%2"
3618 [(set_attr "op_type" "RX,RXY")])
3619
3620 (define_insn "addsi3"
3621 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
3622 (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
3623 (match_operand:SI 2 "general_operand" "d,K,R,T")))
3624 (clobber (reg:CC 33))]
3625 ""
3626 "@
3627 ar\t%0,%2
3628 ahi\t%0,%h2
3629 a\t%0,%2
3630 ay\t%0,%2"
3631 [(set_attr "op_type" "RR,RI,RX,RXY")])
3632
3633 ;
3634 ; adddf3 instruction pattern(s).
3635 ;
3636
3637 (define_expand "adddf3"
3638 [(parallel
3639 [(set (match_operand:DF 0 "register_operand" "=f,f")
3640 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3641 (match_operand:DF 2 "general_operand" "f,R")))
3642 (clobber (reg:CC 33))])]
3643 "TARGET_HARD_FLOAT"
3644 "")
3645
3646 (define_insn "*adddf3"
3647 [(set (match_operand:DF 0 "register_operand" "=f,f")
3648 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3649 (match_operand:DF 2 "general_operand" "f,R")))
3650 (clobber (reg:CC 33))]
3651 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3652 "@
3653 adbr\t%0,%2
3654 adb\t%0,%2"
3655 [(set_attr "op_type" "RRE,RXE")
3656 (set_attr "type" "fsimpd,fsimpd")])
3657
3658 (define_insn "*adddf3_cc"
3659 [(set (reg 33)
3660 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3661 (match_operand:DF 2 "general_operand" "f,R"))
3662 (match_operand:DF 3 "const0_operand" "")))
3663 (set (match_operand:DF 0 "register_operand" "=f,f")
3664 (plus:DF (match_dup 1) (match_dup 2)))]
3665 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3666 "@
3667 adbr\t%0,%2
3668 adb\t%0,%2"
3669 [(set_attr "op_type" "RRE,RXE")
3670 (set_attr "type" "fsimpd,fsimpd")])
3671
3672 (define_insn "*adddf3_cconly"
3673 [(set (reg 33)
3674 (compare (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3675 (match_operand:DF 2 "general_operand" "f,R"))
3676 (match_operand:DF 3 "const0_operand" "")))
3677 (clobber (match_scratch:DF 0 "=f,f"))]
3678 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3679 "@
3680 adbr\t%0,%2
3681 adb\t%0,%2"
3682 [(set_attr "op_type" "RRE,RXE")
3683 (set_attr "type" "fsimpd,fsimpd")])
3684
3685 (define_insn "*adddf3_ibm"
3686 [(set (match_operand:DF 0 "register_operand" "=f,f")
3687 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
3688 (match_operand:DF 2 "general_operand" "f,R")))
3689 (clobber (reg:CC 33))]
3690 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3691 "@
3692 adr\t%0,%2
3693 ad\t%0,%2"
3694 [(set_attr "op_type" "RR,RX")
3695 (set_attr "type" "fsimpd,fsimpd")])
3696
3697 ;
3698 ; addsf3 instruction pattern(s).
3699 ;
3700
3701 (define_expand "addsf3"
3702 [(parallel
3703 [(set (match_operand:SF 0 "register_operand" "=f,f")
3704 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3705 (match_operand:SF 2 "general_operand" "f,R")))
3706 (clobber (reg:CC 33))])]
3707 "TARGET_HARD_FLOAT"
3708 "")
3709
3710 (define_insn "*addsf3"
3711 [(set (match_operand:SF 0 "register_operand" "=f,f")
3712 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3713 (match_operand:SF 2 "general_operand" "f,R")))
3714 (clobber (reg:CC 33))]
3715 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3716 "@
3717 aebr\t%0,%2
3718 aeb\t%0,%2"
3719 [(set_attr "op_type" "RRE,RXE")
3720 (set_attr "type" "fsimps,fsimps")])
3721
3722 (define_insn "*addsf3_cc"
3723 [(set (reg 33)
3724 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3725 (match_operand:SF 2 "general_operand" "f,R"))
3726 (match_operand:SF 3 "const0_operand" "")))
3727 (set (match_operand:SF 0 "register_operand" "=f,f")
3728 (plus:SF (match_dup 1) (match_dup 2)))]
3729 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3730 "@
3731 aebr\t%0,%2
3732 aeb\t%0,%2"
3733 [(set_attr "op_type" "RRE,RXE")
3734 (set_attr "type" "fsimps,fsimps")])
3735
3736 (define_insn "*addsf3_cconly"
3737 [(set (reg 33)
3738 (compare (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3739 (match_operand:SF 2 "general_operand" "f,R"))
3740 (match_operand:SF 3 "const0_operand" "")))
3741 (clobber (match_scratch:SF 0 "=f,f"))]
3742 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
3743 "@
3744 aebr\t%0,%2
3745 aeb\t%0,%2"
3746 [(set_attr "op_type" "RRE,RXE")
3747 (set_attr "type" "fsimps,fsimps")])
3748
3749 (define_insn "*addsf3"
3750 [(set (match_operand:SF 0 "register_operand" "=f,f")
3751 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
3752 (match_operand:SF 2 "general_operand" "f,R")))
3753 (clobber (reg:CC 33))]
3754 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
3755 "@
3756 aer\t%0,%2
3757 ae\t%0,%2"
3758 [(set_attr "op_type" "RR,RX")
3759 (set_attr "type" "fsimps,fsimps")])
3760
3761
3762 ;;
3763 ;;- Subtract instructions.
3764 ;;
3765
3766 ;
3767 ; subti3 instruction pattern(s).
3768 ;
3769
3770 (define_insn_and_split "subti3"
3771 [(set (match_operand:TI 0 "register_operand" "=&d")
3772 (minus:TI (match_operand:TI 1 "register_operand" "0")
3773 (match_operand:TI 2 "general_operand" "do") ) )
3774 (clobber (reg:CC 33))]
3775 "TARGET_64BIT"
3776 "#"
3777 "&& reload_completed"
3778 [(parallel
3779 [(set (reg:CCL2 33)
3780 (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8))
3781 (match_dup 7)))
3782 (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))])
3783 (parallel
3784 [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5))
3785 (gtu:DI (reg:CCL2 33) (const_int 0))))
3786 (clobber (reg:CC 33))])]
3787 "operands[3] = operand_subword (operands[0], 0, 0, TImode);
3788 operands[4] = operand_subword (operands[1], 0, 0, TImode);
3789 operands[5] = operand_subword (operands[2], 0, 0, TImode);
3790 operands[6] = operand_subword (operands[0], 1, 0, TImode);
3791 operands[7] = operand_subword (operands[1], 1, 0, TImode);
3792 operands[8] = operand_subword (operands[2], 1, 0, TImode);"
3793 [(set_attr "op_type" "NN")])
3794
3795 ;
3796 ; subdi3 instruction pattern(s).
3797 ;
3798
3799 (define_insn "*subdi3_sign"
3800 [(set (match_operand:DI 0 "register_operand" "=d,d")
3801 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3802 (sign_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3803 (clobber (reg:CC 33))]
3804 "TARGET_64BIT"
3805 "@
3806 sgfr\t%0,%2
3807 sgf\t%0,%2"
3808 [(set_attr "op_type" "RRE,RXY")])
3809
3810 (define_insn "*subdi3_zero_cc"
3811 [(set (reg 33)
3812 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3813 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3814 (const_int 0)))
3815 (set (match_operand:DI 0 "register_operand" "=d,d")
3816 (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))]
3817 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3818 "@
3819 slgfr\t%0,%2
3820 slgf\t%0,%2"
3821 [(set_attr "op_type" "RRE,RXY")])
3822
3823 (define_insn "*subdi3_zero_cconly"
3824 [(set (reg 33)
3825 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3826 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m")))
3827 (const_int 0)))
3828 (clobber (match_scratch:DI 0 "=d,d"))]
3829 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3830 "@
3831 slgfr\t%0,%2
3832 slgf\t%0,%2"
3833 [(set_attr "op_type" "RRE,RXY")])
3834
3835 (define_insn "*subdi3_zero"
3836 [(set (match_operand:DI 0 "register_operand" "=d,d")
3837 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3838 (zero_extend:DI (match_operand:SI 2 "general_operand" "d,m"))))
3839 (clobber (reg:CC 33))]
3840 "TARGET_64BIT"
3841 "@
3842 slgfr\t%0,%2
3843 slgf\t%0,%2"
3844 [(set_attr "op_type" "RRE,RXY")])
3845
3846 (define_insn "*subdi3_borrow_cc"
3847 [(set (reg 33)
3848 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3849 (match_operand:DI 2 "general_operand" "d,m"))
3850 (match_dup 1)))
3851 (set (match_operand:DI 0 "register_operand" "=d,d")
3852 (minus:DI (match_dup 1) (match_dup 2)))]
3853 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3854 "@
3855 slgr\t%0,%2
3856 slg\t%0,%2"
3857 [(set_attr "op_type" "RRE,RXY")])
3858
3859 (define_insn "*subdi3_borrow_cconly"
3860 [(set (reg 33)
3861 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3862 (match_operand:DI 2 "general_operand" "d,m"))
3863 (match_dup 1)))
3864 (clobber (match_scratch:DI 0 "=d,d"))]
3865 "s390_match_ccmode (insn, CCL2mode) && TARGET_64BIT"
3866 "@
3867 slgr\t%0,%2
3868 slg\t%0,%2"
3869 [(set_attr "op_type" "RRE,RXY")])
3870
3871 (define_insn "*subdi3_cc"
3872 [(set (reg 33)
3873 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3874 (match_operand:DI 2 "general_operand" "d,m"))
3875 (const_int 0)))
3876 (set (match_operand:DI 0 "register_operand" "=d,d")
3877 (minus:DI (match_dup 1) (match_dup 2)))]
3878 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3879 "@
3880 slgr\t%0,%2
3881 slg\t%0,%2"
3882 [(set_attr "op_type" "RRE,RXY")])
3883
3884 (define_insn "*subdi3_cc2"
3885 [(set (reg 33)
3886 (compare (match_operand:DI 1 "register_operand" "0,0")
3887 (match_operand:DI 2 "general_operand" "d,m")))
3888 (set (match_operand:DI 0 "register_operand" "=d,d")
3889 (minus:DI (match_dup 1) (match_dup 2)))]
3890 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3891 "@
3892 slgr\t%0,%2
3893 slg\t%0,%2"
3894 [(set_attr "op_type" "RRE,RXY")])
3895
3896 (define_insn "*subdi3_cconly"
3897 [(set (reg 33)
3898 (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3899 (match_operand:DI 2 "general_operand" "d,m"))
3900 (const_int 0)))
3901 (clobber (match_scratch:DI 0 "=d,d"))]
3902 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
3903 "@
3904 slgr\t%0,%2
3905 slg\t%0,%2"
3906 [(set_attr "op_type" "RRE,RXY")])
3907
3908 (define_insn "*subdi3_cconly2"
3909 [(set (reg 33)
3910 (compare (match_operand:DI 1 "register_operand" "0,0")
3911 (match_operand:DI 2 "general_operand" "d,m")))
3912 (clobber (match_scratch:DI 0 "=d,d"))]
3913 "s390_match_ccmode (insn, CCL3mode) && TARGET_64BIT"
3914 "@
3915 slgr\t%0,%2
3916 slg\t%0,%2"
3917 [(set_attr "op_type" "RRE,RXY")])
3918
3919 (define_insn "*subdi3_64"
3920 [(set (match_operand:DI 0 "register_operand" "=d,d")
3921 (minus:DI (match_operand:DI 1 "register_operand" "0,0")
3922 (match_operand:DI 2 "general_operand" "d,m") ) )
3923 (clobber (reg:CC 33))]
3924 "TARGET_64BIT"
3925 "@
3926 sgr\t%0,%2
3927 sg\t%0,%2"
3928 [(set_attr "op_type" "RRE,RRE")])
3929
3930 (define_insn_and_split "*subdi3_31z"
3931 [(set (match_operand:DI 0 "register_operand" "=&d")
3932 (minus:DI (match_operand:DI 1 "register_operand" "0")
3933 (match_operand:DI 2 "general_operand" "do") ) )
3934 (clobber (reg:CC 33))]
3935 "!TARGET_64BIT && TARGET_CPU_ZARCH"
3936 "#"
3937 "&& reload_completed"
3938 [(parallel
3939 [(set (reg:CCL2 33)
3940 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3941 (match_dup 7)))
3942 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3943 (parallel
3944 [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5))
3945 (gtu:SI (reg:CCL2 33) (const_int 0))))
3946 (clobber (reg:CC 33))])]
3947 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3948 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3949 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3950 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3951 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3952 operands[8] = operand_subword (operands[2], 1, 0, DImode);"
3953 [(set_attr "op_type" "NN")])
3954
3955 (define_insn_and_split "*subdi3_31"
3956 [(set (match_operand:DI 0 "register_operand" "=&d")
3957 (minus:DI (match_operand:DI 1 "register_operand" "0")
3958 (match_operand:DI 2 "general_operand" "do") ) )
3959 (clobber (reg:CC 33))]
3960 "!TARGET_CPU_ZARCH"
3961 "#"
3962 "&& reload_completed"
3963 [(parallel
3964 [(set (match_dup 3) (minus:SI (match_dup 4) (match_dup 5)))
3965 (clobber (reg:CC 33))])
3966 (parallel
3967 [(set (reg:CCL2 33)
3968 (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8))
3969 (match_dup 7)))
3970 (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))])
3971 (set (pc)
3972 (if_then_else (gtu (reg:CCL2 33) (const_int 0))
3973 (pc)
3974 (label_ref (match_dup 9))))
3975 (parallel
3976 [(set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))
3977 (clobber (reg:CC 33))])
3978 (match_dup 9)]
3979 "operands[3] = operand_subword (operands[0], 0, 0, DImode);
3980 operands[4] = operand_subword (operands[1], 0, 0, DImode);
3981 operands[5] = operand_subword (operands[2], 0, 0, DImode);
3982 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3983 operands[7] = operand_subword (operands[1], 1, 0, DImode);
3984 operands[8] = operand_subword (operands[2], 1, 0, DImode);
3985 operands[9] = gen_label_rtx ();"
3986 [(set_attr "op_type" "NN")])
3987
3988 (define_expand "subdi3"
3989 [(parallel
3990 [(set (match_operand:DI 0 "register_operand" "")
3991 (minus:DI (match_operand:DI 1 "register_operand" "")
3992 (match_operand:DI 2 "general_operand" "")))
3993 (clobber (reg:CC 33))])]
3994 ""
3995 "")
3996
3997 ;
3998 ; subsi3 instruction pattern(s).
3999 ;
4000
4001 (define_insn "*subsi3_borrow_cc"
4002 [(set (reg 33)
4003 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4004 (match_operand:SI 2 "general_operand" "d,R,T"))
4005 (match_dup 1)))
4006 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4007 (minus:SI (match_dup 1) (match_dup 2)))]
4008 "s390_match_ccmode (insn, CCL2mode)"
4009 "@
4010 slr\t%0,%2
4011 sl\t%0,%2
4012 sly\t%0,%2"
4013 [(set_attr "op_type" "RR,RX,RXY")])
4014
4015 (define_insn "*subsi3_borrow_cconly"
4016 [(set (reg 33)
4017 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4018 (match_operand:SI 2 "general_operand" "d,R,T"))
4019 (match_dup 1)))
4020 (clobber (match_scratch:SI 0 "=d,d,d"))]
4021 "s390_match_ccmode (insn, CCL2mode)"
4022 "@
4023 slr\t%0,%2
4024 sl\t%0,%2
4025 sly\t%0,%2"
4026 [(set_attr "op_type" "RR,RX,RXY")])
4027
4028 (define_insn "*subsi3_cc"
4029 [(set (reg 33)
4030 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4031 (match_operand:SI 2 "general_operand" "d,R,T"))
4032 (const_int 0)))
4033 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4034 (minus:SI (match_dup 1) (match_dup 2)))]
4035 "s390_match_ccmode (insn, CCLmode)"
4036 "@
4037 slr\t%0,%2
4038 sl\t%0,%2
4039 sly\t%0,%2"
4040 [(set_attr "op_type" "RR,RX,RXY")])
4041
4042 (define_insn "*subsi3_cc2"
4043 [(set (reg 33)
4044 (compare (match_operand:SI 1 "register_operand" "0,0,0")
4045 (match_operand:SI 2 "general_operand" "d,R,T")))
4046 (set (match_operand:SI 0 "register_operand" "=d,d,d")
4047 (minus:SI (match_dup 1) (match_dup 2)))]
4048 "s390_match_ccmode (insn, CCL3mode)"
4049 "@
4050 slr\t%0,%2
4051 sl\t%0,%2
4052 sly\t%0,%2"
4053 [(set_attr "op_type" "RR,RX,RXY")])
4054
4055 (define_insn "*subsi3_cconly"
4056 [(set (reg 33)
4057 (compare (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4058 (match_operand:SI 2 "general_operand" "d,R,T"))
4059 (const_int 0)))
4060 (clobber (match_scratch:SI 0 "=d,d,d"))]
4061 "s390_match_ccmode (insn, CCLmode)"
4062 "@
4063 slr\t%0,%2
4064 sl\t%0,%2
4065 sly\t%0,%2"
4066 [(set_attr "op_type" "RR,RX,RXY")])
4067
4068 (define_insn "*subsi3_cconly2"
4069 [(set (reg 33)
4070 (compare (match_operand:SI 1 "register_operand" "0,0,0")
4071 (match_operand:SI 2 "general_operand" "d,R,T")))
4072 (clobber (match_scratch:SI 0 "=d,d,d"))]
4073 "s390_match_ccmode (insn, CCL3mode)"
4074 "@
4075 slr\t%0,%2
4076 sl\t%0,%2
4077 sly\t%0,%2"
4078 [(set_attr "op_type" "RR,RX,RXY")])
4079
4080 (define_insn "*subsi3_sign"
4081 [(set (match_operand:SI 0 "register_operand" "=d,d")
4082 (minus:SI (match_operand:SI 1 "register_operand" "0,0")
4083 (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T"))))
4084 (clobber (reg:CC 33))]
4085 ""
4086 "@
4087 sh\t%0,%2
4088 shy\t%0,%2"
4089 [(set_attr "op_type" "RX,RXY")])
4090
4091 (define_insn "subsi3"
4092 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
4093 (minus:SI (match_operand:SI 1 "register_operand" "0,0,0")
4094 (match_operand:SI 2 "general_operand" "d,R,T")))
4095 (clobber (reg:CC 33))]
4096 ""
4097 "@
4098 sr\t%0,%2
4099 s\t%0,%2
4100 sy\t%0,%2"
4101 [(set_attr "op_type" "RR,RX,RXY")])
4102
4103
4104 ;
4105 ; subdf3 instruction pattern(s).
4106 ;
4107
4108 (define_expand "subdf3"
4109 [(parallel
4110 [(set (match_operand:DF 0 "register_operand" "=f,f")
4111 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4112 (match_operand:DF 2 "general_operand" "f,R")))
4113 (clobber (reg:CC 33))])]
4114 "TARGET_HARD_FLOAT"
4115 "")
4116
4117 (define_insn "*subdf3"
4118 [(set (match_operand:DF 0 "register_operand" "=f,f")
4119 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4120 (match_operand:DF 2 "general_operand" "f,R")))
4121 (clobber (reg:CC 33))]
4122 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4123 "@
4124 sdbr\t%0,%2
4125 sdb\t%0,%2"
4126 [(set_attr "op_type" "RRE,RXE")
4127 (set_attr "type" "fsimpd,fsimpd")])
4128
4129 (define_insn "*subdf3_cc"
4130 [(set (reg 33)
4131 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4132 (match_operand:DF 2 "general_operand" "f,R"))
4133 (match_operand:DF 3 "const0_operand" "")))
4134 (set (match_operand:DF 0 "register_operand" "=f,f")
4135 (plus:DF (match_dup 1) (match_dup 2)))]
4136 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4137 "@
4138 sdbr\t%0,%2
4139 sdb\t%0,%2"
4140 [(set_attr "op_type" "RRE,RXE")
4141 (set_attr "type" "fsimpd,fsimpd")])
4142
4143 (define_insn "*subdf3_cconly"
4144 [(set (reg 33)
4145 (compare (minus:DF (match_operand:DF 1 "nonimmediate_operand" "0,0")
4146 (match_operand:DF 2 "general_operand" "f,R"))
4147 (match_operand:DF 3 "const0_operand" "")))
4148 (clobber (match_scratch:DF 0 "=f,f"))]
4149 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4150 "@
4151 sdbr\t%0,%2
4152 sdb\t%0,%2"
4153 [(set_attr "op_type" "RRE,RXE")
4154 (set_attr "type" "fsimpd,fsimpd")])
4155
4156 (define_insn "*subdf3_ibm"
4157 [(set (match_operand:DF 0 "register_operand" "=f,f")
4158 (minus:DF (match_operand:DF 1 "register_operand" "0,0")
4159 (match_operand:DF 2 "general_operand" "f,R")))
4160 (clobber (reg:CC 33))]
4161 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4162 "@
4163 sdr\t%0,%2
4164 sd\t%0,%2"
4165 [(set_attr "op_type" "RR,RX")
4166 (set_attr "type" "fsimpd,fsimpd")])
4167
4168 ;
4169 ; subsf3 instruction pattern(s).
4170 ;
4171
4172 (define_expand "subsf3"
4173 [(parallel
4174 [(set (match_operand:SF 0 "register_operand" "=f,f")
4175 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4176 (match_operand:SF 2 "general_operand" "f,R")))
4177 (clobber (reg:CC 33))])]
4178 "TARGET_HARD_FLOAT"
4179 "")
4180
4181 (define_insn "*subsf3"
4182 [(set (match_operand:SF 0 "register_operand" "=f,f")
4183 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4184 (match_operand:SF 2 "general_operand" "f,R")))
4185 (clobber (reg:CC 33))]
4186 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4187 "@
4188 sebr\t%0,%2
4189 seb\t%0,%2"
4190 [(set_attr "op_type" "RRE,RXE")
4191 (set_attr "type" "fsimps,fsimps")])
4192
4193 (define_insn "*subsf3_cc"
4194 [(set (reg 33)
4195 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4196 (match_operand:SF 2 "general_operand" "f,R"))
4197 (match_operand:SF 3 "const0_operand" "")))
4198 (set (match_operand:SF 0 "register_operand" "=f,f")
4199 (minus:SF (match_dup 1) (match_dup 2)))]
4200 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4201 "@
4202 sebr\t%0,%2
4203 seb\t%0,%2"
4204 [(set_attr "op_type" "RRE,RXE")
4205 (set_attr "type" "fsimps,fsimps")])
4206
4207 (define_insn "*subsf3_cconly"
4208 [(set (reg 33)
4209 (compare (minus:SF (match_operand:SF 1 "nonimmediate_operand" "0,0")
4210 (match_operand:SF 2 "general_operand" "f,R"))
4211 (match_operand:SF 3 "const0_operand" "")))
4212 (clobber (match_scratch:SF 0 "=f,f"))]
4213 "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4214 "@
4215 sebr\t%0,%2
4216 seb\t%0,%2"
4217 [(set_attr "op_type" "RRE,RXE")
4218 (set_attr "type" "fsimps,fsimps")])
4219
4220 (define_insn "*subsf3_ibm"
4221 [(set (match_operand:SF 0 "register_operand" "=f,f")
4222 (minus:SF (match_operand:SF 1 "register_operand" "0,0")
4223 (match_operand:SF 2 "general_operand" "f,R")))
4224 (clobber (reg:CC 33))]
4225 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4226 "@
4227 ser\t%0,%2
4228 se\t%0,%2"
4229 [(set_attr "op_type" "RR,RX")
4230 (set_attr "type" "fsimps,fsimps")])
4231
4232
4233 ;;
4234 ;;- Conditional add/subtract instructions.
4235 ;;
4236
4237 ;
4238 ; adddicc instruction pattern(s).
4239 ;
4240
4241 (define_insn "*adddi3_alc_cc"
4242 [(set (reg 33)
4243 (compare
4244 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4245 (match_operand:DI 2 "general_operand" "d,m"))
4246 (match_operand:DI 3 "s390_alc_comparison" ""))
4247 (const_int 0)))
4248 (set (match_operand:DI 0 "register_operand" "=d,d")
4249 (plus:DI (plus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4250 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4251 "@
4252 alcgr\\t%0,%2
4253 alcg\\t%0,%2"
4254 [(set_attr "op_type" "RRE,RXY")])
4255
4256 (define_insn "*adddi3_alc"
4257 [(set (match_operand:DI 0 "register_operand" "=d,d")
4258 (plus:DI (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
4259 (match_operand:DI 2 "general_operand" "d,m"))
4260 (match_operand:DI 3 "s390_alc_comparison" "")))
4261 (clobber (reg:CC 33))]
4262 "TARGET_64BIT"
4263 "@
4264 alcgr\\t%0,%2
4265 alcg\\t%0,%2"
4266 [(set_attr "op_type" "RRE,RXY")])
4267
4268 (define_insn "*subdi3_slb_cc"
4269 [(set (reg 33)
4270 (compare
4271 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4272 (match_operand:DI 2 "general_operand" "d,m"))
4273 (match_operand:DI 3 "s390_slb_comparison" ""))
4274 (const_int 0)))
4275 (set (match_operand:DI 0 "register_operand" "=d,d")
4276 (minus:DI (minus:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4277 "s390_match_ccmode (insn, CCLmode) && TARGET_64BIT"
4278 "@
4279 slbgr\\t%0,%2
4280 slbg\\t%0,%2"
4281 [(set_attr "op_type" "RRE,RXY")])
4282
4283 (define_insn "*subdi3_slb"
4284 [(set (match_operand:DI 0 "register_operand" "=d,d")
4285 (minus:DI (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
4286 (match_operand:DI 2 "general_operand" "d,m"))
4287 (match_operand:DI 3 "s390_slb_comparison" "")))
4288 (clobber (reg:CC 33))]
4289 "TARGET_64BIT"
4290 "@
4291 slbgr\\t%0,%2
4292 slbg\\t%0,%2"
4293 [(set_attr "op_type" "RRE,RXY")])
4294
4295 (define_expand "adddicc"
4296 [(match_operand:DI 0 "register_operand" "")
4297 (match_operand 1 "comparison_operator" "")
4298 (match_operand:DI 2 "register_operand" "")
4299 (match_operand:DI 3 "const_int_operand" "")]
4300 "TARGET_64BIT"
4301 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4302 s390_compare_op0, s390_compare_op1,
4303 operands[0], operands[2],
4304 operands[3])) FAIL; DONE;")
4305
4306 ;
4307 ; addsicc instruction pattern(s).
4308 ;
4309
4310 (define_insn "*addsi3_alc_cc"
4311 [(set (reg 33)
4312 (compare
4313 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4314 (match_operand:SI 2 "general_operand" "d,m"))
4315 (match_operand:SI 3 "s390_alc_comparison" ""))
4316 (const_int 0)))
4317 (set (match_operand:SI 0 "register_operand" "=d,d")
4318 (plus:SI (plus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4319 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4320 "@
4321 alcr\\t%0,%2
4322 alc\\t%0,%2"
4323 [(set_attr "op_type" "RRE,RXY")])
4324
4325 (define_insn "*addsi3_alc"
4326 [(set (match_operand:SI 0 "register_operand" "=d,d")
4327 (plus:SI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
4328 (match_operand:SI 2 "general_operand" "d,m"))
4329 (match_operand:SI 3 "s390_alc_comparison" "")))
4330 (clobber (reg:CC 33))]
4331 "TARGET_CPU_ZARCH"
4332 "@
4333 alcr\\t%0,%2
4334 alc\\t%0,%2"
4335 [(set_attr "op_type" "RRE,RXY")])
4336
4337 (define_insn "*subsi3_slb_cc"
4338 [(set (reg 33)
4339 (compare
4340 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4341 (match_operand:SI 2 "general_operand" "d,m"))
4342 (match_operand:SI 3 "s390_slb_comparison" ""))
4343 (const_int 0)))
4344 (set (match_operand:SI 0 "register_operand" "=d,d")
4345 (minus:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4346 "s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
4347 "@
4348 slbr\\t%0,%2
4349 slb\\t%0,%2"
4350 [(set_attr "op_type" "RRE,RXY")])
4351
4352 (define_insn "*subsi3_slb"
4353 [(set (match_operand:SI 0 "register_operand" "=d,d")
4354 (minus:SI (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
4355 (match_operand:SI 2 "general_operand" "d,m"))
4356 (match_operand:SI 3 "s390_slb_comparison" "")))
4357 (clobber (reg:CC 33))]
4358 "TARGET_CPU_ZARCH"
4359 "@
4360 slbr\\t%0,%2
4361 slb\\t%0,%2"
4362 [(set_attr "op_type" "RRE,RXY")])
4363
4364 (define_expand "addsicc"
4365 [(match_operand:SI 0 "register_operand" "")
4366 (match_operand 1 "comparison_operator" "")
4367 (match_operand:SI 2 "register_operand" "")
4368 (match_operand:SI 3 "const_int_operand" "")]
4369 "TARGET_CPU_ZARCH"
4370 "if (!s390_expand_addcc (GET_CODE (operands[1]),
4371 s390_compare_op0, s390_compare_op1,
4372 operands[0], operands[2],
4373 operands[3])) FAIL; DONE;")
4374
4375 ;
4376 ; scond instruction pattern(s).
4377 ;
4378
4379 (define_insn_and_split "*sconddi"
4380 [(set (match_operand:DI 0 "register_operand" "=&d")
4381 (match_operand:DI 1 "s390_alc_comparison" ""))
4382 (clobber (reg:CC 33))]
4383 "TARGET_64BIT"
4384 "#"
4385 "&& reload_completed"
4386 [(set (match_dup 0) (const_int 0))
4387 (parallel
4388 [(set (match_dup 0) (plus:DI (plus:DI (match_dup 0) (match_dup 0))
4389 (match_dup 1)))
4390 (clobber (reg:CC 33))])]
4391 ""
4392 [(set_attr "op_type" "NN")])
4393
4394 (define_insn_and_split "*scondsi"
4395 [(set (match_operand:SI 0 "register_operand" "=&d")
4396 (match_operand:SI 1 "s390_alc_comparison" ""))
4397 (clobber (reg:CC 33))]
4398 "TARGET_CPU_ZARCH"
4399 "#"
4400 "&& reload_completed"
4401 [(set (match_dup 0) (const_int 0))
4402 (parallel
4403 [(set (match_dup 0) (plus:SI (plus:SI (match_dup 0) (match_dup 0))
4404 (match_dup 1)))
4405 (clobber (reg:CC 33))])]
4406 ""
4407 [(set_attr "op_type" "NN")])
4408
4409 (define_insn_and_split "*sconddi_neg"
4410 [(set (match_operand:DI 0 "register_operand" "=&d")
4411 (match_operand:DI 1 "s390_slb_comparison" ""))
4412 (clobber (reg:CC 33))]
4413 "TARGET_64BIT"
4414 "#"
4415 "&& reload_completed"
4416 [(set (match_dup 0) (const_int 0))
4417 (parallel
4418 [(set (match_dup 0) (minus:DI (minus:DI (match_dup 0) (match_dup 0))
4419 (match_dup 1)))
4420 (clobber (reg:CC 33))])
4421 (parallel
4422 [(set (match_dup 0) (neg:DI (match_dup 0)))
4423 (clobber (reg:CC 33))])]
4424 ""
4425 [(set_attr "op_type" "NN")])
4426
4427 (define_insn_and_split "*scondsi_neg"
4428 [(set (match_operand:SI 0 "register_operand" "=&d")
4429 (match_operand:SI 1 "s390_slb_comparison" ""))
4430 (clobber (reg:CC 33))]
4431 "TARGET_CPU_ZARCH"
4432 "#"
4433 "&& reload_completed"
4434 [(set (match_dup 0) (const_int 0))
4435 (parallel
4436 [(set (match_dup 0) (minus:SI (minus:SI (match_dup 0) (match_dup 0))
4437 (match_dup 1)))
4438 (clobber (reg:CC 33))])
4439 (parallel
4440 [(set (match_dup 0) (neg:SI (match_dup 0)))
4441 (clobber (reg:CC 33))])]
4442 ""
4443 [(set_attr "op_type" "NN")])
4444
4445 (define_expand "sltu"
4446 [(match_operand:SI 0 "register_operand" "")]
4447 "TARGET_CPU_ZARCH"
4448 "if (!s390_expand_addcc (LTU, s390_compare_op0, s390_compare_op1,
4449 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4450
4451 (define_expand "sgtu"
4452 [(match_operand:SI 0 "register_operand" "")]
4453 "TARGET_CPU_ZARCH"
4454 "if (!s390_expand_addcc (GTU, s390_compare_op0, s390_compare_op1,
4455 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4456
4457 (define_expand "sleu"
4458 [(match_operand:SI 0 "register_operand" "")]
4459 "TARGET_CPU_ZARCH"
4460 "if (!s390_expand_addcc (LEU, s390_compare_op0, s390_compare_op1,
4461 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4462
4463 (define_expand "sgeu"
4464 [(match_operand:SI 0 "register_operand" "")]
4465 "TARGET_CPU_ZARCH"
4466 "if (!s390_expand_addcc (GEU, s390_compare_op0, s390_compare_op1,
4467 operands[0], const0_rtx, const1_rtx)) FAIL; DONE;")
4468
4469
4470 ;;
4471 ;;- Multiply instructions.
4472 ;;
4473
4474 ;
4475 ; muldi3 instruction pattern(s).
4476 ;
4477
4478 (define_insn "*muldi3_sign"
4479 [(set (match_operand:DI 0 "register_operand" "=d,d")
4480 (mult:DI (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "d,m"))
4481 (match_operand:DI 1 "register_operand" "0,0")))]
4482 "TARGET_64BIT"
4483 "@
4484 msgfr\t%0,%2
4485 msgf\t%0,%2"
4486 [(set_attr "op_type" "RRE,RXY")
4487 (set_attr "type" "imul")])
4488
4489 (define_insn "muldi3"
4490 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
4491 (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
4492 (match_operand:DI 2 "general_operand" "d,K,m")))]
4493 "TARGET_64BIT"
4494 "@
4495 msgr\t%0,%2
4496 mghi\t%0,%h2
4497 msg\t%0,%2"
4498 [(set_attr "op_type" "RRE,RI,RXY")
4499 (set_attr "type" "imul")])
4500
4501 ;
4502 ; mulsi3 instruction pattern(s).
4503 ;
4504
4505 (define_insn "*mulsi3_sign"
4506 [(set (match_operand:SI 0 "register_operand" "=d")
4507 (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R"))
4508 (match_operand:SI 1 "register_operand" "0")))]
4509 ""
4510 "mh\t%0,%2"
4511 [(set_attr "op_type" "RX")
4512 (set_attr "type" "imul")])
4513
4514 (define_insn "mulsi3"
4515 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
4516 (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0")
4517 (match_operand:SI 2 "general_operand" "d,K,R,T")))]
4518 ""
4519 "@
4520 msr\t%0,%2
4521 mhi\t%0,%h2
4522 ms\t%0,%2
4523 msy\t%0,%2"
4524 [(set_attr "op_type" "RRE,RI,RX,RXY")
4525 (set_attr "type" "imul")])
4526
4527 ;
4528 ; mulsidi3 instruction pattern(s).
4529 ;
4530
4531 (define_insn "mulsidi3"
4532 [(set (match_operand:DI 0 "register_operand" "=d,d")
4533 (mult:DI (sign_extend:DI
4534 (match_operand:SI 1 "register_operand" "%0,0"))
4535 (sign_extend:DI
4536 (match_operand:SI 2 "nonimmediate_operand" "d,R"))))]
4537 "!TARGET_64BIT"
4538 "@
4539 mr\t%0,%2
4540 m\t%0,%2"
4541 [(set_attr "op_type" "RR,RX")
4542 (set_attr "type" "imul")])
4543
4544 ;
4545 ; umulsidi3 instruction pattern(s).
4546 ;
4547
4548 (define_insn "umulsidi3"
4549 [(set (match_operand:DI 0 "register_operand" "=d,d")
4550 (mult:DI (zero_extend:DI
4551 (match_operand:SI 1 "register_operand" "%0,0"))
4552 (zero_extend:DI
4553 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))]
4554 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4555 "@
4556 mlr\t%0,%2
4557 ml\t%0,%2"
4558 [(set_attr "op_type" "RRE,RXY")
4559 (set_attr "type" "imul")])
4560
4561 ;
4562 ; muldf3 instruction pattern(s).
4563 ;
4564
4565 (define_expand "muldf3"
4566 [(set (match_operand:DF 0 "register_operand" "=f,f")
4567 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4568 (match_operand:DF 2 "general_operand" "f,R")))]
4569 "TARGET_HARD_FLOAT"
4570 "")
4571
4572 (define_insn "*muldf3"
4573 [(set (match_operand:DF 0 "register_operand" "=f,f")
4574 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4575 (match_operand:DF 2 "general_operand" "f,R")))]
4576 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4577 "@
4578 mdbr\t%0,%2
4579 mdb\t%0,%2"
4580 [(set_attr "op_type" "RRE,RXE")
4581 (set_attr "type" "fmuld")])
4582
4583 (define_insn "*muldf3_ibm"
4584 [(set (match_operand:DF 0 "register_operand" "=f,f")
4585 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%0,0")
4586 (match_operand:DF 2 "general_operand" "f,R")))]
4587 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4588 "@
4589 mdr\t%0,%2
4590 md\t%0,%2"
4591 [(set_attr "op_type" "RR,RX")
4592 (set_attr "type" "fmuld")])
4593
4594 (define_insn "*fmadddf"
4595 [(set (match_operand:DF 0 "register_operand" "=f,f")
4596 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%f,f")
4597 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4598 (match_operand:DF 3 "register_operand" "0,0")))]
4599 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4600 "@
4601 madbr\t%0,%1,%2
4602 madb\t%0,%1,%2"
4603 [(set_attr "op_type" "RRE,RXE")
4604 (set_attr "type" "fmuld")])
4605
4606 (define_insn "*fmsubdf"
4607 [(set (match_operand:DF 0 "register_operand" "=f,f")
4608 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f,f")
4609 (match_operand:DF 2 "nonimmediate_operand" "f,R"))
4610 (match_operand:DF 3 "register_operand" "0,0")))]
4611 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4612 "@
4613 msdbr\t%0,%1,%2
4614 msdb\t%0,%1,%2"
4615 [(set_attr "op_type" "RRE,RXE")
4616 (set_attr "type" "fmuld")])
4617
4618 ;
4619 ; mulsf3 instruction pattern(s).
4620 ;
4621
4622 (define_expand "mulsf3"
4623 [(set (match_operand:SF 0 "register_operand" "=f,f")
4624 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4625 (match_operand:SF 2 "general_operand" "f,R")))]
4626 "TARGET_HARD_FLOAT"
4627 "")
4628
4629 (define_insn "*mulsf3"
4630 [(set (match_operand:SF 0 "register_operand" "=f,f")
4631 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4632 (match_operand:SF 2 "general_operand" "f,R")))]
4633 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
4634 "@
4635 meebr\t%0,%2
4636 meeb\t%0,%2"
4637 [(set_attr "op_type" "RRE,RXE")
4638 (set_attr "type" "fmuls")])
4639
4640 (define_insn "*mulsf3_ibm"
4641 [(set (match_operand:SF 0 "register_operand" "=f,f")
4642 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%0,0")
4643 (match_operand:SF 2 "general_operand" "f,R")))]
4644 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
4645 "@
4646 mer\t%0,%2
4647 me\t%0,%2"
4648 [(set_attr "op_type" "RR,RX")
4649 (set_attr "type" "fmuls")])
4650
4651 (define_insn "*fmaddsf"
4652 [(set (match_operand:SF 0 "register_operand" "=f,f")
4653 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f,f")
4654 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4655 (match_operand:SF 3 "register_operand" "0,0")))]
4656 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4657 "@
4658 maebr\t%0,%1,%2
4659 maeb\t%0,%1,%2"
4660 [(set_attr "op_type" "RRE,RXE")
4661 (set_attr "type" "fmuls")])
4662
4663 (define_insn "*fmsubsf"
4664 [(set (match_operand:SF 0 "register_operand" "=f,f")
4665 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f,f")
4666 (match_operand:SF 2 "nonimmediate_operand" "f,R"))
4667 (match_operand:SF 3 "register_operand" "0,0")))]
4668 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT && TARGET_FUSED_MADD"
4669 "@
4670 msebr\t%0,%1,%2
4671 mseb\t%0,%1,%2"
4672 [(set_attr "op_type" "RRE,RXE")
4673 (set_attr "type" "fmuls")])
4674
4675 ;;
4676 ;;- Divide and modulo instructions.
4677 ;;
4678
4679 ;
4680 ; divmoddi4 instruction pattern(s).
4681 ;
4682
4683 (define_expand "divmoddi4"
4684 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4685 (div:DI (match_operand:DI 1 "register_operand" "")
4686 (match_operand:DI 2 "general_operand" "")))
4687 (set (match_operand:DI 3 "general_operand" "")
4688 (mod:DI (match_dup 1) (match_dup 2)))])
4689 (clobber (match_dup 4))]
4690 "TARGET_64BIT"
4691 {
4692 rtx insn, div_equal, mod_equal;
4693
4694 div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]);
4695 mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]);
4696
4697 operands[4] = gen_reg_rtx(TImode);
4698 emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2]));
4699
4700 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4701 REG_NOTES (insn) =
4702 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4703
4704 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4705 REG_NOTES (insn) =
4706 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4707
4708 DONE;
4709 })
4710
4711 (define_insn "divmodtidi3"
4712 [(set (match_operand:TI 0 "register_operand" "=d,d")
4713 (ior:TI
4714 (ashift:TI
4715 (zero_extend:TI
4716 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4717 (match_operand:DI 2 "general_operand" "d,m")))
4718 (const_int 64))
4719 (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))]
4720 "TARGET_64BIT"
4721 "@
4722 dsgr\t%0,%2
4723 dsg\t%0,%2"
4724 [(set_attr "op_type" "RRE,RXY")
4725 (set_attr "type" "idiv")])
4726
4727 (define_insn "divmodtisi3"
4728 [(set (match_operand:TI 0 "register_operand" "=d,d")
4729 (ior:TI
4730 (ashift:TI
4731 (zero_extend:TI
4732 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4733 (sign_extend:DI
4734 (match_operand:SI 2 "nonimmediate_operand" "d,m"))))
4735 (const_int 64))
4736 (zero_extend:TI
4737 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))]
4738 "TARGET_64BIT"
4739 "@
4740 dsgfr\t%0,%2
4741 dsgf\t%0,%2"
4742 [(set_attr "op_type" "RRE,RXY")
4743 (set_attr "type" "idiv")])
4744
4745 ;
4746 ; udivmoddi4 instruction pattern(s).
4747 ;
4748
4749 (define_expand "udivmoddi4"
4750 [(parallel [(set (match_operand:DI 0 "general_operand" "")
4751 (udiv:DI (match_operand:DI 1 "general_operand" "")
4752 (match_operand:DI 2 "nonimmediate_operand" "")))
4753 (set (match_operand:DI 3 "general_operand" "")
4754 (umod:DI (match_dup 1) (match_dup 2)))])
4755 (clobber (match_dup 4))]
4756 "TARGET_64BIT"
4757 {
4758 rtx insn, div_equal, mod_equal, equal;
4759
4760 div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]);
4761 mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]);
4762 equal = gen_rtx_IOR (TImode,
4763 gen_rtx_ASHIFT (TImode,
4764 gen_rtx_ZERO_EXTEND (TImode, mod_equal),
4765 GEN_INT (64)),
4766 gen_rtx_ZERO_EXTEND (TImode, div_equal));
4767
4768 operands[4] = gen_reg_rtx(TImode);
4769 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4770 emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
4771 emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
4772 insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2]));
4773 REG_NOTES (insn) =
4774 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4775
4776 insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4]));
4777 REG_NOTES (insn) =
4778 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4779
4780 insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4]));
4781 REG_NOTES (insn) =
4782 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4783
4784 DONE;
4785 })
4786
4787 (define_insn "udivmodtidi3"
4788 [(set (match_operand:TI 0 "register_operand" "=d,d")
4789 (ior:TI
4790 (ashift:TI
4791 (zero_extend:TI
4792 (truncate:DI
4793 (umod:TI (match_operand:TI 1 "register_operand" "0,0")
4794 (zero_extend:TI
4795 (match_operand:DI 2 "nonimmediate_operand" "d,m")))))
4796 (const_int 64))
4797 (zero_extend:TI
4798 (truncate:DI
4799 (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))]
4800 "TARGET_64BIT"
4801 "@
4802 dlgr\t%0,%2
4803 dlg\t%0,%2"
4804 [(set_attr "op_type" "RRE,RXY")
4805 (set_attr "type" "idiv")])
4806
4807 ;
4808 ; divmodsi4 instruction pattern(s).
4809 ;
4810
4811 (define_expand "divmodsi4"
4812 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4813 (div:SI (match_operand:SI 1 "general_operand" "")
4814 (match_operand:SI 2 "nonimmediate_operand" "")))
4815 (set (match_operand:SI 3 "general_operand" "")
4816 (mod:SI (match_dup 1) (match_dup 2)))])
4817 (clobber (match_dup 4))]
4818 "!TARGET_64BIT"
4819 {
4820 rtx insn, div_equal, mod_equal, equal;
4821
4822 div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]);
4823 mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]);
4824 equal = gen_rtx_IOR (DImode,
4825 gen_rtx_ASHIFT (DImode,
4826 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4827 GEN_INT (32)),
4828 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4829
4830 operands[4] = gen_reg_rtx(DImode);
4831 emit_insn (gen_extendsidi2 (operands[4], operands[1]));
4832 insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2]));
4833 REG_NOTES (insn) =
4834 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4835
4836 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4837 REG_NOTES (insn) =
4838 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4839
4840 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4841 REG_NOTES (insn) =
4842 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4843
4844 DONE;
4845 })
4846
4847 (define_insn "divmoddisi3"
4848 [(set (match_operand:DI 0 "register_operand" "=d,d")
4849 (ior:DI
4850 (ashift:DI
4851 (zero_extend:DI
4852 (truncate:SI
4853 (mod:DI (match_operand:DI 1 "register_operand" "0,0")
4854 (sign_extend:DI
4855 (match_operand:SI 2 "nonimmediate_operand" "d,R")))))
4856 (const_int 32))
4857 (zero_extend:DI
4858 (truncate:SI
4859 (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))]
4860 "!TARGET_64BIT"
4861 "@
4862 dr\t%0,%2
4863 d\t%0,%2"
4864 [(set_attr "op_type" "RR,RX")
4865 (set_attr "type" "idiv")])
4866
4867 ;
4868 ; udivsi3 and umodsi3 instruction pattern(s).
4869 ;
4870
4871 (define_expand "udivmodsi4"
4872 [(parallel [(set (match_operand:SI 0 "general_operand" "")
4873 (udiv:SI (match_operand:SI 1 "general_operand" "")
4874 (match_operand:SI 2 "nonimmediate_operand" "")))
4875 (set (match_operand:SI 3 "general_operand" "")
4876 (umod:SI (match_dup 1) (match_dup 2)))])
4877 (clobber (match_dup 4))]
4878 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4879 {
4880 rtx insn, div_equal, mod_equal, equal;
4881
4882 div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4883 mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4884 equal = gen_rtx_IOR (DImode,
4885 gen_rtx_ASHIFT (DImode,
4886 gen_rtx_ZERO_EXTEND (DImode, mod_equal),
4887 GEN_INT (32)),
4888 gen_rtx_ZERO_EXTEND (DImode, div_equal));
4889
4890 operands[4] = gen_reg_rtx(DImode);
4891 emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
4892 emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]);
4893 emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx);
4894 insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2]));
4895 REG_NOTES (insn) =
4896 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4897
4898 insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4]));
4899 REG_NOTES (insn) =
4900 gen_rtx_EXPR_LIST (REG_EQUAL, div_equal, REG_NOTES (insn));
4901
4902 insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4]));
4903 REG_NOTES (insn) =
4904 gen_rtx_EXPR_LIST (REG_EQUAL, mod_equal, REG_NOTES (insn));
4905
4906 DONE;
4907 })
4908
4909 (define_insn "udivmoddisi3"
4910 [(set (match_operand:DI 0 "register_operand" "=d,d")
4911 (ior:DI
4912 (ashift:DI
4913 (zero_extend:DI
4914 (truncate:SI
4915 (umod:DI (match_operand:DI 1 "register_operand" "0,0")
4916 (zero_extend:DI
4917 (match_operand:SI 2 "nonimmediate_operand" "d,m")))))
4918 (const_int 32))
4919 (zero_extend:DI
4920 (truncate:SI
4921 (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))]
4922 "!TARGET_64BIT && TARGET_CPU_ZARCH"
4923 "@
4924 dlr\t%0,%2
4925 dl\t%0,%2"
4926 [(set_attr "op_type" "RRE,RXY")
4927 (set_attr "type" "idiv")])
4928
4929 (define_expand "udivsi3"
4930 [(set (match_operand:SI 0 "register_operand" "=d")
4931 (udiv:SI (match_operand:SI 1 "general_operand" "")
4932 (match_operand:SI 2 "general_operand" "")))
4933 (clobber (match_dup 3))]
4934 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
4935 {
4936 rtx insn, udiv_equal, umod_equal, equal;
4937
4938 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
4939 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
4940 equal = gen_rtx_IOR (DImode,
4941 gen_rtx_ASHIFT (DImode,
4942 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
4943 GEN_INT (32)),
4944 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
4945
4946 operands[3] = gen_reg_rtx (DImode);
4947
4948 if (CONSTANT_P (operands[2]))
4949 {
4950 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4951 {
4952 rtx label1 = gen_label_rtx ();
4953
4954 operands[1] = make_safe_from (operands[1], operands[0]);
4955 emit_move_insn (operands[0], const0_rtx);
4956 emit_insn (gen_cmpsi (operands[1], operands[2]));
4957 emit_jump_insn (gen_bltu (label1));
4958 emit_move_insn (operands[0], const1_rtx);
4959 emit_label (label1);
4960 }
4961 else
4962 {
4963 operands[2] = force_reg (SImode, operands[2]);
4964 operands[2] = make_safe_from (operands[2], operands[0]);
4965
4966 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4967 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4968 operands[2]));
4969 REG_NOTES (insn) =
4970 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
4971
4972 insn = emit_move_insn (operands[0],
4973 gen_lowpart (SImode, operands[3]));
4974 REG_NOTES (insn) =
4975 gen_rtx_EXPR_LIST (REG_EQUAL,
4976 udiv_equal, REG_NOTES (insn));
4977 }
4978 }
4979 else
4980 {
4981 rtx label1 = gen_label_rtx ();
4982 rtx label2 = gen_label_rtx ();
4983 rtx label3 = gen_label_rtx ();
4984
4985 operands[1] = force_reg (SImode, operands[1]);
4986 operands[1] = make_safe_from (operands[1], operands[0]);
4987 operands[2] = force_reg (SImode, operands[2]);
4988 operands[2] = make_safe_from (operands[2], operands[0]);
4989
4990 emit_move_insn (operands[0], const0_rtx);
4991 emit_insn (gen_cmpsi (operands[2], operands[1]));
4992 emit_jump_insn (gen_bgtu (label3));
4993 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4994 emit_jump_insn (gen_blt (label2));
4995 emit_insn (gen_cmpsi (operands[2], const1_rtx));
4996 emit_jump_insn (gen_beq (label1));
4997 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
4998 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
4999 operands[2]));
5000 REG_NOTES (insn) =
5001 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5002
5003 insn = emit_move_insn (operands[0],
5004 gen_lowpart (SImode, operands[3]));
5005 REG_NOTES (insn) =
5006 gen_rtx_EXPR_LIST (REG_EQUAL,
5007 udiv_equal, REG_NOTES (insn));
5008 emit_jump (label3);
5009 emit_label (label1);
5010 emit_move_insn (operands[0], operands[1]);
5011 emit_jump (label3);
5012 emit_label (label2);
5013 emit_move_insn (operands[0], const1_rtx);
5014 emit_label (label3);
5015 }
5016 emit_move_insn (operands[0], operands[0]);
5017 DONE;
5018 })
5019
5020 (define_expand "umodsi3"
5021 [(set (match_operand:SI 0 "register_operand" "=d")
5022 (umod:SI (match_operand:SI 1 "nonimmediate_operand" "")
5023 (match_operand:SI 2 "nonimmediate_operand" "")))
5024 (clobber (match_dup 3))]
5025 "!TARGET_64BIT && !TARGET_CPU_ZARCH"
5026 {
5027 rtx insn, udiv_equal, umod_equal, equal;
5028
5029 udiv_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]);
5030 umod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]);
5031 equal = gen_rtx_IOR (DImode,
5032 gen_rtx_ASHIFT (DImode,
5033 gen_rtx_ZERO_EXTEND (DImode, umod_equal),
5034 GEN_INT (32)),
5035 gen_rtx_ZERO_EXTEND (DImode, udiv_equal));
5036
5037 operands[3] = gen_reg_rtx (DImode);
5038
5039 if (CONSTANT_P (operands[2]))
5040 {
5041 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) <= 0)
5042 {
5043 rtx label1 = gen_label_rtx ();
5044
5045 operands[1] = make_safe_from (operands[1], operands[0]);
5046 emit_move_insn (operands[0], operands[1]);
5047 emit_insn (gen_cmpsi (operands[0], operands[2]));
5048 emit_jump_insn (gen_bltu (label1));
5049 emit_insn (gen_abssi2 (operands[0], operands[2]));
5050 emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
5051 emit_label (label1);
5052 }
5053 else
5054 {
5055 operands[2] = force_reg (SImode, operands[2]);
5056 operands[2] = make_safe_from (operands[2], operands[0]);
5057
5058 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5059 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5060 operands[2]));
5061 REG_NOTES (insn) =
5062 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5063
5064 insn = emit_move_insn (operands[0],
5065 gen_highpart (SImode, operands[3]));
5066 REG_NOTES (insn) =
5067 gen_rtx_EXPR_LIST (REG_EQUAL,
5068 umod_equal, REG_NOTES (insn));
5069 }
5070 }
5071 else
5072 {
5073 rtx label1 = gen_label_rtx ();
5074 rtx label2 = gen_label_rtx ();
5075 rtx label3 = gen_label_rtx ();
5076
5077 operands[1] = force_reg (SImode, operands[1]);
5078 operands[1] = make_safe_from (operands[1], operands[0]);
5079 operands[2] = force_reg (SImode, operands[2]);
5080 operands[2] = make_safe_from (operands[2], operands[0]);
5081
5082 emit_move_insn(operands[0], operands[1]);
5083 emit_insn (gen_cmpsi (operands[2], operands[1]));
5084 emit_jump_insn (gen_bgtu (label3));
5085 emit_insn (gen_cmpsi (operands[2], const1_rtx));
5086 emit_jump_insn (gen_blt (label2));
5087 emit_insn (gen_cmpsi (operands[2], const1_rtx));
5088 emit_jump_insn (gen_beq (label1));
5089 emit_insn (gen_zero_extendsidi2 (operands[3], operands[1]));
5090 insn = emit_insn (gen_divmoddisi3 (operands[3], operands[3],
5091 operands[2]));
5092 REG_NOTES (insn) =
5093 gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
5094
5095 insn = emit_move_insn (operands[0],
5096 gen_highpart (SImode, operands[3]));
5097 REG_NOTES (insn) =
5098 gen_rtx_EXPR_LIST (REG_EQUAL,
5099 umod_equal, REG_NOTES (insn));
5100 emit_jump (label3);
5101 emit_label (label1);
5102 emit_move_insn (operands[0], const0_rtx);
5103 emit_jump (label3);
5104 emit_label (label2);
5105 emit_insn (gen_subsi3 (operands[0], operands[0], operands[2]));
5106 emit_label (label3);
5107 }
5108 DONE;
5109 })
5110
5111 ;
5112 ; divdf3 instruction pattern(s).
5113 ;
5114
5115 (define_expand "divdf3"
5116 [(set (match_operand:DF 0 "register_operand" "=f,f")
5117 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5118 (match_operand:DF 2 "general_operand" "f,R")))]
5119 "TARGET_HARD_FLOAT"
5120 "")
5121
5122 (define_insn "*divdf3"
5123 [(set (match_operand:DF 0 "register_operand" "=f,f")
5124 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5125 (match_operand:DF 2 "general_operand" "f,R")))]
5126 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5127 "@
5128 ddbr\t%0,%2
5129 ddb\t%0,%2"
5130 [(set_attr "op_type" "RRE,RXE")
5131 (set_attr "type" "fdivd")])
5132
5133 (define_insn "*divdf3_ibm"
5134 [(set (match_operand:DF 0 "register_operand" "=f,f")
5135 (div:DF (match_operand:DF 1 "register_operand" "0,0")
5136 (match_operand:DF 2 "general_operand" "f,R")))]
5137 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5138 "@
5139 ddr\t%0,%2
5140 dd\t%0,%2"
5141 [(set_attr "op_type" "RR,RX")
5142 (set_attr "type" "fdivd")])
5143
5144 ;
5145 ; divsf3 instruction pattern(s).
5146 ;
5147
5148 (define_expand "divsf3"
5149 [(set (match_operand:SF 0 "register_operand" "=f,f")
5150 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5151 (match_operand:SF 2 "general_operand" "f,R")))]
5152 "TARGET_HARD_FLOAT"
5153 "")
5154
5155 (define_insn "*divsf3"
5156 [(set (match_operand:SF 0 "register_operand" "=f,f")
5157 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5158 (match_operand:SF 2 "general_operand" "f,R")))]
5159 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5160 "@
5161 debr\t%0,%2
5162 deb\t%0,%2"
5163 [(set_attr "op_type" "RRE,RXE")
5164 (set_attr "type" "fdivs")])
5165
5166 (define_insn "*divsf3"
5167 [(set (match_operand:SF 0 "register_operand" "=f,f")
5168 (div:SF (match_operand:SF 1 "register_operand" "0,0")
5169 (match_operand:SF 2 "general_operand" "f,R")))]
5170 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5171 "@
5172 der\t%0,%2
5173 de\t%0,%2"
5174 [(set_attr "op_type" "RR,RX")
5175 (set_attr "type" "fdivs")])
5176
5177
5178 ;;
5179 ;;- And instructions.
5180 ;;
5181
5182 ;
5183 ; anddi3 instruction pattern(s).
5184 ;
5185
5186 (define_insn "*anddi3_cc"
5187 [(set (reg 33)
5188 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5189 (match_operand:DI 2 "general_operand" "d,m"))
5190 (const_int 0)))
5191 (set (match_operand:DI 0 "register_operand" "=d,d")
5192 (and:DI (match_dup 1) (match_dup 2)))]
5193 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5194 "@
5195 ngr\t%0,%2
5196 ng\t%0,%2"
5197 [(set_attr "op_type" "RRE,RXY")])
5198
5199 (define_insn "*anddi3_cconly"
5200 [(set (reg 33)
5201 (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5202 (match_operand:DI 2 "general_operand" "d,m"))
5203 (const_int 0)))
5204 (clobber (match_scratch:DI 0 "=d,d"))]
5205 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5206 "@
5207 ngr\t%0,%2
5208 ng\t%0,%2"
5209 [(set_attr "op_type" "RRE,RXY")])
5210
5211 (define_insn "anddi3"
5212 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d,d,d")
5213 (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o,0,0,0,0,0,0")
5214 (match_operand:DI 2 "general_operand"
5215 "M,M,N0HDF,N1HDF,N2HDF,N3HDF,d,m")))
5216 (clobber (reg:CC 33))]
5217 "TARGET_64BIT"
5218 "@
5219 #
5220 #
5221 nihh\t%0,%j2
5222 nihl\t%0,%j2
5223 nilh\t%0,%j2
5224 nill\t%0,%j2
5225 ngr\t%0,%2
5226 ng\t%0,%2"
5227 [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RRE,RXY")])
5228
5229 (define_insn "*anddi3_ss"
5230 [(set (match_operand:DI 0 "s_operand" "=Q")
5231 (and:DI (match_dup 0)
5232 (match_operand:DI 1 "s_imm_operand" "Q")))
5233 (clobber (reg:CC 33))]
5234 ""
5235 "nc\t%O0(8,%R0),%1"
5236 [(set_attr "op_type" "SS")])
5237
5238 (define_insn "*anddi3_ss_inv"
5239 [(set (match_operand:DI 0 "s_operand" "=Q")
5240 (and:DI (match_operand:DI 1 "s_imm_operand" "Q")
5241 (match_dup 0)))
5242 (clobber (reg:CC 33))]
5243 ""
5244 "nc\t%O0(8,%R0),%1"
5245 [(set_attr "op_type" "SS")])
5246
5247 ;
5248 ; andsi3 instruction pattern(s).
5249 ;
5250
5251 (define_insn "*andsi3_cc"
5252 [(set (reg 33)
5253 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5254 (match_operand:SI 2 "general_operand" "d,R,T"))
5255 (const_int 0)))
5256 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5257 (and:SI (match_dup 1) (match_dup 2)))]
5258 "s390_match_ccmode(insn, CCTmode)"
5259 "@
5260 nr\t%0,%2
5261 n\t%0,%2
5262 ny\t%0,%2"
5263 [(set_attr "op_type" "RR,RX,RXY")])
5264
5265 (define_insn "*andsi3_cconly"
5266 [(set (reg 33)
5267 (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5268 (match_operand:SI 2 "general_operand" "d,R,T"))
5269 (const_int 0)))
5270 (clobber (match_scratch:SI 0 "=d,d,d"))]
5271 "s390_match_ccmode(insn, CCTmode)"
5272 "@
5273 nr\t%0,%2
5274 n\t%0,%2
5275 ny\t%0,%2"
5276 [(set_attr "op_type" "RR,RX,RXY")])
5277
5278 (define_expand "andsi3"
5279 [(parallel
5280 [(set (match_operand:SI 0 "register_operand" "")
5281 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
5282 (match_operand:SI 2 "general_operand" "")))
5283 (clobber (reg:CC 33))])]
5284 ""
5285 "")
5286
5287 (define_insn "*andsi3_zarch"
5288 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d,d,d")
5289 (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,o,0,0,0,0,0")
5290 (match_operand:SI 2 "general_operand" "M,M,N0HSF,N1HSF,d,R,T")))
5291 (clobber (reg:CC 33))]
5292 "TARGET_ZARCH"
5293 "@
5294 #
5295 #
5296 nilh\t%0,%j2
5297 nill\t%0,%j2
5298 nr\t%0,%2
5299 n\t%0,%2
5300 ny\t%0,%2"
5301 [(set_attr "op_type" "RRE,RXE,RI,RI,RR,RX,RXY")])
5302
5303 (define_insn "*andsi3_esa"
5304 [(set (match_operand:SI 0 "register_operand" "=d,d")
5305 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
5306 (match_operand:SI 2 "general_operand" "d,R")))
5307 (clobber (reg:CC 33))]
5308 "!TARGET_ZARCH"
5309 "@
5310 nr\t%0,%2
5311 n\t%0,%2"
5312 [(set_attr "op_type" "RR,RX")])
5313
5314 (define_insn "*andsi3_ss"
5315 [(set (match_operand:SI 0 "s_operand" "=Q")
5316 (and:SI (match_dup 0)
5317 (match_operand:SI 1 "s_imm_operand" "Q")))
5318 (clobber (reg:CC 33))]
5319 ""
5320 "nc\t%O0(4,%R0),%1"
5321 [(set_attr "op_type" "SS")])
5322
5323 (define_insn "*andsi3_ss_inv"
5324 [(set (match_operand:SI 0 "s_operand" "=Q")
5325 (and:SI (match_operand:SI 1 "s_imm_operand" "Q")
5326 (match_dup 0)))
5327 (clobber (reg:CC 33))]
5328 ""
5329 "nc\t%O0(4,%R0),%1"
5330 [(set_attr "op_type" "SS")])
5331
5332 ;
5333 ; andhi3 instruction pattern(s).
5334 ;
5335
5336 (define_insn "*andhi3_ni"
5337 [(set (match_operand:HI 0 "register_operand" "=d,d")
5338 (and:HI (match_operand:HI 1 "register_operand" "%0,0")
5339 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5340 (clobber (reg:CC 33))]
5341 "TARGET_ZARCH"
5342 "@
5343 nr\t%0,%2
5344 nill\t%0,%x2"
5345 [(set_attr "op_type" "RR,RI")])
5346
5347 (define_insn "andhi3"
5348 [(set (match_operand:HI 0 "register_operand" "=d")
5349 (and:HI (match_operand:HI 1 "register_operand" "%0")
5350 (match_operand:HI 2 "nonmemory_operand" "d")))
5351 (clobber (reg:CC 33))]
5352 ""
5353 "nr\t%0,%2"
5354 [(set_attr "op_type" "RR")])
5355
5356 (define_insn "*andhi3_ss"
5357 [(set (match_operand:HI 0 "s_operand" "=Q")
5358 (and:HI (match_dup 0)
5359 (match_operand:HI 1 "s_imm_operand" "Q")))
5360 (clobber (reg:CC 33))]
5361 ""
5362 "nc\t%O0(2,%R0),%1"
5363 [(set_attr "op_type" "SS")])
5364
5365 (define_insn "*andhi3_ss_inv"
5366 [(set (match_operand:HI 0 "s_operand" "=Q")
5367 (and:HI (match_operand:HI 1 "s_imm_operand" "Q")
5368 (match_dup 0)))
5369 (clobber (reg:CC 33))]
5370 ""
5371 "nc\t%O0(2,%R0),%1"
5372 [(set_attr "op_type" "SS")])
5373
5374 ;
5375 ; andqi3 instruction pattern(s).
5376 ;
5377
5378 (define_insn "*andqi3_ni"
5379 [(set (match_operand:QI 0 "register_operand" "=d,d")
5380 (and:QI (match_operand:QI 1 "register_operand" "%0,0")
5381 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5382 (clobber (reg:CC 33))]
5383 "TARGET_ZARCH"
5384 "@
5385 nr\t%0,%2
5386 nill\t%0,%b2"
5387 [(set_attr "op_type" "RR,RI")])
5388
5389 (define_insn "andqi3"
5390 [(set (match_operand:QI 0 "register_operand" "=d")
5391 (and:QI (match_operand:QI 1 "register_operand" "%0")
5392 (match_operand:QI 2 "nonmemory_operand" "d")))
5393 (clobber (reg:CC 33))]
5394 ""
5395 "nr\t%0,%2"
5396 [(set_attr "op_type" "RR")])
5397
5398 (define_insn "*andqi3_ss"
5399 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5400 (and:QI (match_dup 0)
5401 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5402 (clobber (reg:CC 33))]
5403 ""
5404 "@
5405 ni\t%0,%b1
5406 niy\t%0,%b1
5407 nc\t%O0(1,%R0),%1"
5408 [(set_attr "op_type" "SI,SIY,SS")])
5409
5410 (define_insn "*andqi3_ss_inv"
5411 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5412 (and:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5413 (match_dup 0)))
5414 (clobber (reg:CC 33))]
5415 ""
5416 "@
5417 ni\t%0,%b1
5418 niy\t%0,%b1
5419 nc\t%O0(1,%R0),%1"
5420 [(set_attr "op_type" "SI,SIY,SS")])
5421
5422
5423 ;;
5424 ;;- Bit set (inclusive or) instructions.
5425 ;;
5426
5427 ;
5428 ; iordi3 instruction pattern(s).
5429 ;
5430
5431 (define_insn "*iordi3_cc"
5432 [(set (reg 33)
5433 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5434 (match_operand:DI 2 "general_operand" "d,m"))
5435 (const_int 0)))
5436 (set (match_operand:DI 0 "register_operand" "=d,d")
5437 (ior:DI (match_dup 1) (match_dup 2)))]
5438 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5439 "@
5440 ogr\t%0,%2
5441 og\t%0,%2"
5442 [(set_attr "op_type" "RRE,RXY")])
5443
5444 (define_insn "*iordi3_cconly"
5445 [(set (reg 33)
5446 (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5447 (match_operand:DI 2 "general_operand" "d,m"))
5448 (const_int 0)))
5449 (clobber (match_scratch:DI 0 "=d,d"))]
5450 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5451 "@
5452 ogr\t%0,%2
5453 og\t%0,%2"
5454 [(set_attr "op_type" "RRE,RXY")])
5455
5456 (define_insn "iordi3"
5457 [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d,d")
5458 (ior:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,0,0,0,0")
5459 (match_operand:DI 2 "general_operand" "N0HD0,N1HD0,N2HD0,N3HD0,d,m")))
5460 (clobber (reg:CC 33))]
5461 "TARGET_64BIT"
5462 "@
5463 oihh\t%0,%i2
5464 oihl\t%0,%i2
5465 oilh\t%0,%i2
5466 oill\t%0,%i2
5467 ogr\t%0,%2
5468 og\t%0,%2"
5469 [(set_attr "op_type" "RI,RI,RI,RI,RRE,RXY")])
5470
5471 (define_insn "*iordi3_ss"
5472 [(set (match_operand:DI 0 "s_operand" "=Q")
5473 (ior:DI (match_dup 0)
5474 (match_operand:DI 1 "s_imm_operand" "Q")))
5475 (clobber (reg:CC 33))]
5476 ""
5477 "oc\t%O0(8,%R0),%1"
5478 [(set_attr "op_type" "SS")])
5479
5480 (define_insn "*iordi3_ss_inv"
5481 [(set (match_operand:DI 0 "s_operand" "=Q")
5482 (ior:DI (match_operand:DI 1 "s_imm_operand" "Q")
5483 (match_dup 0)))
5484 (clobber (reg:CC 33))]
5485 ""
5486 "oc\t%O0(8,%R0),%1"
5487 [(set_attr "op_type" "SS")])
5488
5489 ;
5490 ; iorsi3 instruction pattern(s).
5491 ;
5492
5493 (define_insn "*iorsi3_cc"
5494 [(set (reg 33)
5495 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5496 (match_operand:SI 2 "general_operand" "d,R,T"))
5497 (const_int 0)))
5498 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5499 (ior:SI (match_dup 1) (match_dup 2)))]
5500 "s390_match_ccmode(insn, CCTmode)"
5501 "@
5502 or\t%0,%2
5503 o\t%0,%2
5504 oy\t%0,%2"
5505 [(set_attr "op_type" "RR,RX,RXY")])
5506
5507 (define_insn "*iorsi3_cconly"
5508 [(set (reg 33)
5509 (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5510 (match_operand:SI 2 "general_operand" "d,R,T"))
5511 (const_int 0)))
5512 (clobber (match_scratch:SI 0 "=d,d,d"))]
5513 "s390_match_ccmode(insn, CCTmode)"
5514 "@
5515 or\t%0,%2
5516 o\t%0,%2
5517 oy\t%0,%2"
5518 [(set_attr "op_type" "RR,RX,RXY")])
5519
5520 (define_expand "iorsi3"
5521 [(parallel
5522 [(set (match_operand:SI 0 "register_operand" "")
5523 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "")
5524 (match_operand:SI 2 "general_operand" "")))
5525 (clobber (reg:CC 33))])]
5526 ""
5527 "")
5528
5529 (define_insn "iorsi3_zarch"
5530 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d")
5531 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0,0,0,0")
5532 (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,d,R,T")))
5533 (clobber (reg:CC 33))]
5534 "TARGET_ZARCH"
5535 "@
5536 oilh\t%0,%i2
5537 oill\t%0,%i2
5538 or\t%0,%2
5539 o\t%0,%2
5540 oy\t%0,%2"
5541 [(set_attr "op_type" "RI,RI,RR,RX,RXY")])
5542
5543 (define_insn "iorsi3_esa"
5544 [(set (match_operand:SI 0 "register_operand" "=d,d")
5545 (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
5546 (match_operand:SI 2 "general_operand" "d,R")))
5547 (clobber (reg:CC 33))]
5548 "!TARGET_ZARCH"
5549 "@
5550 or\t%0,%2
5551 o\t%0,%2"
5552 [(set_attr "op_type" "RR,RX")])
5553
5554 (define_insn "*iorsi3_ss"
5555 [(set (match_operand:SI 0 "s_operand" "=Q")
5556 (ior:SI (match_dup 0)
5557 (match_operand:SI 1 "s_imm_operand" "Q")))
5558 (clobber (reg:CC 33))]
5559 ""
5560 "oc\t%O0(4,%R0),%1"
5561 [(set_attr "op_type" "SS")])
5562
5563 (define_insn "*iorsi3_ss_inv"
5564 [(set (match_operand:SI 0 "s_operand" "=Q")
5565 (ior:SI (match_operand:SI 1 "s_imm_operand" "Q")
5566 (match_dup 0)))
5567 (clobber (reg:CC 33))]
5568 ""
5569 "oc\t%O0(4,%R0),%1"
5570 [(set_attr "op_type" "SS")])
5571
5572 ;
5573 ; iorhi3 instruction pattern(s).
5574 ;
5575
5576 (define_insn "*iorhi3_oi"
5577 [(set (match_operand:HI 0 "register_operand" "=d,d")
5578 (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
5579 (match_operand:HI 2 "nonmemory_operand" "d,n")))
5580 (clobber (reg:CC 33))]
5581 "TARGET_ZARCH"
5582 "@
5583 or\t%0,%2
5584 oill\t%0,%x2"
5585 [(set_attr "op_type" "RR,RI")])
5586
5587 (define_insn "iorhi3"
5588 [(set (match_operand:HI 0 "register_operand" "=d")
5589 (ior:HI (match_operand:HI 1 "register_operand" "%0")
5590 (match_operand:HI 2 "nonmemory_operand" "d")))
5591 (clobber (reg:CC 33))]
5592 ""
5593 "or\t%0,%2"
5594 [(set_attr "op_type" "RR")])
5595
5596 (define_insn "*iorhi3_ss"
5597 [(set (match_operand:HI 0 "s_operand" "=Q")
5598 (ior:HI (match_dup 0)
5599 (match_operand:HI 1 "s_imm_operand" "Q")))
5600 (clobber (reg:CC 33))]
5601 ""
5602 "oc\t%O0(2,%R0),%1"
5603 [(set_attr "op_type" "SS")])
5604
5605 (define_insn "*iorhi3_ss_inv"
5606 [(set (match_operand:HI 0 "s_operand" "=Q")
5607 (ior:HI (match_operand:HI 1 "s_imm_operand" "Q")
5608 (match_dup 0)))
5609 (clobber (reg:CC 33))]
5610 ""
5611 "oc\t%O0(2,%R0),%1"
5612 [(set_attr "op_type" "SS")])
5613
5614 ;
5615 ; iorqi3 instruction pattern(s).
5616 ;
5617
5618 (define_insn "*iorqi3_oi"
5619 [(set (match_operand:QI 0 "register_operand" "=d,d")
5620 (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
5621 (match_operand:QI 2 "nonmemory_operand" "d,n")))
5622 (clobber (reg:CC 33))]
5623 "TARGET_ZARCH"
5624 "@
5625 or\t%0,%2
5626 oill\t%0,%b2"
5627 [(set_attr "op_type" "RR,RI")])
5628
5629 (define_insn "iorqi3"
5630 [(set (match_operand:QI 0 "register_operand" "=d")
5631 (ior:QI (match_operand:QI 1 "register_operand" "%0")
5632 (match_operand:QI 2 "nonmemory_operand" "d")))
5633 (clobber (reg:CC 33))]
5634 ""
5635 "or\t%0,%2"
5636 [(set_attr "op_type" "RR")])
5637
5638 (define_insn "*iorqi3_ss"
5639 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5640 (ior:QI (match_dup 0)
5641 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5642 (clobber (reg:CC 33))]
5643 ""
5644 "@
5645 oi\t%0,%b1
5646 oiy\t%0,%b1
5647 oc\t%O0(1,%R0),%1"
5648 [(set_attr "op_type" "SI,SIY,SS")])
5649
5650 (define_insn "*iorqi3_ss_inv"
5651 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5652 (ior:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5653 (match_dup 0)))
5654 (clobber (reg:CC 33))]
5655 ""
5656 "@
5657 oi\t%0,%b1
5658 oiy\t%0,%b1
5659 oc\t%O0(1,%R0),%1"
5660 [(set_attr "op_type" "SI,SIY,SS")])
5661
5662
5663 ;;
5664 ;;- Xor instructions.
5665 ;;
5666
5667 ;
5668 ; xordi3 instruction pattern(s).
5669 ;
5670
5671 (define_insn "*xordi3_cc"
5672 [(set (reg 33)
5673 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5674 (match_operand:DI 2 "general_operand" "d,m"))
5675 (const_int 0)))
5676 (set (match_operand:DI 0 "register_operand" "=d,d")
5677 (xor:DI (match_dup 1) (match_dup 2)))]
5678 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5679 "@
5680 xgr\t%0,%2
5681 xg\t%0,%2"
5682 [(set_attr "op_type" "RRE,RXY")])
5683
5684 (define_insn "*xordi3_cconly"
5685 [(set (reg 33)
5686 (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5687 (match_operand:DI 2 "general_operand" "d,m"))
5688 (const_int 0)))
5689 (clobber (match_scratch:DI 0 "=d,d"))]
5690 "s390_match_ccmode(insn, CCTmode) && TARGET_64BIT"
5691 "@
5692 xgr\t%0,%2
5693 xr\t%0,%2"
5694 [(set_attr "op_type" "RRE,RXY")])
5695
5696 (define_insn "xordi3"
5697 [(set (match_operand:DI 0 "register_operand" "=d,d")
5698 (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
5699 (match_operand:DI 2 "general_operand" "d,m")))
5700 (clobber (reg:CC 33))]
5701 "TARGET_64BIT"
5702 "@
5703 xgr\t%0,%2
5704 xg\t%0,%2"
5705 [(set_attr "op_type" "RRE,RXY")])
5706
5707 (define_insn "*xordi3_ss"
5708 [(set (match_operand:DI 0 "s_operand" "=Q")
5709 (xor:DI (match_dup 0)
5710 (match_operand:DI 1 "s_imm_operand" "Q")))
5711 (clobber (reg:CC 33))]
5712 ""
5713 "xc\t%O0(8,%R0),%1"
5714 [(set_attr "op_type" "SS")])
5715
5716 (define_insn "*xordi3_ss_inv"
5717 [(set (match_operand:DI 0 "s_operand" "=Q")
5718 (xor:DI (match_operand:DI 1 "s_imm_operand" "Q")
5719 (match_dup 0)))
5720 (clobber (reg:CC 33))]
5721 ""
5722 "xc\t%O0(8,%R0),%1"
5723 [(set_attr "op_type" "SS")])
5724
5725 ;
5726 ; xorsi3 instruction pattern(s).
5727 ;
5728
5729 (define_insn "*xorsi3_cc"
5730 [(set (reg 33)
5731 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5732 (match_operand:SI 2 "general_operand" "d,R,T"))
5733 (const_int 0)))
5734 (set (match_operand:SI 0 "register_operand" "=d,d,d")
5735 (xor:SI (match_dup 1) (match_dup 2)))]
5736 "s390_match_ccmode(insn, CCTmode)"
5737 "@
5738 xr\t%0,%2
5739 x\t%0,%2
5740 xy\t%0,%2"
5741 [(set_attr "op_type" "RR,RX,RXY")])
5742
5743 (define_insn "*xorsi3_cconly"
5744 [(set (reg 33)
5745 (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5746 (match_operand:SI 2 "general_operand" "d,R,T"))
5747 (const_int 0)))
5748 (clobber (match_scratch:SI 0 "=d,d,d"))]
5749 "s390_match_ccmode(insn, CCTmode)"
5750 "@
5751 xr\t%0,%2
5752 x\t%0,%2
5753 xy\t%0,%2"
5754 [(set_attr "op_type" "RR,RX,RXY")])
5755
5756 (define_insn "xorsi3"
5757 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
5758 (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0")
5759 (match_operand:SI 2 "general_operand" "d,R,T")))
5760 (clobber (reg:CC 33))]
5761 ""
5762 "@
5763 xr\t%0,%2
5764 x\t%0,%2
5765 xy\t%0,%2"
5766 [(set_attr "op_type" "RR,RX,RXY")])
5767
5768 (define_insn "*xorsi3_ss"
5769 [(set (match_operand:SI 0 "s_operand" "=Q")
5770 (xor:SI (match_dup 0)
5771 (match_operand:SI 1 "s_imm_operand" "Q")))
5772 (clobber (reg:CC 33))]
5773 ""
5774 "xc\t%O0(4,%R0),%1"
5775 [(set_attr "op_type" "SS")])
5776
5777 (define_insn "*xorsi3_ss_inv"
5778 [(set (match_operand:SI 0 "s_operand" "=Q")
5779 (xor:SI (match_operand:SI 1 "s_imm_operand" "Q")
5780 (match_dup 0)))
5781 (clobber (reg:CC 33))]
5782 ""
5783 "xc\t%O0(4,%R0),%1"
5784 [(set_attr "op_type" "SS")])
5785
5786 ;
5787 ; xorhi3 instruction pattern(s).
5788 ;
5789
5790 (define_insn "xorhi3"
5791 [(set (match_operand:HI 0 "register_operand" "=d")
5792 (xor:HI (match_operand:HI 1 "register_operand" "%0")
5793 (match_operand:HI 2 "nonmemory_operand" "d")))
5794 (clobber (reg:CC 33))]
5795 ""
5796 "xr\t%0,%2"
5797 [(set_attr "op_type" "RR")])
5798
5799 (define_insn "*xorhi3_ss"
5800 [(set (match_operand:HI 0 "s_operand" "=Q")
5801 (xor:HI (match_dup 0)
5802 (match_operand:HI 1 "s_imm_operand" "Q")))
5803 (clobber (reg:CC 33))]
5804 ""
5805 "xc\t%O0(2,%R0),%1"
5806 [(set_attr "op_type" "SS")])
5807
5808 (define_insn "*xorhi3_ss_inv"
5809 [(set (match_operand:HI 0 "s_operand" "=Q")
5810 (xor:HI (match_operand:HI 1 "s_imm_operand" "Q")
5811 (match_dup 0)))
5812 (clobber (reg:CC 33))]
5813 ""
5814 "xc\t%O0(2,%R0),%1"
5815 [(set_attr "op_type" "SS")])
5816
5817 ;
5818 ; xorqi3 instruction pattern(s).
5819 ;
5820
5821 (define_insn "xorqi3"
5822 [(set (match_operand:QI 0 "register_operand" "=d")
5823 (xor:QI (match_operand:QI 1 "register_operand" "%0")
5824 (match_operand:QI 2 "nonmemory_operand" "d")))
5825 (clobber (reg:CC 33))]
5826 ""
5827 "xr\t%0,%2"
5828 [(set_attr "op_type" "RR")])
5829
5830 (define_insn "*xorqi3_ss"
5831 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5832 (xor:QI (match_dup 0)
5833 (match_operand:QI 1 "s_imm_operand" "n,n,Q")))
5834 (clobber (reg:CC 33))]
5835 ""
5836 "@
5837 xi\t%0,%b1
5838 xiy\t%0,%b1
5839 xc\t%O0(1,%R0),%1"
5840 [(set_attr "op_type" "SI,SIY,SS")])
5841
5842 (define_insn "*xorqi3_ss_inv"
5843 [(set (match_operand:QI 0 "s_operand" "=Q,S,Q")
5844 (xor:QI (match_operand:QI 1 "s_imm_operand" "n,n,Q")
5845 (match_dup 0)))
5846 (clobber (reg:CC 33))]
5847 ""
5848 "@
5849 xi\t%0,%b1
5850 xiy\t%0,%b1
5851 xc\t%O0(1,%R0),%1"
5852 [(set_attr "op_type" "SI,SIY,SS")])
5853
5854
5855 ;;
5856 ;;- Negate instructions.
5857 ;;
5858
5859 ;
5860 ; negdi2 instruction pattern(s).
5861 ;
5862
5863 (define_expand "negdi2"
5864 [(parallel
5865 [(set (match_operand:DI 0 "register_operand" "=d")
5866 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5867 (clobber (reg:CC 33))])]
5868 ""
5869 "")
5870
5871 (define_insn "*negdi2_64"
5872 [(set (match_operand:DI 0 "register_operand" "=d")
5873 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5874 (clobber (reg:CC 33))]
5875 "TARGET_64BIT"
5876 "lcgr\t%0,%1"
5877 [(set_attr "op_type" "RR")])
5878
5879 (define_insn "*negdi2_31"
5880 [(set (match_operand:DI 0 "register_operand" "=d")
5881 (neg:DI (match_operand:DI 1 "register_operand" "d")))
5882 (clobber (reg:CC 33))]
5883 "!TARGET_64BIT"
5884 {
5885 rtx xop[1];
5886 xop[0] = gen_label_rtx ();
5887 output_asm_insn ("lcr\t%0,%1", operands);
5888 output_asm_insn ("lcr\t%N0,%N1", operands);
5889 output_asm_insn ("je\t%l0", xop);
5890 output_asm_insn ("bctr\t%0,0", operands);
5891 targetm.asm_out.internal_label (asm_out_file, "L",
5892 CODE_LABEL_NUMBER (xop[0]));
5893 return "";
5894 }
5895 [(set_attr "op_type" "NN")
5896 (set_attr "type" "other")
5897 (set_attr "length" "10")])
5898
5899 ;
5900 ; negsi2 instruction pattern(s).
5901 ;
5902
5903 (define_insn "negsi2"
5904 [(set (match_operand:SI 0 "register_operand" "=d")
5905 (neg:SI (match_operand:SI 1 "register_operand" "d")))
5906 (clobber (reg:CC 33))]
5907 ""
5908 "lcr\t%0,%1"
5909 [(set_attr "op_type" "RR")])
5910
5911 ;
5912 ; negdf2 instruction pattern(s).
5913 ;
5914
5915 (define_expand "negdf2"
5916 [(parallel
5917 [(set (match_operand:DF 0 "register_operand" "=f")
5918 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5919 (clobber (reg:CC 33))])]
5920 "TARGET_HARD_FLOAT"
5921 "")
5922
5923 (define_insn "*negdf2"
5924 [(set (match_operand:DF 0 "register_operand" "=f")
5925 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5926 (clobber (reg:CC 33))]
5927 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5928 "lcdbr\t%0,%1"
5929 [(set_attr "op_type" "RRE")
5930 (set_attr "type" "fsimpd")])
5931
5932 (define_insn "*negdf2_ibm"
5933 [(set (match_operand:DF 0 "register_operand" "=f")
5934 (neg:DF (match_operand:DF 1 "register_operand" "f")))
5935 (clobber (reg:CC 33))]
5936 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5937 "lcdr\t%0,%1"
5938 [(set_attr "op_type" "RR")
5939 (set_attr "type" "fsimpd")])
5940
5941 ;
5942 ; negsf2 instruction pattern(s).
5943 ;
5944
5945 (define_expand "negsf2"
5946 [(parallel
5947 [(set (match_operand:SF 0 "register_operand" "=f")
5948 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5949 (clobber (reg:CC 33))])]
5950 "TARGET_HARD_FLOAT"
5951 "")
5952
5953 (define_insn "*negsf2"
5954 [(set (match_operand:SF 0 "register_operand" "=f")
5955 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5956 (clobber (reg:CC 33))]
5957 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
5958 "lcebr\t%0,%1"
5959 [(set_attr "op_type" "RRE")
5960 (set_attr "type" "fsimps")])
5961
5962 (define_insn "*negsf2"
5963 [(set (match_operand:SF 0 "register_operand" "=f")
5964 (neg:SF (match_operand:SF 1 "register_operand" "f")))
5965 (clobber (reg:CC 33))]
5966 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
5967 "lcer\t%0,%1"
5968 [(set_attr "op_type" "RR")
5969 (set_attr "type" "fsimps")])
5970
5971
5972 ;;
5973 ;;- Absolute value instructions.
5974 ;;
5975
5976 ;
5977 ; absdi2 instruction pattern(s).
5978 ;
5979
5980 (define_insn "absdi2"
5981 [(set (match_operand:DI 0 "register_operand" "=d")
5982 (abs:DI (match_operand:DI 1 "register_operand" "d")))
5983 (clobber (reg:CC 33))]
5984 "TARGET_64BIT"
5985 "lpgr\t%0,%1"
5986 [(set_attr "op_type" "RRE")])
5987
5988 ;
5989 ; abssi2 instruction pattern(s).
5990 ;
5991
5992 (define_insn "abssi2"
5993 [(set (match_operand:SI 0 "register_operand" "=d")
5994 (abs:SI (match_operand:SI 1 "register_operand" "d")))
5995 (clobber (reg:CC 33))]
5996 ""
5997 "lpr\t%0,%1"
5998 [(set_attr "op_type" "RR")])
5999
6000 ;
6001 ; absdf2 instruction pattern(s).
6002 ;
6003
6004 (define_expand "absdf2"
6005 [(parallel
6006 [(set (match_operand:DF 0 "register_operand" "=f")
6007 (abs:DF (match_operand:DF 1 "register_operand" "f")))
6008 (clobber (reg:CC 33))])]
6009 "TARGET_HARD_FLOAT"
6010 "")
6011
6012 (define_insn "*absdf2"
6013 [(set (match_operand:DF 0 "register_operand" "=f")
6014 (abs:DF (match_operand:DF 1 "register_operand" "f")))
6015 (clobber (reg:CC 33))]
6016 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6017 "lpdbr\t%0,%1"
6018 [(set_attr "op_type" "RRE")
6019 (set_attr "type" "fsimpd")])
6020
6021 (define_insn "*absdf2_ibm"
6022 [(set (match_operand:DF 0 "register_operand" "=f")
6023 (abs:DF (match_operand:DF 1 "register_operand" "f")))
6024 (clobber (reg:CC 33))]
6025 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6026 "lpdr\t%0,%1"
6027 [(set_attr "op_type" "RR")
6028 (set_attr "type" "fsimpd")])
6029
6030 ;
6031 ; abssf2 instruction pattern(s).
6032 ;
6033
6034 (define_expand "abssf2"
6035 [(parallel
6036 [(set (match_operand:SF 0 "register_operand" "=f")
6037 (abs:SF (match_operand:SF 1 "register_operand" "f")))
6038 (clobber (reg:CC 33))])]
6039 "TARGET_HARD_FLOAT"
6040 "")
6041
6042 (define_insn "*abssf2"
6043 [(set (match_operand:SF 0 "register_operand" "=f")
6044 (abs:SF (match_operand:SF 1 "register_operand" "f")))
6045 (clobber (reg:CC 33))]
6046 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6047 "lpebr\t%0,%1"
6048 [(set_attr "op_type" "RRE")
6049 (set_attr "type" "fsimps")])
6050
6051 (define_insn "*abssf2_ibm"
6052 [(set (match_operand:SF 0 "register_operand" "=f")
6053 (abs:SF (match_operand:SF 1 "register_operand" "f")))
6054 (clobber (reg:CC 33))]
6055 "TARGET_HARD_FLOAT && TARGET_IBM_FLOAT"
6056 "lper\t%0,%1"
6057 [(set_attr "op_type" "RR")
6058 (set_attr "type" "fsimps")])
6059
6060 ;;
6061 ;;- Negated absolute value instructions
6062 ;;
6063
6064 ;
6065 ; Integer
6066 ;
6067
6068 (define_insn "*negabssi2"
6069 [(set (match_operand:SI 0 "register_operand" "=d")
6070 (neg:SI (abs:SI (match_operand:SI 1 "register_operand" "d"))))
6071 (clobber (reg:CC 33))]
6072 ""
6073 "lnr\t%0,%1"
6074 [(set_attr "op_type" "RR")])
6075
6076 (define_insn "*negabsdi2"
6077 [(set (match_operand:DI 0 "register_operand" "=d")
6078 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" "d"))))
6079 (clobber (reg:CC 33))]
6080 "TARGET_64BIT"
6081 "lngr\t%0,%1"
6082 [(set_attr "op_type" "RRE")])
6083
6084 ;
6085 ; Floating point
6086 ;
6087
6088 (define_insn "*negabssf2"
6089 [(set (match_operand:SF 0 "register_operand" "=f")
6090 (neg:SF (abs:SF (match_operand:SF 1 "register_operand" "f"))))
6091 (clobber (reg:CC 33))]
6092 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6093 "lnebr\t%0,%1"
6094 [(set_attr "op_type" "RRE")
6095 (set_attr "type" "fsimps")])
6096
6097 (define_insn "*negabsdf2"
6098 [(set (match_operand:DF 0 "register_operand" "=f")
6099 (neg:DF (abs:DF (match_operand:DF 1 "register_operand" "f"))))
6100 (clobber (reg:CC 33))]
6101 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6102 "lndbr\t%0,%1"
6103 [(set_attr "op_type" "RRE")
6104 (set_attr "type" "fsimpd")])
6105
6106 ;;
6107 ;;- Square root instructions.
6108 ;;
6109
6110 ;
6111 ; sqrtdf2 instruction pattern(s).
6112 ;
6113
6114 (define_insn "sqrtdf2"
6115 [(set (match_operand:DF 0 "register_operand" "=f,f")
6116 (sqrt:DF (match_operand:DF 1 "general_operand" "f,R")))]
6117 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6118 "@
6119 sqdbr\t%0,%1
6120 sqdb\t%0,%1"
6121 [(set_attr "op_type" "RRE,RXE")])
6122
6123 ;
6124 ; sqrtsf2 instruction pattern(s).
6125 ;
6126
6127 (define_insn "sqrtsf2"
6128 [(set (match_operand:SF 0 "register_operand" "=f,f")
6129 (sqrt:SF (match_operand:SF 1 "general_operand" "f,R")))]
6130 "TARGET_HARD_FLOAT && TARGET_IEEE_FLOAT"
6131 "@
6132 sqebr\t%0,%1
6133 sqeb\t%0,%1"
6134 [(set_attr "op_type" "RRE,RXE")])
6135
6136 ;;
6137 ;;- One complement instructions.
6138 ;;
6139
6140 ;
6141 ; one_cmpldi2 instruction pattern(s).
6142 ;
6143
6144 (define_expand "one_cmpldi2"
6145 [(parallel
6146 [(set (match_operand:DI 0 "register_operand" "")
6147 (xor:DI (match_operand:DI 1 "register_operand" "")
6148 (const_int -1)))
6149 (clobber (reg:CC 33))])]
6150 "TARGET_64BIT"
6151 "")
6152
6153 ;
6154 ; one_cmplsi2 instruction pattern(s).
6155 ;
6156
6157 (define_expand "one_cmplsi2"
6158 [(parallel
6159 [(set (match_operand:SI 0 "register_operand" "")
6160 (xor:SI (match_operand:SI 1 "register_operand" "")
6161 (const_int -1)))
6162 (clobber (reg:CC 33))])]
6163 ""
6164 "")
6165
6166 ;
6167 ; one_cmplhi2 instruction pattern(s).
6168 ;
6169
6170 (define_expand "one_cmplhi2"
6171 [(parallel
6172 [(set (match_operand:HI 0 "register_operand" "")
6173 (xor:HI (match_operand:HI 1 "register_operand" "")
6174 (const_int -1)))
6175 (clobber (reg:CC 33))])]
6176 ""
6177 "")
6178
6179 ;
6180 ; one_cmplqi2 instruction pattern(s).
6181 ;
6182
6183 (define_expand "one_cmplqi2"
6184 [(parallel
6185 [(set (match_operand:QI 0 "register_operand" "")
6186 (xor:QI (match_operand:QI 1 "register_operand" "")
6187 (const_int -1)))
6188 (clobber (reg:CC 33))])]
6189 ""
6190 "")
6191
6192
6193 ;;
6194 ;;- Rotate instructions.
6195 ;;
6196
6197 ;
6198 ; rotldi3 instruction pattern(s).
6199 ;
6200
6201 (define_insn "rotldi3"
6202 [(set (match_operand:DI 0 "register_operand" "=d")
6203 (rotate:DI (match_operand:DI 1 "register_operand" "d")
6204 (match_operand:SI 2 "shift_count_operand" "Y")))]
6205 "TARGET_64BIT"
6206 "rllg\t%0,%1,%Y2"
6207 [(set_attr "op_type" "RSE")
6208 (set_attr "atype" "reg")])
6209
6210 ;
6211 ; rotlsi3 instruction pattern(s).
6212 ;
6213
6214 (define_insn "rotlsi3"
6215 [(set (match_operand:SI 0 "register_operand" "=d")
6216 (rotate:SI (match_operand:SI 1 "register_operand" "d")
6217 (match_operand:SI 2 "shift_count_operand" "Y")))]
6218 "TARGET_CPU_ZARCH"
6219 "rll\t%0,%1,%Y2"
6220 [(set_attr "op_type" "RSE")
6221 (set_attr "atype" "reg")])
6222
6223
6224 ;;
6225 ;;- Arithmetic shift instructions.
6226 ;;
6227
6228 ;
6229 ; ashldi3 instruction pattern(s).
6230 ;
6231
6232 (define_expand "ashldi3"
6233 [(set (match_operand:DI 0 "register_operand" "")
6234 (ashift:DI (match_operand:DI 1 "register_operand" "")
6235 (match_operand:SI 2 "shift_count_operand" "")))]
6236 ""
6237 "")
6238
6239 (define_insn "*ashldi3_31"
6240 [(set (match_operand:DI 0 "register_operand" "=d")
6241 (ashift:DI (match_operand:DI 1 "register_operand" "0")
6242 (match_operand:SI 2 "shift_count_operand" "Y")))]
6243 "!TARGET_64BIT"
6244 "sldl\t%0,%Y2"
6245 [(set_attr "op_type" "RS")
6246 (set_attr "atype" "reg")])
6247
6248 (define_insn "*ashldi3_64"
6249 [(set (match_operand:DI 0 "register_operand" "=d")
6250 (ashift:DI (match_operand:DI 1 "register_operand" "d")
6251 (match_operand:SI 2 "shift_count_operand" "Y")))]
6252 "TARGET_64BIT"
6253 "sllg\t%0,%1,%Y2"
6254 [(set_attr "op_type" "RSE")
6255 (set_attr "atype" "reg")])
6256
6257 ;
6258 ; ashrdi3 instruction pattern(s).
6259 ;
6260
6261 (define_expand "ashrdi3"
6262 [(parallel
6263 [(set (match_operand:DI 0 "register_operand" "")
6264 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6265 (match_operand:SI 2 "shift_count_operand" "")))
6266 (clobber (reg:CC 33))])]
6267 ""
6268 "")
6269
6270 (define_insn "*ashrdi3_cc_31"
6271 [(set (reg 33)
6272 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6273 (match_operand:SI 2 "shift_count_operand" "Y"))
6274 (const_int 0)))
6275 (set (match_operand:DI 0 "register_operand" "=d")
6276 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6277 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6278 "srda\t%0,%Y2"
6279 [(set_attr "op_type" "RS")
6280 (set_attr "atype" "reg")])
6281
6282 (define_insn "*ashrdi3_cconly_31"
6283 [(set (reg 33)
6284 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6285 (match_operand:SI 2 "shift_count_operand" "Y"))
6286 (const_int 0)))
6287 (clobber (match_scratch:DI 0 "=d"))]
6288 "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
6289 "srda\t%0,%Y2"
6290 [(set_attr "op_type" "RS")
6291 (set_attr "atype" "reg")])
6292
6293 (define_insn "*ashrdi3_31"
6294 [(set (match_operand:DI 0 "register_operand" "=d")
6295 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
6296 (match_operand:SI 2 "shift_count_operand" "Y")))
6297 (clobber (reg:CC 33))]
6298 "!TARGET_64BIT"
6299 "srda\t%0,%Y2"
6300 [(set_attr "op_type" "RS")
6301 (set_attr "atype" "reg")])
6302
6303 (define_insn "*ashrdi3_cc_64"
6304 [(set (reg 33)
6305 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6306 (match_operand:SI 2 "shift_count_operand" "Y"))
6307 (const_int 0)))
6308 (set (match_operand:DI 0 "register_operand" "=d")
6309 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6310 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6311 "srag\t%0,%1,%Y2"
6312 [(set_attr "op_type" "RSE")
6313 (set_attr "atype" "reg")])
6314
6315 (define_insn "*ashrdi3_cconly_64"
6316 [(set (reg 33)
6317 (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6318 (match_operand:SI 2 "shift_count_operand" "Y"))
6319 (const_int 0)))
6320 (clobber (match_scratch:DI 0 "=d"))]
6321 "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
6322 "srag\t%0,%1,%Y2"
6323 [(set_attr "op_type" "RSE")
6324 (set_attr "atype" "reg")])
6325
6326 (define_insn "*ashrdi3_64"
6327 [(set (match_operand:DI 0 "register_operand" "=d")
6328 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6329 (match_operand:SI 2 "shift_count_operand" "Y")))
6330 (clobber (reg:CC 33))]
6331 "TARGET_64BIT"
6332 "srag\t%0,%1,%Y2"
6333 [(set_attr "op_type" "RSE")
6334 (set_attr "atype" "reg")])
6335
6336
6337 ;
6338 ; ashlsi3 instruction pattern(s).
6339 ;
6340
6341 (define_insn "ashlsi3"
6342 [(set (match_operand:SI 0 "register_operand" "=d")
6343 (ashift:SI (match_operand:SI 1 "register_operand" "0")
6344 (match_operand:SI 2 "shift_count_operand" "Y")))]
6345 ""
6346 "sll\t%0,%Y2"
6347 [(set_attr "op_type" "RS")
6348 (set_attr "atype" "reg")])
6349
6350 ;
6351 ; ashrsi3 instruction pattern(s).
6352 ;
6353
6354 (define_insn "*ashrsi3_cc"
6355 [(set (reg 33)
6356 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6357 (match_operand:SI 2 "shift_count_operand" "Y"))
6358 (const_int 0)))
6359 (set (match_operand:SI 0 "register_operand" "=d")
6360 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
6361 "s390_match_ccmode(insn, CCSmode)"
6362 "sra\t%0,%Y2"
6363 [(set_attr "op_type" "RS")
6364 (set_attr "atype" "reg")])
6365
6366
6367 (define_insn "*ashrsi3_cconly"
6368 [(set (reg 33)
6369 (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6370 (match_operand:SI 2 "shift_count_operand" "Y"))
6371 (const_int 0)))
6372 (clobber (match_scratch:SI 0 "=d"))]
6373 "s390_match_ccmode(insn, CCSmode)"
6374 "sra\t%0,%Y2"
6375 [(set_attr "op_type" "RS")
6376 (set_attr "atype" "reg")])
6377
6378 (define_insn "ashrsi3"
6379 [(set (match_operand:SI 0 "register_operand" "=d")
6380 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
6381 (match_operand:SI 2 "shift_count_operand" "Y")))
6382 (clobber (reg:CC 33))]
6383 ""
6384 "sra\t%0,%Y2"
6385 [(set_attr "op_type" "RS")
6386 (set_attr "atype" "reg")])
6387
6388
6389 ;;
6390 ;;- logical shift instructions.
6391 ;;
6392
6393 ;
6394 ; lshrdi3 instruction pattern(s).
6395 ;
6396
6397 (define_expand "lshrdi3"
6398 [(set (match_operand:DI 0 "register_operand" "")
6399 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6400 (match_operand:SI 2 "shift_count_operand" "")))]
6401 ""
6402 "")
6403
6404 (define_insn "*lshrdi3_31"
6405 [(set (match_operand:DI 0 "register_operand" "=d")
6406 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
6407 (match_operand:SI 2 "shift_count_operand" "Y")))]
6408 "!TARGET_64BIT"
6409 "srdl\t%0,%Y2"
6410 [(set_attr "op_type" "RS")
6411 (set_attr "atype" "reg")])
6412
6413 (define_insn "*lshrdi3_64"
6414 [(set (match_operand:DI 0 "register_operand" "=d")
6415 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6416 (match_operand:SI 2 "shift_count_operand" "Y")))]
6417 "TARGET_64BIT"
6418 "srlg\t%0,%1,%Y2"
6419 [(set_attr "op_type" "RSE")
6420 (set_attr "atype" "reg")])
6421
6422 ;
6423 ; lshrsi3 instruction pattern(s).
6424 ;
6425
6426 (define_insn "lshrsi3"
6427 [(set (match_operand:SI 0 "register_operand" "=d")
6428 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
6429 (match_operand:SI 2 "shift_count_operand" "Y")))]
6430 ""
6431 "srl\t%0,%Y2"
6432 [(set_attr "op_type" "RS")
6433 (set_attr "atype" "reg")])
6434
6435
6436 ;;
6437 ;; Branch instruction patterns.
6438 ;;
6439
6440 (define_expand "beq"
6441 [(match_operand 0 "" "")]
6442 ""
6443 "s390_emit_jump (operands[0],
6444 s390_emit_compare (EQ, s390_compare_op0, s390_compare_op1)); DONE;")
6445
6446 (define_expand "bne"
6447 [(match_operand 0 "" "")]
6448 ""
6449 "s390_emit_jump (operands[0],
6450 s390_emit_compare (NE, s390_compare_op0, s390_compare_op1)); DONE;")
6451
6452 (define_expand "bgt"
6453 [(match_operand 0 "" "")]
6454 ""
6455 "s390_emit_jump (operands[0],
6456 s390_emit_compare (GT, s390_compare_op0, s390_compare_op1)); DONE;")
6457
6458 (define_expand "bgtu"
6459 [(match_operand 0 "" "")]
6460 ""
6461 "s390_emit_jump (operands[0],
6462 s390_emit_compare (GTU, s390_compare_op0, s390_compare_op1)); DONE;")
6463
6464 (define_expand "blt"
6465 [(match_operand 0 "" "")]
6466 ""
6467 "s390_emit_jump (operands[0],
6468 s390_emit_compare (LT, s390_compare_op0, s390_compare_op1)); DONE;")
6469
6470 (define_expand "bltu"
6471 [(match_operand 0 "" "")]
6472 ""
6473 "s390_emit_jump (operands[0],
6474 s390_emit_compare (LTU, s390_compare_op0, s390_compare_op1)); DONE;")
6475
6476 (define_expand "bge"
6477 [(match_operand 0 "" "")]
6478 ""
6479 "s390_emit_jump (operands[0],
6480 s390_emit_compare (GE, s390_compare_op0, s390_compare_op1)); DONE;")
6481
6482 (define_expand "bgeu"
6483 [(match_operand 0 "" "")]
6484 ""
6485 "s390_emit_jump (operands[0],
6486 s390_emit_compare (GEU, s390_compare_op0, s390_compare_op1)); DONE;")
6487
6488 (define_expand "ble"
6489 [(match_operand 0 "" "")]
6490 ""
6491 "s390_emit_jump (operands[0],
6492 s390_emit_compare (LE, s390_compare_op0, s390_compare_op1)); DONE;")
6493
6494 (define_expand "bleu"
6495 [(match_operand 0 "" "")]
6496 ""
6497 "s390_emit_jump (operands[0],
6498 s390_emit_compare (LEU, s390_compare_op0, s390_compare_op1)); DONE;")
6499
6500 (define_expand "bunordered"
6501 [(match_operand 0 "" "")]
6502 ""
6503 "s390_emit_jump (operands[0],
6504 s390_emit_compare (UNORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6505
6506 (define_expand "bordered"
6507 [(match_operand 0 "" "")]
6508 ""
6509 "s390_emit_jump (operands[0],
6510 s390_emit_compare (ORDERED, s390_compare_op0, s390_compare_op1)); DONE;")
6511
6512 (define_expand "buneq"
6513 [(match_operand 0 "" "")]
6514 ""
6515 "s390_emit_jump (operands[0],
6516 s390_emit_compare (UNEQ, s390_compare_op0, s390_compare_op1)); DONE;")
6517
6518 (define_expand "bunlt"
6519 [(match_operand 0 "" "")]
6520 ""
6521 "s390_emit_jump (operands[0],
6522 s390_emit_compare (UNLT, s390_compare_op0, s390_compare_op1)); DONE;")
6523
6524 (define_expand "bungt"
6525 [(match_operand 0 "" "")]
6526 ""
6527 "s390_emit_jump (operands[0],
6528 s390_emit_compare (UNGT, s390_compare_op0, s390_compare_op1)); DONE;")
6529
6530 (define_expand "bunle"
6531 [(match_operand 0 "" "")]
6532 ""
6533 "s390_emit_jump (operands[0],
6534 s390_emit_compare (UNLE, s390_compare_op0, s390_compare_op1)); DONE;")
6535
6536 (define_expand "bunge"
6537 [(match_operand 0 "" "")]
6538 ""
6539 "s390_emit_jump (operands[0],
6540 s390_emit_compare (UNGE, s390_compare_op0, s390_compare_op1)); DONE;")
6541
6542 (define_expand "bltgt"
6543 [(match_operand 0 "" "")]
6544 ""
6545 "s390_emit_jump (operands[0],
6546 s390_emit_compare (LTGT, s390_compare_op0, s390_compare_op1)); DONE;")
6547
6548
6549 ;;
6550 ;;- Conditional jump instructions.
6551 ;;
6552
6553 (define_insn "*cjump_64"
6554 [(set (pc)
6555 (if_then_else
6556 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6557 (label_ref (match_operand 0 "" ""))
6558 (pc)))]
6559 "TARGET_CPU_ZARCH"
6560 {
6561 if (get_attr_length (insn) == 4)
6562 return "j%C1\t%l0";
6563 else
6564 return "jg%C1\t%l0";
6565 }
6566 [(set_attr "op_type" "RI")
6567 (set_attr "type" "branch")
6568 (set (attr "length")
6569 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6570 (const_int 4) (const_int 6)))])
6571
6572 (define_insn "*cjump_31"
6573 [(set (pc)
6574 (if_then_else
6575 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6576 (label_ref (match_operand 0 "" ""))
6577 (pc)))]
6578 "!TARGET_CPU_ZARCH"
6579 {
6580 if (get_attr_length (insn) == 4)
6581 return "j%C1\t%l0";
6582 else
6583 abort ();
6584 }
6585 [(set_attr "op_type" "RI")
6586 (set_attr "type" "branch")
6587 (set (attr "length")
6588 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6589 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6590 (const_int 4) (const_int 6))
6591 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6592 (const_int 4) (const_int 8))))])
6593
6594 (define_insn "*cjump_long"
6595 [(set (pc)
6596 (if_then_else
6597 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6598 (match_operand 0 "address_operand" "U")
6599 (pc)))]
6600 ""
6601 {
6602 if (get_attr_op_type (insn) == OP_TYPE_RR)
6603 return "b%C1r\t%0";
6604 else
6605 return "b%C1\t%a0";
6606 }
6607 [(set (attr "op_type")
6608 (if_then_else (match_operand 0 "register_operand" "")
6609 (const_string "RR") (const_string "RX")))
6610 (set_attr "type" "branch")
6611 (set_attr "atype" "agen")])
6612
6613
6614 ;;
6615 ;;- Negated conditional jump instructions.
6616 ;;
6617
6618 (define_insn "*icjump_64"
6619 [(set (pc)
6620 (if_then_else
6621 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6622 (pc)
6623 (label_ref (match_operand 0 "" ""))))]
6624 "TARGET_CPU_ZARCH"
6625 {
6626 if (get_attr_length (insn) == 4)
6627 return "j%D1\t%l0";
6628 else
6629 return "jg%D1\t%l0";
6630 }
6631 [(set_attr "op_type" "RI")
6632 (set_attr "type" "branch")
6633 (set (attr "length")
6634 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6635 (const_int 4) (const_int 6)))])
6636
6637 (define_insn "*icjump_31"
6638 [(set (pc)
6639 (if_then_else
6640 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6641 (pc)
6642 (label_ref (match_operand 0 "" ""))))]
6643 "!TARGET_CPU_ZARCH"
6644 {
6645 if (get_attr_length (insn) == 4)
6646 return "j%D1\t%l0";
6647 else
6648 abort ();
6649 }
6650 [(set_attr "op_type" "RI")
6651 (set_attr "type" "branch")
6652 (set (attr "length")
6653 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6654 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6655 (const_int 4) (const_int 6))
6656 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6657 (const_int 4) (const_int 8))))])
6658
6659 (define_insn "*icjump_long"
6660 [(set (pc)
6661 (if_then_else
6662 (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)])
6663 (pc)
6664 (match_operand 0 "address_operand" "U")))]
6665 ""
6666 {
6667 if (get_attr_op_type (insn) == OP_TYPE_RR)
6668 return "b%D1r\t%0";
6669 else
6670 return "b%D1\t%a0";
6671 }
6672 [(set (attr "op_type")
6673 (if_then_else (match_operand 0 "register_operand" "")
6674 (const_string "RR") (const_string "RX")))
6675 (set_attr "type" "branch")
6676 (set_attr "atype" "agen")])
6677
6678 ;;
6679 ;;- Trap instructions.
6680 ;;
6681
6682 (define_insn "trap"
6683 [(trap_if (const_int 1) (const_int 0))]
6684 ""
6685 "j\t.+2"
6686 [(set_attr "op_type" "RI")
6687 (set_attr "type" "branch")])
6688
6689 (define_expand "conditional_trap"
6690 [(trap_if (match_operand 0 "comparison_operator" "")
6691 (match_operand 1 "general_operand" ""))]
6692 ""
6693 {
6694 if (operands[1] != const0_rtx) FAIL;
6695 operands[0] = s390_emit_compare (GET_CODE (operands[0]),
6696 s390_compare_op0, s390_compare_op1);
6697 })
6698
6699 (define_insn "*trap"
6700 [(trap_if (match_operator 0 "comparison_operator" [(reg 33) (const_int 0)])
6701 (const_int 0))]
6702 ""
6703 "j%C0\t.+2";
6704 [(set_attr "op_type" "RI")
6705 (set_attr "type" "branch")])
6706
6707 ;;
6708 ;;- Loop instructions.
6709 ;;
6710 ;; This is all complicated by the fact that since this is a jump insn
6711 ;; we must handle our own output reloads.
6712
6713 (define_expand "doloop_end"
6714 [(use (match_operand 0 "" "")) ; loop pseudo
6715 (use (match_operand 1 "" "")) ; iterations; zero if unknown
6716 (use (match_operand 2 "" "")) ; max iterations
6717 (use (match_operand 3 "" "")) ; loop level
6718 (use (match_operand 4 "" ""))] ; label
6719 ""
6720 {
6721 if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH)
6722 emit_jump_insn (gen_doloop_si31 (operands[4], operands[0], operands[0]));
6723 else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH)
6724 emit_jump_insn (gen_doloop_si64 (operands[4], operands[0], operands[0]));
6725 else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT)
6726 emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0]));
6727 else
6728 FAIL;
6729
6730 DONE;
6731 })
6732
6733 (define_insn_and_split "doloop_si64"
6734 [(set (pc)
6735 (if_then_else
6736 (ne (match_operand:SI 1 "register_operand" "d,d")
6737 (const_int 1))
6738 (label_ref (match_operand 0 "" ""))
6739 (pc)))
6740 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6741 (plus:SI (match_dup 1) (const_int -1)))
6742 (clobber (match_scratch:SI 3 "=X,&d"))
6743 (clobber (reg:CC 33))]
6744 "TARGET_CPU_ZARCH"
6745 {
6746 if (which_alternative != 0)
6747 return "#";
6748 else if (get_attr_length (insn) == 4)
6749 return "brct\t%1,%l0";
6750 else
6751 return "ahi\t%1,-1\;jgne\t%l0";
6752 }
6753 "&& reload_completed
6754 && (! REG_P (operands[2])
6755 || ! rtx_equal_p (operands[1], operands[2]))"
6756 [(set (match_dup 3) (match_dup 1))
6757 (parallel [(set (reg:CCAN 33)
6758 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6759 (const_int 0)))
6760 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6761 (set (match_dup 2) (match_dup 3))
6762 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6763 (label_ref (match_dup 0))
6764 (pc)))]
6765 ""
6766 [(set_attr "op_type" "RI")
6767 (set_attr "type" "branch")
6768 (set (attr "length")
6769 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6770 (const_int 4) (const_int 10)))])
6771
6772 (define_insn_and_split "doloop_si31"
6773 [(set (pc)
6774 (if_then_else
6775 (ne (match_operand:SI 1 "register_operand" "d,d")
6776 (const_int 1))
6777 (label_ref (match_operand 0 "" ""))
6778 (pc)))
6779 (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d")
6780 (plus:SI (match_dup 1) (const_int -1)))
6781 (clobber (match_scratch:SI 3 "=X,&d"))
6782 (clobber (reg:CC 33))]
6783 "!TARGET_CPU_ZARCH"
6784 {
6785 if (which_alternative != 0)
6786 return "#";
6787 else if (get_attr_length (insn) == 4)
6788 return "brct\t%1,%l0";
6789 else
6790 abort ();
6791 }
6792 "&& reload_completed
6793 && (! REG_P (operands[2])
6794 || ! rtx_equal_p (operands[1], operands[2]))"
6795 [(set (match_dup 3) (match_dup 1))
6796 (parallel [(set (reg:CCAN 33)
6797 (compare:CCAN (plus:SI (match_dup 3) (const_int -1))
6798 (const_int 0)))
6799 (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))])
6800 (set (match_dup 2) (match_dup 3))
6801 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6802 (label_ref (match_dup 0))
6803 (pc)))]
6804 ""
6805 [(set_attr "op_type" "RI")
6806 (set_attr "type" "branch")
6807 (set (attr "length")
6808 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6809 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6810 (const_int 4) (const_int 6))
6811 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6812 (const_int 4) (const_int 8))))])
6813
6814 (define_insn "*doloop_si_long"
6815 [(set (pc)
6816 (if_then_else
6817 (ne (match_operand:SI 1 "register_operand" "d,d")
6818 (const_int 1))
6819 (match_operand 0 "address_operand" "U,U")
6820 (pc)))
6821 (set (match_operand:SI 2 "register_operand" "=1,?*m*d")
6822 (plus:SI (match_dup 1) (const_int -1)))
6823 (clobber (match_scratch:SI 3 "=X,&d"))
6824 (clobber (reg:CC 33))]
6825 "!TARGET_CPU_ZARCH"
6826 {
6827 if (get_attr_op_type (insn) == OP_TYPE_RR)
6828 return "bctr\t%1,%0";
6829 else
6830 return "bct\t%1,%a0";
6831 }
6832 [(set (attr "op_type")
6833 (if_then_else (match_operand 0 "register_operand" "")
6834 (const_string "RR") (const_string "RX")))
6835 (set_attr "type" "branch")
6836 (set_attr "atype" "agen")])
6837
6838 (define_insn_and_split "doloop_di"
6839 [(set (pc)
6840 (if_then_else
6841 (ne (match_operand:DI 1 "register_operand" "d,d")
6842 (const_int 1))
6843 (label_ref (match_operand 0 "" ""))
6844 (pc)))
6845 (set (match_operand:DI 2 "nonimmediate_operand" "=1,?*m*r")
6846 (plus:DI (match_dup 1) (const_int -1)))
6847 (clobber (match_scratch:DI 3 "=X,&d"))
6848 (clobber (reg:CC 33))]
6849 "TARGET_64BIT"
6850 {
6851 if (which_alternative != 0)
6852 return "#";
6853 else if (get_attr_length (insn) == 4)
6854 return "brctg\t%1,%l0";
6855 else
6856 return "aghi\t%1,-1\;jgne\t%l0";
6857 }
6858 "&& reload_completed
6859 && (! REG_P (operands[2])
6860 || ! rtx_equal_p (operands[1], operands[2]))"
6861 [(set (match_dup 3) (match_dup 1))
6862 (parallel [(set (reg:CCAN 33)
6863 (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
6864 (const_int 0)))
6865 (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
6866 (set (match_dup 2) (match_dup 3))
6867 (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0))
6868 (label_ref (match_dup 0))
6869 (pc)))]
6870 ""
6871 [(set_attr "op_type" "RI")
6872 (set_attr "type" "branch")
6873 (set (attr "length")
6874 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6875 (const_int 4) (const_int 10)))])
6876
6877 ;;
6878 ;;- Unconditional jump instructions.
6879 ;;
6880
6881 ;
6882 ; jump instruction pattern(s).
6883 ;
6884
6885 (define_expand "jump"
6886 [(match_operand 0 "" "")]
6887 ""
6888 "s390_emit_jump (operands[0], NULL_RTX); DONE;")
6889
6890 (define_insn "*jump64"
6891 [(set (pc) (label_ref (match_operand 0 "" "")))]
6892 "TARGET_CPU_ZARCH"
6893 {
6894 if (get_attr_length (insn) == 4)
6895 return "j\t%l0";
6896 else
6897 return "jg\t%l0";
6898 }
6899 [(set_attr "op_type" "RI")
6900 (set_attr "type" "branch")
6901 (set (attr "length")
6902 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6903 (const_int 4) (const_int 6)))])
6904
6905 (define_insn "*jump31"
6906 [(set (pc) (label_ref (match_operand 0 "" "")))]
6907 "!TARGET_CPU_ZARCH"
6908 {
6909 if (get_attr_length (insn) == 4)
6910 return "j\t%l0";
6911 else
6912 abort ();
6913 }
6914 [(set_attr "op_type" "RI")
6915 (set_attr "type" "branch")
6916 (set (attr "length")
6917 (if_then_else (eq (symbol_ref "flag_pic") (const_int 0))
6918 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6919 (const_int 4) (const_int 6))
6920 (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000))
6921 (const_int 4) (const_int 8))))])
6922
6923 ;
6924 ; indirect-jump instruction pattern(s).
6925 ;
6926
6927 (define_insn "indirect_jump"
6928 [(set (pc) (match_operand 0 "address_operand" "U"))]
6929 ""
6930 {
6931 if (get_attr_op_type (insn) == OP_TYPE_RR)
6932 return "br\t%0";
6933 else
6934 return "b\t%a0";
6935 }
6936 [(set (attr "op_type")
6937 (if_then_else (match_operand 0 "register_operand" "")
6938 (const_string "RR") (const_string "RX")))
6939 (set_attr "type" "branch")
6940 (set_attr "atype" "agen")])
6941
6942 ;
6943 ; casesi instruction pattern(s).
6944 ;
6945
6946 (define_insn "casesi_jump"
6947 [(set (pc) (match_operand 0 "address_operand" "U"))
6948 (use (label_ref (match_operand 1 "" "")))]
6949 ""
6950 {
6951 if (get_attr_op_type (insn) == OP_TYPE_RR)
6952 return "br\t%0";
6953 else
6954 return "b\t%a0";
6955 }
6956 [(set (attr "op_type")
6957 (if_then_else (match_operand 0 "register_operand" "")
6958 (const_string "RR") (const_string "RX")))
6959 (set_attr "type" "branch")
6960 (set_attr "atype" "agen")])
6961
6962 (define_expand "casesi"
6963 [(match_operand:SI 0 "general_operand" "")
6964 (match_operand:SI 1 "general_operand" "")
6965 (match_operand:SI 2 "general_operand" "")
6966 (label_ref (match_operand 3 "" ""))
6967 (label_ref (match_operand 4 "" ""))]
6968 ""
6969 {
6970 rtx index = gen_reg_rtx (SImode);
6971 rtx base = gen_reg_rtx (Pmode);
6972 rtx target = gen_reg_rtx (Pmode);
6973
6974 emit_move_insn (index, operands[0]);
6975 emit_insn (gen_subsi3 (index, index, operands[1]));
6976 emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1,
6977 operands[4]);
6978
6979 if (Pmode != SImode)
6980 index = convert_to_mode (Pmode, index, 1);
6981 if (GET_CODE (index) != REG)
6982 index = copy_to_mode_reg (Pmode, index);
6983
6984 if (TARGET_64BIT)
6985 emit_insn (gen_ashldi3 (index, index, GEN_INT (3)));
6986 else
6987 emit_insn (gen_ashlsi3 (index, index, const2_rtx));
6988
6989 emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3]));
6990
6991 index = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, base, index));
6992 RTX_UNCHANGING_P (index) = 1;
6993 MEM_NOTRAP_P (index) = 1;
6994 emit_move_insn (target, index);
6995
6996 if (flag_pic)
6997 target = gen_rtx_PLUS (Pmode, base, target);
6998 emit_jump_insn (gen_casesi_jump (target, operands[3]));
6999
7000 DONE;
7001 })
7002
7003
7004 ;;
7005 ;;- Jump to subroutine.
7006 ;;
7007 ;;
7008
7009 ;
7010 ; untyped call instruction pattern(s).
7011 ;
7012
7013 ;; Call subroutine returning any type.
7014 (define_expand "untyped_call"
7015 [(parallel [(call (match_operand 0 "" "")
7016 (const_int 0))
7017 (match_operand 1 "" "")
7018 (match_operand 2 "" "")])]
7019 ""
7020 {
7021 int i;
7022
7023 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx));
7024
7025 for (i = 0; i < XVECLEN (operands[2], 0); i++)
7026 {
7027 rtx set = XVECEXP (operands[2], 0, i);
7028 emit_move_insn (SET_DEST (set), SET_SRC (set));
7029 }
7030
7031 /* The optimizer does not know that the call sets the function value
7032 registers we stored in the result block. We avoid problems by
7033 claiming that all hard registers are used and clobbered at this
7034 point. */
7035 emit_insn (gen_blockage ());
7036
7037 DONE;
7038 })
7039
7040 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
7041 ;; all of memory. This blocks insns from being moved across this point.
7042
7043 (define_insn "blockage"
7044 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
7045 ""
7046 ""
7047 [(set_attr "type" "none")
7048 (set_attr "length" "0")])
7049
7050 ;
7051 ; sibcall patterns
7052 ;
7053
7054 (define_expand "sibcall"
7055 [(call (match_operand 0 "" "")
7056 (match_operand 1 "" ""))]
7057 ""
7058 {
7059 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX);
7060 DONE;
7061 })
7062
7063 (define_insn "*sibcall_br"
7064 [(call (mem:QI (reg 1))
7065 (match_operand 0 "const_int_operand" "n"))]
7066 "SIBLING_CALL_P (insn)
7067 && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
7068 "br\t%%r1"
7069 [(set_attr "op_type" "RR")
7070 (set_attr "type" "branch")
7071 (set_attr "atype" "agen")])
7072
7073 (define_insn "*sibcall_brc"
7074 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7075 (match_operand 1 "const_int_operand" "n"))]
7076 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7077 "j\t%0"
7078 [(set_attr "op_type" "RI")
7079 (set_attr "type" "branch")])
7080
7081 (define_insn "*sibcall_brcl"
7082 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7083 (match_operand 1 "const_int_operand" "n"))]
7084 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7085 "jg\t%0"
7086 [(set_attr "op_type" "RIL")
7087 (set_attr "type" "branch")])
7088
7089 ;
7090 ; sibcall_value patterns
7091 ;
7092
7093 (define_expand "sibcall_value"
7094 [(set (match_operand 0 "" "")
7095 (call (match_operand 1 "" "")
7096 (match_operand 2 "" "")))]
7097 ""
7098 {
7099 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX);
7100 DONE;
7101 })
7102
7103 (define_insn "*sibcall_value_br"
7104 [(set (match_operand 0 "" "")
7105 (call (mem:QI (reg 1))
7106 (match_operand 1 "const_int_operand" "n")))]
7107 "SIBLING_CALL_P (insn)
7108 && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
7109 "br\t%%r1"
7110 [(set_attr "op_type" "RR")
7111 (set_attr "type" "branch")
7112 (set_attr "atype" "agen")])
7113
7114 (define_insn "*sibcall_value_brc"
7115 [(set (match_operand 0 "" "")
7116 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7117 (match_operand 2 "const_int_operand" "n")))]
7118 "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC"
7119 "j\t%1"
7120 [(set_attr "op_type" "RI")
7121 (set_attr "type" "branch")])
7122
7123 (define_insn "*sibcall_value_brcl"
7124 [(set (match_operand 0 "" "")
7125 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7126 (match_operand 2 "const_int_operand" "n")))]
7127 "SIBLING_CALL_P (insn) && TARGET_CPU_ZARCH"
7128 "jg\t%1"
7129 [(set_attr "op_type" "RIL")
7130 (set_attr "type" "branch")])
7131
7132
7133 ;
7134 ; call instruction pattern(s).
7135 ;
7136
7137 (define_expand "call"
7138 [(call (match_operand 0 "" "")
7139 (match_operand 1 "" ""))
7140 (use (match_operand 2 "" ""))]
7141 ""
7142 {
7143 s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX,
7144 gen_rtx_REG (Pmode, RETURN_REGNUM));
7145 DONE;
7146 })
7147
7148 (define_insn "*bras"
7149 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7150 (match_operand 1 "const_int_operand" "n"))
7151 (clobber (match_operand 2 "register_operand" "=r"))]
7152 "!SIBLING_CALL_P (insn)
7153 && TARGET_SMALL_EXEC
7154 && GET_MODE (operands[2]) == Pmode"
7155 "bras\t%2,%0"
7156 [(set_attr "op_type" "RI")
7157 (set_attr "type" "jsr")])
7158
7159 (define_insn "*brasl"
7160 [(call (mem:QI (match_operand 0 "bras_sym_operand" "X"))
7161 (match_operand 1 "const_int_operand" "n"))
7162 (clobber (match_operand 2 "register_operand" "=r"))]
7163 "!SIBLING_CALL_P (insn)
7164 && TARGET_CPU_ZARCH
7165 && GET_MODE (operands[2]) == Pmode"
7166 "brasl\t%2,%0"
7167 [(set_attr "op_type" "RIL")
7168 (set_attr "type" "jsr")])
7169
7170 (define_insn "*basr"
7171 [(call (mem:QI (match_operand 0 "address_operand" "U"))
7172 (match_operand 1 "const_int_operand" "n"))
7173 (clobber (match_operand 2 "register_operand" "=r"))]
7174 "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
7175 {
7176 if (get_attr_op_type (insn) == OP_TYPE_RR)
7177 return "basr\t%2,%0";
7178 else
7179 return "bas\t%2,%a0";
7180 }
7181 [(set (attr "op_type")
7182 (if_then_else (match_operand 0 "register_operand" "")
7183 (const_string "RR") (const_string "RX")))
7184 (set_attr "type" "jsr")
7185 (set_attr "atype" "agen")])
7186
7187 ;
7188 ; call_value instruction pattern(s).
7189 ;
7190
7191 (define_expand "call_value"
7192 [(set (match_operand 0 "" "")
7193 (call (match_operand 1 "" "")
7194 (match_operand 2 "" "")))
7195 (use (match_operand 3 "" ""))]
7196 ""
7197 {
7198 s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0],
7199 gen_rtx_REG (Pmode, RETURN_REGNUM));
7200 DONE;
7201 })
7202
7203 (define_insn "*bras_r"
7204 [(set (match_operand 0 "" "")
7205 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7206 (match_operand:SI 2 "const_int_operand" "n")))
7207 (clobber (match_operand 3 "register_operand" "=r"))]
7208 "!SIBLING_CALL_P (insn)
7209 && TARGET_SMALL_EXEC
7210 && GET_MODE (operands[3]) == Pmode"
7211 "bras\t%3,%1"
7212 [(set_attr "op_type" "RI")
7213 (set_attr "type" "jsr")])
7214
7215 (define_insn "*brasl_r"
7216 [(set (match_operand 0 "" "")
7217 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7218 (match_operand 2 "const_int_operand" "n")))
7219 (clobber (match_operand 3 "register_operand" "=r"))]
7220 "!SIBLING_CALL_P (insn)
7221 && TARGET_CPU_ZARCH
7222 && GET_MODE (operands[3]) == Pmode"
7223 "brasl\t%3,%1"
7224 [(set_attr "op_type" "RIL")
7225 (set_attr "type" "jsr")])
7226
7227 (define_insn "*basr_r"
7228 [(set (match_operand 0 "" "")
7229 (call (mem:QI (match_operand 1 "address_operand" "U"))
7230 (match_operand 2 "const_int_operand" "n")))
7231 (clobber (match_operand 3 "register_operand" "=r"))]
7232 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7233 {
7234 if (get_attr_op_type (insn) == OP_TYPE_RR)
7235 return "basr\t%3,%1";
7236 else
7237 return "bas\t%3,%a1";
7238 }
7239 [(set (attr "op_type")
7240 (if_then_else (match_operand 1 "register_operand" "")
7241 (const_string "RR") (const_string "RX")))
7242 (set_attr "type" "jsr")
7243 (set_attr "atype" "agen")])
7244
7245 ;;
7246 ;;- Thread-local storage support.
7247 ;;
7248
7249 (define_insn "get_tp_64"
7250 [(set (match_operand:DI 0 "nonimmediate_operand" "=??d,Q")
7251 (unspec:DI [(const_int 0)] UNSPEC_TP))]
7252 "TARGET_64BIT"
7253 "@
7254 ear\t%0,%%a0\;sllg\t%0,%0,32\;ear\t%0,%%a1
7255 stam\t%%a0,%%a1,%0"
7256 [(set_attr "op_type" "NN,RS")
7257 (set_attr "atype" "reg,*")
7258 (set_attr "type" "o3,*")
7259 (set_attr "length" "14,*")])
7260
7261 (define_insn "get_tp_31"
7262 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,Q")
7263 (unspec:SI [(const_int 0)] UNSPEC_TP))]
7264 "!TARGET_64BIT"
7265 "@
7266 ear\t%0,%%a0
7267 stam\t%%a0,%%a0,%0"
7268 [(set_attr "op_type" "RRE,RS")])
7269
7270 (define_insn "set_tp_64"
7271 [(unspec_volatile [(match_operand:DI 0 "general_operand" "??d,Q")] UNSPECV_SET_TP)
7272 (clobber (match_scratch:SI 1 "=d,X"))]
7273 "TARGET_64BIT"
7274 "@
7275 sar\t%%a1,%0\;srlg\t%1,%0,32\;sar\t%%a0,%1
7276 lam\t%%a0,%%a1,%0"
7277 [(set_attr "op_type" "NN,RS")
7278 (set_attr "atype" "reg,*")
7279 (set_attr "type" "o3,*")
7280 (set_attr "length" "14,*")])
7281
7282 (define_insn "set_tp_31"
7283 [(unspec_volatile [(match_operand:SI 0 "general_operand" "d,Q")] UNSPECV_SET_TP)]
7284 "!TARGET_64BIT"
7285 "@
7286 sar\t%%a0,%0
7287 lam\t%%a0,%%a0,%0"
7288 [(set_attr "op_type" "RRE,RS")])
7289
7290 (define_insn "*tls_load_64"
7291 [(set (match_operand:DI 0 "register_operand" "=d")
7292 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
7293 (match_operand:DI 2 "" "")]
7294 UNSPEC_TLS_LOAD))]
7295 "TARGET_64BIT"
7296 "lg\t%0,%1%J2"
7297 [(set_attr "op_type" "RXE")])
7298
7299 (define_insn "*tls_load_31"
7300 [(set (match_operand:SI 0 "register_operand" "=d,d")
7301 (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T")
7302 (match_operand:SI 2 "" "")]
7303 UNSPEC_TLS_LOAD))]
7304 "!TARGET_64BIT"
7305 "@
7306 l\t%0,%1%J2
7307 ly\t%0,%1%J2"
7308 [(set_attr "op_type" "RX,RXY")])
7309
7310 (define_insn "*bras_tls"
7311 [(set (match_operand 0 "" "")
7312 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7313 (match_operand 2 "const_int_operand" "n")))
7314 (clobber (match_operand 3 "register_operand" "=r"))
7315 (use (match_operand 4 "" ""))]
7316 "!SIBLING_CALL_P (insn)
7317 && TARGET_SMALL_EXEC
7318 && GET_MODE (operands[3]) == Pmode"
7319 "bras\t%3,%1%J4"
7320 [(set_attr "op_type" "RI")
7321 (set_attr "type" "jsr")])
7322
7323 (define_insn "*brasl_tls"
7324 [(set (match_operand 0 "" "")
7325 (call (mem:QI (match_operand 1 "bras_sym_operand" "X"))
7326 (match_operand 2 "const_int_operand" "n")))
7327 (clobber (match_operand 3 "register_operand" "=r"))
7328 (use (match_operand 4 "" ""))]
7329 "!SIBLING_CALL_P (insn)
7330 && TARGET_CPU_ZARCH
7331 && GET_MODE (operands[3]) == Pmode"
7332 "brasl\t%3,%1%J4"
7333 [(set_attr "op_type" "RIL")
7334 (set_attr "type" "jsr")])
7335
7336 (define_insn "*basr_tls"
7337 [(set (match_operand 0 "" "")
7338 (call (mem:QI (match_operand 1 "address_operand" "U"))
7339 (match_operand 2 "const_int_operand" "n")))
7340 (clobber (match_operand 3 "register_operand" "=r"))
7341 (use (match_operand 4 "" ""))]
7342 "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
7343 {
7344 if (get_attr_op_type (insn) == OP_TYPE_RR)
7345 return "basr\t%3,%1%J4";
7346 else
7347 return "bas\t%3,%a1%J4";
7348 }
7349 [(set (attr "op_type")
7350 (if_then_else (match_operand 1 "register_operand" "")
7351 (const_string "RR") (const_string "RX")))
7352 (set_attr "type" "jsr")
7353 (set_attr "atype" "agen")])
7354
7355 ;;
7356 ;;- Miscellaneous instructions.
7357 ;;
7358
7359 ;
7360 ; allocate stack instruction pattern(s).
7361 ;
7362
7363 (define_expand "allocate_stack"
7364 [(set (reg 15)
7365 (plus (reg 15) (match_operand 1 "general_operand" "")))
7366 (set (match_operand 0 "general_operand" "")
7367 (reg 15))]
7368 "TARGET_BACKCHAIN"
7369 {
7370 rtx stack = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
7371 rtx chain = gen_rtx_MEM (Pmode, stack);
7372 rtx temp = gen_reg_rtx (Pmode);
7373
7374 emit_move_insn (temp, chain);
7375
7376 if (TARGET_64BIT)
7377 emit_insn (gen_adddi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7378 else
7379 emit_insn (gen_addsi3 (stack, stack, negate_rtx (Pmode, operands[1])));
7380
7381 emit_move_insn (chain, temp);
7382
7383 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7384 DONE;
7385 })
7386
7387
7388 ;
7389 ; setjmp instruction pattern.
7390 ;
7391
7392 (define_expand "builtin_setjmp_receiver"
7393 [(match_operand 0 "" "")]
7394 "flag_pic"
7395 {
7396 emit_insn (s390_load_got ());
7397 emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
7398 DONE;
7399 })
7400
7401 ;; These patterns say how to save and restore the stack pointer. We need not
7402 ;; save the stack pointer at function level since we are careful to
7403 ;; preserve the backchain. At block level, we have to restore the backchain
7404 ;; when we restore the stack pointer.
7405 ;;
7406 ;; For nonlocal gotos, we must save both the stack pointer and its
7407 ;; backchain and restore both. Note that in the nonlocal case, the
7408 ;; save area is a memory location.
7409
7410 (define_expand "save_stack_function"
7411 [(match_operand 0 "general_operand" "")
7412 (match_operand 1 "general_operand" "")]
7413 ""
7414 "DONE;")
7415
7416 (define_expand "restore_stack_function"
7417 [(match_operand 0 "general_operand" "")
7418 (match_operand 1 "general_operand" "")]
7419 ""
7420 "DONE;")
7421
7422 (define_expand "restore_stack_block"
7423 [(use (match_operand 0 "register_operand" ""))
7424 (set (match_dup 2) (match_dup 3))
7425 (set (match_dup 0) (match_operand 1 "register_operand" ""))
7426 (set (match_dup 3) (match_dup 2))]
7427 ""
7428 {
7429 operands[2] = gen_reg_rtx (Pmode);
7430 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
7431 })
7432
7433 (define_expand "save_stack_nonlocal"
7434 [(match_operand 0 "memory_operand" "")
7435 (match_operand 1 "register_operand" "")]
7436 ""
7437 {
7438 rtx temp = gen_reg_rtx (Pmode);
7439
7440 /* Copy the backchain to the first word, sp to the second and the literal pool
7441 base to the third. */
7442 emit_move_insn (operand_subword (operands[0], 2, 0,
7443 TARGET_64BIT ? OImode : TImode),
7444 gen_rtx_REG (Pmode, BASE_REGISTER));
7445 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
7446 emit_move_insn (operand_subword (operands[0], 0, 0,
7447 TARGET_64BIT ? OImode : TImode),
7448 temp);
7449 emit_move_insn (operand_subword (operands[0], 1, 0,
7450 TARGET_64BIT ? OImode : TImode),
7451 operands[1]);
7452 DONE;
7453 })
7454
7455 (define_expand "restore_stack_nonlocal"
7456 [(match_operand 0 "register_operand" "")
7457 (match_operand 1 "memory_operand" "")]
7458 ""
7459 {
7460 rtx temp = gen_reg_rtx (Pmode);
7461 rtx base = gen_rtx_REG (Pmode, BASE_REGISTER);
7462
7463 /* Restore the backchain from the first word, sp from the second and the
7464 literal pool base from the third. */
7465 emit_move_insn (temp,
7466 operand_subword (operands[1], 0, 0,
7467 TARGET_64BIT ? OImode : TImode));
7468 emit_move_insn (operands[0],
7469 operand_subword (operands[1], 1, 0,
7470 TARGET_64BIT ? OImode : TImode));
7471 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
7472 emit_move_insn (base,
7473 operand_subword (operands[1], 2, 0,
7474 TARGET_64BIT ? OImode : TImode));
7475 emit_insn (gen_rtx_USE (VOIDmode, base));
7476
7477 DONE;
7478 })
7479
7480
7481 ;
7482 ; nop instruction pattern(s).
7483 ;
7484
7485 (define_insn "nop"
7486 [(const_int 0)]
7487 ""
7488 "lr\t0,0"
7489 [(set_attr "op_type" "RR")])
7490
7491
7492 ;
7493 ; Special literal pool access instruction pattern(s).
7494 ;
7495
7496 (define_insn "*pool_entry"
7497 [(unspec_volatile [(match_operand 0 "consttable_operand" "X")]
7498 UNSPECV_POOL_ENTRY)]
7499 ""
7500 {
7501 enum machine_mode mode = GET_MODE (PATTERN (insn));
7502 unsigned int align = GET_MODE_BITSIZE (mode);
7503 s390_output_pool_entry (operands[0], mode, align);
7504 return "";
7505 }
7506 [(set_attr "op_type" "NN")
7507 (set (attr "length")
7508 (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))])
7509
7510 (define_insn "pool_start_31"
7511 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7512 "!TARGET_CPU_ZARCH"
7513 ".align\t4"
7514 [(set_attr "op_type" "NN")
7515 (set_attr "length" "2")])
7516
7517 (define_insn "pool_end_31"
7518 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7519 "!TARGET_CPU_ZARCH"
7520 ".align\t2"
7521 [(set_attr "op_type" "NN")
7522 (set_attr "length" "2")])
7523
7524 (define_insn "pool_start_64"
7525 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_START)]
7526 "TARGET_CPU_ZARCH"
7527 ".section\t.rodata\;.align\t8"
7528 [(set_attr "op_type" "NN")
7529 (set_attr "length" "0")])
7530
7531 (define_insn "pool_end_64"
7532 [(unspec_volatile [(const_int 0)] UNSPECV_POOL_END)]
7533 "TARGET_CPU_ZARCH"
7534 ".previous"
7535 [(set_attr "op_type" "NN")
7536 (set_attr "length" "0")])
7537
7538 (define_insn "main_base_31_small"
7539 [(set (match_operand 0 "register_operand" "=a")
7540 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7541 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7542 "basr\t%0,0"
7543 [(set_attr "op_type" "RR")
7544 (set_attr "type" "la")])
7545
7546 (define_insn "main_base_31_large"
7547 [(set (match_operand 0 "register_operand" "=a")
7548 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))
7549 (set (pc) (label_ref (match_operand 2 "" "")))]
7550 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7551 "bras\t%0,%2"
7552 [(set_attr "op_type" "RI")])
7553
7554 (define_insn "main_base_64"
7555 [(set (match_operand 0 "register_operand" "=a")
7556 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))]
7557 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7558 "larl\t%0,%1"
7559 [(set_attr "op_type" "RIL")
7560 (set_attr "type" "larl")])
7561
7562 (define_insn "main_pool"
7563 [(set (match_operand 0 "register_operand" "=a")
7564 (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))]
7565 "GET_MODE (operands[0]) == Pmode"
7566 "* abort ();"
7567 [(set_attr "op_type" "NN")])
7568
7569 (define_insn "reload_base_31"
7570 [(set (match_operand 0 "register_operand" "=a")
7571 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7572 "!TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7573 "basr\t%0,0\;la\t%0,%1-.(%0)"
7574 [(set_attr "op_type" "NN")
7575 (set_attr "type" "la")
7576 (set_attr "length" "6")])
7577
7578 (define_insn "reload_base_64"
7579 [(set (match_operand 0 "register_operand" "=a")
7580 (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))]
7581 "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode"
7582 "larl\t%0,%1"
7583 [(set_attr "op_type" "RIL")
7584 (set_attr "type" "larl")])
7585
7586 (define_insn "pool"
7587 [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)]
7588 ""
7589 "* abort ();"
7590 [(set_attr "op_type" "NN")
7591 (set (attr "length") (symbol_ref "INTVAL (operands[0])"))])
7592
7593 ;;
7594 ;; Insns related to generating the function prologue and epilogue.
7595 ;;
7596
7597
7598 (define_expand "prologue"
7599 [(use (const_int 0))]
7600 ""
7601 "s390_emit_prologue (); DONE;")
7602
7603 (define_insn "prologue_tpf"
7604 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_PROLOGUE)
7605 (clobber (reg:DI 1))]
7606 "TARGET_TPF_PROFILING"
7607 "bas\t%%r1,4064"
7608 [(set_attr "type" "jsr")
7609 (set_attr "op_type" "RX")])
7610
7611 (define_expand "epilogue"
7612 [(use (const_int 1))]
7613 ""
7614 "s390_emit_epilogue (false); DONE;")
7615
7616 (define_insn "epilogue_tpf"
7617 [(unspec_volatile [(const_int 0)] UNSPECV_TPF_EPILOGUE)
7618 (clobber (reg:DI 1))]
7619 "TARGET_TPF_PROFILING"
7620 "bas\t%%r1,4070"
7621 [(set_attr "type" "jsr")
7622 (set_attr "op_type" "RX")])
7623
7624
7625 (define_expand "sibcall_epilogue"
7626 [(use (const_int 0))]
7627 ""
7628 "s390_emit_epilogue (true); DONE;")
7629
7630 (define_insn "*return"
7631 [(return)
7632 (use (match_operand 0 "register_operand" "a"))]
7633 "GET_MODE (operands[0]) == Pmode"
7634 "br\t%0"
7635 [(set_attr "op_type" "RR")
7636 (set_attr "type" "jsr")
7637 (set_attr "atype" "agen")])
7638
7639
7640 ;; Instruction definition to extend a 31-bit pointer into a 64-bit
7641 ;; pointer. This is used for compatibility.
7642
7643 (define_expand "ptr_extend"
7644 [(set (match_operand:DI 0 "register_operand" "=r")
7645 (match_operand:SI 1 "register_operand" "r"))]
7646 "TARGET_64BIT"
7647 {
7648 emit_insn (gen_anddi3 (operands[0],
7649 gen_lowpart (DImode, operands[1]),
7650 GEN_INT (0x7fffffff)));
7651 DONE;
7652 })