]>
Commit | Line | Data |
---|---|---|
9db1d521 | 1 | ;;- Machine description for GNU compiler -- S/390 / zSeries version. |
a5544970 | 2 | ;; Copyright (C) 1999-2019 Free Software Foundation, Inc. |
9db1d521 | 3 | ;; Contributed by Hartmut Penner (hpenner@de.ibm.com) and |
963fc8d0 AK |
4 | ;; Ulrich Weigand (uweigand@de.ibm.com) and |
5 | ;; Andreas Krebbel (Andreas.Krebbel@de.ibm.com) | |
9db1d521 | 6 | |
58add37a UW |
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 | |
2f83c7d6 | 11 | ;; Software Foundation; either version 3, or (at your option) any later |
58add37a UW |
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. | |
9db1d521 HP |
18 | |
19 | ;; You should have received a copy of the GNU General Public License | |
2f83c7d6 NC |
20 | ;; along with GCC; see the file COPYING3. If not see |
21 | ;; <http://www.gnu.org/licenses/>. | |
9db1d521 HP |
22 | |
23 | ;; | |
cd8dc1f9 | 24 | ;; See constraints.md for a description of constraints specific to s390. |
9db1d521 | 25 | ;; |
cd8dc1f9 | 26 | |
9db1d521 HP |
27 | ;; Special formats used for outputting 390 instructions. |
28 | ;; | |
f19a9af7 AK |
29 | ;; %C: print opcode suffix for branch condition. |
30 | ;; %D: print opcode suffix for inverse branch condition. | |
31 | ;; %J: print tls_load/tls_gdcall/tls_ldcall suffix | |
da48f5ec | 32 | ;; %G: print the size of the operand in bytes. |
f19a9af7 AK |
33 | ;; %O: print only the displacement of a memory reference. |
34 | ;; %R: print only the base register of a memory reference. | |
fc0ea003 | 35 | ;; %S: print S-type memory reference (base+displacement). |
f19a9af7 AK |
36 | ;; %N: print the second word of a DImode operand. |
37 | ;; %M: print the second word of a TImode operand. | |
da48f5ec | 38 | ;; %Y: print shift count operand. |
f4aa3848 | 39 | ;; |
f19a9af7 | 40 | ;; %b: print integer X as if it's an unsigned byte. |
963fc8d0 | 41 | ;; %c: print integer X as if it's an signed byte. |
da48f5ec AK |
42 | ;; %x: print integer X as if it's an unsigned halfword. |
43 | ;; %h: print integer X as if it's a signed halfword. | |
44 | ;; %i: print the first nonzero HImode part of X. | |
45 | ;; %j: print the first HImode part unequal to -1 of X. | |
46 | ;; %k: print the first nonzero SImode part of X. | |
47 | ;; %m: print the first SImode part unequal to -1 of X. | |
48 | ;; %o: print integer X as if it's an unsigned 32bit word. | |
9db1d521 HP |
49 | ;; |
50 | ;; We have a special constraint for pattern matching. | |
51 | ;; | |
52 | ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction. | |
53 | ;; | |
9db1d521 | 54 | |
fd3cd001 UW |
55 | ;; |
56 | ;; UNSPEC usage | |
57 | ;; | |
58 | ||
30a49b23 AK |
59 | (define_c_enum "unspec" [ |
60 | ; Miscellaneous | |
61 | UNSPEC_ROUND | |
30a49b23 AK |
62 | UNSPEC_ICM |
63 | UNSPEC_TIE | |
10bbf137 | 64 | |
5a3fe9b6 AK |
65 | ; Convert CC into a str comparison result and copy it into an |
66 | ; integer register | |
67 | ; cc0->0, cc1->1, cc2->-1, (cc3->-1) | |
68 | UNSPEC_STRCMPCC_TO_INT | |
69 | ||
70 | ; Copy CC as is into the lower 2 bits of an integer register | |
71 | UNSPEC_CC_TO_INT | |
72 | ||
da0dcab1 DV |
73 | ; The right hand side of an setmem |
74 | UNSPEC_REPLICATE_BYTE | |
75 | ||
10bbf137 | 76 | ; GOT/PLT and lt-relative accesses |
30a49b23 | 77 | UNSPEC_LTREL_OFFSET |
30a49b23 AK |
78 | UNSPEC_POOL_OFFSET |
79 | UNSPEC_GOTENT | |
80 | UNSPEC_GOT | |
81 | UNSPEC_GOTOFF | |
82 | UNSPEC_PLT | |
83 | UNSPEC_PLTOFF | |
fd7643fb UW |
84 | |
85 | ; Literal pool | |
30a49b23 AK |
86 | UNSPEC_RELOAD_BASE |
87 | UNSPEC_MAIN_BASE | |
88 | UNSPEC_LTREF | |
89 | UNSPEC_INSN | |
90 | UNSPEC_EXECUTE | |
84b4c7b5 | 91 | UNSPEC_EXECUTE_JUMP |
fd7643fb | 92 | |
1a8c13b3 | 93 | ; Atomic Support |
30a49b23 | 94 | UNSPEC_MB |
78ce265b | 95 | UNSPEC_MOVA |
1a8c13b3 | 96 | |
fd7643fb | 97 | ; TLS relocation specifiers |
30a49b23 AK |
98 | UNSPEC_TLSGD |
99 | UNSPEC_TLSLDM | |
100 | UNSPEC_NTPOFF | |
101 | UNSPEC_DTPOFF | |
102 | UNSPEC_GOTNTPOFF | |
103 | UNSPEC_INDNTPOFF | |
fd3cd001 UW |
104 | |
105 | ; TLS support | |
30a49b23 AK |
106 | UNSPEC_TLSLDM_NTPOFF |
107 | UNSPEC_TLS_LOAD | |
91d39d71 UW |
108 | |
109 | ; String Functions | |
30a49b23 AK |
110 | UNSPEC_SRST |
111 | UNSPEC_MVST | |
638e37c2 | 112 | |
7b8acc34 | 113 | ; Stack Smashing Protector |
30a49b23 AK |
114 | UNSPEC_SP_SET |
115 | UNSPEC_SP_TEST | |
85dae55a | 116 | |
4cb4721f MK |
117 | ; Split stack support |
118 | UNSPEC_STACK_CHECK | |
119 | ||
638e37c2 | 120 | ; Test Data Class (TDC) |
30a49b23 | 121 | UNSPEC_TDC_INSN |
65b1d8ea | 122 | |
25cb5165 | 123 | ; Byte-wise Population Count |
30a49b23 AK |
124 | UNSPEC_POPCNT |
125 | UNSPEC_COPYSIGN | |
d12a76f3 AK |
126 | |
127 | ; Load FP Integer | |
128 | UNSPEC_FPINT_FLOOR | |
129 | UNSPEC_FPINT_BTRUNC | |
130 | UNSPEC_FPINT_ROUND | |
131 | UNSPEC_FPINT_CEIL | |
132 | UNSPEC_FPINT_NEARBYINT | |
133 | UNSPEC_FPINT_RINT | |
085261c8 | 134 | |
3af82a61 AK |
135 | UNSPEC_LCBB |
136 | ||
085261c8 | 137 | ; Vector |
3af82a61 AK |
138 | UNSPEC_VEC_SMULT_HI |
139 | UNSPEC_VEC_UMULT_HI | |
140 | UNSPEC_VEC_SMULT_LO | |
085261c8 AK |
141 | UNSPEC_VEC_SMULT_EVEN |
142 | UNSPEC_VEC_UMULT_EVEN | |
143 | UNSPEC_VEC_SMULT_ODD | |
144 | UNSPEC_VEC_UMULT_ODD | |
3af82a61 AK |
145 | |
146 | UNSPEC_VEC_VMAL | |
147 | UNSPEC_VEC_VMAH | |
148 | UNSPEC_VEC_VMALH | |
149 | UNSPEC_VEC_VMAE | |
150 | UNSPEC_VEC_VMALE | |
151 | UNSPEC_VEC_VMAO | |
152 | UNSPEC_VEC_VMALO | |
153 | ||
154 | UNSPEC_VEC_GATHER | |
155 | UNSPEC_VEC_EXTRACT | |
156 | UNSPEC_VEC_INSERT_AND_ZERO | |
157 | UNSPEC_VEC_LOAD_BNDRY | |
085261c8 | 158 | UNSPEC_VEC_LOAD_LEN |
76794c52 | 159 | UNSPEC_VEC_LOAD_LEN_R |
3af82a61 AK |
160 | UNSPEC_VEC_MERGEH |
161 | UNSPEC_VEC_MERGEL | |
162 | UNSPEC_VEC_PACK | |
163 | UNSPEC_VEC_PACK_SATURATE | |
164 | UNSPEC_VEC_PACK_SATURATE_CC | |
165 | UNSPEC_VEC_PACK_SATURATE_GENCC | |
166 | UNSPEC_VEC_PACK_UNSIGNED_SATURATE | |
167 | UNSPEC_VEC_PACK_UNSIGNED_SATURATE_CC | |
168 | UNSPEC_VEC_PACK_UNSIGNED_SATURATE_GENCC | |
169 | UNSPEC_VEC_PERM | |
170 | UNSPEC_VEC_PERMI | |
171 | UNSPEC_VEC_EXTEND | |
172 | UNSPEC_VEC_STORE_LEN | |
76794c52 AK |
173 | UNSPEC_VEC_STORE_LEN_R |
174 | UNSPEC_VEC_VBPERM | |
3af82a61 AK |
175 | UNSPEC_VEC_UNPACKH |
176 | UNSPEC_VEC_UNPACKH_L | |
177 | UNSPEC_VEC_UNPACKL | |
178 | UNSPEC_VEC_UNPACKL_L | |
179 | UNSPEC_VEC_ADDC | |
3af82a61 AK |
180 | UNSPEC_VEC_ADDE_U128 |
181 | UNSPEC_VEC_ADDEC_U128 | |
182 | UNSPEC_VEC_AVG | |
183 | UNSPEC_VEC_AVGU | |
184 | UNSPEC_VEC_CHECKSUM | |
185 | UNSPEC_VEC_GFMSUM | |
186 | UNSPEC_VEC_GFMSUM_128 | |
187 | UNSPEC_VEC_GFMSUM_ACCUM | |
188 | UNSPEC_VEC_GFMSUM_ACCUM_128 | |
189 | UNSPEC_VEC_SET | |
190 | ||
191 | UNSPEC_VEC_VSUMG | |
192 | UNSPEC_VEC_VSUMQ | |
193 | UNSPEC_VEC_VSUM | |
194 | UNSPEC_VEC_RL_MASK | |
195 | UNSPEC_VEC_SLL | |
196 | UNSPEC_VEC_SLB | |
ad7a3e39 AK |
197 | UNSPEC_VEC_SLDBYTE |
198 | UNSPEC_VEC_SLDBIT | |
199 | UNSPEC_VEC_SRDBIT | |
3af82a61 AK |
200 | UNSPEC_VEC_SRAL |
201 | UNSPEC_VEC_SRAB | |
202 | UNSPEC_VEC_SRL | |
203 | UNSPEC_VEC_SRLB | |
204 | ||
3af82a61 | 205 | UNSPEC_VEC_SUBC |
3af82a61 AK |
206 | UNSPEC_VEC_SUBE_U128 |
207 | UNSPEC_VEC_SUBEC_U128 | |
208 | ||
209 | UNSPEC_VEC_TEST_MASK | |
210 | ||
211 | UNSPEC_VEC_VFAE | |
212 | UNSPEC_VEC_VFAECC | |
213 | ||
214 | UNSPEC_VEC_VFEE | |
215 | UNSPEC_VEC_VFEECC | |
085261c8 AK |
216 | UNSPEC_VEC_VFENE |
217 | UNSPEC_VEC_VFENECC | |
3af82a61 AK |
218 | |
219 | UNSPEC_VEC_VISTR | |
220 | UNSPEC_VEC_VISTRCC | |
221 | ||
222 | UNSPEC_VEC_VSTRC | |
223 | UNSPEC_VEC_VSTRCCC | |
224 | ||
49adc461 AK |
225 | UNSPEC_VEC_VSTRS |
226 | UNSPEC_VEC_VSTRSCC | |
227 | ||
3af82a61 AK |
228 | UNSPEC_VEC_VCDGB |
229 | UNSPEC_VEC_VCDLGB | |
230 | ||
231 | UNSPEC_VEC_VCGDB | |
232 | UNSPEC_VEC_VCLGDB | |
233 | ||
76794c52 | 234 | UNSPEC_VEC_VFI |
3af82a61 | 235 | |
76794c52 AK |
236 | UNSPEC_VEC_VFLL ; vector fp load lengthened |
237 | UNSPEC_VEC_VFLR ; vector fp load rounded | |
3af82a61 | 238 | |
76794c52 AK |
239 | UNSPEC_VEC_VFTCI |
240 | UNSPEC_VEC_VFTCICC | |
241 | ||
242 | UNSPEC_VEC_MSUM | |
243 | ||
244 | UNSPEC_VEC_VFMIN | |
245 | UNSPEC_VEC_VFMAX | |
3278804e AK |
246 | |
247 | UNSPEC_VEC_ELTSWAP | |
085261c8 | 248 | ]) |
fd3cd001 UW |
249 | |
250 | ;; | |
251 | ;; UNSPEC_VOLATILE usage | |
252 | ;; | |
253 | ||
30a49b23 AK |
254 | (define_c_enum "unspecv" [ |
255 | ; Blockage | |
256 | UNSPECV_BLOCKAGE | |
10bbf137 | 257 | |
2f7e5a0d | 258 | ; TPF Support |
30a49b23 AK |
259 | UNSPECV_TPF_PROLOGUE |
260 | UNSPECV_TPF_EPILOGUE | |
2f7e5a0d | 261 | |
10bbf137 | 262 | ; Literal pool |
30a49b23 AK |
263 | UNSPECV_POOL |
264 | UNSPECV_POOL_SECTION | |
265 | UNSPECV_POOL_ALIGN | |
266 | UNSPECV_POOL_ENTRY | |
267 | UNSPECV_MAIN_POOL | |
fd7643fb UW |
268 | |
269 | ; TLS support | |
30a49b23 | 270 | UNSPECV_SET_TP |
e0374221 AS |
271 | |
272 | ; Atomic Support | |
30a49b23 AK |
273 | UNSPECV_CAS |
274 | UNSPECV_ATOMIC_OP | |
5a3fe9b6 | 275 | |
aad98a61 AK |
276 | ; Non-branch nops used for compare-and-branch adjustments on z10 |
277 | UNSPECV_NOP_LR_0 | |
278 | UNSPECV_NOP_LR_1 | |
279 | ||
f8af0e30 DV |
280 | ; Hotpatching (unremovable NOPs) |
281 | UNSPECV_NOP_2_BYTE | |
282 | UNSPECV_NOP_4_BYTE | |
283 | UNSPECV_NOP_6_BYTE | |
284 | ||
5a3fe9b6 AK |
285 | ; Transactional Execution support |
286 | UNSPECV_TBEGIN | |
2561451d | 287 | UNSPECV_TBEGIN_TDB |
5a3fe9b6 AK |
288 | UNSPECV_TBEGINC |
289 | UNSPECV_TEND | |
290 | UNSPECV_TABORT | |
291 | UNSPECV_ETND | |
292 | UNSPECV_NTSTG | |
293 | UNSPECV_PPA | |
004f64e1 AK |
294 | |
295 | ; Set and get floating point control register | |
296 | UNSPECV_SFPC | |
297 | UNSPECV_EFPC | |
4cb4721f MK |
298 | |
299 | ; Split stack support | |
300 | UNSPECV_SPLIT_STACK_CALL | |
301 | UNSPECV_SPLIT_STACK_DATA | |
539405d5 AK |
302 | |
303 | UNSPECV_OSC_BREAK | |
fd3cd001 UW |
304 | ]) |
305 | ||
ae156f85 AS |
306 | ;; |
307 | ;; Registers | |
308 | ;; | |
309 | ||
35dd9a0e AK |
310 | ; Registers with special meaning |
311 | ||
ae156f85 AS |
312 | (define_constants |
313 | [ | |
314 | ; Sibling call register. | |
315 | (SIBCALL_REGNUM 1) | |
84b4c7b5 AK |
316 | ; A call-clobbered reg which can be used in indirect branch thunks |
317 | (INDIRECT_BRANCH_THUNK_REGNUM 1) | |
ae156f85 AS |
318 | ; Literal pool base register. |
319 | (BASE_REGNUM 13) | |
320 | ; Return address register. | |
321 | (RETURN_REGNUM 14) | |
82c6f58a AK |
322 | ; Stack pointer register. |
323 | (STACK_REGNUM 15) | |
ae156f85 AS |
324 | ; Condition code register. |
325 | (CC_REGNUM 33) | |
f4aa3848 | 326 | ; Thread local storage pointer register. |
ae156f85 AS |
327 | (TP_REGNUM 36) |
328 | ]) | |
329 | ||
35dd9a0e AK |
330 | ; Hardware register names |
331 | ||
332 | (define_constants | |
333 | [ | |
334 | ; General purpose registers | |
335 | (GPR0_REGNUM 0) | |
af344a30 | 336 | (GPR1_REGNUM 1) |
82379bdf AK |
337 | (GPR2_REGNUM 2) |
338 | (GPR6_REGNUM 6) | |
35dd9a0e AK |
339 | ; Floating point registers. |
340 | (FPR0_REGNUM 16) | |
2cf4c39e AK |
341 | (FPR1_REGNUM 20) |
342 | (FPR2_REGNUM 17) | |
343 | (FPR3_REGNUM 21) | |
344 | (FPR4_REGNUM 18) | |
345 | (FPR5_REGNUM 22) | |
346 | (FPR6_REGNUM 19) | |
347 | (FPR7_REGNUM 23) | |
348 | (FPR8_REGNUM 24) | |
349 | (FPR9_REGNUM 28) | |
350 | (FPR10_REGNUM 25) | |
351 | (FPR11_REGNUM 29) | |
352 | (FPR12_REGNUM 26) | |
353 | (FPR13_REGNUM 30) | |
354 | (FPR14_REGNUM 27) | |
355 | (FPR15_REGNUM 31) | |
085261c8 AK |
356 | (VR0_REGNUM 16) |
357 | (VR16_REGNUM 38) | |
358 | (VR23_REGNUM 45) | |
359 | (VR24_REGNUM 46) | |
360 | (VR31_REGNUM 53) | |
35dd9a0e AK |
361 | ]) |
362 | ||
ae8e301e AK |
363 | ; Rounding modes for binary floating point numbers |
364 | (define_constants | |
365 | [(BFP_RND_CURRENT 0) | |
366 | (BFP_RND_NEAREST_TIE_AWAY_FROM_0 1) | |
367 | (BFP_RND_PREP_FOR_SHORT_PREC 3) | |
368 | (BFP_RND_NEAREST_TIE_TO_EVEN 4) | |
369 | (BFP_RND_TOWARD_0 5) | |
370 | (BFP_RND_TOWARD_INF 6) | |
371 | (BFP_RND_TOWARD_MINF 7)]) | |
372 | ||
373 | ; Rounding modes for decimal floating point numbers | |
374 | ; 1-7 were introduced with the floating point extension facility | |
375 | ; available with z196 | |
376 | ; With these rounding modes (1-7) a quantum exception might occur | |
377 | ; which is suppressed for the other modes. | |
378 | (define_constants | |
379 | [(DFP_RND_CURRENT 0) | |
380 | (DFP_RND_NEAREST_TIE_AWAY_FROM_0_QUANTEXC 1) | |
381 | (DFP_RND_CURRENT_QUANTEXC 2) | |
382 | (DFP_RND_PREP_FOR_SHORT_PREC_QUANTEXC 3) | |
383 | (DFP_RND_NEAREST_TIE_TO_EVEN_QUANTEXC 4) | |
384 | (DFP_RND_TOWARD_0_QUANTEXC 5) | |
385 | (DFP_RND_TOWARD_INF_QUANTEXC 6) | |
386 | (DFP_RND_TOWARD_MINF_QUANTEXC 7) | |
387 | (DFP_RND_NEAREST_TIE_TO_EVEN 8) | |
388 | (DFP_RND_TOWARD_0 9) | |
389 | (DFP_RND_TOWARD_INF 10) | |
390 | (DFP_RND_TOWARD_MINF 11) | |
391 | (DFP_RND_NEAREST_TIE_AWAY_FROM_0 12) | |
392 | (DFP_RND_NEAREST_TIE_TO_0 13) | |
393 | (DFP_RND_AWAY_FROM_0 14) | |
394 | (DFP_RND_PREP_FOR_SHORT_PREC 15)]) | |
395 | ||
35dd9a0e AK |
396 | ;; |
397 | ;; PFPO GPR0 argument format | |
398 | ;; | |
399 | ||
400 | (define_constants | |
401 | [ | |
402 | ; PFPO operation type | |
403 | (PFPO_CONVERT 0x1000000) | |
404 | ; PFPO operand types | |
405 | (PFPO_OP_TYPE_SF 0x5) | |
406 | (PFPO_OP_TYPE_DF 0x6) | |
407 | (PFPO_OP_TYPE_TF 0x7) | |
408 | (PFPO_OP_TYPE_SD 0x8) | |
409 | (PFPO_OP_TYPE_DD 0x9) | |
410 | (PFPO_OP_TYPE_TD 0xa) | |
411 | ; Bitposition of operand types | |
412 | (PFPO_OP0_TYPE_SHIFT 16) | |
413 | (PFPO_OP1_TYPE_SHIFT 8) | |
ced8d882 AK |
414 | ; Decide whether current DFP or BFD rounding mode should be used |
415 | ; for the conversion. | |
416 | (PFPO_RND_MODE_DFP 0) | |
417 | (PFPO_RND_MODE_BFP 1) | |
35dd9a0e AK |
418 | ]) |
419 | ||
291a9e98 AK |
420 | ;; PPA constants |
421 | ||
422 | ; Immediate values which can be used as the third operand to the | |
423 | ; perform processor assist instruction | |
424 | ||
425 | (define_constants | |
426 | [(PPA_TX_ABORT 1) | |
427 | (PPA_OOO_BARRIER 15)]) | |
428 | ||
5a3fe9b6 AK |
429 | ; Immediate operands for tbegin and tbeginc |
430 | (define_constants [(TBEGIN_MASK 65292)]) ; 0xff0c | |
431 | (define_constants [(TBEGINC_MASK 65288)]) ; 0xff08 | |
fd3cd001 | 432 | |
29a74354 UW |
433 | ;; Instruction operand type as used in the Principles of Operation. |
434 | ;; Used to determine defaults for length and other attribute values. | |
1fec52be | 435 | |
29a74354 | 436 | (define_attr "op_type" |
76794c52 | 437 | "NN,E,RR,RRE,RX,RS,RSI,RI,SI,S,SS,SSE,RXE,RSE,RIL,RIE,RXY,RSY,SIY,RRF,SIL,RRS,RIS,VRI,VRR,VRS,VRV,VRX,VSI" |
b628bd8e | 438 | (const_string "NN")) |
9db1d521 | 439 | |
29a74354 | 440 | ;; Instruction type attribute used for scheduling. |
9db1d521 | 441 | |
077dab3b | 442 | (define_attr "type" "none,integer,load,lr,la,larl,lm,stm, |
e0374221 | 443 | cs,vs,store,sem,idiv, |
ed0e512a | 444 | imulhi,imulsi,imuldi, |
2cdece44 | 445 | branch,jsr,fsimptf,fsimpdf,fsimpsf,fhex, |
f61a2c7d AK |
446 | floadtf,floaddf,floadsf,fstoredf,fstoresf, |
447 | fmultf,fmuldf,fmulsf,fdivtf,fdivdf,fdivsf, | |
9381e3f1 | 448 | ftoi,fsqrttf,fsqrtdf,fsqrtsf, |
65b1d8ea | 449 | fmadddf,fmaddsf, |
9381e3f1 WG |
450 | ftrunctf,ftruncdf, ftruncsd, ftruncdd, |
451 | itoftf, itofdf, itofsf, itofdd, itoftd, | |
452 | fdivdd, fdivtd, floaddd, floadsd, fmuldd, fmultd, | |
453 | fsimpdd, fsimpsd, fsimptd, fstoredd, fstoresd, | |
454 | ftoidfp, other" | |
29a74354 UW |
455 | (cond [(eq_attr "op_type" "NN") (const_string "other") |
456 | (eq_attr "op_type" "SS") (const_string "cs")] | |
457 | (const_string "integer"))) | |
9db1d521 | 458 | |
29a74354 UW |
459 | ;; Another attribute used for scheduling purposes: |
460 | ;; agen: Instruction uses the address generation unit | |
461 | ;; reg: Instruction does not use the agen unit | |
077dab3b HP |
462 | |
463 | (define_attr "atype" "agen,reg" | |
62d3f261 | 464 | (if_then_else (eq_attr "op_type" "E,RR,RI,RRE,RSI,RIL,RIE,RRF") |
0101708c AS |
465 | (const_string "reg") |
466 | (const_string "agen"))) | |
9db1d521 | 467 | |
9381e3f1 WG |
468 | ;; Properties concerning Z10 execution grouping and value forwarding. |
469 | ;; z10_super: instruction is superscalar. | |
470 | ;; z10_super_c: instruction is superscalar and meets the condition of z10_c. | |
471 | ;; z10_fwd: The instruction reads the value of an operand and stores it into a | |
472 | ;; target register. It can forward this value to a second instruction that reads | |
473 | ;; the same register if that second instruction is issued in the same group. | |
474 | ;; z10_rec: The instruction is in the T pipeline and reads a register. If the | |
475 | ;; instruction in the S pipe writes to the register, then the T instruction | |
476 | ;; can immediately read the new value. | |
477 | ;; z10_fr: union of Z10_fwd and z10_rec. | |
478 | ;; z10_c: second operand of instruction is a register and read with complemented bits. | |
9381e3f1 WG |
479 | ;; |
480 | ;; An additional suffix A1, A3, or E1 indicates the respective AGI bypass. | |
481 | ||
482 | ||
483 | (define_attr "z10prop" "none, | |
484 | z10_super, z10_super_E1, z10_super_A1, z10_super_c, z10_super_c_E1, | |
485 | z10_fwd, z10_fwd_A1, z10_fwd_A3, z10_fwd_E1, | |
486 | z10_rec, | |
487 | z10_fr, z10_fr_A3, z10_fr_E1, | |
e3cba5e5 | 488 | z10_c" |
9381e3f1 WG |
489 | (const_string "none")) |
490 | ||
65b1d8ea AK |
491 | ;; Properties concerning Z196 decoding |
492 | ;; z196_alone: must group alone | |
493 | ;; z196_end: ends a group | |
494 | ;; z196_cracked: instruction is cracked or expanded | |
495 | (define_attr "z196prop" "none, | |
496 | z196_alone, z196_ends, | |
497 | z196_cracked" | |
498 | (const_string "none")) | |
9381e3f1 | 499 | |
84b4c7b5 AK |
500 | ; mnemonics which only get defined through if_then_else currently |
501 | ; don't get added to the list values automatically and hence need to | |
502 | ; be listed here. | |
8cc6307c | 503 | (define_attr "mnemonic" "b,bas,basr,bc,bcr_flush,unknown" (const_string "unknown")) |
22ac2c2f | 504 | |
9db1d521 HP |
505 | ;; Length in bytes. |
506 | ||
507 | (define_attr "length" "" | |
62d3f261 AK |
508 | (cond [(eq_attr "op_type" "E,RR") (const_int 2) |
509 | (eq_attr "op_type" "RX,RI,RRE,RS,RSI,S,SI,RRF") (const_int 4)] | |
b628bd8e | 510 | (const_int 6))) |
9db1d521 | 511 | |
29a74354 UW |
512 | |
513 | ;; Processor type. This attribute must exactly match the processor_type | |
52d4aa4f | 514 | ;; enumeration in s390.h. |
29a74354 | 515 | |
375a6bc6 | 516 | (define_attr "cpu" "z900,z990,z9_109,z9_ec,z10,z196,zEC12,z13,z14,arch13" |
90c6fd8a | 517 | (const (symbol_ref "s390_tune_attr"))) |
29a74354 | 518 | |
b5e0425c | 519 | (define_attr "cpu_facility" |
511ea153 | 520 | "standard,ieee,zarch,cpu_zarch,longdisp,extimm,dfp,z10,z196,zEC12,vx,z13,z14,vxe,arch13,vxe2" |
3af8e996 AK |
521 | (const_string "standard")) |
522 | ||
523 | (define_attr "enabled" "" | |
524 | (cond [(eq_attr "cpu_facility" "standard") | |
525 | (const_int 1) | |
526 | ||
527 | (and (eq_attr "cpu_facility" "ieee") | |
d7f99b2c | 528 | (match_test "TARGET_CPU_IEEE_FLOAT")) |
3af8e996 AK |
529 | (const_int 1) |
530 | ||
531 | (and (eq_attr "cpu_facility" "zarch") | |
d7f99b2c | 532 | (match_test "TARGET_ZARCH")) |
3af8e996 AK |
533 | (const_int 1) |
534 | ||
535 | (and (eq_attr "cpu_facility" "longdisp") | |
d7f99b2c | 536 | (match_test "TARGET_LONG_DISPLACEMENT")) |
3af8e996 AK |
537 | (const_int 1) |
538 | ||
539 | (and (eq_attr "cpu_facility" "extimm") | |
d7f99b2c | 540 | (match_test "TARGET_EXTIMM")) |
3af8e996 AK |
541 | (const_int 1) |
542 | ||
543 | (and (eq_attr "cpu_facility" "dfp") | |
d7f99b2c | 544 | (match_test "TARGET_DFP")) |
93538e8e AK |
545 | (const_int 1) |
546 | ||
8cc6307c | 547 | (eq_attr "cpu_facility" "cpu_zarch") |
b5e0425c AK |
548 | (const_int 1) |
549 | ||
93538e8e | 550 | (and (eq_attr "cpu_facility" "z10") |
d7f99b2c | 551 | (match_test "TARGET_Z10")) |
65b1d8ea AK |
552 | (const_int 1) |
553 | ||
554 | (and (eq_attr "cpu_facility" "z196") | |
d7f99b2c | 555 | (match_test "TARGET_Z196")) |
22ac2c2f AK |
556 | (const_int 1) |
557 | ||
558 | (and (eq_attr "cpu_facility" "zEC12") | |
559 | (match_test "TARGET_ZEC12")) | |
55ac540c AK |
560 | (const_int 1) |
561 | ||
285363a1 | 562 | (and (eq_attr "cpu_facility" "vx") |
55ac540c | 563 | (match_test "TARGET_VX")) |
bf749919 DV |
564 | (const_int 1) |
565 | ||
566 | (and (eq_attr "cpu_facility" "z13") | |
567 | (match_test "TARGET_Z13")) | |
568 | (const_int 1) | |
6654e96f | 569 | |
e9e8efc9 AK |
570 | (and (eq_attr "cpu_facility" "z14") |
571 | (match_test "TARGET_Z14")) | |
6654e96f AK |
572 | (const_int 1) |
573 | ||
574 | (and (eq_attr "cpu_facility" "vxe") | |
575 | (match_test "TARGET_VXE")) | |
576 | (const_int 1) | |
511ea153 AK |
577 | |
578 | (and (eq_attr "cpu_facility" "arch13") | |
579 | (match_test "TARGET_ARCH13")) | |
580 | (const_int 1) | |
581 | ||
582 | (and (eq_attr "cpu_facility" "vxe2") | |
583 | (match_test "TARGET_VXE2")) | |
584 | (const_int 1) | |
bf749919 | 585 | ] |
3af8e996 AK |
586 | (const_int 0))) |
587 | ||
14cfceb7 IL |
588 | ;; Whether an instruction supports relative long addressing. |
589 | ;; Currently this corresponds to RIL-b and RIL-c instruction formats, | |
590 | ;; but having a separate attribute, as opposed to reusing op_type, | |
591 | ;; provides additional flexibility. | |
592 | ||
593 | (define_attr "relative_long" "no,yes" (const_string "no")) | |
594 | ||
52d4aa4f | 595 | ;; Pipeline description for z900. |
29a74354 UW |
596 | (include "2064.md") |
597 | ||
3443392a | 598 | ;; Pipeline description for z990, z9-109 and z9-ec. |
29a74354 UW |
599 | (include "2084.md") |
600 | ||
9381e3f1 WG |
601 | ;; Pipeline description for z10 |
602 | (include "2097.md") | |
603 | ||
65b1d8ea AK |
604 | ;; Pipeline description for z196 |
605 | (include "2817.md") | |
606 | ||
22ac2c2f AK |
607 | ;; Pipeline description for zEC12 |
608 | (include "2827.md") | |
609 | ||
23902021 AK |
610 | ;; Pipeline description for z13 |
611 | (include "2964.md") | |
612 | ||
ff99338c RD |
613 | ;; Pipeline description for z14 |
614 | (include "3906.md") | |
615 | ||
375a6bc6 RD |
616 | ;; Pipeline description for arch13 |
617 | (include "8561.md") | |
618 | ||
0bfc3f69 AS |
619 | ;; Predicates |
620 | (include "predicates.md") | |
621 | ||
cd8dc1f9 WG |
622 | ;; Constraint definitions |
623 | (include "constraints.md") | |
624 | ||
a8ba31f2 EC |
625 | ;; Other includes |
626 | (include "tpf.md") | |
f52c81dd | 627 | |
3abcb3a7 | 628 | ;; Iterators |
f52c81dd | 629 | |
085261c8 AK |
630 | (define_mode_iterator ALL [TI DI SI HI QI TF DF SF TD DD SD V1QI V2QI V4QI V8QI V16QI V1HI V2HI V4HI V8HI V1SI V2SI V4SI V1DI V2DI V1SF V2SF V4SF V1TI V1DF V2DF V1TF]) |
631 | ||
3abcb3a7 | 632 | ;; These mode iterators allow floating point patterns to be generated from the |
f5905b37 | 633 | ;; same template. |
f4aa3848 | 634 | (define_mode_iterator FP_ALL [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP") |
0387c142 | 635 | (SD "TARGET_HARD_DFP")]) |
3abcb3a7 HPN |
636 | (define_mode_iterator FP [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")]) |
637 | (define_mode_iterator BFP [TF DF SF]) | |
638 | (define_mode_iterator DFP [TD DD]) | |
639 | (define_mode_iterator DFP_ALL [TD DD SD]) | |
640 | (define_mode_iterator DSF [DF SF]) | |
641 | (define_mode_iterator SD_SF [SF SD]) | |
642 | (define_mode_iterator DD_DF [DF DD]) | |
643 | (define_mode_iterator TD_TF [TF TD]) | |
644 | ||
026bfe89 AK |
645 | ; 32 bit int<->fp conversion instructions are available since VXE2 (arch13). |
646 | (define_mode_iterator VX_CONV_BFP [DF (SF "TARGET_VXE2")]) | |
647 | (define_mode_iterator VX_CONV_INT [DI (SI "TARGET_VXE2")]) | |
648 | ||
3abcb3a7 | 649 | ;; These mode iterators allow 31-bit and 64-bit GPR patterns to be generated |
9db2f16d | 650 | ;; from the same template. |
9602b6a1 | 651 | (define_mode_iterator GPR [(DI "TARGET_ZARCH") SI]) |
78ce265b | 652 | (define_mode_iterator DGPR [(TI "TARGET_ZARCH") DI SI]) |
3abcb3a7 | 653 | (define_mode_iterator DSI [DI SI]) |
78ce265b | 654 | (define_mode_iterator TDI [TI DI]) |
9db2f16d | 655 | |
3abcb3a7 | 656 | ;; These mode iterators allow :P to be used for patterns that operate on |
9db2f16d | 657 | ;; pointer-sized quantities. Exactly one of the two alternatives will match. |
3abcb3a7 | 658 | (define_mode_iterator P [(DI "TARGET_64BIT") (SI "!TARGET_64BIT")]) |
9db2f16d | 659 | |
78ce265b RH |
660 | ;; These macros refer to the actual word_mode of the configuration. |
661 | ;; This is equal to Pmode except on 31-bit machines in zarch mode. | |
9602b6a1 AK |
662 | (define_mode_iterator DW [(TI "TARGET_ZARCH") (DI "!TARGET_ZARCH")]) |
663 | (define_mode_iterator W [(DI "TARGET_ZARCH") (SI "!TARGET_ZARCH")]) | |
664 | ||
6e0d70c9 AK |
665 | ;; Used by the umul pattern to express modes having half the size. |
666 | (define_mode_attr DWH [(TI "DI") (DI "SI")]) | |
667 | (define_mode_attr dwh [(TI "di") (DI "si")]) | |
668 | ||
3abcb3a7 | 669 | ;; This mode iterator allows the QI and HI patterns to be defined from |
f52c81dd | 670 | ;; the same template. |
3abcb3a7 | 671 | (define_mode_iterator HQI [HI QI]) |
f52c81dd | 672 | |
3abcb3a7 | 673 | ;; This mode iterator allows the integer patterns to be defined from the |
342cf42b | 674 | ;; same template. |
9602b6a1 | 675 | (define_mode_iterator INT [(DI "TARGET_ZARCH") SI HI QI]) |
78ce265b | 676 | (define_mode_iterator DINT [(TI "TARGET_ZARCH") DI SI HI QI]) |
64c744b9 | 677 | (define_mode_iterator SINT [SI HI QI]) |
342cf42b | 678 | |
3abcb3a7 | 679 | ;; This iterator allows some 'ashift' and 'lshiftrt' pattern to be defined from |
f337b930 | 680 | ;; the same template. |
3abcb3a7 | 681 | (define_code_iterator SHIFT [ashift lshiftrt]) |
f337b930 | 682 | |
d12a76f3 | 683 | ;; This iterator allows r[ox]sbg to be defined with the same template |
571e408a RH |
684 | (define_code_iterator IXOR [ior xor]) |
685 | ||
4a9733f3 AK |
686 | ;; This is used for merging the nand/nor and and/or with complement patterns |
687 | (define_code_iterator ANDOR [and ior]) | |
688 | (define_code_attr bitops_name [(and "and") (ior "or")]) | |
689 | (define_code_attr inv_bitops_name [(and "or") (ior "and")]) | |
690 | (define_code_attr inv_no [(and "o") (ior "n")]) | |
691 | ||
d12a76f3 AK |
692 | ;; This iterator is used to expand the patterns for the nearest |
693 | ;; integer functions. | |
694 | (define_int_iterator FPINT [UNSPEC_FPINT_FLOOR UNSPEC_FPINT_BTRUNC | |
695 | UNSPEC_FPINT_ROUND UNSPEC_FPINT_CEIL | |
696 | UNSPEC_FPINT_NEARBYINT]) | |
697 | (define_int_attr fpint_name [(UNSPEC_FPINT_FLOOR "floor") | |
698 | (UNSPEC_FPINT_BTRUNC "btrunc") | |
699 | (UNSPEC_FPINT_ROUND "round") | |
700 | (UNSPEC_FPINT_CEIL "ceil") | |
701 | (UNSPEC_FPINT_NEARBYINT "nearbyint")]) | |
702 | (define_int_attr fpint_roundingmode [(UNSPEC_FPINT_FLOOR "7") | |
703 | (UNSPEC_FPINT_BTRUNC "5") | |
704 | (UNSPEC_FPINT_ROUND "1") | |
705 | (UNSPEC_FPINT_CEIL "6") | |
706 | (UNSPEC_FPINT_NEARBYINT "0")]) | |
707 | ||
3abcb3a7 HPN |
708 | ;; This iterator and attribute allow to combine most atomic operations. |
709 | (define_code_iterator ATOMIC [and ior xor plus minus mult]) | |
65b1d8ea | 710 | (define_code_iterator ATOMIC_Z196 [and ior xor plus]) |
cf5b43b0 | 711 | (define_code_attr atomic [(and "and") (ior "or") (xor "xor") |
45d18331 | 712 | (plus "add") (minus "sub") (mult "nand")]) |
65b1d8ea | 713 | (define_code_attr noxa [(and "n") (ior "o") (xor "x") (plus "a")]) |
45d18331 | 714 | |
f4aa3848 | 715 | ;; In FP templates, a string like "lt<de>br" will expand to "ltxbr" in |
609e7e80 | 716 | ;; TF/TDmode, "ltdbr" in DF/DDmode, and "ltebr" in SF/SDmode. |
4156b056 | 717 | (define_mode_attr xde [(TF "x") (DF "d") (SF "e") (TD "x") (DD "d") (SD "e") (V4SF "e") (V2DF "d")]) |
f337b930 | 718 | |
f4aa3848 AK |
719 | ;; In FP templates, a <dee> in "m<dee><bt>r" will expand to "mx<bt>r" in |
720 | ;; TF/TDmode, "md<bt>r" in DF/DDmode, "mee<bt>r" in SFmode and "me<bt>r in | |
609e7e80 AK |
721 | ;; SDmode. |
722 | (define_mode_attr xdee [(TF "x") (DF "d") (SF "ee") (TD "x") (DD "d") (SD "e")]) | |
f5905b37 | 723 | |
609e7e80 | 724 | ;; In FP templates, "<RRe>" will expand to "RRE" in TFmode and "RR" otherwise. |
f61a2c7d AK |
725 | ;; Likewise for "<RXe>". |
726 | (define_mode_attr RRe [(TF "RRE") (DF "RR") (SF "RR")]) | |
727 | (define_mode_attr RXe [(TF "RXE") (DF "RX") (SF "RX")]) | |
728 | ||
609e7e80 | 729 | ;; The decimal floating point variants of add, sub, div and mul support 3 |
3abcb3a7 | 730 | ;; fp register operands. The following attributes allow to merge the bfp and |
609e7e80 AK |
731 | ;; dfp variants in a single insn definition. |
732 | ||
62d3f261 AK |
733 | ;; These mode attributes are supposed to be used in the `enabled' insn |
734 | ;; attribute to disable certain alternatives for certain modes. | |
735 | (define_mode_attr nBFP [(TF "0") (DF "0") (SF "0") (TD "*") (DD "*") (DD "*")]) | |
736 | (define_mode_attr nDFP [(TF "*") (DF "*") (SF "*") (TD "0") (DD "0") (DD "0")]) | |
737 | (define_mode_attr DSF [(TF "0") (DF "*") (SF "*") (TD "0") (DD "0") (SD "0")]) | |
738 | (define_mode_attr DFDI [(TF "0") (DF "*") (SF "0") | |
739 | (TD "0") (DD "0") (DD "0") | |
740 | (TI "0") (DI "*") (SI "0")]) | |
026bfe89 AK |
741 | (define_mode_attr SFSI [(TF "0") (DF "0") (SF "*") |
742 | (TD "0") (DD "0") (DD "0") | |
743 | (TI "0") (DI "0") (SI "*")]) | |
2de2b3f9 AK |
744 | (define_mode_attr DF [(TF "0") (DF "*") (SF "0") |
745 | (TD "0") (DD "0") (DD "0") | |
746 | (TI "0") (DI "0") (SI "0")]) | |
747 | (define_mode_attr SF [(TF "0") (DF "0") (SF "*") | |
748 | (TD "0") (DD "0") (DD "0") | |
749 | (TI "0") (DI "0") (SI "0")]) | |
f5905b37 | 750 | |
85dae55a AK |
751 | ;; This attribute is used in the operand constraint list |
752 | ;; for instructions dealing with the sign bit of 32 or 64bit fp values. | |
753 | ;; TFmode values are represented by a fp register pair. Since the | |
754 | ;; sign bit instructions only handle single source and target fp registers | |
755 | ;; these instructions can only be used for TFmode values if the source and | |
756 | ;; target operand uses the same fp register. | |
757 | (define_mode_attr fT0 [(TF "0") (DF "f") (SF "f")]) | |
758 | ||
3abcb3a7 | 759 | ;; This attribute adds b for bfp instructions and t for dfp instructions and is used |
609e7e80 AK |
760 | ;; within instruction mnemonics. |
761 | (define_mode_attr bt [(TF "b") (DF "b") (SF "b") (TD "t") (DD "t") (SD "t")]) | |
762 | ||
0387c142 WG |
763 | ;; This attribute is used within instruction mnemonics. It evaluates to d for dfp |
764 | ;; modes and to an empty string for bfp modes. | |
765 | (define_mode_attr _d [(TF "") (DF "") (SF "") (TD "d") (DD "d") (SD "d")]) | |
766 | ||
1b48c8cc AS |
767 | ;; In GPR and P templates, a constraint like "<d0>" will expand to "d" in DImode |
768 | ;; and "0" in SImode. This allows to combine instructions of which the 31bit | |
769 | ;; version only operates on one register. | |
770 | (define_mode_attr d0 [(DI "d") (SI "0")]) | |
771 | ||
772 | ;; In combination with d0 this allows to combine instructions of which the 31bit | |
773 | ;; version only operates on one register. The DImode version needs an additional | |
774 | ;; register for the assembler output. | |
775 | (define_mode_attr 1 [(DI "%1,") (SI "")]) | |
9381e3f1 WG |
776 | |
777 | ;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in | |
f337b930 AS |
778 | ;; 'ashift' and "srdl" in 'lshiftrt'. |
779 | (define_code_attr lr [(ashift "l") (lshiftrt "r")]) | |
780 | ||
781 | ;; In SHIFT templates, this attribute holds the correct standard name for the | |
9381e3f1 | 782 | ;; pattern itself and the corresponding function calls. |
f337b930 | 783 | (define_code_attr shift [(ashift "ashl") (lshiftrt "lshr")]) |
9a91a21f AS |
784 | |
785 | ;; This attribute handles differences in the instruction 'type' and will result | |
786 | ;; in "RRE" for DImode and "RR" for SImode. | |
787 | (define_mode_attr E [(DI "E") (SI "")]) | |
788 | ||
3298c037 AK |
789 | ;; This attribute handles differences in the instruction 'type' and makes RX<Y> |
790 | ;; to result in "RXY" for DImode and "RX" for SImode. | |
791 | (define_mode_attr Y [(DI "Y") (SI "")]) | |
792 | ||
8006eaa6 AS |
793 | ;; This attribute handles differences in the instruction 'type' and will result |
794 | ;; in "RSE" for TImode and "RS" for DImode. | |
795 | (define_mode_attr TE [(TI "E") (DI "")]) | |
796 | ||
9a91a21f AS |
797 | ;; In GPR templates, a string like "lc<g>r" will expand to "lcgr" in DImode |
798 | ;; and "lcr" in SImode. | |
799 | (define_mode_attr g [(DI "g") (SI "")]) | |
f52c81dd | 800 | |
3298c037 AK |
801 | ;; In GPR templates, a string like "sl<y>" will expand to "slg" in DImode |
802 | ;; and "sly" in SImode. This is useful because on 64bit the ..g instructions | |
803 | ;; were enhanced with long displacements whereas 31bit instructions got a ..y | |
804 | ;; variant for long displacements. | |
805 | (define_mode_attr y [(DI "g") (SI "y")]) | |
806 | ||
9602b6a1 | 807 | ;; In DW templates, a string like "cds<g>" will expand to "cdsg" in TImode |
8006eaa6 AS |
808 | ;; and "cds" in DImode. |
809 | (define_mode_attr tg [(TI "g") (DI "")]) | |
810 | ||
78ce265b RH |
811 | ;; In TDI templates, a string like "c<d>sg". |
812 | (define_mode_attr td [(TI "d") (DI "")]) | |
813 | ||
2f8f8434 AS |
814 | ;; In GPR templates, a string like "c<gf>dbr" will expand to "cgdbr" in DImode |
815 | ;; and "cfdbr" in SImode. | |
816 | (define_mode_attr gf [(DI "g") (SI "f")]) | |
817 | ||
65b1d8ea AK |
818 | ;; In GPR templates, a string like sll<gk> will expand to sllg for DI |
819 | ;; and sllk for SI. This way it is possible to merge the new z196 SI | |
820 | ;; 3 operands shift instructions into the existing patterns. | |
821 | (define_mode_attr gk [(DI "g") (SI "k")]) | |
822 | ||
f52c81dd AS |
823 | ;; ICM mask required to load MODE value into the lowest subreg |
824 | ;; of a SImode register. | |
825 | (define_mode_attr icm_lo [(HI "3") (QI "1")]) | |
826 | ||
f6ee577c AS |
827 | ;; In HQI templates, a string like "llg<hc>" will expand to "llgh" in |
828 | ;; HImode and "llgc" in QImode. | |
829 | (define_mode_attr hc [(HI "h") (QI "c")]) | |
830 | ||
a1aed706 AS |
831 | ;; In P templates, the mode <DBL> will expand to "TI" in DImode and "DI" |
832 | ;; in SImode. | |
833 | (define_mode_attr DBL [(DI "TI") (SI "DI")]) | |
834 | ||
609e7e80 AK |
835 | ;; This attribute expands to DF for TFmode and to DD for TDmode . It is |
836 | ;; used for Txmode splitters splitting a Txmode copy into 2 Dxmode copies. | |
837 | (define_mode_attr HALF_TMODE [(TF "DF") (TD "DD")]) | |
838 | ||
f52c81dd AS |
839 | ;; Maximum unsigned integer that fits in MODE. |
840 | (define_mode_attr max_uint [(HI "65535") (QI "255")]) | |
841 | ||
75ca1b39 RH |
842 | ;; Start and end field computations for RISBG et al. |
843 | (define_mode_attr bfstart [(DI "s") (SI "t")]) | |
844 | (define_mode_attr bfend [(DI "e") (SI "f")]) | |
845 | ||
2542ef05 RH |
846 | ;; In place of GET_MODE_BITSIZE (<MODE>mode) |
847 | (define_mode_attr bitsize [(DI "64") (SI "32") (HI "16") (QI "8")]) | |
576987fc DV |
848 | ;; 64 - bitsize |
849 | (define_mode_attr bitoff [(DI "0") (SI "32") (HI "48") (QI "56")]) | |
850 | (define_mode_attr bitoff_plus [(DI "") (SI "32+") (HI "48+") (QI "56+")]) | |
2542ef05 | 851 | |
da0dcab1 DV |
852 | ;; In place of GET_MODE_SIZE (<MODE>mode) |
853 | (define_mode_attr modesize [(DI "8") (SI "4")]) | |
854 | ||
177bc204 RS |
855 | ;; Allow return and simple_return to be defined from a single template. |
856 | (define_code_iterator ANY_RETURN [return simple_return]) | |
857 | ||
6e5b5de8 AK |
858 | |
859 | ||
860 | ; Condition code modes generated by vector fp comparisons. These will | |
861 | ; be used also in single element mode. | |
862 | (define_mode_iterator VFCMP [CCVEQ CCVFH CCVFHE]) | |
863 | ; Used with VFCMP to expand part of the mnemonic | |
864 | ; For fp we have a mismatch: eq in the insn name - e in asm | |
865 | (define_mode_attr asm_fcmp [(CCVEQ "e") (CCVFH "h") (CCVFHE "he")]) | |
a6a2b532 | 866 | (define_mode_attr insn_cmp [(CCVEQ "eq") (CCVIH "h") (CCVIHU "hl") (CCVFH "h") (CCVFHE "he")]) |
6e5b5de8 | 867 | |
191eb16d AK |
868 | ;; Subst pattern definitions |
869 | (include "subst.md") | |
6e5b5de8 | 870 | |
085261c8 AK |
871 | (include "vector.md") |
872 | ||
9db1d521 HP |
873 | ;; |
874 | ;;- Compare instructions. | |
875 | ;; | |
876 | ||
07893d4f | 877 | ; Test-under-Mask instructions |
9db1d521 | 878 | |
07893d4f | 879 | (define_insn "*tmqi_mem" |
ae156f85 | 880 | [(set (reg CC_REGNUM) |
68f9c5e2 UW |
881 | (compare (and:QI (match_operand:QI 0 "memory_operand" "Q,S") |
882 | (match_operand:QI 1 "immediate_operand" "n,n")) | |
883 | (match_operand:QI 2 "immediate_operand" "n,n")))] | |
3ed99cc9 | 884 | "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], false))" |
d3632d41 | 885 | "@ |
fc0ea003 UW |
886 | tm\t%S0,%b1 |
887 | tmy\t%S0,%b1" | |
9381e3f1 | 888 | [(set_attr "op_type" "SI,SIY") |
3e4be43f | 889 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 890 | (set_attr "z10prop" "z10_super,z10_super")]) |
9db1d521 | 891 | |
05b9aaaa | 892 | (define_insn "*tmdi_reg" |
ae156f85 | 893 | [(set (reg CC_REGNUM) |
f19a9af7 | 894 | (compare (and:DI (match_operand:DI 0 "nonimmediate_operand" "d,d,d,d") |
2f7e5a0d | 895 | (match_operand:DI 1 "immediate_operand" |
f19a9af7 AK |
896 | "N0HD0,N1HD0,N2HD0,N3HD0")) |
897 | (match_operand:DI 2 "immediate_operand" "n,n,n,n")))] | |
9602b6a1 | 898 | "TARGET_ZARCH |
3ed99cc9 | 899 | && s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true)) |
f19a9af7 AK |
900 | && s390_single_part (operands[1], DImode, HImode, 0) >= 0" |
901 | "@ | |
902 | tmhh\t%0,%i1 | |
903 | tmhl\t%0,%i1 | |
904 | tmlh\t%0,%i1 | |
905 | tmll\t%0,%i1" | |
9381e3f1 WG |
906 | [(set_attr "op_type" "RI") |
907 | (set_attr "z10prop" "z10_super,z10_super,z10_super,z10_super")]) | |
05b9aaaa UW |
908 | |
909 | (define_insn "*tmsi_reg" | |
ae156f85 | 910 | [(set (reg CC_REGNUM) |
f19a9af7 AK |
911 | (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "d,d") |
912 | (match_operand:SI 1 "immediate_operand" "N0HS0,N1HS0")) | |
913 | (match_operand:SI 2 "immediate_operand" "n,n")))] | |
3ed99cc9 | 914 | "s390_match_ccmode (insn, s390_tm_ccmode (operands[1], operands[2], true)) |
f19a9af7 AK |
915 | && s390_single_part (operands[1], SImode, HImode, 0) >= 0" |
916 | "@ | |
917 | tmh\t%0,%i1 | |
918 | tml\t%0,%i1" | |
729e750f WG |
919 | [(set_attr "op_type" "RI") |
920 | (set_attr "z10prop" "z10_super,z10_super")]) | |
05b9aaaa | 921 | |
f52c81dd | 922 | (define_insn "*tm<mode>_full" |
ae156f85 | 923 | [(set (reg CC_REGNUM) |
f52c81dd AS |
924 | (compare (match_operand:HQI 0 "register_operand" "d") |
925 | (match_operand:HQI 1 "immediate_operand" "n")))] | |
3ed99cc9 | 926 | "s390_match_ccmode (insn, s390_tm_ccmode (constm1_rtx, operands[1], true))" |
f52c81dd | 927 | "tml\t%0,<max_uint>" |
729e750f WG |
928 | [(set_attr "op_type" "RI") |
929 | (set_attr "z10prop" "z10_super")]) | |
9db1d521 | 930 | |
07893d4f | 931 | |
08a5aaa2 | 932 | ; |
07893d4f | 933 | ; Load-and-Test instructions |
08a5aaa2 AS |
934 | ; |
935 | ||
c0220ea4 | 936 | ; tst(di|si) instruction pattern(s). |
07893d4f UW |
937 | |
938 | (define_insn "*tstdi_sign" | |
ae156f85 | 939 | [(set (reg CC_REGNUM) |
963fc8d0 AK |
940 | (compare |
941 | (ashiftrt:DI | |
942 | (ashift:DI | |
3e4be43f | 943 | (subreg:DI (match_operand:SI 0 "nonimmediate_operand" "d,T") 0) |
963fc8d0 AK |
944 | (const_int 32)) (const_int 32)) |
945 | (match_operand:DI 1 "const0_operand" ""))) | |
946 | (set (match_operand:DI 2 "register_operand" "=d,d") | |
07893d4f | 947 | (sign_extend:DI (match_dup 0)))] |
9602b6a1 | 948 | "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH" |
963fc8d0 AK |
949 | "ltgfr\t%2,%0 |
950 | ltgf\t%2,%0" | |
951 | [(set_attr "op_type" "RRE,RXY") | |
9381e3f1 WG |
952 | (set_attr "cpu_facility" "*,z10") |
953 | (set_attr "z10prop" "z10_super_E1,z10_super_E1") ]) | |
07893d4f | 954 | |
43a09b63 | 955 | ; ltr, lt, ltgr, ltg |
08a5aaa2 | 956 | (define_insn "*tst<mode>_extimm" |
ec24698e | 957 | [(set (reg CC_REGNUM) |
3e4be43f | 958 | (compare (match_operand:GPR 0 "nonimmediate_operand" "d,T") |
08a5aaa2 AS |
959 | (match_operand:GPR 1 "const0_operand" ""))) |
960 | (set (match_operand:GPR 2 "register_operand" "=d,d") | |
ec24698e | 961 | (match_dup 0))] |
08a5aaa2 | 962 | "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM" |
ec24698e | 963 | "@ |
08a5aaa2 AS |
964 | lt<g>r\t%2,%0 |
965 | lt<g>\t%2,%0" | |
9381e3f1 | 966 | [(set_attr "op_type" "RR<E>,RXY") |
729e750f | 967 | (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3") ]) |
ec24698e | 968 | |
97160c9b DV |
969 | ; Peephole to combine a load-and-test from volatile memory which combine does |
970 | ; not do. | |
971 | (define_peephole2 | |
972 | [(set (match_operand:GPR 0 "register_operand") | |
973 | (match_operand:GPR 2 "memory_operand")) | |
974 | (set (reg CC_REGNUM) | |
975 | (compare (match_dup 0) (match_operand:GPR 1 "const0_operand")))] | |
976 | "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM | |
977 | && GENERAL_REG_P (operands[0]) | |
34a249bc IL |
978 | && satisfies_constraint_T (operands[2]) |
979 | && !contains_constant_pool_address_p (operands[2])" | |
97160c9b DV |
980 | [(parallel |
981 | [(set (reg:CCS CC_REGNUM) | |
982 | (compare:CCS (match_dup 2) (match_dup 1))) | |
983 | (set (match_dup 0) (match_dup 2))])]) | |
984 | ||
43a09b63 | 985 | ; ltr, lt, ltgr, ltg |
08a5aaa2 | 986 | (define_insn "*tst<mode>_cconly_extimm" |
ec24698e | 987 | [(set (reg CC_REGNUM) |
3e4be43f | 988 | (compare (match_operand:GPR 0 "nonimmediate_operand" "d,T") |
08a5aaa2 AS |
989 | (match_operand:GPR 1 "const0_operand" ""))) |
990 | (clobber (match_scratch:GPR 2 "=X,d"))] | |
991 | "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM" | |
ec24698e | 992 | "@ |
08a5aaa2 AS |
993 | lt<g>r\t%0,%0 |
994 | lt<g>\t%2,%0" | |
9381e3f1 | 995 | [(set_attr "op_type" "RR<E>,RXY") |
729e750f | 996 | (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3")]) |
ec24698e | 997 | |
07893d4f | 998 | (define_insn "*tstdi" |
ae156f85 | 999 | [(set (reg CC_REGNUM) |
07893d4f UW |
1000 | (compare (match_operand:DI 0 "register_operand" "d") |
1001 | (match_operand:DI 1 "const0_operand" ""))) | |
1002 | (set (match_operand:DI 2 "register_operand" "=d") | |
1003 | (match_dup 0))] | |
9602b6a1 | 1004 | "s390_match_ccmode(insn, CCSmode) && TARGET_ZARCH && !TARGET_EXTIMM" |
d40c829f | 1005 | "ltgr\t%2,%0" |
9381e3f1 WG |
1006 | [(set_attr "op_type" "RRE") |
1007 | (set_attr "z10prop" "z10_fr_E1")]) | |
9db1d521 | 1008 | |
07893d4f | 1009 | (define_insn "*tstsi" |
ae156f85 | 1010 | [(set (reg CC_REGNUM) |
d3632d41 | 1011 | (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S") |
07893d4f | 1012 | (match_operand:SI 1 "const0_operand" ""))) |
d3632d41 | 1013 | (set (match_operand:SI 2 "register_operand" "=d,d,d") |
07893d4f | 1014 | (match_dup 0))] |
ec24698e | 1015 | "s390_match_ccmode(insn, CCSmode) && !TARGET_EXTIMM" |
07893d4f | 1016 | "@ |
d40c829f | 1017 | ltr\t%2,%0 |
fc0ea003 UW |
1018 | icm\t%2,15,%S0 |
1019 | icmy\t%2,15,%S0" | |
9381e3f1 | 1020 | [(set_attr "op_type" "RR,RS,RSY") |
3e4be43f | 1021 | (set_attr "cpu_facility" "*,*,longdisp") |
9381e3f1 | 1022 | (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")]) |
9db1d521 | 1023 | |
07893d4f | 1024 | (define_insn "*tstsi_cconly" |
ae156f85 | 1025 | [(set (reg CC_REGNUM) |
d3632d41 | 1026 | (compare (match_operand:SI 0 "nonimmediate_operand" "d,Q,S") |
07893d4f | 1027 | (match_operand:SI 1 "const0_operand" ""))) |
d3632d41 | 1028 | (clobber (match_scratch:SI 2 "=X,d,d"))] |
07893d4f UW |
1029 | "s390_match_ccmode(insn, CCSmode)" |
1030 | "@ | |
d40c829f | 1031 | ltr\t%0,%0 |
fc0ea003 UW |
1032 | icm\t%2,15,%S0 |
1033 | icmy\t%2,15,%S0" | |
9381e3f1 | 1034 | [(set_attr "op_type" "RR,RS,RSY") |
3e4be43f | 1035 | (set_attr "cpu_facility" "*,*,longdisp") |
9381e3f1 | 1036 | (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")]) |
4023fb28 | 1037 | |
08a5aaa2 AS |
1038 | (define_insn "*tstdi_cconly_31" |
1039 | [(set (reg CC_REGNUM) | |
1040 | (compare (match_operand:DI 0 "register_operand" "d") | |
1041 | (match_operand:DI 1 "const0_operand" "")))] | |
9602b6a1 | 1042 | "s390_match_ccmode(insn, CCSmode) && !TARGET_ZARCH" |
08a5aaa2 AS |
1043 | "srda\t%0,0" |
1044 | [(set_attr "op_type" "RS") | |
1045 | (set_attr "atype" "reg")]) | |
1046 | ||
43a09b63 | 1047 | ; ltr, ltgr |
08a5aaa2 | 1048 | (define_insn "*tst<mode>_cconly2" |
ae156f85 | 1049 | [(set (reg CC_REGNUM) |
08a5aaa2 AS |
1050 | (compare (match_operand:GPR 0 "register_operand" "d") |
1051 | (match_operand:GPR 1 "const0_operand" "")))] | |
07893d4f | 1052 | "s390_match_ccmode(insn, CCSmode)" |
08a5aaa2 | 1053 | "lt<g>r\t%0,%0" |
9381e3f1 WG |
1054 | [(set_attr "op_type" "RR<E>") |
1055 | (set_attr "z10prop" "z10_fr_E1")]) | |
08a5aaa2 | 1056 | |
c0220ea4 | 1057 | ; tst(hi|qi) instruction pattern(s). |
4023fb28 | 1058 | |
f52c81dd | 1059 | (define_insn "*tst<mode>CCT" |
ae156f85 | 1060 | [(set (reg CC_REGNUM) |
f52c81dd AS |
1061 | (compare (match_operand:HQI 0 "nonimmediate_operand" "?Q,?S,d") |
1062 | (match_operand:HQI 1 "const0_operand" ""))) | |
1063 | (set (match_operand:HQI 2 "register_operand" "=d,d,0") | |
3af97654 UW |
1064 | (match_dup 0))] |
1065 | "s390_match_ccmode(insn, CCTmode)" | |
1066 | "@ | |
f52c81dd AS |
1067 | icm\t%2,<icm_lo>,%S0 |
1068 | icmy\t%2,<icm_lo>,%S0 | |
1069 | tml\t%0,<max_uint>" | |
9381e3f1 | 1070 | [(set_attr "op_type" "RS,RSY,RI") |
3e4be43f | 1071 | (set_attr "cpu_facility" "*,longdisp,*") |
9381e3f1 | 1072 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")]) |
3af97654 UW |
1073 | |
1074 | (define_insn "*tsthiCCT_cconly" | |
ae156f85 | 1075 | [(set (reg CC_REGNUM) |
d3632d41 | 1076 | (compare (match_operand:HI 0 "nonimmediate_operand" "Q,S,d") |
3af97654 | 1077 | (match_operand:HI 1 "const0_operand" ""))) |
d3632d41 | 1078 | (clobber (match_scratch:HI 2 "=d,d,X"))] |
3af97654 UW |
1079 | "s390_match_ccmode(insn, CCTmode)" |
1080 | "@ | |
fc0ea003 UW |
1081 | icm\t%2,3,%S0 |
1082 | icmy\t%2,3,%S0 | |
d40c829f | 1083 | tml\t%0,65535" |
9381e3f1 | 1084 | [(set_attr "op_type" "RS,RSY,RI") |
3e4be43f | 1085 | (set_attr "cpu_facility" "*,longdisp,*") |
9381e3f1 | 1086 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")]) |
3af97654 | 1087 | |
3af97654 | 1088 | (define_insn "*tstqiCCT_cconly" |
ae156f85 | 1089 | [(set (reg CC_REGNUM) |
d3632d41 | 1090 | (compare (match_operand:QI 0 "nonimmediate_operand" "?Q,?S,d") |
3af97654 UW |
1091 | (match_operand:QI 1 "const0_operand" "")))] |
1092 | "s390_match_ccmode(insn, CCTmode)" | |
1093 | "@ | |
fc0ea003 UW |
1094 | cli\t%S0,0 |
1095 | cliy\t%S0,0 | |
d40c829f | 1096 | tml\t%0,255" |
9381e3f1 | 1097 | [(set_attr "op_type" "SI,SIY,RI") |
3e4be43f | 1098 | (set_attr "cpu_facility" "*,longdisp,*") |
729e750f | 1099 | (set_attr "z10prop" "z10_super,z10_super,z10_super")]) |
3af97654 | 1100 | |
f52c81dd | 1101 | (define_insn "*tst<mode>" |
ae156f85 | 1102 | [(set (reg CC_REGNUM) |
f52c81dd AS |
1103 | (compare (match_operand:HQI 0 "s_operand" "Q,S") |
1104 | (match_operand:HQI 1 "const0_operand" ""))) | |
1105 | (set (match_operand:HQI 2 "register_operand" "=d,d") | |
07893d4f UW |
1106 | (match_dup 0))] |
1107 | "s390_match_ccmode(insn, CCSmode)" | |
d3632d41 | 1108 | "@ |
f52c81dd AS |
1109 | icm\t%2,<icm_lo>,%S0 |
1110 | icmy\t%2,<icm_lo>,%S0" | |
9381e3f1 | 1111 | [(set_attr "op_type" "RS,RSY") |
3e4be43f | 1112 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 1113 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) |
9db1d521 | 1114 | |
f52c81dd | 1115 | (define_insn "*tst<mode>_cconly" |
ae156f85 | 1116 | [(set (reg CC_REGNUM) |
f52c81dd AS |
1117 | (compare (match_operand:HQI 0 "s_operand" "Q,S") |
1118 | (match_operand:HQI 1 "const0_operand" ""))) | |
1119 | (clobber (match_scratch:HQI 2 "=d,d"))] | |
07893d4f | 1120 | "s390_match_ccmode(insn, CCSmode)" |
d3632d41 | 1121 | "@ |
f52c81dd AS |
1122 | icm\t%2,<icm_lo>,%S0 |
1123 | icmy\t%2,<icm_lo>,%S0" | |
9381e3f1 | 1124 | [(set_attr "op_type" "RS,RSY") |
3e4be43f | 1125 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 1126 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) |
d3632d41 | 1127 | |
9db1d521 | 1128 | |
575f7c2b UW |
1129 | ; Compare (equality) instructions |
1130 | ||
1131 | (define_insn "*cmpdi_cct" | |
ae156f85 | 1132 | [(set (reg CC_REGNUM) |
ec24698e | 1133 | (compare (match_operand:DI 0 "nonimmediate_operand" "%d,d,d,d,Q") |
3e4be43f | 1134 | (match_operand:DI 1 "general_operand" "d,K,Os,T,BQ")))] |
9602b6a1 | 1135 | "s390_match_ccmode (insn, CCTmode) && TARGET_ZARCH" |
575f7c2b UW |
1136 | "@ |
1137 | cgr\t%0,%1 | |
f4f41b4e | 1138 | cghi\t%0,%h1 |
ec24698e | 1139 | cgfi\t%0,%1 |
575f7c2b | 1140 | cg\t%0,%1 |
19b63d8e | 1141 | #" |
9381e3f1 WG |
1142 | [(set_attr "op_type" "RRE,RI,RIL,RXY,SS") |
1143 | (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,*")]) | |
575f7c2b UW |
1144 | |
1145 | (define_insn "*cmpsi_cct" | |
ae156f85 | 1146 | [(set (reg CC_REGNUM) |
ec24698e UW |
1147 | (compare (match_operand:SI 0 "nonimmediate_operand" "%d,d,d,d,d,Q") |
1148 | (match_operand:SI 1 "general_operand" "d,K,Os,R,T,BQ")))] | |
e221ef54 | 1149 | "s390_match_ccmode (insn, CCTmode)" |
575f7c2b UW |
1150 | "@ |
1151 | cr\t%0,%1 | |
f4f41b4e | 1152 | chi\t%0,%h1 |
ec24698e | 1153 | cfi\t%0,%1 |
575f7c2b UW |
1154 | c\t%0,%1 |
1155 | cy\t%0,%1 | |
19b63d8e | 1156 | #" |
9381e3f1 | 1157 | [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS") |
3e4be43f | 1158 | (set_attr "cpu_facility" "*,*,*,*,longdisp,*") |
e3cba5e5 | 1159 | (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*")]) |
575f7c2b | 1160 | |
07893d4f | 1161 | ; Compare (signed) instructions |
4023fb28 | 1162 | |
07893d4f | 1163 | (define_insn "*cmpdi_ccs_sign" |
ae156f85 | 1164 | [(set (reg CC_REGNUM) |
963fc8d0 | 1165 | (compare (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" |
3e4be43f | 1166 | "d,T,b")) |
963fc8d0 | 1167 | (match_operand:DI 0 "register_operand" "d, d,d")))] |
9602b6a1 | 1168 | "s390_match_ccmode(insn, CCSRmode) && TARGET_ZARCH" |
4023fb28 | 1169 | "@ |
d40c829f | 1170 | cgfr\t%0,%1 |
963fc8d0 AK |
1171 | cgf\t%0,%1 |
1172 | cgfrl\t%0,%1" | |
1173 | [(set_attr "op_type" "RRE,RXY,RIL") | |
9381e3f1 | 1174 | (set_attr "z10prop" "z10_c,*,*") |
14cfceb7 IL |
1175 | (set_attr "type" "*,*,larl") |
1176 | (set_attr "relative_long" "*,*,yes")]) | |
4023fb28 | 1177 | |
9381e3f1 WG |
1178 | |
1179 | ||
07893d4f | 1180 | (define_insn "*cmpsi_ccs_sign" |
ae156f85 | 1181 | [(set (reg CC_REGNUM) |
963fc8d0 AK |
1182 | (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T,b")) |
1183 | (match_operand:SI 0 "register_operand" "d,d,d")))] | |
07893d4f | 1184 | "s390_match_ccmode(insn, CCSRmode)" |
d3632d41 | 1185 | "@ |
d40c829f | 1186 | ch\t%0,%1 |
963fc8d0 AK |
1187 | chy\t%0,%1 |
1188 | chrl\t%0,%1" | |
1189 | [(set_attr "op_type" "RX,RXY,RIL") | |
3e4be43f | 1190 | (set_attr "cpu_facility" "*,longdisp,z10") |
65b1d8ea | 1191 | (set_attr "type" "*,*,larl") |
14cfceb7 IL |
1192 | (set_attr "z196prop" "z196_cracked,z196_cracked,z196_cracked") |
1193 | (set_attr "relative_long" "*,*,yes")]) | |
963fc8d0 AK |
1194 | |
1195 | (define_insn "*cmphi_ccs_z10" | |
1196 | [(set (reg CC_REGNUM) | |
1197 | (compare (match_operand:HI 0 "s_operand" "Q") | |
1198 | (match_operand:HI 1 "immediate_operand" "K")))] | |
1199 | "s390_match_ccmode(insn, CCSmode) && TARGET_Z10" | |
1200 | "chhsi\t%0,%1" | |
65b1d8ea AK |
1201 | [(set_attr "op_type" "SIL") |
1202 | (set_attr "z196prop" "z196_cracked")]) | |
963fc8d0 AK |
1203 | |
1204 | (define_insn "*cmpdi_ccs_signhi_rl" | |
1205 | [(set (reg CC_REGNUM) | |
3e4be43f | 1206 | (compare (sign_extend:DI (match_operand:HI 1 "memory_operand" "T,b")) |
963fc8d0 AK |
1207 | (match_operand:GPR 0 "register_operand" "d,d")))] |
1208 | "s390_match_ccmode(insn, CCSRmode) && TARGET_Z10" | |
1209 | "@ | |
1210 | cgh\t%0,%1 | |
1211 | cghrl\t%0,%1" | |
1212 | [(set_attr "op_type" "RXY,RIL") | |
14cfceb7 IL |
1213 | (set_attr "type" "*,larl") |
1214 | (set_attr "relative_long" "*,yes")]) | |
4023fb28 | 1215 | |
963fc8d0 | 1216 | ; cr, chi, cfi, c, cy, cgr, cghi, cgfi, cg, chsi, cghsi, crl, cgrl |
3298c037 | 1217 | (define_insn "*cmp<mode>_ccs" |
ae156f85 | 1218 | [(set (reg CC_REGNUM) |
963fc8d0 AK |
1219 | (compare (match_operand:GPR 0 "nonimmediate_operand" |
1220 | "d,d,Q, d,d,d,d") | |
1221 | (match_operand:GPR 1 "general_operand" | |
1222 | "d,K,K,Os,R,T,b")))] | |
9db1d521 | 1223 | "s390_match_ccmode(insn, CCSmode)" |
07893d4f | 1224 | "@ |
3298c037 AK |
1225 | c<g>r\t%0,%1 |
1226 | c<g>hi\t%0,%h1 | |
963fc8d0 | 1227 | c<g>hsi\t%0,%h1 |
3298c037 AK |
1228 | c<g>fi\t%0,%1 |
1229 | c<g>\t%0,%1 | |
963fc8d0 AK |
1230 | c<y>\t%0,%1 |
1231 | c<g>rl\t%0,%1" | |
1232 | [(set_attr "op_type" "RR<E>,RI,SIL,RIL,RX<Y>,RXY,RIL") | |
3e4be43f | 1233 | (set_attr "cpu_facility" "*,*,z10,extimm,*,longdisp,z10") |
9381e3f1 | 1234 | (set_attr "type" "*,*,*,*,*,*,larl") |
14cfceb7 IL |
1235 | (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,z10_super") |
1236 | (set_attr "relative_long" "*,*,*,*,*,*,yes")]) | |
c7453384 | 1237 | |
07893d4f UW |
1238 | |
1239 | ; Compare (unsigned) instructions | |
9db1d521 | 1240 | |
963fc8d0 AK |
1241 | (define_insn "*cmpsi_ccu_zerohi_rlsi" |
1242 | [(set (reg CC_REGNUM) | |
1243 | (compare (zero_extend:SI (mem:HI (match_operand:SI 1 | |
1244 | "larl_operand" "X"))) | |
1245 | (match_operand:SI 0 "register_operand" "d")))] | |
1246 | "s390_match_ccmode(insn, CCURmode) && TARGET_Z10" | |
1247 | "clhrl\t%0,%1" | |
1248 | [(set_attr "op_type" "RIL") | |
729e750f | 1249 | (set_attr "type" "larl") |
14cfceb7 IL |
1250 | (set_attr "z10prop" "z10_super") |
1251 | (set_attr "relative_long" "yes")]) | |
963fc8d0 AK |
1252 | |
1253 | ; clhrl, clghrl | |
1254 | (define_insn "*cmp<GPR:mode>_ccu_zerohi_rldi" | |
1255 | [(set (reg CC_REGNUM) | |
1256 | (compare (zero_extend:GPR (mem:HI (match_operand:DI 1 | |
1257 | "larl_operand" "X"))) | |
1258 | (match_operand:GPR 0 "register_operand" "d")))] | |
1259 | "s390_match_ccmode(insn, CCURmode) && TARGET_Z10" | |
1260 | "cl<g>hrl\t%0,%1" | |
1261 | [(set_attr "op_type" "RIL") | |
9381e3f1 | 1262 | (set_attr "type" "larl") |
14cfceb7 IL |
1263 | (set_attr "z10prop" "z10_super") |
1264 | (set_attr "relative_long" "yes")]) | |
963fc8d0 | 1265 | |
07893d4f | 1266 | (define_insn "*cmpdi_ccu_zero" |
ae156f85 | 1267 | [(set (reg CC_REGNUM) |
963fc8d0 | 1268 | (compare (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" |
3e4be43f UW |
1269 | "d,T,b")) |
1270 | (match_operand:DI 0 "register_operand" "d,d,d")))] | |
9602b6a1 | 1271 | "s390_match_ccmode (insn, CCURmode) && TARGET_ZARCH" |
07893d4f | 1272 | "@ |
d40c829f | 1273 | clgfr\t%0,%1 |
963fc8d0 AK |
1274 | clgf\t%0,%1 |
1275 | clgfrl\t%0,%1" | |
1276 | [(set_attr "op_type" "RRE,RXY,RIL") | |
1277 | (set_attr "cpu_facility" "*,*,z10") | |
9381e3f1 | 1278 | (set_attr "type" "*,*,larl") |
14cfceb7 IL |
1279 | (set_attr "z10prop" "z10_super_c,z10_super_E1,z10_super") |
1280 | (set_attr "relative_long" "*,*,yes")]) | |
9db1d521 | 1281 | |
07893d4f | 1282 | (define_insn "*cmpdi_ccu" |
ae156f85 | 1283 | [(set (reg CC_REGNUM) |
963fc8d0 | 1284 | (compare (match_operand:DI 0 "nonimmediate_operand" |
3e4be43f | 1285 | "d, d,d,Q,d, Q,BQ") |
963fc8d0 | 1286 | (match_operand:DI 1 "general_operand" |
3e4be43f | 1287 | "d,Op,b,D,T,BQ,Q")))] |
9602b6a1 | 1288 | "s390_match_ccmode (insn, CCUmode) && TARGET_ZARCH" |
07893d4f | 1289 | "@ |
d40c829f | 1290 | clgr\t%0,%1 |
ec24698e | 1291 | clgfi\t%0,%1 |
963fc8d0 AK |
1292 | clgrl\t%0,%1 |
1293 | clghsi\t%0,%x1 | |
575f7c2b | 1294 | clg\t%0,%1 |
e221ef54 | 1295 | # |
19b63d8e | 1296 | #" |
963fc8d0 AK |
1297 | [(set_attr "op_type" "RRE,RIL,RIL,SIL,RXY,SS,SS") |
1298 | (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*") | |
9381e3f1 | 1299 | (set_attr "type" "*,*,larl,*,*,*,*") |
14cfceb7 IL |
1300 | (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*,*") |
1301 | (set_attr "relative_long" "*,*,yes,*,*,*,*")]) | |
9db1d521 | 1302 | |
07893d4f | 1303 | (define_insn "*cmpsi_ccu" |
ae156f85 | 1304 | [(set (reg CC_REGNUM) |
963fc8d0 AK |
1305 | (compare (match_operand:SI 0 "nonimmediate_operand" "d, d,d,Q,d,d, Q,BQ") |
1306 | (match_operand:SI 1 "general_operand" "d,Os,b,D,R,T,BQ, Q")))] | |
e221ef54 | 1307 | "s390_match_ccmode (insn, CCUmode)" |
07893d4f | 1308 | "@ |
d40c829f | 1309 | clr\t%0,%1 |
ec24698e | 1310 | clfi\t%0,%o1 |
963fc8d0 AK |
1311 | clrl\t%0,%1 |
1312 | clfhsi\t%0,%x1 | |
d40c829f | 1313 | cl\t%0,%1 |
575f7c2b | 1314 | cly\t%0,%1 |
e221ef54 | 1315 | # |
19b63d8e | 1316 | #" |
963fc8d0 | 1317 | [(set_attr "op_type" "RR,RIL,RIL,SIL,RX,RXY,SS,SS") |
3e4be43f | 1318 | (set_attr "cpu_facility" "*,extimm,z10,z10,*,longdisp,*,*") |
9381e3f1 | 1319 | (set_attr "type" "*,*,larl,*,*,*,*,*") |
14cfceb7 IL |
1320 | (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,*,*") |
1321 | (set_attr "relative_long" "*,*,yes,*,*,*,*,*")]) | |
9db1d521 | 1322 | |
07893d4f | 1323 | (define_insn "*cmphi_ccu" |
ae156f85 | 1324 | [(set (reg CC_REGNUM) |
963fc8d0 AK |
1325 | (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,Q,BQ") |
1326 | (match_operand:HI 1 "general_operand" "Q,S,D,BQ,Q")))] | |
575f7c2b | 1327 | "s390_match_ccmode (insn, CCUmode) |
575f7c2b | 1328 | && !register_operand (operands[1], HImode)" |
d3632d41 | 1329 | "@ |
fc0ea003 UW |
1330 | clm\t%0,3,%S1 |
1331 | clmy\t%0,3,%S1 | |
963fc8d0 | 1332 | clhhsi\t%0,%1 |
e221ef54 | 1333 | # |
19b63d8e | 1334 | #" |
963fc8d0 | 1335 | [(set_attr "op_type" "RS,RSY,SIL,SS,SS") |
3e4be43f | 1336 | (set_attr "cpu_facility" "*,longdisp,z10,*,*") |
9381e3f1 | 1337 | (set_attr "z10prop" "*,*,z10_super,*,*")]) |
9db1d521 HP |
1338 | |
1339 | (define_insn "*cmpqi_ccu" | |
ae156f85 | 1340 | [(set (reg CC_REGNUM) |
e221ef54 UW |
1341 | (compare (match_operand:QI 0 "nonimmediate_operand" "d,d,Q,S,Q,BQ") |
1342 | (match_operand:QI 1 "general_operand" "Q,S,n,n,BQ,Q")))] | |
575f7c2b | 1343 | "s390_match_ccmode (insn, CCUmode) |
575f7c2b | 1344 | && !register_operand (operands[1], QImode)" |
d3632d41 | 1345 | "@ |
fc0ea003 UW |
1346 | clm\t%0,1,%S1 |
1347 | clmy\t%0,1,%S1 | |
1348 | cli\t%S0,%b1 | |
1349 | cliy\t%S0,%b1 | |
e221ef54 | 1350 | # |
19b63d8e | 1351 | #" |
9381e3f1 | 1352 | [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS") |
3e4be43f | 1353 | (set_attr "cpu_facility" "*,longdisp,*,longdisp,*,*") |
9381e3f1 | 1354 | (set_attr "z10prop" "*,*,z10_super,z10_super,*,*")]) |
9db1d521 HP |
1355 | |
1356 | ||
19b63d8e UW |
1357 | ; Block compare (CLC) instruction patterns. |
1358 | ||
1359 | (define_insn "*clc" | |
ae156f85 | 1360 | [(set (reg CC_REGNUM) |
d4f52f0e | 1361 | (compare (match_operand:BLK 0 "memory_operand" "Q") |
19b63d8e UW |
1362 | (match_operand:BLK 1 "memory_operand" "Q"))) |
1363 | (use (match_operand 2 "const_int_operand" "n"))] | |
1364 | "s390_match_ccmode (insn, CCUmode) | |
1365 | && INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256" | |
fc0ea003 | 1366 | "clc\t%O0(%2,%R0),%S1" |
b628bd8e | 1367 | [(set_attr "op_type" "SS")]) |
19b63d8e UW |
1368 | |
1369 | (define_split | |
ae156f85 | 1370 | [(set (reg CC_REGNUM) |
19b63d8e UW |
1371 | (compare (match_operand 0 "memory_operand" "") |
1372 | (match_operand 1 "memory_operand" "")))] | |
1373 | "reload_completed | |
1374 | && s390_match_ccmode (insn, CCUmode) | |
1375 | && GET_MODE (operands[0]) == GET_MODE (operands[1]) | |
1376 | && GET_MODE_SIZE (GET_MODE (operands[0])) > 0" | |
1377 | [(parallel | |
1378 | [(set (match_dup 0) (match_dup 1)) | |
1379 | (use (match_dup 2))])] | |
1380 | { | |
1381 | operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0]))); | |
1382 | operands[0] = adjust_address (operands[0], BLKmode, 0); | |
1383 | operands[1] = adjust_address (operands[1], BLKmode, 0); | |
1384 | ||
1385 | operands[1] = gen_rtx_COMPARE (GET_MODE (SET_DEST (PATTERN (curr_insn))), | |
1386 | operands[0], operands[1]); | |
1387 | operands[0] = SET_DEST (PATTERN (curr_insn)); | |
1388 | }) | |
1389 | ||
1390 | ||
609e7e80 | 1391 | ; (TF|DF|SF|TD|DD|SD) instructions |
9db1d521 | 1392 | |
e325aba2 | 1393 | |
64c8e85a | 1394 | ; FIXME: load and test instructions turn SNaN into QNaN what is not |
e325aba2 AK |
1395 | ; acceptable if the target will be used afterwards. On the other hand |
1396 | ; they are quite convenient for implementing comparisons with 0.0. So | |
64c8e85a AK |
1397 | ; try to enable them via splitter/peephole if the value isn't needed anymore. |
1398 | ; See testcases: load-and-test-fp-1.c and load-and-test-fp-2.c | |
e325aba2 | 1399 | |
609e7e80 | 1400 | ; ltxbr, ltdbr, ltebr, ltxtr, ltdtr |
f5905b37 | 1401 | (define_insn "*cmp<mode>_ccs_0" |
ae156f85 | 1402 | [(set (reg CC_REGNUM) |
e325aba2 AK |
1403 | (compare (match_operand:FP 0 "register_operand" "f") |
1404 | (match_operand:FP 1 "const0_operand" ""))) | |
1405 | (clobber (match_operand:FP 2 "register_operand" "=0"))] | |
142cd70f | 1406 | "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT" |
609e7e80 | 1407 | "lt<xde><bt>r\t%0,%0" |
077dab3b | 1408 | [(set_attr "op_type" "RRE") |
9381e3f1 | 1409 | (set_attr "type" "fsimp<mode>")]) |
9db1d521 | 1410 | |
2de2b3f9 AK |
1411 | ; VX: TFmode in FPR pairs: use cxbr instead of wfcxb |
1412 | ; cxtr, cdtr, cxbr, cdbr, cebr, cdb, ceb, wfcsb, wfcdb | |
f5905b37 | 1413 | (define_insn "*cmp<mode>_ccs" |
ae156f85 | 1414 | [(set (reg CC_REGNUM) |
2de2b3f9 AK |
1415 | (compare (match_operand:FP 0 "register_operand" "f,f,v,v") |
1416 | (match_operand:FP 1 "general_operand" "f,R,v,v")))] | |
142cd70f | 1417 | "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT" |
9db1d521 | 1418 | "@ |
609e7e80 | 1419 | c<xde><bt>r\t%0,%1 |
77c585ca | 1420 | c<xde>b\t%0,%1 |
2de2b3f9 AK |
1421 | wfcdb\t%0,%1 |
1422 | wfcsb\t%0,%1" | |
1423 | [(set_attr "op_type" "RRE,RXE,VRR,VRR") | |
1424 | (set_attr "cpu_facility" "*,*,vx,vxe") | |
1425 | (set_attr "enabled" "*,<DSF>,<DF>,<SF>")]) | |
963fc8d0 AK |
1426 | |
1427 | ; Compare and Branch instructions | |
1428 | ||
1429 | ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr | |
9381e3f1 WG |
1430 | ; The following instructions do a complementary access of their second |
1431 | ; operand (z01 only): crj_c, cgrjc, cr, cgr | |
963fc8d0 AK |
1432 | (define_insn "*cmp_and_br_signed_<mode>" |
1433 | [(set (pc) | |
1434 | (if_then_else (match_operator 0 "s390_signed_integer_comparison" | |
1435 | [(match_operand:GPR 1 "register_operand" "d,d") | |
1436 | (match_operand:GPR 2 "nonmemory_operand" "d,C")]) | |
1437 | (label_ref (match_operand 3 "" "")) | |
1438 | (pc))) | |
1439 | (clobber (reg:CC CC_REGNUM))] | |
65b1d8ea | 1440 | "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH" |
963fc8d0 AK |
1441 | { |
1442 | if (get_attr_length (insn) == 6) | |
1443 | return which_alternative ? | |
1444 | "c<g>ij%C0\t%1,%c2,%l3" : "c<g>rj%C0\t%1,%2,%l3"; | |
1445 | else | |
1446 | return which_alternative ? | |
1447 | "c<g>fi\t%1,%c2\;jg%C0\t%l3" : "c<g>r\t%1,%2\;jg%C0\t%l3"; | |
1448 | } | |
1449 | [(set_attr "op_type" "RIE") | |
1450 | (set_attr "type" "branch") | |
e3cba5e5 | 1451 | (set_attr "z10prop" "z10_super_c,z10_super") |
963fc8d0 AK |
1452 | (set (attr "length") |
1453 | (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000)) | |
1454 | (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg | |
1455 | ; 10 byte for cgr/jg | |
1456 | ||
1457 | ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr | |
9381e3f1 WG |
1458 | ; The following instructions do a complementary access of their second |
1459 | ; operand (z10 only): clrj, clgrj, clr, clgr | |
963fc8d0 AK |
1460 | (define_insn "*cmp_and_br_unsigned_<mode>" |
1461 | [(set (pc) | |
1462 | (if_then_else (match_operator 0 "s390_unsigned_integer_comparison" | |
1463 | [(match_operand:GPR 1 "register_operand" "d,d") | |
1464 | (match_operand:GPR 2 "nonmemory_operand" "d,I")]) | |
1465 | (label_ref (match_operand 3 "" "")) | |
1466 | (pc))) | |
1467 | (clobber (reg:CC CC_REGNUM))] | |
65b1d8ea | 1468 | "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH" |
963fc8d0 AK |
1469 | { |
1470 | if (get_attr_length (insn) == 6) | |
1471 | return which_alternative ? | |
1472 | "cl<g>ij%C0\t%1,%b2,%l3" : "cl<g>rj%C0\t%1,%2,%l3"; | |
1473 | else | |
1474 | return which_alternative ? | |
1475 | "cl<g>fi\t%1,%b2\;jg%C0\t%l3" : "cl<g>r\t%1,%2\;jg%C0\t%l3"; | |
1476 | } | |
1477 | [(set_attr "op_type" "RIE") | |
1478 | (set_attr "type" "branch") | |
e3cba5e5 | 1479 | (set_attr "z10prop" "z10_super_c,z10_super") |
963fc8d0 AK |
1480 | (set (attr "length") |
1481 | (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000)) | |
1482 | (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg | |
1483 | ; 10 byte for clgr/jg | |
1484 | ||
b0f86a7e AK |
1485 | ; And now the same two patterns as above but with a negated CC mask. |
1486 | ||
1487 | ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr | |
1488 | ; The following instructions do a complementary access of their second | |
1489 | ; operand (z01 only): crj_c, cgrjc, cr, cgr | |
1490 | (define_insn "*icmp_and_br_signed_<mode>" | |
1491 | [(set (pc) | |
1492 | (if_then_else (match_operator 0 "s390_signed_integer_comparison" | |
1493 | [(match_operand:GPR 1 "register_operand" "d,d") | |
1494 | (match_operand:GPR 2 "nonmemory_operand" "d,C")]) | |
1495 | (pc) | |
1496 | (label_ref (match_operand 3 "" "")))) | |
1497 | (clobber (reg:CC CC_REGNUM))] | |
65b1d8ea | 1498 | "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH" |
b0f86a7e AK |
1499 | { |
1500 | if (get_attr_length (insn) == 6) | |
1501 | return which_alternative ? | |
1502 | "c<g>ij%D0\t%1,%c2,%l3" : "c<g>rj%D0\t%1,%2,%l3"; | |
1503 | else | |
1504 | return which_alternative ? | |
1505 | "c<g>fi\t%1,%c2\;jg%D0\t%l3" : "c<g>r\t%1,%2\;jg%D0\t%l3"; | |
1506 | } | |
1507 | [(set_attr "op_type" "RIE") | |
1508 | (set_attr "type" "branch") | |
1509 | (set_attr "z10prop" "z10_super_c,z10_super") | |
1510 | (set (attr "length") | |
1511 | (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000)) | |
1512 | (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg | |
1513 | ; 10 byte for cgr/jg | |
1514 | ||
1515 | ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr | |
1516 | ; The following instructions do a complementary access of their second | |
1517 | ; operand (z10 only): clrj, clgrj, clr, clgr | |
1518 | (define_insn "*icmp_and_br_unsigned_<mode>" | |
1519 | [(set (pc) | |
1520 | (if_then_else (match_operator 0 "s390_unsigned_integer_comparison" | |
1521 | [(match_operand:GPR 1 "register_operand" "d,d") | |
1522 | (match_operand:GPR 2 "nonmemory_operand" "d,I")]) | |
1523 | (pc) | |
1524 | (label_ref (match_operand 3 "" "")))) | |
1525 | (clobber (reg:CC CC_REGNUM))] | |
65b1d8ea | 1526 | "TARGET_Z10 && !TARGET_AVOID_CMP_AND_BRANCH" |
b0f86a7e AK |
1527 | { |
1528 | if (get_attr_length (insn) == 6) | |
1529 | return which_alternative ? | |
1530 | "cl<g>ij%D0\t%1,%b2,%l3" : "cl<g>rj%D0\t%1,%2,%l3"; | |
1531 | else | |
1532 | return which_alternative ? | |
1533 | "cl<g>fi\t%1,%b2\;jg%D0\t%l3" : "cl<g>r\t%1,%2\;jg%D0\t%l3"; | |
1534 | } | |
1535 | [(set_attr "op_type" "RIE") | |
1536 | (set_attr "type" "branch") | |
1537 | (set_attr "z10prop" "z10_super_c,z10_super") | |
1538 | (set (attr "length") | |
1539 | (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000)) | |
1540 | (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg | |
1541 | ; 10 byte for clgr/jg | |
1542 | ||
9db1d521 HP |
1543 | ;; |
1544 | ;;- Move instructions. | |
1545 | ;; | |
1546 | ||
1547 | ; | |
1548 | ; movti instruction pattern(s). | |
1549 | ; | |
1550 | ||
3cb9ee2f AK |
1551 | |
1552 | ; Separate out the register pair alternative since constraints (P) are | |
1553 | ; not able to deal with const_wide_int's. But predicates do. | |
1554 | (define_insn "*movti_bigconst" | |
1555 | [(set (match_operand:TI 0 "register_operand" "=d") | |
1556 | (match_operand:TI 1 "reload_const_wide_int_operand" ""))] | |
1557 | "TARGET_ZARCH" | |
1558 | "#") | |
1559 | ||
085261c8 AK |
1560 | ; FIXME: More constants are possible by enabling jxx, jyy constraints |
1561 | ; for TImode (use double-int for the calculations) | |
9db1d521 | 1562 | (define_insn "movti" |
9f3c21d6 AK |
1563 | [(set (match_operand:TI 0 "nonimmediate_operand" "=d,S,v, v, v,v,d,v,R,d, d, d, d, d,o") |
1564 | (match_operand:TI 1 "general_operand" " S,d,v,j00,jm1,d,v,R,v,K,NxHD0,Os,NxSD0,dT,d"))] | |
9602b6a1 | 1565 | "TARGET_ZARCH" |
4023fb28 | 1566 | "@ |
fc0ea003 UW |
1567 | lmg\t%0,%N0,%S1 |
1568 | stmg\t%1,%N1,%S0 | |
085261c8 AK |
1569 | vlr\t%v0,%v1 |
1570 | vzero\t%v0 | |
1571 | vone\t%v0 | |
1572 | vlvgp\t%v0,%1,%N1 | |
1573 | # | |
b8923037 AK |
1574 | vl\t%v0,%1%A1 |
1575 | vst\t%v1,%0%A0 | |
4023fb28 | 1576 | # |
9f3c21d6 AK |
1577 | # |
1578 | # | |
1579 | # | |
1580 | # | |
19b63d8e | 1581 | #" |
9f3c21d6 AK |
1582 | [(set_attr "op_type" "RSY,RSY,VRR,VRI,VRI,VRR,*,VRX,VRX,*,*,*,*,*,*") |
1583 | (set_attr "type" "lm,stm,*,*,*,*,*,*,*,*,*,*,*,*,*") | |
1584 | (set_attr "cpu_facility" "*,*,vx,vx,vx,vx,vx,vx,vx,*,*,*,extimm,*,*")]) | |
4023fb28 UW |
1585 | |
1586 | (define_split | |
1587 | [(set (match_operand:TI 0 "nonimmediate_operand" "") | |
1588 | (match_operand:TI 1 "general_operand" ""))] | |
9602b6a1 | 1589 | "TARGET_ZARCH && reload_completed |
9d605427 AK |
1590 | && !s_operand (operands[0], TImode) |
1591 | && !s_operand (operands[1], TImode) | |
dc65c307 | 1592 | && s390_split_ok_p (operands[0], operands[1], TImode, 0)" |
4023fb28 UW |
1593 | [(set (match_dup 2) (match_dup 4)) |
1594 | (set (match_dup 3) (match_dup 5))] | |
9db1d521 | 1595 | { |
dc65c307 UW |
1596 | operands[2] = operand_subword (operands[0], 0, 0, TImode); |
1597 | operands[3] = operand_subword (operands[0], 1, 0, TImode); | |
1598 | operands[4] = operand_subword (operands[1], 0, 0, TImode); | |
1599 | operands[5] = operand_subword (operands[1], 1, 0, TImode); | |
1600 | }) | |
1601 | ||
1602 | (define_split | |
1603 | [(set (match_operand:TI 0 "nonimmediate_operand" "") | |
1604 | (match_operand:TI 1 "general_operand" ""))] | |
9602b6a1 | 1605 | "TARGET_ZARCH && reload_completed |
9d605427 AK |
1606 | && !s_operand (operands[0], TImode) |
1607 | && !s_operand (operands[1], TImode) | |
dc65c307 UW |
1608 | && s390_split_ok_p (operands[0], operands[1], TImode, 1)" |
1609 | [(set (match_dup 2) (match_dup 4)) | |
1610 | (set (match_dup 3) (match_dup 5))] | |
1611 | { | |
1612 | operands[2] = operand_subword (operands[0], 1, 0, TImode); | |
1613 | operands[3] = operand_subword (operands[0], 0, 0, TImode); | |
1614 | operands[4] = operand_subword (operands[1], 1, 0, TImode); | |
1615 | operands[5] = operand_subword (operands[1], 0, 0, TImode); | |
1616 | }) | |
4023fb28 | 1617 | |
085261c8 AK |
1618 | ; Use part of the TImode target reg to perform the address |
1619 | ; calculation. If the TImode value is supposed to be copied into a VR | |
1620 | ; this splitter is not necessary. | |
4023fb28 UW |
1621 | (define_split |
1622 | [(set (match_operand:TI 0 "register_operand" "") | |
1623 | (match_operand:TI 1 "memory_operand" ""))] | |
9602b6a1 | 1624 | "TARGET_ZARCH && reload_completed |
085261c8 | 1625 | && !VECTOR_REG_P (operands[0]) |
4023fb28 | 1626 | && !s_operand (operands[1], VOIDmode)" |
a41c6c53 | 1627 | [(set (match_dup 0) (match_dup 1))] |
a41c6c53 UW |
1628 | { |
1629 | rtx addr = operand_subword (operands[0], 1, 0, TImode); | |
9602b6a1 | 1630 | addr = gen_lowpart (Pmode, addr); |
a41c6c53 UW |
1631 | s390_load_address (addr, XEXP (operands[1], 0)); |
1632 | operands[1] = replace_equiv_address (operands[1], addr); | |
dc65c307 UW |
1633 | }) |
1634 | ||
833cd70a | 1635 | |
085261c8 AK |
1636 | ; Split a VR -> GPR TImode move into 2 vector load GR from VR element. |
1637 | ; For the higher order bits we do simply a DImode move while the | |
1638 | ; second part is done via vec extract. Both will end up as vlgvg. | |
1639 | (define_split | |
1640 | [(set (match_operand:TI 0 "register_operand" "") | |
1641 | (match_operand:TI 1 "register_operand" ""))] | |
1642 | "TARGET_VX && reload_completed | |
1643 | && GENERAL_REG_P (operands[0]) | |
1644 | && VECTOR_REG_P (operands[1])" | |
1645 | [(set (match_dup 2) (match_dup 4)) | |
1646 | (set (match_dup 3) (unspec:DI [(match_dup 5) (const_int 1)] | |
1647 | UNSPEC_VEC_EXTRACT))] | |
1648 | { | |
1649 | operands[2] = operand_subword (operands[0], 0, 0, TImode); | |
1650 | operands[3] = operand_subword (operands[0], 1, 0, TImode); | |
1651 | operands[4] = gen_rtx_REG (DImode, REGNO (operands[1])); | |
1652 | operands[5] = gen_rtx_REG (V2DImode, REGNO (operands[1])); | |
1653 | }) | |
1654 | ||
833cd70a AK |
1655 | ; |
1656 | ; Patterns used for secondary reloads | |
1657 | ; | |
1658 | ||
963fc8d0 AK |
1659 | ; z10 provides move instructions accepting larl memory operands. |
1660 | ; Unfortunately there is no such variant for QI, TI and FP mode moves. | |
1661 | ; These patterns are also used for unaligned SI and DI accesses. | |
1662 | ||
085261c8 AK |
1663 | (define_expand "reload<ALL:mode><P:mode>_tomem_z10" |
1664 | [(parallel [(match_operand:ALL 0 "memory_operand" "") | |
1665 | (match_operand:ALL 1 "register_operand" "=d") | |
1666 | (match_operand:P 2 "register_operand" "=&a")])] | |
963fc8d0 AK |
1667 | "TARGET_Z10" |
1668 | { | |
1669 | s390_reload_symref_address (operands[1], operands[0], operands[2], 1); | |
1670 | DONE; | |
1671 | }) | |
1672 | ||
085261c8 AK |
1673 | (define_expand "reload<ALL:mode><P:mode>_toreg_z10" |
1674 | [(parallel [(match_operand:ALL 0 "register_operand" "=d") | |
1675 | (match_operand:ALL 1 "memory_operand" "") | |
1676 | (match_operand:P 2 "register_operand" "=a")])] | |
963fc8d0 AK |
1677 | "TARGET_Z10" |
1678 | { | |
1679 | s390_reload_symref_address (operands[0], operands[1], operands[2], 0); | |
1680 | DONE; | |
1681 | }) | |
1682 | ||
1683 | (define_expand "reload<P:mode>_larl_odd_addend_z10" | |
1684 | [(parallel [(match_operand:P 0 "register_operand" "=d") | |
1685 | (match_operand:P 1 "larl_operand" "") | |
1686 | (match_operand:P 2 "register_operand" "=a")])] | |
1687 | "TARGET_Z10" | |
1688 | { | |
1689 | s390_reload_larl_operand (operands[0], operands[1], operands[2]); | |
1690 | DONE; | |
1691 | }) | |
1692 | ||
833cd70a AK |
1693 | ; Handles loading a PLUS (load address) expression |
1694 | ||
1695 | (define_expand "reload<mode>_plus" | |
1696 | [(parallel [(match_operand:P 0 "register_operand" "=a") | |
1697 | (match_operand:P 1 "s390_plus_operand" "") | |
1698 | (match_operand:P 2 "register_operand" "=&a")])] | |
1699 | "" | |
1700 | { | |
1701 | s390_expand_plus_operand (operands[0], operands[1], operands[2]); | |
1702 | DONE; | |
1703 | }) | |
1704 | ||
085261c8 AK |
1705 | ; Not all the indirect memory access instructions support the full |
1706 | ; format (long disp + index + base). So whenever a move from/to such | |
1707 | ; an address is required and the instruction cannot deal with it we do | |
1708 | ; a load address into a scratch register first and use this as the new | |
1709 | ; base register. | |
1710 | ; This in particular is used for: | |
1711 | ; - non-offsetable memory accesses for multiword moves | |
1712 | ; - full vector reg moves with long displacements | |
833cd70a | 1713 | |
085261c8 | 1714 | (define_expand "reload<mode>_la_in" |
833cd70a AK |
1715 | [(parallel [(match_operand 0 "register_operand" "") |
1716 | (match_operand 1 "" "") | |
1717 | (match_operand:P 2 "register_operand" "=&a")])] | |
1718 | "" | |
1719 | { | |
1720 | gcc_assert (MEM_P (operands[1])); | |
1721 | s390_load_address (operands[2], find_replacement (&XEXP (operands[1], 0))); | |
1722 | operands[1] = replace_equiv_address (operands[1], operands[2]); | |
1723 | emit_move_insn (operands[0], operands[1]); | |
1724 | DONE; | |
1725 | }) | |
1726 | ||
085261c8 | 1727 | (define_expand "reload<mode>_la_out" |
833cd70a AK |
1728 | [(parallel [(match_operand 0 "" "") |
1729 | (match_operand 1 "register_operand" "") | |
1730 | (match_operand:P 2 "register_operand" "=&a")])] | |
1731 | "" | |
dc65c307 | 1732 | { |
9c3c3dcc | 1733 | gcc_assert (MEM_P (operands[0])); |
9c90a97e | 1734 | s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0))); |
dc65c307 UW |
1735 | operands[0] = replace_equiv_address (operands[0], operands[2]); |
1736 | emit_move_insn (operands[0], operands[1]); | |
1737 | DONE; | |
1738 | }) | |
9db1d521 | 1739 | |
1f9e1fc6 AK |
1740 | (define_expand "reload<mode>_PIC_addr" |
1741 | [(parallel [(match_operand 0 "register_operand" "=d") | |
1742 | (match_operand 1 "larl_operand" "") | |
1743 | (match_operand:P 2 "register_operand" "=a")])] | |
1744 | "" | |
1745 | { | |
0a2aaacc KG |
1746 | rtx new_rtx = legitimize_pic_address (operands[1], operands[2]); |
1747 | emit_move_insn (operands[0], new_rtx); | |
1f9e1fc6 AK |
1748 | }) |
1749 | ||
9db1d521 HP |
1750 | ; |
1751 | ; movdi instruction pattern(s). | |
1752 | ; | |
1753 | ||
9db1d521 HP |
1754 | (define_expand "movdi" |
1755 | [(set (match_operand:DI 0 "general_operand" "") | |
1756 | (match_operand:DI 1 "general_operand" ""))] | |
1757 | "" | |
9db1d521 | 1758 | { |
fd3cd001 | 1759 | /* Handle symbolic constants. */ |
e4f2cd43 AK |
1760 | if (TARGET_64BIT |
1761 | && (SYMBOLIC_CONST (operands[1]) | |
1762 | || (GET_CODE (operands[1]) == PLUS | |
1763 | && XEXP (operands[1], 0) == pic_offset_table_rtx | |
1764 | && SYMBOLIC_CONST (XEXP (operands[1], 1))))) | |
fd3cd001 | 1765 | emit_symbolic_move (operands); |
10bbf137 | 1766 | }) |
9db1d521 | 1767 | |
3af8e996 | 1768 | (define_insn "*movdi_64" |
85dae55a | 1769 | [(set (match_operand:DI 0 "nonimmediate_operand" |
b6f51755 | 1770 | "=d, d, d, d, d, d, d, d,f,d,d,d,d,d,T,!*f,!*f,!*f,!R,!T,b,Q,d,t,Q,t,v,v,v,d,v,R,d") |
85dae55a | 1771 | (match_operand:DI 1 "general_operand" |
b6f51755 | 1772 | " K,N0HD0,N1HD0,N2HD0,N3HD0,Os,N0SD0,N1SD0,d,f,L,b,d,T,d, *f, R, T,*f,*f,d,K,t,d,t,Q,K,v,d,v,R,v,ZL"))] |
9602b6a1 | 1773 | "TARGET_ZARCH" |
85dae55a AK |
1774 | "@ |
1775 | lghi\t%0,%h1 | |
1776 | llihh\t%0,%i1 | |
1777 | llihl\t%0,%i1 | |
1778 | llilh\t%0,%i1 | |
1779 | llill\t%0,%i1 | |
1780 | lgfi\t%0,%1 | |
1781 | llihf\t%0,%k1 | |
1782 | llilf\t%0,%k1 | |
1783 | ldgr\t%0,%1 | |
1784 | lgdr\t%0,%1 | |
1785 | lay\t%0,%a1 | |
963fc8d0 | 1786 | lgrl\t%0,%1 |
85dae55a AK |
1787 | lgr\t%0,%1 |
1788 | lg\t%0,%1 | |
1789 | stg\t%1,%0 | |
1790 | ldr\t%0,%1 | |
1791 | ld\t%0,%1 | |
1792 | ldy\t%0,%1 | |
1793 | std\t%1,%0 | |
1794 | stdy\t%1,%0 | |
963fc8d0 AK |
1795 | stgrl\t%1,%0 |
1796 | mvghi\t%0,%1 | |
85dae55a AK |
1797 | # |
1798 | # | |
1799 | stam\t%1,%N1,%S0 | |
085261c8 AK |
1800 | lam\t%0,%N0,%S1 |
1801 | vleig\t%v0,%h1,0 | |
1802 | vlr\t%v0,%v1 | |
1803 | vlvgg\t%v0,%1,0 | |
1804 | vlgvg\t%0,%v1,0 | |
1805 | vleg\t%v0,%1,0 | |
b6f51755 IL |
1806 | vsteg\t%v1,%0,0 |
1807 | larl\t%0,%1" | |
963fc8d0 | 1808 | [(set_attr "op_type" "RI,RI,RI,RI,RI,RIL,RIL,RIL,RRE,RRE,RXY,RIL,RRE,RXY, |
b6f51755 IL |
1809 | RXY,RR,RX,RXY,RX,RXY,RIL,SIL,*,*,RS,RS,VRI,VRR,VRS,VRS, |
1810 | VRX,VRX,RIL") | |
963fc8d0 | 1811 | (set_attr "type" "*,*,*,*,*,*,*,*,floaddf,floaddf,la,larl,lr,load,store, |
085261c8 | 1812 | floaddf,floaddf,floaddf,fstoredf,fstoredf,larl,*,*,*,*, |
b6f51755 | 1813 | *,*,*,*,*,*,*,larl") |
3af8e996 | 1814 | (set_attr "cpu_facility" "*,*,*,*,*,extimm,extimm,extimm,dfp,dfp,longdisp, |
963fc8d0 | 1815 | z10,*,*,*,*,*,longdisp,*,longdisp, |
b6f51755 | 1816 | z10,z10,*,*,*,*,vx,vx,vx,vx,vx,vx,*") |
9381e3f1 WG |
1817 | (set_attr "z10prop" "z10_fwd_A1, |
1818 | z10_fwd_E1, | |
1819 | z10_fwd_E1, | |
1820 | z10_fwd_E1, | |
1821 | z10_fwd_E1, | |
1822 | z10_fwd_A1, | |
1823 | z10_fwd_E1, | |
1824 | z10_fwd_E1, | |
1825 | *, | |
1826 | *, | |
1827 | z10_fwd_A1, | |
1828 | z10_fwd_A3, | |
1829 | z10_fr_E1, | |
1830 | z10_fwd_A3, | |
1831 | z10_rec, | |
1832 | *, | |
1833 | *, | |
1834 | *, | |
1835 | *, | |
1836 | *, | |
1837 | z10_rec, | |
1838 | z10_super, | |
1839 | *, | |
1840 | *, | |
1841 | *, | |
b6f51755 IL |
1842 | *,*,*,*,*,*,*, |
1843 | z10_super_A1") | |
14cfceb7 IL |
1844 | (set_attr "relative_long" "*,*,*,*,*,*,*,*,*,*, |
1845 | *,yes,*,*,*,*,*,*,*,*, | |
1846 | yes,*,*,*,*,*,*,*,*,*, | |
1847 | *,*,yes") | |
9381e3f1 | 1848 | ]) |
c5aa1d12 UW |
1849 | |
1850 | (define_split | |
1851 | [(set (match_operand:DI 0 "register_operand" "") | |
1852 | (match_operand:DI 1 "register_operand" ""))] | |
9602b6a1 | 1853 | "TARGET_ZARCH && ACCESS_REG_P (operands[1])" |
c5aa1d12 UW |
1854 | [(set (match_dup 2) (match_dup 3)) |
1855 | (set (match_dup 0) (ashift:DI (match_dup 0) (const_int 32))) | |
1856 | (set (strict_low_part (match_dup 2)) (match_dup 4))] | |
1857 | "operands[2] = gen_lowpart (SImode, operands[0]); | |
1858 | s390_split_access_reg (operands[1], &operands[4], &operands[3]);") | |
1859 | ||
1860 | (define_split | |
1861 | [(set (match_operand:DI 0 "register_operand" "") | |
1862 | (match_operand:DI 1 "register_operand" ""))] | |
9602b6a1 | 1863 | "TARGET_ZARCH && ACCESS_REG_P (operands[0]) |
c5aa1d12 UW |
1864 | && dead_or_set_p (insn, operands[1])" |
1865 | [(set (match_dup 3) (match_dup 2)) | |
1866 | (set (match_dup 1) (lshiftrt:DI (match_dup 1) (const_int 32))) | |
1867 | (set (match_dup 4) (match_dup 2))] | |
1868 | "operands[2] = gen_lowpart (SImode, operands[1]); | |
1869 | s390_split_access_reg (operands[0], &operands[3], &operands[4]);") | |
1870 | ||
1871 | (define_split | |
1872 | [(set (match_operand:DI 0 "register_operand" "") | |
1873 | (match_operand:DI 1 "register_operand" ""))] | |
9602b6a1 | 1874 | "TARGET_ZARCH && ACCESS_REG_P (operands[0]) |
c5aa1d12 UW |
1875 | && !dead_or_set_p (insn, operands[1])" |
1876 | [(set (match_dup 3) (match_dup 2)) | |
1877 | (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32))) | |
1878 | (set (match_dup 4) (match_dup 2)) | |
1879 | (set (match_dup 1) (rotate:DI (match_dup 1) (const_int 32)))] | |
1880 | "operands[2] = gen_lowpart (SImode, operands[1]); | |
1881 | s390_split_access_reg (operands[0], &operands[3], &operands[4]);") | |
9db1d521 HP |
1882 | |
1883 | (define_insn "*movdi_31" | |
963fc8d0 | 1884 | [(set (match_operand:DI 0 "nonimmediate_operand" |
3e4be43f | 1885 | "=d,d,Q,S,d ,o,!*f,!*f,!*f,!R,!T,d") |
963fc8d0 | 1886 | (match_operand:DI 1 "general_operand" |
3e4be43f | 1887 | " Q,S,d,d,dPT,d, *f, R, T,*f,*f,b"))] |
9602b6a1 | 1888 | "!TARGET_ZARCH" |
4023fb28 | 1889 | "@ |
fc0ea003 | 1890 | lm\t%0,%N0,%S1 |
c4d50129 | 1891 | lmy\t%0,%N0,%S1 |
fc0ea003 | 1892 | stm\t%1,%N1,%S0 |
c4d50129 | 1893 | stmy\t%1,%N1,%S0 |
4023fb28 UW |
1894 | # |
1895 | # | |
d40c829f UW |
1896 | ldr\t%0,%1 |
1897 | ld\t%0,%1 | |
1898 | ldy\t%0,%1 | |
1899 | std\t%1,%0 | |
1900 | stdy\t%1,%0 | |
19b63d8e | 1901 | #" |
f2dc2f86 AK |
1902 | [(set_attr "op_type" "RS,RSY,RS,RSY,*,*,RR,RX,RXY,RX,RXY,*") |
1903 | (set_attr "type" "lm,lm,stm,stm,*,*,floaddf,floaddf,floaddf,fstoredf,fstoredf,*") | |
3e4be43f | 1904 | (set_attr "cpu_facility" "*,longdisp,*,longdisp,*,*,*,*,longdisp,*,longdisp,z10")]) |
963fc8d0 AK |
1905 | |
1906 | ; For a load from a symbol ref we can use one of the target registers | |
1907 | ; together with larl to load the address. | |
1908 | (define_split | |
1909 | [(set (match_operand:DI 0 "register_operand" "") | |
1910 | (match_operand:DI 1 "memory_operand" ""))] | |
9602b6a1 | 1911 | "!TARGET_ZARCH && reload_completed && TARGET_Z10 |
963fc8d0 AK |
1912 | && larl_operand (XEXP (operands[1], 0), SImode)" |
1913 | [(set (match_dup 2) (match_dup 3)) | |
1914 | (set (match_dup 0) (match_dup 1))] | |
1915 | { | |
1916 | operands[2] = operand_subword (operands[0], 1, 0, DImode); | |
1917 | operands[3] = XEXP (operands[1], 0); | |
1918 | operands[1] = replace_equiv_address (operands[1], operands[2]); | |
1919 | }) | |
4023fb28 UW |
1920 | |
1921 | (define_split | |
1922 | [(set (match_operand:DI 0 "nonimmediate_operand" "") | |
1923 | (match_operand:DI 1 "general_operand" ""))] | |
9602b6a1 | 1924 | "!TARGET_ZARCH && reload_completed |
9d605427 AK |
1925 | && !s_operand (operands[0], DImode) |
1926 | && !s_operand (operands[1], DImode) | |
dc65c307 | 1927 | && s390_split_ok_p (operands[0], operands[1], DImode, 0)" |
4023fb28 UW |
1928 | [(set (match_dup 2) (match_dup 4)) |
1929 | (set (match_dup 3) (match_dup 5))] | |
9db1d521 | 1930 | { |
dc65c307 UW |
1931 | operands[2] = operand_subword (operands[0], 0, 0, DImode); |
1932 | operands[3] = operand_subword (operands[0], 1, 0, DImode); | |
1933 | operands[4] = operand_subword (operands[1], 0, 0, DImode); | |
1934 | operands[5] = operand_subword (operands[1], 1, 0, DImode); | |
1935 | }) | |
1936 | ||
1937 | (define_split | |
1938 | [(set (match_operand:DI 0 "nonimmediate_operand" "") | |
1939 | (match_operand:DI 1 "general_operand" ""))] | |
9602b6a1 | 1940 | "!TARGET_ZARCH && reload_completed |
9d605427 AK |
1941 | && !s_operand (operands[0], DImode) |
1942 | && !s_operand (operands[1], DImode) | |
dc65c307 UW |
1943 | && s390_split_ok_p (operands[0], operands[1], DImode, 1)" |
1944 | [(set (match_dup 2) (match_dup 4)) | |
1945 | (set (match_dup 3) (match_dup 5))] | |
1946 | { | |
1947 | operands[2] = operand_subword (operands[0], 1, 0, DImode); | |
1948 | operands[3] = operand_subword (operands[0], 0, 0, DImode); | |
1949 | operands[4] = operand_subword (operands[1], 1, 0, DImode); | |
1950 | operands[5] = operand_subword (operands[1], 0, 0, DImode); | |
1951 | }) | |
9db1d521 | 1952 | |
4023fb28 UW |
1953 | (define_split |
1954 | [(set (match_operand:DI 0 "register_operand" "") | |
1955 | (match_operand:DI 1 "memory_operand" ""))] | |
9602b6a1 | 1956 | "!TARGET_ZARCH && reload_completed |
8e509cf9 | 1957 | && !FP_REG_P (operands[0]) |
4023fb28 | 1958 | && !s_operand (operands[1], VOIDmode)" |
a41c6c53 | 1959 | [(set (match_dup 0) (match_dup 1))] |
a41c6c53 UW |
1960 | { |
1961 | rtx addr = operand_subword (operands[0], 1, 0, DImode); | |
1962 | s390_load_address (addr, XEXP (operands[1], 0)); | |
1963 | operands[1] = replace_equiv_address (operands[1], addr); | |
dc65c307 UW |
1964 | }) |
1965 | ||
84817c5d UW |
1966 | (define_peephole2 |
1967 | [(set (match_operand:DI 0 "register_operand" "") | |
1968 | (mem:DI (match_operand 1 "address_operand" "")))] | |
9602b6a1 | 1969 | "TARGET_ZARCH |
84817c5d UW |
1970 | && !FP_REG_P (operands[0]) |
1971 | && GET_CODE (operands[1]) == SYMBOL_REF | |
1972 | && CONSTANT_POOL_ADDRESS_P (operands[1]) | |
1973 | && get_pool_mode (operands[1]) == DImode | |
1974 | && legitimate_reload_constant_p (get_pool_constant (operands[1]))" | |
1975 | [(set (match_dup 0) (match_dup 2))] | |
1976 | "operands[2] = get_pool_constant (operands[1]);") | |
1977 | ||
7bdff56f UW |
1978 | (define_insn "*la_64" |
1979 | [(set (match_operand:DI 0 "register_operand" "=d,d") | |
3e4be43f | 1980 | (match_operand:QI 1 "address_operand" "ZR,ZT"))] |
7bdff56f UW |
1981 | "TARGET_64BIT" |
1982 | "@ | |
1983 | la\t%0,%a1 | |
1984 | lay\t%0,%a1" | |
1985 | [(set_attr "op_type" "RX,RXY") | |
9381e3f1 | 1986 | (set_attr "type" "la") |
3e4be43f | 1987 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 1988 | (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")]) |
7bdff56f UW |
1989 | |
1990 | (define_peephole2 | |
1991 | [(parallel | |
1992 | [(set (match_operand:DI 0 "register_operand" "") | |
1993 | (match_operand:QI 1 "address_operand" "")) | |
ae156f85 | 1994 | (clobber (reg:CC CC_REGNUM))])] |
7bdff56f | 1995 | "TARGET_64BIT |
e1d5ee28 | 1996 | && preferred_la_operand_p (operands[1], const0_rtx)" |
7bdff56f UW |
1997 | [(set (match_dup 0) (match_dup 1))] |
1998 | "") | |
1999 | ||
2000 | (define_peephole2 | |
2001 | [(set (match_operand:DI 0 "register_operand" "") | |
2002 | (match_operand:DI 1 "register_operand" "")) | |
2003 | (parallel | |
2004 | [(set (match_dup 0) | |
2005 | (plus:DI (match_dup 0) | |
2006 | (match_operand:DI 2 "nonmemory_operand" ""))) | |
ae156f85 | 2007 | (clobber (reg:CC CC_REGNUM))])] |
7bdff56f UW |
2008 | "TARGET_64BIT |
2009 | && !reg_overlap_mentioned_p (operands[0], operands[2]) | |
e1d5ee28 | 2010 | && preferred_la_operand_p (operands[1], operands[2])" |
7bdff56f UW |
2011 | [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))] |
2012 | "") | |
2013 | ||
9db1d521 HP |
2014 | ; |
2015 | ; movsi instruction pattern(s). | |
2016 | ; | |
2017 | ||
9db1d521 HP |
2018 | (define_expand "movsi" |
2019 | [(set (match_operand:SI 0 "general_operand" "") | |
2020 | (match_operand:SI 1 "general_operand" ""))] | |
2021 | "" | |
9db1d521 | 2022 | { |
fd3cd001 | 2023 | /* Handle symbolic constants. */ |
e4f2cd43 AK |
2024 | if (!TARGET_64BIT |
2025 | && (SYMBOLIC_CONST (operands[1]) | |
2026 | || (GET_CODE (operands[1]) == PLUS | |
2027 | && XEXP (operands[1], 0) == pic_offset_table_rtx | |
2028 | && SYMBOLIC_CONST (XEXP(operands[1], 1))))) | |
fd3cd001 | 2029 | emit_symbolic_move (operands); |
10bbf137 | 2030 | }) |
9db1d521 | 2031 | |
9e8327e3 UW |
2032 | (define_insn "*movsi_larl" |
2033 | [(set (match_operand:SI 0 "register_operand" "=d") | |
2034 | (match_operand:SI 1 "larl_operand" "X"))] | |
8cc6307c | 2035 | "!TARGET_64BIT |
9e8327e3 UW |
2036 | && !FP_REG_P (operands[0])" |
2037 | "larl\t%0,%1" | |
2038 | [(set_attr "op_type" "RIL") | |
9381e3f1 | 2039 | (set_attr "type" "larl") |
14cfceb7 IL |
2040 | (set_attr "z10prop" "z10_fwd_A1") |
2041 | (set_attr "relative_long" "yes")]) | |
9e8327e3 | 2042 | |
f19a9af7 | 2043 | (define_insn "*movsi_zarch" |
2f7e5a0d | 2044 | [(set (match_operand:SI 0 "nonimmediate_operand" |
3e4be43f | 2045 | "=d, d, d, d,d,d,d,d,d,R,T,!*f,!*f,!*f,!*f,!*f,!R,!T,d,t,Q,b,Q,t,v,v,v,d,v,R") |
2f7e5a0d | 2046 | (match_operand:SI 1 "general_operand" |
3e4be43f | 2047 | " K,N0HS0,N1HS0,Os,L,b,d,R,T,d,d, *f, *f, R, R, T,*f,*f,t,d,t,d,K,Q,K,v,d,v,R,v"))] |
f19a9af7 | 2048 | "TARGET_ZARCH" |
9db1d521 | 2049 | "@ |
f19a9af7 AK |
2050 | lhi\t%0,%h1 |
2051 | llilh\t%0,%i1 | |
2052 | llill\t%0,%i1 | |
ec24698e | 2053 | iilf\t%0,%o1 |
f19a9af7 | 2054 | lay\t%0,%a1 |
963fc8d0 | 2055 | lrl\t%0,%1 |
d40c829f UW |
2056 | lr\t%0,%1 |
2057 | l\t%0,%1 | |
2058 | ly\t%0,%1 | |
2059 | st\t%1,%0 | |
2060 | sty\t%1,%0 | |
ae1c6198 | 2061 | ldr\t%0,%1 |
d40c829f | 2062 | ler\t%0,%1 |
085261c8 | 2063 | lde\t%0,%1 |
d40c829f UW |
2064 | le\t%0,%1 |
2065 | ley\t%0,%1 | |
2066 | ste\t%1,%0 | |
2067 | stey\t%1,%0 | |
c5aa1d12 UW |
2068 | ear\t%0,%1 |
2069 | sar\t%0,%1 | |
2070 | stam\t%1,%1,%S0 | |
963fc8d0 AK |
2071 | strl\t%1,%0 |
2072 | mvhi\t%0,%1 | |
085261c8 AK |
2073 | lam\t%0,%0,%S1 |
2074 | vleif\t%v0,%h1,0 | |
2075 | vlr\t%v0,%v1 | |
2076 | vlvgf\t%v0,%1,0 | |
2077 | vlgvf\t%0,%v1,0 | |
2078 | vlef\t%v0,%1,0 | |
2079 | vstef\t%v1,%0,0" | |
963fc8d0 | 2080 | [(set_attr "op_type" "RI,RI,RI,RIL,RXY,RIL,RR,RX,RXY,RX,RXY, |
ae1c6198 | 2081 | RR,RR,RXE,RX,RXY,RX,RXY,RRE,RRE,RS,RIL,SIL,RS,VRI,VRR,VRS,VRS,VRX,VRX") |
9381e3f1 WG |
2082 | (set_attr "type" "*, |
2083 | *, | |
2084 | *, | |
2085 | *, | |
2086 | la, | |
2087 | larl, | |
2088 | lr, | |
2089 | load, | |
2090 | load, | |
2091 | store, | |
2092 | store, | |
2093 | floadsf, | |
2094 | floadsf, | |
2095 | floadsf, | |
085261c8 AK |
2096 | floadsf, |
2097 | floadsf, | |
9381e3f1 WG |
2098 | fstoresf, |
2099 | fstoresf, | |
2100 | *, | |
2101 | *, | |
2102 | *, | |
2103 | larl, | |
2104 | *, | |
085261c8 | 2105 | *,*,*,*,*,*,*") |
963fc8d0 | 2106 | (set_attr "cpu_facility" "*,*,*,extimm,longdisp,z10,*,*,longdisp,*,longdisp, |
285363a1 | 2107 | vx,*,vx,*,longdisp,*,longdisp,*,*,*,z10,z10,*,vx,vx,vx,vx,vx,vx") |
9381e3f1 WG |
2108 | (set_attr "z10prop" "z10_fwd_A1, |
2109 | z10_fwd_E1, | |
2110 | z10_fwd_E1, | |
2111 | z10_fwd_A1, | |
2112 | z10_fwd_A1, | |
2113 | z10_fwd_A3, | |
2114 | z10_fr_E1, | |
2115 | z10_fwd_A3, | |
2116 | z10_fwd_A3, | |
729e750f | 2117 | z10_rec, |
9381e3f1 WG |
2118 | z10_rec, |
2119 | *, | |
2120 | *, | |
2121 | *, | |
2122 | *, | |
2123 | *, | |
085261c8 AK |
2124 | *, |
2125 | *, | |
9381e3f1 WG |
2126 | z10_super_E1, |
2127 | z10_super, | |
2128 | *, | |
2129 | z10_rec, | |
2130 | z10_super, | |
14cfceb7 IL |
2131 | *,*,*,*,*,*,*") |
2132 | (set_attr "relative_long" "*,*,*,*,*,yes,*,*,*,*, | |
2133 | *,*,*,*,*,*,*,*,*,*, | |
2134 | *,yes,*,*,*,*,*,*,*,*")]) | |
f19a9af7 AK |
2135 | |
2136 | (define_insn "*movsi_esa" | |
085261c8 AK |
2137 | [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!*f,!*f,!R,d,t,Q,t") |
2138 | (match_operand:SI 1 "general_operand" "K,d,R,d, *f, *f, R, R,*f,t,d,t,Q"))] | |
f19a9af7 AK |
2139 | "!TARGET_ZARCH" |
2140 | "@ | |
2141 | lhi\t%0,%h1 | |
2142 | lr\t%0,%1 | |
2143 | l\t%0,%1 | |
2144 | st\t%1,%0 | |
ae1c6198 | 2145 | ldr\t%0,%1 |
f19a9af7 | 2146 | ler\t%0,%1 |
085261c8 | 2147 | lde\t%0,%1 |
f19a9af7 AK |
2148 | le\t%0,%1 |
2149 | ste\t%1,%0 | |
c5aa1d12 UW |
2150 | ear\t%0,%1 |
2151 | sar\t%0,%1 | |
2152 | stam\t%1,%1,%S0 | |
f2dc2f86 | 2153 | lam\t%0,%0,%S1" |
ae1c6198 | 2154 | [(set_attr "op_type" "RI,RR,RX,RX,RR,RR,RXE,RX,RX,RRE,RRE,RS,RS") |
085261c8 AK |
2155 | (set_attr "type" "*,lr,load,store,floadsf,floadsf,floadsf,floadsf,fstoresf,*,*,*,*") |
2156 | (set_attr "z10prop" "z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_rec,*,*,*,*,*,z10_super_E1, | |
2157 | z10_super,*,*") | |
285363a1 | 2158 | (set_attr "cpu_facility" "*,*,*,*,vx,*,vx,*,*,*,*,*,*") |
9381e3f1 | 2159 | ]) |
9db1d521 | 2160 | |
84817c5d UW |
2161 | (define_peephole2 |
2162 | [(set (match_operand:SI 0 "register_operand" "") | |
2163 | (mem:SI (match_operand 1 "address_operand" "")))] | |
2164 | "!FP_REG_P (operands[0]) | |
2165 | && GET_CODE (operands[1]) == SYMBOL_REF | |
2166 | && CONSTANT_POOL_ADDRESS_P (operands[1]) | |
2167 | && get_pool_mode (operands[1]) == SImode | |
2168 | && legitimate_reload_constant_p (get_pool_constant (operands[1]))" | |
2169 | [(set (match_dup 0) (match_dup 2))] | |
2170 | "operands[2] = get_pool_constant (operands[1]);") | |
9db1d521 | 2171 | |
7bdff56f UW |
2172 | (define_insn "*la_31" |
2173 | [(set (match_operand:SI 0 "register_operand" "=d,d") | |
3e4be43f | 2174 | (match_operand:QI 1 "address_operand" "ZR,ZT"))] |
7bdff56f UW |
2175 | "!TARGET_64BIT && legitimate_la_operand_p (operands[1])" |
2176 | "@ | |
2177 | la\t%0,%a1 | |
2178 | lay\t%0,%a1" | |
2179 | [(set_attr "op_type" "RX,RXY") | |
9381e3f1 | 2180 | (set_attr "type" "la") |
3e4be43f | 2181 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 2182 | (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")]) |
7bdff56f UW |
2183 | |
2184 | (define_peephole2 | |
2185 | [(parallel | |
2186 | [(set (match_operand:SI 0 "register_operand" "") | |
2187 | (match_operand:QI 1 "address_operand" "")) | |
ae156f85 | 2188 | (clobber (reg:CC CC_REGNUM))])] |
7bdff56f | 2189 | "!TARGET_64BIT |
e1d5ee28 | 2190 | && preferred_la_operand_p (operands[1], const0_rtx)" |
7bdff56f UW |
2191 | [(set (match_dup 0) (match_dup 1))] |
2192 | "") | |
2193 | ||
2194 | (define_peephole2 | |
2195 | [(set (match_operand:SI 0 "register_operand" "") | |
2196 | (match_operand:SI 1 "register_operand" "")) | |
2197 | (parallel | |
2198 | [(set (match_dup 0) | |
2199 | (plus:SI (match_dup 0) | |
2200 | (match_operand:SI 2 "nonmemory_operand" ""))) | |
ae156f85 | 2201 | (clobber (reg:CC CC_REGNUM))])] |
7bdff56f UW |
2202 | "!TARGET_64BIT |
2203 | && !reg_overlap_mentioned_p (operands[0], operands[2]) | |
e1d5ee28 | 2204 | && preferred_la_operand_p (operands[1], operands[2])" |
7bdff56f UW |
2205 | [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))] |
2206 | "") | |
2207 | ||
2208 | (define_insn "*la_31_and" | |
2209 | [(set (match_operand:SI 0 "register_operand" "=d,d") | |
3e4be43f | 2210 | (and:SI (match_operand:QI 1 "address_operand" "ZR,ZT") |
7bdff56f UW |
2211 | (const_int 2147483647)))] |
2212 | "!TARGET_64BIT" | |
2213 | "@ | |
2214 | la\t%0,%a1 | |
2215 | lay\t%0,%a1" | |
2216 | [(set_attr "op_type" "RX,RXY") | |
9381e3f1 | 2217 | (set_attr "type" "la") |
3e4be43f | 2218 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 2219 | (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")]) |
7bdff56f UW |
2220 | |
2221 | (define_insn_and_split "*la_31_and_cc" | |
2222 | [(set (match_operand:SI 0 "register_operand" "=d") | |
2223 | (and:SI (match_operand:QI 1 "address_operand" "p") | |
2224 | (const_int 2147483647))) | |
ae156f85 | 2225 | (clobber (reg:CC CC_REGNUM))] |
7bdff56f UW |
2226 | "!TARGET_64BIT" |
2227 | "#" | |
2228 | "&& reload_completed" | |
2229 | [(set (match_dup 0) | |
2230 | (and:SI (match_dup 1) (const_int 2147483647)))] | |
2231 | "" | |
2232 | [(set_attr "op_type" "RX") | |
2233 | (set_attr "type" "la")]) | |
2234 | ||
2235 | (define_insn "force_la_31" | |
2236 | [(set (match_operand:SI 0 "register_operand" "=d,d") | |
3e4be43f | 2237 | (match_operand:QI 1 "address_operand" "ZR,ZT")) |
7bdff56f UW |
2238 | (use (const_int 0))] |
2239 | "!TARGET_64BIT" | |
2240 | "@ | |
2241 | la\t%0,%a1 | |
2242 | lay\t%0,%a1" | |
2243 | [(set_attr "op_type" "RX") | |
9381e3f1 | 2244 | (set_attr "type" "la") |
3e4be43f | 2245 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 2246 | (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")]) |
7bdff56f | 2247 | |
9db1d521 HP |
2248 | ; |
2249 | ; movhi instruction pattern(s). | |
2250 | ; | |
2251 | ||
02ed3c5e UW |
2252 | (define_expand "movhi" |
2253 | [(set (match_operand:HI 0 "nonimmediate_operand" "") | |
2254 | (match_operand:HI 1 "general_operand" ""))] | |
2255 | "" | |
2256 | { | |
2f7e5a0d | 2257 | /* Make it explicit that loading a register from memory |
02ed3c5e | 2258 | always sign-extends (at least) to SImode. */ |
b3a13419 | 2259 | if (optimize && can_create_pseudo_p () |
02ed3c5e | 2260 | && register_operand (operands[0], VOIDmode) |
8fff4fc1 | 2261 | && GET_CODE (operands[1]) == MEM) |
02ed3c5e UW |
2262 | { |
2263 | rtx tmp = gen_reg_rtx (SImode); | |
2264 | rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]); | |
f7df4a84 | 2265 | emit_insn (gen_rtx_SET (tmp, ext)); |
02ed3c5e UW |
2266 | operands[1] = gen_lowpart (HImode, tmp); |
2267 | } | |
2268 | }) | |
2269 | ||
2270 | (define_insn "*movhi" | |
3e4be43f UW |
2271 | [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,d,R,T,b,Q,v,v,v,d,v,R") |
2272 | (match_operand:HI 1 "general_operand" " d,n,R,T,b,d,d,d,K,K,v,d,v,R,v"))] | |
9db1d521 HP |
2273 | "" |
2274 | "@ | |
d40c829f UW |
2275 | lr\t%0,%1 |
2276 | lhi\t%0,%h1 | |
2277 | lh\t%0,%1 | |
2278 | lhy\t%0,%1 | |
963fc8d0 | 2279 | lhrl\t%0,%1 |
d40c829f UW |
2280 | sth\t%1,%0 |
2281 | sthy\t%1,%0 | |
963fc8d0 | 2282 | sthrl\t%1,%0 |
085261c8 AK |
2283 | mvhhi\t%0,%1 |
2284 | vleih\t%v0,%h1,0 | |
2285 | vlr\t%v0,%v1 | |
2286 | vlvgh\t%v0,%1,0 | |
2287 | vlgvh\t%0,%v1,0 | |
2288 | vleh\t%v0,%1,0 | |
2289 | vsteh\t%v1,%0,0" | |
2290 | [(set_attr "op_type" "RR,RI,RX,RXY,RIL,RX,RXY,RIL,SIL,VRI,VRR,VRS,VRS,VRX,VRX") | |
2291 | (set_attr "type" "lr,*,*,*,larl,store,store,store,*,*,*,*,*,*,*") | |
285363a1 | 2292 | (set_attr "cpu_facility" "*,*,*,longdisp,z10,*,longdisp,z10,z10,vx,vx,vx,vx,vx,vx") |
9381e3f1 WG |
2293 | (set_attr "z10prop" "z10_fr_E1, |
2294 | z10_fwd_A1, | |
2295 | z10_super_E1, | |
2296 | z10_super_E1, | |
2297 | z10_super_E1, | |
729e750f | 2298 | z10_rec, |
9381e3f1 WG |
2299 | z10_rec, |
2300 | z10_rec, | |
14cfceb7 IL |
2301 | z10_super,*,*,*,*,*,*") |
2302 | (set_attr "relative_long" "*,*,*,*,yes,*,*,yes,*,*,*,*,*,*,*")]) | |
9db1d521 | 2303 | |
84817c5d UW |
2304 | (define_peephole2 |
2305 | [(set (match_operand:HI 0 "register_operand" "") | |
2306 | (mem:HI (match_operand 1 "address_operand" "")))] | |
2307 | "GET_CODE (operands[1]) == SYMBOL_REF | |
2308 | && CONSTANT_POOL_ADDRESS_P (operands[1]) | |
2309 | && get_pool_mode (operands[1]) == HImode | |
2310 | && GET_CODE (get_pool_constant (operands[1])) == CONST_INT" | |
2311 | [(set (match_dup 0) (match_dup 2))] | |
2312 | "operands[2] = get_pool_constant (operands[1]);") | |
4023fb28 | 2313 | |
9db1d521 HP |
2314 | ; |
2315 | ; movqi instruction pattern(s). | |
2316 | ; | |
2317 | ||
02ed3c5e UW |
2318 | (define_expand "movqi" |
2319 | [(set (match_operand:QI 0 "nonimmediate_operand" "") | |
2320 | (match_operand:QI 1 "general_operand" ""))] | |
2321 | "" | |
2322 | { | |
c19ec8f9 | 2323 | /* On z/Architecture, zero-extending from memory to register |
02ed3c5e | 2324 | is just as fast as a QImode load. */ |
b3a13419 | 2325 | if (TARGET_ZARCH && optimize && can_create_pseudo_p () |
02ed3c5e | 2326 | && register_operand (operands[0], VOIDmode) |
8fff4fc1 | 2327 | && GET_CODE (operands[1]) == MEM) |
02ed3c5e | 2328 | { |
9602b6a1 AK |
2329 | rtx tmp = gen_reg_rtx (DImode); |
2330 | rtx ext = gen_rtx_ZERO_EXTEND (DImode, operands[1]); | |
f7df4a84 | 2331 | emit_insn (gen_rtx_SET (tmp, ext)); |
02ed3c5e UW |
2332 | operands[1] = gen_lowpart (QImode, tmp); |
2333 | } | |
2334 | }) | |
4023fb28 | 2335 | |
02ed3c5e | 2336 | (define_insn "*movqi" |
3e4be43f UW |
2337 | [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,T,Q,S,?Q,v,v,v,d,v,R") |
2338 | (match_operand:QI 1 "general_operand" " d,n,R,T,d,d,n,n,?Q,K,v,d,v,R,v"))] | |
9db1d521 HP |
2339 | "" |
2340 | "@ | |
d40c829f UW |
2341 | lr\t%0,%1 |
2342 | lhi\t%0,%b1 | |
2343 | ic\t%0,%1 | |
2344 | icy\t%0,%1 | |
2345 | stc\t%1,%0 | |
2346 | stcy\t%1,%0 | |
fc0ea003 | 2347 | mvi\t%S0,%b1 |
0a88561f | 2348 | mviy\t%S0,%b1 |
085261c8 AK |
2349 | # |
2350 | vleib\t%v0,%b1,0 | |
2351 | vlr\t%v0,%v1 | |
2352 | vlvgb\t%v0,%1,0 | |
2353 | vlgvb\t%0,%v1,0 | |
2354 | vleb\t%v0,%1,0 | |
2355 | vsteb\t%v1,%0,0" | |
2356 | [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS,VRI,VRR,VRS,VRS,VRX,VRX") | |
2357 | (set_attr "type" "lr,*,*,*,store,store,store,store,*,*,*,*,*,*,*") | |
285363a1 | 2358 | (set_attr "cpu_facility" "*,*,*,longdisp,*,longdisp,*,longdisp,*,vx,vx,vx,vx,vx,vx") |
9381e3f1 WG |
2359 | (set_attr "z10prop" "z10_fr_E1, |
2360 | z10_fwd_A1, | |
2361 | z10_super_E1, | |
2362 | z10_super_E1, | |
729e750f | 2363 | z10_rec, |
9381e3f1 WG |
2364 | z10_rec, |
2365 | z10_super, | |
0a88561f | 2366 | z10_super, |
085261c8 | 2367 | *,*,*,*,*,*,*")]) |
9db1d521 | 2368 | |
84817c5d UW |
2369 | (define_peephole2 |
2370 | [(set (match_operand:QI 0 "nonimmediate_operand" "") | |
2371 | (mem:QI (match_operand 1 "address_operand" "")))] | |
2372 | "GET_CODE (operands[1]) == SYMBOL_REF | |
2373 | && CONSTANT_POOL_ADDRESS_P (operands[1]) | |
2374 | && get_pool_mode (operands[1]) == QImode | |
2375 | && GET_CODE (get_pool_constant (operands[1])) == CONST_INT" | |
2376 | [(set (match_dup 0) (match_dup 2))] | |
2377 | "operands[2] = get_pool_constant (operands[1]);") | |
4023fb28 | 2378 | |
9db1d521 | 2379 | ; |
05b9aaaa | 2380 | ; movstrictqi instruction pattern(s). |
9db1d521 HP |
2381 | ; |
2382 | ||
2383 | (define_insn "*movstrictqi" | |
d3632d41 UW |
2384 | [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d,d")) |
2385 | (match_operand:QI 1 "memory_operand" "R,T"))] | |
9db1d521 | 2386 | "" |
d3632d41 | 2387 | "@ |
d40c829f UW |
2388 | ic\t%0,%1 |
2389 | icy\t%0,%1" | |
9381e3f1 | 2390 | [(set_attr "op_type" "RX,RXY") |
3e4be43f | 2391 | (set_attr "cpu_facility" "*,longdisp") |
729e750f | 2392 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) |
9db1d521 HP |
2393 | |
2394 | ; | |
2395 | ; movstricthi instruction pattern(s). | |
2396 | ; | |
2397 | ||
2398 | (define_insn "*movstricthi" | |
d3632d41 | 2399 | [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d,d")) |
575f7c2b | 2400 | (match_operand:HI 1 "memory_operand" "Q,S")) |
ae156f85 | 2401 | (clobber (reg:CC CC_REGNUM))] |
9db1d521 | 2402 | "" |
d3632d41 | 2403 | "@ |
fc0ea003 UW |
2404 | icm\t%0,3,%S1 |
2405 | icmy\t%0,3,%S1" | |
9381e3f1 | 2406 | [(set_attr "op_type" "RS,RSY") |
3e4be43f | 2407 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 2408 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) |
9db1d521 HP |
2409 | |
2410 | ; | |
2411 | ; movstrictsi instruction pattern(s). | |
2412 | ; | |
2413 | ||
05b9aaaa | 2414 | (define_insn "movstrictsi" |
c5aa1d12 UW |
2415 | [(set (strict_low_part (match_operand:SI 0 "register_operand" "+d,d,d,d")) |
2416 | (match_operand:SI 1 "general_operand" "d,R,T,t"))] | |
9602b6a1 | 2417 | "TARGET_ZARCH" |
9db1d521 | 2418 | "@ |
d40c829f UW |
2419 | lr\t%0,%1 |
2420 | l\t%0,%1 | |
c5aa1d12 UW |
2421 | ly\t%0,%1 |
2422 | ear\t%0,%1" | |
2423 | [(set_attr "op_type" "RR,RX,RXY,RRE") | |
9381e3f1 | 2424 | (set_attr "type" "lr,load,load,*") |
3e4be43f | 2425 | (set_attr "cpu_facility" "*,*,longdisp,*") |
9381e3f1 | 2426 | (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_super_E1")]) |
9db1d521 | 2427 | |
f61a2c7d | 2428 | ; |
609e7e80 | 2429 | ; mov(tf|td) instruction pattern(s). |
f61a2c7d AK |
2430 | ; |
2431 | ||
609e7e80 AK |
2432 | (define_expand "mov<mode>" |
2433 | [(set (match_operand:TD_TF 0 "nonimmediate_operand" "") | |
2434 | (match_operand:TD_TF 1 "general_operand" ""))] | |
f61a2c7d AK |
2435 | "" |
2436 | "") | |
2437 | ||
609e7e80 | 2438 | (define_insn "*mov<mode>_64" |
3e4be43f UW |
2439 | [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o,d,S, d,o") |
2440 | (match_operand:TD_TF 1 "general_operand" " G,f,o,f,S,d,dT,d"))] | |
9602b6a1 | 2441 | "TARGET_ZARCH" |
f61a2c7d | 2442 | "@ |
65b1d8ea | 2443 | lzxr\t%0 |
f61a2c7d AK |
2444 | lxr\t%0,%1 |
2445 | # | |
2446 | # | |
2447 | lmg\t%0,%N0,%S1 | |
2448 | stmg\t%1,%N1,%S0 | |
2449 | # | |
f61a2c7d | 2450 | #" |
65b1d8ea AK |
2451 | [(set_attr "op_type" "RRE,RRE,*,*,RSY,RSY,*,*") |
2452 | (set_attr "type" "fsimptf,fsimptf,*,*,lm,stm,*,*") | |
2453 | (set_attr "cpu_facility" "z196,*,*,*,*,*,*,*")]) | |
f61a2c7d | 2454 | |
609e7e80 | 2455 | (define_insn "*mov<mode>_31" |
65b1d8ea AK |
2456 | [(set (match_operand:TD_TF 0 "nonimmediate_operand" "=f,f,f,o") |
2457 | (match_operand:TD_TF 1 "general_operand" " G,f,o,f"))] | |
9602b6a1 | 2458 | "!TARGET_ZARCH" |
f61a2c7d | 2459 | "@ |
65b1d8ea | 2460 | lzxr\t%0 |
f61a2c7d AK |
2461 | lxr\t%0,%1 |
2462 | # | |
f61a2c7d | 2463 | #" |
65b1d8ea AK |
2464 | [(set_attr "op_type" "RRE,RRE,*,*") |
2465 | (set_attr "type" "fsimptf,fsimptf,*,*") | |
2466 | (set_attr "cpu_facility" "z196,*,*,*")]) | |
f61a2c7d AK |
2467 | |
2468 | ; TFmode in GPRs splitters | |
2469 | ||
2470 | (define_split | |
609e7e80 AK |
2471 | [(set (match_operand:TD_TF 0 "nonimmediate_operand" "") |
2472 | (match_operand:TD_TF 1 "general_operand" ""))] | |
9602b6a1 | 2473 | "TARGET_ZARCH && reload_completed |
9d605427 AK |
2474 | && !s_operand (operands[0], <MODE>mode) |
2475 | && !s_operand (operands[1], <MODE>mode) | |
609e7e80 | 2476 | && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)" |
f61a2c7d AK |
2477 | [(set (match_dup 2) (match_dup 4)) |
2478 | (set (match_dup 3) (match_dup 5))] | |
2479 | { | |
609e7e80 AK |
2480 | operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode); |
2481 | operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode); | |
2482 | operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode); | |
2483 | operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode); | |
f61a2c7d AK |
2484 | }) |
2485 | ||
2486 | (define_split | |
609e7e80 AK |
2487 | [(set (match_operand:TD_TF 0 "nonimmediate_operand" "") |
2488 | (match_operand:TD_TF 1 "general_operand" ""))] | |
9602b6a1 | 2489 | "TARGET_ZARCH && reload_completed |
9d605427 AK |
2490 | && !s_operand (operands[0], <MODE>mode) |
2491 | && !s_operand (operands[1], <MODE>mode) | |
609e7e80 | 2492 | && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)" |
f61a2c7d AK |
2493 | [(set (match_dup 2) (match_dup 4)) |
2494 | (set (match_dup 3) (match_dup 5))] | |
2495 | { | |
609e7e80 AK |
2496 | operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode); |
2497 | operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode); | |
2498 | operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode); | |
2499 | operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode); | |
f61a2c7d AK |
2500 | }) |
2501 | ||
2502 | (define_split | |
609e7e80 AK |
2503 | [(set (match_operand:TD_TF 0 "register_operand" "") |
2504 | (match_operand:TD_TF 1 "memory_operand" ""))] | |
9602b6a1 | 2505 | "TARGET_ZARCH && reload_completed |
085261c8 | 2506 | && GENERAL_REG_P (operands[0]) |
f61a2c7d AK |
2507 | && !s_operand (operands[1], VOIDmode)" |
2508 | [(set (match_dup 0) (match_dup 1))] | |
2509 | { | |
609e7e80 | 2510 | rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode); |
a9e6994a | 2511 | addr = gen_lowpart (Pmode, addr); |
f61a2c7d AK |
2512 | s390_load_address (addr, XEXP (operands[1], 0)); |
2513 | operands[1] = replace_equiv_address (operands[1], addr); | |
2514 | }) | |
2515 | ||
7b6baae1 | 2516 | ; TFmode in BFPs splitters |
f61a2c7d AK |
2517 | |
2518 | (define_split | |
609e7e80 AK |
2519 | [(set (match_operand:TD_TF 0 "register_operand" "") |
2520 | (match_operand:TD_TF 1 "memory_operand" ""))] | |
9381e3f1 | 2521 | "reload_completed && offsettable_memref_p (operands[1]) |
f61a2c7d AK |
2522 | && FP_REG_P (operands[0])" |
2523 | [(set (match_dup 2) (match_dup 4)) | |
2524 | (set (match_dup 3) (match_dup 5))] | |
2525 | { | |
609e7e80 AK |
2526 | operands[2] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0], |
2527 | <MODE>mode, 0); | |
2528 | operands[3] = simplify_gen_subreg (<HALF_TMODE>mode, operands[0], | |
2529 | <MODE>mode, 8); | |
2530 | operands[4] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 0); | |
2531 | operands[5] = adjust_address_nv (operands[1], <HALF_TMODE>mode, 8); | |
f61a2c7d AK |
2532 | }) |
2533 | ||
2534 | (define_split | |
609e7e80 AK |
2535 | [(set (match_operand:TD_TF 0 "memory_operand" "") |
2536 | (match_operand:TD_TF 1 "register_operand" ""))] | |
f61a2c7d AK |
2537 | "reload_completed && offsettable_memref_p (operands[0]) |
2538 | && FP_REG_P (operands[1])" | |
2539 | [(set (match_dup 2) (match_dup 4)) | |
2540 | (set (match_dup 3) (match_dup 5))] | |
2541 | { | |
609e7e80 AK |
2542 | operands[2] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 0); |
2543 | operands[3] = adjust_address_nv (operands[0], <HALF_TMODE>mode, 8); | |
2544 | operands[4] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1], | |
2545 | <MODE>mode, 0); | |
2546 | operands[5] = simplify_gen_subreg (<HALF_TMODE>mode, operands[1], | |
2547 | <MODE>mode, 8); | |
f61a2c7d AK |
2548 | }) |
2549 | ||
9db1d521 | 2550 | ; |
609e7e80 | 2551 | ; mov(df|dd) instruction pattern(s). |
9db1d521 HP |
2552 | ; |
2553 | ||
609e7e80 AK |
2554 | (define_expand "mov<mode>" |
2555 | [(set (match_operand:DD_DF 0 "nonimmediate_operand" "") | |
2556 | (match_operand:DD_DF 1 "general_operand" ""))] | |
9db1d521 | 2557 | "" |
13c025c1 | 2558 | "") |
9db1d521 | 2559 | |
609e7e80 AK |
2560 | (define_insn "*mov<mode>_64dfp" |
2561 | [(set (match_operand:DD_DF 0 "nonimmediate_operand" | |
590961cf | 2562 | "=f,f,f,d,f,f,R,T,d,d,d,d,b,T,v,v,v,d,v,R") |
609e7e80 | 2563 | (match_operand:DD_DF 1 "general_operand" |
590961cf | 2564 | " G,f,d,f,R,T,f,f,G,d,b,T,d,d,v,G,d,v,R,v"))] |
9602b6a1 | 2565 | "TARGET_DFP" |
85dae55a | 2566 | "@ |
65b1d8ea | 2567 | lzdr\t%0 |
85dae55a AK |
2568 | ldr\t%0,%1 |
2569 | ldgr\t%0,%1 | |
2570 | lgdr\t%0,%1 | |
2571 | ld\t%0,%1 | |
2572 | ldy\t%0,%1 | |
2573 | std\t%1,%0 | |
2574 | stdy\t%1,%0 | |
45e5214c | 2575 | lghi\t%0,0 |
85dae55a | 2576 | lgr\t%0,%1 |
085261c8 | 2577 | lgrl\t%0,%1 |
85dae55a | 2578 | lg\t%0,%1 |
085261c8 AK |
2579 | stgrl\t%1,%0 |
2580 | stg\t%1,%0 | |
2581 | vlr\t%v0,%v1 | |
590961cf | 2582 | vleig\t%v0,0,0 |
085261c8 AK |
2583 | vlvgg\t%v0,%1,0 |
2584 | vlgvg\t%0,%v1,0 | |
2585 | vleg\t%0,%1,0 | |
2586 | vsteg\t%1,%0,0" | |
590961cf | 2587 | [(set_attr "op_type" "RRE,RR,RRE,RRE,RX,RXY,RX,RXY,RI,RRE,RIL,RXY,RIL,RXY,VRR,VRI,VRS,VRS,VRX,VRX") |
65b1d8ea | 2588 | (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,floaddf,floaddf, |
590961cf AK |
2589 | fstoredf,fstoredf,*,lr,load,load,store,store,*,*,*,*,load,store") |
2590 | (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,*,*,*,*,*,*") | |
14cfceb7 IL |
2591 | (set_attr "cpu_facility" "z196,*,*,*,*,longdisp,*,longdisp,*,*,z10,*,z10,*,vx,vx,vx,vx,vx,vx") |
2592 | (set_attr "relative_long" "*,*,*,*,*,*,*,*,*,*,yes,*,yes,*,*,*,*,*,*,*")]) | |
85dae55a | 2593 | |
609e7e80 | 2594 | (define_insn "*mov<mode>_64" |
590961cf AK |
2595 | [(set (match_operand:DD_DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d,d,d,d,b,T") |
2596 | (match_operand:DD_DF 1 "general_operand" " G,f,R,T,f,f,G,d,b,T,d,d"))] | |
9602b6a1 | 2597 | "TARGET_ZARCH" |
9db1d521 | 2598 | "@ |
65b1d8ea | 2599 | lzdr\t%0 |
d40c829f UW |
2600 | ldr\t%0,%1 |
2601 | ld\t%0,%1 | |
2602 | ldy\t%0,%1 | |
2603 | std\t%1,%0 | |
2604 | stdy\t%1,%0 | |
45e5214c | 2605 | lghi\t%0,0 |
d40c829f | 2606 | lgr\t%0,%1 |
085261c8 | 2607 | lgrl\t%0,%1 |
d40c829f | 2608 | lg\t%0,%1 |
085261c8 | 2609 | stgrl\t%1,%0 |
590961cf AK |
2610 | stg\t%1,%0" |
2611 | [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RI,RRE,RIL,RXY,RIL,RXY") | |
65b1d8ea | 2612 | (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>, |
590961cf AK |
2613 | fstore<mode>,fstore<mode>,*,lr,load,load,store,store") |
2614 | (set_attr "z10prop" "*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec") | |
14cfceb7 IL |
2615 | (set_attr "cpu_facility" "z196,*,*,longdisp,*,longdisp,*,*,z10,*,z10,*") |
2616 | (set_attr "relative_long" "*,*,*,*,*,*,*,*,yes,*,*,*")]) | |
609e7e80 AK |
2617 | |
2618 | (define_insn "*mov<mode>_31" | |
2619 | [(set (match_operand:DD_DF 0 "nonimmediate_operand" | |
3e4be43f | 2620 | "=f,f,f,f,R,T,d,d,Q,S, d,o") |
609e7e80 | 2621 | (match_operand:DD_DF 1 "general_operand" |
3e4be43f | 2622 | " G,f,R,T,f,f,Q,S,d,d,dPT,d"))] |
9602b6a1 | 2623 | "!TARGET_ZARCH" |
9db1d521 | 2624 | "@ |
65b1d8ea | 2625 | lzdr\t%0 |
d40c829f UW |
2626 | ldr\t%0,%1 |
2627 | ld\t%0,%1 | |
2628 | ldy\t%0,%1 | |
2629 | std\t%1,%0 | |
2630 | stdy\t%1,%0 | |
fc0ea003 | 2631 | lm\t%0,%N0,%S1 |
c4d50129 | 2632 | lmy\t%0,%N0,%S1 |
fc0ea003 | 2633 | stm\t%1,%N1,%S0 |
c4d50129 | 2634 | stmy\t%1,%N1,%S0 |
4023fb28 | 2635 | # |
19b63d8e | 2636 | #" |
65b1d8ea AK |
2637 | [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*") |
2638 | (set_attr "type" "fsimpdf,fload<mode>,fload<mode>,fload<mode>, | |
2639 | fstore<mode>,fstore<mode>,lm,lm,stm,stm,*,*") | |
3e4be43f | 2640 | (set_attr "cpu_facility" "z196,*,*,longdisp,*,longdisp,*,longdisp,*,longdisp,*,*")]) |
4023fb28 UW |
2641 | |
2642 | (define_split | |
609e7e80 AK |
2643 | [(set (match_operand:DD_DF 0 "nonimmediate_operand" "") |
2644 | (match_operand:DD_DF 1 "general_operand" ""))] | |
9602b6a1 | 2645 | "!TARGET_ZARCH && reload_completed |
9d605427 AK |
2646 | && !s_operand (operands[0], <MODE>mode) |
2647 | && !s_operand (operands[1], <MODE>mode) | |
609e7e80 | 2648 | && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 0)" |
4023fb28 UW |
2649 | [(set (match_dup 2) (match_dup 4)) |
2650 | (set (match_dup 3) (match_dup 5))] | |
9db1d521 | 2651 | { |
609e7e80 AK |
2652 | operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode); |
2653 | operands[3] = operand_subword (operands[0], 1, 0, <MODE>mode); | |
2654 | operands[4] = operand_subword (operands[1], 0, 0, <MODE>mode); | |
2655 | operands[5] = operand_subword (operands[1], 1, 0, <MODE>mode); | |
dc65c307 UW |
2656 | }) |
2657 | ||
2658 | (define_split | |
609e7e80 AK |
2659 | [(set (match_operand:DD_DF 0 "nonimmediate_operand" "") |
2660 | (match_operand:DD_DF 1 "general_operand" ""))] | |
9602b6a1 | 2661 | "!TARGET_ZARCH && reload_completed |
9d605427 AK |
2662 | && !s_operand (operands[0], <MODE>mode) |
2663 | && !s_operand (operands[1], <MODE>mode) | |
609e7e80 | 2664 | && s390_split_ok_p (operands[0], operands[1], <MODE>mode, 1)" |
dc65c307 UW |
2665 | [(set (match_dup 2) (match_dup 4)) |
2666 | (set (match_dup 3) (match_dup 5))] | |
2667 | { | |
609e7e80 AK |
2668 | operands[2] = operand_subword (operands[0], 1, 0, <MODE>mode); |
2669 | operands[3] = operand_subword (operands[0], 0, 0, <MODE>mode); | |
2670 | operands[4] = operand_subword (operands[1], 1, 0, <MODE>mode); | |
2671 | operands[5] = operand_subword (operands[1], 0, 0, <MODE>mode); | |
dc65c307 | 2672 | }) |
9db1d521 | 2673 | |
4023fb28 | 2674 | (define_split |
609e7e80 AK |
2675 | [(set (match_operand:DD_DF 0 "register_operand" "") |
2676 | (match_operand:DD_DF 1 "memory_operand" ""))] | |
9602b6a1 | 2677 | "!TARGET_ZARCH && reload_completed |
8e509cf9 | 2678 | && !FP_REG_P (operands[0]) |
4023fb28 | 2679 | && !s_operand (operands[1], VOIDmode)" |
a41c6c53 | 2680 | [(set (match_dup 0) (match_dup 1))] |
a41c6c53 | 2681 | { |
609e7e80 | 2682 | rtx addr = operand_subword (operands[0], 1, 0, <MODE>mode); |
a41c6c53 UW |
2683 | s390_load_address (addr, XEXP (operands[1], 0)); |
2684 | operands[1] = replace_equiv_address (operands[1], addr); | |
dc65c307 UW |
2685 | }) |
2686 | ||
9db1d521 | 2687 | ; |
609e7e80 | 2688 | ; mov(sf|sd) instruction pattern(s). |
9db1d521 HP |
2689 | ; |
2690 | ||
609e7e80 AK |
2691 | (define_insn "mov<mode>" |
2692 | [(set (match_operand:SD_SF 0 "nonimmediate_operand" | |
3e4be43f | 2693 | "=f,f,f,f,f,f,R,T,d,d,d,d,d,b,R,T,v,v,v,d,v,R") |
609e7e80 | 2694 | (match_operand:SD_SF 1 "general_operand" |
3e4be43f | 2695 | " G,f,f,R,R,T,f,f,G,d,b,R,T,d,d,d,v,G,d,v,R,v"))] |
4023fb28 | 2696 | "" |
9db1d521 | 2697 | "@ |
65b1d8ea | 2698 | lzer\t%0 |
ae1c6198 | 2699 | ldr\t%0,%1 |
d40c829f | 2700 | ler\t%0,%1 |
085261c8 | 2701 | lde\t%0,%1 |
d40c829f UW |
2702 | le\t%0,%1 |
2703 | ley\t%0,%1 | |
2704 | ste\t%1,%0 | |
2705 | stey\t%1,%0 | |
45e5214c | 2706 | lhi\t%0,0 |
d40c829f | 2707 | lr\t%0,%1 |
085261c8 | 2708 | lrl\t%0,%1 |
d40c829f UW |
2709 | l\t%0,%1 |
2710 | ly\t%0,%1 | |
085261c8 | 2711 | strl\t%1,%0 |
d40c829f | 2712 | st\t%1,%0 |
085261c8 AK |
2713 | sty\t%1,%0 |
2714 | vlr\t%v0,%v1 | |
298f4647 | 2715 | vleif\t%v0,0,0 |
085261c8 AK |
2716 | vlvgf\t%v0,%1,0 |
2717 | vlgvf\t%0,%v1,0 | |
298f4647 AK |
2718 | vlef\t%0,%1,0 |
2719 | vstef\t%1,%0,0" | |
ae1c6198 | 2720 | [(set_attr "op_type" "RRE,RR,RR,RXE,RX,RXY,RX,RXY,RI,RR,RIL,RX,RXY,RIL,RX,RXY,VRR,VRI,VRS,VRS,VRX,VRX") |
085261c8 AK |
2721 | (set_attr "type" "fsimpsf,fsimpsf,fload<mode>,fload<mode>,fload<mode>,fload<mode>, |
2722 | fstore<mode>,fstore<mode>,*,lr,load,load,load,store,store,store,*,*,*,*,load,store") | |
2723 | (set_attr "z10prop" "*,*,*,*,*,*,*,*,z10_fwd_A1,z10_fr_E1,z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec,z10_rec,*,*,*,*,*,*") | |
14cfceb7 IL |
2724 | (set_attr "cpu_facility" "z196,vx,*,vx,*,longdisp,*,longdisp,*,*,z10,*,longdisp,z10,*,longdisp,vx,vx,vx,vx,vx,vx") |
2725 | (set_attr "relative_long" "*,*,*,*,*,*,*,*,*,*,yes,*,*,yes,*,*,*,*,*,*,*,*")]) | |
4023fb28 | 2726 | |
9dc62c00 AK |
2727 | ; |
2728 | ; movcc instruction pattern | |
2729 | ; | |
2730 | ||
2731 | (define_insn "movcc" | |
2732 | [(set (match_operand:CC 0 "nonimmediate_operand" "=d,c,d,d,d,R,T") | |
5a3fe9b6 | 2733 | (match_operand:CC 1 "nonimmediate_operand" " d,d,c,R,T,d,d"))] |
9dc62c00 AK |
2734 | "" |
2735 | "@ | |
2736 | lr\t%0,%1 | |
2737 | tmh\t%1,12288 | |
2738 | ipm\t%0 | |
a71f0749 DV |
2739 | l\t%0,%1 |
2740 | ly\t%0,%1 | |
2741 | st\t%1,%0 | |
2742 | sty\t%1,%0" | |
8dd3b235 | 2743 | [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY") |
a71f0749 | 2744 | (set_attr "type" "lr,*,*,load,load,store,store") |
3e4be43f | 2745 | (set_attr "cpu_facility" "*,*,*,*,longdisp,*,longdisp") |
a71f0749 | 2746 | (set_attr "z10prop" "z10_fr_E1,z10_super,*,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec") |
65b1d8ea | 2747 | (set_attr "z196prop" "*,*,z196_ends,*,*,*,*")]) |
9dc62c00 | 2748 | |
19b63d8e UW |
2749 | ; |
2750 | ; Block move (MVC) patterns. | |
2751 | ; | |
2752 | ||
2753 | (define_insn "*mvc" | |
2754 | [(set (match_operand:BLK 0 "memory_operand" "=Q") | |
2755 | (match_operand:BLK 1 "memory_operand" "Q")) | |
2756 | (use (match_operand 2 "const_int_operand" "n"))] | |
2757 | "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256" | |
fc0ea003 | 2758 | "mvc\t%O0(%2,%R0),%S1" |
b628bd8e | 2759 | [(set_attr "op_type" "SS")]) |
19b63d8e | 2760 | |
0a88561f AK |
2761 | ; This splitter converts a QI to QI mode copy into a BLK mode copy in |
2762 | ; order to have it implemented with mvc. | |
2763 | ||
2764 | (define_split | |
2765 | [(set (match_operand:QI 0 "memory_operand" "") | |
2766 | (match_operand:QI 1 "memory_operand" ""))] | |
2767 | "reload_completed" | |
2768 | [(parallel | |
2769 | [(set (match_dup 0) (match_dup 1)) | |
2770 | (use (const_int 1))])] | |
2771 | { | |
2772 | operands[0] = adjust_address (operands[0], BLKmode, 0); | |
2773 | operands[1] = adjust_address (operands[1], BLKmode, 0); | |
2774 | }) | |
2775 | ||
2776 | ||
19b63d8e UW |
2777 | (define_peephole2 |
2778 | [(parallel | |
2779 | [(set (match_operand:BLK 0 "memory_operand" "") | |
2780 | (match_operand:BLK 1 "memory_operand" "")) | |
2781 | (use (match_operand 2 "const_int_operand" ""))]) | |
2782 | (parallel | |
2783 | [(set (match_operand:BLK 3 "memory_operand" "") | |
2784 | (match_operand:BLK 4 "memory_operand" "")) | |
2785 | (use (match_operand 5 "const_int_operand" ""))])] | |
f9dcf14a AK |
2786 | "((INTVAL (operands[2]) > 16 && INTVAL (operands[5]) > 16) |
2787 | || (INTVAL (operands[2]) + INTVAL (operands[5]) <= 16)) | |
2788 | && s390_offset_p (operands[0], operands[3], operands[2]) | |
19b63d8e | 2789 | && s390_offset_p (operands[1], operands[4], operands[2]) |
9381e3f1 | 2790 | && !s390_overlap_p (operands[0], operands[1], |
bcf8c1cc | 2791 | INTVAL (operands[2]) + INTVAL (operands[5])) |
19b63d8e UW |
2792 | && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256" |
2793 | [(parallel | |
2794 | [(set (match_dup 6) (match_dup 7)) | |
2795 | (use (match_dup 8))])] | |
2796 | "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0)); | |
2797 | operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0)); | |
2798 | operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));") | |
2799 | ||
f9dcf14a AK |
2800 | (define_peephole2 |
2801 | [(parallel | |
2802 | [(set (match_operand:BLK 0 "plus16_Q_operand" "") | |
2803 | (match_operand:BLK 1 "plus16_Q_operand" "")) | |
2804 | (use (match_operand 2 "const_int_operand" ""))])] | |
2805 | "INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32" | |
2806 | [(parallel | |
2807 | [(set (match_dup 0) (match_dup 1)) | |
2808 | (use (const_int 16))]) | |
2809 | (parallel | |
2810 | [(set (match_dup 3) (match_dup 4)) | |
2811 | (use (match_dup 5))])] | |
2812 | "operands[3] = change_address (operands[0], VOIDmode, | |
2813 | plus_constant (Pmode, XEXP (operands[0], 0), 16)); | |
2814 | operands[4] = change_address (operands[1], VOIDmode, | |
2815 | plus_constant (Pmode, XEXP (operands[1], 0), 16)); | |
2816 | operands[5] = GEN_INT (INTVAL (operands[2]) - 16);") | |
2817 | ||
19b63d8e | 2818 | |
9db1d521 HP |
2819 | ; |
2820 | ; load_multiple pattern(s). | |
2821 | ; | |
22ea6b4f UW |
2822 | ; ??? Due to reload problems with replacing registers inside match_parallel |
2823 | ; we currently support load_multiple/store_multiple only after reload. | |
2824 | ; | |
9db1d521 HP |
2825 | |
2826 | (define_expand "load_multiple" | |
2827 | [(match_par_dup 3 [(set (match_operand 0 "" "") | |
2828 | (match_operand 1 "" "")) | |
2829 | (use (match_operand 2 "" ""))])] | |
22ea6b4f | 2830 | "reload_completed" |
9db1d521 | 2831 | { |
ef4bddc2 | 2832 | machine_mode mode; |
9db1d521 HP |
2833 | int regno; |
2834 | int count; | |
2835 | rtx from; | |
4023fb28 | 2836 | int i, off; |
9db1d521 HP |
2837 | |
2838 | /* Support only loading a constant number of fixed-point registers from | |
2839 | memory and only bother with this if more than two */ | |
2840 | if (GET_CODE (operands[2]) != CONST_INT | |
4023fb28 | 2841 | || INTVAL (operands[2]) < 2 |
9db1d521 HP |
2842 | || INTVAL (operands[2]) > 16 |
2843 | || GET_CODE (operands[1]) != MEM | |
2844 | || GET_CODE (operands[0]) != REG | |
2845 | || REGNO (operands[0]) >= 16) | |
2846 | FAIL; | |
2847 | ||
2848 | count = INTVAL (operands[2]); | |
2849 | regno = REGNO (operands[0]); | |
c19ec8f9 | 2850 | mode = GET_MODE (operands[0]); |
9602b6a1 | 2851 | if (mode != SImode && (!TARGET_ZARCH || mode != DImode)) |
c19ec8f9 | 2852 | FAIL; |
9db1d521 HP |
2853 | |
2854 | operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count)); | |
b3a13419 | 2855 | if (!can_create_pseudo_p ()) |
4023fb28 UW |
2856 | { |
2857 | if (GET_CODE (XEXP (operands[1], 0)) == REG) | |
2858 | { | |
2859 | from = XEXP (operands[1], 0); | |
2860 | off = 0; | |
2861 | } | |
2862 | else if (GET_CODE (XEXP (operands[1], 0)) == PLUS | |
2863 | && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == REG | |
2864 | && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT) | |
2865 | { | |
2866 | from = XEXP (XEXP (operands[1], 0), 0); | |
2867 | off = INTVAL (XEXP (XEXP (operands[1], 0), 1)); | |
2868 | } | |
2869 | else | |
2870 | FAIL; | |
4023fb28 UW |
2871 | } |
2872 | else | |
2873 | { | |
2874 | from = force_reg (Pmode, XEXP (operands[1], 0)); | |
2875 | off = 0; | |
2876 | } | |
9db1d521 HP |
2877 | |
2878 | for (i = 0; i < count; i++) | |
2879 | XVECEXP (operands[3], 0, i) | |
f7df4a84 | 2880 | = gen_rtx_SET (gen_rtx_REG (mode, regno + i), |
c19ec8f9 | 2881 | change_address (operands[1], mode, |
0a81f074 RS |
2882 | plus_constant (Pmode, from, |
2883 | off + i * GET_MODE_SIZE (mode)))); | |
10bbf137 | 2884 | }) |
9db1d521 HP |
2885 | |
2886 | (define_insn "*load_multiple_di" | |
2887 | [(match_parallel 0 "load_multiple_operation" | |
2888 | [(set (match_operand:DI 1 "register_operand" "=r") | |
3e4be43f | 2889 | (match_operand:DI 2 "s_operand" "S"))])] |
9602b6a1 | 2890 | "reload_completed && TARGET_ZARCH" |
9db1d521 HP |
2891 | { |
2892 | int words = XVECLEN (operands[0], 0); | |
9db1d521 | 2893 | operands[0] = gen_rtx_REG (DImode, REGNO (operands[1]) + words - 1); |
fc0ea003 | 2894 | return "lmg\t%1,%0,%S2"; |
10bbf137 | 2895 | } |
d3632d41 | 2896 | [(set_attr "op_type" "RSY") |
4023fb28 | 2897 | (set_attr "type" "lm")]) |
9db1d521 HP |
2898 | |
2899 | (define_insn "*load_multiple_si" | |
2900 | [(match_parallel 0 "load_multiple_operation" | |
d3632d41 UW |
2901 | [(set (match_operand:SI 1 "register_operand" "=r,r") |
2902 | (match_operand:SI 2 "s_operand" "Q,S"))])] | |
22ea6b4f | 2903 | "reload_completed" |
9db1d521 HP |
2904 | { |
2905 | int words = XVECLEN (operands[0], 0); | |
9db1d521 | 2906 | operands[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + words - 1); |
fc0ea003 | 2907 | return which_alternative == 0 ? "lm\t%1,%0,%S2" : "lmy\t%1,%0,%S2"; |
10bbf137 | 2908 | } |
d3632d41 | 2909 | [(set_attr "op_type" "RS,RSY") |
3e4be43f | 2910 | (set_attr "cpu_facility" "*,longdisp") |
4023fb28 | 2911 | (set_attr "type" "lm")]) |
9db1d521 HP |
2912 | |
2913 | ; | |
c7453384 | 2914 | ; store multiple pattern(s). |
9db1d521 HP |
2915 | ; |
2916 | ||
2917 | (define_expand "store_multiple" | |
2918 | [(match_par_dup 3 [(set (match_operand 0 "" "") | |
2919 | (match_operand 1 "" "")) | |
2920 | (use (match_operand 2 "" ""))])] | |
22ea6b4f | 2921 | "reload_completed" |
9db1d521 | 2922 | { |
ef4bddc2 | 2923 | machine_mode mode; |
9db1d521 HP |
2924 | int regno; |
2925 | int count; | |
2926 | rtx to; | |
4023fb28 | 2927 | int i, off; |
9db1d521 HP |
2928 | |
2929 | /* Support only storing a constant number of fixed-point registers to | |
2930 | memory and only bother with this if more than two. */ | |
2931 | if (GET_CODE (operands[2]) != CONST_INT | |
4023fb28 | 2932 | || INTVAL (operands[2]) < 2 |
9db1d521 HP |
2933 | || INTVAL (operands[2]) > 16 |
2934 | || GET_CODE (operands[0]) != MEM | |
2935 | || GET_CODE (operands[1]) != REG | |
2936 | || REGNO (operands[1]) >= 16) | |
2937 | FAIL; | |
2938 | ||
2939 | count = INTVAL (operands[2]); | |
2940 | regno = REGNO (operands[1]); | |
c19ec8f9 | 2941 | mode = GET_MODE (operands[1]); |
9602b6a1 | 2942 | if (mode != SImode && (!TARGET_ZARCH || mode != DImode)) |
c19ec8f9 | 2943 | FAIL; |
9db1d521 HP |
2944 | |
2945 | operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count)); | |
4023fb28 | 2946 | |
b3a13419 | 2947 | if (!can_create_pseudo_p ()) |
4023fb28 UW |
2948 | { |
2949 | if (GET_CODE (XEXP (operands[0], 0)) == REG) | |
2950 | { | |
2951 | to = XEXP (operands[0], 0); | |
2952 | off = 0; | |
2953 | } | |
2954 | else if (GET_CODE (XEXP (operands[0], 0)) == PLUS | |
2955 | && GET_CODE (XEXP (XEXP (operands[0], 0), 0)) == REG | |
2956 | && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT) | |
2957 | { | |
2958 | to = XEXP (XEXP (operands[0], 0), 0); | |
2959 | off = INTVAL (XEXP (XEXP (operands[0], 0), 1)); | |
2960 | } | |
2961 | else | |
2962 | FAIL; | |
4023fb28 | 2963 | } |
c7453384 | 2964 | else |
4023fb28 UW |
2965 | { |
2966 | to = force_reg (Pmode, XEXP (operands[0], 0)); | |
2967 | off = 0; | |
2968 | } | |
9db1d521 HP |
2969 | |
2970 | for (i = 0; i < count; i++) | |
2971 | XVECEXP (operands[3], 0, i) | |
f7df4a84 | 2972 | = gen_rtx_SET (change_address (operands[0], mode, |
0a81f074 RS |
2973 | plus_constant (Pmode, to, |
2974 | off + i * GET_MODE_SIZE (mode))), | |
c19ec8f9 | 2975 | gen_rtx_REG (mode, regno + i)); |
10bbf137 | 2976 | }) |
9db1d521 HP |
2977 | |
2978 | (define_insn "*store_multiple_di" | |
2979 | [(match_parallel 0 "store_multiple_operation" | |
3e4be43f | 2980 | [(set (match_operand:DI 1 "s_operand" "=S") |
9db1d521 | 2981 | (match_operand:DI 2 "register_operand" "r"))])] |
9602b6a1 | 2982 | "reload_completed && TARGET_ZARCH" |
9db1d521 HP |
2983 | { |
2984 | int words = XVECLEN (operands[0], 0); | |
9db1d521 | 2985 | operands[0] = gen_rtx_REG (DImode, REGNO (operands[2]) + words - 1); |
fc0ea003 | 2986 | return "stmg\t%2,%0,%S1"; |
10bbf137 | 2987 | } |
d3632d41 | 2988 | [(set_attr "op_type" "RSY") |
4023fb28 | 2989 | (set_attr "type" "stm")]) |
9db1d521 HP |
2990 | |
2991 | ||
2992 | (define_insn "*store_multiple_si" | |
2993 | [(match_parallel 0 "store_multiple_operation" | |
d3632d41 UW |
2994 | [(set (match_operand:SI 1 "s_operand" "=Q,S") |
2995 | (match_operand:SI 2 "register_operand" "r,r"))])] | |
22ea6b4f | 2996 | "reload_completed" |
9db1d521 HP |
2997 | { |
2998 | int words = XVECLEN (operands[0], 0); | |
9db1d521 | 2999 | operands[0] = gen_rtx_REG (SImode, REGNO (operands[2]) + words - 1); |
fc0ea003 | 3000 | return which_alternative == 0 ? "stm\t%2,%0,%S1" : "stmy\t%2,%0,%S1"; |
10bbf137 | 3001 | } |
d3632d41 | 3002 | [(set_attr "op_type" "RS,RSY") |
3e4be43f | 3003 | (set_attr "cpu_facility" "*,longdisp") |
4023fb28 | 3004 | (set_attr "type" "stm")]) |
9db1d521 HP |
3005 | |
3006 | ;; | |
3007 | ;; String instructions. | |
3008 | ;; | |
3009 | ||
963fc8d0 | 3010 | (define_insn "*execute_rl" |
2771c2f9 | 3011 | [(match_parallel 0 "execute_operation" |
963fc8d0 AK |
3012 | [(unspec [(match_operand 1 "register_operand" "a") |
3013 | (match_operand 2 "" "") | |
3014 | (match_operand:SI 3 "larl_operand" "X")] UNSPEC_EXECUTE)])] | |
3015 | "TARGET_Z10 && GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT | |
3016 | && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD" | |
3017 | "exrl\t%1,%3" | |
3018 | [(set_attr "op_type" "RIL") | |
14cfceb7 IL |
3019 | (set_attr "type" "cs") |
3020 | (set_attr "relative_long" "yes")]) | |
963fc8d0 | 3021 | |
9bb86f41 | 3022 | (define_insn "*execute" |
2771c2f9 | 3023 | [(match_parallel 0 "execute_operation" |
9bb86f41 UW |
3024 | [(unspec [(match_operand 1 "register_operand" "a") |
3025 | (match_operand:BLK 2 "memory_operand" "R") | |
3026 | (match_operand 3 "" "")] UNSPEC_EXECUTE)])] | |
3027 | "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT | |
3028 | && GET_MODE_SIZE (GET_MODE (operands[1])) <= UNITS_PER_WORD" | |
3029 | "ex\t%1,%2" | |
29a74354 UW |
3030 | [(set_attr "op_type" "RX") |
3031 | (set_attr "type" "cs")]) | |
9bb86f41 UW |
3032 | |
3033 | ||
91d39d71 UW |
3034 | ; |
3035 | ; strlenM instruction pattern(s). | |
3036 | ; | |
3037 | ||
9db2f16d | 3038 | (define_expand "strlen<mode>" |
085261c8 AK |
3039 | [(match_operand:P 0 "register_operand" "") ; result |
3040 | (match_operand:BLK 1 "memory_operand" "") ; input string | |
3041 | (match_operand:SI 2 "immediate_operand" "") ; search character | |
3042 | (match_operand:SI 3 "immediate_operand" "")] ; known alignment | |
3043 | "" | |
3044 | { | |
3045 | if (!TARGET_VX || operands[2] != const0_rtx) | |
3046 | emit_insn (gen_strlen_srst<mode> (operands[0], operands[1], | |
3047 | operands[2], operands[3])); | |
3048 | else | |
3049 | s390_expand_vec_strlen (operands[0], operands[1], operands[3]); | |
3050 | ||
3051 | DONE; | |
3052 | }) | |
3053 | ||
3054 | (define_expand "strlen_srst<mode>" | |
ccbdc0d4 | 3055 | [(set (reg:SI 0) (match_operand:SI 2 "immediate_operand" "")) |
2f7e5a0d | 3056 | (parallel |
91d39d71 | 3057 | [(set (match_dup 4) |
9db2f16d | 3058 | (unspec:P [(const_int 0) |
91d39d71 | 3059 | (match_operand:BLK 1 "memory_operand" "") |
ccbdc0d4 | 3060 | (reg:SI 0) |
91d39d71 | 3061 | (match_operand 3 "immediate_operand" "")] UNSPEC_SRST)) |
9db2f16d | 3062 | (clobber (scratch:P)) |
ae156f85 | 3063 | (clobber (reg:CC CC_REGNUM))]) |
91d39d71 | 3064 | (parallel |
9db2f16d AS |
3065 | [(set (match_operand:P 0 "register_operand" "") |
3066 | (minus:P (match_dup 4) (match_dup 5))) | |
ae156f85 | 3067 | (clobber (reg:CC CC_REGNUM))])] |
9db2f16d | 3068 | "" |
91d39d71 | 3069 | { |
9db2f16d AS |
3070 | operands[4] = gen_reg_rtx (Pmode); |
3071 | operands[5] = gen_reg_rtx (Pmode); | |
91d39d71 UW |
3072 | emit_move_insn (operands[5], force_operand (XEXP (operands[1], 0), NULL_RTX)); |
3073 | operands[1] = replace_equiv_address (operands[1], operands[5]); | |
3074 | }) | |
3075 | ||
9db2f16d AS |
3076 | (define_insn "*strlen<mode>" |
3077 | [(set (match_operand:P 0 "register_operand" "=a") | |
3078 | (unspec:P [(match_operand:P 2 "general_operand" "0") | |
3079 | (mem:BLK (match_operand:P 3 "register_operand" "1")) | |
ccbdc0d4 | 3080 | (reg:SI 0) |
91d39d71 | 3081 | (match_operand 4 "immediate_operand" "")] UNSPEC_SRST)) |
9db2f16d | 3082 | (clobber (match_scratch:P 1 "=a")) |
ae156f85 | 3083 | (clobber (reg:CC CC_REGNUM))] |
9db2f16d | 3084 | "" |
91d39d71 | 3085 | "srst\t%0,%1\;jo\t.-4" |
b628bd8e UW |
3086 | [(set_attr "length" "8") |
3087 | (set_attr "type" "vs")]) | |
91d39d71 | 3088 | |
ccbdc0d4 AS |
3089 | ; |
3090 | ; cmpstrM instruction pattern(s). | |
3091 | ; | |
3092 | ||
3093 | (define_expand "cmpstrsi" | |
3094 | [(set (reg:SI 0) (const_int 0)) | |
3095 | (parallel | |
3096 | [(clobber (match_operand 3 "" "")) | |
3097 | (clobber (match_dup 4)) | |
3098 | (set (reg:CCU CC_REGNUM) | |
3099 | (compare:CCU (match_operand:BLK 1 "memory_operand" "") | |
3100 | (match_operand:BLK 2 "memory_operand" ""))) | |
3101 | (use (reg:SI 0))]) | |
3102 | (parallel | |
3103 | [(set (match_operand:SI 0 "register_operand" "=d") | |
5a3fe9b6 | 3104 | (unspec:SI [(reg:CCU CC_REGNUM)] UNSPEC_STRCMPCC_TO_INT)) |
ccbdc0d4 AS |
3105 | (clobber (reg:CC CC_REGNUM))])] |
3106 | "" | |
3107 | { | |
3108 | /* As the result of CMPINT is inverted compared to what we need, | |
3109 | we have to swap the operands. */ | |
3110 | rtx op1 = operands[2]; | |
3111 | rtx op2 = operands[1]; | |
3112 | rtx addr1 = gen_reg_rtx (Pmode); | |
3113 | rtx addr2 = gen_reg_rtx (Pmode); | |
3114 | ||
3115 | emit_move_insn (addr1, force_operand (XEXP (op1, 0), NULL_RTX)); | |
3116 | emit_move_insn (addr2, force_operand (XEXP (op2, 0), NULL_RTX)); | |
3117 | operands[1] = replace_equiv_address_nv (op1, addr1); | |
3118 | operands[2] = replace_equiv_address_nv (op2, addr2); | |
3119 | operands[3] = addr1; | |
3120 | operands[4] = addr2; | |
3121 | }) | |
3122 | ||
3123 | (define_insn "*cmpstr<mode>" | |
3124 | [(clobber (match_operand:P 0 "register_operand" "=d")) | |
3125 | (clobber (match_operand:P 1 "register_operand" "=d")) | |
3126 | (set (reg:CCU CC_REGNUM) | |
3127 | (compare:CCU (mem:BLK (match_operand:P 2 "register_operand" "0")) | |
3128 | (mem:BLK (match_operand:P 3 "register_operand" "1")))) | |
3129 | (use (reg:SI 0))] | |
3130 | "" | |
3131 | "clst\t%0,%1\;jo\t.-4" | |
3132 | [(set_attr "length" "8") | |
3133 | (set_attr "type" "vs")]) | |
9381e3f1 | 3134 | |
742090fc AS |
3135 | ; |
3136 | ; movstr instruction pattern. | |
3137 | ; | |
3138 | ||
3139 | (define_expand "movstr" | |
4a7dec25 DV |
3140 | [(match_operand 0 "register_operand" "") |
3141 | (match_operand 1 "memory_operand" "") | |
3142 | (match_operand 2 "memory_operand" "")] | |
3143 | "" | |
3144 | { | |
3145 | if (TARGET_64BIT) | |
3146 | emit_insn (gen_movstrdi (operands[0], operands[1], operands[2])); | |
3147 | else | |
3148 | emit_insn (gen_movstrsi (operands[0], operands[1], operands[2])); | |
3149 | DONE; | |
3150 | }) | |
3151 | ||
3152 | (define_expand "movstr<P:mode>" | |
742090fc | 3153 | [(set (reg:SI 0) (const_int 0)) |
9381e3f1 | 3154 | (parallel |
742090fc AS |
3155 | [(clobber (match_dup 3)) |
3156 | (set (match_operand:BLK 1 "memory_operand" "") | |
3157 | (match_operand:BLK 2 "memory_operand" "")) | |
4a7dec25 DV |
3158 | (set (match_operand:P 0 "register_operand" "") |
3159 | (unspec:P [(match_dup 1) | |
742090fc AS |
3160 | (match_dup 2) |
3161 | (reg:SI 0)] UNSPEC_MVST)) | |
3162 | (clobber (reg:CC CC_REGNUM))])] | |
3163 | "" | |
3164 | { | |
859a4c0e AK |
3165 | rtx addr1, addr2; |
3166 | ||
3167 | if (TARGET_VX && optimize_function_for_speed_p (cfun)) | |
3168 | { | |
3169 | s390_expand_vec_movstr (operands[0], operands[1], operands[2]); | |
3170 | DONE; | |
3171 | } | |
3172 | ||
3173 | addr1 = gen_reg_rtx (Pmode); | |
3174 | addr2 = gen_reg_rtx (Pmode); | |
742090fc AS |
3175 | |
3176 | emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX)); | |
3177 | emit_move_insn (addr2, force_operand (XEXP (operands[2], 0), NULL_RTX)); | |
3178 | operands[1] = replace_equiv_address_nv (operands[1], addr1); | |
3179 | operands[2] = replace_equiv_address_nv (operands[2], addr2); | |
3180 | operands[3] = addr2; | |
3181 | }) | |
3182 | ||
3183 | (define_insn "*movstr" | |
3184 | [(clobber (match_operand:P 2 "register_operand" "=d")) | |
3185 | (set (mem:BLK (match_operand:P 1 "register_operand" "0")) | |
3186 | (mem:BLK (match_operand:P 3 "register_operand" "2"))) | |
3187 | (set (match_operand:P 0 "register_operand" "=d") | |
4a7dec25 | 3188 | (unspec:P [(mem:BLK (match_dup 1)) |
742090fc AS |
3189 | (mem:BLK (match_dup 3)) |
3190 | (reg:SI 0)] UNSPEC_MVST)) | |
3191 | (clobber (reg:CC CC_REGNUM))] | |
3192 | "" | |
3193 | "mvst\t%1,%2\;jo\t.-4" | |
3194 | [(set_attr "length" "8") | |
3195 | (set_attr "type" "vs")]) | |
9381e3f1 | 3196 | |
742090fc | 3197 | |
9db1d521 | 3198 | ; |
76715c32 | 3199 | ; cpymemM instruction pattern(s). |
9db1d521 HP |
3200 | ; |
3201 | ||
76715c32 | 3202 | (define_expand "cpymem<mode>" |
963fc8d0 AK |
3203 | [(set (match_operand:BLK 0 "memory_operand" "") ; destination |
3204 | (match_operand:BLK 1 "memory_operand" "")) ; source | |
3205 | (use (match_operand:GPR 2 "general_operand" "")) ; count | |
a41c6c53 UW |
3206 | (match_operand 3 "" "")] |
3207 | "" | |
367d32f3 | 3208 | { |
76715c32 | 3209 | if (s390_expand_cpymem (operands[0], operands[1], operands[2])) |
367d32f3 AK |
3210 | DONE; |
3211 | else | |
3212 | FAIL; | |
3213 | }) | |
9db1d521 | 3214 | |
ecbe845e UW |
3215 | ; Move a block that is up to 256 bytes in length. |
3216 | ; The block length is taken as (operands[2] % 256) + 1. | |
9db1d521 | 3217 | |
76715c32 | 3218 | (define_expand "cpymem_short" |
b9404c99 UW |
3219 | [(parallel |
3220 | [(set (match_operand:BLK 0 "memory_operand" "") | |
3221 | (match_operand:BLK 1 "memory_operand" "")) | |
3222 | (use (match_operand 2 "nonmemory_operand" "")) | |
9bb86f41 | 3223 | (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN))) |
b9404c99 UW |
3224 | (clobber (match_dup 3))])] |
3225 | "" | |
3226 | "operands[3] = gen_rtx_SCRATCH (Pmode);") | |
ecbe845e | 3227 | |
76715c32 | 3228 | (define_insn "*cpymem_short" |
963fc8d0 AK |
3229 | [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q") |
3230 | (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q")) | |
3231 | (use (match_operand 2 "nonmemory_operand" "n,a,a,a")) | |
3232 | (use (match_operand 3 "immediate_operand" "X,R,X,X")) | |
1eae36f0 AK |
3233 | (clobber (match_scratch:P 4 "=X,X,X,&a"))] |
3234 | "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)" | |
9bb86f41 | 3235 | "#" |
963fc8d0 | 3236 | [(set_attr "type" "cs") |
b5e0425c | 3237 | (set_attr "cpu_facility" "*,*,z10,cpu_zarch")]) |
ecbe845e | 3238 | |
9bb86f41 UW |
3239 | (define_split |
3240 | [(set (match_operand:BLK 0 "memory_operand" "") | |
3241 | (match_operand:BLK 1 "memory_operand" "")) | |
3242 | (use (match_operand 2 "const_int_operand" "")) | |
3243 | (use (match_operand 3 "immediate_operand" "")) | |
3244 | (clobber (scratch))] | |
3245 | "reload_completed" | |
3246 | [(parallel | |
3247 | [(set (match_dup 0) (match_dup 1)) | |
3248 | (use (match_dup 2))])] | |
3249 | "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);") | |
9db1d521 | 3250 | |
9bb86f41 UW |
3251 | (define_split |
3252 | [(set (match_operand:BLK 0 "memory_operand" "") | |
3253 | (match_operand:BLK 1 "memory_operand" "")) | |
3254 | (use (match_operand 2 "register_operand" "")) | |
3255 | (use (match_operand 3 "memory_operand" "")) | |
3256 | (clobber (scratch))] | |
3257 | "reload_completed" | |
3258 | [(parallel | |
3259 | [(unspec [(match_dup 2) (match_dup 3) | |
3260 | (const_int 0)] UNSPEC_EXECUTE) | |
3261 | (set (match_dup 0) (match_dup 1)) | |
3262 | (use (const_int 1))])] | |
3263 | "") | |
3264 | ||
963fc8d0 AK |
3265 | (define_split |
3266 | [(set (match_operand:BLK 0 "memory_operand" "") | |
3267 | (match_operand:BLK 1 "memory_operand" "")) | |
3268 | (use (match_operand 2 "register_operand" "")) | |
3269 | (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN))) | |
3270 | (clobber (scratch))] | |
3271 | "TARGET_Z10 && reload_completed" | |
3272 | [(parallel | |
3273 | [(unspec [(match_dup 2) (const_int 0) | |
3274 | (label_ref (match_dup 3))] UNSPEC_EXECUTE) | |
3275 | (set (match_dup 0) (match_dup 1)) | |
3276 | (use (const_int 1))])] | |
3277 | "operands[3] = gen_label_rtx ();") | |
3278 | ||
9bb86f41 UW |
3279 | (define_split |
3280 | [(set (match_operand:BLK 0 "memory_operand" "") | |
3281 | (match_operand:BLK 1 "memory_operand" "")) | |
3282 | (use (match_operand 2 "register_operand" "")) | |
3283 | (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN))) | |
3284 | (clobber (match_operand 3 "register_operand" ""))] | |
8cc6307c | 3285 | "reload_completed" |
9bb86f41 UW |
3286 | [(set (match_dup 3) (label_ref (match_dup 4))) |
3287 | (parallel | |
9381e3f1 | 3288 | [(unspec [(match_dup 2) (mem:BLK (match_dup 3)) |
9bb86f41 UW |
3289 | (label_ref (match_dup 4))] UNSPEC_EXECUTE) |
3290 | (set (match_dup 0) (match_dup 1)) | |
3291 | (use (const_int 1))])] | |
3292 | "operands[4] = gen_label_rtx ();") | |
3293 | ||
a41c6c53 | 3294 | ; Move a block of arbitrary length. |
9db1d521 | 3295 | |
76715c32 | 3296 | (define_expand "cpymem_long" |
b9404c99 UW |
3297 | [(parallel |
3298 | [(clobber (match_dup 2)) | |
3299 | (clobber (match_dup 3)) | |
3300 | (set (match_operand:BLK 0 "memory_operand" "") | |
3301 | (match_operand:BLK 1 "memory_operand" "")) | |
3302 | (use (match_operand 2 "general_operand" "")) | |
3303 | (use (match_dup 3)) | |
ae156f85 | 3304 | (clobber (reg:CC CC_REGNUM))])] |
b9404c99 UW |
3305 | "" |
3306 | { | |
ef4bddc2 RS |
3307 | machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode; |
3308 | machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode; | |
9602b6a1 AK |
3309 | rtx reg0 = gen_reg_rtx (dreg_mode); |
3310 | rtx reg1 = gen_reg_rtx (dreg_mode); | |
3311 | rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0)); | |
3312 | rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1)); | |
b9404c99 UW |
3313 | rtx len0 = gen_lowpart (Pmode, reg0); |
3314 | rtx len1 = gen_lowpart (Pmode, reg1); | |
3315 | ||
c41c1387 | 3316 | emit_clobber (reg0); |
b9404c99 UW |
3317 | emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX)); |
3318 | emit_move_insn (len0, operands[2]); | |
3319 | ||
c41c1387 | 3320 | emit_clobber (reg1); |
b9404c99 UW |
3321 | emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX)); |
3322 | emit_move_insn (len1, operands[2]); | |
3323 | ||
3324 | operands[0] = replace_equiv_address_nv (operands[0], addr0); | |
3325 | operands[1] = replace_equiv_address_nv (operands[1], addr1); | |
3326 | operands[2] = reg0; | |
3327 | operands[3] = reg1; | |
3328 | }) | |
3329 | ||
76715c32 | 3330 | (define_insn "*cpymem_long" |
a1aed706 AS |
3331 | [(clobber (match_operand:<DBL> 0 "register_operand" "=d")) |
3332 | (clobber (match_operand:<DBL> 1 "register_operand" "=d")) | |
3333 | (set (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0)) | |
3334 | (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0))) | |
b9404c99 UW |
3335 | (use (match_dup 2)) |
3336 | (use (match_dup 3)) | |
ae156f85 | 3337 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 AK |
3338 | "TARGET_64BIT || !TARGET_ZARCH" |
3339 | "mvcle\t%0,%1,0\;jo\t.-4" | |
3340 | [(set_attr "length" "8") | |
3341 | (set_attr "type" "vs")]) | |
3342 | ||
76715c32 | 3343 | (define_insn "*cpymem_long_31z" |
9602b6a1 AK |
3344 | [(clobber (match_operand:TI 0 "register_operand" "=d")) |
3345 | (clobber (match_operand:TI 1 "register_operand" "=d")) | |
3346 | (set (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4)) | |
3347 | (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4))) | |
3348 | (use (match_dup 2)) | |
3349 | (use (match_dup 3)) | |
3350 | (clobber (reg:CC CC_REGNUM))] | |
3351 | "!TARGET_64BIT && TARGET_ZARCH" | |
d40c829f | 3352 | "mvcle\t%0,%1,0\;jo\t.-4" |
b628bd8e UW |
3353 | [(set_attr "length" "8") |
3354 | (set_attr "type" "vs")]) | |
9db1d521 | 3355 | |
638e37c2 WG |
3356 | |
3357 | ; | |
3358 | ; Test data class. | |
3359 | ; | |
3360 | ||
0f67fa83 WG |
3361 | (define_expand "signbit<mode>2" |
3362 | [(set (reg:CCZ CC_REGNUM) | |
9381e3f1 WG |
3363 | (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f") |
3364 | (match_dup 2)] | |
0f67fa83 WG |
3365 | UNSPEC_TDC_INSN)) |
3366 | (set (match_operand:SI 0 "register_operand" "=d") | |
5a3fe9b6 | 3367 | (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))] |
0f67fa83 WG |
3368 | "TARGET_HARD_FLOAT" |
3369 | { | |
3370 | operands[2] = GEN_INT (S390_TDC_SIGNBIT_SET); | |
3371 | }) | |
3372 | ||
638e37c2 WG |
3373 | (define_expand "isinf<mode>2" |
3374 | [(set (reg:CCZ CC_REGNUM) | |
9381e3f1 WG |
3375 | (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f") |
3376 | (match_dup 2)] | |
638e37c2 WG |
3377 | UNSPEC_TDC_INSN)) |
3378 | (set (match_operand:SI 0 "register_operand" "=d") | |
5a3fe9b6 | 3379 | (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))] |
142cd70f | 3380 | "TARGET_HARD_FLOAT" |
638e37c2 WG |
3381 | { |
3382 | operands[2] = GEN_INT (S390_TDC_INFINITY); | |
3383 | }) | |
3384 | ||
085261c8 AK |
3385 | ; This extracts CC into a GPR properly shifted. The actual IPM |
3386 | ; instruction will be issued by reload. The constraint of operand 1 | |
3387 | ; forces reload to use a GPR. So reload will issue a movcc insn for | |
3388 | ; copying CC into a GPR first. | |
5a3fe9b6 | 3389 | (define_insn_and_split "*cc_to_int" |
085261c8 | 3390 | [(set (match_operand:SI 0 "nonimmediate_operand" "=d") |
5a3fe9b6 AK |
3391 | (unspec:SI [(match_operand 1 "register_operand" "0")] |
3392 | UNSPEC_CC_TO_INT))] | |
3393 | "operands != NULL" | |
3394 | "#" | |
3395 | "reload_completed" | |
3396 | [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 28)))]) | |
3397 | ||
638e37c2 WG |
3398 | ; This insn is used to generate all variants of the Test Data Class |
3399 | ; instruction, namely tcxb, tcdb, and tceb. The insn's first operand | |
3400 | ; is the register to be tested and the second one is the bit mask | |
9381e3f1 | 3401 | ; specifying the required test(s). |
638e37c2 | 3402 | ; |
be5de7a1 | 3403 | ; tcxb, tcdb, tceb, tdcxt, tdcdt, tdcet |
638e37c2 WG |
3404 | (define_insn "*TDC_insn_<mode>" |
3405 | [(set (reg:CCZ CC_REGNUM) | |
9381e3f1 | 3406 | (unspec:CCZ [(match_operand:FP_ALL 0 "register_operand" "f") |
638e37c2 | 3407 | (match_operand:SI 1 "const_int_operand")] UNSPEC_TDC_INSN))] |
142cd70f | 3408 | "TARGET_HARD_FLOAT" |
0387c142 | 3409 | "t<_d>c<xde><bt>\t%0,%1" |
638e37c2 | 3410 | [(set_attr "op_type" "RXE") |
9381e3f1 | 3411 | (set_attr "type" "fsimp<mode>")]) |
638e37c2 | 3412 | |
638e37c2 WG |
3413 | |
3414 | ||
9db1d521 | 3415 | ; |
57e84f18 | 3416 | ; setmemM instruction pattern(s). |
9db1d521 HP |
3417 | ; |
3418 | ||
57e84f18 | 3419 | (define_expand "setmem<mode>" |
a41c6c53 | 3420 | [(set (match_operand:BLK 0 "memory_operand" "") |
6d057022 | 3421 | (match_operand:QI 2 "general_operand" "")) |
9db2f16d | 3422 | (use (match_operand:GPR 1 "general_operand" "")) |
57e84f18 | 3423 | (match_operand 3 "" "")] |
a41c6c53 | 3424 | "" |
6d057022 | 3425 | "s390_expand_setmem (operands[0], operands[1], operands[2]); DONE;") |
9db1d521 | 3426 | |
a41c6c53 | 3427 | ; Clear a block that is up to 256 bytes in length. |
b9404c99 UW |
3428 | ; The block length is taken as (operands[1] % 256) + 1. |
3429 | ||
70128ad9 | 3430 | (define_expand "clrmem_short" |
b9404c99 UW |
3431 | [(parallel |
3432 | [(set (match_operand:BLK 0 "memory_operand" "") | |
3433 | (const_int 0)) | |
3434 | (use (match_operand 1 "nonmemory_operand" "")) | |
9bb86f41 | 3435 | (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN))) |
b9404c99 | 3436 | (clobber (match_dup 2)) |
ae156f85 | 3437 | (clobber (reg:CC CC_REGNUM))])] |
b9404c99 UW |
3438 | "" |
3439 | "operands[2] = gen_rtx_SCRATCH (Pmode);") | |
9db1d521 | 3440 | |
70128ad9 | 3441 | (define_insn "*clrmem_short" |
963fc8d0 | 3442 | [(set (match_operand:BLK 0 "memory_operand" "=Q,Q,Q,Q") |
a41c6c53 | 3443 | (const_int 0)) |
963fc8d0 AK |
3444 | (use (match_operand 1 "nonmemory_operand" "n,a,a,a")) |
3445 | (use (match_operand 2 "immediate_operand" "X,R,X,X")) | |
1eae36f0 | 3446 | (clobber (match_scratch:P 3 "=X,X,X,&a")) |
ae156f85 | 3447 | (clobber (reg:CC CC_REGNUM))] |
1eae36f0 | 3448 | "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)" |
9bb86f41 | 3449 | "#" |
963fc8d0 | 3450 | [(set_attr "type" "cs") |
b5e0425c | 3451 | (set_attr "cpu_facility" "*,*,z10,cpu_zarch")]) |
9bb86f41 UW |
3452 | |
3453 | (define_split | |
3454 | [(set (match_operand:BLK 0 "memory_operand" "") | |
3455 | (const_int 0)) | |
3456 | (use (match_operand 1 "const_int_operand" "")) | |
3457 | (use (match_operand 2 "immediate_operand" "")) | |
3458 | (clobber (scratch)) | |
ae156f85 | 3459 | (clobber (reg:CC CC_REGNUM))] |
9bb86f41 UW |
3460 | "reload_completed" |
3461 | [(parallel | |
3462 | [(set (match_dup 0) (const_int 0)) | |
3463 | (use (match_dup 1)) | |
ae156f85 | 3464 | (clobber (reg:CC CC_REGNUM))])] |
9bb86f41 | 3465 | "operands[1] = GEN_INT ((INTVAL (operands[1]) & 0xff) + 1);") |
9db1d521 | 3466 | |
9bb86f41 UW |
3467 | (define_split |
3468 | [(set (match_operand:BLK 0 "memory_operand" "") | |
3469 | (const_int 0)) | |
3470 | (use (match_operand 1 "register_operand" "")) | |
3471 | (use (match_operand 2 "memory_operand" "")) | |
3472 | (clobber (scratch)) | |
ae156f85 | 3473 | (clobber (reg:CC CC_REGNUM))] |
9bb86f41 UW |
3474 | "reload_completed" |
3475 | [(parallel | |
3476 | [(unspec [(match_dup 1) (match_dup 2) | |
3477 | (const_int 0)] UNSPEC_EXECUTE) | |
3478 | (set (match_dup 0) (const_int 0)) | |
3479 | (use (const_int 1)) | |
ae156f85 | 3480 | (clobber (reg:CC CC_REGNUM))])] |
9bb86f41 | 3481 | "") |
9db1d521 | 3482 | |
963fc8d0 AK |
3483 | (define_split |
3484 | [(set (match_operand:BLK 0 "memory_operand" "") | |
3485 | (const_int 0)) | |
3486 | (use (match_operand 1 "register_operand" "")) | |
3487 | (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN))) | |
3488 | (clobber (scratch)) | |
3489 | (clobber (reg:CC CC_REGNUM))] | |
3490 | "TARGET_Z10 && reload_completed" | |
3491 | [(parallel | |
3492 | [(unspec [(match_dup 1) (const_int 0) | |
3493 | (label_ref (match_dup 3))] UNSPEC_EXECUTE) | |
3494 | (set (match_dup 0) (const_int 0)) | |
3495 | (use (const_int 1)) | |
3496 | (clobber (reg:CC CC_REGNUM))])] | |
3497 | "operands[3] = gen_label_rtx ();") | |
3498 | ||
9bb86f41 UW |
3499 | (define_split |
3500 | [(set (match_operand:BLK 0 "memory_operand" "") | |
3501 | (const_int 0)) | |
3502 | (use (match_operand 1 "register_operand" "")) | |
3503 | (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN))) | |
3504 | (clobber (match_operand 2 "register_operand" "")) | |
ae156f85 | 3505 | (clobber (reg:CC CC_REGNUM))] |
8cc6307c | 3506 | "reload_completed" |
9bb86f41 UW |
3507 | [(set (match_dup 2) (label_ref (match_dup 3))) |
3508 | (parallel | |
9381e3f1 | 3509 | [(unspec [(match_dup 1) (mem:BLK (match_dup 2)) |
9bb86f41 UW |
3510 | (label_ref (match_dup 3))] UNSPEC_EXECUTE) |
3511 | (set (match_dup 0) (const_int 0)) | |
3512 | (use (const_int 1)) | |
ae156f85 | 3513 | (clobber (reg:CC CC_REGNUM))])] |
9bb86f41 UW |
3514 | "operands[3] = gen_label_rtx ();") |
3515 | ||
9381e3f1 | 3516 | ; Initialize a block of arbitrary length with (operands[2] % 256). |
b9404c99 | 3517 | |
da0dcab1 | 3518 | (define_expand "setmem_long_<P:mode>" |
b9404c99 UW |
3519 | [(parallel |
3520 | [(clobber (match_dup 1)) | |
3521 | (set (match_operand:BLK 0 "memory_operand" "") | |
dd95128b | 3522 | (unspec:BLK [(match_operand:P 2 "setmem_operand" "") |
da0dcab1 | 3523 | (match_dup 4)] UNSPEC_REPLICATE_BYTE)) |
6d057022 | 3524 | (use (match_dup 3)) |
ae156f85 | 3525 | (clobber (reg:CC CC_REGNUM))])] |
b9404c99 | 3526 | "" |
a41c6c53 | 3527 | { |
ef4bddc2 RS |
3528 | machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode; |
3529 | machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode; | |
9602b6a1 AK |
3530 | rtx reg0 = gen_reg_rtx (dreg_mode); |
3531 | rtx reg1 = gen_reg_rtx (dreg_mode); | |
3532 | rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0)); | |
b9404c99 | 3533 | rtx len0 = gen_lowpart (Pmode, reg0); |
9db1d521 | 3534 | |
c41c1387 | 3535 | emit_clobber (reg0); |
b9404c99 UW |
3536 | emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX)); |
3537 | emit_move_insn (len0, operands[1]); | |
9db1d521 | 3538 | |
b9404c99 | 3539 | emit_move_insn (reg1, const0_rtx); |
a41c6c53 | 3540 | |
b9404c99 UW |
3541 | operands[0] = replace_equiv_address_nv (operands[0], addr0); |
3542 | operands[1] = reg0; | |
6d057022 | 3543 | operands[3] = reg1; |
da0dcab1 | 3544 | operands[4] = gen_lowpart (Pmode, operands[1]); |
b9404c99 | 3545 | }) |
a41c6c53 | 3546 | |
da0dcab1 DV |
3547 | ; Patterns for 31 bit + Esa and 64 bit + Zarch. |
3548 | ||
db340c73 | 3549 | (define_insn "*setmem_long" |
a1aed706 | 3550 | [(clobber (match_operand:<DBL> 0 "register_operand" "=d")) |
6d057022 | 3551 | (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0)) |
dd95128b | 3552 | (unspec:BLK [(match_operand:P 2 "setmem_operand" "Y") |
da0dcab1 DV |
3553 | (subreg:P (match_dup 3) <modesize>)] |
3554 | UNSPEC_REPLICATE_BYTE)) | |
a1aed706 | 3555 | (use (match_operand:<DBL> 1 "register_operand" "d")) |
ae156f85 | 3556 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 3557 | "TARGET_64BIT || !TARGET_ZARCH" |
6d057022 | 3558 | "mvcle\t%0,%1,%Y2\;jo\t.-4" |
b628bd8e UW |
3559 | [(set_attr "length" "8") |
3560 | (set_attr "type" "vs")]) | |
9db1d521 | 3561 | |
db340c73 AK |
3562 | (define_insn "*setmem_long_and" |
3563 | [(clobber (match_operand:<DBL> 0 "register_operand" "=d")) | |
3564 | (set (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "0") 0)) | |
d876f5cd | 3565 | (unspec:BLK [(zero_extend:P (match_operand:QI 2 "setmem_operand" "Y")) |
db340c73 AK |
3566 | (subreg:P (match_dup 3) <modesize>)] |
3567 | UNSPEC_REPLICATE_BYTE)) | |
3568 | (use (match_operand:<DBL> 1 "register_operand" "d")) | |
3569 | (clobber (reg:CC CC_REGNUM))] | |
d876f5cd | 3570 | "(TARGET_64BIT || !TARGET_ZARCH)" |
db340c73 AK |
3571 | "mvcle\t%0,%1,%Y2\;jo\t.-4" |
3572 | [(set_attr "length" "8") | |
3573 | (set_attr "type" "vs")]) | |
3574 | ||
da0dcab1 DV |
3575 | ; Variants for 31 bit + Zarch, necessary because of the odd in-register offsets |
3576 | ; of the SImode subregs. | |
3577 | ||
db340c73 | 3578 | (define_insn "*setmem_long_31z" |
9602b6a1 AK |
3579 | [(clobber (match_operand:TI 0 "register_operand" "=d")) |
3580 | (set (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "0") 4)) | |
dd95128b | 3581 | (unspec:BLK [(match_operand:SI 2 "setmem_operand" "Y") |
da0dcab1 | 3582 | (subreg:SI (match_dup 3) 12)] UNSPEC_REPLICATE_BYTE)) |
9602b6a1 AK |
3583 | (use (match_operand:TI 1 "register_operand" "d")) |
3584 | (clobber (reg:CC CC_REGNUM))] | |
3585 | "!TARGET_64BIT && TARGET_ZARCH" | |
4989e88a AK |
3586 | "mvcle\t%0,%1,%Y2\;jo\t.-4" |
3587 | [(set_attr "length" "8") | |
3588 | (set_attr "type" "vs")]) | |
9602b6a1 | 3589 | |
db340c73 AK |
3590 | (define_insn "*setmem_long_and_31z" |
3591 | [(clobber (match_operand:TI 0 "register_operand" "=d")) | |
3592 | (set (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "0") 4)) | |
d876f5cd | 3593 | (unspec:BLK [(zero_extend:SI (match_operand:QI 2 "setmem_operand" "Y")) |
db340c73 AK |
3594 | (subreg:SI (match_dup 3) 12)] UNSPEC_REPLICATE_BYTE)) |
3595 | (use (match_operand:TI 1 "register_operand" "d")) | |
3596 | (clobber (reg:CC CC_REGNUM))] | |
d876f5cd | 3597 | "(!TARGET_64BIT && TARGET_ZARCH)" |
db340c73 AK |
3598 | "mvcle\t%0,%1,%Y2\;jo\t.-4" |
3599 | [(set_attr "length" "8") | |
3600 | (set_attr "type" "vs")]) | |
3601 | ||
9db1d521 | 3602 | ; |
358b8f01 | 3603 | ; cmpmemM instruction pattern(s). |
9db1d521 HP |
3604 | ; |
3605 | ||
358b8f01 | 3606 | (define_expand "cmpmemsi" |
a41c6c53 UW |
3607 | [(set (match_operand:SI 0 "register_operand" "") |
3608 | (compare:SI (match_operand:BLK 1 "memory_operand" "") | |
3609 | (match_operand:BLK 2 "memory_operand" "") ) ) | |
3610 | (use (match_operand:SI 3 "general_operand" "")) | |
3611 | (use (match_operand:SI 4 "" ""))] | |
3612 | "" | |
367d32f3 AK |
3613 | { |
3614 | if (s390_expand_cmpmem (operands[0], operands[1], | |
3615 | operands[2], operands[3])) | |
3616 | DONE; | |
3617 | else | |
3618 | FAIL; | |
3619 | }) | |
9db1d521 | 3620 | |
a41c6c53 UW |
3621 | ; Compare a block that is up to 256 bytes in length. |
3622 | ; The block length is taken as (operands[2] % 256) + 1. | |
9db1d521 | 3623 | |
b9404c99 UW |
3624 | (define_expand "cmpmem_short" |
3625 | [(parallel | |
ae156f85 | 3626 | [(set (reg:CCU CC_REGNUM) |
5b022de5 | 3627 | (compare:CCU (match_operand:BLK 0 "memory_operand" "") |
b9404c99 UW |
3628 | (match_operand:BLK 1 "memory_operand" ""))) |
3629 | (use (match_operand 2 "nonmemory_operand" "")) | |
9bb86f41 | 3630 | (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN))) |
b9404c99 UW |
3631 | (clobber (match_dup 3))])] |
3632 | "" | |
3633 | "operands[3] = gen_rtx_SCRATCH (Pmode);") | |
9db1d521 | 3634 | |
b9404c99 | 3635 | (define_insn "*cmpmem_short" |
ae156f85 | 3636 | [(set (reg:CCU CC_REGNUM) |
963fc8d0 AK |
3637 | (compare:CCU (match_operand:BLK 0 "memory_operand" "Q,Q,Q,Q") |
3638 | (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q"))) | |
3639 | (use (match_operand 2 "nonmemory_operand" "n,a,a,a")) | |
3640 | (use (match_operand 3 "immediate_operand" "X,R,X,X")) | |
1eae36f0 AK |
3641 | (clobber (match_scratch:P 4 "=X,X,X,&a"))] |
3642 | "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)" | |
9bb86f41 | 3643 | "#" |
963fc8d0 | 3644 | [(set_attr "type" "cs") |
b5e0425c | 3645 | (set_attr "cpu_facility" "*,*,z10,cpu_zarch")]) |
9db1d521 | 3646 | |
9bb86f41 | 3647 | (define_split |
ae156f85 | 3648 | [(set (reg:CCU CC_REGNUM) |
9bb86f41 UW |
3649 | (compare:CCU (match_operand:BLK 0 "memory_operand" "") |
3650 | (match_operand:BLK 1 "memory_operand" ""))) | |
3651 | (use (match_operand 2 "const_int_operand" "")) | |
3652 | (use (match_operand 3 "immediate_operand" "")) | |
3653 | (clobber (scratch))] | |
3654 | "reload_completed" | |
3655 | [(parallel | |
ae156f85 | 3656 | [(set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1))) |
9bb86f41 UW |
3657 | (use (match_dup 2))])] |
3658 | "operands[2] = GEN_INT ((INTVAL (operands[2]) & 0xff) + 1);") | |
9db1d521 | 3659 | |
9bb86f41 | 3660 | (define_split |
ae156f85 | 3661 | [(set (reg:CCU CC_REGNUM) |
9bb86f41 UW |
3662 | (compare:CCU (match_operand:BLK 0 "memory_operand" "") |
3663 | (match_operand:BLK 1 "memory_operand" ""))) | |
3664 | (use (match_operand 2 "register_operand" "")) | |
3665 | (use (match_operand 3 "memory_operand" "")) | |
3666 | (clobber (scratch))] | |
3667 | "reload_completed" | |
3668 | [(parallel | |
3669 | [(unspec [(match_dup 2) (match_dup 3) | |
3670 | (const_int 0)] UNSPEC_EXECUTE) | |
ae156f85 | 3671 | (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1))) |
9bb86f41 UW |
3672 | (use (const_int 1))])] |
3673 | "") | |
3674 | ||
963fc8d0 AK |
3675 | (define_split |
3676 | [(set (reg:CCU CC_REGNUM) | |
3677 | (compare:CCU (match_operand:BLK 0 "memory_operand" "") | |
3678 | (match_operand:BLK 1 "memory_operand" ""))) | |
3679 | (use (match_operand 2 "register_operand" "")) | |
3680 | (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN))) | |
3681 | (clobber (scratch))] | |
3682 | "TARGET_Z10 && reload_completed" | |
3683 | [(parallel | |
3684 | [(unspec [(match_dup 2) (const_int 0) | |
3685 | (label_ref (match_dup 4))] UNSPEC_EXECUTE) | |
3686 | (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1))) | |
3687 | (use (const_int 1))])] | |
3688 | "operands[4] = gen_label_rtx ();") | |
3689 | ||
9bb86f41 | 3690 | (define_split |
ae156f85 | 3691 | [(set (reg:CCU CC_REGNUM) |
9bb86f41 UW |
3692 | (compare:CCU (match_operand:BLK 0 "memory_operand" "") |
3693 | (match_operand:BLK 1 "memory_operand" ""))) | |
3694 | (use (match_operand 2 "register_operand" "")) | |
3695 | (use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN))) | |
3696 | (clobber (match_operand 3 "register_operand" ""))] | |
8cc6307c | 3697 | "reload_completed" |
9bb86f41 UW |
3698 | [(set (match_dup 3) (label_ref (match_dup 4))) |
3699 | (parallel | |
9381e3f1 | 3700 | [(unspec [(match_dup 2) (mem:BLK (match_dup 3)) |
9bb86f41 | 3701 | (label_ref (match_dup 4))] UNSPEC_EXECUTE) |
ae156f85 | 3702 | (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1))) |
9bb86f41 UW |
3703 | (use (const_int 1))])] |
3704 | "operands[4] = gen_label_rtx ();") | |
3705 | ||
a41c6c53 | 3706 | ; Compare a block of arbitrary length. |
9db1d521 | 3707 | |
b9404c99 UW |
3708 | (define_expand "cmpmem_long" |
3709 | [(parallel | |
3710 | [(clobber (match_dup 2)) | |
3711 | (clobber (match_dup 3)) | |
ae156f85 | 3712 | (set (reg:CCU CC_REGNUM) |
5b022de5 | 3713 | (compare:CCU (match_operand:BLK 0 "memory_operand" "") |
b9404c99 UW |
3714 | (match_operand:BLK 1 "memory_operand" ""))) |
3715 | (use (match_operand 2 "general_operand" "")) | |
3716 | (use (match_dup 3))])] | |
3717 | "" | |
3718 | { | |
ef4bddc2 RS |
3719 | machine_mode sreg_mode = TARGET_ZARCH ? DImode : SImode; |
3720 | machine_mode dreg_mode = TARGET_ZARCH ? TImode : DImode; | |
9602b6a1 AK |
3721 | rtx reg0 = gen_reg_rtx (dreg_mode); |
3722 | rtx reg1 = gen_reg_rtx (dreg_mode); | |
3723 | rtx addr0 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg0)); | |
3724 | rtx addr1 = gen_lowpart (Pmode, gen_highpart (sreg_mode, reg1)); | |
b9404c99 UW |
3725 | rtx len0 = gen_lowpart (Pmode, reg0); |
3726 | rtx len1 = gen_lowpart (Pmode, reg1); | |
3727 | ||
c41c1387 | 3728 | emit_clobber (reg0); |
b9404c99 UW |
3729 | emit_move_insn (addr0, force_operand (XEXP (operands[0], 0), NULL_RTX)); |
3730 | emit_move_insn (len0, operands[2]); | |
3731 | ||
c41c1387 | 3732 | emit_clobber (reg1); |
b9404c99 UW |
3733 | emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX)); |
3734 | emit_move_insn (len1, operands[2]); | |
3735 | ||
3736 | operands[0] = replace_equiv_address_nv (operands[0], addr0); | |
3737 | operands[1] = replace_equiv_address_nv (operands[1], addr1); | |
3738 | operands[2] = reg0; | |
3739 | operands[3] = reg1; | |
3740 | }) | |
3741 | ||
a1aed706 AS |
3742 | (define_insn "*cmpmem_long" |
3743 | [(clobber (match_operand:<DBL> 0 "register_operand" "=d")) | |
3744 | (clobber (match_operand:<DBL> 1 "register_operand" "=d")) | |
ae156f85 | 3745 | (set (reg:CCU CC_REGNUM) |
a1aed706 AS |
3746 | (compare:CCU (mem:BLK (subreg:P (match_operand:<DBL> 2 "register_operand" "0") 0)) |
3747 | (mem:BLK (subreg:P (match_operand:<DBL> 3 "register_operand" "1") 0)))) | |
f8766020 HP |
3748 | (use (match_dup 2)) |
3749 | (use (match_dup 3))] | |
9602b6a1 | 3750 | "TARGET_64BIT || !TARGET_ZARCH" |
287ff198 | 3751 | "clcle\t%0,%1,0\;jo\t.-4" |
b628bd8e UW |
3752 | [(set_attr "length" "8") |
3753 | (set_attr "type" "vs")]) | |
9db1d521 | 3754 | |
9602b6a1 AK |
3755 | (define_insn "*cmpmem_long_31z" |
3756 | [(clobber (match_operand:TI 0 "register_operand" "=d")) | |
3757 | (clobber (match_operand:TI 1 "register_operand" "=d")) | |
3758 | (set (reg:CCU CC_REGNUM) | |
3759 | (compare:CCU (mem:BLK (subreg:SI (match_operand:TI 2 "register_operand" "0") 4)) | |
3760 | (mem:BLK (subreg:SI (match_operand:TI 3 "register_operand" "1") 4)))) | |
3761 | (use (match_dup 2)) | |
3762 | (use (match_dup 3))] | |
3763 | "!TARGET_64BIT && TARGET_ZARCH" | |
3764 | "clcle\t%0,%1,0\;jo\t.-4" | |
3765 | [(set_attr "op_type" "NN") | |
3766 | (set_attr "type" "vs") | |
3767 | (set_attr "length" "8")]) | |
3768 | ||
02887425 UW |
3769 | ; Convert CCUmode condition code to integer. |
3770 | ; Result is zero if EQ, positive if LTU, negative if GTU. | |
9db1d521 | 3771 | |
02887425 | 3772 | (define_insn_and_split "cmpint" |
9db1d521 | 3773 | [(set (match_operand:SI 0 "register_operand" "=d") |
02887425 | 3774 | (unspec:SI [(match_operand:CCU 1 "register_operand" "0")] |
5a3fe9b6 | 3775 | UNSPEC_STRCMPCC_TO_INT)) |
ae156f85 | 3776 | (clobber (reg:CC CC_REGNUM))] |
9db1d521 | 3777 | "" |
02887425 UW |
3778 | "#" |
3779 | "reload_completed" | |
3780 | [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2))) | |
3781 | (parallel | |
3782 | [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30))) | |
ae156f85 | 3783 | (clobber (reg:CC CC_REGNUM))])]) |
02887425 UW |
3784 | |
3785 | (define_insn_and_split "*cmpint_cc" | |
ae156f85 | 3786 | [(set (reg CC_REGNUM) |
02887425 | 3787 | (compare (unspec:SI [(match_operand:CCU 1 "register_operand" "0")] |
5a3fe9b6 | 3788 | UNSPEC_STRCMPCC_TO_INT) |
02887425 UW |
3789 | (const_int 0))) |
3790 | (set (match_operand:SI 0 "register_operand" "=d") | |
5a3fe9b6 | 3791 | (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT))] |
02887425 UW |
3792 | "s390_match_ccmode (insn, CCSmode)" |
3793 | "#" | |
3794 | "&& reload_completed" | |
3795 | [(set (match_dup 0) (ashift:SI (match_dup 0) (const_int 2))) | |
3796 | (parallel | |
3797 | [(set (match_dup 2) (match_dup 3)) | |
3798 | (set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 30)))])] | |
9db1d521 | 3799 | { |
02887425 UW |
3800 | rtx result = gen_rtx_ASHIFTRT (SImode, operands[0], GEN_INT (30)); |
3801 | operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0)); | |
3802 | operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx); | |
3803 | }) | |
9db1d521 | 3804 | |
02887425 | 3805 | (define_insn_and_split "*cmpint_sign" |
9db1d521 | 3806 | [(set (match_operand:DI 0 "register_operand" "=d") |
02887425 | 3807 | (sign_extend:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")] |
5a3fe9b6 | 3808 | UNSPEC_STRCMPCC_TO_INT))) |
ae156f85 | 3809 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 3810 | "TARGET_ZARCH" |
02887425 UW |
3811 | "#" |
3812 | "&& reload_completed" | |
3813 | [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34))) | |
3814 | (parallel | |
3815 | [(set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62))) | |
ae156f85 | 3816 | (clobber (reg:CC CC_REGNUM))])]) |
02887425 UW |
3817 | |
3818 | (define_insn_and_split "*cmpint_sign_cc" | |
ae156f85 | 3819 | [(set (reg CC_REGNUM) |
9381e3f1 | 3820 | (compare (ashiftrt:DI (ashift:DI (subreg:DI |
02887425 | 3821 | (unspec:SI [(match_operand:CCU 1 "register_operand" "0")] |
5a3fe9b6 | 3822 | UNSPEC_STRCMPCC_TO_INT) 0) |
02887425 UW |
3823 | (const_int 32)) (const_int 32)) |
3824 | (const_int 0))) | |
3825 | (set (match_operand:DI 0 "register_operand" "=d") | |
5a3fe9b6 | 3826 | (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT)))] |
9602b6a1 | 3827 | "s390_match_ccmode (insn, CCSmode) && TARGET_ZARCH" |
02887425 UW |
3828 | "#" |
3829 | "&& reload_completed" | |
3830 | [(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 34))) | |
3831 | (parallel | |
3832 | [(set (match_dup 2) (match_dup 3)) | |
3833 | (set (match_dup 0) (ashiftrt:DI (match_dup 0) (const_int 62)))])] | |
9db1d521 | 3834 | { |
02887425 UW |
3835 | rtx result = gen_rtx_ASHIFTRT (DImode, operands[0], GEN_INT (62)); |
3836 | operands[2] = SET_DEST (XVECEXP (PATTERN (curr_insn), 0, 0)); | |
3837 | operands[3] = gen_rtx_COMPARE (GET_MODE (operands[2]), result, const0_rtx); | |
3838 | }) | |
9db1d521 | 3839 | |
4023fb28 | 3840 | |
9db1d521 HP |
3841 | ;; |
3842 | ;;- Conversion instructions. | |
3843 | ;; | |
3844 | ||
6fa05db6 | 3845 | (define_insn "*sethighpartsi" |
d3632d41 | 3846 | [(set (match_operand:SI 0 "register_operand" "=d,d") |
6fa05db6 AS |
3847 | (unspec:SI [(match_operand:BLK 1 "s_operand" "Q,S") |
3848 | (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM)) | |
ae156f85 | 3849 | (clobber (reg:CC CC_REGNUM))] |
4023fb28 | 3850 | "" |
d3632d41 | 3851 | "@ |
6fa05db6 AS |
3852 | icm\t%0,%2,%S1 |
3853 | icmy\t%0,%2,%S1" | |
9381e3f1 | 3854 | [(set_attr "op_type" "RS,RSY") |
3e4be43f | 3855 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 3856 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) |
4023fb28 | 3857 | |
6fa05db6 | 3858 | (define_insn "*sethighpartdi_64" |
4023fb28 | 3859 | [(set (match_operand:DI 0 "register_operand" "=d") |
3e4be43f | 3860 | (unspec:DI [(match_operand:BLK 1 "s_operand" "S") |
6fa05db6 | 3861 | (match_operand 2 "const_int_operand" "n")] UNSPEC_ICM)) |
ae156f85 | 3862 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 3863 | "TARGET_ZARCH" |
6fa05db6 | 3864 | "icmh\t%0,%2,%S1" |
729e750f WG |
3865 | [(set_attr "op_type" "RSY") |
3866 | (set_attr "z10prop" "z10_super")]) | |
4023fb28 | 3867 | |
6fa05db6 | 3868 | (define_insn "*sethighpartdi_31" |
d3632d41 | 3869 | [(set (match_operand:DI 0 "register_operand" "=d,d") |
6fa05db6 AS |
3870 | (unspec:DI [(match_operand:BLK 1 "s_operand" "Q,S") |
3871 | (match_operand 2 "const_int_operand" "n,n")] UNSPEC_ICM)) | |
ae156f85 | 3872 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 3873 | "!TARGET_ZARCH" |
d3632d41 | 3874 | "@ |
6fa05db6 AS |
3875 | icm\t%0,%2,%S1 |
3876 | icmy\t%0,%2,%S1" | |
9381e3f1 | 3877 | [(set_attr "op_type" "RS,RSY") |
3e4be43f | 3878 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 WG |
3879 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) |
3880 | ||
1a2e356e RH |
3881 | ; |
3882 | ; extv instruction patterns | |
3883 | ; | |
3884 | ||
3885 | ; FIXME: This expander needs to be converted from DI to GPR as well | |
3886 | ; after resolving some issues with it. | |
3887 | ||
3888 | (define_expand "extzv" | |
3889 | [(parallel | |
3890 | [(set (match_operand:DI 0 "register_operand" "=d") | |
3891 | (zero_extract:DI | |
3892 | (match_operand:DI 1 "register_operand" "d") | |
3893 | (match_operand 2 "const_int_operand" "") ; size | |
3894 | (match_operand 3 "const_int_operand" ""))) ; start | |
3895 | (clobber (reg:CC CC_REGNUM))])] | |
3896 | "TARGET_Z10" | |
3897 | { | |
0f6f72e8 DV |
3898 | if (! EXTRACT_ARGS_IN_RANGE (INTVAL (operands[2]), INTVAL (operands[3]), 64)) |
3899 | FAIL; | |
1a2e356e RH |
3900 | /* Starting with zEC12 there is risbgn not clobbering CC. */ |
3901 | if (TARGET_ZEC12) | |
3902 | { | |
3903 | emit_move_insn (operands[0], | |
3904 | gen_rtx_ZERO_EXTRACT (DImode, | |
3905 | operands[1], | |
3906 | operands[2], | |
3907 | operands[3])); | |
3908 | DONE; | |
3909 | } | |
3910 | }) | |
3911 | ||
64c744b9 | 3912 | (define_insn "*extzv<mode><clobbercc_or_nocc>" |
1a2e356e RH |
3913 | [(set (match_operand:GPR 0 "register_operand" "=d") |
3914 | (zero_extract:GPR | |
3915 | (match_operand:GPR 1 "register_operand" "d") | |
3916 | (match_operand 2 "const_int_operand" "") ; size | |
64c744b9 DV |
3917 | (match_operand 3 "const_int_operand" ""))) ; start |
3918 | ] | |
0f6f72e8 DV |
3919 | "<z10_or_zEC12_cond> |
3920 | && EXTRACT_ARGS_IN_RANGE (INTVAL (operands[2]), INTVAL (operands[3]), | |
3921 | GET_MODE_BITSIZE (<MODE>mode))" | |
64c744b9 DV |
3922 | "<risbg_n>\t%0,%1,64-%2,128+63,<bitoff_plus>%3+%2" ; dst, src, start, end, shift |
3923 | [(set_attr "op_type" "RIE") | |
3924 | (set_attr "z10prop" "z10_super_E1")]) | |
1a2e356e | 3925 | |
64c744b9 DV |
3926 | ; 64 bit: (a & -16) | ((b >> 8) & 15) |
3927 | (define_insn "*extzvdi<clobbercc_or_nocc>_lshiftrt" | |
3928 | [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d") | |
3929 | (match_operand 1 "const_int_operand" "") ; size | |
3930 | (match_operand 2 "const_int_operand" "")) ; start | |
3931 | (lshiftrt:DI (match_operand:DI 3 "register_operand" "d") | |
3932 | (match_operand:DI 4 "nonzero_shift_count_operand" "")))] | |
3933 | "<z10_or_zEC12_cond> | |
0f6f72e8 | 3934 | && EXTRACT_ARGS_IN_RANGE (INTVAL (operands[1]), INTVAL (operands[2]), 64) |
64c744b9 DV |
3935 | && 64 - UINTVAL (operands[4]) >= UINTVAL (operands[1])" |
3936 | "<risbg_n>\t%0,%3,%2,%2+%1-1,128-%2-%1-%4" | |
3937 | [(set_attr "op_type" "RIE") | |
3938 | (set_attr "z10prop" "z10_super_E1")]) | |
3939 | ||
3940 | ; 32 bit: (a & -16) | ((b >> 8) & 15) | |
3941 | (define_insn "*<risbg_n>_ior_and_sr_ze" | |
3942 | [(set (match_operand:SI 0 "register_operand" "=d") | |
3943 | (ior:SI (and:SI | |
3944 | (match_operand:SI 1 "register_operand" "0") | |
3945 | (match_operand:SI 2 "const_int_operand" "")) | |
3946 | (subreg:SI | |
3947 | (zero_extract:DI | |
3948 | (match_operand:DI 3 "register_operand" "d") | |
3949 | (match_operand 4 "const_int_operand" "") ; size | |
3950 | (match_operand 5 "const_int_operand" "")) ; start | |
3951 | 4)))] | |
3952 | "<z10_or_zEC12_cond> | |
0f6f72e8 | 3953 | && EXTRACT_ARGS_IN_RANGE (INTVAL (operands[4]), INTVAL (operands[5]), 64) |
14653c37 | 3954 | && UINTVAL (operands[2]) == (HOST_WIDE_INT_M1U << UINTVAL (operands[4]))" |
64c744b9 DV |
3955 | "<risbg_n>\t%0,%3,64-%4,63,%4+%5" |
3956 | [(set_attr "op_type" "RIE") | |
3957 | (set_attr "z10prop" "z10_super_E1")]) | |
3958 | ||
3959 | ; ((int)foo >> 10) & 1; | |
3960 | (define_insn "*extract1bitdi<clobbercc_or_nocc>" | |
3961 | [(set (match_operand:DI 0 "register_operand" "=d") | |
3962 | (ne:DI (zero_extract:DI | |
3963 | (match_operand:DI 1 "register_operand" "d") | |
3964 | (const_int 1) ; size | |
3965 | (match_operand 2 "const_int_operand" "")) ; start | |
3966 | (const_int 0)))] | |
0f6f72e8 DV |
3967 | "<z10_or_zEC12_cond> |
3968 | && EXTRACT_ARGS_IN_RANGE (1, INTVAL (operands[2]), 64)" | |
64c744b9 DV |
3969 | "<risbg_n>\t%0,%1,64-1,128+63,%2+1" ; dst, src, start, end, shift |
3970 | [(set_attr "op_type" "RIE") | |
3971 | (set_attr "z10prop" "z10_super_E1")]) | |
3972 | ||
3973 | (define_insn "*<risbg_n>_and_subregdi_rotr" | |
3974 | [(set (match_operand:DI 0 "register_operand" "=d") | |
3975 | (and:DI (subreg:DI | |
3976 | (rotate:SINT (match_operand:SINT 1 "register_operand" "d") | |
3977 | (match_operand:SINT 2 "const_int_operand" "")) 0) | |
3978 | (match_operand:DI 3 "contiguous_bitmask_operand" "")))] | |
3979 | "<z10_or_zEC12_cond> | |
14653c37 JJ |
3980 | && (UINTVAL (operands[3]) |
3981 | < (HOST_WIDE_INT_1U << (UINTVAL (operands[2]) & 0x3f)))" | |
64c744b9 DV |
3982 | "<risbg_n>\t%0,%1,%s3,128+%e3,<bitoff_plus>%2" ; dst, src, start, end, shift |
3983 | [(set_attr "op_type" "RIE") | |
3984 | (set_attr "z10prop" "z10_super_E1")]) | |
3985 | ||
3986 | (define_insn "*<risbg_n>_and_subregdi_rotl" | |
3987 | [(set (match_operand:DI 0 "register_operand" "=d") | |
3988 | (and:DI (subreg:DI | |
3989 | (rotate:SINT (match_operand:SINT 1 "register_operand" "d") | |
3990 | (match_operand:SINT 2 "const_int_operand" "")) 0) | |
3991 | (match_operand:DI 3 "contiguous_bitmask_operand" "")))] | |
3992 | "<z10_or_zEC12_cond> | |
14653c37 JJ |
3993 | && !(UINTVAL (operands[3]) |
3994 | & ((HOST_WIDE_INT_1U << (UINTVAL (operands[2]) & 0x3f)) - 1))" | |
64c744b9 DV |
3995 | "<risbg_n>\t%0,%1,%s3,128+%e3,%2" ; dst, src, start, end, shift |
3996 | [(set_attr "op_type" "RIE") | |
3997 | (set_attr "z10prop" "z10_super_E1")]) | |
3998 | ||
3999 | (define_insn "*<risbg_n>_di_and_rot" | |
4000 | [(set (match_operand:DI 0 "register_operand" "=d") | |
4001 | (and:DI (rotate:DI (match_operand:DI 1 "register_operand" "d") | |
4002 | (match_operand:DI 2 "const_int_operand" "")) | |
4003 | (match_operand:DI 3 "contiguous_bitmask_operand" "")))] | |
4004 | "<z10_or_zEC12_cond>" | |
4005 | "<risbg_n>\t%0,%1,%s3,128+%e3,%2" ; dst, src, start, end, shift | |
1a2e356e RH |
4006 | [(set_attr "op_type" "RIE") |
4007 | (set_attr "z10prop" "z10_super_E1")]) | |
4023fb28 | 4008 | |
1a2e356e | 4009 | (define_insn_and_split "*pre_z10_extzv<mode>" |
6fa05db6 | 4010 | [(set (match_operand:GPR 0 "register_operand" "=d") |
3e4be43f | 4011 | (zero_extract:GPR (match_operand:QI 1 "s_operand" "S") |
1a2e356e | 4012 | (match_operand 2 "nonzero_shift_count_operand" "") |
6fa05db6 | 4013 | (const_int 0))) |
ae156f85 | 4014 | (clobber (reg:CC CC_REGNUM))] |
1a2e356e | 4015 | "!TARGET_Z10" |
cc7ab9b7 UW |
4016 | "#" |
4017 | "&& reload_completed" | |
4023fb28 | 4018 | [(parallel |
6fa05db6 | 4019 | [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM)) |
ae156f85 | 4020 | (clobber (reg:CC CC_REGNUM))]) |
6fa05db6 | 4021 | (set (match_dup 0) (lshiftrt:GPR (match_dup 0) (match_dup 2)))] |
4023fb28 | 4022 | { |
6fa05db6 AS |
4023 | int bitsize = INTVAL (operands[2]); |
4024 | int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */ | |
14653c37 JJ |
4025 | unsigned HOST_WIDE_INT mask |
4026 | = ((HOST_WIDE_INT_1U << size) - 1) << (GET_MODE_SIZE (SImode) - size); | |
6fa05db6 AS |
4027 | |
4028 | operands[1] = adjust_address (operands[1], BLKmode, 0); | |
f5541398 | 4029 | set_mem_size (operands[1], size); |
2542ef05 | 4030 | operands[2] = GEN_INT (<GPR:bitsize> - bitsize); |
6fa05db6 | 4031 | operands[3] = GEN_INT (mask); |
b628bd8e | 4032 | }) |
4023fb28 | 4033 | |
1a2e356e | 4034 | (define_insn_and_split "*pre_z10_extv<mode>" |
6fa05db6 | 4035 | [(set (match_operand:GPR 0 "register_operand" "=d") |
3e4be43f | 4036 | (sign_extract:GPR (match_operand:QI 1 "s_operand" "S") |
1a2e356e | 4037 | (match_operand 2 "nonzero_shift_count_operand" "") |
6fa05db6 | 4038 | (const_int 0))) |
ae156f85 | 4039 | (clobber (reg:CC CC_REGNUM))] |
1a2e356e | 4040 | "" |
cc7ab9b7 UW |
4041 | "#" |
4042 | "&& reload_completed" | |
4023fb28 | 4043 | [(parallel |
6fa05db6 | 4044 | [(set (match_dup 0) (unspec:GPR [(match_dup 1) (match_dup 3)] UNSPEC_ICM)) |
ae156f85 | 4045 | (clobber (reg:CC CC_REGNUM))]) |
6fa05db6 AS |
4046 | (parallel |
4047 | [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2))) | |
4048 | (clobber (reg:CC CC_REGNUM))])] | |
4049 | { | |
4050 | int bitsize = INTVAL (operands[2]); | |
4051 | int size = (bitsize - 1) / BITS_PER_UNIT + 1; /* round up */ | |
14653c37 JJ |
4052 | unsigned HOST_WIDE_INT mask |
4053 | = ((HOST_WIDE_INT_1U << size) - 1) << (GET_MODE_SIZE (SImode) - size); | |
6fa05db6 AS |
4054 | |
4055 | operands[1] = adjust_address (operands[1], BLKmode, 0); | |
f5541398 | 4056 | set_mem_size (operands[1], size); |
2542ef05 | 4057 | operands[2] = GEN_INT (<GPR:bitsize> - bitsize); |
6fa05db6 AS |
4058 | operands[3] = GEN_INT (mask); |
4059 | }) | |
4060 | ||
4061 | ; | |
4062 | ; insv instruction patterns | |
4063 | ; | |
4064 | ||
4065 | (define_expand "insv" | |
4066 | [(set (zero_extract (match_operand 0 "nonimmediate_operand" "") | |
4067 | (match_operand 1 "const_int_operand" "") | |
4068 | (match_operand 2 "const_int_operand" "")) | |
4069 | (match_operand 3 "general_operand" ""))] | |
4070 | "" | |
4023fb28 | 4071 | { |
6fa05db6 AS |
4072 | if (s390_expand_insv (operands[0], operands[1], operands[2], operands[3])) |
4073 | DONE; | |
4074 | FAIL; | |
b628bd8e | 4075 | }) |
4023fb28 | 4076 | |
2542ef05 RH |
4077 | |
4078 | ; The normal RTL expansion will never generate a zero_extract where | |
4079 | ; the location operand isn't word mode. However, we do this in the | |
4080 | ; back-end when generating atomic operations. See s390_two_part_insv. | |
64c744b9 | 4081 | (define_insn "*insv<mode><clobbercc_or_nocc>" |
22ac2c2f | 4082 | [(set (zero_extract:GPR (match_operand:GPR 0 "nonimmediate_operand" "+d") |
2542ef05 RH |
4083 | (match_operand 1 "const_int_operand" "I") ; size |
4084 | (match_operand 2 "const_int_operand" "I")) ; pos | |
22ac2c2f | 4085 | (match_operand:GPR 3 "nonimmediate_operand" "d"))] |
64c744b9 | 4086 | "<z10_or_zEC12_cond> |
0f6f72e8 DV |
4087 | && EXTRACT_ARGS_IN_RANGE (INTVAL (operands[1]), INTVAL (operands[2]), |
4088 | GET_MODE_BITSIZE (<MODE>mode)) | |
2542ef05 | 4089 | && (INTVAL (operands[1]) + INTVAL (operands[2])) <= <bitsize>" |
64c744b9 | 4090 | "<risbg_n>\t%0,%3,<bitoff_plus>%2,<bitoff_plus>%2+%1-1,<bitsize>-%2-%1" |
9381e3f1 WG |
4091 | [(set_attr "op_type" "RIE") |
4092 | (set_attr "z10prop" "z10_super_E1")]) | |
963fc8d0 | 4093 | |
22ac2c2f AK |
4094 | ; and op1 with a mask being 1 for the selected bits and 0 for the rest |
4095 | ; and op3=op0 with a mask being 0 for the selected bits and 1 for the rest | |
64c744b9 DV |
4096 | (define_insn "*insv<mode><clobbercc_or_nocc>_noshift" |
4097 | [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d") | |
4098 | (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d,0") | |
75ca1b39 | 4099 | (match_operand:GPR 2 "contiguous_bitmask_operand" "")) |
64c744b9 | 4100 | (and:GPR (match_operand:GPR 3 "nonimmediate_operand" "0,d") |
75ca1b39 | 4101 | (match_operand:GPR 4 "const_int_operand" ""))))] |
64c744b9 DV |
4102 | "<z10_or_zEC12_cond> && INTVAL (operands[2]) == ~INTVAL (operands[4])" |
4103 | "@ | |
4104 | <risbg_n>\t%0,%1,%<bfstart>2,%<bfend>2,0 | |
4105 | <risbg_n>\t%0,%3,%<bfstart>4,%<bfend>4,0" | |
4106 | [(set_attr "op_type" "RIE") | |
4107 | (set_attr "z10prop" "z10_super_E1")]) | |
22ac2c2f | 4108 | |
64c744b9 DV |
4109 | (define_insn "*insv_z10_noshift_cc" |
4110 | [(set (reg CC_REGNUM) | |
4111 | (compare | |
4112 | (ior:DI | |
4113 | (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,0") | |
4114 | (match_operand:DI 2 "contiguous_bitmask_operand" "")) | |
4115 | (and:DI (match_operand:DI 3 "nonimmediate_operand" "0,d") | |
4116 | (match_operand:DI 4 "const_int_operand" ""))) | |
4117 | (const_int 0))) | |
4118 | (set (match_operand:DI 0 "nonimmediate_operand" "=d,d") | |
4119 | (ior:DI (and:DI (match_dup 1) (match_dup 2)) | |
4120 | (and:DI (match_dup 3) (match_dup 4))))] | |
4121 | "TARGET_Z10 && s390_match_ccmode (insn, CCSmode) | |
4122 | && INTVAL (operands[2]) == ~INTVAL (operands[4])" | |
4123 | "@ | |
4124 | risbg\t%0,%1,%s2,%e2,0 | |
4125 | risbg\t%0,%3,%s4,%e4,0" | |
4126 | [(set_attr "op_type" "RIE") | |
4127 | (set_attr "z10prop" "z10_super_E1")]) | |
4128 | ||
4129 | (define_insn "*insv_z10_noshift_cconly" | |
4130 | [(set | |
4131 | (reg CC_REGNUM) | |
4132 | (compare | |
4133 | (ior:DI | |
4134 | (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,0") | |
4135 | (match_operand:DI 2 "contiguous_bitmask_operand" "")) | |
4136 | (and:DI (match_operand:DI 3 "nonimmediate_operand" "0,d") | |
4137 | (match_operand:DI 4 "const_int_operand" ""))) | |
4138 | (const_int 0))) | |
4139 | (clobber (match_scratch:DI 0 "=d,d"))] | |
4140 | "TARGET_Z10 && s390_match_ccmode (insn, CCSmode) | |
4141 | && INTVAL (operands[2]) == ~INTVAL (operands[4])" | |
4142 | "@ | |
4143 | risbg\t%0,%1,%s2,%e2,0 | |
4144 | risbg\t%0,%3,%s4,%e4,0" | |
9381e3f1 WG |
4145 | [(set_attr "op_type" "RIE") |
4146 | (set_attr "z10prop" "z10_super_E1")]) | |
963fc8d0 | 4147 | |
3d44ff99 AK |
4148 | ; Implement appending Y on the left of S bits of X |
4149 | ; x = (y << s) | (x & ((1 << s) - 1)) | |
64c744b9 | 4150 | (define_insn "*insv<mode><clobbercc_or_nocc>_appendbitsleft" |
3d44ff99 AK |
4151 | [(set (match_operand:GPR 0 "nonimmediate_operand" "=d") |
4152 | (ior:GPR (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "0") | |
4153 | (match_operand:GPR 2 "immediate_operand" "")) | |
4154 | (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "d") | |
4155 | (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))] | |
64c744b9 | 4156 | "<z10_or_zEC12_cond> |
14653c37 | 4157 | && UINTVAL (operands[2]) == (HOST_WIDE_INT_1U << UINTVAL (operands[4])) - 1" |
64c744b9 | 4158 | "<risbg_n>\t%0,%3,<bitoff>,64-%4-1,%4" |
3d44ff99 AK |
4159 | [(set_attr "op_type" "RIE") |
4160 | (set_attr "z10prop" "z10_super_E1")]) | |
4161 | ||
64c744b9 DV |
4162 | ; a = ((i32)a & -16777216) | (((ui32)b) >> 8) |
4163 | (define_insn "*<risbg_n>_<mode>_ior_and_lshiftrt" | |
4164 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
4165 | (ior:GPR (and:GPR | |
4166 | (match_operand:GPR 1 "register_operand" "0") | |
4167 | (match_operand:GPR 2 "const_int_operand" "")) | |
4168 | (lshiftrt:GPR | |
4169 | (match_operand:GPR 3 "register_operand" "d") | |
4170 | (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))] | |
4171 | "<z10_or_zEC12_cond> && UINTVAL (operands[2]) | |
14653c37 JJ |
4172 | == (HOST_WIDE_INT_M1U |
4173 | << (GET_MODE_BITSIZE (<MODE>mode) - UINTVAL (operands[4])))" | |
64c744b9 DV |
4174 | "<risbg_n>\t%0,%3,<bitoff_plus>%4,63,64-%4" |
4175 | [(set_attr "op_type" "RIE") | |
4176 | (set_attr "z10prop" "z10_super_E1")]) | |
4177 | ||
4178 | ; (ui32)(((ui64)x) >> 48) | ((i32)y & -65536); | |
4179 | (define_insn "*<risbg_n>_sidi_ior_and_lshiftrt" | |
4180 | [(set (match_operand:SI 0 "register_operand" "=d") | |
4181 | (ior:SI (and:SI | |
4182 | (match_operand:SI 1 "register_operand" "0") | |
4183 | (match_operand:SI 2 "const_int_operand" "")) | |
4184 | (subreg:SI | |
4185 | (lshiftrt:DI | |
4186 | (match_operand:DI 3 "register_operand" "d") | |
4187 | (match_operand:DI 4 "nonzero_shift_count_operand" "")) 4)))] | |
4188 | "<z10_or_zEC12_cond> | |
14653c37 | 4189 | && UINTVAL (operands[2]) == ~(HOST_WIDE_INT_M1U >> UINTVAL (operands[4]))" |
64c744b9 DV |
4190 | "<risbg_n>\t%0,%3,%4,63,64-%4" |
4191 | [(set_attr "op_type" "RIE") | |
4192 | (set_attr "z10prop" "z10_super_E1")]) | |
4193 | ||
4194 | ; (ui32)(((ui64)x) >> 12) & -4 | |
4195 | (define_insn "*trunc_sidi_and_subreg_lshrt<clobbercc_or_nocc>" | |
4196 | [(set (match_operand:SI 0 "register_operand" "=d") | |
4197 | (and:SI | |
4198 | (subreg:SI (lshiftrt:DI | |
4199 | (match_operand:DI 1 "register_operand" "d") | |
4200 | (match_operand:DI 2 "nonzero_shift_count_operand" "")) 4) | |
4201 | (match_operand:SI 3 "contiguous_bitmask_nowrap_operand" "")))] | |
4202 | "<z10_or_zEC12_cond>" | |
4203 | "<risbg_n>\t%0,%1,%t3,128+%f3,64-%2" | |
3d44ff99 AK |
4204 | [(set_attr "op_type" "RIE") |
4205 | (set_attr "z10prop" "z10_super_E1")]) | |
4206 | ||
4207 | ; z = (x << c) | (y >> d) with (x << c) and (y >> d) not overlapping after shifting | |
4208 | ; -> z = y >> d; z = (x << c) | (z & ((1 << c) - 1)) | |
4209 | ; -> z = y >> d; z = risbg; | |
4210 | ||
4211 | (define_split | |
4212 | [(set (match_operand:GPR 0 "nonimmediate_operand" "") | |
4213 | (ior:GPR (lshiftrt:GPR (match_operand:GPR 1 "nonimmediate_operand" "") | |
4214 | (match_operand:GPR 2 "nonzero_shift_count_operand" "")) | |
4215 | (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "") | |
4216 | (match_operand:GPR 4 "nonzero_shift_count_operand" ""))))] | |
4217 | "TARGET_ZEC12 && UINTVAL (operands[2]) + UINTVAL (operands[4]) >= <bitsize>" | |
1d11f7ce | 4218 | [(set (match_dup 6) |
3d44ff99 AK |
4219 | (lshiftrt:GPR (match_dup 1) (match_dup 2))) |
4220 | (set (match_dup 0) | |
1d11f7ce | 4221 | (ior:GPR (and:GPR (match_dup 6) (match_dup 5)) |
3d44ff99 AK |
4222 | (ashift:GPR (match_dup 3) (match_dup 4))))] |
4223 | { | |
14653c37 | 4224 | operands[5] = GEN_INT ((HOST_WIDE_INT_1U << UINTVAL (operands[4])) - 1); |
3168e073 | 4225 | if (reg_overlap_mentioned_p (operands[0], operands[3])) |
1d11f7ce AK |
4226 | { |
4227 | if (!can_create_pseudo_p ()) | |
4228 | FAIL; | |
4229 | operands[6] = gen_reg_rtx (<MODE>mode); | |
4230 | } | |
4231 | else | |
4232 | operands[6] = operands[0]; | |
3d44ff99 AK |
4233 | }) |
4234 | ||
4235 | (define_split | |
4236 | [(parallel | |
4237 | [(set (match_operand:GPR 0 "nonimmediate_operand" "") | |
4238 | (ior:GPR (lshiftrt:GPR (match_operand:GPR 1 "nonimmediate_operand" "") | |
4239 | (match_operand:GPR 2 "nonzero_shift_count_operand" "")) | |
4240 | (ashift:GPR (match_operand:GPR 3 "nonimmediate_operand" "") | |
4241 | (match_operand:GPR 4 "nonzero_shift_count_operand" "")))) | |
4242 | (clobber (reg:CC CC_REGNUM))])] | |
4243 | "TARGET_Z10 && !TARGET_ZEC12 && UINTVAL (operands[2]) + UINTVAL (operands[4]) >= <bitsize>" | |
1d11f7ce | 4244 | [(set (match_dup 6) |
3d44ff99 AK |
4245 | (lshiftrt:GPR (match_dup 1) (match_dup 2))) |
4246 | (parallel | |
4247 | [(set (match_dup 0) | |
1d11f7ce | 4248 | (ior:GPR (and:GPR (match_dup 6) (match_dup 5)) |
3d44ff99 AK |
4249 | (ashift:GPR (match_dup 3) (match_dup 4)))) |
4250 | (clobber (reg:CC CC_REGNUM))])] | |
4251 | { | |
14653c37 | 4252 | operands[5] = GEN_INT ((HOST_WIDE_INT_1U << UINTVAL (operands[4])) - 1); |
3168e073 | 4253 | if (reg_overlap_mentioned_p (operands[0], operands[3])) |
1d11f7ce AK |
4254 | { |
4255 | if (!can_create_pseudo_p ()) | |
4256 | FAIL; | |
4257 | operands[6] = gen_reg_rtx (<MODE>mode); | |
4258 | } | |
4259 | else | |
4260 | operands[6] = operands[0]; | |
3d44ff99 AK |
4261 | }) |
4262 | ||
50dc4eed | 4263 | ; rosbg, rxsbg |
571e408a | 4264 | (define_insn "*r<noxa>sbg_<mode>_noshift" |
963fc8d0 | 4265 | [(set (match_operand:GPR 0 "nonimmediate_operand" "=d") |
571e408a RH |
4266 | (IXOR:GPR |
4267 | (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "d") | |
4268 | (match_operand:GPR 2 "contiguous_bitmask_operand" "")) | |
4269 | (match_operand:GPR 3 "nonimmediate_operand" "0"))) | |
963fc8d0 | 4270 | (clobber (reg:CC CC_REGNUM))] |
75ca1b39 | 4271 | "TARGET_Z10" |
571e408a RH |
4272 | "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,0" |
4273 | [(set_attr "op_type" "RIE")]) | |
4274 | ||
50dc4eed | 4275 | ; rosbg, rxsbg |
571e408a RH |
4276 | (define_insn "*r<noxa>sbg_di_rotl" |
4277 | [(set (match_operand:DI 0 "nonimmediate_operand" "=d") | |
4278 | (IXOR:DI | |
4279 | (and:DI | |
4280 | (rotate:DI | |
4281 | (match_operand:DI 1 "nonimmediate_operand" "d") | |
4282 | (match_operand:DI 3 "const_int_operand" "")) | |
4283 | (match_operand:DI 2 "contiguous_bitmask_operand" "")) | |
4284 | (match_operand:DI 4 "nonimmediate_operand" "0"))) | |
4285 | (clobber (reg:CC CC_REGNUM))] | |
4286 | "TARGET_Z10" | |
8c21b0d1 | 4287 | "r<noxa>sbg\t%0,%1,%s2,%e2,%b3" |
571e408a RH |
4288 | [(set_attr "op_type" "RIE")]) |
4289 | ||
50dc4eed | 4290 | ; rosbg, rxsbg |
f3d90045 | 4291 | (define_insn "*r<noxa>sbg_<mode>_srl_bitmask" |
571e408a RH |
4292 | [(set (match_operand:GPR 0 "nonimmediate_operand" "=d") |
4293 | (IXOR:GPR | |
4294 | (and:GPR | |
4295 | (lshiftrt:GPR | |
4296 | (match_operand:GPR 1 "nonimmediate_operand" "d") | |
4297 | (match_operand:GPR 3 "nonzero_shift_count_operand" "")) | |
ab4be5d1 | 4298 | (match_operand:GPR 2 "contiguous_bitmask_nowrap_operand" "")) |
571e408a RH |
4299 | (match_operand:GPR 4 "nonimmediate_operand" "0"))) |
4300 | (clobber (reg:CC CC_REGNUM))] | |
4301 | "TARGET_Z10 | |
4302 | && s390_extzv_shift_ok (<bitsize>, 64 - INTVAL (operands[3]), | |
4303 | INTVAL (operands[2]))" | |
b9789752 | 4304 | { |
290dfd9b JJ |
4305 | operands[3] = GEN_INT (64 - INTVAL (operands[3])); |
4306 | return "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%3"; | |
b9789752 | 4307 | } |
571e408a RH |
4308 | [(set_attr "op_type" "RIE")]) |
4309 | ||
50dc4eed | 4310 | ; rosbg, rxsbg |
f3d90045 | 4311 | (define_insn "*r<noxa>sbg_<mode>_sll_bitmask" |
571e408a RH |
4312 | [(set (match_operand:GPR 0 "nonimmediate_operand" "=d") |
4313 | (IXOR:GPR | |
4314 | (and:GPR | |
4315 | (ashift:GPR | |
4316 | (match_operand:GPR 1 "nonimmediate_operand" "d") | |
4317 | (match_operand:GPR 3 "nonzero_shift_count_operand" "")) | |
ab4be5d1 | 4318 | (match_operand:GPR 2 "contiguous_bitmask_nowrap_operand" "")) |
571e408a RH |
4319 | (match_operand:GPR 4 "nonimmediate_operand" "0"))) |
4320 | (clobber (reg:CC CC_REGNUM))] | |
4321 | "TARGET_Z10 | |
4322 | && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[3]), | |
4323 | INTVAL (operands[2]))" | |
4324 | "r<noxa>sbg\t%0,%1,%<bfstart>2,%<bfend>2,%3" | |
963fc8d0 AK |
4325 | [(set_attr "op_type" "RIE")]) |
4326 | ||
f3d90045 DV |
4327 | ;; unsigned {int,long} a, b |
4328 | ;; a = a | (b << const_int) | |
4329 | ;; a = a ^ (b << const_int) | |
50dc4eed | 4330 | ; rosbg, rxsbg |
f3d90045 DV |
4331 | (define_insn "*r<noxa>sbg_<mode>_sll" |
4332 | [(set (match_operand:GPR 0 "nonimmediate_operand" "=d") | |
4333 | (IXOR:GPR | |
4334 | (ashift:GPR | |
4335 | (match_operand:GPR 1 "nonimmediate_operand" "d") | |
4336 | (match_operand:GPR 2 "nonzero_shift_count_operand" "")) | |
4337 | (match_operand:GPR 3 "nonimmediate_operand" "0"))) | |
4338 | (clobber (reg:CC CC_REGNUM))] | |
4339 | "TARGET_Z10" | |
b9789752 | 4340 | { |
290dfd9b JJ |
4341 | operands[3] = GEN_INT (63 - INTVAL (operands[2])); |
4342 | return "r<noxa>sbg\t%0,%1,<bitoff>,%3,%2"; | |
b9789752 | 4343 | } |
f3d90045 DV |
4344 | [(set_attr "op_type" "RIE")]) |
4345 | ||
4346 | ;; unsigned {int,long} a, b | |
4347 | ;; a = a | (b >> const_int) | |
4348 | ;; a = a ^ (b >> const_int) | |
50dc4eed | 4349 | ; rosbg, rxsbg |
f3d90045 DV |
4350 | (define_insn "*r<noxa>sbg_<mode>_srl" |
4351 | [(set (match_operand:GPR 0 "nonimmediate_operand" "=d") | |
4352 | (IXOR:GPR | |
4353 | (lshiftrt:GPR | |
4354 | (match_operand:GPR 1 "nonimmediate_operand" "d") | |
4355 | (match_operand:GPR 2 "nonzero_shift_count_operand" "")) | |
4356 | (match_operand:GPR 3 "nonimmediate_operand" "0"))) | |
4357 | (clobber (reg:CC CC_REGNUM))] | |
4358 | "TARGET_Z10" | |
b9789752 | 4359 | { |
290dfd9b JJ |
4360 | operands[3] = GEN_INT (64 - INTVAL (operands[2])); |
4361 | operands[2] = GEN_INT (<bitoff_plus> INTVAL (operands[2])); | |
4362 | return "r<noxa>sbg\t%0,%1,%2,63,%3"; | |
b9789752 IL |
4363 | } |
4364 | [(set_attr "op_type" "RIE")]) | |
4365 | ||
4366 | ; rosbg, rxsbg | |
4367 | (define_insn "*r<noxa>sbg_sidi_srl" | |
4368 | [(set (match_operand:SI 0 "nonimmediate_operand" "=d") | |
4369 | (IXOR:SI | |
4370 | (subreg:SI | |
4371 | (zero_extract:DI | |
4372 | (match_operand:DI 1 "nonimmediate_operand" "d") | |
4373 | (const_int 32) | |
4374 | (match_operand:DI 2 "immediate_operand" "")) | |
4375 | 4) | |
4376 | (match_operand:SI 3 "nonimmediate_operand" "0"))) | |
4377 | (clobber (reg:CC CC_REGNUM))] | |
4378 | "TARGET_Z10" | |
4379 | { | |
290dfd9b JJ |
4380 | operands[2] = GEN_INT (32 + INTVAL (operands[2])); |
4381 | return "r<noxa>sbg\t%0,%1,32,63,%2"; | |
b9789752 | 4382 | } |
f3d90045 DV |
4383 | [(set_attr "op_type" "RIE")]) |
4384 | ||
5bb33936 RH |
4385 | ;; These two are generated by combine for s.bf &= val. |
4386 | ;; ??? For bitfields smaller than 32-bits, we wind up with SImode | |
4387 | ;; shifts and ands, which results in some truly awful patterns | |
4388 | ;; including subregs of operations. Rather unnecessisarily, IMO. | |
4389 | ;; Instead of | |
4390 | ;; | |
4391 | ;; (set (zero_extract:DI (reg/v:DI 50 [ s ]) | |
4392 | ;; (const_int 24 [0x18]) | |
4393 | ;; (const_int 0 [0])) | |
4394 | ;; (subreg:DI (and:SI (subreg:SI (lshiftrt:DI (reg/v:DI 50 [ s ]) | |
4395 | ;; (const_int 40 [0x28])) 4) | |
4396 | ;; (reg:SI 4 %r4 [ y+4 ])) 0)) | |
4397 | ;; | |
4398 | ;; we should instead generate | |
4399 | ;; | |
4400 | ;; (set (zero_extract:DI (reg/v:DI 50 [ s ]) | |
4401 | ;; (const_int 24 [0x18]) | |
4402 | ;; (const_int 0 [0])) | |
4403 | ;; (and:DI (lshiftrt:DI (reg/v:DI 50 [ s ]) | |
4404 | ;; (const_int 40 [0x28])) | |
4405 | ;; (subreg:DI (reg:SI 4 %r4 [ y+4 ]) 0))) | |
4406 | ;; | |
4407 | ;; by noticing that we can push down the outer paradoxical subreg | |
4408 | ;; into the operation. | |
4409 | ||
4410 | (define_insn "*insv_rnsbg_noshift" | |
4411 | [(set (zero_extract:DI | |
4412 | (match_operand:DI 0 "nonimmediate_operand" "+d") | |
4413 | (match_operand 1 "const_int_operand" "") | |
4414 | (match_operand 2 "const_int_operand" "")) | |
4415 | (and:DI | |
4416 | (match_dup 0) | |
4417 | (match_operand:DI 3 "nonimmediate_operand" "d"))) | |
4418 | (clobber (reg:CC CC_REGNUM))] | |
4419 | "TARGET_Z10 | |
0f6f72e8 | 4420 | && EXTRACT_ARGS_IN_RANGE (INTVAL (operands[1]), INTVAL (operands[2]), 64) |
5bb33936 RH |
4421 | && INTVAL (operands[1]) + INTVAL (operands[2]) == 64" |
4422 | "rnsbg\t%0,%3,%2,63,0" | |
4423 | [(set_attr "op_type" "RIE")]) | |
4424 | ||
4425 | (define_insn "*insv_rnsbg_srl" | |
4426 | [(set (zero_extract:DI | |
4427 | (match_operand:DI 0 "nonimmediate_operand" "+d") | |
4428 | (match_operand 1 "const_int_operand" "") | |
4429 | (match_operand 2 "const_int_operand" "")) | |
4430 | (and:DI | |
4431 | (lshiftrt:DI | |
4432 | (match_dup 0) | |
4433 | (match_operand 3 "const_int_operand" "")) | |
4434 | (match_operand:DI 4 "nonimmediate_operand" "d"))) | |
4435 | (clobber (reg:CC CC_REGNUM))] | |
4436 | "TARGET_Z10 | |
0f6f72e8 | 4437 | && EXTRACT_ARGS_IN_RANGE (INTVAL (operands[1]), INTVAL (operands[2]), 64) |
5bb33936 RH |
4438 | && INTVAL (operands[3]) == 64 - INTVAL (operands[1]) - INTVAL (operands[2])" |
4439 | "rnsbg\t%0,%4,%2,%2+%1-1,%3" | |
4440 | [(set_attr "op_type" "RIE")]) | |
4441 | ||
6fa05db6 | 4442 | (define_insn "*insv<mode>_mem_reg" |
9602b6a1 | 4443 | [(set (zero_extract:W (match_operand:QI 0 "memory_operand" "+Q,S") |
6fa05db6 AS |
4444 | (match_operand 1 "const_int_operand" "n,n") |
4445 | (const_int 0)) | |
9602b6a1 | 4446 | (match_operand:W 2 "register_operand" "d,d"))] |
0f6f72e8 DV |
4447 | "EXTRACT_ARGS_IN_RANGE (INTVAL (operands[1]), 0, 64) |
4448 | && INTVAL (operands[1]) > 0 | |
6fa05db6 AS |
4449 | && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode) |
4450 | && INTVAL (operands[1]) % BITS_PER_UNIT == 0" | |
4451 | { | |
4452 | int size = INTVAL (operands[1]) / BITS_PER_UNIT; | |
4453 | ||
14653c37 | 4454 | operands[1] = GEN_INT ((HOST_WIDE_INT_1U << size) - 1); |
9381e3f1 | 4455 | return (which_alternative == 0) ? "stcm\t%2,%1,%S0" |
6fa05db6 AS |
4456 | : "stcmy\t%2,%1,%S0"; |
4457 | } | |
9381e3f1 | 4458 | [(set_attr "op_type" "RS,RSY") |
3e4be43f | 4459 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 4460 | (set_attr "z10prop" "z10_super,z10_super")]) |
6fa05db6 AS |
4461 | |
4462 | (define_insn "*insvdi_mem_reghigh" | |
3e4be43f | 4463 | [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "+S") |
6fa05db6 AS |
4464 | (match_operand 1 "const_int_operand" "n") |
4465 | (const_int 0)) | |
4466 | (lshiftrt:DI (match_operand:DI 2 "register_operand" "d") | |
4467 | (const_int 32)))] | |
9602b6a1 | 4468 | "TARGET_ZARCH |
0f6f72e8 | 4469 | && EXTRACT_ARGS_IN_RANGE (INTVAL (operands[1]), 0, 64) |
6fa05db6 AS |
4470 | && INTVAL (operands[1]) > 0 |
4471 | && INTVAL (operands[1]) <= GET_MODE_BITSIZE (SImode) | |
4472 | && INTVAL (operands[1]) % BITS_PER_UNIT == 0" | |
4473 | { | |
4474 | int size = INTVAL (operands[1]) / BITS_PER_UNIT; | |
4475 | ||
14653c37 | 4476 | operands[1] = GEN_INT ((HOST_WIDE_INT_1U << size) - 1); |
6fa05db6 AS |
4477 | return "stcmh\t%2,%1,%S0"; |
4478 | } | |
9381e3f1 WG |
4479 | [(set_attr "op_type" "RSY") |
4480 | (set_attr "z10prop" "z10_super")]) | |
6fa05db6 | 4481 | |
9602b6a1 AK |
4482 | (define_insn "*insvdi_reg_imm" |
4483 | [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d") | |
4484 | (const_int 16) | |
4485 | (match_operand 1 "const_int_operand" "n")) | |
4486 | (match_operand:DI 2 "const_int_operand" "n"))] | |
6fa05db6 | 4487 | "TARGET_ZARCH |
0f6f72e8 | 4488 | && EXTRACT_ARGS_IN_RANGE (16, INTVAL (operands[1]), 64) |
6fa05db6 AS |
4489 | && INTVAL (operands[1]) >= 0 |
4490 | && INTVAL (operands[1]) < BITS_PER_WORD | |
4491 | && INTVAL (operands[1]) % 16 == 0" | |
4492 | { | |
4493 | switch (BITS_PER_WORD - INTVAL (operands[1])) | |
4494 | { | |
4495 | case 64: return "iihh\t%0,%x2"; break; | |
4496 | case 48: return "iihl\t%0,%x2"; break; | |
4497 | case 32: return "iilh\t%0,%x2"; break; | |
4498 | case 16: return "iill\t%0,%x2"; break; | |
4499 | default: gcc_unreachable(); | |
4500 | } | |
4501 | } | |
9381e3f1 WG |
4502 | [(set_attr "op_type" "RI") |
4503 | (set_attr "z10prop" "z10_super_E1")]) | |
4504 | ||
9fec758d WG |
4505 | ; Update the left-most 32 bit of a DI. |
4506 | (define_insn "*insv_h_di_reg_extimm" | |
4507 | [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d") | |
4508 | (const_int 32) | |
4509 | (const_int 0)) | |
4510 | (match_operand:DI 1 "const_int_operand" "n"))] | |
4511 | "TARGET_EXTIMM" | |
4512 | "iihf\t%0,%o1" | |
4513 | [(set_attr "op_type" "RIL") | |
4514 | (set_attr "z10prop" "z10_fwd_E1")]) | |
6fa05db6 | 4515 | |
d378b983 RH |
4516 | ; Update the right-most 32 bit of a DI. |
4517 | (define_insn "*insv_l_di_reg_extimm" | |
4518 | [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "+d") | |
4519 | (const_int 32) | |
4520 | (const_int 32)) | |
4521 | (match_operand:DI 1 "const_int_operand" "n"))] | |
4522 | "TARGET_EXTIMM" | |
4523 | "iilf\t%0,%o1" | |
9381e3f1 | 4524 | [(set_attr "op_type" "RIL") |
9fec758d | 4525 | (set_attr "z10prop" "z10_fwd_A1")]) |
6fa05db6 | 4526 | |
9db1d521 HP |
4527 | ; |
4528 | ; extendsidi2 instruction pattern(s). | |
4529 | ; | |
4530 | ||
4023fb28 UW |
4531 | (define_expand "extendsidi2" |
4532 | [(set (match_operand:DI 0 "register_operand" "") | |
4533 | (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))] | |
4534 | "" | |
4023fb28 | 4535 | { |
9602b6a1 | 4536 | if (!TARGET_ZARCH) |
4023fb28 | 4537 | { |
c41c1387 | 4538 | emit_clobber (operands[0]); |
9f37ccb1 UW |
4539 | emit_move_insn (gen_highpart (SImode, operands[0]), operands[1]); |
4540 | emit_move_insn (gen_lowpart (SImode, operands[0]), const0_rtx); | |
4541 | emit_insn (gen_ashrdi3 (operands[0], operands[0], GEN_INT (32))); | |
4023fb28 UW |
4542 | DONE; |
4543 | } | |
ec24698e | 4544 | }) |
4023fb28 UW |
4545 | |
4546 | (define_insn "*extendsidi2" | |
963fc8d0 | 4547 | [(set (match_operand:DI 0 "register_operand" "=d,d,d") |
3e4be43f | 4548 | (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,T,b")))] |
9602b6a1 | 4549 | "TARGET_ZARCH" |
9db1d521 | 4550 | "@ |
d40c829f | 4551 | lgfr\t%0,%1 |
963fc8d0 AK |
4552 | lgf\t%0,%1 |
4553 | lgfrl\t%0,%1" | |
4554 | [(set_attr "op_type" "RRE,RXY,RIL") | |
4555 | (set_attr "type" "*,*,larl") | |
9381e3f1 | 4556 | (set_attr "cpu_facility" "*,*,z10") |
14cfceb7 IL |
4557 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1") |
4558 | (set_attr "relative_long" "*,*,yes")]) | |
9db1d521 | 4559 | |
9db1d521 | 4560 | ; |
56477c21 | 4561 | ; extend(hi|qi)(si|di)2 instruction pattern(s). |
9db1d521 HP |
4562 | ; |
4563 | ||
56477c21 AS |
4564 | (define_expand "extend<HQI:mode><DSI:mode>2" |
4565 | [(set (match_operand:DSI 0 "register_operand" "") | |
4566 | (sign_extend:DSI (match_operand:HQI 1 "nonimmediate_operand" "")))] | |
4023fb28 | 4567 | "" |
4023fb28 | 4568 | { |
9602b6a1 | 4569 | if (<DSI:MODE>mode == DImode && !TARGET_ZARCH) |
4023fb28 UW |
4570 | { |
4571 | rtx tmp = gen_reg_rtx (SImode); | |
56477c21 | 4572 | emit_insn (gen_extend<HQI:mode>si2 (tmp, operands[1])); |
4023fb28 UW |
4573 | emit_insn (gen_extendsidi2 (operands[0], tmp)); |
4574 | DONE; | |
4575 | } | |
ec24698e | 4576 | else if (!TARGET_EXTIMM) |
4023fb28 | 4577 | { |
2542ef05 | 4578 | rtx bitcount = GEN_INT (<DSI:bitsize> - <HQI:bitsize>); |
56477c21 AS |
4579 | |
4580 | operands[1] = gen_lowpart (<DSI:MODE>mode, operands[1]); | |
4581 | emit_insn (gen_ashl<DSI:mode>3 (operands[0], operands[1], bitcount)); | |
4582 | emit_insn (gen_ashr<DSI:mode>3 (operands[0], operands[0], bitcount)); | |
4023fb28 UW |
4583 | DONE; |
4584 | } | |
ec24698e UW |
4585 | }) |
4586 | ||
56477c21 AS |
4587 | ; |
4588 | ; extendhidi2 instruction pattern(s). | |
4589 | ; | |
4590 | ||
ec24698e | 4591 | (define_insn "*extendhidi2_extimm" |
963fc8d0 | 4592 | [(set (match_operand:DI 0 "register_operand" "=d,d,d") |
3e4be43f | 4593 | (sign_extend:DI (match_operand:HI 1 "general_operand" "d,T,b")))] |
9602b6a1 | 4594 | "TARGET_ZARCH && TARGET_EXTIMM" |
ec24698e UW |
4595 | "@ |
4596 | lghr\t%0,%1 | |
963fc8d0 AK |
4597 | lgh\t%0,%1 |
4598 | lghrl\t%0,%1" | |
4599 | [(set_attr "op_type" "RRE,RXY,RIL") | |
4600 | (set_attr "type" "*,*,larl") | |
9381e3f1 | 4601 | (set_attr "cpu_facility" "extimm,extimm,z10") |
14cfceb7 IL |
4602 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1") |
4603 | (set_attr "relative_long" "*,*,yes")]) | |
4023fb28 UW |
4604 | |
4605 | (define_insn "*extendhidi2" | |
9db1d521 | 4606 | [(set (match_operand:DI 0 "register_operand" "=d") |
3e4be43f | 4607 | (sign_extend:DI (match_operand:HI 1 "memory_operand" "T")))] |
9602b6a1 | 4608 | "TARGET_ZARCH" |
d40c829f | 4609 | "lgh\t%0,%1" |
9381e3f1 WG |
4610 | [(set_attr "op_type" "RXY") |
4611 | (set_attr "z10prop" "z10_super_E1")]) | |
9db1d521 | 4612 | |
9db1d521 | 4613 | ; |
56477c21 | 4614 | ; extendhisi2 instruction pattern(s). |
9db1d521 HP |
4615 | ; |
4616 | ||
ec24698e | 4617 | (define_insn "*extendhisi2_extimm" |
963fc8d0 AK |
4618 | [(set (match_operand:SI 0 "register_operand" "=d,d,d,d") |
4619 | (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" " d,R,T,b")))] | |
ec24698e UW |
4620 | "TARGET_EXTIMM" |
4621 | "@ | |
4622 | lhr\t%0,%1 | |
4623 | lh\t%0,%1 | |
963fc8d0 AK |
4624 | lhy\t%0,%1 |
4625 | lhrl\t%0,%1" | |
4626 | [(set_attr "op_type" "RRE,RX,RXY,RIL") | |
4627 | (set_attr "type" "*,*,*,larl") | |
9381e3f1 | 4628 | (set_attr "cpu_facility" "extimm,extimm,extimm,z10") |
14cfceb7 IL |
4629 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1") |
4630 | (set_attr "relative_long" "*,*,*,yes")]) | |
9db1d521 | 4631 | |
4023fb28 | 4632 | (define_insn "*extendhisi2" |
d3632d41 UW |
4633 | [(set (match_operand:SI 0 "register_operand" "=d,d") |
4634 | (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T")))] | |
ec24698e | 4635 | "!TARGET_EXTIMM" |
d3632d41 | 4636 | "@ |
d40c829f UW |
4637 | lh\t%0,%1 |
4638 | lhy\t%0,%1" | |
9381e3f1 | 4639 | [(set_attr "op_type" "RX,RXY") |
3e4be43f | 4640 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 4641 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) |
9db1d521 | 4642 | |
56477c21 AS |
4643 | ; |
4644 | ; extendqi(si|di)2 instruction pattern(s). | |
4645 | ; | |
4646 | ||
43a09b63 | 4647 | ; lbr, lgbr, lb, lgb |
56477c21 AS |
4648 | (define_insn "*extendqi<mode>2_extimm" |
4649 | [(set (match_operand:GPR 0 "register_operand" "=d,d") | |
3e4be43f | 4650 | (sign_extend:GPR (match_operand:QI 1 "nonimmediate_operand" "d,T")))] |
ec24698e UW |
4651 | "TARGET_EXTIMM" |
4652 | "@ | |
56477c21 AS |
4653 | l<g>br\t%0,%1 |
4654 | l<g>b\t%0,%1" | |
9381e3f1 WG |
4655 | [(set_attr "op_type" "RRE,RXY") |
4656 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) | |
ec24698e | 4657 | |
43a09b63 | 4658 | ; lb, lgb |
56477c21 AS |
4659 | (define_insn "*extendqi<mode>2" |
4660 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
3e4be43f | 4661 | (sign_extend:GPR (match_operand:QI 1 "memory_operand" "T")))] |
56477c21 AS |
4662 | "!TARGET_EXTIMM && TARGET_LONG_DISPLACEMENT" |
4663 | "l<g>b\t%0,%1" | |
9381e3f1 WG |
4664 | [(set_attr "op_type" "RXY") |
4665 | (set_attr "z10prop" "z10_super_E1")]) | |
d3632d41 | 4666 | |
56477c21 AS |
4667 | (define_insn_and_split "*extendqi<mode>2_short_displ" |
4668 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
4669 | (sign_extend:GPR (match_operand:QI 1 "s_operand" "Q"))) | |
ae156f85 | 4670 | (clobber (reg:CC CC_REGNUM))] |
56477c21 | 4671 | "!TARGET_EXTIMM && !TARGET_LONG_DISPLACEMENT" |
19796784 AK |
4672 | "#" |
4673 | "&& reload_completed" | |
4023fb28 | 4674 | [(parallel |
56477c21 | 4675 | [(set (match_dup 0) (unspec:GPR [(match_dup 1) (const_int 8)] UNSPEC_ICM)) |
ae156f85 | 4676 | (clobber (reg:CC CC_REGNUM))]) |
4023fb28 | 4677 | (parallel |
56477c21 | 4678 | [(set (match_dup 0) (ashiftrt:GPR (match_dup 0) (match_dup 2))) |
ae156f85 | 4679 | (clobber (reg:CC CC_REGNUM))])] |
6fa05db6 AS |
4680 | { |
4681 | operands[1] = adjust_address (operands[1], BLKmode, 0); | |
f5541398 | 4682 | set_mem_size (operands[1], GET_MODE_SIZE (QImode)); |
2542ef05 | 4683 | operands[2] = GEN_INT (<GPR:bitsize> - BITS_PER_UNIT); |
6fa05db6 | 4684 | }) |
9db1d521 | 4685 | |
9db1d521 HP |
4686 | ; |
4687 | ; zero_extendsidi2 instruction pattern(s). | |
4688 | ; | |
4689 | ||
4023fb28 UW |
4690 | (define_expand "zero_extendsidi2" |
4691 | [(set (match_operand:DI 0 "register_operand" "") | |
4692 | (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))] | |
4693 | "" | |
4023fb28 | 4694 | { |
9602b6a1 | 4695 | if (!TARGET_ZARCH) |
4023fb28 | 4696 | { |
c41c1387 | 4697 | emit_clobber (operands[0]); |
9f37ccb1 UW |
4698 | emit_move_insn (gen_lowpart (SImode, operands[0]), operands[1]); |
4699 | emit_move_insn (gen_highpart (SImode, operands[0]), const0_rtx); | |
4023fb28 UW |
4700 | DONE; |
4701 | } | |
ec24698e | 4702 | }) |
4023fb28 UW |
4703 | |
4704 | (define_insn "*zero_extendsidi2" | |
963fc8d0 | 4705 | [(set (match_operand:DI 0 "register_operand" "=d,d,d") |
3e4be43f | 4706 | (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,T,b")))] |
9602b6a1 | 4707 | "TARGET_ZARCH" |
9db1d521 | 4708 | "@ |
d40c829f | 4709 | llgfr\t%0,%1 |
963fc8d0 AK |
4710 | llgf\t%0,%1 |
4711 | llgfrl\t%0,%1" | |
4712 | [(set_attr "op_type" "RRE,RXY,RIL") | |
4713 | (set_attr "type" "*,*,larl") | |
9381e3f1 | 4714 | (set_attr "cpu_facility" "*,*,z10") |
14cfceb7 IL |
4715 | (set_attr "z10prop" "z10_fwd_E1,z10_fwd_A3,z10_fwd_A3") |
4716 | (set_attr "relative_long" "*,*,yes")]) | |
9db1d521 | 4717 | |
288e517f AK |
4718 | ; |
4719 | ; LLGT-type instructions (zero-extend from 31 bit to 64 bit). | |
4720 | ; | |
4721 | ||
d6083c7d UW |
4722 | (define_insn "*llgt_sidi" |
4723 | [(set (match_operand:DI 0 "register_operand" "=d") | |
3e4be43f | 4724 | (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "T") 0) |
d6083c7d | 4725 | (const_int 2147483647)))] |
9602b6a1 | 4726 | "TARGET_ZARCH" |
d6083c7d | 4727 | "llgt\t%0,%1" |
9381e3f1 WG |
4728 | [(set_attr "op_type" "RXE") |
4729 | (set_attr "z10prop" "z10_super_E1")]) | |
d6083c7d UW |
4730 | |
4731 | (define_insn_and_split "*llgt_sidi_split" | |
4732 | [(set (match_operand:DI 0 "register_operand" "=d") | |
3e4be43f | 4733 | (and:DI (subreg:DI (match_operand:SI 1 "memory_operand" "T") 0) |
d6083c7d | 4734 | (const_int 2147483647))) |
ae156f85 | 4735 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 4736 | "TARGET_ZARCH" |
d6083c7d UW |
4737 | "#" |
4738 | "&& reload_completed" | |
4739 | [(set (match_dup 0) | |
4740 | (and:DI (subreg:DI (match_dup 1) 0) | |
4741 | (const_int 2147483647)))] | |
4742 | "") | |
4743 | ||
288e517f AK |
4744 | (define_insn "*llgt_sisi" |
4745 | [(set (match_operand:SI 0 "register_operand" "=d,d") | |
3e4be43f | 4746 | (and:SI (match_operand:SI 1 "nonimmediate_operand" "d,T") |
288e517f | 4747 | (const_int 2147483647)))] |
c4d50129 | 4748 | "TARGET_ZARCH" |
288e517f AK |
4749 | "@ |
4750 | llgtr\t%0,%1 | |
4751 | llgt\t%0,%1" | |
9381e3f1 WG |
4752 | [(set_attr "op_type" "RRE,RXE") |
4753 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) | |
288e517f | 4754 | |
288e517f AK |
4755 | (define_insn "*llgt_didi" |
4756 | [(set (match_operand:DI 0 "register_operand" "=d,d") | |
4757 | (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,o") | |
4758 | (const_int 2147483647)))] | |
9602b6a1 | 4759 | "TARGET_ZARCH" |
288e517f AK |
4760 | "@ |
4761 | llgtr\t%0,%1 | |
4762 | llgt\t%0,%N1" | |
9381e3f1 WG |
4763 | [(set_attr "op_type" "RRE,RXE") |
4764 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) | |
288e517f | 4765 | |
f19a9af7 | 4766 | (define_split |
9602b6a1 AK |
4767 | [(set (match_operand:DSI 0 "register_operand" "") |
4768 | (and:DSI (match_operand:DSI 1 "nonimmediate_operand" "") | |
f6ee577c | 4769 | (const_int 2147483647))) |
ae156f85 | 4770 | (clobber (reg:CC CC_REGNUM))] |
c4d50129 | 4771 | "TARGET_ZARCH && reload_completed" |
288e517f | 4772 | [(set (match_dup 0) |
9602b6a1 | 4773 | (and:DSI (match_dup 1) |
f6ee577c | 4774 | (const_int 2147483647)))] |
288e517f AK |
4775 | "") |
4776 | ||
9db1d521 | 4777 | ; |
56477c21 | 4778 | ; zero_extend(hi|qi)(si|di)2 instruction pattern(s). |
9db1d521 HP |
4779 | ; |
4780 | ||
56477c21 AS |
4781 | (define_expand "zero_extend<mode>di2" |
4782 | [(set (match_operand:DI 0 "register_operand" "") | |
4783 | (zero_extend:DI (match_operand:HQI 1 "nonimmediate_operand" "")))] | |
4784 | "" | |
4785 | { | |
9602b6a1 | 4786 | if (!TARGET_ZARCH) |
56477c21 AS |
4787 | { |
4788 | rtx tmp = gen_reg_rtx (SImode); | |
4789 | emit_insn (gen_zero_extend<mode>si2 (tmp, operands[1])); | |
4790 | emit_insn (gen_zero_extendsidi2 (operands[0], tmp)); | |
4791 | DONE; | |
4792 | } | |
4793 | else if (!TARGET_EXTIMM) | |
4794 | { | |
2542ef05 | 4795 | rtx bitcount = GEN_INT (64 - <HQI:bitsize>); |
56477c21 AS |
4796 | operands[1] = gen_lowpart (DImode, operands[1]); |
4797 | emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount)); | |
4798 | emit_insn (gen_lshrdi3 (operands[0], operands[0], bitcount)); | |
4799 | DONE; | |
4800 | } | |
4801 | }) | |
4802 | ||
f6ee577c | 4803 | (define_expand "zero_extend<mode>si2" |
4023fb28 | 4804 | [(set (match_operand:SI 0 "register_operand" "") |
ec24698e | 4805 | (zero_extend:SI (match_operand:HQI 1 "nonimmediate_operand" "")))] |
9db1d521 | 4806 | "" |
4023fb28 | 4807 | { |
ec24698e UW |
4808 | if (!TARGET_EXTIMM) |
4809 | { | |
4810 | operands[1] = gen_lowpart (SImode, operands[1]); | |
9381e3f1 | 4811 | emit_insn (gen_andsi3 (operands[0], operands[1], |
2542ef05 | 4812 | GEN_INT ((1 << <HQI:bitsize>) - 1))); |
ec24698e | 4813 | DONE; |
56477c21 | 4814 | } |
ec24698e UW |
4815 | }) |
4816 | ||
963fc8d0 AK |
4817 | ; llhrl, llghrl |
4818 | (define_insn "*zero_extendhi<mode>2_z10" | |
4819 | [(set (match_operand:GPR 0 "register_operand" "=d,d,d") | |
3e4be43f | 4820 | (zero_extend:GPR (match_operand:HI 1 "nonimmediate_operand" "d,T,b")))] |
963fc8d0 AK |
4821 | "TARGET_Z10" |
4822 | "@ | |
4823 | ll<g>hr\t%0,%1 | |
4824 | ll<g>h\t%0,%1 | |
4825 | ll<g>hrl\t%0,%1" | |
4826 | [(set_attr "op_type" "RXY,RRE,RIL") | |
4827 | (set_attr "type" "*,*,larl") | |
9381e3f1 | 4828 | (set_attr "cpu_facility" "*,*,z10") |
14cfceb7 IL |
4829 | (set_attr "z10prop" "z10_super_E1,z10_fwd_A3,z10_fwd_A3") |
4830 | (set_attr "relative_long" "*,*,yes")]) | |
963fc8d0 | 4831 | |
43a09b63 | 4832 | ; llhr, llcr, llghr, llgcr, llh, llc, llgh, llgc |
56477c21 AS |
4833 | (define_insn "*zero_extend<HQI:mode><GPR:mode>2_extimm" |
4834 | [(set (match_operand:GPR 0 "register_operand" "=d,d") | |
3e4be43f | 4835 | (zero_extend:GPR (match_operand:HQI 1 "nonimmediate_operand" "d,T")))] |
ec24698e UW |
4836 | "TARGET_EXTIMM" |
4837 | "@ | |
56477c21 AS |
4838 | ll<g><hc>r\t%0,%1 |
4839 | ll<g><hc>\t%0,%1" | |
9381e3f1 WG |
4840 | [(set_attr "op_type" "RRE,RXY") |
4841 | (set_attr "z10prop" "z10_super_E1,z10_fwd_A3")]) | |
9db1d521 | 4842 | |
43a09b63 | 4843 | ; llgh, llgc |
56477c21 AS |
4844 | (define_insn "*zero_extend<HQI:mode><GPR:mode>2" |
4845 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
3e4be43f | 4846 | (zero_extend:GPR (match_operand:HQI 1 "memory_operand" "T")))] |
ec24698e | 4847 | "TARGET_ZARCH && !TARGET_EXTIMM" |
f6ee577c | 4848 | "llg<hc>\t%0,%1" |
9381e3f1 WG |
4849 | [(set_attr "op_type" "RXY") |
4850 | (set_attr "z10prop" "z10_fwd_A3")]) | |
cc7ab9b7 UW |
4851 | |
4852 | (define_insn_and_split "*zero_extendhisi2_31" | |
4853 | [(set (match_operand:SI 0 "register_operand" "=&d") | |
3e4be43f | 4854 | (zero_extend:SI (match_operand:HI 1 "s_operand" "S"))) |
ae156f85 | 4855 | (clobber (reg:CC CC_REGNUM))] |
f4f41b4e | 4856 | "!TARGET_ZARCH" |
cc7ab9b7 UW |
4857 | "#" |
4858 | "&& reload_completed" | |
4859 | [(set (match_dup 0) (const_int 0)) | |
4860 | (parallel | |
4861 | [(set (strict_low_part (match_dup 2)) (match_dup 1)) | |
ae156f85 | 4862 | (clobber (reg:CC CC_REGNUM))])] |
b628bd8e | 4863 | "operands[2] = gen_lowpart (HImode, operands[0]);") |
c7453384 | 4864 | |
cc7ab9b7 UW |
4865 | (define_insn_and_split "*zero_extendqisi2_31" |
4866 | [(set (match_operand:SI 0 "register_operand" "=&d") | |
3e4be43f | 4867 | (zero_extend:SI (match_operand:QI 1 "memory_operand" "T")))] |
9e8327e3 | 4868 | "!TARGET_ZARCH" |
cc7ab9b7 UW |
4869 | "#" |
4870 | "&& reload_completed" | |
4871 | [(set (match_dup 0) (const_int 0)) | |
4872 | (set (strict_low_part (match_dup 2)) (match_dup 1))] | |
b628bd8e | 4873 | "operands[2] = gen_lowpart (QImode, operands[0]);") |
c7453384 | 4874 | |
9db1d521 HP |
4875 | ; |
4876 | ; zero_extendqihi2 instruction pattern(s). | |
4877 | ; | |
4878 | ||
9db1d521 HP |
4879 | (define_expand "zero_extendqihi2" |
4880 | [(set (match_operand:HI 0 "register_operand" "") | |
4023fb28 | 4881 | (zero_extend:HI (match_operand:QI 1 "register_operand" "")))] |
ec24698e | 4882 | "TARGET_ZARCH && !TARGET_EXTIMM" |
9db1d521 | 4883 | { |
4023fb28 UW |
4884 | operands[1] = gen_lowpart (HImode, operands[1]); |
4885 | emit_insn (gen_andhi3 (operands[0], operands[1], GEN_INT (0xff))); | |
4886 | DONE; | |
ec24698e | 4887 | }) |
9db1d521 | 4888 | |
4023fb28 | 4889 | (define_insn "*zero_extendqihi2_64" |
9db1d521 | 4890 | [(set (match_operand:HI 0 "register_operand" "=d") |
3e4be43f | 4891 | (zero_extend:HI (match_operand:QI 1 "memory_operand" "T")))] |
ec24698e | 4892 | "TARGET_ZARCH && !TARGET_EXTIMM" |
d40c829f | 4893 | "llgc\t%0,%1" |
9381e3f1 WG |
4894 | [(set_attr "op_type" "RXY") |
4895 | (set_attr "z10prop" "z10_fwd_A3")]) | |
9db1d521 | 4896 | |
cc7ab9b7 UW |
4897 | (define_insn_and_split "*zero_extendqihi2_31" |
4898 | [(set (match_operand:HI 0 "register_operand" "=&d") | |
3e4be43f | 4899 | (zero_extend:HI (match_operand:QI 1 "memory_operand" "T")))] |
9e8327e3 | 4900 | "!TARGET_ZARCH" |
cc7ab9b7 UW |
4901 | "#" |
4902 | "&& reload_completed" | |
4903 | [(set (match_dup 0) (const_int 0)) | |
4904 | (set (strict_low_part (match_dup 2)) (match_dup 1))] | |
b628bd8e | 4905 | "operands[2] = gen_lowpart (QImode, operands[0]);") |
cc7ab9b7 | 4906 | |
609e7e80 | 4907 | ; |
9751ad6e | 4908 | ; fixuns_trunc(dd|td|sf|df|tf)(si|di)2 expander |
609e7e80 AK |
4909 | ; |
4910 | ||
9751ad6e AK |
4911 | ; This is the only entry point for fixuns_trunc. It multiplexes the |
4912 | ; expansion to either the *_emu expanders below for pre z196 machines | |
4913 | ; or emits the default pattern otherwise. | |
4914 | (define_expand "fixuns_trunc<FP:mode><GPR:mode>2" | |
609e7e80 | 4915 | [(parallel |
9751ad6e AK |
4916 | [(set (match_operand:GPR 0 "register_operand" "") |
4917 | (unsigned_fix:GPR (match_operand:FP 1 "register_operand" ""))) | |
4918 | (unspec:GPR [(match_dup 2)] UNSPEC_ROUND) | |
65b1d8ea | 4919 | (clobber (reg:CC CC_REGNUM))])] |
9751ad6e | 4920 | "TARGET_HARD_FLOAT" |
609e7e80 | 4921 | { |
65b1d8ea AK |
4922 | if (!TARGET_Z196) |
4923 | { | |
9751ad6e AK |
4924 | /* We don't provide emulation for TD|DD->SI. */ |
4925 | if (GET_MODE_CLASS (<FP:MODE>mode) == MODE_DECIMAL_FLOAT | |
4926 | && <GPR:MODE>mode == SImode) | |
4927 | FAIL; | |
4928 | emit_insn (gen_fixuns_trunc<FP:mode><GPR:mode>2_emu (operands[0], | |
4929 | operands[1])); | |
65b1d8ea AK |
4930 | DONE; |
4931 | } | |
9751ad6e AK |
4932 | |
4933 | if (GET_MODE_CLASS (<FP:MODE>mode) == MODE_DECIMAL_FLOAT) | |
4934 | operands[2] = GEN_INT (DFP_RND_TOWARD_0); | |
4935 | else | |
4936 | operands[2] = GEN_INT (BFP_RND_TOWARD_0); | |
609e7e80 AK |
4937 | }) |
4938 | ||
9751ad6e AK |
4939 | ; (sf|df|tf)->unsigned (si|di) |
4940 | ||
4941 | ; Emulate the unsigned conversion with the signed version for pre z196 | |
4942 | ; machines. | |
4943 | (define_expand "fixuns_trunc<BFP:mode><GPR:mode>2_emu" | |
4944 | [(parallel | |
4945 | [(set (match_operand:GPR 0 "register_operand" "") | |
4946 | (unsigned_fix:GPR (match_operand:BFP 1 "register_operand" ""))) | |
4947 | (unspec:GPR [(const_int BFP_RND_TOWARD_0)] UNSPEC_ROUND) | |
4948 | (clobber (reg:CC CC_REGNUM))])] | |
4949 | "!TARGET_Z196 && TARGET_HARD_FLOAT" | |
4950 | { | |
4951 | rtx_code_label *label1 = gen_label_rtx (); | |
4952 | rtx_code_label *label2 = gen_label_rtx (); | |
4953 | rtx temp = gen_reg_rtx (<BFP:MODE>mode); | |
4954 | REAL_VALUE_TYPE cmp, sub; | |
4955 | ||
4956 | operands[1] = force_reg (<BFP:MODE>mode, operands[1]); | |
4957 | real_2expN (&cmp, <GPR:bitsize> - 1, <BFP:MODE>mode); | |
4958 | real_2expN (&sub, <GPR:bitsize>, <BFP:MODE>mode); | |
4959 | ||
4960 | emit_cmp_and_jump_insns (operands[1], | |
4961 | const_double_from_real_value (cmp, <BFP:MODE>mode), | |
4962 | LT, NULL_RTX, VOIDmode, 0, label1); | |
4963 | emit_insn (gen_sub<BFP:mode>3 (temp, operands[1], | |
4964 | const_double_from_real_value (sub, <BFP:MODE>mode))); | |
4965 | emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0], temp, | |
4966 | GEN_INT (BFP_RND_TOWARD_MINF))); | |
4967 | emit_jump (label2); | |
4968 | ||
4969 | emit_label (label1); | |
4970 | emit_insn (gen_fix_trunc<BFP:mode><GPR:mode>2_bfp (operands[0], | |
4971 | operands[1], | |
4972 | GEN_INT (BFP_RND_TOWARD_0))); | |
4973 | emit_label (label2); | |
4974 | DONE; | |
4975 | }) | |
4976 | ||
4977 | ; dd->unsigned di | |
4978 | ||
4979 | ; Emulate the unsigned conversion with the signed version for pre z196 | |
4980 | ; machines. | |
4981 | (define_expand "fixuns_truncdddi2_emu" | |
65b1d8ea AK |
4982 | [(parallel |
4983 | [(set (match_operand:DI 0 "register_operand" "") | |
9751ad6e | 4984 | (unsigned_fix:DI (match_operand:DD 1 "register_operand" ""))) |
ae8e301e | 4985 | (unspec:DI [(const_int DFP_RND_TOWARD_0)] UNSPEC_ROUND) |
65b1d8ea AK |
4986 | (clobber (reg:CC CC_REGNUM))])] |
4987 | ||
9751ad6e | 4988 | "!TARGET_Z196 && TARGET_HARD_DFP" |
609e7e80 | 4989 | { |
9751ad6e AK |
4990 | rtx_code_label *label1 = gen_label_rtx (); |
4991 | rtx_code_label *label2 = gen_label_rtx (); | |
4992 | rtx temp = gen_reg_rtx (TDmode); | |
4993 | REAL_VALUE_TYPE cmp, sub; | |
4994 | ||
4995 | decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */ | |
4996 | decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */ | |
4997 | ||
4998 | /* 2^63 can't be represented as 64bit DFP number with full precision. The | |
4999 | solution is doing the check and the subtraction in TD mode and using a | |
5000 | TD -> DI convert afterwards. */ | |
5001 | emit_insn (gen_extendddtd2 (temp, operands[1])); | |
5002 | temp = force_reg (TDmode, temp); | |
5003 | emit_cmp_and_jump_insns (temp, | |
5004 | const_double_from_real_value (cmp, TDmode), | |
5005 | LT, NULL_RTX, VOIDmode, 0, label1); | |
5006 | emit_insn (gen_subtd3 (temp, temp, | |
5007 | const_double_from_real_value (sub, TDmode))); | |
5008 | emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, | |
5009 | GEN_INT (DFP_RND_TOWARD_MINF))); | |
5010 | emit_jump (label2); | |
5011 | ||
5012 | emit_label (label1); | |
5013 | emit_insn (gen_fix_truncdddi2_dfp (operands[0], operands[1], | |
5014 | GEN_INT (DFP_RND_TOWARD_0))); | |
5015 | emit_label (label2); | |
5016 | DONE; | |
609e7e80 | 5017 | }) |
cc7ab9b7 | 5018 | |
9751ad6e | 5019 | ; td->unsigned di |
9db1d521 | 5020 | |
9751ad6e AK |
5021 | ; Emulate the unsigned conversion with the signed version for pre z196 |
5022 | ; machines. | |
5023 | (define_expand "fixuns_trunctddi2_emu" | |
65b1d8ea | 5024 | [(parallel |
9751ad6e AK |
5025 | [(set (match_operand:DI 0 "register_operand" "") |
5026 | (unsigned_fix:DI (match_operand:TD 1 "register_operand" ""))) | |
5027 | (unspec:DI [(const_int DFP_RND_TOWARD_0)] UNSPEC_ROUND) | |
65b1d8ea | 5028 | (clobber (reg:CC CC_REGNUM))])] |
9751ad6e AK |
5029 | |
5030 | "!TARGET_Z196 && TARGET_HARD_DFP" | |
9db1d521 | 5031 | { |
9751ad6e AK |
5032 | rtx_code_label *label1 = gen_label_rtx (); |
5033 | rtx_code_label *label2 = gen_label_rtx (); | |
5034 | rtx temp = gen_reg_rtx (TDmode); | |
5035 | REAL_VALUE_TYPE cmp, sub; | |
5036 | ||
5037 | operands[1] = force_reg (TDmode, operands[1]); | |
5038 | decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */ | |
5039 | decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */ | |
5040 | ||
5041 | emit_cmp_and_jump_insns (operands[1], | |
5042 | const_double_from_real_value (cmp, TDmode), | |
5043 | LT, NULL_RTX, VOIDmode, 0, label1); | |
5044 | emit_insn (gen_subtd3 (temp, operands[1], | |
5045 | const_double_from_real_value (sub, TDmode))); | |
5046 | emit_insn (gen_fix_trunctddi2_dfp (operands[0], temp, | |
5047 | GEN_INT (DFP_RND_TOWARD_MINF))); | |
5048 | emit_jump (label2); | |
5049 | ||
5050 | emit_label (label1); | |
5051 | emit_insn (gen_fix_trunctddi2_dfp (operands[0], operands[1], | |
5052 | GEN_INT (DFP_RND_TOWARD_0))); | |
5053 | emit_label (label2); | |
5054 | DONE; | |
10bbf137 | 5055 | }) |
9db1d521 | 5056 | |
9751ad6e AK |
5057 | ; Just a dummy to make the code in the first expander a bit easier. |
5058 | (define_expand "fixuns_trunc<mode>si2_emu" | |
65b1d8ea AK |
5059 | [(parallel |
5060 | [(set (match_operand:SI 0 "register_operand" "") | |
5061 | (unsigned_fix:SI (match_operand:DFP 1 "register_operand" ""))) | |
9751ad6e | 5062 | (unspec:DI [(const_int DFP_RND_TOWARD_0)] UNSPEC_ROUND) |
65b1d8ea | 5063 | (clobber (reg:CC CC_REGNUM))])] |
9751ad6e AK |
5064 | |
5065 | "!TARGET_Z196 && TARGET_HARD_DFP" | |
5066 | { | |
5067 | FAIL; | |
5068 | }) | |
5069 | ||
65b1d8ea AK |
5070 | |
5071 | ; fixuns_trunc(tf|df|sf|td|dd)(di|si)2 instruction patterns. | |
5072 | ||
026bfe89 AK |
5073 | ; df -> unsigned di, vxe2: sf -> unsigned si |
5074 | ; clgdbr, clfebr, wclgdb, wclfeb | |
5075 | (define_insn "*fixuns_trunc<VX_CONV_BFP:mode><VX_CONV_INT:mode>2_z13" | |
5076 | [(set (match_operand:VX_CONV_INT 0 "register_operand" "=d,v") | |
5077 | (unsigned_fix:VX_CONV_INT (match_operand:VX_CONV_BFP 1 "register_operand" "f,v"))) | |
5078 | (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND) | |
6e5b5de8 | 5079 | (clobber (reg:CC CC_REGNUM))] |
026bfe89 AK |
5080 | "TARGET_VX && TARGET_HARD_FLOAT |
5081 | && GET_MODE_SIZE (<VX_CONV_INT:MODE>mode) == GET_MODE_SIZE (<VX_CONV_BFP:MODE>mode)" | |
9751ad6e | 5082 | "@ |
026bfe89 AK |
5083 | cl<VX_CONV_INT:gf><VX_CONV_BFP:xde>br\t%0,%h2,%1,0 |
5084 | wcl<VX_CONV_INT:gf><VX_CONV_BFP:xde>b\t%v0,%v1,0,%h2" | |
9751ad6e AK |
5085 | [(set_attr "op_type" "RRF,VRR") |
5086 | (set_attr "type" "ftoi")]) | |
6e5b5de8 | 5087 | |
9751ad6e | 5088 | ; (dd|td|sf|df|tf)->unsigned (di|si) |
65b1d8ea AK |
5089 | ; clfebr, clfdbr, clfxbr, clgebr, clgdbr, clgxbr |
5090 | ; clfdtr, clfxtr, clgdtr, clgxtr | |
5091 | (define_insn "*fixuns_trunc<FP:mode><GPR:mode>2_z196" | |
6e5b5de8 AK |
5092 | [(set (match_operand:GPR 0 "register_operand" "=d") |
5093 | (unsigned_fix:GPR (match_operand:FP 1 "register_operand" "f"))) | |
5094 | (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND) | |
65b1d8ea | 5095 | (clobber (reg:CC CC_REGNUM))] |
6e5b5de8 | 5096 | "TARGET_Z196 && TARGET_HARD_FLOAT |
a579871b | 5097 | && (!TARGET_VX || <GPR:MODE>mode != DImode || <FP:MODE>mode != DFmode)" |
65b1d8ea AK |
5098 | "cl<GPR:gf><FP:xde><FP:bt>r\t%0,%h2,%1,0" |
5099 | [(set_attr "op_type" "RRF") | |
5100 | (set_attr "type" "ftoi")]) | |
5101 | ||
b60cb710 AK |
5102 | (define_expand "fix_trunc<DSF:mode><GPR:mode>2" |
5103 | [(set (match_operand:GPR 0 "register_operand" "") | |
5104 | (fix:GPR (match_operand:DSF 1 "register_operand" "")))] | |
5105 | "TARGET_HARD_FLOAT" | |
9db1d521 | 5106 | { |
b60cb710 | 5107 | emit_insn (gen_fix_trunc<DSF:mode><GPR:mode>2_bfp (operands[0], operands[1], |
ae8e301e | 5108 | GEN_INT (BFP_RND_TOWARD_0))); |
9db1d521 | 5109 | DONE; |
10bbf137 | 5110 | }) |
9db1d521 | 5111 | |
026bfe89 AK |
5112 | ; df -> signed di, vxe2: sf -> signed si |
5113 | ; cgdbr, cfebr, wcgdb, wcfeb | |
5114 | (define_insn "*fix_trunc<VX_CONV_BFP:mode><VX_CONV_INT:mode>2_bfp_z13" | |
5115 | [(set (match_operand:VX_CONV_INT 0 "register_operand" "=d,v") | |
5116 | (fix:VX_CONV_INT (match_operand:VX_CONV_BFP 1 "register_operand" "f,v"))) | |
5117 | (unspec:VX_CONV_INT [(match_operand:VX_CONV_INT 2 "immediate_operand" "K,K")] UNSPEC_ROUND) | |
6e5b5de8 | 5118 | (clobber (reg:CC CC_REGNUM))] |
026bfe89 AK |
5119 | "TARGET_VX && TARGET_HARD_FLOAT |
5120 | && GET_MODE_SIZE (<VX_CONV_INT:MODE>mode) == GET_MODE_SIZE (<VX_CONV_BFP:MODE>mode)" | |
6e5b5de8 | 5121 | "@ |
026bfe89 AK |
5122 | c<VX_CONV_INT:gf><VX_CONV_BFP:xde>br\t%0,%h2,%1 |
5123 | wc<VX_CONV_INT:gf><VX_CONV_BFP:xde>b\t%v0,%v1,0,%h2" | |
6e5b5de8 AK |
5124 | [(set_attr "op_type" "RRE,VRR") |
5125 | (set_attr "type" "ftoi")]) | |
5126 | ||
43a09b63 | 5127 | ; cgxbr, cgdbr, cgebr, cfxbr, cfdbr, cfebr |
6e5b5de8 AK |
5128 | (define_insn "*fix_trunc<BFP:mode><GPR:mode>2_bfp" |
5129 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
5130 | (fix:GPR (match_operand:BFP 1 "register_operand" "f"))) | |
5131 | (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND) | |
ae156f85 | 5132 | (clobber (reg:CC CC_REGNUM))] |
6e5b5de8 AK |
5133 | "TARGET_HARD_FLOAT |
5134 | && (!TARGET_VX || <GPR:MODE>mode != DImode || <BFP:MODE>mode != DFmode)" | |
7b6baae1 | 5135 | "c<GPR:gf><BFP:xde>br\t%0,%h2,%1" |
9db1d521 | 5136 | [(set_attr "op_type" "RRE") |
077dab3b | 5137 | (set_attr "type" "ftoi")]) |
9db1d521 | 5138 | |
6e5b5de8 AK |
5139 | (define_expand "fix_trunc<BFP:mode><GPR:mode>2_bfp" |
5140 | [(parallel | |
5141 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
5142 | (fix:GPR (match_operand:BFP 1 "register_operand" "f"))) | |
5143 | (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND) | |
5144 | (clobber (reg:CC CC_REGNUM))])] | |
5145 | "TARGET_HARD_FLOAT") | |
609e7e80 AK |
5146 | ; |
5147 | ; fix_trunc(td|dd)di2 instruction pattern(s). | |
5148 | ; | |
5149 | ||
99cd7dd0 AK |
5150 | (define_expand "fix_trunc<mode>di2" |
5151 | [(set (match_operand:DI 0 "register_operand" "") | |
5152 | (fix:DI (match_operand:DFP 1 "nonimmediate_operand" "")))] | |
9602b6a1 | 5153 | "TARGET_ZARCH && TARGET_HARD_DFP" |
99cd7dd0 AK |
5154 | { |
5155 | operands[1] = force_reg (<MODE>mode, operands[1]); | |
5156 | emit_insn (gen_fix_trunc<mode>di2_dfp (operands[0], operands[1], | |
ae8e301e | 5157 | GEN_INT (DFP_RND_TOWARD_0))); |
99cd7dd0 AK |
5158 | DONE; |
5159 | }) | |
5160 | ||
609e7e80 | 5161 | ; cgxtr, cgdtr |
99cd7dd0 | 5162 | (define_insn "fix_trunc<DFP:mode>di2_dfp" |
609e7e80 AK |
5163 | [(set (match_operand:DI 0 "register_operand" "=d") |
5164 | (fix:DI (match_operand:DFP 1 "register_operand" "f"))) | |
5165 | (unspec:DI [(match_operand:DI 2 "immediate_operand" "K")] UNSPEC_ROUND) | |
5166 | (clobber (reg:CC CC_REGNUM))] | |
9602b6a1 | 5167 | "TARGET_ZARCH && TARGET_HARD_DFP" |
609e7e80 AK |
5168 | "cg<DFP:xde>tr\t%0,%h2,%1" |
5169 | [(set_attr "op_type" "RRF") | |
9381e3f1 | 5170 | (set_attr "type" "ftoidfp")]) |
609e7e80 AK |
5171 | |
5172 | ||
f61a2c7d AK |
5173 | ; |
5174 | ; fix_trunctf(si|di)2 instruction pattern(s). | |
5175 | ; | |
5176 | ||
5177 | (define_expand "fix_trunctf<mode>2" | |
5178 | [(parallel [(set (match_operand:GPR 0 "register_operand" "") | |
5179 | (fix:GPR (match_operand:TF 1 "register_operand" ""))) | |
ae8e301e | 5180 | (unspec:GPR [(const_int BFP_RND_TOWARD_0)] UNSPEC_ROUND) |
f61a2c7d | 5181 | (clobber (reg:CC CC_REGNUM))])] |
9db1d521 | 5182 | "TARGET_HARD_FLOAT" |
142cd70f | 5183 | "") |
9db1d521 | 5184 | |
9db1d521 | 5185 | |
9db1d521 | 5186 | ; |
142cd70f | 5187 | ; float(si|di)(tf|df|sf|td|dd)2 instruction pattern(s). |
9db1d521 HP |
5188 | ; |
5189 | ||
609e7e80 | 5190 | ; cxgbr, cdgbr, cegbr, cxgtr, cdgtr |
f5905b37 | 5191 | (define_insn "floatdi<mode>2" |
62d3f261 AK |
5192 | [(set (match_operand:FP 0 "register_operand" "=f,v") |
5193 | (float:FP (match_operand:DI 1 "register_operand" "d,v")))] | |
9602b6a1 | 5194 | "TARGET_ZARCH && TARGET_HARD_FLOAT" |
6e5b5de8 AK |
5195 | "@ |
5196 | c<xde>g<bt>r\t%0,%1 | |
5197 | wcdgb\t%v0,%v1,0,0" | |
5198 | [(set_attr "op_type" "RRE,VRR") | |
5199 | (set_attr "type" "itof<mode>" ) | |
285363a1 | 5200 | (set_attr "cpu_facility" "*,vx") |
62d3f261 | 5201 | (set_attr "enabled" "*,<DFDI>")]) |
9db1d521 | 5202 | |
026bfe89 | 5203 | ; cxfbr, cdfbr, cefbr, wcefb |
142cd70f | 5204 | (define_insn "floatsi<mode>2" |
026bfe89 AK |
5205 | [(set (match_operand:BFP 0 "register_operand" "=f,v") |
5206 | (float:BFP (match_operand:SI 1 "register_operand" "d,v")))] | |
142cd70f | 5207 | "TARGET_HARD_FLOAT" |
026bfe89 AK |
5208 | "@ |
5209 | c<xde>fbr\t%0,%1 | |
5210 | wcefb\t%v0,%v1,0,0" | |
5211 | [(set_attr "op_type" "RRE,VRR") | |
5212 | (set_attr "type" "itof<mode>" ) | |
5213 | (set_attr "cpu_facility" "*,vxe2") | |
5214 | (set_attr "enabled" "*,<SFSI>")]) | |
f61a2c7d | 5215 | |
65b1d8ea AK |
5216 | ; cxftr, cdftr |
5217 | (define_insn "floatsi<mode>2" | |
5218 | [(set (match_operand:DFP 0 "register_operand" "=f") | |
5219 | (float:DFP (match_operand:SI 1 "register_operand" "d")))] | |
5220 | "TARGET_Z196 && TARGET_HARD_FLOAT" | |
5221 | "c<xde>ftr\t%0,0,%1,0" | |
5222 | [(set_attr "op_type" "RRE") | |
5223 | (set_attr "type" "itof<mode>" )]) | |
5224 | ||
5225 | ; | |
5226 | ; floatuns(si|di)(tf|df|sf|td|dd)2 instruction pattern(s). | |
5227 | ; | |
5228 | ||
026bfe89 AK |
5229 | (define_insn "*floatuns<VX_CONV_INT:mode><VX_CONV_BFP:mode>2_z13" |
5230 | [(set (match_operand:VX_CONV_BFP 0 "register_operand" "=f,v") | |
5231 | (unsigned_float:VX_CONV_BFP (match_operand:VX_CONV_INT 1 "register_operand" "d,v")))] | |
5232 | "TARGET_VX && TARGET_HARD_FLOAT | |
5233 | && GET_MODE_SIZE (<VX_CONV_INT:MODE>mode) == GET_MODE_SIZE (<VX_CONV_BFP:MODE>mode)" | |
6e5b5de8 | 5234 | "@ |
026bfe89 AK |
5235 | c<VX_CONV_BFP:xde>l<VX_CONV_INT:gf>br\t%0,0,%1,0 |
5236 | wc<VX_CONV_BFP:xde>l<VX_CONV_INT:gf>b\t%v0,%v1,0,0" | |
6e5b5de8 AK |
5237 | [(set_attr "op_type" "RRE,VRR") |
5238 | (set_attr "type" "itofdf")]) | |
5239 | ||
65b1d8ea AK |
5240 | ; cxlgbr, cdlgbr, celgbr, cxlgtr, cdlgtr |
5241 | ; cxlfbr, cdlfbr, celfbr, cxlftr, cdlftr | |
6e5b5de8 AK |
5242 | (define_insn "*floatuns<GPR:mode><FP:mode>2" |
5243 | [(set (match_operand:FP 0 "register_operand" "=f") | |
5244 | (unsigned_float:FP (match_operand:GPR 1 "register_operand" "d")))] | |
5245 | "TARGET_Z196 && TARGET_HARD_FLOAT | |
5246 | && (!TARGET_VX || <FP:MODE>mode != DFmode || <GPR:MODE>mode != DImode)" | |
65b1d8ea AK |
5247 | "c<FP:xde>l<GPR:gf><FP:bt>r\t%0,0,%1,0" |
5248 | [(set_attr "op_type" "RRE") | |
6e5b5de8 AK |
5249 | (set_attr "type" "itof<FP:mode>")]) |
5250 | ||
5251 | (define_expand "floatuns<GPR:mode><FP:mode>2" | |
5252 | [(set (match_operand:FP 0 "register_operand" "") | |
5253 | (unsigned_float:FP (match_operand:GPR 1 "register_operand" "")))] | |
5254 | "TARGET_Z196 && TARGET_HARD_FLOAT") | |
f61a2c7d | 5255 | |
9db1d521 HP |
5256 | ; |
5257 | ; truncdfsf2 instruction pattern(s). | |
5258 | ; | |
5259 | ||
142cd70f | 5260 | (define_insn "truncdfsf2" |
6e5b5de8 AK |
5261 | [(set (match_operand:SF 0 "register_operand" "=f,v") |
5262 | (float_truncate:SF (match_operand:DF 1 "register_operand" "f,v")))] | |
142cd70f | 5263 | "TARGET_HARD_FLOAT" |
6e5b5de8 AK |
5264 | "@ |
5265 | ledbr\t%0,%1 | |
5266 | wledb\t%v0,%v1,0,0" ; IEEE inexact exception not suppressed | |
5267 | ; According to BFP rounding mode | |
5268 | [(set_attr "op_type" "RRE,VRR") | |
5269 | (set_attr "type" "ftruncdf") | |
285363a1 | 5270 | (set_attr "cpu_facility" "*,vx")]) |
9db1d521 | 5271 | |
f61a2c7d | 5272 | ; |
142cd70f | 5273 | ; trunctf(df|sf)2 instruction pattern(s). |
f61a2c7d AK |
5274 | ; |
5275 | ||
142cd70f AK |
5276 | ; ldxbr, lexbr |
5277 | (define_insn "trunctf<mode>2" | |
5278 | [(set (match_operand:DSF 0 "register_operand" "=f") | |
5279 | (float_truncate:DSF (match_operand:TF 1 "register_operand" "f"))) | |
f61a2c7d | 5280 | (clobber (match_scratch:TF 2 "=f"))] |
142cd70f AK |
5281 | "TARGET_HARD_FLOAT" |
5282 | "l<xde>xbr\t%2,%1\;l<xde>r\t%0,%2" | |
f61a2c7d | 5283 | [(set_attr "length" "6") |
9381e3f1 | 5284 | (set_attr "type" "ftrunctf")]) |
f61a2c7d | 5285 | |
609e7e80 AK |
5286 | ; |
5287 | ; trunctddd2 and truncddsd2 instruction pattern(s). | |
5288 | ; | |
5289 | ||
432d4670 AK |
5290 | |
5291 | (define_expand "trunctddd2" | |
5292 | [(parallel | |
5293 | [(set (match_operand:DD 0 "register_operand" "") | |
5294 | (float_truncate:DD (match_operand:TD 1 "register_operand" ""))) | |
5295 | (unspec:DI [(const_int DFP_RND_CURRENT)] UNSPEC_ROUND) | |
5296 | (clobber (scratch:TD))])] | |
5297 | "TARGET_HARD_DFP") | |
5298 | ||
5299 | (define_insn "*trunctddd2" | |
609e7e80 | 5300 | [(set (match_operand:DD 0 "register_operand" "=f") |
bf259a77 | 5301 | (float_truncate:DD (match_operand:TD 1 "register_operand" "f"))) |
432d4670 AK |
5302 | (unspec:DI [(match_operand:DI 2 "const_mask_operand" "I")] UNSPEC_ROUND) |
5303 | (clobber (match_scratch:TD 3 "=f"))] | |
fb068247 | 5304 | "TARGET_HARD_DFP" |
432d4670 | 5305 | "ldxtr\t%3,%2,%1,0\;ldr\t%0,%3" |
bf259a77 | 5306 | [(set_attr "length" "6") |
9381e3f1 | 5307 | (set_attr "type" "ftruncdd")]) |
609e7e80 AK |
5308 | |
5309 | (define_insn "truncddsd2" | |
5310 | [(set (match_operand:SD 0 "register_operand" "=f") | |
5311 | (float_truncate:SD (match_operand:DD 1 "register_operand" "f")))] | |
fb068247 | 5312 | "TARGET_HARD_DFP" |
609e7e80 AK |
5313 | "ledtr\t%0,0,%1,0" |
5314 | [(set_attr "op_type" "RRF") | |
9381e3f1 | 5315 | (set_attr "type" "ftruncsd")]) |
609e7e80 | 5316 | |
feade5a8 AK |
5317 | (define_expand "trunctdsd2" |
5318 | [(parallel | |
d5a216fa | 5319 | [(set (match_dup 2) |
feade5a8 | 5320 | (float_truncate:DD (match_operand:TD 1 "register_operand" ""))) |
432d4670 | 5321 | (unspec:DI [(const_int DFP_RND_PREP_FOR_SHORT_PREC)] UNSPEC_ROUND) |
d5a216fa | 5322 | (clobber (match_scratch:TD 3 ""))]) |
feade5a8 | 5323 | (set (match_operand:SD 0 "register_operand" "") |
d5a216fa | 5324 | (float_truncate:SD (match_dup 2)))] |
feade5a8 AK |
5325 | "TARGET_HARD_DFP" |
5326 | { | |
d5a216fa | 5327 | operands[2] = gen_reg_rtx (DDmode); |
feade5a8 AK |
5328 | }) |
5329 | ||
9db1d521 | 5330 | ; |
142cd70f | 5331 | ; extend(sf|df)(df|tf)2 instruction pattern(s). |
f61a2c7d AK |
5332 | ; |
5333 | ||
2de2b3f9 | 5334 | ; wflls |
6e5b5de8 AK |
5335 | (define_insn "*extendsfdf2_z13" |
5336 | [(set (match_operand:DF 0 "register_operand" "=f,f,v") | |
5337 | (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R,v")))] | |
a579871b | 5338 | "TARGET_VX && TARGET_HARD_FLOAT" |
6e5b5de8 AK |
5339 | "@ |
5340 | ldebr\t%0,%1 | |
5341 | ldeb\t%0,%1 | |
5342 | wldeb\t%v0,%v1" | |
5343 | [(set_attr "op_type" "RRE,RXE,VRR") | |
5344 | (set_attr "type" "fsimpdf, floaddf,fsimpdf")]) | |
5345 | ||
142cd70f | 5346 | ; ldebr, ldeb, lxdbr, lxdb, lxebr, lxeb |
6e5b5de8 AK |
5347 | (define_insn "*extend<DSF:mode><BFP:mode>2" |
5348 | [(set (match_operand:BFP 0 "register_operand" "=f,f") | |
142cd70f AK |
5349 | (float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "f,R")))] |
5350 | "TARGET_HARD_FLOAT | |
6e5b5de8 AK |
5351 | && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DSF:MODE>mode) |
5352 | && (!TARGET_VX || <BFP:MODE>mode != DFmode || <DSF:MODE>mode != SFmode)" | |
f61a2c7d | 5353 | "@ |
142cd70f AK |
5354 | l<BFP:xde><DSF:xde>br\t%0,%1 |
5355 | l<BFP:xde><DSF:xde>b\t%0,%1" | |
6e5b5de8 AK |
5356 | [(set_attr "op_type" "RRE,RXE") |
5357 | (set_attr "type" "fsimp<BFP:mode>, fload<BFP:mode>")]) | |
5358 | ||
5359 | (define_expand "extend<DSF:mode><BFP:mode>2" | |
5360 | [(set (match_operand:BFP 0 "register_operand" "") | |
5361 | (float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "")))] | |
5362 | "TARGET_HARD_FLOAT | |
5363 | && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DSF:MODE>mode)") | |
f61a2c7d | 5364 | |
609e7e80 AK |
5365 | ; |
5366 | ; extendddtd2 and extendsddd2 instruction pattern(s). | |
5367 | ; | |
5368 | ||
5369 | (define_insn "extendddtd2" | |
5370 | [(set (match_operand:TD 0 "register_operand" "=f") | |
5371 | (float_extend:TD (match_operand:DD 1 "register_operand" "f")))] | |
fb068247 | 5372 | "TARGET_HARD_DFP" |
609e7e80 AK |
5373 | "lxdtr\t%0,%1,0" |
5374 | [(set_attr "op_type" "RRF") | |
5375 | (set_attr "type" "fsimptf")]) | |
5376 | ||
5377 | (define_insn "extendsddd2" | |
5378 | [(set (match_operand:DD 0 "register_operand" "=f") | |
5379 | (float_extend:DD (match_operand:SD 1 "register_operand" "f")))] | |
fb068247 | 5380 | "TARGET_HARD_DFP" |
609e7e80 AK |
5381 | "ldetr\t%0,%1,0" |
5382 | [(set_attr "op_type" "RRF") | |
5383 | (set_attr "type" "fsimptf")]) | |
9db1d521 | 5384 | |
feade5a8 AK |
5385 | (define_expand "extendsdtd2" |
5386 | [(set (match_dup 2) | |
5387 | (float_extend:DD (match_operand:SD 1 "register_operand" ""))) | |
5388 | (set (match_operand:TD 0 "register_operand" "") | |
5389 | (float_extend:TD (match_dup 2)))] | |
5390 | "TARGET_HARD_DFP" | |
5391 | { | |
5392 | operands[2] = gen_reg_rtx (DDmode); | |
5393 | }) | |
5394 | ||
d12a76f3 AK |
5395 | ; Binary Floating Point - load fp integer |
5396 | ||
5397 | ; Expanders for: floor, btrunc, round, ceil, and nearbyint | |
5398 | ; For all of them the inexact exceptions are suppressed. | |
5399 | ||
5400 | ; fiebra, fidbra, fixbra | |
5401 | (define_insn "<FPINT:fpint_name><BFP:mode>2" | |
5402 | [(set (match_operand:BFP 0 "register_operand" "=f") | |
5403 | (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")] | |
5404 | FPINT))] | |
5405 | "TARGET_Z196" | |
5406 | "fi<BFP:xde>bra\t%0,<FPINT:fpint_roundingmode>,%1,4" | |
5407 | [(set_attr "op_type" "RRF") | |
5408 | (set_attr "type" "fsimp<BFP:mode>")]) | |
5409 | ||
5410 | ; rint is supposed to raise an inexact exception so we can use the | |
5411 | ; older instructions. | |
5412 | ||
5413 | ; fiebr, fidbr, fixbr | |
5414 | (define_insn "rint<BFP:mode>2" | |
5415 | [(set (match_operand:BFP 0 "register_operand" "=f") | |
5416 | (unspec:BFP [(match_operand:BFP 1 "register_operand" "f")] | |
5417 | UNSPEC_FPINT_RINT))] | |
5418 | "" | |
5419 | "fi<BFP:xde>br\t%0,0,%1" | |
5420 | [(set_attr "op_type" "RRF") | |
5421 | (set_attr "type" "fsimp<BFP:mode>")]) | |
5422 | ||
5423 | ||
5424 | ; Decimal Floating Point - load fp integer | |
5425 | ||
5426 | ; fidtr, fixtr | |
5427 | (define_insn "<FPINT:fpint_name><DFP:mode>2" | |
5428 | [(set (match_operand:DFP 0 "register_operand" "=f") | |
5429 | (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")] | |
5430 | FPINT))] | |
5431 | "TARGET_HARD_DFP" | |
5432 | "fi<DFP:xde>tr\t%0,<FPINT:fpint_roundingmode>,%1,4" | |
5433 | [(set_attr "op_type" "RRF") | |
5434 | (set_attr "type" "fsimp<DFP:mode>")]) | |
5435 | ||
5436 | ; fidtr, fixtr | |
5437 | (define_insn "rint<DFP:mode>2" | |
5438 | [(set (match_operand:DFP 0 "register_operand" "=f") | |
5439 | (unspec:DFP [(match_operand:DFP 1 "register_operand" "f")] | |
5440 | UNSPEC_FPINT_RINT))] | |
5441 | "TARGET_HARD_DFP" | |
5442 | "fi<DFP:xde>tr\t%0,0,%1,0" | |
5443 | [(set_attr "op_type" "RRF") | |
5444 | (set_attr "type" "fsimp<DFP:mode>")]) | |
5445 | ||
5446 | ; | |
35dd9a0e AK |
5447 | ; Binary <-> Decimal floating point trunc patterns |
5448 | ; | |
5449 | ||
5450 | (define_insn "*trunc<BFP:mode><DFP_ALL:mode>2" | |
5451 | [(set (reg:DFP_ALL FPR0_REGNUM) | |
2cf4c39e | 5452 | (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM))) |
35dd9a0e | 5453 | (use (reg:SI GPR0_REGNUM)) |
af344a30 DV |
5454 | (clobber (reg:CC CC_REGNUM)) |
5455 | (clobber (reg:SI GPR1_REGNUM))] | |
fb068247 | 5456 | "TARGET_HARD_DFP" |
35dd9a0e AK |
5457 | "pfpo") |
5458 | ||
5459 | (define_insn "*trunc<DFP_ALL:mode><BFP:mode>2" | |
5460 | [(set (reg:BFP FPR0_REGNUM) | |
2cf4c39e | 5461 | (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM))) |
35dd9a0e | 5462 | (use (reg:SI GPR0_REGNUM)) |
af344a30 DV |
5463 | (clobber (reg:CC CC_REGNUM)) |
5464 | (clobber (reg:SI GPR1_REGNUM))] | |
fb068247 | 5465 | "TARGET_HARD_DFP" |
35dd9a0e AK |
5466 | "pfpo") |
5467 | ||
5468 | (define_expand "trunc<BFP:mode><DFP_ALL:mode>2" | |
2cf4c39e | 5469 | [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" "")) |
35dd9a0e AK |
5470 | (set (reg:SI GPR0_REGNUM) (match_dup 2)) |
5471 | (parallel | |
5472 | [(set (reg:DFP_ALL FPR0_REGNUM) | |
2cf4c39e | 5473 | (float_truncate:DFP_ALL (reg:BFP FPR4_REGNUM))) |
35dd9a0e | 5474 | (use (reg:SI GPR0_REGNUM)) |
af344a30 DV |
5475 | (clobber (reg:CC CC_REGNUM)) |
5476 | (clobber (reg:SI GPR1_REGNUM))]) | |
35dd9a0e AK |
5477 | (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "") |
5478 | (reg:DFP_ALL FPR0_REGNUM))] | |
fb068247 | 5479 | "TARGET_HARD_DFP |
35dd9a0e AK |
5480 | && GET_MODE_SIZE (<BFP:MODE>mode) > GET_MODE_SIZE (<DFP_ALL:MODE>mode)" |
5481 | { | |
5482 | HOST_WIDE_INT flags; | |
5483 | ||
ced8d882 AK |
5484 | /* According to IEEE 754 2008 4.3 'Rounding-direction attributes' the |
5485 | rounding mode of the target format needs to be used. */ | |
5486 | ||
35dd9a0e AK |
5487 | flags = (PFPO_CONVERT | |
5488 | PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT | | |
ced8d882 AK |
5489 | PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT | |
5490 | PFPO_RND_MODE_DFP); | |
35dd9a0e AK |
5491 | |
5492 | operands[2] = GEN_INT (flags); | |
5493 | }) | |
5494 | ||
5495 | (define_expand "trunc<DFP_ALL:mode><BFP:mode>2" | |
2cf4c39e | 5496 | [(set (reg:DFP_ALL FPR4_REGNUM) |
35dd9a0e AK |
5497 | (match_operand:DFP_ALL 1 "nonimmediate_operand" "")) |
5498 | (set (reg:SI GPR0_REGNUM) (match_dup 2)) | |
5499 | (parallel | |
2cf4c39e | 5500 | [(set (reg:BFP FPR0_REGNUM) (float_truncate:BFP (reg:DFP_ALL FPR4_REGNUM))) |
35dd9a0e | 5501 | (use (reg:SI GPR0_REGNUM)) |
af344a30 DV |
5502 | (clobber (reg:CC CC_REGNUM)) |
5503 | (clobber (reg:SI GPR1_REGNUM))]) | |
35dd9a0e | 5504 | (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))] |
fb068247 | 5505 | "TARGET_HARD_DFP |
35dd9a0e AK |
5506 | && GET_MODE_SIZE (<DFP_ALL:MODE>mode) >= GET_MODE_SIZE (<BFP:MODE>mode)" |
5507 | { | |
5508 | HOST_WIDE_INT flags; | |
5509 | ||
ced8d882 AK |
5510 | /* According to IEEE 754 2008 4.3 'Rounding-direction attributes' the |
5511 | rounding mode of the target format needs to be used. */ | |
5512 | ||
35dd9a0e AK |
5513 | flags = (PFPO_CONVERT | |
5514 | PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT | | |
ced8d882 AK |
5515 | PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT | |
5516 | PFPO_RND_MODE_BFP); | |
35dd9a0e AK |
5517 | |
5518 | operands[2] = GEN_INT (flags); | |
5519 | }) | |
5520 | ||
5521 | ; | |
5522 | ; Binary <-> Decimal floating point extend patterns | |
5523 | ; | |
5524 | ||
5525 | (define_insn "*extend<BFP:mode><DFP_ALL:mode>2" | |
2cf4c39e | 5526 | [(set (reg:DFP_ALL FPR0_REGNUM) (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM))) |
35dd9a0e | 5527 | (use (reg:SI GPR0_REGNUM)) |
af344a30 DV |
5528 | (clobber (reg:CC CC_REGNUM)) |
5529 | (clobber (reg:SI GPR1_REGNUM))] | |
fb068247 | 5530 | "TARGET_HARD_DFP" |
35dd9a0e AK |
5531 | "pfpo") |
5532 | ||
5533 | (define_insn "*extend<DFP_ALL:mode><BFP:mode>2" | |
2cf4c39e | 5534 | [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM))) |
35dd9a0e | 5535 | (use (reg:SI GPR0_REGNUM)) |
af344a30 DV |
5536 | (clobber (reg:CC CC_REGNUM)) |
5537 | (clobber (reg:SI GPR1_REGNUM))] | |
fb068247 | 5538 | "TARGET_HARD_DFP" |
35dd9a0e AK |
5539 | "pfpo") |
5540 | ||
5541 | (define_expand "extend<BFP:mode><DFP_ALL:mode>2" | |
2cf4c39e | 5542 | [(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" "")) |
35dd9a0e AK |
5543 | (set (reg:SI GPR0_REGNUM) (match_dup 2)) |
5544 | (parallel | |
5545 | [(set (reg:DFP_ALL FPR0_REGNUM) | |
2cf4c39e | 5546 | (float_extend:DFP_ALL (reg:BFP FPR4_REGNUM))) |
35dd9a0e | 5547 | (use (reg:SI GPR0_REGNUM)) |
af344a30 DV |
5548 | (clobber (reg:CC CC_REGNUM)) |
5549 | (clobber (reg:SI GPR1_REGNUM))]) | |
35dd9a0e AK |
5550 | (set (match_operand:DFP_ALL 0 "nonimmediate_operand" "") |
5551 | (reg:DFP_ALL FPR0_REGNUM))] | |
fb068247 | 5552 | "TARGET_HARD_DFP |
35dd9a0e AK |
5553 | && GET_MODE_SIZE (<BFP:MODE>mode) <= GET_MODE_SIZE (<DFP_ALL:MODE>mode)" |
5554 | { | |
5555 | HOST_WIDE_INT flags; | |
5556 | ||
ced8d882 AK |
5557 | /* According to IEEE 754 2008 4.3 'Rounding-direction attributes' the |
5558 | rounding mode of the target format needs to be used. */ | |
5559 | ||
35dd9a0e AK |
5560 | flags = (PFPO_CONVERT | |
5561 | PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP0_TYPE_SHIFT | | |
ced8d882 AK |
5562 | PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP1_TYPE_SHIFT | |
5563 | PFPO_RND_MODE_DFP); | |
35dd9a0e AK |
5564 | |
5565 | operands[2] = GEN_INT (flags); | |
5566 | }) | |
5567 | ||
5568 | (define_expand "extend<DFP_ALL:mode><BFP:mode>2" | |
2cf4c39e | 5569 | [(set (reg:DFP_ALL FPR4_REGNUM) |
35dd9a0e AK |
5570 | (match_operand:DFP_ALL 1 "nonimmediate_operand" "")) |
5571 | (set (reg:SI GPR0_REGNUM) (match_dup 2)) | |
5572 | (parallel | |
2cf4c39e | 5573 | [(set (reg:BFP FPR0_REGNUM) (float_extend:BFP (reg:DFP_ALL FPR4_REGNUM))) |
35dd9a0e | 5574 | (use (reg:SI GPR0_REGNUM)) |
af344a30 DV |
5575 | (clobber (reg:CC CC_REGNUM)) |
5576 | (clobber (reg:SI GPR1_REGNUM))]) | |
35dd9a0e | 5577 | (set (match_operand:BFP 0 "nonimmediate_operand" "") (reg:BFP FPR0_REGNUM))] |
fb068247 | 5578 | "TARGET_HARD_DFP |
35dd9a0e AK |
5579 | && GET_MODE_SIZE (<DFP_ALL:MODE>mode) < GET_MODE_SIZE (<BFP:MODE>mode)" |
5580 | { | |
5581 | HOST_WIDE_INT flags; | |
5582 | ||
ced8d882 AK |
5583 | /* According to IEEE 754 2008 4.3 'Rounding-direction attributes' the |
5584 | rounding mode of the target format needs to be used. */ | |
5585 | ||
35dd9a0e AK |
5586 | flags = (PFPO_CONVERT | |
5587 | PFPO_OP_TYPE_<BFP:MODE> << PFPO_OP0_TYPE_SHIFT | | |
ced8d882 AK |
5588 | PFPO_OP_TYPE_<DFP_ALL:MODE> << PFPO_OP1_TYPE_SHIFT | |
5589 | PFPO_RND_MODE_BFP); | |
35dd9a0e AK |
5590 | |
5591 | operands[2] = GEN_INT (flags); | |
5592 | }) | |
5593 | ||
5594 | ||
9db1d521 | 5595 | ;; |
fae778eb | 5596 | ;; ARITHMETIC OPERATIONS |
9db1d521 | 5597 | ;; |
fae778eb | 5598 | ; arithmetic operations set the ConditionCode, |
9db1d521 HP |
5599 | ; because of unpredictable Bits in Register for Halfword and Byte |
5600 | ; the ConditionCode can be set wrong in operations for Halfword and Byte | |
5601 | ||
07893d4f UW |
5602 | ;; |
5603 | ;;- Add instructions. | |
5604 | ;; | |
5605 | ||
1c7b1b7e UW |
5606 | ; |
5607 | ; addti3 instruction pattern(s). | |
5608 | ; | |
5609 | ||
085261c8 AK |
5610 | (define_expand "addti3" |
5611 | [(parallel | |
5612 | [(set (match_operand:TI 0 "register_operand" "") | |
5613 | (plus:TI (match_operand:TI 1 "nonimmediate_operand" "") | |
5614 | (match_operand:TI 2 "general_operand" "") ) ) | |
5615 | (clobber (reg:CC CC_REGNUM))])] | |
5616 | "TARGET_ZARCH" | |
5617 | { | |
5618 | /* For z13 we have vaq which doesn't set CC. */ | |
5619 | if (TARGET_VX) | |
5620 | { | |
5621 | emit_insn (gen_rtx_SET (operands[0], | |
5622 | gen_rtx_PLUS (TImode, | |
5623 | copy_to_mode_reg (TImode, operands[1]), | |
5624 | copy_to_mode_reg (TImode, operands[2])))); | |
5625 | DONE; | |
5626 | } | |
5627 | }) | |
5628 | ||
5629 | (define_insn_and_split "*addti3" | |
5630 | [(set (match_operand:TI 0 "register_operand" "=&d") | |
1c7b1b7e | 5631 | (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0") |
085261c8 | 5632 | (match_operand:TI 2 "general_operand" "do") ) ) |
ae156f85 | 5633 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 5634 | "TARGET_ZARCH" |
1c7b1b7e UW |
5635 | "#" |
5636 | "&& reload_completed" | |
5637 | [(parallel | |
ae156f85 | 5638 | [(set (reg:CCL1 CC_REGNUM) |
1c7b1b7e UW |
5639 | (compare:CCL1 (plus:DI (match_dup 7) (match_dup 8)) |
5640 | (match_dup 7))) | |
5641 | (set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))]) | |
5642 | (parallel | |
a94a76a7 UW |
5643 | [(set (match_dup 3) (plus:DI |
5644 | (plus:DI (ltu:DI (reg:CCL1 CC_REGNUM) (const_int 0)) | |
5645 | (match_dup 4)) (match_dup 5))) | |
ae156f85 | 5646 | (clobber (reg:CC CC_REGNUM))])] |
1c7b1b7e UW |
5647 | "operands[3] = operand_subword (operands[0], 0, 0, TImode); |
5648 | operands[4] = operand_subword (operands[1], 0, 0, TImode); | |
5649 | operands[5] = operand_subword (operands[2], 0, 0, TImode); | |
5650 | operands[6] = operand_subword (operands[0], 1, 0, TImode); | |
5651 | operands[7] = operand_subword (operands[1], 1, 0, TImode); | |
085261c8 AK |
5652 | operands[8] = operand_subword (operands[2], 1, 0, TImode);" |
5653 | [(set_attr "op_type" "*") | |
5654 | (set_attr "cpu_facility" "*")]) | |
1c7b1b7e | 5655 | |
07893d4f UW |
5656 | ; |
5657 | ; adddi3 instruction pattern(s). | |
5658 | ; | |
5659 | ||
3298c037 AK |
5660 | (define_expand "adddi3" |
5661 | [(parallel | |
963fc8d0 | 5662 | [(set (match_operand:DI 0 "nonimmediate_operand" "") |
3298c037 AK |
5663 | (plus:DI (match_operand:DI 1 "nonimmediate_operand" "") |
5664 | (match_operand:DI 2 "general_operand" ""))) | |
5665 | (clobber (reg:CC CC_REGNUM))])] | |
5666 | "" | |
5667 | "") | |
5668 | ||
07893d4f UW |
5669 | (define_insn "*adddi3_sign" |
5670 | [(set (match_operand:DI 0 "register_operand" "=d,d") | |
3e4be43f | 5671 | (plus:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,T")) |
07893d4f | 5672 | (match_operand:DI 1 "register_operand" "0,0"))) |
ae156f85 | 5673 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 5674 | "TARGET_ZARCH" |
07893d4f | 5675 | "@ |
d40c829f UW |
5676 | agfr\t%0,%2 |
5677 | agf\t%0,%2" | |
65b1d8ea AK |
5678 | [(set_attr "op_type" "RRE,RXY") |
5679 | (set_attr "z196prop" "z196_cracked,z196_cracked")]) | |
07893d4f UW |
5680 | |
5681 | (define_insn "*adddi3_zero_cc" | |
ae156f85 | 5682 | [(set (reg CC_REGNUM) |
3e4be43f | 5683 | (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,T")) |
07893d4f UW |
5684 | (match_operand:DI 1 "register_operand" "0,0")) |
5685 | (const_int 0))) | |
5686 | (set (match_operand:DI 0 "register_operand" "=d,d") | |
5687 | (plus:DI (zero_extend:DI (match_dup 2)) (match_dup 1)))] | |
9602b6a1 | 5688 | "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH" |
07893d4f | 5689 | "@ |
d40c829f UW |
5690 | algfr\t%0,%2 |
5691 | algf\t%0,%2" | |
9381e3f1 WG |
5692 | [(set_attr "op_type" "RRE,RXY") |
5693 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) | |
07893d4f UW |
5694 | |
5695 | (define_insn "*adddi3_zero_cconly" | |
ae156f85 | 5696 | [(set (reg CC_REGNUM) |
3e4be43f | 5697 | (compare (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,T")) |
07893d4f UW |
5698 | (match_operand:DI 1 "register_operand" "0,0")) |
5699 | (const_int 0))) | |
5700 | (clobber (match_scratch:DI 0 "=d,d"))] | |
9602b6a1 | 5701 | "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH" |
07893d4f | 5702 | "@ |
d40c829f UW |
5703 | algfr\t%0,%2 |
5704 | algf\t%0,%2" | |
9381e3f1 WG |
5705 | [(set_attr "op_type" "RRE,RXY") |
5706 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) | |
07893d4f UW |
5707 | |
5708 | (define_insn "*adddi3_zero" | |
5709 | [(set (match_operand:DI 0 "register_operand" "=d,d") | |
3e4be43f | 5710 | (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "d,T")) |
07893d4f | 5711 | (match_operand:DI 1 "register_operand" "0,0"))) |
ae156f85 | 5712 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 5713 | "TARGET_ZARCH" |
07893d4f | 5714 | "@ |
d40c829f UW |
5715 | algfr\t%0,%2 |
5716 | algf\t%0,%2" | |
9381e3f1 WG |
5717 | [(set_attr "op_type" "RRE,RXY") |
5718 | (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) | |
07893d4f | 5719 | |
e69166de | 5720 | (define_insn_and_split "*adddi3_31z" |
963fc8d0 | 5721 | [(set (match_operand:DI 0 "nonimmediate_operand" "=&d") |
e69166de UW |
5722 | (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0") |
5723 | (match_operand:DI 2 "general_operand" "do") ) ) | |
ae156f85 | 5724 | (clobber (reg:CC CC_REGNUM))] |
8cc6307c | 5725 | "!TARGET_ZARCH" |
e69166de UW |
5726 | "#" |
5727 | "&& reload_completed" | |
5728 | [(parallel | |
ae156f85 | 5729 | [(set (reg:CCL1 CC_REGNUM) |
e69166de UW |
5730 | (compare:CCL1 (plus:SI (match_dup 7) (match_dup 8)) |
5731 | (match_dup 7))) | |
5732 | (set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))]) | |
5733 | (parallel | |
a94a76a7 UW |
5734 | [(set (match_dup 3) (plus:SI |
5735 | (plus:SI (ltu:SI (reg:CCL1 CC_REGNUM) (const_int 0)) | |
5736 | (match_dup 4)) (match_dup 5))) | |
ae156f85 | 5737 | (clobber (reg:CC CC_REGNUM))])] |
e69166de UW |
5738 | "operands[3] = operand_subword (operands[0], 0, 0, DImode); |
5739 | operands[4] = operand_subword (operands[1], 0, 0, DImode); | |
5740 | operands[5] = operand_subword (operands[2], 0, 0, DImode); | |
5741 | operands[6] = operand_subword (operands[0], 1, 0, DImode); | |
5742 | operands[7] = operand_subword (operands[1], 1, 0, DImode); | |
b628bd8e | 5743 | operands[8] = operand_subword (operands[2], 1, 0, DImode);") |
e69166de | 5744 | |
3298c037 AK |
5745 | ; |
5746 | ; addsi3 instruction pattern(s). | |
5747 | ; | |
5748 | ||
5749 | (define_expand "addsi3" | |
07893d4f | 5750 | [(parallel |
963fc8d0 | 5751 | [(set (match_operand:SI 0 "nonimmediate_operand" "") |
3298c037 AK |
5752 | (plus:SI (match_operand:SI 1 "nonimmediate_operand" "") |
5753 | (match_operand:SI 2 "general_operand" ""))) | |
ae156f85 | 5754 | (clobber (reg:CC CC_REGNUM))])] |
9db1d521 | 5755 | "" |
07893d4f | 5756 | "") |
9db1d521 | 5757 | |
3298c037 AK |
5758 | (define_insn "*addsi3_sign" |
5759 | [(set (match_operand:SI 0 "register_operand" "=d,d") | |
5760 | (plus:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T")) | |
5761 | (match_operand:SI 1 "register_operand" "0,0"))) | |
5762 | (clobber (reg:CC CC_REGNUM))] | |
5763 | "" | |
5764 | "@ | |
5765 | ah\t%0,%2 | |
5766 | ahy\t%0,%2" | |
65b1d8ea | 5767 | [(set_attr "op_type" "RX,RXY") |
3e4be43f | 5768 | (set_attr "cpu_facility" "*,longdisp") |
65b1d8ea | 5769 | (set_attr "z196prop" "z196_cracked,z196_cracked")]) |
3298c037 | 5770 | |
9db1d521 | 5771 | ; |
3298c037 | 5772 | ; add(di|si)3 instruction pattern(s). |
9db1d521 | 5773 | ; |
9db1d521 | 5774 | |
65b1d8ea | 5775 | ; ark, agrk, ar, ahi, ahik, aghik, alfi, slfi, a, ay, agr, aghi, algfi, slgfi, ag, asi, agsi |
3298c037 | 5776 | (define_insn "*add<mode>3" |
3e4be43f UW |
5777 | [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d,d,d, d, d,d,d,S") |
5778 | (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,d, 0, 0,0,0,0") | |
5779 | (match_operand:GPR 2 "general_operand" " d,d,K,K,Op,On,R,T,C") ) ) | |
3298c037 AK |
5780 | (clobber (reg:CC CC_REGNUM))] |
5781 | "" | |
ec24698e | 5782 | "@ |
3298c037 | 5783 | a<g>r\t%0,%2 |
65b1d8ea | 5784 | a<g>rk\t%0,%1,%2 |
3298c037 | 5785 | a<g>hi\t%0,%h2 |
65b1d8ea | 5786 | a<g>hik\t%0,%1,%h2 |
3298c037 AK |
5787 | al<g>fi\t%0,%2 |
5788 | sl<g>fi\t%0,%n2 | |
5789 | a<g>\t%0,%2 | |
963fc8d0 AK |
5790 | a<y>\t%0,%2 |
5791 | a<g>si\t%0,%c2" | |
65b1d8ea | 5792 | [(set_attr "op_type" "RR<E>,RRF,RI,RIE,RIL,RIL,RX<Y>,RXY,SIY") |
3e4be43f | 5793 | (set_attr "cpu_facility" "*,z196,*,z196,extimm,extimm,*,longdisp,z10") |
65b1d8ea AK |
5794 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,z10_super_E1,z10_super_E1, |
5795 | z10_super_E1,z10_super_E1,z10_super_E1")]) | |
0a3bdf9d | 5796 | |
65b1d8ea | 5797 | ; alr, alfi, slfi, al, aly, alrk, alhsik, algr, algfi, slgfi, alg, alsi, algsi, algrk, alghsik |
3298c037 | 5798 | (define_insn "*add<mode>3_carry1_cc" |
ae156f85 | 5799 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
5800 | (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0,0") |
5801 | (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T,C")) | |
07893d4f | 5802 | (match_dup 1))) |
65b1d8ea | 5803 | (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,d") |
3298c037 | 5804 | (plus:GPR (match_dup 1) (match_dup 2)))] |
c7453384 | 5805 | "s390_match_ccmode (insn, CCL1mode)" |
07893d4f | 5806 | "@ |
3298c037 | 5807 | al<g>r\t%0,%2 |
65b1d8ea | 5808 | al<g>rk\t%0,%1,%2 |
3298c037 AK |
5809 | al<g>fi\t%0,%2 |
5810 | sl<g>fi\t%0,%n2 | |
65b1d8ea | 5811 | al<g>hsik\t%0,%1,%h2 |
3298c037 | 5812 | al<g>\t%0,%2 |
963fc8d0 AK |
5813 | al<y>\t%0,%2 |
5814 | al<g>si\t%0,%c2" | |
65b1d8ea | 5815 | [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY") |
3e4be43f | 5816 | (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,longdisp,z10") |
65b1d8ea AK |
5817 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*, |
5818 | z10_super_E1,z10_super_E1,z10_super_E1")]) | |
07893d4f | 5819 | |
65b1d8ea | 5820 | ; alr, al, aly, algr, alg, alrk, algrk |
3298c037 | 5821 | (define_insn "*add<mode>3_carry1_cconly" |
ae156f85 | 5822 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
5823 | (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0") |
5824 | (match_operand:GPR 2 "general_operand" "d,d,R,T")) | |
07893d4f | 5825 | (match_dup 1))) |
65b1d8ea | 5826 | (clobber (match_scratch:GPR 0 "=d,d,d,d"))] |
c7453384 | 5827 | "s390_match_ccmode (insn, CCL1mode)" |
07893d4f | 5828 | "@ |
3298c037 | 5829 | al<g>r\t%0,%2 |
65b1d8ea | 5830 | al<g>rk\t%0,%1,%2 |
3298c037 AK |
5831 | al<g>\t%0,%2 |
5832 | al<y>\t%0,%2" | |
65b1d8ea | 5833 | [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY") |
3e4be43f | 5834 | (set_attr "cpu_facility" "*,z196,*,longdisp") |
65b1d8ea | 5835 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")]) |
07893d4f | 5836 | |
65b1d8ea | 5837 | ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik |
3298c037 | 5838 | (define_insn "*add<mode>3_carry2_cc" |
ae156f85 | 5839 | [(set (reg CC_REGNUM) |
3e4be43f UW |
5840 | (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0,0") |
5841 | (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T,C")) | |
07893d4f | 5842 | (match_dup 2))) |
3e4be43f | 5843 | (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,S") |
3298c037 | 5844 | (plus:GPR (match_dup 1) (match_dup 2)))] |
c7453384 | 5845 | "s390_match_ccmode (insn, CCL1mode)" |
07893d4f | 5846 | "@ |
3298c037 | 5847 | al<g>r\t%0,%2 |
65b1d8ea | 5848 | al<g>rk\t%0,%1,%2 |
3298c037 AK |
5849 | al<g>fi\t%0,%2 |
5850 | sl<g>fi\t%0,%n2 | |
65b1d8ea | 5851 | al<g>hsik\t%0,%1,%h2 |
3298c037 | 5852 | al<g>\t%0,%2 |
963fc8d0 AK |
5853 | al<y>\t%0,%2 |
5854 | al<g>si\t%0,%c2" | |
65b1d8ea | 5855 | [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY") |
3e4be43f | 5856 | (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,longdisp,z10") |
65b1d8ea AK |
5857 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1,*, |
5858 | z10_super_E1,z10_super_E1,z10_super_E1")]) | |
07893d4f | 5859 | |
65b1d8ea | 5860 | ; alr, al, aly, algr, alg, alrk, algrk |
3298c037 | 5861 | (define_insn "*add<mode>3_carry2_cconly" |
ae156f85 | 5862 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
5863 | (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0") |
5864 | (match_operand:GPR 2 "general_operand" "d,d,R,T")) | |
07893d4f | 5865 | (match_dup 2))) |
65b1d8ea | 5866 | (clobber (match_scratch:GPR 0 "=d,d,d,d"))] |
c7453384 | 5867 | "s390_match_ccmode (insn, CCL1mode)" |
07893d4f | 5868 | "@ |
3298c037 | 5869 | al<g>r\t%0,%2 |
65b1d8ea | 5870 | al<g>rk\t%0,%1,%2 |
3298c037 AK |
5871 | al<g>\t%0,%2 |
5872 | al<y>\t%0,%2" | |
65b1d8ea | 5873 | [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY") |
3e4be43f | 5874 | (set_attr "cpu_facility" "*,z196,*,longdisp") |
65b1d8ea | 5875 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")]) |
07893d4f | 5876 | |
65b1d8ea | 5877 | ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi, alrk, algrk, alhsik, alghsik |
3298c037 | 5878 | (define_insn "*add<mode>3_cc" |
ae156f85 | 5879 | [(set (reg CC_REGNUM) |
3e4be43f UW |
5880 | (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d, 0, 0,d,0,0,0") |
5881 | (match_operand:GPR 2 "general_operand" " d,d,Op,On,K,R,T,C")) | |
9db1d521 | 5882 | (const_int 0))) |
3e4be43f | 5883 | (set (match_operand:GPR 0 "nonimmediate_operand" "=d,d, d, d,d,d,d,S") |
3298c037 | 5884 | (plus:GPR (match_dup 1) (match_dup 2)))] |
c7453384 | 5885 | "s390_match_ccmode (insn, CCLmode)" |
9db1d521 | 5886 | "@ |
3298c037 | 5887 | al<g>r\t%0,%2 |
65b1d8ea | 5888 | al<g>rk\t%0,%1,%2 |
3298c037 AK |
5889 | al<g>fi\t%0,%2 |
5890 | sl<g>fi\t%0,%n2 | |
65b1d8ea | 5891 | al<g>hsik\t%0,%1,%h2 |
3298c037 | 5892 | al<g>\t%0,%2 |
963fc8d0 AK |
5893 | al<y>\t%0,%2 |
5894 | al<g>si\t%0,%c2" | |
65b1d8ea | 5895 | [(set_attr "op_type" "RR<E>,RRF,RIL,RIL,RIE,RX<Y>,RXY,SIY") |
3e4be43f | 5896 | (set_attr "cpu_facility" "*,z196,extimm,extimm,z196,*,longdisp,z10") |
65b1d8ea AK |
5897 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1, |
5898 | *,z10_super_E1,z10_super_E1,z10_super_E1")]) | |
9db1d521 | 5899 | |
65b1d8ea | 5900 | ; alr, al, aly, algr, alg, alrk, algrk |
3298c037 | 5901 | (define_insn "*add<mode>3_cconly" |
ae156f85 | 5902 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
5903 | (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0") |
5904 | (match_operand:GPR 2 "general_operand" "d,d,R,T")) | |
9db1d521 | 5905 | (const_int 0))) |
65b1d8ea | 5906 | (clobber (match_scratch:GPR 0 "=d,d,d,d"))] |
c7453384 | 5907 | "s390_match_ccmode (insn, CCLmode)" |
9db1d521 | 5908 | "@ |
3298c037 | 5909 | al<g>r\t%0,%2 |
65b1d8ea | 5910 | al<g>rk\t%0,%1,%2 |
3298c037 AK |
5911 | al<g>\t%0,%2 |
5912 | al<y>\t%0,%2" | |
65b1d8ea | 5913 | [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY") |
3e4be43f | 5914 | (set_attr "cpu_facility" "*,z196,*,longdisp") |
65b1d8ea | 5915 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")]) |
9db1d521 | 5916 | |
65b1d8ea | 5917 | ; alr, al, aly, algr, alg, alrk, algrk |
3298c037 | 5918 | (define_insn "*add<mode>3_cconly2" |
ae156f85 | 5919 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
5920 | (compare (match_operand:GPR 1 "nonimmediate_operand" "%0,d,0,0") |
5921 | (neg:GPR (match_operand:GPR 2 "general_operand" "d,d,R,T")))) | |
5922 | (clobber (match_scratch:GPR 0 "=d,d,d,d"))] | |
3298c037 | 5923 | "s390_match_ccmode(insn, CCLmode)" |
d3632d41 | 5924 | "@ |
3298c037 | 5925 | al<g>r\t%0,%2 |
65b1d8ea | 5926 | al<g>rk\t%0,%1,%2 |
3298c037 AK |
5927 | al<g>\t%0,%2 |
5928 | al<y>\t%0,%2" | |
65b1d8ea | 5929 | [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY") |
3e4be43f | 5930 | (set_attr "cpu_facility" "*,z196,*,longdisp") |
65b1d8ea | 5931 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")]) |
07893d4f | 5932 | |
963fc8d0 | 5933 | ; ahi, afi, aghi, agfi, asi, agsi |
3298c037 AK |
5934 | (define_insn "*add<mode>3_imm_cc" |
5935 | [(set (reg CC_REGNUM) | |
65b1d8ea | 5936 | (compare (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" " 0, d,0, 0") |
3e4be43f | 5937 | (match_operand:GPR 2 "const_int_operand" " K, K,Os,C")) |
3298c037 | 5938 | (const_int 0))) |
3e4be43f | 5939 | (set (match_operand:GPR 0 "nonimmediate_operand" "=d, d,d, S") |
3298c037 AK |
5940 | (plus:GPR (match_dup 1) (match_dup 2)))] |
5941 | "s390_match_ccmode (insn, CCAmode) | |
5942 | && (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'K', \"K\") | |
2542ef05 RH |
5943 | || (CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'O', \"Os\") |
5944 | /* Avoid INT32_MIN on 32 bit. */ | |
5945 | && (!TARGET_ZARCH || INTVAL (operands[2]) != -0x7fffffff - 1)))" | |
9db1d521 | 5946 | "@ |
3298c037 | 5947 | a<g>hi\t%0,%h2 |
65b1d8ea | 5948 | a<g>hik\t%0,%1,%h2 |
963fc8d0 AK |
5949 | a<g>fi\t%0,%2 |
5950 | a<g>si\t%0,%c2" | |
65b1d8ea AK |
5951 | [(set_attr "op_type" "RI,RIE,RIL,SIY") |
5952 | (set_attr "cpu_facility" "*,z196,extimm,z10") | |
5953 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")]) | |
9db1d521 | 5954 | |
7d2fd075 AK |
5955 | (define_insn "*adddi3_sign" |
5956 | [(set (match_operand:DI 0 "register_operand" "=d") | |
5957 | (plus:DI (sign_extend:DI (match_operand:HI 2 "memory_operand" "T")) | |
5958 | (match_operand:DI 1 "register_operand" "0"))) | |
5959 | (clobber (reg:CC CC_REGNUM))] | |
e9e8efc9 | 5960 | "TARGET_Z14" |
7d2fd075 AK |
5961 | "agh\t%0,%2" |
5962 | [(set_attr "op_type" "RXY")]) | |
5963 | ||
9db1d521 | 5964 | ; |
609e7e80 | 5965 | ; add(tf|df|sf|td|dd)3 instruction pattern(s). |
9db1d521 HP |
5966 | ; |
5967 | ||
609e7e80 | 5968 | ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr |
6e5b5de8 | 5969 | ; FIXME: wfadb does not clobber cc |
142cd70f | 5970 | (define_insn "add<mode>3" |
2de2b3f9 AK |
5971 | [(set (match_operand:FP 0 "register_operand" "=f,f,f,v,v") |
5972 | (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%f,0,0,v,v") | |
5973 | (match_operand:FP 2 "general_operand" "f,f,R,v,v"))) | |
ae156f85 | 5974 | (clobber (reg:CC CC_REGNUM))] |
142cd70f | 5975 | "TARGET_HARD_FLOAT" |
9db1d521 | 5976 | "@ |
62d3f261 AK |
5977 | a<xde>tr\t%0,%1,%2 |
5978 | a<xde>br\t%0,%2 | |
6e5b5de8 | 5979 | a<xde>b\t%0,%2 |
2de2b3f9 AK |
5980 | wfadb\t%v0,%v1,%v2 |
5981 | wfasb\t%v0,%v1,%v2" | |
5982 | [(set_attr "op_type" "RRF,RRE,RXE,VRR,VRR") | |
6e5b5de8 | 5983 | (set_attr "type" "fsimp<mode>") |
2de2b3f9 AK |
5984 | (set_attr "cpu_facility" "*,*,*,vx,vxe") |
5985 | (set_attr "enabled" "<nBFP>,<nDFP>,<DSF>,<DF>,<SF>")]) | |
9db1d521 | 5986 | |
609e7e80 | 5987 | ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr |
f5905b37 | 5988 | (define_insn "*add<mode>3_cc" |
ae156f85 | 5989 | [(set (reg CC_REGNUM) |
62d3f261 AK |
5990 | (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%f,0,0") |
5991 | (match_operand:FP 2 "general_operand" "f,f,R")) | |
609e7e80 | 5992 | (match_operand:FP 3 "const0_operand" ""))) |
62d3f261 | 5993 | (set (match_operand:FP 0 "register_operand" "=f,f,f") |
609e7e80 | 5994 | (plus:FP (match_dup 1) (match_dup 2)))] |
142cd70f | 5995 | "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT" |
3ef093a8 | 5996 | "@ |
62d3f261 AK |
5997 | a<xde>tr\t%0,%1,%2 |
5998 | a<xde>br\t%0,%2 | |
f61a2c7d | 5999 | a<xde>b\t%0,%2" |
62d3f261 AK |
6000 | [(set_attr "op_type" "RRF,RRE,RXE") |
6001 | (set_attr "type" "fsimp<mode>") | |
6002 | (set_attr "enabled" "<nBFP>,<nDFP>,<DSF>")]) | |
3ef093a8 | 6003 | |
609e7e80 | 6004 | ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr |
f5905b37 | 6005 | (define_insn "*add<mode>3_cconly" |
ae156f85 | 6006 | [(set (reg CC_REGNUM) |
62d3f261 AK |
6007 | (compare (plus:FP (match_operand:FP 1 "nonimmediate_operand" "%f,0,0") |
6008 | (match_operand:FP 2 "general_operand" "f,f,R")) | |
609e7e80 | 6009 | (match_operand:FP 3 "const0_operand" ""))) |
62d3f261 | 6010 | (clobber (match_scratch:FP 0 "=f,f,f"))] |
142cd70f | 6011 | "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT" |
3ef093a8 | 6012 | "@ |
62d3f261 AK |
6013 | a<xde>tr\t%0,%1,%2 |
6014 | a<xde>br\t%0,%2 | |
f61a2c7d | 6015 | a<xde>b\t%0,%2" |
62d3f261 AK |
6016 | [(set_attr "op_type" "RRF,RRE,RXE") |
6017 | (set_attr "type" "fsimp<mode>") | |
6018 | (set_attr "enabled" "<nBFP>,<nDFP>,<DSF>")]) | |
3ef093a8 | 6019 | |
72a4ddf2 AK |
6020 | ; |
6021 | ; Pointer add instruction patterns | |
6022 | ; | |
6023 | ||
6024 | ; This will match "*la_64" | |
6025 | (define_expand "addptrdi3" | |
6026 | [(set (match_operand:DI 0 "register_operand" "") | |
6027 | (plus:DI (match_operand:DI 1 "register_operand" "") | |
6028 | (match_operand:DI 2 "nonmemory_operand" "")))] | |
6029 | "TARGET_64BIT" | |
6030 | { | |
72a4ddf2 AK |
6031 | if (GET_CODE (operands[2]) == CONST_INT) |
6032 | { | |
357ddc7d TV |
6033 | HOST_WIDE_INT c = INTVAL (operands[2]); |
6034 | ||
72a4ddf2 AK |
6035 | if (!CONST_OK_FOR_CONSTRAINT_P (c, 'K', "K") |
6036 | && !CONST_OK_FOR_CONSTRAINT_P (c, 'O', "Os")) | |
6037 | { | |
6038 | operands[2] = force_const_mem (DImode, operands[2]); | |
6039 | operands[2] = force_reg (DImode, operands[2]); | |
6040 | } | |
6041 | else if (!DISP_IN_RANGE (INTVAL (operands[2]))) | |
6042 | operands[2] = force_reg (DImode, operands[2]); | |
6043 | } | |
6044 | }) | |
6045 | ||
6046 | ; For 31 bit we have to prevent the generated pattern from matching | |
6047 | ; normal ADDs since la only does a 31 bit add. This is supposed to | |
6048 | ; match "force_la_31". | |
6049 | (define_expand "addptrsi3" | |
6050 | [(parallel | |
6051 | [(set (match_operand:SI 0 "register_operand" "") | |
6052 | (plus:SI (match_operand:SI 1 "register_operand" "") | |
6053 | (match_operand:SI 2 "nonmemory_operand" ""))) | |
6054 | (use (const_int 0))])] | |
6055 | "!TARGET_64BIT" | |
6056 | { | |
72a4ddf2 AK |
6057 | if (GET_CODE (operands[2]) == CONST_INT) |
6058 | { | |
357ddc7d TV |
6059 | HOST_WIDE_INT c = INTVAL (operands[2]); |
6060 | ||
72a4ddf2 AK |
6061 | if (!CONST_OK_FOR_CONSTRAINT_P (c, 'K', "K") |
6062 | && !CONST_OK_FOR_CONSTRAINT_P (c, 'O', "Os")) | |
6063 | { | |
6064 | operands[2] = force_const_mem (SImode, operands[2]); | |
6065 | operands[2] = force_reg (SImode, operands[2]); | |
6066 | } | |
6067 | else if (!DISP_IN_RANGE (INTVAL (operands[2]))) | |
6068 | operands[2] = force_reg (SImode, operands[2]); | |
6069 | } | |
6070 | }) | |
9db1d521 HP |
6071 | |
6072 | ;; | |
6073 | ;;- Subtract instructions. | |
6074 | ;; | |
6075 | ||
1c7b1b7e UW |
6076 | ; |
6077 | ; subti3 instruction pattern(s). | |
6078 | ; | |
6079 | ||
085261c8 AK |
6080 | (define_expand "subti3" |
6081 | [(parallel | |
6082 | [(set (match_operand:TI 0 "register_operand" "") | |
6083 | (minus:TI (match_operand:TI 1 "register_operand" "") | |
6084 | (match_operand:TI 2 "general_operand" "") ) ) | |
6085 | (clobber (reg:CC CC_REGNUM))])] | |
6086 | "TARGET_ZARCH" | |
6087 | { | |
2d71f118 | 6088 | /* For z13 we have vsq which doesn't set CC. */ |
085261c8 AK |
6089 | if (TARGET_VX) |
6090 | { | |
6091 | emit_insn (gen_rtx_SET (operands[0], | |
6092 | gen_rtx_MINUS (TImode, | |
6093 | operands[1], | |
6094 | copy_to_mode_reg (TImode, operands[2])))); | |
6095 | DONE; | |
6096 | } | |
6097 | }) | |
6098 | ||
6099 | (define_insn_and_split "*subti3" | |
6100 | [(set (match_operand:TI 0 "register_operand" "=&d") | |
6101 | (minus:TI (match_operand:TI 1 "register_operand" "0") | |
6102 | (match_operand:TI 2 "general_operand" "do") ) ) | |
ae156f85 | 6103 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 6104 | "TARGET_ZARCH" |
1c7b1b7e UW |
6105 | "#" |
6106 | "&& reload_completed" | |
6107 | [(parallel | |
ae156f85 | 6108 | [(set (reg:CCL2 CC_REGNUM) |
1c7b1b7e UW |
6109 | (compare:CCL2 (minus:DI (match_dup 7) (match_dup 8)) |
6110 | (match_dup 7))) | |
6111 | (set (match_dup 6) (minus:DI (match_dup 7) (match_dup 8)))]) | |
6112 | (parallel | |
6113 | [(set (match_dup 3) (minus:DI (minus:DI (match_dup 4) (match_dup 5)) | |
ae156f85 AS |
6114 | (gtu:DI (reg:CCL2 CC_REGNUM) (const_int 0)))) |
6115 | (clobber (reg:CC CC_REGNUM))])] | |
1c7b1b7e UW |
6116 | "operands[3] = operand_subword (operands[0], 0, 0, TImode); |
6117 | operands[4] = operand_subword (operands[1], 0, 0, TImode); | |
6118 | operands[5] = operand_subword (operands[2], 0, 0, TImode); | |
6119 | operands[6] = operand_subword (operands[0], 1, 0, TImode); | |
6120 | operands[7] = operand_subword (operands[1], 1, 0, TImode); | |
085261c8 AK |
6121 | operands[8] = operand_subword (operands[2], 1, 0, TImode);" |
6122 | [(set_attr "op_type" "*") | |
6123 | (set_attr "cpu_facility" "*")]) | |
1c7b1b7e | 6124 | |
9db1d521 HP |
6125 | ; |
6126 | ; subdi3 instruction pattern(s). | |
6127 | ; | |
6128 | ||
3298c037 AK |
6129 | (define_expand "subdi3" |
6130 | [(parallel | |
6131 | [(set (match_operand:DI 0 "register_operand" "") | |
6132 | (minus:DI (match_operand:DI 1 "register_operand" "") | |
6133 | (match_operand:DI 2 "general_operand" ""))) | |
6134 | (clobber (reg:CC CC_REGNUM))])] | |
6135 | "" | |
6136 | "") | |
6137 | ||
07893d4f UW |
6138 | (define_insn "*subdi3_sign" |
6139 | [(set (match_operand:DI 0 "register_operand" "=d,d") | |
6140 | (minus:DI (match_operand:DI 1 "register_operand" "0,0") | |
3e4be43f | 6141 | (sign_extend:DI (match_operand:SI 2 "general_operand" "d,T")))) |
ae156f85 | 6142 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 6143 | "TARGET_ZARCH" |
07893d4f | 6144 | "@ |
d40c829f UW |
6145 | sgfr\t%0,%2 |
6146 | sgf\t%0,%2" | |
9381e3f1 | 6147 | [(set_attr "op_type" "RRE,RXY") |
65b1d8ea AK |
6148 | (set_attr "z10prop" "z10_c,*") |
6149 | (set_attr "z196prop" "z196_cracked")]) | |
07893d4f UW |
6150 | |
6151 | (define_insn "*subdi3_zero_cc" | |
ae156f85 | 6152 | [(set (reg CC_REGNUM) |
07893d4f | 6153 | (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0") |
3e4be43f | 6154 | (zero_extend:DI (match_operand:SI 2 "general_operand" "d,T"))) |
07893d4f UW |
6155 | (const_int 0))) |
6156 | (set (match_operand:DI 0 "register_operand" "=d,d") | |
6157 | (minus:DI (match_dup 1) (zero_extend:DI (match_dup 2))))] | |
9602b6a1 | 6158 | "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH" |
07893d4f | 6159 | "@ |
d40c829f UW |
6160 | slgfr\t%0,%2 |
6161 | slgf\t%0,%2" | |
9381e3f1 WG |
6162 | [(set_attr "op_type" "RRE,RXY") |
6163 | (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")]) | |
07893d4f UW |
6164 | |
6165 | (define_insn "*subdi3_zero_cconly" | |
ae156f85 | 6166 | [(set (reg CC_REGNUM) |
07893d4f | 6167 | (compare (minus:DI (match_operand:DI 1 "register_operand" "0,0") |
3e4be43f | 6168 | (zero_extend:DI (match_operand:SI 2 "general_operand" "d,T"))) |
07893d4f UW |
6169 | (const_int 0))) |
6170 | (clobber (match_scratch:DI 0 "=d,d"))] | |
9602b6a1 | 6171 | "s390_match_ccmode (insn, CCLmode) && TARGET_ZARCH" |
07893d4f | 6172 | "@ |
d40c829f UW |
6173 | slgfr\t%0,%2 |
6174 | slgf\t%0,%2" | |
9381e3f1 WG |
6175 | [(set_attr "op_type" "RRE,RXY") |
6176 | (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")]) | |
07893d4f UW |
6177 | |
6178 | (define_insn "*subdi3_zero" | |
6179 | [(set (match_operand:DI 0 "register_operand" "=d,d") | |
6180 | (minus:DI (match_operand:DI 1 "register_operand" "0,0") | |
3e4be43f | 6181 | (zero_extend:DI (match_operand:SI 2 "general_operand" "d,T")))) |
ae156f85 | 6182 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 6183 | "TARGET_ZARCH" |
07893d4f | 6184 | "@ |
d40c829f UW |
6185 | slgfr\t%0,%2 |
6186 | slgf\t%0,%2" | |
9381e3f1 WG |
6187 | [(set_attr "op_type" "RRE,RXY") |
6188 | (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")]) | |
07893d4f | 6189 | |
e69166de UW |
6190 | (define_insn_and_split "*subdi3_31z" |
6191 | [(set (match_operand:DI 0 "register_operand" "=&d") | |
6192 | (minus:DI (match_operand:DI 1 "register_operand" "0") | |
6193 | (match_operand:DI 2 "general_operand" "do") ) ) | |
ae156f85 | 6194 | (clobber (reg:CC CC_REGNUM))] |
8cc6307c | 6195 | "!TARGET_ZARCH" |
e69166de UW |
6196 | "#" |
6197 | "&& reload_completed" | |
6198 | [(parallel | |
ae156f85 | 6199 | [(set (reg:CCL2 CC_REGNUM) |
e69166de UW |
6200 | (compare:CCL2 (minus:SI (match_dup 7) (match_dup 8)) |
6201 | (match_dup 7))) | |
6202 | (set (match_dup 6) (minus:SI (match_dup 7) (match_dup 8)))]) | |
6203 | (parallel | |
6204 | [(set (match_dup 3) (minus:SI (minus:SI (match_dup 4) (match_dup 5)) | |
ae156f85 AS |
6205 | (gtu:SI (reg:CCL2 CC_REGNUM) (const_int 0)))) |
6206 | (clobber (reg:CC CC_REGNUM))])] | |
e69166de UW |
6207 | "operands[3] = operand_subword (operands[0], 0, 0, DImode); |
6208 | operands[4] = operand_subword (operands[1], 0, 0, DImode); | |
6209 | operands[5] = operand_subword (operands[2], 0, 0, DImode); | |
6210 | operands[6] = operand_subword (operands[0], 1, 0, DImode); | |
6211 | operands[7] = operand_subword (operands[1], 1, 0, DImode); | |
b628bd8e | 6212 | operands[8] = operand_subword (operands[2], 1, 0, DImode);") |
e69166de | 6213 | |
3298c037 AK |
6214 | ; |
6215 | ; subsi3 instruction pattern(s). | |
6216 | ; | |
6217 | ||
6218 | (define_expand "subsi3" | |
07893d4f | 6219 | [(parallel |
3298c037 AK |
6220 | [(set (match_operand:SI 0 "register_operand" "") |
6221 | (minus:SI (match_operand:SI 1 "register_operand" "") | |
6222 | (match_operand:SI 2 "general_operand" ""))) | |
ae156f85 | 6223 | (clobber (reg:CC CC_REGNUM))])] |
9db1d521 | 6224 | "" |
07893d4f | 6225 | "") |
9db1d521 | 6226 | |
3298c037 AK |
6227 | (define_insn "*subsi3_sign" |
6228 | [(set (match_operand:SI 0 "register_operand" "=d,d") | |
6229 | (minus:SI (match_operand:SI 1 "register_operand" "0,0") | |
6230 | (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T")))) | |
6231 | (clobber (reg:CC CC_REGNUM))] | |
6232 | "" | |
6233 | "@ | |
6234 | sh\t%0,%2 | |
6235 | shy\t%0,%2" | |
65b1d8ea | 6236 | [(set_attr "op_type" "RX,RXY") |
3e4be43f | 6237 | (set_attr "cpu_facility" "*,longdisp") |
65b1d8ea | 6238 | (set_attr "z196prop" "z196_cracked,z196_cracked")]) |
3298c037 | 6239 | |
9db1d521 | 6240 | ; |
3298c037 | 6241 | ; sub(di|si)3 instruction pattern(s). |
9db1d521 HP |
6242 | ; |
6243 | ||
65b1d8ea | 6244 | ; sr, s, sy, sgr, sg, srk, sgrk |
3298c037 | 6245 | (define_insn "*sub<mode>3" |
65b1d8ea AK |
6246 | [(set (match_operand:GPR 0 "register_operand" "=d,d,d,d") |
6247 | (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0") | |
6248 | (match_operand:GPR 2 "general_operand" "d,d,R,T") ) ) | |
3298c037 AK |
6249 | (clobber (reg:CC CC_REGNUM))] |
6250 | "" | |
6251 | "@ | |
6252 | s<g>r\t%0,%2 | |
65b1d8ea | 6253 | s<g>rk\t%0,%1,%2 |
3298c037 AK |
6254 | s<g>\t%0,%2 |
6255 | s<y>\t%0,%2" | |
65b1d8ea | 6256 | [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY") |
3e4be43f | 6257 | (set_attr "cpu_facility" "*,z196,*,longdisp") |
65b1d8ea | 6258 | (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")]) |
3298c037 | 6259 | |
65b1d8ea | 6260 | ; slr, sl, sly, slgr, slg, slrk, slgrk |
3298c037 | 6261 | (define_insn "*sub<mode>3_borrow_cc" |
ae156f85 | 6262 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
6263 | (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0") |
6264 | (match_operand:GPR 2 "general_operand" "d,d,R,T")) | |
07893d4f | 6265 | (match_dup 1))) |
65b1d8ea | 6266 | (set (match_operand:GPR 0 "register_operand" "=d,d,d,d") |
3298c037 | 6267 | (minus:GPR (match_dup 1) (match_dup 2)))] |
b2ba71ca | 6268 | "s390_match_ccmode (insn, CCL2mode)" |
07893d4f | 6269 | "@ |
3298c037 | 6270 | sl<g>r\t%0,%2 |
65b1d8ea | 6271 | sl<g>rk\t%0,%1,%2 |
3298c037 AK |
6272 | sl<g>\t%0,%2 |
6273 | sl<y>\t%0,%2" | |
65b1d8ea | 6274 | [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY") |
3e4be43f | 6275 | (set_attr "cpu_facility" "*,z196,*,longdisp") |
65b1d8ea | 6276 | (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")]) |
07893d4f | 6277 | |
65b1d8ea | 6278 | ; slr, sl, sly, slgr, slg, slrk, slgrk |
3298c037 | 6279 | (define_insn "*sub<mode>3_borrow_cconly" |
ae156f85 | 6280 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
6281 | (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0") |
6282 | (match_operand:GPR 2 "general_operand" "d,d,R,T")) | |
07893d4f | 6283 | (match_dup 1))) |
65b1d8ea | 6284 | (clobber (match_scratch:GPR 0 "=d,d,d,d"))] |
b2ba71ca | 6285 | "s390_match_ccmode (insn, CCL2mode)" |
07893d4f | 6286 | "@ |
3298c037 | 6287 | sl<g>r\t%0,%2 |
65b1d8ea | 6288 | sl<g>rk\t%0,%1,%2 |
3298c037 AK |
6289 | sl<g>\t%0,%2 |
6290 | sl<y>\t%0,%2" | |
65b1d8ea | 6291 | [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY") |
3e4be43f | 6292 | (set_attr "cpu_facility" "*,z196,*,longdisp") |
65b1d8ea | 6293 | (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")]) |
07893d4f | 6294 | |
65b1d8ea | 6295 | ; slr, sl, sly, slgr, slg, slrk, slgrk |
3298c037 | 6296 | (define_insn "*sub<mode>3_cc" |
ae156f85 | 6297 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
6298 | (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0") |
6299 | (match_operand:GPR 2 "general_operand" "d,d,R,T")) | |
9db1d521 | 6300 | (const_int 0))) |
65b1d8ea | 6301 | (set (match_operand:GPR 0 "register_operand" "=d,d,d,d") |
3298c037 | 6302 | (minus:GPR (match_dup 1) (match_dup 2)))] |
b2ba71ca | 6303 | "s390_match_ccmode (insn, CCLmode)" |
9db1d521 | 6304 | "@ |
3298c037 | 6305 | sl<g>r\t%0,%2 |
65b1d8ea | 6306 | sl<g>rk\t%0,%1,%2 |
3298c037 AK |
6307 | sl<g>\t%0,%2 |
6308 | sl<y>\t%0,%2" | |
65b1d8ea | 6309 | [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY") |
3e4be43f | 6310 | (set_attr "cpu_facility" "*,z196,*,longdisp") |
65b1d8ea | 6311 | (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")]) |
9db1d521 | 6312 | |
65b1d8ea | 6313 | ; slr, sl, sly, slgr, slg, slrk, slgrk |
3298c037 | 6314 | (define_insn "*sub<mode>3_cc2" |
ae156f85 | 6315 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
6316 | (compare (match_operand:GPR 1 "register_operand" "0,d,0,0") |
6317 | (match_operand:GPR 2 "general_operand" "d,d,R,T"))) | |
6318 | (set (match_operand:GPR 0 "register_operand" "=d,d,d,d") | |
3298c037 | 6319 | (minus:GPR (match_dup 1) (match_dup 2)))] |
5d880bd2 UW |
6320 | "s390_match_ccmode (insn, CCL3mode)" |
6321 | "@ | |
3298c037 | 6322 | sl<g>r\t%0,%2 |
65b1d8ea | 6323 | sl<g>rk\t%0,%1,%2 |
3298c037 AK |
6324 | sl<g>\t%0,%2 |
6325 | sl<y>\t%0,%2" | |
65b1d8ea | 6326 | [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY") |
3e4be43f | 6327 | (set_attr "cpu_facility" "*,z196,*,longdisp") |
65b1d8ea | 6328 | (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")]) |
5d880bd2 | 6329 | |
65b1d8ea | 6330 | ; slr, sl, sly, slgr, slg, slrk, slgrk |
3298c037 | 6331 | (define_insn "*sub<mode>3_cconly" |
ae156f85 | 6332 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
6333 | (compare (minus:GPR (match_operand:GPR 1 "register_operand" "0,d,0,0") |
6334 | (match_operand:GPR 2 "general_operand" "d,d,R,T")) | |
9db1d521 | 6335 | (const_int 0))) |
65b1d8ea | 6336 | (clobber (match_scratch:GPR 0 "=d,d,d,d"))] |
b2ba71ca | 6337 | "s390_match_ccmode (insn, CCLmode)" |
9db1d521 | 6338 | "@ |
3298c037 | 6339 | sl<g>r\t%0,%2 |
65b1d8ea | 6340 | sl<g>rk\t%0,%1,%2 |
3298c037 AK |
6341 | sl<g>\t%0,%2 |
6342 | sl<y>\t%0,%2" | |
65b1d8ea | 6343 | [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY") |
3e4be43f | 6344 | (set_attr "cpu_facility" "*,z196,*,longdisp") |
65b1d8ea | 6345 | (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")]) |
9381e3f1 | 6346 | |
9db1d521 | 6347 | |
65b1d8ea | 6348 | ; slr, sl, sly, slgr, slg, slrk, slgrk |
3298c037 | 6349 | (define_insn "*sub<mode>3_cconly2" |
ae156f85 | 6350 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
6351 | (compare (match_operand:GPR 1 "register_operand" "0,d,0,0") |
6352 | (match_operand:GPR 2 "general_operand" "d,d,R,T"))) | |
6353 | (clobber (match_scratch:GPR 0 "=d,d,d,d"))] | |
5d880bd2 UW |
6354 | "s390_match_ccmode (insn, CCL3mode)" |
6355 | "@ | |
3298c037 | 6356 | sl<g>r\t%0,%2 |
65b1d8ea | 6357 | sl<g>rk\t%0,%1,%2 |
3298c037 AK |
6358 | sl<g>\t%0,%2 |
6359 | sl<y>\t%0,%2" | |
65b1d8ea | 6360 | [(set_attr "op_type" "RR<E>,RRF,RX<Y>,RXY") |
3e4be43f | 6361 | (set_attr "cpu_facility" "*,z196,*,longdisp") |
65b1d8ea | 6362 | (set_attr "z10prop" "z10_super_c_E1,*,z10_super_E1,z10_super_E1")]) |
9381e3f1 | 6363 | |
7d2fd075 AK |
6364 | (define_insn "*subdi3_sign" |
6365 | [(set (match_operand:DI 0 "register_operand" "=d") | |
6366 | (minus:DI (match_operand:DI 1 "register_operand" "0") | |
6367 | (sign_extend:DI (match_operand:HI 2 "memory_operand" "T")))) | |
6368 | (clobber (reg:CC CC_REGNUM))] | |
e9e8efc9 | 6369 | "TARGET_Z14" |
7d2fd075 AK |
6370 | "sgh\t%0,%2" |
6371 | [(set_attr "op_type" "RXY")]) | |
6372 | ||
9db1d521 HP |
6373 | |
6374 | ; | |
609e7e80 | 6375 | ; sub(tf|df|sf|td|dd)3 instruction pattern(s). |
9db1d521 HP |
6376 | ; |
6377 | ||
2de2b3f9 | 6378 | ; FIXME: (clobber (match_scratch:CC 3 "=c,c,c,X,X")) does not work - why? |
d46f24b6 | 6379 | ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr |
142cd70f | 6380 | (define_insn "sub<mode>3" |
2de2b3f9 AK |
6381 | [(set (match_operand:FP 0 "register_operand" "=f,f,f,v,v") |
6382 | (minus:FP (match_operand:FP 1 "register_operand" "f,0,0,v,v") | |
6383 | (match_operand:FP 2 "general_operand" "f,f,R,v,v"))) | |
ae156f85 | 6384 | (clobber (reg:CC CC_REGNUM))] |
142cd70f | 6385 | "TARGET_HARD_FLOAT" |
9db1d521 | 6386 | "@ |
62d3f261 AK |
6387 | s<xde>tr\t%0,%1,%2 |
6388 | s<xde>br\t%0,%2 | |
6e5b5de8 | 6389 | s<xde>b\t%0,%2 |
2de2b3f9 AK |
6390 | wfsdb\t%v0,%v1,%v2 |
6391 | wfssb\t%v0,%v1,%v2" | |
6392 | [(set_attr "op_type" "RRF,RRE,RXE,VRR,VRR") | |
6e5b5de8 | 6393 | (set_attr "type" "fsimp<mode>") |
2de2b3f9 AK |
6394 | (set_attr "cpu_facility" "*,*,*,vx,vxe") |
6395 | (set_attr "enabled" "<nBFP>,<nDFP>,<DSF>,<DF>,<SF>")]) | |
9db1d521 | 6396 | |
d46f24b6 | 6397 | ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr |
f5905b37 | 6398 | (define_insn "*sub<mode>3_cc" |
ae156f85 | 6399 | [(set (reg CC_REGNUM) |
62d3f261 | 6400 | (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "f,0,0") |
2de2b3f9 | 6401 | (match_operand:FP 2 "general_operand" "f,f,R")) |
609e7e80 | 6402 | (match_operand:FP 3 "const0_operand" ""))) |
62d3f261 | 6403 | (set (match_operand:FP 0 "register_operand" "=f,f,f") |
609e7e80 | 6404 | (minus:FP (match_dup 1) (match_dup 2)))] |
142cd70f | 6405 | "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT" |
3ef093a8 | 6406 | "@ |
62d3f261 AK |
6407 | s<xde>tr\t%0,%1,%2 |
6408 | s<xde>br\t%0,%2 | |
f61a2c7d | 6409 | s<xde>b\t%0,%2" |
62d3f261 AK |
6410 | [(set_attr "op_type" "RRF,RRE,RXE") |
6411 | (set_attr "type" "fsimp<mode>") | |
6412 | (set_attr "enabled" "<nBFP>,<nDFP>,<DSF>")]) | |
3ef093a8 | 6413 | |
d46f24b6 | 6414 | ; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr |
f5905b37 | 6415 | (define_insn "*sub<mode>3_cconly" |
ae156f85 | 6416 | [(set (reg CC_REGNUM) |
62d3f261 AK |
6417 | (compare (minus:FP (match_operand:FP 1 "nonimmediate_operand" "f,0,0") |
6418 | (match_operand:FP 2 "general_operand" "f,f,R")) | |
609e7e80 | 6419 | (match_operand:FP 3 "const0_operand" ""))) |
62d3f261 | 6420 | (clobber (match_scratch:FP 0 "=f,f,f"))] |
142cd70f | 6421 | "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT" |
3ef093a8 | 6422 | "@ |
62d3f261 AK |
6423 | s<xde>tr\t%0,%1,%2 |
6424 | s<xde>br\t%0,%2 | |
f61a2c7d | 6425 | s<xde>b\t%0,%2" |
62d3f261 AK |
6426 | [(set_attr "op_type" "RRF,RRE,RXE") |
6427 | (set_attr "type" "fsimp<mode>") | |
6428 | (set_attr "enabled" "<nBFP>,<nDFP>,<DSF>")]) | |
3ef093a8 | 6429 | |
9db1d521 | 6430 | |
e69166de UW |
6431 | ;; |
6432 | ;;- Conditional add/subtract instructions. | |
6433 | ;; | |
6434 | ||
6435 | ; | |
9a91a21f | 6436 | ; add(di|si)cc instruction pattern(s). |
e69166de UW |
6437 | ; |
6438 | ||
a996720c UW |
6439 | ; the following 4 patterns are used when the result of an add with |
6440 | ; carry is checked for an overflow condition | |
6441 | ||
6442 | ; op1 + op2 + c < op1 | |
6443 | ||
6444 | ; alcr, alc, alcgr, alcg | |
6445 | (define_insn "*add<mode>3_alc_carry1_cc" | |
6446 | [(set (reg CC_REGNUM) | |
6447 | (compare | |
6448 | (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "") | |
6449 | (match_operand:GPR 1 "nonimmediate_operand" "%0,0")) | |
3e4be43f | 6450 | (match_operand:GPR 2 "general_operand" "d,T")) |
a996720c UW |
6451 | (match_dup 1))) |
6452 | (set (match_operand:GPR 0 "register_operand" "=d,d") | |
6453 | (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))] | |
8cc6307c | 6454 | "s390_match_ccmode (insn, CCL1mode)" |
a996720c UW |
6455 | "@ |
6456 | alc<g>r\t%0,%2 | |
6457 | alc<g>\t%0,%2" | |
65b1d8ea AK |
6458 | [(set_attr "op_type" "RRE,RXY") |
6459 | (set_attr "z196prop" "z196_alone,z196_alone")]) | |
a996720c UW |
6460 | |
6461 | ; alcr, alc, alcgr, alcg | |
6462 | (define_insn "*add<mode>3_alc_carry1_cconly" | |
6463 | [(set (reg CC_REGNUM) | |
6464 | (compare | |
6465 | (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "") | |
6466 | (match_operand:GPR 1 "nonimmediate_operand" "%0,0")) | |
3e4be43f | 6467 | (match_operand:GPR 2 "general_operand" "d,T")) |
a996720c UW |
6468 | (match_dup 1))) |
6469 | (clobber (match_scratch:GPR 0 "=d,d"))] | |
8cc6307c | 6470 | "s390_match_ccmode (insn, CCL1mode)" |
a996720c UW |
6471 | "@ |
6472 | alc<g>r\t%0,%2 | |
6473 | alc<g>\t%0,%2" | |
65b1d8ea AK |
6474 | [(set_attr "op_type" "RRE,RXY") |
6475 | (set_attr "z196prop" "z196_alone,z196_alone")]) | |
a996720c UW |
6476 | |
6477 | ; op1 + op2 + c < op2 | |
6478 | ||
6479 | ; alcr, alc, alcgr, alcg | |
6480 | (define_insn "*add<mode>3_alc_carry2_cc" | |
6481 | [(set (reg CC_REGNUM) | |
6482 | (compare | |
6483 | (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "") | |
6484 | (match_operand:GPR 1 "nonimmediate_operand" "%0,0")) | |
3e4be43f | 6485 | (match_operand:GPR 2 "general_operand" "d,T")) |
a996720c UW |
6486 | (match_dup 2))) |
6487 | (set (match_operand:GPR 0 "register_operand" "=d,d") | |
6488 | (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))] | |
8cc6307c | 6489 | "s390_match_ccmode (insn, CCL1mode)" |
a996720c UW |
6490 | "@ |
6491 | alc<g>r\t%0,%2 | |
6492 | alc<g>\t%0,%2" | |
6493 | [(set_attr "op_type" "RRE,RXY")]) | |
6494 | ||
6495 | ; alcr, alc, alcgr, alcg | |
6496 | (define_insn "*add<mode>3_alc_carry2_cconly" | |
6497 | [(set (reg CC_REGNUM) | |
6498 | (compare | |
6499 | (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "") | |
6500 | (match_operand:GPR 1 "nonimmediate_operand" "%0,0")) | |
3e4be43f | 6501 | (match_operand:GPR 2 "general_operand" "d,T")) |
a996720c UW |
6502 | (match_dup 2))) |
6503 | (clobber (match_scratch:GPR 0 "=d,d"))] | |
8cc6307c | 6504 | "s390_match_ccmode (insn, CCL1mode)" |
a996720c UW |
6505 | "@ |
6506 | alc<g>r\t%0,%2 | |
6507 | alc<g>\t%0,%2" | |
6508 | [(set_attr "op_type" "RRE,RXY")]) | |
6509 | ||
43a09b63 | 6510 | ; alcr, alc, alcgr, alcg |
9a91a21f | 6511 | (define_insn "*add<mode>3_alc_cc" |
ae156f85 | 6512 | [(set (reg CC_REGNUM) |
e69166de | 6513 | (compare |
a94a76a7 UW |
6514 | (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "") |
6515 | (match_operand:GPR 1 "nonimmediate_operand" "%0,0")) | |
3e4be43f | 6516 | (match_operand:GPR 2 "general_operand" "d,T")) |
e69166de | 6517 | (const_int 0))) |
9a91a21f | 6518 | (set (match_operand:GPR 0 "register_operand" "=d,d") |
a94a76a7 | 6519 | (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))] |
8cc6307c | 6520 | "s390_match_ccmode (insn, CCLmode)" |
e69166de | 6521 | "@ |
9a91a21f AS |
6522 | alc<g>r\t%0,%2 |
6523 | alc<g>\t%0,%2" | |
e69166de UW |
6524 | [(set_attr "op_type" "RRE,RXY")]) |
6525 | ||
43a09b63 | 6526 | ; alcr, alc, alcgr, alcg |
9a91a21f AS |
6527 | (define_insn "*add<mode>3_alc" |
6528 | [(set (match_operand:GPR 0 "register_operand" "=d,d") | |
a94a76a7 UW |
6529 | (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "") |
6530 | (match_operand:GPR 1 "nonimmediate_operand" "%0,0")) | |
3e4be43f | 6531 | (match_operand:GPR 2 "general_operand" "d,T"))) |
ae156f85 | 6532 | (clobber (reg:CC CC_REGNUM))] |
8cc6307c | 6533 | "" |
e69166de | 6534 | "@ |
9a91a21f AS |
6535 | alc<g>r\t%0,%2 |
6536 | alc<g>\t%0,%2" | |
e69166de UW |
6537 | [(set_attr "op_type" "RRE,RXY")]) |
6538 | ||
43a09b63 | 6539 | ; slbr, slb, slbgr, slbg |
9a91a21f | 6540 | (define_insn "*sub<mode>3_slb_cc" |
ae156f85 | 6541 | [(set (reg CC_REGNUM) |
e69166de | 6542 | (compare |
9a91a21f | 6543 | (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0") |
3e4be43f | 6544 | (match_operand:GPR 2 "general_operand" "d,T")) |
9a91a21f | 6545 | (match_operand:GPR 3 "s390_slb_comparison" "")) |
e69166de | 6546 | (const_int 0))) |
9a91a21f AS |
6547 | (set (match_operand:GPR 0 "register_operand" "=d,d") |
6548 | (minus:GPR (minus:GPR (match_dup 1) (match_dup 2)) (match_dup 3)))] | |
8cc6307c | 6549 | "s390_match_ccmode (insn, CCLmode)" |
e69166de | 6550 | "@ |
9a91a21f AS |
6551 | slb<g>r\t%0,%2 |
6552 | slb<g>\t%0,%2" | |
9381e3f1 WG |
6553 | [(set_attr "op_type" "RRE,RXY") |
6554 | (set_attr "z10prop" "z10_c,*")]) | |
e69166de | 6555 | |
43a09b63 | 6556 | ; slbr, slb, slbgr, slbg |
9a91a21f AS |
6557 | (define_insn "*sub<mode>3_slb" |
6558 | [(set (match_operand:GPR 0 "register_operand" "=d,d") | |
6559 | (minus:GPR (minus:GPR (match_operand:GPR 1 "nonimmediate_operand" "0,0") | |
3e4be43f | 6560 | (match_operand:GPR 2 "general_operand" "d,T")) |
9a91a21f | 6561 | (match_operand:GPR 3 "s390_slb_comparison" ""))) |
ae156f85 | 6562 | (clobber (reg:CC CC_REGNUM))] |
8cc6307c | 6563 | "" |
e69166de | 6564 | "@ |
9a91a21f AS |
6565 | slb<g>r\t%0,%2 |
6566 | slb<g>\t%0,%2" | |
9381e3f1 WG |
6567 | [(set_attr "op_type" "RRE,RXY") |
6568 | (set_attr "z10prop" "z10_c,*")]) | |
e69166de | 6569 | |
9a91a21f AS |
6570 | (define_expand "add<mode>cc" |
6571 | [(match_operand:GPR 0 "register_operand" "") | |
5d880bd2 | 6572 | (match_operand 1 "comparison_operator" "") |
9a91a21f AS |
6573 | (match_operand:GPR 2 "register_operand" "") |
6574 | (match_operand:GPR 3 "const_int_operand" "")] | |
8cc6307c | 6575 | "" |
9381e3f1 | 6576 | "if (!s390_expand_addcc (GET_CODE (operands[1]), |
f90b7a5a | 6577 | XEXP (operands[1], 0), XEXP (operands[1], 1), |
9381e3f1 | 6578 | operands[0], operands[2], |
5d880bd2 UW |
6579 | operands[3])) FAIL; DONE;") |
6580 | ||
6581 | ; | |
6582 | ; scond instruction pattern(s). | |
6583 | ; | |
6584 | ||
9a91a21f AS |
6585 | (define_insn_and_split "*scond<mode>" |
6586 | [(set (match_operand:GPR 0 "register_operand" "=&d") | |
6587 | (match_operand:GPR 1 "s390_alc_comparison" "")) | |
ae156f85 | 6588 | (clobber (reg:CC CC_REGNUM))] |
8cc6307c | 6589 | "" |
5d880bd2 UW |
6590 | "#" |
6591 | "&& reload_completed" | |
6592 | [(set (match_dup 0) (const_int 0)) | |
6593 | (parallel | |
a94a76a7 UW |
6594 | [(set (match_dup 0) (plus:GPR (plus:GPR (match_dup 1) (match_dup 0)) |
6595 | (match_dup 0))) | |
ae156f85 | 6596 | (clobber (reg:CC CC_REGNUM))])] |
b628bd8e | 6597 | "") |
5d880bd2 | 6598 | |
9a91a21f AS |
6599 | (define_insn_and_split "*scond<mode>_neg" |
6600 | [(set (match_operand:GPR 0 "register_operand" "=&d") | |
6601 | (match_operand:GPR 1 "s390_slb_comparison" "")) | |
ae156f85 | 6602 | (clobber (reg:CC CC_REGNUM))] |
8cc6307c | 6603 | "" |
5d880bd2 UW |
6604 | "#" |
6605 | "&& reload_completed" | |
6606 | [(set (match_dup 0) (const_int 0)) | |
6607 | (parallel | |
9a91a21f AS |
6608 | [(set (match_dup 0) (minus:GPR (minus:GPR (match_dup 0) (match_dup 0)) |
6609 | (match_dup 1))) | |
ae156f85 | 6610 | (clobber (reg:CC CC_REGNUM))]) |
5d880bd2 | 6611 | (parallel |
9a91a21f | 6612 | [(set (match_dup 0) (neg:GPR (match_dup 0))) |
ae156f85 | 6613 | (clobber (reg:CC CC_REGNUM))])] |
b628bd8e | 6614 | "") |
5d880bd2 | 6615 | |
5d880bd2 | 6616 | |
f90b7a5a | 6617 | (define_expand "cstore<mode>4" |
9a91a21f | 6618 | [(set (match_operand:SI 0 "register_operand" "") |
f90b7a5a PB |
6619 | (match_operator:SI 1 "s390_scond_operator" |
6620 | [(match_operand:GPR 2 "register_operand" "") | |
6621 | (match_operand:GPR 3 "general_operand" "")]))] | |
8cc6307c | 6622 | "" |
f90b7a5a | 6623 | "if (!s390_expand_addcc (GET_CODE (operands[1]), operands[2], operands[3], |
5d880bd2 UW |
6624 | operands[0], const0_rtx, const1_rtx)) FAIL; DONE;") |
6625 | ||
f90b7a5a | 6626 | (define_expand "cstorecc4" |
69950452 | 6627 | [(parallel |
f90b7a5a PB |
6628 | [(set (match_operand:SI 0 "register_operand" "") |
6629 | (match_operator:SI 1 "s390_eqne_operator" | |
3ea685e7 | 6630 | [(match_operand 2 "cc_reg_operand") |
f90b7a5a | 6631 | (match_operand 3 "const0_operand")])) |
69950452 AS |
6632 | (clobber (reg:CC CC_REGNUM))])] |
6633 | "" | |
3ea685e7 DV |
6634 | "machine_mode mode = GET_MODE (operands[2]); |
6635 | if (TARGET_Z196) | |
6636 | { | |
6637 | rtx cond, ite; | |
6638 | ||
6639 | if (GET_CODE (operands[1]) == NE) | |
6640 | cond = gen_rtx_NE (VOIDmode, operands[2], const0_rtx); | |
6641 | else | |
6642 | cond = gen_rtx_EQ (VOIDmode, operands[2], const0_rtx); | |
6643 | ite = gen_rtx_IF_THEN_ELSE (SImode, cond, const1_rtx, const0_rtx); | |
6644 | emit_insn (gen_rtx_SET (operands[0], ite)); | |
6645 | } | |
6646 | else | |
6647 | { | |
6648 | if (mode != CCZ1mode) | |
6649 | FAIL; | |
6650 | emit_insn (gen_sne (operands[0], operands[2])); | |
6651 | if (GET_CODE (operands[1]) == EQ) | |
6652 | emit_insn (gen_xorsi3 (operands[0], operands[0], const1_rtx)); | |
6653 | } | |
f90b7a5a | 6654 | DONE;") |
69950452 | 6655 | |
f90b7a5a | 6656 | (define_insn_and_split "sne" |
69950452 | 6657 | [(set (match_operand:SI 0 "register_operand" "=d") |
9381e3f1 | 6658 | (ne:SI (match_operand:CCZ1 1 "register_operand" "0") |
69950452 AS |
6659 | (const_int 0))) |
6660 | (clobber (reg:CC CC_REGNUM))] | |
6661 | "" | |
6662 | "#" | |
6663 | "reload_completed" | |
6664 | [(parallel | |
6665 | [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 28))) | |
6666 | (clobber (reg:CC CC_REGNUM))])]) | |
6667 | ||
e69166de | 6668 | |
65b1d8ea AK |
6669 | ;; |
6670 | ;; - Conditional move instructions (introduced with z196) | |
6671 | ;; | |
6672 | ||
6673 | (define_expand "mov<mode>cc" | |
6674 | [(set (match_operand:GPR 0 "nonimmediate_operand" "") | |
6675 | (if_then_else:GPR (match_operand 1 "comparison_operator" "") | |
88e845c0 RD |
6676 | (match_operand:GPR 2 "loc_operand" "") |
6677 | (match_operand:GPR 3 "loc_operand" "")))] | |
65b1d8ea | 6678 | "TARGET_Z196" |
7477de01 | 6679 | { |
88e845c0 RD |
6680 | if (!TARGET_Z13 && CONSTANT_P (operands[2])) |
6681 | operands[2] = force_reg (<MODE>mode, operands[2]); | |
6682 | ||
6683 | if (!TARGET_Z13 && CONSTANT_P (operands[3])) | |
6684 | operands[3] = force_reg (<MODE>mode, operands[3]); | |
6685 | ||
7477de01 AK |
6686 | /* Emit the comparison insn in case we do not already have a comparison result. */ |
6687 | if (!s390_comparison (operands[1], VOIDmode)) | |
6688 | operands[1] = s390_emit_compare (GET_CODE (operands[1]), | |
6689 | XEXP (operands[1], 0), | |
6690 | XEXP (operands[1], 1)); | |
6691 | }) | |
65b1d8ea | 6692 | |
d8928886 RD |
6693 | ;; |
6694 | ;; - We do not have instructions for QImode or HImode but still | |
6695 | ;; enable load on condition/if conversion for them. | |
6696 | (define_expand "mov<mode>cc" | |
6697 | [(set (match_operand:HQI 0 "nonimmediate_operand" "") | |
6698 | (if_then_else:HQI (match_operand 1 "comparison_operator" "") | |
6699 | (match_operand:HQI 2 "loc_operand" "") | |
6700 | (match_operand:HQI 3 "loc_operand" "")))] | |
6701 | "TARGET_Z196" | |
6702 | { | |
6703 | /* Emit the comparison insn in case we do not already have a comparison | |
6704 | result. */ | |
6705 | if (!s390_comparison (operands[1], VOIDmode)) | |
6706 | operands[1] = s390_emit_compare (GET_CODE (operands[1]), | |
6707 | XEXP (operands[1], 0), | |
6708 | XEXP (operands[1], 1)); | |
6709 | ||
6710 | rtx then = operands[2]; | |
6711 | rtx els = operands[3]; | |
6712 | ||
6713 | if ((!TARGET_Z13 && CONSTANT_P (then)) || MEM_P (then)) | |
6714 | then = force_reg (<MODE>mode, then); | |
6715 | if ((!TARGET_Z13 && CONSTANT_P (els)) || MEM_P (els)) | |
6716 | els = force_reg (<MODE>mode, els); | |
6717 | ||
6718 | if (!CONSTANT_P (then)) | |
6719 | then = simplify_gen_subreg (E_SImode, then, <MODE>mode, 0); | |
6720 | if (!CONSTANT_P (els)) | |
6721 | els = simplify_gen_subreg (E_SImode, els, <MODE>mode, 0); | |
6722 | ||
6723 | rtx tmp_target = gen_reg_rtx (E_SImode); | |
6724 | emit_insn (gen_movsicc (tmp_target, operands[1], then, els)); | |
6725 | emit_move_insn (operands[0], gen_lowpart (<MODE>mode, tmp_target)); | |
6726 | DONE; | |
6727 | }) | |
6728 | ||
6729 | ||
6730 | ||
618eef38 | 6731 | ; locr, loc, stoc, locgr, locg, stocg, lochi, locghi, selr, selgr |
561f6312 | 6732 | (define_insn "*mov<mode>cc" |
618eef38 | 6733 | [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,S,S") |
65b1d8ea AK |
6734 | (if_then_else:GPR |
6735 | (match_operator 1 "s390_comparison" | |
618eef38 AK |
6736 | [(match_operand 2 "cc_reg_operand" " c,c,c,c,c,c,c,c,c") |
6737 | (match_operand 5 "const_int_operand" "")]) | |
6738 | (match_operand:GPR 3 "loc_operand" " d,0,d,S,0,K,0,d,0") | |
6739 | (match_operand:GPR 4 "loc_operand" " 0,d,d,0,S,0,K,0,d")))] | |
65b1d8ea AK |
6740 | "TARGET_Z196" |
6741 | "@ | |
6742 | loc<g>r%C1\t%0,%3 | |
6743 | loc<g>r%D1\t%0,%4 | |
618eef38 | 6744 | sel<g>r%C1\t%0,%3,%4 |
a6510374 AK |
6745 | loc<g>%C1\t%0,%3 |
6746 | loc<g>%D1\t%0,%4 | |
bf749919 DV |
6747 | loc<g>hi%C1\t%0,%h3 |
6748 | loc<g>hi%D1\t%0,%h4 | |
a6510374 | 6749 | stoc<g>%C1\t%3,%0 |
561f6312 | 6750 | stoc<g>%D1\t%4,%0" |
618eef38 AK |
6751 | [(set_attr "op_type" "RRF,RRF,RRF,RSY,RSY,RIE,RIE,RSY,RSY") |
6752 | (set_attr "cpu_facility" "*,*,arch13,*,*,z13,z13,*,*")]) | |
65b1d8ea | 6753 | |
9db1d521 HP |
6754 | ;; |
6755 | ;;- Multiply instructions. | |
6756 | ;; | |
6757 | ||
4023fb28 UW |
6758 | ; |
6759 | ; muldi3 instruction pattern(s). | |
6760 | ; | |
9db1d521 | 6761 | |
7d2fd075 AK |
6762 | (define_expand "muldi3" |
6763 | [(parallel | |
6764 | [(set (match_operand:DI 0 "register_operand") | |
6765 | (mult:DI (match_operand:DI 1 "nonimmediate_operand") | |
6766 | (match_operand:DI 2 "general_operand"))) | |
6767 | (clobber (reg:CC CC_REGNUM))])] | |
6768 | "TARGET_ZARCH") | |
6769 | ||
07893d4f UW |
6770 | (define_insn "*muldi3_sign" |
6771 | [(set (match_operand:DI 0 "register_operand" "=d,d") | |
3e4be43f | 6772 | (mult:DI (sign_extend:DI (match_operand:SI 2 "general_operand" "d,T")) |
07893d4f | 6773 | (match_operand:DI 1 "register_operand" "0,0")))] |
9602b6a1 | 6774 | "TARGET_ZARCH" |
07893d4f | 6775 | "@ |
d40c829f UW |
6776 | msgfr\t%0,%2 |
6777 | msgf\t%0,%2" | |
963fc8d0 AK |
6778 | [(set_attr "op_type" "RRE,RXY") |
6779 | (set_attr "type" "imuldi")]) | |
07893d4f | 6780 | |
7d2fd075 AK |
6781 | (define_insn "*muldi3" |
6782 | [(set (match_operand:DI 0 "register_operand" "=d,d,d,d,d") | |
6783 | (mult:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0,0,0") | |
6784 | (match_operand:DI 2 "general_operand" "d,d,K,T,Os"))) | |
6785 | (clobber (match_scratch:CC 3 "=X,c,X,X,X"))] | |
9602b6a1 | 6786 | "TARGET_ZARCH" |
9db1d521 | 6787 | "@ |
d40c829f | 6788 | msgr\t%0,%2 |
7d2fd075 | 6789 | msgrkc\t%0,%1,%2 |
d40c829f | 6790 | mghi\t%0,%h2 |
963fc8d0 AK |
6791 | msg\t%0,%2 |
6792 | msgfi\t%0,%2" | |
7d2fd075 | 6793 | [(set_attr "op_type" "RRE,RRF,RI,RXY,RIL") |
963fc8d0 | 6794 | (set_attr "type" "imuldi") |
e9e8efc9 | 6795 | (set_attr "cpu_facility" "*,z14,*,*,z10")]) |
7d2fd075 AK |
6796 | |
6797 | (define_insn "mulditi3" | |
6798 | [(set (match_operand:TI 0 "register_operand" "=d,d") | |
6799 | (mult:TI (sign_extend:TI | |
6800 | (match_operand:DI 1 "register_operand" "%d,0")) | |
6801 | (sign_extend:TI | |
6802 | (match_operand:DI 2 "nonimmediate_operand" " d,T"))))] | |
e9e8efc9 | 6803 | "TARGET_Z14" |
7d2fd075 AK |
6804 | "@ |
6805 | mgrk\t%0,%1,%2 | |
6806 | mg\t%0,%2" | |
6807 | [(set_attr "op_type" "RRF,RXY")]) | |
6808 | ||
6809 | ; Combine likes op1 and op2 to be swapped sometimes. | |
6810 | (define_insn "mulditi3_2" | |
6811 | [(set (match_operand:TI 0 "register_operand" "=d,d") | |
6812 | (mult:TI (sign_extend:TI | |
6813 | (match_operand:DI 1 "nonimmediate_operand" "%d,T")) | |
6814 | (sign_extend:TI | |
6815 | (match_operand:DI 2 "register_operand" " d,0"))))] | |
e9e8efc9 | 6816 | "TARGET_Z14" |
7d2fd075 AK |
6817 | "@ |
6818 | mgrk\t%0,%1,%2 | |
6819 | mg\t%0,%1" | |
6820 | [(set_attr "op_type" "RRF,RXY")]) | |
6821 | ||
6822 | (define_insn "*muldi3_sign" | |
6823 | [(set (match_operand:DI 0 "register_operand" "=d") | |
6824 | (mult:DI (sign_extend:DI (match_operand:HI 2 "memory_operand" "T")) | |
6825 | (match_operand:DI 1 "register_operand" "0")))] | |
e9e8efc9 | 6826 | "TARGET_Z14" |
7d2fd075 AK |
6827 | "mgh\t%0,%2" |
6828 | [(set_attr "op_type" "RXY")]) | |
6829 | ||
f2d3c02a | 6830 | |
9db1d521 HP |
6831 | ; |
6832 | ; mulsi3 instruction pattern(s). | |
6833 | ; | |
6834 | ||
7d2fd075 AK |
6835 | (define_expand "mulsi3" |
6836 | [(parallel | |
6837 | [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d,d") | |
6838 | (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,d,0,0,0,0") | |
6839 | (match_operand:SI 2 "general_operand" "d,d,K,R,T,Os"))) | |
6840 | (clobber (reg:CC CC_REGNUM))])] | |
6841 | "") | |
6842 | ||
f1e77d83 | 6843 | (define_insn "*mulsi3_sign" |
963fc8d0 AK |
6844 | [(set (match_operand:SI 0 "register_operand" "=d,d") |
6845 | (mult:SI (sign_extend:SI (match_operand:HI 2 "memory_operand" "R,T")) | |
6846 | (match_operand:SI 1 "register_operand" "0,0")))] | |
f1e77d83 | 6847 | "" |
963fc8d0 AK |
6848 | "@ |
6849 | mh\t%0,%2 | |
6850 | mhy\t%0,%2" | |
6851 | [(set_attr "op_type" "RX,RXY") | |
6852 | (set_attr "type" "imulhi") | |
6853 | (set_attr "cpu_facility" "*,z10")]) | |
f1e77d83 | 6854 | |
7d2fd075 AK |
6855 | (define_insn "*mulsi3" |
6856 | [(set (match_operand:SI 0 "register_operand" "=d,d,d,d,d,d") | |
6857 | (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,d,0,0,0,0") | |
6858 | (match_operand:SI 2 "general_operand" "d,d,K,R,T,Os"))) | |
6859 | (clobber (match_scratch:CC 3 "=X,c,X,X,X,X"))] | |
9db1d521 HP |
6860 | "" |
6861 | "@ | |
d40c829f | 6862 | msr\t%0,%2 |
7d2fd075 | 6863 | msrkc\t%0,%1,%2 |
d40c829f UW |
6864 | mhi\t%0,%h2 |
6865 | ms\t%0,%2 | |
963fc8d0 AK |
6866 | msy\t%0,%2 |
6867 | msfi\t%0,%2" | |
7d2fd075 AK |
6868 | [(set_attr "op_type" "RRE,RRF,RI,RX,RXY,RIL") |
6869 | (set_attr "type" "imulsi,*,imulhi,imulsi,imulsi,imulsi") | |
e9e8efc9 | 6870 | (set_attr "cpu_facility" "*,z14,*,*,longdisp,z10")]) |
9db1d521 | 6871 | |
4023fb28 UW |
6872 | ; |
6873 | ; mulsidi3 instruction pattern(s). | |
6874 | ; | |
6875 | ||
f1e77d83 | 6876 | (define_insn "mulsidi3" |
963fc8d0 | 6877 | [(set (match_operand:DI 0 "register_operand" "=d,d,d") |
f1e77d83 | 6878 | (mult:DI (sign_extend:DI |
963fc8d0 | 6879 | (match_operand:SI 1 "register_operand" "%0,0,0")) |
f1e77d83 | 6880 | (sign_extend:DI |
963fc8d0 | 6881 | (match_operand:SI 2 "nonimmediate_operand" "d,R,T"))))] |
9602b6a1 | 6882 | "!TARGET_ZARCH" |
f1e77d83 UW |
6883 | "@ |
6884 | mr\t%0,%2 | |
963fc8d0 AK |
6885 | m\t%0,%2 |
6886 | mfy\t%0,%2" | |
6887 | [(set_attr "op_type" "RR,RX,RXY") | |
6888 | (set_attr "type" "imulsi") | |
6889 | (set_attr "cpu_facility" "*,*,z10")]) | |
4023fb28 | 6890 | |
f1e77d83 | 6891 | ; |
6e0d70c9 | 6892 | ; umul instruction pattern(s). |
f1e77d83 | 6893 | ; |
c7453384 | 6894 | |
6e0d70c9 AK |
6895 | ; mlr, ml, mlgr, mlg |
6896 | (define_insn "umul<dwh><mode>3" | |
3e4be43f | 6897 | [(set (match_operand:DW 0 "register_operand" "=d,d") |
6e0d70c9 | 6898 | (mult:DW (zero_extend:DW |
3e4be43f | 6899 | (match_operand:<DWH> 1 "register_operand" "%0,0")) |
6e0d70c9 | 6900 | (zero_extend:DW |
3e4be43f | 6901 | (match_operand:<DWH> 2 "nonimmediate_operand" " d,T"))))] |
8cc6307c | 6902 | "" |
f1e77d83 | 6903 | "@ |
6e0d70c9 AK |
6904 | ml<tg>r\t%0,%2 |
6905 | ml<tg>\t%0,%2" | |
f1e77d83 | 6906 | [(set_attr "op_type" "RRE,RXY") |
6e0d70c9 | 6907 | (set_attr "type" "imul<dwh>")]) |
c7453384 | 6908 | |
9db1d521 | 6909 | ; |
609e7e80 | 6910 | ; mul(tf|df|sf|td|dd)3 instruction pattern(s). |
9db1d521 HP |
6911 | ; |
6912 | ||
9381e3f1 | 6913 | ; mxbr, mdbr, meebr, mxb, mxb, meeb, mdtr, mxtr |
142cd70f | 6914 | (define_insn "mul<mode>3" |
2de2b3f9 AK |
6915 | [(set (match_operand:FP 0 "register_operand" "=f,f,f,v,v") |
6916 | (mult:FP (match_operand:FP 1 "nonimmediate_operand" "%f,0,0,v,v") | |
6917 | (match_operand:FP 2 "general_operand" "f,f,R,v,v")))] | |
142cd70f | 6918 | "TARGET_HARD_FLOAT" |
9db1d521 | 6919 | "@ |
62d3f261 AK |
6920 | m<xdee>tr\t%0,%1,%2 |
6921 | m<xdee>br\t%0,%2 | |
6e5b5de8 | 6922 | m<xdee>b\t%0,%2 |
2de2b3f9 AK |
6923 | wfmdb\t%v0,%v1,%v2 |
6924 | wfmsb\t%v0,%v1,%v2" | |
6925 | [(set_attr "op_type" "RRF,RRE,RXE,VRR,VRR") | |
6e5b5de8 | 6926 | (set_attr "type" "fmul<mode>") |
2de2b3f9 AK |
6927 | (set_attr "cpu_facility" "*,*,*,vx,vxe") |
6928 | (set_attr "enabled" "<nBFP>,<nDFP>,<DSF>,<DF>,<SF>")]) | |
9db1d521 | 6929 | |
9381e3f1 | 6930 | ; madbr, maebr, maxb, madb, maeb |
d7ecb504 | 6931 | (define_insn "fma<mode>4" |
2de2b3f9 AK |
6932 | [(set (match_operand:DSF 0 "register_operand" "=f,f,v,v") |
6933 | (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,v,v") | |
6934 | (match_operand:DSF 2 "nonimmediate_operand" "f,R,v,v") | |
6935 | (match_operand:DSF 3 "register_operand" "0,0,v,v")))] | |
d7ecb504 | 6936 | "TARGET_HARD_FLOAT" |
a1b892b5 | 6937 | "@ |
f61a2c7d | 6938 | ma<xde>br\t%0,%1,%2 |
6e5b5de8 | 6939 | ma<xde>b\t%0,%1,%2 |
2de2b3f9 AK |
6940 | wfmadb\t%v0,%v1,%v2,%v3 |
6941 | wfmasb\t%v0,%v1,%v2,%v3" | |
6942 | [(set_attr "op_type" "RRE,RXE,VRR,VRR") | |
6e5b5de8 | 6943 | (set_attr "type" "fmadd<mode>") |
2de2b3f9 AK |
6944 | (set_attr "cpu_facility" "*,*,vx,vxe") |
6945 | (set_attr "enabled" "*,*,<DF>,<SF>")]) | |
a1b892b5 | 6946 | |
43a09b63 | 6947 | ; msxbr, msdbr, msebr, msxb, msdb, mseb |
d7ecb504 | 6948 | (define_insn "fms<mode>4" |
2de2b3f9 AK |
6949 | [(set (match_operand:DSF 0 "register_operand" "=f,f,v,v") |
6950 | (fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,v,v") | |
6951 | (match_operand:DSF 2 "nonimmediate_operand" "f,R,v,v") | |
6952 | (neg:DSF (match_operand:DSF 3 "register_operand" "0,0,v,v"))))] | |
d7ecb504 | 6953 | "TARGET_HARD_FLOAT" |
a1b892b5 | 6954 | "@ |
f61a2c7d | 6955 | ms<xde>br\t%0,%1,%2 |
6e5b5de8 | 6956 | ms<xde>b\t%0,%1,%2 |
2de2b3f9 AK |
6957 | wfmsdb\t%v0,%v1,%v2,%v3 |
6958 | wfmssb\t%v0,%v1,%v2,%v3" | |
6959 | [(set_attr "op_type" "RRE,RXE,VRR,VRR") | |
6e5b5de8 | 6960 | (set_attr "type" "fmadd<mode>") |
2de2b3f9 AK |
6961 | (set_attr "cpu_facility" "*,*,vx,vxe") |
6962 | (set_attr "enabled" "*,*,<DF>,<SF>")]) | |
9db1d521 HP |
6963 | |
6964 | ;; | |
6965 | ;;- Divide and modulo instructions. | |
6966 | ;; | |
6967 | ||
6968 | ; | |
4023fb28 | 6969 | ; divmoddi4 instruction pattern(s). |
9db1d521 HP |
6970 | ; |
6971 | ||
4023fb28 UW |
6972 | (define_expand "divmoddi4" |
6973 | [(parallel [(set (match_operand:DI 0 "general_operand" "") | |
f1e77d83 | 6974 | (div:DI (match_operand:DI 1 "register_operand" "") |
4023fb28 UW |
6975 | (match_operand:DI 2 "general_operand" ""))) |
6976 | (set (match_operand:DI 3 "general_operand" "") | |
6977 | (mod:DI (match_dup 1) (match_dup 2)))]) | |
6978 | (clobber (match_dup 4))] | |
9602b6a1 | 6979 | "TARGET_ZARCH" |
9db1d521 | 6980 | { |
d8485bdb TS |
6981 | rtx div_equal, mod_equal; |
6982 | rtx_insn *insn; | |
4023fb28 UW |
6983 | |
6984 | div_equal = gen_rtx_DIV (DImode, operands[1], operands[2]); | |
6985 | mod_equal = gen_rtx_MOD (DImode, operands[1], operands[2]); | |
4023fb28 UW |
6986 | |
6987 | operands[4] = gen_reg_rtx(TImode); | |
f1e77d83 | 6988 | emit_insn (gen_divmodtidi3 (operands[4], operands[1], operands[2])); |
4023fb28 UW |
6989 | |
6990 | insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4])); | |
bd94cb6e | 6991 | set_unique_reg_note (insn, REG_EQUAL, div_equal); |
4023fb28 UW |
6992 | |
6993 | insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4])); | |
bd94cb6e | 6994 | set_unique_reg_note (insn, REG_EQUAL, mod_equal); |
9db1d521 | 6995 | |
9db1d521 | 6996 | DONE; |
10bbf137 | 6997 | }) |
9db1d521 HP |
6998 | |
6999 | (define_insn "divmodtidi3" | |
4023fb28 UW |
7000 | [(set (match_operand:TI 0 "register_operand" "=d,d") |
7001 | (ior:TI | |
4023fb28 UW |
7002 | (ashift:TI |
7003 | (zero_extend:TI | |
5665e398 | 7004 | (mod:DI (match_operand:DI 1 "register_operand" "0,0") |
3e4be43f | 7005 | (match_operand:DI 2 "general_operand" "d,T"))) |
5665e398 UW |
7006 | (const_int 64)) |
7007 | (zero_extend:TI (div:DI (match_dup 1) (match_dup 2)))))] | |
9602b6a1 | 7008 | "TARGET_ZARCH" |
9db1d521 | 7009 | "@ |
d40c829f UW |
7010 | dsgr\t%0,%2 |
7011 | dsg\t%0,%2" | |
d3632d41 | 7012 | [(set_attr "op_type" "RRE,RXY") |
077dab3b | 7013 | (set_attr "type" "idiv")]) |
9db1d521 | 7014 | |
4023fb28 UW |
7015 | (define_insn "divmodtisi3" |
7016 | [(set (match_operand:TI 0 "register_operand" "=d,d") | |
7017 | (ior:TI | |
4023fb28 UW |
7018 | (ashift:TI |
7019 | (zero_extend:TI | |
5665e398 | 7020 | (mod:DI (match_operand:DI 1 "register_operand" "0,0") |
2f7e5a0d | 7021 | (sign_extend:DI |
3e4be43f | 7022 | (match_operand:SI 2 "nonimmediate_operand" "d,T")))) |
5665e398 UW |
7023 | (const_int 64)) |
7024 | (zero_extend:TI | |
7025 | (div:DI (match_dup 1) (sign_extend:DI (match_dup 2))))))] | |
9602b6a1 | 7026 | "TARGET_ZARCH" |
4023fb28 | 7027 | "@ |
d40c829f UW |
7028 | dsgfr\t%0,%2 |
7029 | dsgf\t%0,%2" | |
d3632d41 | 7030 | [(set_attr "op_type" "RRE,RXY") |
077dab3b | 7031 | (set_attr "type" "idiv")]) |
9db1d521 | 7032 | |
4023fb28 UW |
7033 | ; |
7034 | ; udivmoddi4 instruction pattern(s). | |
7035 | ; | |
9db1d521 | 7036 | |
4023fb28 UW |
7037 | (define_expand "udivmoddi4" |
7038 | [(parallel [(set (match_operand:DI 0 "general_operand" "") | |
7039 | (udiv:DI (match_operand:DI 1 "general_operand" "") | |
7040 | (match_operand:DI 2 "nonimmediate_operand" ""))) | |
7041 | (set (match_operand:DI 3 "general_operand" "") | |
7042 | (umod:DI (match_dup 1) (match_dup 2)))]) | |
7043 | (clobber (match_dup 4))] | |
9602b6a1 | 7044 | "TARGET_ZARCH" |
9db1d521 | 7045 | { |
d8485bdb TS |
7046 | rtx div_equal, mod_equal, equal; |
7047 | rtx_insn *insn; | |
4023fb28 UW |
7048 | |
7049 | div_equal = gen_rtx_UDIV (DImode, operands[1], operands[2]); | |
7050 | mod_equal = gen_rtx_UMOD (DImode, operands[1], operands[2]); | |
7051 | equal = gen_rtx_IOR (TImode, | |
4023fb28 UW |
7052 | gen_rtx_ASHIFT (TImode, |
7053 | gen_rtx_ZERO_EXTEND (TImode, mod_equal), | |
5665e398 UW |
7054 | GEN_INT (64)), |
7055 | gen_rtx_ZERO_EXTEND (TImode, div_equal)); | |
4023fb28 UW |
7056 | |
7057 | operands[4] = gen_reg_rtx(TImode); | |
c41c1387 | 7058 | emit_clobber (operands[4]); |
4023fb28 UW |
7059 | emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]); |
7060 | emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx); | |
bd94cb6e | 7061 | |
4023fb28 | 7062 | insn = emit_insn (gen_udivmodtidi3 (operands[4], operands[4], operands[2])); |
bd94cb6e | 7063 | set_unique_reg_note (insn, REG_EQUAL, equal); |
4023fb28 UW |
7064 | |
7065 | insn = emit_move_insn (operands[0], gen_lowpart (DImode, operands[4])); | |
bd94cb6e | 7066 | set_unique_reg_note (insn, REG_EQUAL, div_equal); |
4023fb28 UW |
7067 | |
7068 | insn = emit_move_insn (operands[3], gen_highpart (DImode, operands[4])); | |
bd94cb6e | 7069 | set_unique_reg_note (insn, REG_EQUAL, mod_equal); |
9db1d521 | 7070 | |
9db1d521 | 7071 | DONE; |
10bbf137 | 7072 | }) |
9db1d521 HP |
7073 | |
7074 | (define_insn "udivmodtidi3" | |
4023fb28 | 7075 | [(set (match_operand:TI 0 "register_operand" "=d,d") |
2f7e5a0d | 7076 | (ior:TI |
5665e398 UW |
7077 | (ashift:TI |
7078 | (zero_extend:TI | |
7079 | (truncate:DI | |
2f7e5a0d EC |
7080 | (umod:TI (match_operand:TI 1 "register_operand" "0,0") |
7081 | (zero_extend:TI | |
3e4be43f | 7082 | (match_operand:DI 2 "nonimmediate_operand" "d,T"))))) |
5665e398 UW |
7083 | (const_int 64)) |
7084 | (zero_extend:TI | |
7085 | (truncate:DI | |
7086 | (udiv:TI (match_dup 1) (zero_extend:TI (match_dup 2)))))))] | |
9602b6a1 | 7087 | "TARGET_ZARCH" |
9db1d521 | 7088 | "@ |
d40c829f UW |
7089 | dlgr\t%0,%2 |
7090 | dlg\t%0,%2" | |
d3632d41 | 7091 | [(set_attr "op_type" "RRE,RXY") |
077dab3b | 7092 | (set_attr "type" "idiv")]) |
9db1d521 HP |
7093 | |
7094 | ; | |
4023fb28 | 7095 | ; divmodsi4 instruction pattern(s). |
9db1d521 HP |
7096 | ; |
7097 | ||
4023fb28 UW |
7098 | (define_expand "divmodsi4" |
7099 | [(parallel [(set (match_operand:SI 0 "general_operand" "") | |
7100 | (div:SI (match_operand:SI 1 "general_operand" "") | |
7101 | (match_operand:SI 2 "nonimmediate_operand" ""))) | |
7102 | (set (match_operand:SI 3 "general_operand" "") | |
7103 | (mod:SI (match_dup 1) (match_dup 2)))]) | |
7104 | (clobber (match_dup 4))] | |
9602b6a1 | 7105 | "!TARGET_ZARCH" |
9db1d521 | 7106 | { |
d8485bdb TS |
7107 | rtx div_equal, mod_equal, equal; |
7108 | rtx_insn *insn; | |
4023fb28 UW |
7109 | |
7110 | div_equal = gen_rtx_DIV (SImode, operands[1], operands[2]); | |
7111 | mod_equal = gen_rtx_MOD (SImode, operands[1], operands[2]); | |
7112 | equal = gen_rtx_IOR (DImode, | |
4023fb28 UW |
7113 | gen_rtx_ASHIFT (DImode, |
7114 | gen_rtx_ZERO_EXTEND (DImode, mod_equal), | |
5665e398 UW |
7115 | GEN_INT (32)), |
7116 | gen_rtx_ZERO_EXTEND (DImode, div_equal)); | |
4023fb28 UW |
7117 | |
7118 | operands[4] = gen_reg_rtx(DImode); | |
7119 | emit_insn (gen_extendsidi2 (operands[4], operands[1])); | |
bd94cb6e | 7120 | |
4023fb28 | 7121 | insn = emit_insn (gen_divmoddisi3 (operands[4], operands[4], operands[2])); |
bd94cb6e | 7122 | set_unique_reg_note (insn, REG_EQUAL, equal); |
4023fb28 UW |
7123 | |
7124 | insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4])); | |
bd94cb6e | 7125 | set_unique_reg_note (insn, REG_EQUAL, div_equal); |
4023fb28 UW |
7126 | |
7127 | insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4])); | |
bd94cb6e | 7128 | set_unique_reg_note (insn, REG_EQUAL, mod_equal); |
9db1d521 | 7129 | |
9db1d521 | 7130 | DONE; |
10bbf137 | 7131 | }) |
9db1d521 HP |
7132 | |
7133 | (define_insn "divmoddisi3" | |
4023fb28 | 7134 | [(set (match_operand:DI 0 "register_operand" "=d,d") |
2f7e5a0d | 7135 | (ior:DI |
5665e398 UW |
7136 | (ashift:DI |
7137 | (zero_extend:DI | |
7138 | (truncate:SI | |
2f7e5a0d EC |
7139 | (mod:DI (match_operand:DI 1 "register_operand" "0,0") |
7140 | (sign_extend:DI | |
5665e398 UW |
7141 | (match_operand:SI 2 "nonimmediate_operand" "d,R"))))) |
7142 | (const_int 32)) | |
7143 | (zero_extend:DI | |
7144 | (truncate:SI | |
7145 | (div:DI (match_dup 1) (sign_extend:DI (match_dup 2)))))))] | |
9602b6a1 | 7146 | "!TARGET_ZARCH" |
9db1d521 | 7147 | "@ |
d40c829f UW |
7148 | dr\t%0,%2 |
7149 | d\t%0,%2" | |
9db1d521 | 7150 | [(set_attr "op_type" "RR,RX") |
077dab3b | 7151 | (set_attr "type" "idiv")]) |
9db1d521 HP |
7152 | |
7153 | ; | |
7154 | ; udivsi3 and umodsi3 instruction pattern(s). | |
7155 | ; | |
7156 | ||
f1e77d83 UW |
7157 | (define_expand "udivmodsi4" |
7158 | [(parallel [(set (match_operand:SI 0 "general_operand" "") | |
7159 | (udiv:SI (match_operand:SI 1 "general_operand" "") | |
7160 | (match_operand:SI 2 "nonimmediate_operand" ""))) | |
7161 | (set (match_operand:SI 3 "general_operand" "") | |
7162 | (umod:SI (match_dup 1) (match_dup 2)))]) | |
7163 | (clobber (match_dup 4))] | |
8cc6307c | 7164 | "!TARGET_ZARCH" |
f1e77d83 | 7165 | { |
d8485bdb TS |
7166 | rtx div_equal, mod_equal, equal; |
7167 | rtx_insn *insn; | |
f1e77d83 UW |
7168 | |
7169 | div_equal = gen_rtx_UDIV (SImode, operands[1], operands[2]); | |
7170 | mod_equal = gen_rtx_UMOD (SImode, operands[1], operands[2]); | |
7171 | equal = gen_rtx_IOR (DImode, | |
f1e77d83 UW |
7172 | gen_rtx_ASHIFT (DImode, |
7173 | gen_rtx_ZERO_EXTEND (DImode, mod_equal), | |
5665e398 UW |
7174 | GEN_INT (32)), |
7175 | gen_rtx_ZERO_EXTEND (DImode, div_equal)); | |
f1e77d83 UW |
7176 | |
7177 | operands[4] = gen_reg_rtx(DImode); | |
c41c1387 | 7178 | emit_clobber (operands[4]); |
f1e77d83 UW |
7179 | emit_move_insn (gen_lowpart (SImode, operands[4]), operands[1]); |
7180 | emit_move_insn (gen_highpart (SImode, operands[4]), const0_rtx); | |
bd94cb6e | 7181 | |
f1e77d83 | 7182 | insn = emit_insn (gen_udivmoddisi3 (operands[4], operands[4], operands[2])); |
bd94cb6e | 7183 | set_unique_reg_note (insn, REG_EQUAL, equal); |
f1e77d83 UW |
7184 | |
7185 | insn = emit_move_insn (operands[0], gen_lowpart (SImode, operands[4])); | |
bd94cb6e | 7186 | set_unique_reg_note (insn, REG_EQUAL, div_equal); |
f1e77d83 UW |
7187 | |
7188 | insn = emit_move_insn (operands[3], gen_highpart (SImode, operands[4])); | |
bd94cb6e | 7189 | set_unique_reg_note (insn, REG_EQUAL, mod_equal); |
f1e77d83 UW |
7190 | |
7191 | DONE; | |
7192 | }) | |
7193 | ||
7194 | (define_insn "udivmoddisi3" | |
7195 | [(set (match_operand:DI 0 "register_operand" "=d,d") | |
2f7e5a0d | 7196 | (ior:DI |
5665e398 UW |
7197 | (ashift:DI |
7198 | (zero_extend:DI | |
7199 | (truncate:SI | |
2f7e5a0d EC |
7200 | (umod:DI (match_operand:DI 1 "register_operand" "0,0") |
7201 | (zero_extend:DI | |
3e4be43f | 7202 | (match_operand:SI 2 "nonimmediate_operand" "d,T"))))) |
5665e398 UW |
7203 | (const_int 32)) |
7204 | (zero_extend:DI | |
7205 | (truncate:SI | |
7206 | (udiv:DI (match_dup 1) (zero_extend:DI (match_dup 2)))))))] | |
8cc6307c | 7207 | "!TARGET_ZARCH" |
f1e77d83 UW |
7208 | "@ |
7209 | dlr\t%0,%2 | |
7210 | dl\t%0,%2" | |
7211 | [(set_attr "op_type" "RRE,RXY") | |
7212 | (set_attr "type" "idiv")]) | |
4023fb28 | 7213 | |
9db1d521 | 7214 | ; |
f5905b37 | 7215 | ; div(df|sf)3 instruction pattern(s). |
9db1d521 HP |
7216 | ; |
7217 | ||
609e7e80 | 7218 | ; dxbr, ddbr, debr, dxb, ddb, deb, ddtr, dxtr |
142cd70f | 7219 | (define_insn "div<mode>3" |
2de2b3f9 AK |
7220 | [(set (match_operand:FP 0 "register_operand" "=f,f,f,v,v") |
7221 | (div:FP (match_operand:FP 1 "register_operand" "f,0,0,v,v") | |
7222 | (match_operand:FP 2 "general_operand" "f,f,R,v,v")))] | |
142cd70f | 7223 | "TARGET_HARD_FLOAT" |
9db1d521 | 7224 | "@ |
62d3f261 AK |
7225 | d<xde>tr\t%0,%1,%2 |
7226 | d<xde>br\t%0,%2 | |
6e5b5de8 | 7227 | d<xde>b\t%0,%2 |
2de2b3f9 AK |
7228 | wfddb\t%v0,%v1,%v2 |
7229 | wfdsb\t%v0,%v1,%v2" | |
7230 | [(set_attr "op_type" "RRF,RRE,RXE,VRR,VRR") | |
6e5b5de8 | 7231 | (set_attr "type" "fdiv<mode>") |
2de2b3f9 AK |
7232 | (set_attr "cpu_facility" "*,*,*,vx,vxe") |
7233 | (set_attr "enabled" "<nBFP>,<nDFP>,<DSF>,<DF>,<SF>")]) | |
9db1d521 | 7234 | |
9db1d521 HP |
7235 | |
7236 | ;; | |
7237 | ;;- And instructions. | |
7238 | ;; | |
7239 | ||
047d35ed AS |
7240 | (define_expand "and<mode>3" |
7241 | [(set (match_operand:INT 0 "nonimmediate_operand" "") | |
7242 | (and:INT (match_operand:INT 1 "nonimmediate_operand" "") | |
7243 | (match_operand:INT 2 "general_operand" ""))) | |
7244 | (clobber (reg:CC CC_REGNUM))] | |
7245 | "" | |
7246 | "s390_expand_logical_operator (AND, <MODE>mode, operands); DONE;") | |
7247 | ||
9db1d521 HP |
7248 | ; |
7249 | ; anddi3 instruction pattern(s). | |
7250 | ; | |
7251 | ||
7252 | (define_insn "*anddi3_cc" | |
ae156f85 | 7253 | [(set (reg CC_REGNUM) |
e3140518 | 7254 | (compare |
3e4be43f | 7255 | (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0, d") |
c2586c82 | 7256 | (match_operand:DI 2 "general_operand" " d,d,T,NxxDw")) |
e3140518 | 7257 | (const_int 0))) |
3e4be43f | 7258 | (set (match_operand:DI 0 "register_operand" "=d,d,d, d") |
9db1d521 | 7259 | (and:DI (match_dup 1) (match_dup 2)))] |
e3140518 | 7260 | "TARGET_ZARCH && s390_match_ccmode(insn, CCTmode)" |
9db1d521 | 7261 | "@ |
d40c829f | 7262 | ngr\t%0,%2 |
65b1d8ea | 7263 | ngrk\t%0,%1,%2 |
e3140518 RH |
7264 | ng\t%0,%2 |
7265 | risbg\t%0,%1,%s2,128+%e2,0" | |
7266 | [(set_attr "op_type" "RRE,RRF,RXY,RIE") | |
7267 | (set_attr "cpu_facility" "*,z196,*,z10") | |
7268 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")]) | |
9db1d521 HP |
7269 | |
7270 | (define_insn "*anddi3_cconly" | |
ae156f85 | 7271 | [(set (reg CC_REGNUM) |
e3140518 | 7272 | (compare |
3e4be43f | 7273 | (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0, d") |
c2586c82 | 7274 | (match_operand:DI 2 "general_operand" " d,d,T,NxxDw")) |
9db1d521 | 7275 | (const_int 0))) |
3e4be43f | 7276 | (clobber (match_scratch:DI 0 "=d,d,d, d"))] |
e3140518 RH |
7277 | "TARGET_ZARCH |
7278 | && s390_match_ccmode(insn, CCTmode) | |
68f9c5e2 UW |
7279 | /* Do not steal TM patterns. */ |
7280 | && s390_single_part (operands[2], DImode, HImode, 0) < 0" | |
9db1d521 | 7281 | "@ |
d40c829f | 7282 | ngr\t%0,%2 |
65b1d8ea | 7283 | ngrk\t%0,%1,%2 |
e3140518 RH |
7284 | ng\t%0,%2 |
7285 | risbg\t%0,%1,%s2,128+%e2,0" | |
7286 | [(set_attr "op_type" "RRE,RRF,RXY,RIE") | |
7287 | (set_attr "cpu_facility" "*,z196,*,z10") | |
7288 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super_E1")]) | |
9db1d521 | 7289 | |
3af8e996 | 7290 | (define_insn "*anddi3" |
65b1d8ea | 7291 | [(set (match_operand:DI 0 "nonimmediate_operand" |
3e4be43f | 7292 | "=d,d, d, d, d, d, d, d,d,d,d, d, AQ,Q") |
e3140518 RH |
7293 | (and:DI |
7294 | (match_operand:DI 1 "nonimmediate_operand" | |
3e4be43f | 7295 | "%d,o, 0, 0, 0, 0, 0, 0,0,d,0, d, 0,0") |
e3140518 | 7296 | (match_operand:DI 2 "general_operand" |
c2586c82 | 7297 | "M, M,N0HDF,N1HDF,N2HDF,N3HDF,N0SDF,N1SDF,d,d,T,NxxDw,NxQDF,Q"))) |
ec24698e | 7298 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 7299 | "TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
ec24698e UW |
7300 | "@ |
7301 | # | |
7302 | # | |
7303 | nihh\t%0,%j2 | |
7304 | nihl\t%0,%j2 | |
7305 | nilh\t%0,%j2 | |
7306 | nill\t%0,%j2 | |
7307 | nihf\t%0,%m2 | |
7308 | nilf\t%0,%m2 | |
7309 | ngr\t%0,%2 | |
65b1d8ea | 7310 | ngrk\t%0,%1,%2 |
ec24698e | 7311 | ng\t%0,%2 |
e3140518 | 7312 | risbg\t%0,%1,%s2,128+%e2,0 |
ec24698e UW |
7313 | # |
7314 | #" | |
e3140518 RH |
7315 | [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,RIE,SI,SS") |
7316 | (set_attr "cpu_facility" "*,*,*,*,*,*,extimm,extimm,*,z196,*,z10,*,*") | |
9381e3f1 WG |
7317 | (set_attr "z10prop" "*, |
7318 | *, | |
7319 | z10_super_E1, | |
7320 | z10_super_E1, | |
7321 | z10_super_E1, | |
7322 | z10_super_E1, | |
7323 | z10_super_E1, | |
7324 | z10_super_E1, | |
7325 | z10_super_E1, | |
65b1d8ea | 7326 | *, |
9381e3f1 | 7327 | z10_super_E1, |
e3140518 | 7328 | z10_super_E1, |
9381e3f1 WG |
7329 | *, |
7330 | *")]) | |
0dfa6c5e UW |
7331 | |
7332 | (define_split | |
7333 | [(set (match_operand:DI 0 "s_operand" "") | |
7334 | (and:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" ""))) | |
ae156f85 | 7335 | (clobber (reg:CC CC_REGNUM))] |
0dfa6c5e UW |
7336 | "reload_completed" |
7337 | [(parallel | |
7338 | [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1))) | |
ae156f85 | 7339 | (clobber (reg:CC CC_REGNUM))])] |
0dfa6c5e | 7340 | "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);") |
4023fb28 | 7341 | |
1a2e356e | 7342 | ;; These two are what combine generates for (ashift (zero_extract)). |
64c744b9 | 7343 | (define_insn "*extzv_<mode>_srl<clobbercc_or_nocc>" |
1a2e356e RH |
7344 | [(set (match_operand:GPR 0 "register_operand" "=d") |
7345 | (and:GPR (lshiftrt:GPR | |
7346 | (match_operand:GPR 1 "register_operand" "d") | |
7347 | (match_operand:GPR 2 "nonzero_shift_count_operand" "")) | |
ab4be5d1 | 7348 | (match_operand:GPR 3 "contiguous_bitmask_nowrap_operand" "")))] |
64c744b9 | 7349 | "<z10_or_zEC12_cond> |
1a2e356e RH |
7350 | /* Note that even for the SImode pattern, the rotate is always DImode. */ |
7351 | && s390_extzv_shift_ok (<bitsize>, -INTVAL (operands[2]), | |
7352 | INTVAL (operands[3]))" | |
64c744b9 | 7353 | "<risbg_n>\t%0,%1,%<bfstart>3,128+%<bfend>3,64-%2" |
1a2e356e RH |
7354 | [(set_attr "op_type" "RIE") |
7355 | (set_attr "z10prop" "z10_super_E1")]) | |
7356 | ||
64c744b9 | 7357 | (define_insn "*extzv_<mode>_sll<clobbercc_or_nocc>" |
1a2e356e RH |
7358 | [(set (match_operand:GPR 0 "register_operand" "=d") |
7359 | (and:GPR (ashift:GPR | |
7360 | (match_operand:GPR 1 "register_operand" "d") | |
7361 | (match_operand:GPR 2 "nonzero_shift_count_operand" "")) | |
ab4be5d1 | 7362 | (match_operand:GPR 3 "contiguous_bitmask_nowrap_operand" "")))] |
64c744b9 | 7363 | "<z10_or_zEC12_cond> |
1a2e356e RH |
7364 | && s390_extzv_shift_ok (<bitsize>, INTVAL (operands[2]), |
7365 | INTVAL (operands[3]))" | |
64c744b9 | 7366 | "<risbg_n>\t%0,%1,%<bfstart>3,128+%<bfend>3,%2" |
1a2e356e RH |
7367 | [(set_attr "op_type" "RIE") |
7368 | (set_attr "z10prop" "z10_super_E1")]) | |
7369 | ||
9db1d521 HP |
7370 | |
7371 | ; | |
7372 | ; andsi3 instruction pattern(s). | |
7373 | ; | |
7374 | ||
7375 | (define_insn "*andsi3_cc" | |
ae156f85 | 7376 | [(set (reg CC_REGNUM) |
e3140518 RH |
7377 | (compare |
7378 | (and:SI | |
7379 | (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d") | |
7380 | (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq")) | |
7381 | (const_int 0))) | |
7382 | (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d, d") | |
9db1d521 HP |
7383 | (and:SI (match_dup 1) (match_dup 2)))] |
7384 | "s390_match_ccmode(insn, CCTmode)" | |
7385 | "@ | |
ec24698e | 7386 | nilf\t%0,%o2 |
d40c829f | 7387 | nr\t%0,%2 |
65b1d8ea | 7388 | nrk\t%0,%1,%2 |
d40c829f | 7389 | n\t%0,%2 |
e3140518 RH |
7390 | ny\t%0,%2 |
7391 | risbg\t%0,%1,%t2,128+%f2,0" | |
7392 | [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE") | |
3e4be43f | 7393 | (set_attr "cpu_facility" "*,*,z196,*,longdisp,z10") |
e3140518 RH |
7394 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,*, |
7395 | z10_super_E1,z10_super_E1,z10_super_E1")]) | |
9db1d521 HP |
7396 | |
7397 | (define_insn "*andsi3_cconly" | |
ae156f85 | 7398 | [(set (reg CC_REGNUM) |
e3140518 RH |
7399 | (compare |
7400 | (and:SI | |
7401 | (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, d") | |
7402 | (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxxSq")) | |
7403 | (const_int 0))) | |
7404 | (clobber (match_scratch:SI 0 "=d,d,d,d,d, d"))] | |
68f9c5e2 UW |
7405 | "s390_match_ccmode(insn, CCTmode) |
7406 | /* Do not steal TM patterns. */ | |
7407 | && s390_single_part (operands[2], SImode, HImode, 0) < 0" | |
9db1d521 | 7408 | "@ |
ec24698e | 7409 | nilf\t%0,%o2 |
d40c829f | 7410 | nr\t%0,%2 |
65b1d8ea | 7411 | nrk\t%0,%1,%2 |
d40c829f | 7412 | n\t%0,%2 |
e3140518 RH |
7413 | ny\t%0,%2 |
7414 | risbg\t%0,%1,%t2,128+%f2,0" | |
7415 | [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,RIE") | |
3e4be43f | 7416 | (set_attr "cpu_facility" "*,*,z196,*,longdisp,z10") |
65b1d8ea | 7417 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,*, |
e3140518 | 7418 | z10_super_E1,z10_super_E1,z10_super_E1")]) |
9db1d521 | 7419 | |
f19a9af7 | 7420 | (define_insn "*andsi3_zarch" |
65b1d8ea | 7421 | [(set (match_operand:SI 0 "nonimmediate_operand" |
e3140518 | 7422 | "=d,d, d, d, d,d,d,d,d, d, AQ,Q") |
0dfa6c5e | 7423 | (and:SI (match_operand:SI 1 "nonimmediate_operand" |
e3140518 | 7424 | "%d,o, 0, 0, 0,0,d,0,0, d, 0,0") |
0dfa6c5e | 7425 | (match_operand:SI 2 "general_operand" |
c2586c82 | 7426 | " M,M,N0HSF,N1HSF,Os,d,d,R,T,NxxSw,NxQSF,Q"))) |
ae156f85 | 7427 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 7428 | "TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
9db1d521 | 7429 | "@ |
f19a9af7 AK |
7430 | # |
7431 | # | |
7432 | nilh\t%0,%j2 | |
2f7e5a0d | 7433 | nill\t%0,%j2 |
ec24698e | 7434 | nilf\t%0,%o2 |
d40c829f | 7435 | nr\t%0,%2 |
65b1d8ea | 7436 | nrk\t%0,%1,%2 |
d40c829f | 7437 | n\t%0,%2 |
8cb66696 | 7438 | ny\t%0,%2 |
e3140518 | 7439 | risbg\t%0,%1,%t2,128+%f2,0 |
0dfa6c5e | 7440 | # |
19b63d8e | 7441 | #" |
e3140518 | 7442 | [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RRF,RX,RXY,RIE,SI,SS") |
3e4be43f | 7443 | (set_attr "cpu_facility" "*,*,*,*,*,*,z196,*,longdisp,z10,*,*") |
9381e3f1 WG |
7444 | (set_attr "z10prop" "*, |
7445 | *, | |
7446 | z10_super_E1, | |
7447 | z10_super_E1, | |
7448 | z10_super_E1, | |
7449 | z10_super_E1, | |
65b1d8ea | 7450 | *, |
9381e3f1 WG |
7451 | z10_super_E1, |
7452 | z10_super_E1, | |
e3140518 | 7453 | z10_super_E1, |
9381e3f1 WG |
7454 | *, |
7455 | *")]) | |
f19a9af7 AK |
7456 | |
7457 | (define_insn "*andsi3_esa" | |
65b1d8ea AK |
7458 | [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d, AQ,Q") |
7459 | (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0, 0,0") | |
7460 | (match_operand:SI 2 "general_operand" " d,R,NxQSF,Q"))) | |
ae156f85 | 7461 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 7462 | "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
f19a9af7 AK |
7463 | "@ |
7464 | nr\t%0,%2 | |
8cb66696 | 7465 | n\t%0,%2 |
0dfa6c5e | 7466 | # |
19b63d8e | 7467 | #" |
9381e3f1 WG |
7468 | [(set_attr "op_type" "RR,RX,SI,SS") |
7469 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")]) | |
7470 | ||
0dfa6c5e UW |
7471 | |
7472 | (define_split | |
7473 | [(set (match_operand:SI 0 "s_operand" "") | |
7474 | (and:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" ""))) | |
ae156f85 | 7475 | (clobber (reg:CC CC_REGNUM))] |
0dfa6c5e UW |
7476 | "reload_completed" |
7477 | [(parallel | |
7478 | [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1))) | |
ae156f85 | 7479 | (clobber (reg:CC CC_REGNUM))])] |
0dfa6c5e | 7480 | "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);") |
4023fb28 | 7481 | |
9db1d521 HP |
7482 | ; |
7483 | ; andhi3 instruction pattern(s). | |
7484 | ; | |
7485 | ||
8cb66696 | 7486 | (define_insn "*andhi3_zarch" |
65b1d8ea AK |
7487 | [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q") |
7488 | (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0") | |
7489 | (match_operand:HI 2 "general_operand" " d,d,n,NxQHF,Q"))) | |
ae156f85 | 7490 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 7491 | "TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
4023fb28 | 7492 | "@ |
d40c829f | 7493 | nr\t%0,%2 |
65b1d8ea | 7494 | nrk\t%0,%1,%2 |
8cb66696 | 7495 | nill\t%0,%x2 |
0dfa6c5e | 7496 | # |
19b63d8e | 7497 | #" |
65b1d8ea AK |
7498 | [(set_attr "op_type" "RR,RRF,RI,SI,SS") |
7499 | (set_attr "cpu_facility" "*,z196,*,*,*") | |
7500 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*") | |
9381e3f1 | 7501 | ]) |
8cb66696 UW |
7502 | |
7503 | (define_insn "*andhi3_esa" | |
0dfa6c5e UW |
7504 | [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q") |
7505 | (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0") | |
7506 | (match_operand:HI 2 "general_operand" "d,NxQHF,Q"))) | |
ae156f85 | 7507 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 UW |
7508 | "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
7509 | "@ | |
7510 | nr\t%0,%2 | |
0dfa6c5e | 7511 | # |
19b63d8e | 7512 | #" |
9381e3f1 WG |
7513 | [(set_attr "op_type" "RR,SI,SS") |
7514 | (set_attr "z10prop" "z10_super_E1,*,*") | |
7515 | ]) | |
0dfa6c5e UW |
7516 | |
7517 | (define_split | |
7518 | [(set (match_operand:HI 0 "s_operand" "") | |
7519 | (and:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" ""))) | |
ae156f85 | 7520 | (clobber (reg:CC CC_REGNUM))] |
0dfa6c5e UW |
7521 | "reload_completed" |
7522 | [(parallel | |
7523 | [(set (match_dup 0) (and:QI (match_dup 0) (match_dup 1))) | |
ae156f85 | 7524 | (clobber (reg:CC CC_REGNUM))])] |
0dfa6c5e | 7525 | "s390_narrow_logical_operator (AND, &operands[0], &operands[1]);") |
9db1d521 | 7526 | |
9db1d521 HP |
7527 | ; |
7528 | ; andqi3 instruction pattern(s). | |
7529 | ; | |
7530 | ||
8cb66696 | 7531 | (define_insn "*andqi3_zarch" |
65b1d8ea AK |
7532 | [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q") |
7533 | (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0") | |
7534 | (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q"))) | |
ae156f85 | 7535 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 7536 | "TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
4023fb28 | 7537 | "@ |
d40c829f | 7538 | nr\t%0,%2 |
65b1d8ea | 7539 | nrk\t%0,%1,%2 |
8cb66696 | 7540 | nill\t%0,%b2 |
fc0ea003 UW |
7541 | ni\t%S0,%b2 |
7542 | niy\t%S0,%b2 | |
19b63d8e | 7543 | #" |
65b1d8ea | 7544 | [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS") |
3e4be43f | 7545 | (set_attr "cpu_facility" "*,z196,*,*,longdisp,*") |
65b1d8ea | 7546 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,z10_super,z10_super,*")]) |
8cb66696 UW |
7547 | |
7548 | (define_insn "*andqi3_esa" | |
7549 | [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q") | |
7550 | (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0") | |
7551 | (match_operand:QI 2 "general_operand" "d,n,Q"))) | |
ae156f85 | 7552 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 7553 | "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
9db1d521 | 7554 | "@ |
8cb66696 | 7555 | nr\t%0,%2 |
fc0ea003 | 7556 | ni\t%S0,%b2 |
19b63d8e | 7557 | #" |
9381e3f1 WG |
7558 | [(set_attr "op_type" "RR,SI,SS") |
7559 | (set_attr "z10prop" "z10_super_E1,z10_super,*")]) | |
4023fb28 | 7560 | |
deb9351f DV |
7561 | ; |
7562 | ; And with complement | |
7563 | ; | |
7564 | ; c = ~b & a = (b & a) ^ a | |
7565 | ||
7566 | (define_insn_and_split "*andc_split_<mode>" | |
7567 | [(set (match_operand:GPR 0 "nonimmediate_operand" "") | |
7568 | (and:GPR (not:GPR (match_operand:GPR 1 "nonimmediate_operand" "")) | |
7569 | (match_operand:GPR 2 "general_operand" ""))) | |
7570 | (clobber (reg:CC CC_REGNUM))] | |
4a9733f3 AK |
7571 | "!TARGET_ARCH13 |
7572 | && ! reload_completed | |
ad7ab32e DV |
7573 | && (GET_CODE (operands[0]) != MEM |
7574 | /* Ensure that s390_logical_operator_ok_p will succeed even | |
7575 | on the split xor if (b & a) is stored into a pseudo. */ | |
7576 | || rtx_equal_p (operands[0], operands[2]))" | |
deb9351f DV |
7577 | "#" |
7578 | "&& 1" | |
7579 | [ | |
7580 | (parallel | |
7581 | [(set (match_dup 3) (and:GPR (match_dup 1) (match_dup 2))) | |
7582 | (clobber (reg:CC CC_REGNUM))]) | |
7583 | (parallel | |
7584 | [(set (match_dup 0) (xor:GPR (match_dup 3) (match_dup 2))) | |
7585 | (clobber (reg:CC CC_REGNUM))])] | |
7586 | { | |
7587 | if (reg_overlap_mentioned_p (operands[0], operands[2])) | |
7588 | operands[3] = gen_reg_rtx (<MODE>mode); | |
7589 | else | |
7590 | operands[3] = operands[0]; | |
7591 | }) | |
7592 | ||
19b63d8e UW |
7593 | ; |
7594 | ; Block and (NC) patterns. | |
7595 | ; | |
7596 | ||
7597 | (define_insn "*nc" | |
7598 | [(set (match_operand:BLK 0 "memory_operand" "=Q") | |
7599 | (and:BLK (match_dup 0) | |
7600 | (match_operand:BLK 1 "memory_operand" "Q"))) | |
7601 | (use (match_operand 2 "const_int_operand" "n")) | |
ae156f85 | 7602 | (clobber (reg:CC CC_REGNUM))] |
19b63d8e | 7603 | "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256" |
fc0ea003 | 7604 | "nc\t%O0(%2,%R0),%S1" |
65b1d8ea AK |
7605 | [(set_attr "op_type" "SS") |
7606 | (set_attr "z196prop" "z196_cracked")]) | |
19b63d8e UW |
7607 | |
7608 | (define_split | |
7609 | [(set (match_operand 0 "memory_operand" "") | |
7610 | (and (match_dup 0) | |
7611 | (match_operand 1 "memory_operand" ""))) | |
ae156f85 | 7612 | (clobber (reg:CC CC_REGNUM))] |
19b63d8e UW |
7613 | "reload_completed |
7614 | && GET_MODE (operands[0]) == GET_MODE (operands[1]) | |
7615 | && GET_MODE_SIZE (GET_MODE (operands[0])) > 0" | |
7616 | [(parallel | |
7617 | [(set (match_dup 0) (and:BLK (match_dup 0) (match_dup 1))) | |
7618 | (use (match_dup 2)) | |
ae156f85 | 7619 | (clobber (reg:CC CC_REGNUM))])] |
19b63d8e UW |
7620 | { |
7621 | operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0]))); | |
7622 | operands[0] = adjust_address (operands[0], BLKmode, 0); | |
7623 | operands[1] = adjust_address (operands[1], BLKmode, 0); | |
7624 | }) | |
7625 | ||
7626 | (define_peephole2 | |
7627 | [(parallel | |
7628 | [(set (match_operand:BLK 0 "memory_operand" "") | |
7629 | (and:BLK (match_dup 0) | |
7630 | (match_operand:BLK 1 "memory_operand" ""))) | |
7631 | (use (match_operand 2 "const_int_operand" "")) | |
ae156f85 | 7632 | (clobber (reg:CC CC_REGNUM))]) |
19b63d8e UW |
7633 | (parallel |
7634 | [(set (match_operand:BLK 3 "memory_operand" "") | |
7635 | (and:BLK (match_dup 3) | |
7636 | (match_operand:BLK 4 "memory_operand" ""))) | |
7637 | (use (match_operand 5 "const_int_operand" "")) | |
ae156f85 | 7638 | (clobber (reg:CC CC_REGNUM))])] |
19b63d8e UW |
7639 | "s390_offset_p (operands[0], operands[3], operands[2]) |
7640 | && s390_offset_p (operands[1], operands[4], operands[2]) | |
9381e3f1 | 7641 | && !s390_overlap_p (operands[0], operands[1], |
bcf8c1cc | 7642 | INTVAL (operands[2]) + INTVAL (operands[5])) |
19b63d8e UW |
7643 | && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256" |
7644 | [(parallel | |
7645 | [(set (match_dup 6) (and:BLK (match_dup 6) (match_dup 7))) | |
7646 | (use (match_dup 8)) | |
ae156f85 | 7647 | (clobber (reg:CC CC_REGNUM))])] |
19b63d8e UW |
7648 | "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0)); |
7649 | operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0)); | |
7650 | operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));") | |
7651 | ||
9db1d521 HP |
7652 | |
7653 | ;; | |
7654 | ;;- Bit set (inclusive or) instructions. | |
7655 | ;; | |
7656 | ||
047d35ed AS |
7657 | (define_expand "ior<mode>3" |
7658 | [(set (match_operand:INT 0 "nonimmediate_operand" "") | |
7659 | (ior:INT (match_operand:INT 1 "nonimmediate_operand" "") | |
7660 | (match_operand:INT 2 "general_operand" ""))) | |
7661 | (clobber (reg:CC CC_REGNUM))] | |
7662 | "" | |
7663 | "s390_expand_logical_operator (IOR, <MODE>mode, operands); DONE;") | |
7664 | ||
9db1d521 HP |
7665 | ; |
7666 | ; iordi3 instruction pattern(s). | |
7667 | ; | |
7668 | ||
4023fb28 | 7669 | (define_insn "*iordi3_cc" |
ae156f85 | 7670 | [(set (reg CC_REGNUM) |
3e4be43f UW |
7671 | (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0") |
7672 | (match_operand:DI 2 "general_operand" " d,d,T")) | |
4023fb28 | 7673 | (const_int 0))) |
3e4be43f | 7674 | (set (match_operand:DI 0 "register_operand" "=d,d,d") |
4023fb28 | 7675 | (ior:DI (match_dup 1) (match_dup 2)))] |
9602b6a1 | 7676 | "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH" |
4023fb28 | 7677 | "@ |
d40c829f | 7678 | ogr\t%0,%2 |
65b1d8ea | 7679 | ogrk\t%0,%1,%2 |
d40c829f | 7680 | og\t%0,%2" |
65b1d8ea AK |
7681 | [(set_attr "op_type" "RRE,RRF,RXY") |
7682 | (set_attr "cpu_facility" "*,z196,*") | |
7683 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")]) | |
4023fb28 UW |
7684 | |
7685 | (define_insn "*iordi3_cconly" | |
ae156f85 | 7686 | [(set (reg CC_REGNUM) |
65b1d8ea | 7687 | (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0") |
3e4be43f | 7688 | (match_operand:DI 2 "general_operand" " d,d,T")) |
4023fb28 | 7689 | (const_int 0))) |
65b1d8ea | 7690 | (clobber (match_scratch:DI 0 "=d,d,d"))] |
9602b6a1 | 7691 | "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH" |
4023fb28 | 7692 | "@ |
d40c829f | 7693 | ogr\t%0,%2 |
65b1d8ea | 7694 | ogrk\t%0,%1,%2 |
d40c829f | 7695 | og\t%0,%2" |
65b1d8ea AK |
7696 | [(set_attr "op_type" "RRE,RRF,RXY") |
7697 | (set_attr "cpu_facility" "*,z196,*") | |
7698 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")]) | |
4023fb28 | 7699 | |
3af8e996 | 7700 | (define_insn "*iordi3" |
65b1d8ea | 7701 | [(set (match_operand:DI 0 "nonimmediate_operand" |
3e4be43f | 7702 | "=d, d, d, d, d, d,d,d,d, AQ,Q") |
65b1d8ea | 7703 | (ior:DI (match_operand:DI 1 "nonimmediate_operand" |
3e4be43f | 7704 | " %0, 0, 0, 0, 0, 0,0,d,0, 0,0") |
ec24698e | 7705 | (match_operand:DI 2 "general_operand" |
3e4be43f | 7706 | "N0HD0,N1HD0,N2HD0,N3HD0,N0SD0,N1SD0,d,d,T,NxQD0,Q"))) |
ec24698e | 7707 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 7708 | "TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
ec24698e UW |
7709 | "@ |
7710 | oihh\t%0,%i2 | |
7711 | oihl\t%0,%i2 | |
7712 | oilh\t%0,%i2 | |
7713 | oill\t%0,%i2 | |
7714 | oihf\t%0,%k2 | |
7715 | oilf\t%0,%k2 | |
7716 | ogr\t%0,%2 | |
65b1d8ea | 7717 | ogrk\t%0,%1,%2 |
ec24698e UW |
7718 | og\t%0,%2 |
7719 | # | |
7720 | #" | |
65b1d8ea AK |
7721 | [(set_attr "op_type" "RI,RI,RI,RI,RIL,RIL,RRE,RRF,RXY,SI,SS") |
7722 | (set_attr "cpu_facility" "*,*,*,*,extimm,extimm,*,z196,*,*,*") | |
9381e3f1 WG |
7723 | (set_attr "z10prop" "z10_super_E1, |
7724 | z10_super_E1, | |
7725 | z10_super_E1, | |
7726 | z10_super_E1, | |
7727 | z10_super_E1, | |
7728 | z10_super_E1, | |
7729 | z10_super_E1, | |
65b1d8ea | 7730 | *, |
9381e3f1 WG |
7731 | z10_super_E1, |
7732 | *, | |
7733 | *")]) | |
0dfa6c5e UW |
7734 | |
7735 | (define_split | |
7736 | [(set (match_operand:DI 0 "s_operand" "") | |
7737 | (ior:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" ""))) | |
ae156f85 | 7738 | (clobber (reg:CC CC_REGNUM))] |
0dfa6c5e UW |
7739 | "reload_completed" |
7740 | [(parallel | |
7741 | [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1))) | |
ae156f85 | 7742 | (clobber (reg:CC CC_REGNUM))])] |
0dfa6c5e | 7743 | "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);") |
4023fb28 | 7744 | |
9db1d521 HP |
7745 | ; |
7746 | ; iorsi3 instruction pattern(s). | |
7747 | ; | |
7748 | ||
4023fb28 | 7749 | (define_insn "*iorsi3_cc" |
ae156f85 | 7750 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
7751 | (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0") |
7752 | (match_operand:SI 2 "general_operand" "Os,d,d,R,T")) | |
4023fb28 | 7753 | (const_int 0))) |
65b1d8ea | 7754 | (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d") |
4023fb28 UW |
7755 | (ior:SI (match_dup 1) (match_dup 2)))] |
7756 | "s390_match_ccmode(insn, CCTmode)" | |
7757 | "@ | |
ec24698e | 7758 | oilf\t%0,%o2 |
d40c829f | 7759 | or\t%0,%2 |
65b1d8ea | 7760 | ork\t%0,%1,%2 |
d40c829f UW |
7761 | o\t%0,%2 |
7762 | oy\t%0,%2" | |
65b1d8ea | 7763 | [(set_attr "op_type" "RIL,RR,RRF,RX,RXY") |
3e4be43f | 7764 | (set_attr "cpu_facility" "*,*,z196,*,longdisp") |
65b1d8ea | 7765 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")]) |
4023fb28 UW |
7766 | |
7767 | (define_insn "*iorsi3_cconly" | |
ae156f85 | 7768 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
7769 | (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0") |
7770 | (match_operand:SI 2 "general_operand" "Os,d,d,R,T")) | |
4023fb28 | 7771 | (const_int 0))) |
65b1d8ea | 7772 | (clobber (match_scratch:SI 0 "=d,d,d,d,d"))] |
4023fb28 UW |
7773 | "s390_match_ccmode(insn, CCTmode)" |
7774 | "@ | |
ec24698e | 7775 | oilf\t%0,%o2 |
d40c829f | 7776 | or\t%0,%2 |
65b1d8ea | 7777 | ork\t%0,%1,%2 |
d40c829f UW |
7778 | o\t%0,%2 |
7779 | oy\t%0,%2" | |
65b1d8ea | 7780 | [(set_attr "op_type" "RIL,RR,RRF,RX,RXY") |
3e4be43f | 7781 | (set_attr "cpu_facility" "*,*,z196,*,longdisp") |
65b1d8ea | 7782 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super_E1,z10_super_E1")]) |
4023fb28 | 7783 | |
8cb66696 | 7784 | (define_insn "*iorsi3_zarch" |
65b1d8ea AK |
7785 | [(set (match_operand:SI 0 "nonimmediate_operand" "=d, d, d,d,d,d,d, AQ,Q") |
7786 | (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0, 0, 0,0,d,0,0, 0,0") | |
7787 | (match_operand:SI 2 "general_operand" "N0HS0,N1HS0,Os,d,d,R,T,NxQS0,Q"))) | |
ae156f85 | 7788 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 7789 | "TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
4023fb28 | 7790 | "@ |
f19a9af7 AK |
7791 | oilh\t%0,%i2 |
7792 | oill\t%0,%i2 | |
ec24698e | 7793 | oilf\t%0,%o2 |
d40c829f | 7794 | or\t%0,%2 |
65b1d8ea | 7795 | ork\t%0,%1,%2 |
d40c829f | 7796 | o\t%0,%2 |
8cb66696 | 7797 | oy\t%0,%2 |
0dfa6c5e | 7798 | # |
19b63d8e | 7799 | #" |
65b1d8ea | 7800 | [(set_attr "op_type" "RI,RI,RIL,RR,RRF,RX,RXY,SI,SS") |
3e4be43f | 7801 | (set_attr "cpu_facility" "*,*,*,*,z196,*,longdisp,*,*") |
9381e3f1 WG |
7802 | (set_attr "z10prop" "z10_super_E1, |
7803 | z10_super_E1, | |
7804 | z10_super_E1, | |
7805 | z10_super_E1, | |
65b1d8ea | 7806 | *, |
9381e3f1 WG |
7807 | z10_super_E1, |
7808 | z10_super_E1, | |
7809 | *, | |
7810 | *")]) | |
8cb66696 UW |
7811 | |
7812 | (define_insn "*iorsi3_esa" | |
0dfa6c5e | 7813 | [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q") |
bad82153 | 7814 | (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0") |
0dfa6c5e | 7815 | (match_operand:SI 2 "general_operand" "d,R,NxQS0,Q"))) |
ae156f85 | 7816 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 7817 | "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
f19a9af7 AK |
7818 | "@ |
7819 | or\t%0,%2 | |
8cb66696 | 7820 | o\t%0,%2 |
0dfa6c5e | 7821 | # |
19b63d8e | 7822 | #" |
9381e3f1 WG |
7823 | [(set_attr "op_type" "RR,RX,SI,SS") |
7824 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")]) | |
0dfa6c5e UW |
7825 | |
7826 | (define_split | |
7827 | [(set (match_operand:SI 0 "s_operand" "") | |
7828 | (ior:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" ""))) | |
ae156f85 | 7829 | (clobber (reg:CC CC_REGNUM))] |
0dfa6c5e UW |
7830 | "reload_completed" |
7831 | [(parallel | |
7832 | [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1))) | |
ae156f85 | 7833 | (clobber (reg:CC CC_REGNUM))])] |
0dfa6c5e | 7834 | "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);") |
4023fb28 | 7835 | |
4023fb28 UW |
7836 | ; |
7837 | ; iorhi3 instruction pattern(s). | |
7838 | ; | |
7839 | ||
8cb66696 | 7840 | (define_insn "*iorhi3_zarch" |
65b1d8ea AK |
7841 | [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q") |
7842 | (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,d,0, 0,0") | |
7843 | (match_operand:HI 2 "general_operand" " d,d,n,NxQH0,Q"))) | |
ae156f85 | 7844 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 7845 | "TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
4023fb28 | 7846 | "@ |
d40c829f | 7847 | or\t%0,%2 |
65b1d8ea | 7848 | ork\t%0,%1,%2 |
8cb66696 | 7849 | oill\t%0,%x2 |
0dfa6c5e | 7850 | # |
19b63d8e | 7851 | #" |
65b1d8ea AK |
7852 | [(set_attr "op_type" "RR,RRF,RI,SI,SS") |
7853 | (set_attr "cpu_facility" "*,z196,*,*,*") | |
7854 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1,*,*")]) | |
8cb66696 UW |
7855 | |
7856 | (define_insn "*iorhi3_esa" | |
0dfa6c5e UW |
7857 | [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q") |
7858 | (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,0") | |
7859 | (match_operand:HI 2 "general_operand" "d,NxQH0,Q"))) | |
ae156f85 | 7860 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 UW |
7861 | "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
7862 | "@ | |
7863 | or\t%0,%2 | |
0dfa6c5e | 7864 | # |
19b63d8e | 7865 | #" |
9381e3f1 WG |
7866 | [(set_attr "op_type" "RR,SI,SS") |
7867 | (set_attr "z10prop" "z10_super_E1,*,*")]) | |
0dfa6c5e UW |
7868 | |
7869 | (define_split | |
7870 | [(set (match_operand:HI 0 "s_operand" "") | |
7871 | (ior:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" ""))) | |
ae156f85 | 7872 | (clobber (reg:CC CC_REGNUM))] |
0dfa6c5e UW |
7873 | "reload_completed" |
7874 | [(parallel | |
7875 | [(set (match_dup 0) (ior:QI (match_dup 0) (match_dup 1))) | |
ae156f85 | 7876 | (clobber (reg:CC CC_REGNUM))])] |
0dfa6c5e | 7877 | "s390_narrow_logical_operator (IOR, &operands[0], &operands[1]);") |
9db1d521 | 7878 | |
9db1d521 | 7879 | ; |
4023fb28 | 7880 | ; iorqi3 instruction pattern(s). |
9db1d521 HP |
7881 | ; |
7882 | ||
8cb66696 | 7883 | (define_insn "*iorqi3_zarch" |
65b1d8ea AK |
7884 | [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q") |
7885 | (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,d,0,0,0,0") | |
7886 | (match_operand:QI 2 "general_operand" " d,d,n,n,n,Q"))) | |
ae156f85 | 7887 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 7888 | "TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
4023fb28 | 7889 | "@ |
d40c829f | 7890 | or\t%0,%2 |
65b1d8ea | 7891 | ork\t%0,%1,%2 |
8cb66696 | 7892 | oill\t%0,%b2 |
fc0ea003 UW |
7893 | oi\t%S0,%b2 |
7894 | oiy\t%S0,%b2 | |
19b63d8e | 7895 | #" |
65b1d8ea | 7896 | [(set_attr "op_type" "RR,RRF,RI,SI,SIY,SS") |
3e4be43f | 7897 | (set_attr "cpu_facility" "*,z196,*,*,longdisp,*") |
65b1d8ea AK |
7898 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1, |
7899 | z10_super,z10_super,*")]) | |
8cb66696 UW |
7900 | |
7901 | (define_insn "*iorqi3_esa" | |
7902 | [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q") | |
7903 | (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0") | |
7904 | (match_operand:QI 2 "general_operand" "d,n,Q"))) | |
ae156f85 | 7905 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 7906 | "!TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
9db1d521 | 7907 | "@ |
8cb66696 | 7908 | or\t%0,%2 |
fc0ea003 | 7909 | oi\t%S0,%b2 |
19b63d8e | 7910 | #" |
9381e3f1 WG |
7911 | [(set_attr "op_type" "RR,SI,SS") |
7912 | (set_attr "z10prop" "z10_super_E1,z10_super,*")]) | |
9db1d521 | 7913 | |
4a9733f3 AK |
7914 | ; |
7915 | ; And/Or with complement | |
7916 | ; | |
7917 | ||
7918 | ; ncrk, ncgrk, ocrk, ocgrk | |
7919 | (define_insn "*<ANDOR:bitops_name>c<GPR:mode>_cc" | |
7920 | [(set (reg CC_REGNUM) | |
7921 | (compare | |
7922 | (ANDOR:GPR (not:GPR (match_operand:GPR 1 "register_operand" "d")) | |
7923 | (match_operand:GPR 2 "register_operand" "d")) | |
7924 | (const_int 0))) | |
7925 | (set (match_operand:GPR 0 "register_operand" "=d") | |
7926 | (ANDOR:GPR (not:GPR (match_dup 1)) | |
7927 | (match_dup 2)))] | |
7928 | "TARGET_ARCH13 && s390_match_ccmode(insn, CCTmode)" | |
7929 | "<ANDOR:noxa>c<GPR:g>rk\t%0,%2,%1" | |
7930 | [(set_attr "op_type" "RRF")]) | |
7931 | ||
7932 | ; ncrk, ncgrk, ocrk, ocgrk | |
7933 | (define_insn "*<ANDOR:bitops_name>c<GPR:mode>_cconly" | |
7934 | [(set (reg CC_REGNUM) | |
7935 | (compare | |
7936 | (ANDOR:GPR (not:GPR (match_operand:GPR 1 "register_operand" "d")) | |
7937 | (match_operand:GPR 2 "register_operand" "d")) | |
7938 | (const_int 0))) | |
7939 | (clobber (match_scratch:GPR 0 "=d"))] | |
7940 | "TARGET_ARCH13 && s390_match_ccmode(insn, CCTmode)" | |
7941 | "<ANDOR:noxa>c<GPR:g>rk\t%0,%2,%1" | |
7942 | [(set_attr "op_type" "RRF")]) | |
7943 | ||
7944 | ; ncrk, ncgrk, ocrk, ocgrk | |
7945 | (define_insn "*<ANDOR:bitops_name>c<GPR:mode>" | |
7946 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
7947 | (ANDOR:GPR (not:GPR (match_operand:GPR 1 "register_operand" "d")) | |
7948 | (match_operand:GPR 2 "register_operand" "d"))) | |
7949 | (clobber (reg:CC CC_REGNUM))] | |
7950 | "TARGET_ARCH13" | |
7951 | "<ANDOR:noxa>c<GPR:g>rk\t%0,%2,%1" | |
7952 | [(set_attr "op_type" "RRF")]) | |
7953 | ||
7954 | ; | |
7955 | ;- Nand/Nor instructions. | |
7956 | ; | |
7957 | ||
7958 | ; nnrk, nngrk, nork, nogrk | |
7959 | (define_insn "*n<ANDOR:inv_bitops_name><GPR:mode>_cc" | |
7960 | [(set (reg CC_REGNUM) | |
7961 | (compare | |
7962 | (ANDOR:GPR (not:GPR (match_operand:GPR 1 "register_operand" "d")) | |
7963 | (not:GPR (match_operand:GPR 2 "register_operand" "d"))) | |
7964 | (const_int 0))) | |
7965 | (set (match_operand:GPR 0 "register_operand" "=d") | |
7966 | (ANDOR:GPR (not:GPR (match_dup 1)) | |
7967 | (not:GPR (match_dup 2))))] | |
7968 | "TARGET_ARCH13 && s390_match_ccmode(insn, CCTmode)" | |
7969 | "n<ANDOR:inv_no><GPR:g>rk\t%0,%1,%2" | |
7970 | [(set_attr "op_type" "RRF")]) | |
7971 | ||
7972 | ; nnrk, nngrk, nork, nogrk | |
7973 | (define_insn "*n<ANDOR:inv_bitops_name><mode>_cconly" | |
7974 | [(set (reg CC_REGNUM) | |
7975 | (compare | |
7976 | (ANDOR:GPR (not:GPR (match_operand:GPR 1 "register_operand" "d")) | |
7977 | (not:GPR (match_operand:GPR 2 "register_operand" "d"))) | |
7978 | (const_int 0))) | |
7979 | (clobber (match_scratch:GPR 0 "=d"))] | |
7980 | "TARGET_ARCH13 && s390_match_ccmode(insn, CCTmode)" | |
7981 | "n<ANDOR:inv_no><GPR:g>rk\t%0,%1,%2" | |
7982 | [(set_attr "op_type" "RRF")]) | |
7983 | ||
7984 | ; nnrk, nngrk, nork, nogrk | |
7985 | (define_insn "*n<ANDOR:inv_bitops_name><mode>" | |
7986 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
7987 | (ANDOR:GPR (not:GPR (match_operand:GPR 1 "register_operand" "d")) | |
7988 | (not:GPR (match_operand:GPR 2 "register_operand" "d")))) | |
7989 | (clobber (reg:CC CC_REGNUM))] | |
7990 | "TARGET_ARCH13" | |
7991 | "n<ANDOR:inv_no><GPR:g>rk\t%0,%1,%2" | |
7992 | [(set_attr "op_type" "RRF")]) | |
7993 | ||
7994 | ||
19b63d8e UW |
7995 | ; |
7996 | ; Block inclusive or (OC) patterns. | |
7997 | ; | |
7998 | ||
7999 | (define_insn "*oc" | |
8000 | [(set (match_operand:BLK 0 "memory_operand" "=Q") | |
8001 | (ior:BLK (match_dup 0) | |
8002 | (match_operand:BLK 1 "memory_operand" "Q"))) | |
8003 | (use (match_operand 2 "const_int_operand" "n")) | |
ae156f85 | 8004 | (clobber (reg:CC CC_REGNUM))] |
19b63d8e | 8005 | "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256" |
fc0ea003 | 8006 | "oc\t%O0(%2,%R0),%S1" |
65b1d8ea AK |
8007 | [(set_attr "op_type" "SS") |
8008 | (set_attr "z196prop" "z196_cracked")]) | |
19b63d8e UW |
8009 | |
8010 | (define_split | |
8011 | [(set (match_operand 0 "memory_operand" "") | |
8012 | (ior (match_dup 0) | |
8013 | (match_operand 1 "memory_operand" ""))) | |
ae156f85 | 8014 | (clobber (reg:CC CC_REGNUM))] |
19b63d8e UW |
8015 | "reload_completed |
8016 | && GET_MODE (operands[0]) == GET_MODE (operands[1]) | |
8017 | && GET_MODE_SIZE (GET_MODE (operands[0])) > 0" | |
8018 | [(parallel | |
8019 | [(set (match_dup 0) (ior:BLK (match_dup 0) (match_dup 1))) | |
8020 | (use (match_dup 2)) | |
ae156f85 | 8021 | (clobber (reg:CC CC_REGNUM))])] |
19b63d8e UW |
8022 | { |
8023 | operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0]))); | |
8024 | operands[0] = adjust_address (operands[0], BLKmode, 0); | |
8025 | operands[1] = adjust_address (operands[1], BLKmode, 0); | |
8026 | }) | |
8027 | ||
8028 | (define_peephole2 | |
8029 | [(parallel | |
8030 | [(set (match_operand:BLK 0 "memory_operand" "") | |
8031 | (ior:BLK (match_dup 0) | |
8032 | (match_operand:BLK 1 "memory_operand" ""))) | |
8033 | (use (match_operand 2 "const_int_operand" "")) | |
ae156f85 | 8034 | (clobber (reg:CC CC_REGNUM))]) |
19b63d8e UW |
8035 | (parallel |
8036 | [(set (match_operand:BLK 3 "memory_operand" "") | |
8037 | (ior:BLK (match_dup 3) | |
8038 | (match_operand:BLK 4 "memory_operand" ""))) | |
8039 | (use (match_operand 5 "const_int_operand" "")) | |
ae156f85 | 8040 | (clobber (reg:CC CC_REGNUM))])] |
19b63d8e UW |
8041 | "s390_offset_p (operands[0], operands[3], operands[2]) |
8042 | && s390_offset_p (operands[1], operands[4], operands[2]) | |
9381e3f1 | 8043 | && !s390_overlap_p (operands[0], operands[1], |
bcf8c1cc | 8044 | INTVAL (operands[2]) + INTVAL (operands[5])) |
19b63d8e UW |
8045 | && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256" |
8046 | [(parallel | |
8047 | [(set (match_dup 6) (ior:BLK (match_dup 6) (match_dup 7))) | |
8048 | (use (match_dup 8)) | |
ae156f85 | 8049 | (clobber (reg:CC CC_REGNUM))])] |
19b63d8e UW |
8050 | "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0)); |
8051 | operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0)); | |
8052 | operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));") | |
8053 | ||
9db1d521 HP |
8054 | |
8055 | ;; | |
8056 | ;;- Xor instructions. | |
8057 | ;; | |
8058 | ||
047d35ed AS |
8059 | (define_expand "xor<mode>3" |
8060 | [(set (match_operand:INT 0 "nonimmediate_operand" "") | |
8061 | (xor:INT (match_operand:INT 1 "nonimmediate_operand" "") | |
8062 | (match_operand:INT 2 "general_operand" ""))) | |
8063 | (clobber (reg:CC CC_REGNUM))] | |
8064 | "" | |
8065 | "s390_expand_logical_operator (XOR, <MODE>mode, operands); DONE;") | |
8066 | ||
3c91f126 AK |
8067 | ; Combine replaces (xor (x) (const_int -1)) with (not (x)) when doing |
8068 | ; simplifications. So its better to have something matching. | |
8069 | (define_split | |
8070 | [(set (match_operand:INT 0 "nonimmediate_operand" "") | |
8071 | (not:INT (match_operand:INT 1 "nonimmediate_operand" "")))] | |
8072 | "" | |
8073 | [(parallel | |
8074 | [(set (match_dup 0) (xor:INT (match_dup 1) (match_dup 2))) | |
8075 | (clobber (reg:CC CC_REGNUM))])] | |
8076 | { | |
8077 | operands[2] = constm1_rtx; | |
8078 | if (!s390_logical_operator_ok_p (operands)) | |
8079 | FAIL; | |
8080 | }) | |
8081 | ||
9db1d521 HP |
8082 | ; |
8083 | ; xordi3 instruction pattern(s). | |
8084 | ; | |
8085 | ||
4023fb28 | 8086 | (define_insn "*xordi3_cc" |
ae156f85 | 8087 | [(set (reg CC_REGNUM) |
3e4be43f UW |
8088 | (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0") |
8089 | (match_operand:DI 2 "general_operand" " d,d,T")) | |
4023fb28 | 8090 | (const_int 0))) |
3e4be43f | 8091 | (set (match_operand:DI 0 "register_operand" "=d,d,d") |
4023fb28 | 8092 | (xor:DI (match_dup 1) (match_dup 2)))] |
9602b6a1 | 8093 | "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH" |
4023fb28 | 8094 | "@ |
d40c829f | 8095 | xgr\t%0,%2 |
65b1d8ea | 8096 | xgrk\t%0,%1,%2 |
d40c829f | 8097 | xg\t%0,%2" |
65b1d8ea | 8098 | [(set_attr "op_type" "RRE,RRF,RXY") |
5490de28 | 8099 | (set_attr "cpu_facility" "*,z196,*") |
65b1d8ea | 8100 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")]) |
4023fb28 UW |
8101 | |
8102 | (define_insn "*xordi3_cconly" | |
ae156f85 | 8103 | [(set (reg CC_REGNUM) |
3e4be43f UW |
8104 | (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,d,0") |
8105 | (match_operand:DI 2 "general_operand" " d,d,T")) | |
4023fb28 | 8106 | (const_int 0))) |
3e4be43f | 8107 | (clobber (match_scratch:DI 0 "=d,d,d"))] |
9602b6a1 | 8108 | "s390_match_ccmode(insn, CCTmode) && TARGET_ZARCH" |
4023fb28 | 8109 | "@ |
d40c829f | 8110 | xgr\t%0,%2 |
65b1d8ea | 8111 | xgrk\t%0,%1,%2 |
c7fd8cd8 | 8112 | xg\t%0,%2" |
65b1d8ea AK |
8113 | [(set_attr "op_type" "RRE,RRF,RXY") |
8114 | (set_attr "cpu_facility" "*,z196,*") | |
8115 | (set_attr "z10prop" "z10_super_E1,*,z10_super_E1")]) | |
4023fb28 | 8116 | |
3af8e996 | 8117 | (define_insn "*xordi3" |
3e4be43f UW |
8118 | [(set (match_operand:DI 0 "nonimmediate_operand" "=d, d,d,d,d, AQ,Q") |
8119 | (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0, 0,0,d,0, 0,0") | |
8120 | (match_operand:DI 2 "general_operand" "N0SD0,N1SD0,d,d,T,NxQD0,Q"))) | |
ec24698e | 8121 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 8122 | "TARGET_ZARCH && s390_logical_operator_ok_p (operands)" |
ec24698e UW |
8123 | "@ |
8124 | xihf\t%0,%k2 | |
8125 | xilf\t%0,%k2 | |
8126 | xgr\t%0,%2 | |
65b1d8ea | 8127 | xgrk\t%0,%1,%2 |
ec24698e UW |
8128 | xg\t%0,%2 |
8129 | # | |
8130 | #" | |
65b1d8ea AK |
8131 | [(set_attr "op_type" "RIL,RIL,RRE,RRF,RXY,SI,SS") |
8132 | (set_attr "cpu_facility" "extimm,extimm,*,z196,*,*,*") | |
8133 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1, | |
8134 | *,z10_super_E1,*,*")]) | |
0dfa6c5e UW |
8135 | |
8136 | (define_split | |
8137 | [(set (match_operand:DI 0 "s_operand" "") | |
8138 | (xor:DI (match_dup 0) (match_operand:DI 1 "immediate_operand" ""))) | |
ae156f85 | 8139 | (clobber (reg:CC CC_REGNUM))] |
0dfa6c5e UW |
8140 | "reload_completed" |
8141 | [(parallel | |
8142 | [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1))) | |
ae156f85 | 8143 | (clobber (reg:CC CC_REGNUM))])] |
0dfa6c5e | 8144 | "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);") |
4023fb28 | 8145 | |
9db1d521 HP |
8146 | ; |
8147 | ; xorsi3 instruction pattern(s). | |
8148 | ; | |
8149 | ||
4023fb28 | 8150 | (define_insn "*xorsi3_cc" |
ae156f85 | 8151 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
8152 | (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0") |
8153 | (match_operand:SI 2 "general_operand" "Os,d,d,R,T")) | |
4023fb28 | 8154 | (const_int 0))) |
65b1d8ea | 8155 | (set (match_operand:SI 0 "register_operand" "=d,d,d,d,d") |
4023fb28 UW |
8156 | (xor:SI (match_dup 1) (match_dup 2)))] |
8157 | "s390_match_ccmode(insn, CCTmode)" | |
8158 | "@ | |
ec24698e | 8159 | xilf\t%0,%o2 |
d40c829f | 8160 | xr\t%0,%2 |
65b1d8ea | 8161 | xrk\t%0,%1,%2 |
d40c829f UW |
8162 | x\t%0,%2 |
8163 | xy\t%0,%2" | |
65b1d8ea | 8164 | [(set_attr "op_type" "RIL,RR,RRF,RX,RXY") |
3e4be43f | 8165 | (set_attr "cpu_facility" "*,*,z196,*,longdisp") |
65b1d8ea AK |
8166 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,*, |
8167 | z10_super_E1,z10_super_E1")]) | |
4023fb28 UW |
8168 | |
8169 | (define_insn "*xorsi3_cconly" | |
ae156f85 | 8170 | [(set (reg CC_REGNUM) |
65b1d8ea AK |
8171 | (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0") |
8172 | (match_operand:SI 2 "general_operand" "Os,d,d,R,T")) | |
4023fb28 | 8173 | (const_int 0))) |
65b1d8ea | 8174 | (clobber (match_scratch:SI 0 "=d,d,d,d,d"))] |
4023fb28 UW |
8175 | "s390_match_ccmode(insn, CCTmode)" |
8176 | "@ | |
ec24698e | 8177 | xilf\t%0,%o2 |
d40c829f | 8178 | xr\t%0,%2 |
65b1d8ea | 8179 | xrk\t%0,%1,%2 |
d40c829f UW |
8180 | x\t%0,%2 |
8181 | xy\t%0,%2" | |
65b1d8ea | 8182 | [(set_attr "op_type" "RIL,RR,RRF,RX,RXY") |
3e4be43f | 8183 | (set_attr "cpu_facility" "*,*,z196,*,longdisp") |
65b1d8ea AK |
8184 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,*, |
8185 | z10_super_E1,z10_super_E1")]) | |
9db1d521 | 8186 | |
8cb66696 | 8187 | (define_insn "*xorsi3" |
65b1d8ea AK |
8188 | [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d, AQ,Q") |
8189 | (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,d,0,0, 0,0") | |
8190 | (match_operand:SI 2 "general_operand" "Os,d,d,R,T,NxQS0,Q"))) | |
ae156f85 | 8191 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 8192 | "s390_logical_operator_ok_p (operands)" |
9db1d521 | 8193 | "@ |
ec24698e | 8194 | xilf\t%0,%o2 |
d40c829f | 8195 | xr\t%0,%2 |
65b1d8ea | 8196 | xrk\t%0,%1,%2 |
d40c829f | 8197 | x\t%0,%2 |
8cb66696 | 8198 | xy\t%0,%2 |
0dfa6c5e | 8199 | # |
19b63d8e | 8200 | #" |
65b1d8ea | 8201 | [(set_attr "op_type" "RIL,RR,RRF,RX,RXY,SI,SS") |
3e4be43f | 8202 | (set_attr "cpu_facility" "*,*,z196,*,longdisp,*,*") |
65b1d8ea AK |
8203 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,*, |
8204 | z10_super_E1,z10_super_E1,*,*")]) | |
0dfa6c5e UW |
8205 | |
8206 | (define_split | |
8207 | [(set (match_operand:SI 0 "s_operand" "") | |
8208 | (xor:SI (match_dup 0) (match_operand:SI 1 "immediate_operand" ""))) | |
ae156f85 | 8209 | (clobber (reg:CC CC_REGNUM))] |
0dfa6c5e UW |
8210 | "reload_completed" |
8211 | [(parallel | |
8212 | [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1))) | |
ae156f85 | 8213 | (clobber (reg:CC CC_REGNUM))])] |
0dfa6c5e | 8214 | "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);") |
8cb66696 | 8215 | |
9db1d521 HP |
8216 | ; |
8217 | ; xorhi3 instruction pattern(s). | |
8218 | ; | |
8219 | ||
8cb66696 | 8220 | (define_insn "*xorhi3" |
65b1d8ea AK |
8221 | [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d, AQ,Q") |
8222 | (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,d, 0,0") | |
8223 | (match_operand:HI 2 "general_operand" "Os,d,d,NxQH0,Q"))) | |
ae156f85 | 8224 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 UW |
8225 | "s390_logical_operator_ok_p (operands)" |
8226 | "@ | |
ec24698e | 8227 | xilf\t%0,%x2 |
8cb66696 | 8228 | xr\t%0,%2 |
65b1d8ea | 8229 | xrk\t%0,%1,%2 |
0dfa6c5e | 8230 | # |
19b63d8e | 8231 | #" |
65b1d8ea AK |
8232 | [(set_attr "op_type" "RIL,RR,RRF,SI,SS") |
8233 | (set_attr "cpu_facility" "*,*,z196,*,*") | |
8234 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*,*")]) | |
0dfa6c5e UW |
8235 | |
8236 | (define_split | |
8237 | [(set (match_operand:HI 0 "s_operand" "") | |
8238 | (xor:HI (match_dup 0) (match_operand:HI 1 "immediate_operand" ""))) | |
ae156f85 | 8239 | (clobber (reg:CC CC_REGNUM))] |
0dfa6c5e UW |
8240 | "reload_completed" |
8241 | [(parallel | |
8242 | [(set (match_dup 0) (xor:QI (match_dup 0) (match_dup 1))) | |
ae156f85 | 8243 | (clobber (reg:CC CC_REGNUM))])] |
0dfa6c5e | 8244 | "s390_narrow_logical_operator (XOR, &operands[0], &operands[1]);") |
9db1d521 | 8245 | |
9db1d521 HP |
8246 | ; |
8247 | ; xorqi3 instruction pattern(s). | |
8248 | ; | |
8249 | ||
8cb66696 | 8250 | (define_insn "*xorqi3" |
65b1d8ea AK |
8251 | [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,Q,S,Q") |
8252 | (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,d,0,0,0") | |
8253 | (match_operand:QI 2 "general_operand" "Os,d,d,n,n,Q"))) | |
ae156f85 | 8254 | (clobber (reg:CC CC_REGNUM))] |
8cb66696 | 8255 | "s390_logical_operator_ok_p (operands)" |
9db1d521 | 8256 | "@ |
ec24698e | 8257 | xilf\t%0,%b2 |
8cb66696 | 8258 | xr\t%0,%2 |
65b1d8ea | 8259 | xrk\t%0,%1,%2 |
fc0ea003 UW |
8260 | xi\t%S0,%b2 |
8261 | xiy\t%S0,%b2 | |
19b63d8e | 8262 | #" |
65b1d8ea | 8263 | [(set_attr "op_type" "RIL,RR,RRF,SI,SIY,SS") |
3e4be43f | 8264 | (set_attr "cpu_facility" "*,*,z196,*,longdisp,*") |
65b1d8ea | 8265 | (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,z10_super,z10_super,*")]) |
9381e3f1 | 8266 | |
4023fb28 | 8267 | |
19b63d8e UW |
8268 | ; |
8269 | ; Block exclusive or (XC) patterns. | |
8270 | ; | |
8271 | ||
8272 | (define_insn "*xc" | |
8273 | [(set (match_operand:BLK 0 "memory_operand" "=Q") | |
8274 | (xor:BLK (match_dup 0) | |
8275 | (match_operand:BLK 1 "memory_operand" "Q"))) | |
8276 | (use (match_operand 2 "const_int_operand" "n")) | |
ae156f85 | 8277 | (clobber (reg:CC CC_REGNUM))] |
19b63d8e | 8278 | "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 256" |
fc0ea003 | 8279 | "xc\t%O0(%2,%R0),%S1" |
b628bd8e | 8280 | [(set_attr "op_type" "SS")]) |
19b63d8e UW |
8281 | |
8282 | (define_split | |
8283 | [(set (match_operand 0 "memory_operand" "") | |
8284 | (xor (match_dup 0) | |
8285 | (match_operand 1 "memory_operand" ""))) | |
ae156f85 | 8286 | (clobber (reg:CC CC_REGNUM))] |
19b63d8e UW |
8287 | "reload_completed |
8288 | && GET_MODE (operands[0]) == GET_MODE (operands[1]) | |
8289 | && GET_MODE_SIZE (GET_MODE (operands[0])) > 0" | |
8290 | [(parallel | |
8291 | [(set (match_dup 0) (xor:BLK (match_dup 0) (match_dup 1))) | |
8292 | (use (match_dup 2)) | |
ae156f85 | 8293 | (clobber (reg:CC CC_REGNUM))])] |
19b63d8e UW |
8294 | { |
8295 | operands[2] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0]))); | |
8296 | operands[0] = adjust_address (operands[0], BLKmode, 0); | |
8297 | operands[1] = adjust_address (operands[1], BLKmode, 0); | |
8298 | }) | |
8299 | ||
8300 | (define_peephole2 | |
8301 | [(parallel | |
8302 | [(set (match_operand:BLK 0 "memory_operand" "") | |
8303 | (xor:BLK (match_dup 0) | |
8304 | (match_operand:BLK 1 "memory_operand" ""))) | |
8305 | (use (match_operand 2 "const_int_operand" "")) | |
ae156f85 | 8306 | (clobber (reg:CC CC_REGNUM))]) |
19b63d8e UW |
8307 | (parallel |
8308 | [(set (match_operand:BLK 3 "memory_operand" "") | |
8309 | (xor:BLK (match_dup 3) | |
8310 | (match_operand:BLK 4 "memory_operand" ""))) | |
8311 | (use (match_operand 5 "const_int_operand" "")) | |
ae156f85 | 8312 | (clobber (reg:CC CC_REGNUM))])] |
19b63d8e UW |
8313 | "s390_offset_p (operands[0], operands[3], operands[2]) |
8314 | && s390_offset_p (operands[1], operands[4], operands[2]) | |
9381e3f1 | 8315 | && !s390_overlap_p (operands[0], operands[1], |
bcf8c1cc | 8316 | INTVAL (operands[2]) + INTVAL (operands[5])) |
19b63d8e UW |
8317 | && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256" |
8318 | [(parallel | |
8319 | [(set (match_dup 6) (xor:BLK (match_dup 6) (match_dup 7))) | |
8320 | (use (match_dup 8)) | |
ae156f85 | 8321 | (clobber (reg:CC CC_REGNUM))])] |
19b63d8e UW |
8322 | "operands[6] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0)); |
8323 | operands[7] = gen_rtx_MEM (BLKmode, XEXP (operands[1], 0)); | |
8324 | operands[8] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[5]));") | |
8325 | ||
8326 | ; | |
8327 | ; Block xor (XC) patterns with src == dest. | |
8328 | ; | |
8329 | ||
8330 | (define_insn "*xc_zero" | |
8331 | [(set (match_operand:BLK 0 "memory_operand" "=Q") | |
8332 | (const_int 0)) | |
8333 | (use (match_operand 1 "const_int_operand" "n")) | |
ae156f85 | 8334 | (clobber (reg:CC CC_REGNUM))] |
19b63d8e | 8335 | "INTVAL (operands[1]) >= 1 && INTVAL (operands[1]) <= 256" |
fc0ea003 | 8336 | "xc\t%O0(%1,%R0),%S0" |
65b1d8ea AK |
8337 | [(set_attr "op_type" "SS") |
8338 | (set_attr "z196prop" "z196_cracked")]) | |
19b63d8e UW |
8339 | |
8340 | (define_peephole2 | |
8341 | [(parallel | |
8342 | [(set (match_operand:BLK 0 "memory_operand" "") | |
8343 | (const_int 0)) | |
8344 | (use (match_operand 1 "const_int_operand" "")) | |
ae156f85 | 8345 | (clobber (reg:CC CC_REGNUM))]) |
19b63d8e UW |
8346 | (parallel |
8347 | [(set (match_operand:BLK 2 "memory_operand" "") | |
8348 | (const_int 0)) | |
8349 | (use (match_operand 3 "const_int_operand" "")) | |
ae156f85 | 8350 | (clobber (reg:CC CC_REGNUM))])] |
19b63d8e UW |
8351 | "s390_offset_p (operands[0], operands[2], operands[1]) |
8352 | && INTVAL (operands[1]) + INTVAL (operands[3]) <= 256" | |
8353 | [(parallel | |
8354 | [(set (match_dup 4) (const_int 0)) | |
8355 | (use (match_dup 5)) | |
ae156f85 | 8356 | (clobber (reg:CC CC_REGNUM))])] |
19b63d8e UW |
8357 | "operands[4] = gen_rtx_MEM (BLKmode, XEXP (operands[0], 0)); |
8358 | operands[5] = GEN_INT (INTVAL (operands[1]) + INTVAL (operands[3]));") | |
8359 | ||
4a9733f3 AK |
8360 | ; |
8361 | ;- Nxor instructions. | |
8362 | ; | |
8363 | ||
8364 | ; nxrk, nxgrk | |
8365 | (define_insn "*nxor<GPR:mode>_cc" | |
8366 | [(set (reg CC_REGNUM) | |
8367 | (compare | |
8368 | (not:GPR (xor:GPR (match_operand:GPR 1 "register_operand" "d") | |
8369 | (match_operand:GPR 2 "register_operand" "d"))) | |
8370 | (const_int 0))) | |
8371 | (set (match_operand:GPR 0 "register_operand" "=d") | |
8372 | (xor:GPR (not:GPR (match_dup 1)) | |
8373 | (match_dup 2)))] | |
8374 | "TARGET_ARCH13 && s390_match_ccmode(insn, CCTmode)" | |
8375 | "nx<GPR:g>rk\t%0,%1,%2" | |
8376 | [(set_attr "op_type" "RRF")]) | |
8377 | ||
8378 | ; nxrk, nxgrk | |
8379 | (define_insn "*nxor<mode>_cconly" | |
8380 | [(set (reg CC_REGNUM) | |
8381 | (compare | |
8382 | (not:GPR (xor:GPR (match_operand:GPR 1 "register_operand" "d") | |
8383 | (match_operand:GPR 2 "register_operand" "d"))) | |
8384 | (const_int 0))) | |
8385 | (clobber (match_scratch:GPR 0 "=d"))] | |
8386 | "TARGET_ARCH13 && s390_match_ccmode(insn, CCTmode)" | |
8387 | "nx<GPR:g>rk\t%0,%1,%2" | |
8388 | [(set_attr "op_type" "RRF")]) | |
8389 | ||
8390 | ; nxrk, nxgrk | |
8391 | (define_insn "*nxor<mode>" | |
8392 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
8393 | (not:GPR (xor:GPR (match_operand:GPR 1 "register_operand" "d") | |
8394 | (match_operand:GPR 2 "register_operand" "d")))) | |
8395 | (clobber (reg:CC CC_REGNUM))] | |
8396 | "TARGET_ARCH13" | |
8397 | "nx<GPR:g>rk\t%0,%1,%2" | |
8398 | [(set_attr "op_type" "RRF")]) | |
9db1d521 HP |
8399 | |
8400 | ;; | |
8401 | ;;- Negate instructions. | |
8402 | ;; | |
8403 | ||
8404 | ; | |
9a91a21f | 8405 | ; neg(di|si)2 instruction pattern(s). |
9db1d521 HP |
8406 | ; |
8407 | ||
9a91a21f | 8408 | (define_expand "neg<mode>2" |
9db1d521 | 8409 | [(parallel |
9a91a21f AS |
8410 | [(set (match_operand:DSI 0 "register_operand" "=d") |
8411 | (neg:DSI (match_operand:DSI 1 "register_operand" "d"))) | |
ae156f85 | 8412 | (clobber (reg:CC CC_REGNUM))])] |
9db1d521 HP |
8413 | "" |
8414 | "") | |
8415 | ||
26a89301 | 8416 | (define_insn "*negdi2_sign_cc" |
ae156f85 | 8417 | [(set (reg CC_REGNUM) |
26a89301 UW |
8418 | (compare (neg:DI (ashiftrt:DI (ashift:DI (subreg:DI |
8419 | (match_operand:SI 1 "register_operand" "d") 0) | |
8420 | (const_int 32)) (const_int 32))) | |
8421 | (const_int 0))) | |
8422 | (set (match_operand:DI 0 "register_operand" "=d") | |
8423 | (neg:DI (sign_extend:DI (match_dup 1))))] | |
9602b6a1 | 8424 | "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)" |
26a89301 | 8425 | "lcgfr\t%0,%1" |
729e750f WG |
8426 | [(set_attr "op_type" "RRE") |
8427 | (set_attr "z10prop" "z10_c")]) | |
9381e3f1 | 8428 | |
26a89301 UW |
8429 | (define_insn "*negdi2_sign" |
8430 | [(set (match_operand:DI 0 "register_operand" "=d") | |
8431 | (neg:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d")))) | |
ae156f85 | 8432 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 8433 | "TARGET_ZARCH" |
26a89301 | 8434 | "lcgfr\t%0,%1" |
729e750f WG |
8435 | [(set_attr "op_type" "RRE") |
8436 | (set_attr "z10prop" "z10_c")]) | |
26a89301 | 8437 | |
43a09b63 | 8438 | ; lcr, lcgr |
9a91a21f | 8439 | (define_insn "*neg<mode>2_cc" |
ae156f85 | 8440 | [(set (reg CC_REGNUM) |
9a91a21f | 8441 | (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d")) |
26a89301 | 8442 | (const_int 0))) |
9a91a21f AS |
8443 | (set (match_operand:GPR 0 "register_operand" "=d") |
8444 | (neg:GPR (match_dup 1)))] | |
8445 | "s390_match_ccmode (insn, CCAmode)" | |
8446 | "lc<g>r\t%0,%1" | |
9381e3f1 WG |
8447 | [(set_attr "op_type" "RR<E>") |
8448 | (set_attr "z10prop" "z10_super_c_E1")]) | |
43a09b63 AK |
8449 | |
8450 | ; lcr, lcgr | |
9a91a21f | 8451 | (define_insn "*neg<mode>2_cconly" |
ae156f85 | 8452 | [(set (reg CC_REGNUM) |
9a91a21f | 8453 | (compare (neg:GPR (match_operand:GPR 1 "register_operand" "d")) |
26a89301 | 8454 | (const_int 0))) |
9a91a21f AS |
8455 | (clobber (match_scratch:GPR 0 "=d"))] |
8456 | "s390_match_ccmode (insn, CCAmode)" | |
8457 | "lc<g>r\t%0,%1" | |
9381e3f1 WG |
8458 | [(set_attr "op_type" "RR<E>") |
8459 | (set_attr "z10prop" "z10_super_c_E1")]) | |
43a09b63 AK |
8460 | |
8461 | ; lcr, lcgr | |
9a91a21f AS |
8462 | (define_insn "*neg<mode>2" |
8463 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
8464 | (neg:GPR (match_operand:GPR 1 "register_operand" "d"))) | |
ae156f85 | 8465 | (clobber (reg:CC CC_REGNUM))] |
9a91a21f AS |
8466 | "" |
8467 | "lc<g>r\t%0,%1" | |
9381e3f1 WG |
8468 | [(set_attr "op_type" "RR<E>") |
8469 | (set_attr "z10prop" "z10_super_c_E1")]) | |
9db1d521 | 8470 | |
b7d19263 | 8471 | (define_insn "*negdi2_31" |
9db1d521 HP |
8472 | [(set (match_operand:DI 0 "register_operand" "=d") |
8473 | (neg:DI (match_operand:DI 1 "register_operand" "d"))) | |
ae156f85 | 8474 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 8475 | "!TARGET_ZARCH" |
b7d19263 AK |
8476 | "#") |
8477 | ||
8478 | ; Split a DImode NEG on 31bit into 2 SImode NEGs | |
8479 | ||
8480 | ; Doing the twos complement separately on the SImode parts does an | |
8481 | ; unwanted +1 on the high part which needs to be subtracted afterwards | |
8482 | ; ... unless the +1 on the low part created an overflow. | |
8483 | ||
8484 | (define_split | |
8485 | [(set (match_operand:DI 0 "register_operand" "") | |
8486 | (neg:DI (match_operand:DI 1 "register_operand" ""))) | |
8487 | (clobber (reg:CC CC_REGNUM))] | |
8488 | "!TARGET_ZARCH | |
8489 | && (REGNO (operands[0]) == REGNO (operands[1]) | |
8490 | || s390_split_ok_p (operands[0], operands[1], DImode, 0)) | |
8491 | && reload_completed" | |
26a89301 UW |
8492 | [(parallel |
8493 | [(set (match_dup 2) (neg:SI (match_dup 3))) | |
ae156f85 | 8494 | (clobber (reg:CC CC_REGNUM))]) |
26a89301 | 8495 | (parallel |
ae156f85 | 8496 | [(set (reg:CCAP CC_REGNUM) |
26a89301 UW |
8497 | (compare:CCAP (neg:SI (match_dup 5)) (const_int 0))) |
8498 | (set (match_dup 4) (neg:SI (match_dup 5)))]) | |
8499 | (set (pc) | |
ae156f85 | 8500 | (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0)) |
26a89301 UW |
8501 | (pc) |
8502 | (label_ref (match_dup 6)))) | |
8503 | (parallel | |
8504 | [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1))) | |
ae156f85 | 8505 | (clobber (reg:CC CC_REGNUM))]) |
26a89301 UW |
8506 | (match_dup 6)] |
8507 | "operands[2] = operand_subword (operands[0], 0, 0, DImode); | |
8508 | operands[3] = operand_subword (operands[1], 0, 0, DImode); | |
8509 | operands[4] = operand_subword (operands[0], 1, 0, DImode); | |
8510 | operands[5] = operand_subword (operands[1], 1, 0, DImode); | |
8511 | operands[6] = gen_label_rtx ();") | |
9db1d521 | 8512 | |
b7d19263 AK |
8513 | ; Like above but first make a copy of the low part of the src operand |
8514 | ; since it might overlap with the high part of the destination. | |
8515 | ||
8516 | (define_split | |
8517 | [(set (match_operand:DI 0 "register_operand" "") | |
8518 | (neg:DI (match_operand:DI 1 "register_operand" ""))) | |
8519 | (clobber (reg:CC CC_REGNUM))] | |
8520 | "!TARGET_ZARCH | |
8521 | && s390_split_ok_p (operands[0], operands[1], DImode, 1) | |
8522 | && reload_completed" | |
8523 | [; Make a backup of op5 first | |
8524 | (set (match_dup 4) (match_dup 5)) | |
8525 | ; Setting op2 here might clobber op5 | |
8526 | (parallel | |
8527 | [(set (match_dup 2) (neg:SI (match_dup 3))) | |
8528 | (clobber (reg:CC CC_REGNUM))]) | |
8529 | (parallel | |
8530 | [(set (reg:CCAP CC_REGNUM) | |
8531 | (compare:CCAP (neg:SI (match_dup 4)) (const_int 0))) | |
8532 | (set (match_dup 4) (neg:SI (match_dup 4)))]) | |
8533 | (set (pc) | |
8534 | (if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0)) | |
8535 | (pc) | |
8536 | (label_ref (match_dup 6)))) | |
8537 | (parallel | |
8538 | [(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1))) | |
8539 | (clobber (reg:CC CC_REGNUM))]) | |
8540 | (match_dup 6)] | |
8541 | "operands[2] = operand_subword (operands[0], 0, 0, DImode); | |
8542 | operands[3] = operand_subword (operands[1], 0, 0, DImode); | |
8543 | operands[4] = operand_subword (operands[0], 1, 0, DImode); | |
8544 | operands[5] = operand_subword (operands[1], 1, 0, DImode); | |
8545 | operands[6] = gen_label_rtx ();") | |
8546 | ||
9db1d521 | 8547 | ; |
f5905b37 | 8548 | ; neg(df|sf)2 instruction pattern(s). |
9db1d521 HP |
8549 | ; |
8550 | ||
f5905b37 | 8551 | (define_expand "neg<mode>2" |
9db1d521 | 8552 | [(parallel |
2de2b3f9 AK |
8553 | [(set (match_operand:BFP 0 "register_operand") |
8554 | (neg:BFP (match_operand:BFP 1 "register_operand"))) | |
ae156f85 | 8555 | (clobber (reg:CC CC_REGNUM))])] |
2de2b3f9 | 8556 | "TARGET_HARD_FLOAT") |
9db1d521 | 8557 | |
43a09b63 | 8558 | ; lcxbr, lcdbr, lcebr |
f5905b37 | 8559 | (define_insn "*neg<mode>2_cc" |
ae156f85 | 8560 | [(set (reg CC_REGNUM) |
7b6baae1 AK |
8561 | (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f")) |
8562 | (match_operand:BFP 2 "const0_operand" ""))) | |
8563 | (set (match_operand:BFP 0 "register_operand" "=f") | |
8564 | (neg:BFP (match_dup 1)))] | |
142cd70f | 8565 | "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT" |
f61a2c7d | 8566 | "lc<xde>br\t%0,%1" |
26a89301 | 8567 | [(set_attr "op_type" "RRE") |
f5905b37 | 8568 | (set_attr "type" "fsimp<mode>")]) |
43a09b63 AK |
8569 | |
8570 | ; lcxbr, lcdbr, lcebr | |
f5905b37 | 8571 | (define_insn "*neg<mode>2_cconly" |
ae156f85 | 8572 | [(set (reg CC_REGNUM) |
7b6baae1 AK |
8573 | (compare (neg:BFP (match_operand:BFP 1 "register_operand" "f")) |
8574 | (match_operand:BFP 2 "const0_operand" ""))) | |
8575 | (clobber (match_scratch:BFP 0 "=f"))] | |
142cd70f | 8576 | "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT" |
f61a2c7d | 8577 | "lc<xde>br\t%0,%1" |
26a89301 | 8578 | [(set_attr "op_type" "RRE") |
f5905b37 | 8579 | (set_attr "type" "fsimp<mode>")]) |
43a09b63 | 8580 | |
85dae55a AK |
8581 | ; lcdfr |
8582 | (define_insn "*neg<mode>2_nocc" | |
609e7e80 AK |
8583 | [(set (match_operand:FP 0 "register_operand" "=f") |
8584 | (neg:FP (match_operand:FP 1 "register_operand" "<fT0>")))] | |
fb068247 | 8585 | "TARGET_DFP" |
85dae55a AK |
8586 | "lcdfr\t%0,%1" |
8587 | [(set_attr "op_type" "RRE") | |
9381e3f1 | 8588 | (set_attr "type" "fsimp<mode>")]) |
85dae55a | 8589 | |
43a09b63 | 8590 | ; lcxbr, lcdbr, lcebr |
6e5b5de8 | 8591 | ; FIXME: wflcdb does not clobber cc |
2de2b3f9 | 8592 | ; FIXME: Does wflcdb ever match here? |
f5905b37 | 8593 | (define_insn "*neg<mode>2" |
2de2b3f9 AK |
8594 | [(set (match_operand:BFP 0 "register_operand" "=f,v,v") |
8595 | (neg:BFP (match_operand:BFP 1 "register_operand" "f,v,v"))) | |
ae156f85 | 8596 | (clobber (reg:CC CC_REGNUM))] |
142cd70f | 8597 | "TARGET_HARD_FLOAT" |
6e5b5de8 AK |
8598 | "@ |
8599 | lc<xde>br\t%0,%1 | |
2de2b3f9 AK |
8600 | wflcdb\t%0,%1 |
8601 | wflcsb\t%0,%1" | |
8602 | [(set_attr "op_type" "RRE,VRR,VRR") | |
8603 | (set_attr "cpu_facility" "*,vx,vxe") | |
8604 | (set_attr "type" "fsimp<mode>,*,*") | |
8605 | (set_attr "enabled" "*,<DF>,<SF>")]) | |
9db1d521 | 8606 | |
9db1d521 HP |
8607 | |
8608 | ;; | |
8609 | ;;- Absolute value instructions. | |
8610 | ;; | |
8611 | ||
8612 | ; | |
9a91a21f | 8613 | ; abs(di|si)2 instruction pattern(s). |
9db1d521 HP |
8614 | ; |
8615 | ||
26a89301 | 8616 | (define_insn "*absdi2_sign_cc" |
ae156f85 | 8617 | [(set (reg CC_REGNUM) |
26a89301 UW |
8618 | (compare (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI |
8619 | (match_operand:SI 1 "register_operand" "d") 0) | |
8620 | (const_int 32)) (const_int 32))) | |
8621 | (const_int 0))) | |
8622 | (set (match_operand:DI 0 "register_operand" "=d") | |
8623 | (abs:DI (sign_extend:DI (match_dup 1))))] | |
9602b6a1 | 8624 | "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)" |
26a89301 | 8625 | "lpgfr\t%0,%1" |
729e750f WG |
8626 | [(set_attr "op_type" "RRE") |
8627 | (set_attr "z10prop" "z10_c")]) | |
26a89301 UW |
8628 | |
8629 | (define_insn "*absdi2_sign" | |
8630 | [(set (match_operand:DI 0 "register_operand" "=d") | |
8631 | (abs:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d")))) | |
ae156f85 | 8632 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 8633 | "TARGET_ZARCH" |
26a89301 | 8634 | "lpgfr\t%0,%1" |
729e750f WG |
8635 | [(set_attr "op_type" "RRE") |
8636 | (set_attr "z10prop" "z10_c")]) | |
26a89301 | 8637 | |
43a09b63 | 8638 | ; lpr, lpgr |
9a91a21f | 8639 | (define_insn "*abs<mode>2_cc" |
ae156f85 | 8640 | [(set (reg CC_REGNUM) |
9a91a21f | 8641 | (compare (abs:GPR (match_operand:DI 1 "register_operand" "d")) |
26a89301 | 8642 | (const_int 0))) |
9a91a21f AS |
8643 | (set (match_operand:GPR 0 "register_operand" "=d") |
8644 | (abs:GPR (match_dup 1)))] | |
26a89301 | 8645 | "s390_match_ccmode (insn, CCAmode)" |
9a91a21f | 8646 | "lp<g>r\t%0,%1" |
9381e3f1 WG |
8647 | [(set_attr "op_type" "RR<E>") |
8648 | (set_attr "z10prop" "z10_c")]) | |
43a09b63 | 8649 | |
9381e3f1 | 8650 | ; lpr, lpgr |
9a91a21f | 8651 | (define_insn "*abs<mode>2_cconly" |
ae156f85 | 8652 | [(set (reg CC_REGNUM) |
9a91a21f | 8653 | (compare (abs:GPR (match_operand:GPR 1 "register_operand" "d")) |
26a89301 | 8654 | (const_int 0))) |
9a91a21f | 8655 | (clobber (match_scratch:GPR 0 "=d"))] |
26a89301 | 8656 | "s390_match_ccmode (insn, CCAmode)" |
9a91a21f | 8657 | "lp<g>r\t%0,%1" |
9381e3f1 WG |
8658 | [(set_attr "op_type" "RR<E>") |
8659 | (set_attr "z10prop" "z10_c")]) | |
43a09b63 AK |
8660 | |
8661 | ; lpr, lpgr | |
9a91a21f AS |
8662 | (define_insn "abs<mode>2" |
8663 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
8664 | (abs:GPR (match_operand:GPR 1 "register_operand" "d"))) | |
ae156f85 | 8665 | (clobber (reg:CC CC_REGNUM))] |
9db1d521 | 8666 | "" |
9a91a21f | 8667 | "lp<g>r\t%0,%1" |
9381e3f1 WG |
8668 | [(set_attr "op_type" "RR<E>") |
8669 | (set_attr "z10prop" "z10_c")]) | |
9db1d521 | 8670 | |
9db1d521 | 8671 | ; |
f5905b37 | 8672 | ; abs(df|sf)2 instruction pattern(s). |
9db1d521 HP |
8673 | ; |
8674 | ||
f5905b37 | 8675 | (define_expand "abs<mode>2" |
9db1d521 | 8676 | [(parallel |
7b6baae1 AK |
8677 | [(set (match_operand:BFP 0 "register_operand" "=f") |
8678 | (abs:BFP (match_operand:BFP 1 "register_operand" "f"))) | |
ae156f85 | 8679 | (clobber (reg:CC CC_REGNUM))])] |
9db1d521 HP |
8680 | "TARGET_HARD_FLOAT" |
8681 | "") | |
8682 | ||
43a09b63 | 8683 | ; lpxbr, lpdbr, lpebr |
f5905b37 | 8684 | (define_insn "*abs<mode>2_cc" |
ae156f85 | 8685 | [(set (reg CC_REGNUM) |
7b6baae1 AK |
8686 | (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f")) |
8687 | (match_operand:BFP 2 "const0_operand" ""))) | |
8688 | (set (match_operand:BFP 0 "register_operand" "=f") | |
8689 | (abs:BFP (match_dup 1)))] | |
142cd70f | 8690 | "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT" |
f61a2c7d | 8691 | "lp<xde>br\t%0,%1" |
26a89301 | 8692 | [(set_attr "op_type" "RRE") |
f5905b37 | 8693 | (set_attr "type" "fsimp<mode>")]) |
43a09b63 AK |
8694 | |
8695 | ; lpxbr, lpdbr, lpebr | |
f5905b37 | 8696 | (define_insn "*abs<mode>2_cconly" |
ae156f85 | 8697 | [(set (reg CC_REGNUM) |
7b6baae1 AK |
8698 | (compare (abs:BFP (match_operand:BFP 1 "register_operand" "f")) |
8699 | (match_operand:BFP 2 "const0_operand" ""))) | |
8700 | (clobber (match_scratch:BFP 0 "=f"))] | |
142cd70f | 8701 | "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT" |
f61a2c7d | 8702 | "lp<xde>br\t%0,%1" |
26a89301 | 8703 | [(set_attr "op_type" "RRE") |
f5905b37 | 8704 | (set_attr "type" "fsimp<mode>")]) |
43a09b63 | 8705 | |
85dae55a AK |
8706 | ; lpdfr |
8707 | (define_insn "*abs<mode>2_nocc" | |
609e7e80 AK |
8708 | [(set (match_operand:FP 0 "register_operand" "=f") |
8709 | (abs:FP (match_operand:FP 1 "register_operand" "<fT0>")))] | |
fb068247 | 8710 | "TARGET_DFP" |
85dae55a AK |
8711 | "lpdfr\t%0,%1" |
8712 | [(set_attr "op_type" "RRE") | |
9381e3f1 | 8713 | (set_attr "type" "fsimp<mode>")]) |
85dae55a | 8714 | |
43a09b63 | 8715 | ; lpxbr, lpdbr, lpebr |
6e5b5de8 | 8716 | ; FIXME: wflpdb does not clobber cc |
f5905b37 | 8717 | (define_insn "*abs<mode>2" |
62d3f261 AK |
8718 | [(set (match_operand:BFP 0 "register_operand" "=f,v") |
8719 | (abs:BFP (match_operand:BFP 1 "register_operand" "f,v"))) | |
ae156f85 | 8720 | (clobber (reg:CC CC_REGNUM))] |
142cd70f | 8721 | "TARGET_HARD_FLOAT" |
6e5b5de8 AK |
8722 | "@ |
8723 | lp<xde>br\t%0,%1 | |
8724 | wflpdb\t%0,%1" | |
8725 | [(set_attr "op_type" "RRE,VRR") | |
285363a1 | 8726 | (set_attr "cpu_facility" "*,vx") |
62d3f261 AK |
8727 | (set_attr "type" "fsimp<mode>,*") |
8728 | (set_attr "enabled" "*,<DFDI>")]) | |
9db1d521 | 8729 | |
9db1d521 | 8730 | |
3ef093a8 AK |
8731 | ;; |
8732 | ;;- Negated absolute value instructions | |
8733 | ;; | |
8734 | ||
8735 | ; | |
8736 | ; Integer | |
8737 | ; | |
8738 | ||
26a89301 | 8739 | (define_insn "*negabsdi2_sign_cc" |
ae156f85 | 8740 | [(set (reg CC_REGNUM) |
26a89301 UW |
8741 | (compare (neg:DI (abs:DI (ashiftrt:DI (ashift:DI (subreg:DI |
8742 | (match_operand:SI 1 "register_operand" "d") 0) | |
8743 | (const_int 32)) (const_int 32)))) | |
8744 | (const_int 0))) | |
8745 | (set (match_operand:DI 0 "register_operand" "=d") | |
8746 | (neg:DI (abs:DI (sign_extend:DI (match_dup 1)))))] | |
9602b6a1 | 8747 | "TARGET_ZARCH && s390_match_ccmode (insn, CCAmode)" |
26a89301 | 8748 | "lngfr\t%0,%1" |
729e750f WG |
8749 | [(set_attr "op_type" "RRE") |
8750 | (set_attr "z10prop" "z10_c")]) | |
9381e3f1 | 8751 | |
26a89301 UW |
8752 | (define_insn "*negabsdi2_sign" |
8753 | [(set (match_operand:DI 0 "register_operand" "=d") | |
8754 | (neg:DI (abs:DI (sign_extend:DI | |
8755 | (match_operand:SI 1 "register_operand" "d"))))) | |
ae156f85 | 8756 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 8757 | "TARGET_ZARCH" |
26a89301 | 8758 | "lngfr\t%0,%1" |
729e750f WG |
8759 | [(set_attr "op_type" "RRE") |
8760 | (set_attr "z10prop" "z10_c")]) | |
3ef093a8 | 8761 | |
43a09b63 | 8762 | ; lnr, lngr |
9a91a21f | 8763 | (define_insn "*negabs<mode>2_cc" |
ae156f85 | 8764 | [(set (reg CC_REGNUM) |
9a91a21f | 8765 | (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d"))) |
26a89301 | 8766 | (const_int 0))) |
9a91a21f AS |
8767 | (set (match_operand:GPR 0 "register_operand" "=d") |
8768 | (neg:GPR (abs:GPR (match_dup 1))))] | |
26a89301 | 8769 | "s390_match_ccmode (insn, CCAmode)" |
9a91a21f | 8770 | "ln<g>r\t%0,%1" |
9381e3f1 WG |
8771 | [(set_attr "op_type" "RR<E>") |
8772 | (set_attr "z10prop" "z10_c")]) | |
43a09b63 AK |
8773 | |
8774 | ; lnr, lngr | |
9a91a21f | 8775 | (define_insn "*negabs<mode>2_cconly" |
ae156f85 | 8776 | [(set (reg CC_REGNUM) |
9a91a21f | 8777 | (compare (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d"))) |
26a89301 | 8778 | (const_int 0))) |
9a91a21f | 8779 | (clobber (match_scratch:GPR 0 "=d"))] |
26a89301 | 8780 | "s390_match_ccmode (insn, CCAmode)" |
9a91a21f | 8781 | "ln<g>r\t%0,%1" |
9381e3f1 WG |
8782 | [(set_attr "op_type" "RR<E>") |
8783 | (set_attr "z10prop" "z10_c")]) | |
43a09b63 AK |
8784 | |
8785 | ; lnr, lngr | |
9a91a21f AS |
8786 | (define_insn "*negabs<mode>2" |
8787 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
8788 | (neg:GPR (abs:GPR (match_operand:GPR 1 "register_operand" "d")))) | |
ae156f85 | 8789 | (clobber (reg:CC CC_REGNUM))] |
26a89301 | 8790 | "" |
9a91a21f | 8791 | "ln<g>r\t%0,%1" |
9381e3f1 WG |
8792 | [(set_attr "op_type" "RR<E>") |
8793 | (set_attr "z10prop" "z10_c")]) | |
26a89301 | 8794 | |
3ef093a8 AK |
8795 | ; |
8796 | ; Floating point | |
8797 | ; | |
8798 | ||
43a09b63 | 8799 | ; lnxbr, lndbr, lnebr |
f5905b37 | 8800 | (define_insn "*negabs<mode>2_cc" |
ae156f85 | 8801 | [(set (reg CC_REGNUM) |
7b6baae1 AK |
8802 | (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f"))) |
8803 | (match_operand:BFP 2 "const0_operand" ""))) | |
8804 | (set (match_operand:BFP 0 "register_operand" "=f") | |
8805 | (neg:BFP (abs:BFP (match_dup 1))))] | |
142cd70f | 8806 | "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT" |
f61a2c7d | 8807 | "ln<xde>br\t%0,%1" |
26a89301 | 8808 | [(set_attr "op_type" "RRE") |
f5905b37 | 8809 | (set_attr "type" "fsimp<mode>")]) |
43a09b63 AK |
8810 | |
8811 | ; lnxbr, lndbr, lnebr | |
f5905b37 | 8812 | (define_insn "*negabs<mode>2_cconly" |
ae156f85 | 8813 | [(set (reg CC_REGNUM) |
7b6baae1 AK |
8814 | (compare (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f"))) |
8815 | (match_operand:BFP 2 "const0_operand" ""))) | |
8816 | (clobber (match_scratch:BFP 0 "=f"))] | |
142cd70f | 8817 | "s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT" |
f61a2c7d | 8818 | "ln<xde>br\t%0,%1" |
26a89301 | 8819 | [(set_attr "op_type" "RRE") |
f5905b37 | 8820 | (set_attr "type" "fsimp<mode>")]) |
43a09b63 | 8821 | |
85dae55a AK |
8822 | ; lndfr |
8823 | (define_insn "*negabs<mode>2_nocc" | |
609e7e80 AK |
8824 | [(set (match_operand:FP 0 "register_operand" "=f") |
8825 | (neg:FP (abs:FP (match_operand:BFP 1 "register_operand" "<fT0>"))))] | |
fb068247 | 8826 | "TARGET_DFP" |
85dae55a AK |
8827 | "lndfr\t%0,%1" |
8828 | [(set_attr "op_type" "RRE") | |
9381e3f1 | 8829 | (set_attr "type" "fsimp<mode>")]) |
85dae55a | 8830 | |
43a09b63 | 8831 | ; lnxbr, lndbr, lnebr |
6e5b5de8 | 8832 | ; FIXME: wflndb does not clobber cc |
f5905b37 | 8833 | (define_insn "*negabs<mode>2" |
62d3f261 AK |
8834 | [(set (match_operand:BFP 0 "register_operand" "=f,v") |
8835 | (neg:BFP (abs:BFP (match_operand:BFP 1 "register_operand" "f,v")))) | |
ae156f85 | 8836 | (clobber (reg:CC CC_REGNUM))] |
142cd70f | 8837 | "TARGET_HARD_FLOAT" |
6e5b5de8 AK |
8838 | "@ |
8839 | ln<xde>br\t%0,%1 | |
8840 | wflndb\t%0,%1" | |
8841 | [(set_attr "op_type" "RRE,VRR") | |
285363a1 | 8842 | (set_attr "cpu_facility" "*,vx") |
62d3f261 AK |
8843 | (set_attr "type" "fsimp<mode>,*") |
8844 | (set_attr "enabled" "*,<DFDI>")]) | |
26a89301 | 8845 | |
4023fb28 UW |
8846 | ;; |
8847 | ;;- Square root instructions. | |
8848 | ;; | |
8849 | ||
8850 | ; | |
f5905b37 | 8851 | ; sqrt(df|sf)2 instruction pattern(s). |
4023fb28 UW |
8852 | ; |
8853 | ||
9381e3f1 | 8854 | ; sqxbr, sqdbr, sqebr, sqdb, sqeb |
f5905b37 | 8855 | (define_insn "sqrt<mode>2" |
62d3f261 AK |
8856 | [(set (match_operand:BFP 0 "register_operand" "=f,f,v") |
8857 | (sqrt:BFP (match_operand:BFP 1 "general_operand" "f,R,v")))] | |
142cd70f | 8858 | "TARGET_HARD_FLOAT" |
4023fb28 | 8859 | "@ |
f61a2c7d | 8860 | sq<xde>br\t%0,%1 |
6e5b5de8 AK |
8861 | sq<xde>b\t%0,%1 |
8862 | wfsqdb\t%v0,%v1" | |
8863 | [(set_attr "op_type" "RRE,RXE,VRR") | |
8864 | (set_attr "type" "fsqrt<mode>") | |
285363a1 | 8865 | (set_attr "cpu_facility" "*,*,vx") |
62d3f261 | 8866 | (set_attr "enabled" "*,<DSF>,<DFDI>")]) |
4023fb28 | 8867 | |
9db1d521 HP |
8868 | |
8869 | ;; | |
8870 | ;;- One complement instructions. | |
8871 | ;; | |
8872 | ||
8873 | ; | |
342cf42b | 8874 | ; one_cmpl(di|si|hi|qi)2 instruction pattern(s). |
9db1d521 | 8875 | ; |
c7453384 | 8876 | |
342cf42b | 8877 | (define_expand "one_cmpl<mode>2" |
4023fb28 | 8878 | [(parallel |
342cf42b AS |
8879 | [(set (match_operand:INT 0 "register_operand" "") |
8880 | (xor:INT (match_operand:INT 1 "register_operand" "") | |
8881 | (const_int -1))) | |
ae156f85 | 8882 | (clobber (reg:CC CC_REGNUM))])] |
9db1d521 | 8883 | "" |
4023fb28 | 8884 | "") |
9db1d521 HP |
8885 | |
8886 | ||
ec24698e UW |
8887 | ;; |
8888 | ;; Find leftmost bit instructions. | |
8889 | ;; | |
8890 | ||
8891 | (define_expand "clzdi2" | |
8892 | [(set (match_operand:DI 0 "register_operand" "=d") | |
8893 | (clz:DI (match_operand:DI 1 "register_operand" "d")))] | |
9602b6a1 | 8894 | "TARGET_EXTIMM && TARGET_ZARCH" |
ec24698e | 8895 | { |
d8485bdb TS |
8896 | rtx_insn *insn; |
8897 | rtx clz_equal; | |
ec24698e | 8898 | rtx wide_reg = gen_reg_rtx (TImode); |
406fde6e | 8899 | rtx msb = gen_rtx_CONST_INT (DImode, HOST_WIDE_INT_1U << 63); |
ec24698e UW |
8900 | |
8901 | clz_equal = gen_rtx_CLZ (DImode, operands[1]); | |
8902 | ||
8903 | emit_insn (gen_clztidi2 (wide_reg, operands[1], msb)); | |
8904 | ||
9381e3f1 | 8905 | insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg)); |
bd94cb6e | 8906 | set_unique_reg_note (insn, REG_EQUAL, clz_equal); |
ec24698e UW |
8907 | |
8908 | DONE; | |
8909 | }) | |
8910 | ||
33f3393a AK |
8911 | ; CLZ result is in hard reg op0 - this is the high part of the target operand |
8912 | ; The source with the left-most one bit cleared is in hard reg op0 + 1 - the low part | |
ec24698e UW |
8913 | (define_insn "clztidi2" |
8914 | [(set (match_operand:TI 0 "register_operand" "=d") | |
8915 | (ior:TI | |
33f3393a AK |
8916 | (ashift:TI (zero_extend:TI (clz:DI (match_operand:DI 1 "register_operand" "d"))) |
8917 | (const_int 64)) | |
8918 | (zero_extend:TI | |
8919 | (xor:DI (match_dup 1) | |
8920 | (lshiftrt (match_operand:DI 2 "const_int_operand" "") | |
8921 | (subreg:SI (clz:DI (match_dup 1)) 4)))))) | |
ec24698e | 8922 | (clobber (reg:CC CC_REGNUM))] |
406fde6e | 8923 | "UINTVAL (operands[2]) == HOST_WIDE_INT_1U << 63 |
9602b6a1 | 8924 | && TARGET_EXTIMM && TARGET_ZARCH" |
ec24698e UW |
8925 | "flogr\t%0,%1" |
8926 | [(set_attr "op_type" "RRE")]) | |
8927 | ||
8928 | ||
9db1d521 HP |
8929 | ;; |
8930 | ;;- Rotate instructions. | |
8931 | ;; | |
8932 | ||
8933 | ; | |
9a91a21f | 8934 | ; rotl(di|si)3 instruction pattern(s). |
9db1d521 HP |
8935 | ; |
8936 | ||
191eb16d AK |
8937 | (define_expand "rotl<mode>3" |
8938 | [(set (match_operand:GPR 0 "register_operand" "") | |
8939 | (rotate:GPR (match_operand:GPR 1 "register_operand" "") | |
8940 | (match_operand:SI 2 "nonmemory_operand" "")))] | |
8cc6307c | 8941 | "" |
191eb16d | 8942 | "") |
9db1d521 | 8943 | |
43a09b63 | 8944 | ; rll, rllg |
191eb16d AK |
8945 | (define_insn "*rotl<mode>3<addr_style_op><masked_op>" |
8946 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
8947 | (rotate:GPR (match_operand:GPR 1 "register_operand" "d") | |
8948 | (match_operand:SI 2 "nonmemory_operand" "an")))] | |
8cc6307c | 8949 | "" |
191eb16d | 8950 | "rll<g>\t%0,%1,<addr_style_op_ops>" |
4989e88a | 8951 | [(set_attr "op_type" "RSE") |
9381e3f1 | 8952 | (set_attr "atype" "reg") |
191eb16d | 8953 | (set_attr "z10prop" "z10_super_E1")]) |
4989e88a | 8954 | |
9db1d521 HP |
8955 | |
8956 | ;; | |
f337b930 | 8957 | ;;- Shift instructions. |
9db1d521 | 8958 | ;; |
9db1d521 HP |
8959 | |
8960 | ; | |
1b48c8cc | 8961 | ; (ashl|lshr)(di|si)3 instruction pattern(s). |
65b1d8ea | 8962 | ; Left shifts and logical right shifts |
9db1d521 | 8963 | |
1b48c8cc AS |
8964 | (define_expand "<shift><mode>3" |
8965 | [(set (match_operand:DSI 0 "register_operand" "") | |
8966 | (SHIFT:DSI (match_operand:DSI 1 "register_operand" "") | |
adf22b3f | 8967 | (match_operand:SI 2 "nonmemory_operand" "")))] |
9db1d521 HP |
8968 | "" |
8969 | "") | |
8970 | ||
adf22b3f | 8971 | ; ESA 64 bit register pair shift with reg or imm shift count |
43a09b63 | 8972 | ; sldl, srdl |
adf22b3f AK |
8973 | (define_insn "*<shift>di3_31<addr_style_op><masked_op>" |
8974 | [(set (match_operand:DI 0 "register_operand" "=d") | |
8975 | (SHIFT:DI (match_operand:DI 1 "register_operand" "0") | |
8976 | (match_operand:SI 2 "nonmemory_operand" "an")))] | |
9602b6a1 | 8977 | "!TARGET_ZARCH" |
adf22b3f | 8978 | "s<lr>dl\t%0,<addr_style_op_ops>" |
077dab3b | 8979 | [(set_attr "op_type" "RS") |
65b1d8ea AK |
8980 | (set_attr "atype" "reg") |
8981 | (set_attr "z196prop" "z196_cracked")]) | |
9db1d521 | 8982 | |
adf22b3f AK |
8983 | |
8984 | ; 64 bit register shift with reg or imm shift count | |
65b1d8ea | 8985 | ; sll, srl, sllg, srlg, sllk, srlk |
adf22b3f AK |
8986 | (define_insn "*<shift><mode>3<addr_style_op><masked_op>" |
8987 | [(set (match_operand:GPR 0 "register_operand" "=d, d") | |
8988 | (SHIFT:GPR (match_operand:GPR 1 "register_operand" "<d0>, d") | |
8989 | (match_operand:SI 2 "nonmemory_operand" "an,an")))] | |
1b48c8cc | 8990 | "" |
65b1d8ea | 8991 | "@ |
adf22b3f AK |
8992 | s<lr>l<g>\t%0,<1><addr_style_op_ops> |
8993 | s<lr>l<gk>\t%0,%1,<addr_style_op_ops>" | |
65b1d8ea AK |
8994 | [(set_attr "op_type" "RS<E>,RSY") |
8995 | (set_attr "atype" "reg,reg") | |
8996 | (set_attr "cpu_facility" "*,z196") | |
adf22b3f | 8997 | (set_attr "z10prop" "z10_super_E1,*")]) |
4989e88a | 8998 | |
9db1d521 | 8999 | ; |
1b48c8cc | 9000 | ; ashr(di|si)3 instruction pattern(s). |
65b1d8ea | 9001 | ; Arithmetic right shifts |
9db1d521 | 9002 | |
1b48c8cc | 9003 | (define_expand "ashr<mode>3" |
9db1d521 | 9004 | [(parallel |
1b48c8cc AS |
9005 | [(set (match_operand:DSI 0 "register_operand" "") |
9006 | (ashiftrt:DSI (match_operand:DSI 1 "register_operand" "") | |
a9fcf821 | 9007 | (match_operand:SI 2 "nonmemory_operand" ""))) |
ae156f85 | 9008 | (clobber (reg:CC CC_REGNUM))])] |
9db1d521 HP |
9009 | "" |
9010 | "") | |
9011 | ||
a9fcf821 AK |
9012 | ; FIXME: The number of alternatives is doubled here to match the fix |
9013 | ; number of 2 in the subst pattern for the (clobber (match_scratch... | |
9014 | ; The right fix should be to support match_scratch in the output | |
9015 | ; pattern of a define_subst. | |
9016 | (define_insn "*ashrdi3_31<addr_style_op_cc><masked_op_cc><setcc><cconly>" | |
9017 | [(set (match_operand:DI 0 "register_operand" "=d, d") | |
9018 | (ashiftrt:DI (match_operand:DI 1 "register_operand" "0, 0") | |
9019 | (match_operand:SI 2 "nonmemory_operand" "an,an"))) | |
ae156f85 | 9020 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 9021 | "!TARGET_ZARCH" |
65b1d8ea | 9022 | "@ |
a9fcf821 AK |
9023 | srda\t%0,<addr_style_op_cc_ops> |
9024 | srda\t%0,<addr_style_op_cc_ops>" | |
9025 | [(set_attr "op_type" "RS") | |
9026 | (set_attr "atype" "reg")]) | |
ecbe845e | 9027 | |
ecbe845e | 9028 | |
43a09b63 | 9029 | ; sra, srag |
a9fcf821 AK |
9030 | (define_insn "*ashr<mode>3<addr_style_op_cc><masked_op_cc><setcc><cconly>" |
9031 | [(set (match_operand:GPR 0 "register_operand" "=d, d") | |
9032 | (ashiftrt:GPR (match_operand:GPR 1 "register_operand" "<d0>, d") | |
9033 | (match_operand:SI 2 "nonmemory_operand" "an,an"))) | |
ae156f85 | 9034 | (clobber (reg:CC CC_REGNUM))] |
1b48c8cc | 9035 | "" |
65b1d8ea | 9036 | "@ |
a9fcf821 AK |
9037 | sra<g>\t%0,<1><addr_style_op_cc_ops> |
9038 | sra<gk>\t%0,%1,<addr_style_op_cc_ops>" | |
65b1d8ea | 9039 | [(set_attr "op_type" "RS<E>,RSY") |
a9fcf821 | 9040 | (set_attr "atype" "reg") |
01496eca | 9041 | (set_attr "cpu_facility" "*,z196") |
65b1d8ea | 9042 | (set_attr "z10prop" "z10_super_E1,*")]) |
4989e88a | 9043 | |
9db1d521 | 9044 | |
9db1d521 HP |
9045 | ;; |
9046 | ;; Branch instruction patterns. | |
9047 | ;; | |
9048 | ||
f90b7a5a | 9049 | (define_expand "cbranch<mode>4" |
fa77b251 | 9050 | [(set (pc) |
f90b7a5a PB |
9051 | (if_then_else (match_operator 0 "comparison_operator" |
9052 | [(match_operand:GPR 1 "register_operand" "") | |
9053 | (match_operand:GPR 2 "general_operand" "")]) | |
9054 | (label_ref (match_operand 3 "" "")) | |
fa77b251 | 9055 | (pc)))] |
ba956982 | 9056 | "" |
f90b7a5a PB |
9057 | "s390_emit_jump (operands[3], |
9058 | s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2])); | |
9059 | DONE;") | |
9060 | ||
9061 | (define_expand "cbranch<mode>4" | |
9062 | [(set (pc) | |
9063 | (if_then_else (match_operator 0 "comparison_operator" | |
9064 | [(match_operand:FP 1 "register_operand" "") | |
9065 | (match_operand:FP 2 "general_operand" "")]) | |
9066 | (label_ref (match_operand 3 "" "")) | |
9067 | (pc)))] | |
9068 | "TARGET_HARD_FLOAT" | |
9069 | "s390_emit_jump (operands[3], | |
9070 | s390_emit_compare (GET_CODE (operands[0]), operands[1], operands[2])); | |
9071 | DONE;") | |
9072 | ||
9073 | (define_expand "cbranchcc4" | |
9074 | [(set (pc) | |
de6fba39 | 9075 | (if_then_else (match_operator 0 "s390_comparison" |
f90b7a5a | 9076 | [(match_operand 1 "cc_reg_operand" "") |
de6fba39 | 9077 | (match_operand 2 "const_int_operand" "")]) |
f90b7a5a PB |
9078 | (label_ref (match_operand 3 "" "")) |
9079 | (pc)))] | |
de6fba39 UW |
9080 | "" |
9081 | "") | |
ba956982 | 9082 | |
9db1d521 HP |
9083 | |
9084 | ;; | |
9085 | ;;- Conditional jump instructions. | |
9086 | ;; | |
9087 | ||
6590e19a UW |
9088 | (define_insn "*cjump_64" |
9089 | [(set (pc) | |
9090 | (if_then_else | |
5a3fe9b6 AK |
9091 | (match_operator 1 "s390_comparison" [(reg CC_REGNUM) |
9092 | (match_operand 2 "const_int_operand" "")]) | |
6590e19a UW |
9093 | (label_ref (match_operand 0 "" "")) |
9094 | (pc)))] | |
8cc6307c | 9095 | "" |
9db1d521 | 9096 | { |
13e58269 | 9097 | if (get_attr_length (insn) == 4) |
d40c829f | 9098 | return "j%C1\t%l0"; |
6590e19a | 9099 | else |
d40c829f | 9100 | return "jg%C1\t%l0"; |
6590e19a UW |
9101 | } |
9102 | [(set_attr "op_type" "RI") | |
9103 | (set_attr "type" "branch") | |
9104 | (set (attr "length") | |
9105 | (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) | |
9106 | (const_int 4) (const_int 6)))]) | |
9107 | ||
f314b9b1 | 9108 | (define_insn "*cjump_long" |
6590e19a UW |
9109 | [(set (pc) |
9110 | (if_then_else | |
ae156f85 | 9111 | (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)]) |
4fe6dea8 | 9112 | (match_operand 0 "address_operand" "ZQZR") |
6590e19a | 9113 | (pc)))] |
84b4c7b5 | 9114 | "!TARGET_INDIRECT_BRANCH_NOBP_JUMP" |
f314b9b1 UW |
9115 | { |
9116 | if (get_attr_op_type (insn) == OP_TYPE_RR) | |
d40c829f | 9117 | return "b%C1r\t%0"; |
f314b9b1 | 9118 | else |
d40c829f | 9119 | return "b%C1\t%a0"; |
10bbf137 | 9120 | } |
c7453384 | 9121 | [(set (attr "op_type") |
f314b9b1 UW |
9122 | (if_then_else (match_operand 0 "register_operand" "") |
9123 | (const_string "RR") (const_string "RX"))) | |
84b4c7b5 AK |
9124 | (set (attr "mnemonic") |
9125 | (if_then_else (match_operand 0 "register_operand" "") | |
9126 | (const_string "bcr") (const_string "bc"))) | |
6590e19a | 9127 | (set_attr "type" "branch") |
077dab3b | 9128 | (set_attr "atype" "agen")]) |
9db1d521 | 9129 | |
177bc204 RS |
9130 | ;; A conditional return instruction. |
9131 | (define_insn "*c<code>" | |
9132 | [(set (pc) | |
9133 | (if_then_else | |
9134 | (match_operator 0 "s390_comparison" [(reg CC_REGNUM) (const_int 0)]) | |
9135 | (ANY_RETURN) | |
9136 | (pc)))] | |
9137 | "s390_can_use_<code>_insn ()" | |
84b4c7b5 AK |
9138 | { |
9139 | if (TARGET_INDIRECT_BRANCH_NOBP_RET) | |
9140 | { | |
9141 | s390_indirect_branch_via_thunk (RETURN_REGNUM, | |
9142 | INVALID_REGNUM, | |
9143 | operands[0], | |
9144 | s390_indirect_branch_type_return); | |
9145 | return ""; | |
9146 | } | |
9147 | else | |
9148 | return "b%C0r\t%%r14"; | |
9149 | } | |
9150 | [(set (attr "op_type") | |
9151 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET") | |
9152 | (const_string "RIL") | |
9153 | (const_string "RR"))) | |
9154 | (set (attr "mnemonic") | |
9155 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET") | |
9156 | (const_string "brcl") | |
9157 | (const_string "bcr"))) | |
177bc204 RS |
9158 | (set_attr "type" "jsr") |
9159 | (set_attr "atype" "agen")]) | |
9db1d521 HP |
9160 | |
9161 | ;; | |
9162 | ;;- Negated conditional jump instructions. | |
9163 | ;; | |
9164 | ||
6590e19a UW |
9165 | (define_insn "*icjump_64" |
9166 | [(set (pc) | |
9167 | (if_then_else | |
ae156f85 | 9168 | (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)]) |
6590e19a UW |
9169 | (pc) |
9170 | (label_ref (match_operand 0 "" ""))))] | |
8cc6307c | 9171 | "" |
c7453384 | 9172 | { |
13e58269 | 9173 | if (get_attr_length (insn) == 4) |
d40c829f | 9174 | return "j%D1\t%l0"; |
6590e19a | 9175 | else |
d40c829f | 9176 | return "jg%D1\t%l0"; |
6590e19a UW |
9177 | } |
9178 | [(set_attr "op_type" "RI") | |
9179 | (set_attr "type" "branch") | |
9180 | (set (attr "length") | |
9181 | (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) | |
9182 | (const_int 4) (const_int 6)))]) | |
9183 | ||
f314b9b1 | 9184 | (define_insn "*icjump_long" |
6590e19a UW |
9185 | [(set (pc) |
9186 | (if_then_else | |
ae156f85 | 9187 | (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)]) |
6590e19a | 9188 | (pc) |
4fe6dea8 | 9189 | (match_operand 0 "address_operand" "ZQZR")))] |
84b4c7b5 | 9190 | "!TARGET_INDIRECT_BRANCH_NOBP_JUMP" |
f314b9b1 UW |
9191 | { |
9192 | if (get_attr_op_type (insn) == OP_TYPE_RR) | |
d40c829f | 9193 | return "b%D1r\t%0"; |
f314b9b1 | 9194 | else |
d40c829f | 9195 | return "b%D1\t%a0"; |
10bbf137 | 9196 | } |
c7453384 | 9197 | [(set (attr "op_type") |
f314b9b1 UW |
9198 | (if_then_else (match_operand 0 "register_operand" "") |
9199 | (const_string "RR") (const_string "RX"))) | |
84b4c7b5 AK |
9200 | (set (attr "mnemonic") |
9201 | (if_then_else (match_operand 0 "register_operand" "") | |
9202 | (const_string "bcr") (const_string "bc"))) | |
077dab3b HP |
9203 | (set_attr "type" "branch") |
9204 | (set_attr "atype" "agen")]) | |
9db1d521 | 9205 | |
4456530d HP |
9206 | ;; |
9207 | ;;- Trap instructions. | |
9208 | ;; | |
9209 | ||
9210 | (define_insn "trap" | |
9211 | [(trap_if (const_int 1) (const_int 0))] | |
9212 | "" | |
d40c829f | 9213 | "j\t.+2" |
6590e19a | 9214 | [(set_attr "op_type" "RI") |
077dab3b | 9215 | (set_attr "type" "branch")]) |
4456530d | 9216 | |
f90b7a5a PB |
9217 | (define_expand "ctrap<mode>4" |
9218 | [(trap_if (match_operator 0 "comparison_operator" | |
9219 | [(match_operand:GPR 1 "register_operand" "") | |
9220 | (match_operand:GPR 2 "general_operand" "")]) | |
9221 | (match_operand 3 "const0_operand" ""))] | |
4456530d | 9222 | "" |
f90b7a5a PB |
9223 | { |
9224 | rtx cond = s390_emit_compare (GET_CODE (operands[0]), | |
9225 | operands[1], operands[2]); | |
9226 | emit_insn (gen_condtrap (cond, XEXP (cond, 0))); | |
9227 | DONE; | |
9228 | }) | |
9229 | ||
9230 | (define_expand "ctrap<mode>4" | |
9231 | [(trap_if (match_operator 0 "comparison_operator" | |
9232 | [(match_operand:FP 1 "register_operand" "") | |
9233 | (match_operand:FP 2 "general_operand" "")]) | |
9234 | (match_operand 3 "const0_operand" ""))] | |
9235 | "" | |
9236 | { | |
9237 | rtx cond = s390_emit_compare (GET_CODE (operands[0]), | |
9238 | operands[1], operands[2]); | |
9239 | emit_insn (gen_condtrap (cond, XEXP (cond, 0))); | |
9240 | DONE; | |
9241 | }) | |
4456530d | 9242 | |
f90b7a5a PB |
9243 | (define_insn "condtrap" |
9244 | [(trap_if (match_operator 0 "s390_comparison" | |
9245 | [(match_operand 1 "cc_reg_operand" "c") | |
9246 | (const_int 0)]) | |
4456530d HP |
9247 | (const_int 0))] |
9248 | "" | |
d40c829f | 9249 | "j%C0\t.+2"; |
077dab3b HP |
9250 | [(set_attr "op_type" "RI") |
9251 | (set_attr "type" "branch")]) | |
9db1d521 | 9252 | |
963fc8d0 AK |
9253 | ; crt, cgrt, cit, cgit |
9254 | (define_insn "*cmp_and_trap_signed_int<mode>" | |
9255 | [(trap_if (match_operator 0 "s390_signed_integer_comparison" | |
9256 | [(match_operand:GPR 1 "register_operand" "d,d") | |
9257 | (match_operand:GPR 2 "nonmemory_operand" "d,K")]) | |
9258 | (const_int 0))] | |
9259 | "TARGET_Z10" | |
9260 | "@ | |
9261 | c<g>rt%C0\t%1,%2 | |
9262 | c<g>it%C0\t%1,%h2" | |
9263 | [(set_attr "op_type" "RRF,RIE") | |
9381e3f1 | 9264 | (set_attr "type" "branch") |
729e750f | 9265 | (set_attr "z10prop" "z10_super_c,z10_super")]) |
963fc8d0 | 9266 | |
22ac2c2f | 9267 | ; clrt, clgrt, clfit, clgit, clt, clgt |
963fc8d0 AK |
9268 | (define_insn "*cmp_and_trap_unsigned_int<mode>" |
9269 | [(trap_if (match_operator 0 "s390_unsigned_integer_comparison" | |
3e4be43f UW |
9270 | [(match_operand:GPR 1 "register_operand" "d,d,d") |
9271 | (match_operand:GPR 2 "general_operand" "d,D,T")]) | |
963fc8d0 AK |
9272 | (const_int 0))] |
9273 | "TARGET_Z10" | |
9274 | "@ | |
9275 | cl<g>rt%C0\t%1,%2 | |
22ac2c2f AK |
9276 | cl<gf>it%C0\t%1,%x2 |
9277 | cl<g>t%C0\t%1,%2" | |
9278 | [(set_attr "op_type" "RRF,RIE,RSY") | |
9279 | (set_attr "type" "branch") | |
9280 | (set_attr "z10prop" "z10_super_c,z10_super,*") | |
9281 | (set_attr "cpu_facility" "z10,z10,zEC12")]) | |
9282 | ||
9283 | ; lat, lgat | |
9284 | (define_insn "*load_and_trap<mode>" | |
3e4be43f | 9285 | [(trap_if (eq (match_operand:GPR 0 "memory_operand" "T") |
22ac2c2f AK |
9286 | (const_int 0)) |
9287 | (const_int 0)) | |
9288 | (set (match_operand:GPR 1 "register_operand" "=d") | |
9289 | (match_dup 0))] | |
9290 | "TARGET_ZEC12" | |
9291 | "l<g>at\t%1,%0" | |
9292 | [(set_attr "op_type" "RXY")]) | |
9293 | ||
963fc8d0 | 9294 | |
9db1d521 | 9295 | ;; |
0a3bdf9d | 9296 | ;;- Loop instructions. |
9db1d521 | 9297 | ;; |
0a3bdf9d UW |
9298 | ;; This is all complicated by the fact that since this is a jump insn |
9299 | ;; we must handle our own output reloads. | |
c7453384 | 9300 | |
f1149235 AK |
9301 | ;; branch on index |
9302 | ||
9303 | ; This splitter will be matched by combine and has to add the 2 moves | |
9304 | ; necessary to load the compare and the increment values into a | |
9305 | ; register pair as needed by brxle. | |
9306 | ||
9307 | (define_insn_and_split "*brx_stage1_<GPR:mode>" | |
9308 | [(set (pc) | |
9309 | (if_then_else | |
9310 | (match_operator 6 "s390_brx_operator" | |
9311 | [(plus:GPR (match_operand:GPR 1 "register_operand" "") | |
9312 | (match_operand:GPR 2 "general_operand" "")) | |
9313 | (match_operand:GPR 3 "register_operand" "")]) | |
9314 | (label_ref (match_operand 0 "" "")) | |
9315 | (pc))) | |
9316 | (set (match_operand:GPR 4 "nonimmediate_operand" "") | |
9317 | (plus:GPR (match_dup 1) (match_dup 2))) | |
9318 | (clobber (match_scratch:GPR 5 ""))] | |
8cc6307c | 9319 | "" |
f1149235 AK |
9320 | "#" |
9321 | "!reload_completed && !reload_in_progress" | |
9322 | [(set (match_dup 7) (match_dup 2)) ; the increment | |
9323 | (set (match_dup 8) (match_dup 3)) ; the comparison value | |
9324 | (parallel [(set (pc) | |
9325 | (if_then_else | |
9326 | (match_op_dup 6 | |
9327 | [(plus:GPR (match_dup 1) (match_dup 7)) | |
9328 | (match_dup 8)]) | |
9329 | (label_ref (match_dup 0)) | |
9330 | (pc))) | |
9331 | (set (match_dup 4) | |
9332 | (plus:GPR (match_dup 1) (match_dup 7))) | |
9333 | (clobber (match_dup 5)) | |
9334 | (clobber (reg:CC CC_REGNUM))])] | |
9335 | { | |
9336 | rtx dreg = gen_reg_rtx (word_mode == DImode ? TImode : DImode); | |
9337 | operands[7] = gen_lowpart (<GPR:MODE>mode, | |
9338 | gen_highpart (word_mode, dreg)); | |
9339 | operands[8] = gen_lowpart (<GPR:MODE>mode, | |
9340 | gen_lowpart (word_mode, dreg)); | |
9341 | }) | |
9342 | ||
9343 | ; brxlg, brxhg | |
9344 | ||
9345 | (define_insn_and_split "*brxg_64bit" | |
9346 | [(set (pc) | |
9347 | (if_then_else | |
9348 | (match_operator 5 "s390_brx_operator" | |
9349 | [(plus:DI (match_operand:DI 1 "register_operand" "d,d,d") | |
9350 | (subreg:DI (match_operand:TI 2 "register_operand" "d,d,d") 0)) | |
9351 | (subreg:DI (match_dup 2) 8)]) | |
9352 | (label_ref (match_operand 0 "" "")) | |
9353 | (pc))) | |
9354 | (set (match_operand:DI 3 "nonimmediate_operand" "=1,?X,?X") | |
9355 | (plus:DI (match_dup 1) | |
9356 | (subreg:DI (match_dup 2) 0))) | |
9357 | (clobber (match_scratch:DI 4 "=X,&1,&?d")) | |
9358 | (clobber (reg:CC CC_REGNUM))] | |
9602b6a1 | 9359 | "TARGET_ZARCH" |
f1149235 AK |
9360 | { |
9361 | if (which_alternative != 0) | |
9362 | return "#"; | |
9363 | else if (get_attr_length (insn) == 6) | |
9364 | return "brx%E5g\t%1,%2,%l0"; | |
9365 | else | |
9366 | return "agr\t%1,%2\;cgr\t%1,%M2\;jg%C5\t%l0"; | |
9367 | } | |
9368 | "&& reload_completed | |
9369 | && (!REG_P (operands[3]) | |
9370 | || !rtx_equal_p (operands[1], operands[3]))" | |
9371 | [(set (match_dup 4) (match_dup 1)) | |
9372 | (parallel [(set (match_dup 4) (plus:DI (match_dup 4) (subreg:DI (match_dup 2) 0))) | |
9373 | (clobber (reg:CC CC_REGNUM))]) | |
9374 | (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:DI (match_dup 2) 8))) | |
9375 | (set (match_dup 3) (match_dup 4)) | |
9376 | (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)]) | |
9377 | (label_ref (match_dup 0)) | |
9378 | (pc)))] | |
9379 | "" | |
9380 | [(set_attr "op_type" "RIE") | |
9381 | (set_attr "type" "branch") | |
9382 | (set (attr "length") | |
9383 | (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) | |
9384 | (const_int 6) (const_int 16)))]) | |
9385 | ||
9386 | ; brxle, brxh | |
9387 | ||
9388 | (define_insn_and_split "*brx_64bit" | |
9389 | [(set (pc) | |
9390 | (if_then_else | |
9391 | (match_operator 5 "s390_brx_operator" | |
9392 | [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d") | |
9393 | (subreg:SI (match_operand:TI 2 "register_operand" "d,d,d") 4)) | |
9394 | (subreg:SI (match_dup 2) 12)]) | |
9395 | (label_ref (match_operand 0 "" "")) | |
9396 | (pc))) | |
9397 | (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X") | |
9398 | (plus:SI (match_dup 1) | |
9399 | (subreg:SI (match_dup 2) 4))) | |
9400 | (clobber (match_scratch:SI 4 "=X,&1,&?d")) | |
9401 | (clobber (reg:CC CC_REGNUM))] | |
9602b6a1 | 9402 | "TARGET_ZARCH" |
f1149235 AK |
9403 | { |
9404 | if (which_alternative != 0) | |
9405 | return "#"; | |
9406 | else if (get_attr_length (insn) == 6) | |
9407 | return "brx%C5\t%1,%2,%l0"; | |
9408 | else | |
9409 | return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0"; | |
9410 | } | |
9411 | "&& reload_completed | |
9412 | && (!REG_P (operands[3]) | |
9413 | || !rtx_equal_p (operands[1], operands[3]))" | |
9414 | [(set (match_dup 4) (match_dup 1)) | |
9415 | (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 4))) | |
9416 | (clobber (reg:CC CC_REGNUM))]) | |
9417 | (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 12))) | |
9418 | (set (match_dup 3) (match_dup 4)) | |
9419 | (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)]) | |
9420 | (label_ref (match_dup 0)) | |
9421 | (pc)))] | |
9422 | "" | |
9423 | [(set_attr "op_type" "RSI") | |
9424 | (set_attr "type" "branch") | |
9425 | (set (attr "length") | |
9426 | (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) | |
9427 | (const_int 6) (const_int 14)))]) | |
9428 | ||
9429 | ; brxle, brxh | |
9430 | ||
9431 | (define_insn_and_split "*brx_31bit" | |
9432 | [(set (pc) | |
9433 | (if_then_else | |
9434 | (match_operator 5 "s390_brx_operator" | |
9435 | [(plus:SI (match_operand:SI 1 "register_operand" "d,d,d") | |
9436 | (subreg:SI (match_operand:DI 2 "register_operand" "d,d,d") 0)) | |
9437 | (subreg:SI (match_dup 2) 4)]) | |
9438 | (label_ref (match_operand 0 "" "")) | |
9439 | (pc))) | |
9440 | (set (match_operand:SI 3 "nonimmediate_operand" "=1,?X,?X") | |
9441 | (plus:SI (match_dup 1) | |
9442 | (subreg:SI (match_dup 2) 0))) | |
9443 | (clobber (match_scratch:SI 4 "=X,&1,&?d")) | |
9444 | (clobber (reg:CC CC_REGNUM))] | |
8cc6307c | 9445 | "!TARGET_ZARCH" |
f1149235 AK |
9446 | { |
9447 | if (which_alternative != 0) | |
9448 | return "#"; | |
9449 | else if (get_attr_length (insn) == 6) | |
9450 | return "brx%C5\t%1,%2,%l0"; | |
9451 | else | |
9452 | return "ar\t%1,%2\;cr\t%1,%M2\;jg%C5\t%l0"; | |
9453 | } | |
9454 | "&& reload_completed | |
9455 | && (!REG_P (operands[3]) | |
9456 | || !rtx_equal_p (operands[1], operands[3]))" | |
9457 | [(set (match_dup 4) (match_dup 1)) | |
9458 | (parallel [(set (match_dup 4) (plus:SI (match_dup 4) (subreg:SI (match_dup 2) 0))) | |
9459 | (clobber (reg:CC CC_REGNUM))]) | |
9460 | (set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 4) (subreg:SI (match_dup 2) 4))) | |
9461 | (set (match_dup 3) (match_dup 4)) | |
9462 | (set (pc) (if_then_else (match_op_dup 5 [(reg:CCS CC_REGNUM) (const_int 0)]) | |
9463 | (label_ref (match_dup 0)) | |
9464 | (pc)))] | |
9465 | "" | |
9466 | [(set_attr "op_type" "RSI") | |
9467 | (set_attr "type" "branch") | |
9468 | (set (attr "length") | |
9469 | (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) | |
9470 | (const_int 6) (const_int 14)))]) | |
9471 | ||
9472 | ||
9473 | ;; branch on count | |
9474 | ||
0a3bdf9d UW |
9475 | (define_expand "doloop_end" |
9476 | [(use (match_operand 0 "" "")) ; loop pseudo | |
1d0216c8 | 9477 | (use (match_operand 1 "" ""))] ; label |
0a3bdf9d | 9478 | "" |
0a3bdf9d | 9479 | { |
8cc6307c | 9480 | if (GET_MODE (operands[0]) == SImode) |
1d0216c8 | 9481 | emit_jump_insn (gen_doloop_si64 (operands[1], operands[0], operands[0])); |
9602b6a1 | 9482 | else if (GET_MODE (operands[0]) == DImode && TARGET_ZARCH) |
1d0216c8 | 9483 | emit_jump_insn (gen_doloop_di (operands[1], operands[0], operands[0])); |
0a3bdf9d UW |
9484 | else |
9485 | FAIL; | |
9486 | ||
9487 | DONE; | |
10bbf137 | 9488 | }) |
0a3bdf9d | 9489 | |
6590e19a | 9490 | (define_insn_and_split "doloop_si64" |
0a3bdf9d UW |
9491 | [(set (pc) |
9492 | (if_then_else | |
7e665d18 | 9493 | (ne (match_operand:SI 1 "register_operand" "d,d,d") |
0a3bdf9d UW |
9494 | (const_int 1)) |
9495 | (label_ref (match_operand 0 "" "")) | |
9496 | (pc))) | |
7e665d18 | 9497 | (set (match_operand:SI 2 "nonimmediate_operand" "=1,?X,?X") |
0a3bdf9d | 9498 | (plus:SI (match_dup 1) (const_int -1))) |
7e665d18 | 9499 | (clobber (match_scratch:SI 3 "=X,&1,&?d")) |
ae156f85 | 9500 | (clobber (reg:CC CC_REGNUM))] |
8cc6307c | 9501 | "" |
0a3bdf9d UW |
9502 | { |
9503 | if (which_alternative != 0) | |
10bbf137 | 9504 | return "#"; |
0a3bdf9d | 9505 | else if (get_attr_length (insn) == 4) |
d40c829f | 9506 | return "brct\t%1,%l0"; |
6590e19a | 9507 | else |
545d16ff | 9508 | return "ahi\t%1,-1\;jgne\t%l0"; |
6590e19a UW |
9509 | } |
9510 | "&& reload_completed | |
9511 | && (! REG_P (operands[2]) | |
9512 | || ! rtx_equal_p (operands[1], operands[2]))" | |
7e665d18 AK |
9513 | [(set (match_dup 3) (match_dup 1)) |
9514 | (parallel [(set (reg:CCAN CC_REGNUM) | |
6590e19a UW |
9515 | (compare:CCAN (plus:SI (match_dup 3) (const_int -1)) |
9516 | (const_int 0))) | |
9517 | (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))]) | |
9518 | (set (match_dup 2) (match_dup 3)) | |
ae156f85 | 9519 | (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0)) |
6590e19a UW |
9520 | (label_ref (match_dup 0)) |
9521 | (pc)))] | |
9522 | "" | |
9523 | [(set_attr "op_type" "RI") | |
9381e3f1 WG |
9524 | ; Strictly speaking, the z10 properties are valid for brct only, however, it does not |
9525 | ; hurt us in the (rare) case of ahi. | |
729e750f | 9526 | (set_attr "z10prop" "z10_super_E1") |
6590e19a UW |
9527 | (set_attr "type" "branch") |
9528 | (set (attr "length") | |
9529 | (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) | |
9530 | (const_int 4) (const_int 10)))]) | |
9531 | ||
6590e19a | 9532 | (define_insn_and_split "doloop_di" |
0a3bdf9d UW |
9533 | [(set (pc) |
9534 | (if_then_else | |
7e665d18 | 9535 | (ne (match_operand:DI 1 "register_operand" "d,d,d") |
0a3bdf9d UW |
9536 | (const_int 1)) |
9537 | (label_ref (match_operand 0 "" "")) | |
9538 | (pc))) | |
7e665d18 | 9539 | (set (match_operand:DI 2 "nonimmediate_operand" "=1,?X,?X") |
0a3bdf9d | 9540 | (plus:DI (match_dup 1) (const_int -1))) |
7e665d18 | 9541 | (clobber (match_scratch:DI 3 "=X,&1,&?d")) |
ae156f85 | 9542 | (clobber (reg:CC CC_REGNUM))] |
9602b6a1 | 9543 | "TARGET_ZARCH" |
0a3bdf9d UW |
9544 | { |
9545 | if (which_alternative != 0) | |
10bbf137 | 9546 | return "#"; |
0a3bdf9d | 9547 | else if (get_attr_length (insn) == 4) |
d40c829f | 9548 | return "brctg\t%1,%l0"; |
0a3bdf9d | 9549 | else |
545d16ff | 9550 | return "aghi\t%1,-1\;jgne\t%l0"; |
10bbf137 | 9551 | } |
6590e19a | 9552 | "&& reload_completed |
0a3bdf9d UW |
9553 | && (! REG_P (operands[2]) |
9554 | || ! rtx_equal_p (operands[1], operands[2]))" | |
7e665d18 AK |
9555 | [(set (match_dup 3) (match_dup 1)) |
9556 | (parallel [(set (reg:CCAN CC_REGNUM) | |
0a3bdf9d UW |
9557 | (compare:CCAN (plus:DI (match_dup 3) (const_int -1)) |
9558 | (const_int 0))) | |
9559 | (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))]) | |
9560 | (set (match_dup 2) (match_dup 3)) | |
ae156f85 | 9561 | (set (pc) (if_then_else (ne (reg:CCAN CC_REGNUM) (const_int 0)) |
6590e19a | 9562 | (label_ref (match_dup 0)) |
0a3bdf9d | 9563 | (pc)))] |
6590e19a UW |
9564 | "" |
9565 | [(set_attr "op_type" "RI") | |
9381e3f1 WG |
9566 | ; Strictly speaking, the z10 properties are valid for brct only, however, it does not |
9567 | ; hurt us in the (rare) case of ahi. | |
729e750f | 9568 | (set_attr "z10prop" "z10_super_E1") |
6590e19a UW |
9569 | (set_attr "type" "branch") |
9570 | (set (attr "length") | |
9571 | (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) | |
9572 | (const_int 4) (const_int 10)))]) | |
9db1d521 HP |
9573 | |
9574 | ;; | |
9575 | ;;- Unconditional jump instructions. | |
9576 | ;; | |
9577 | ||
9578 | ; | |
9579 | ; jump instruction pattern(s). | |
9580 | ; | |
9581 | ||
6590e19a UW |
9582 | (define_expand "jump" |
9583 | [(match_operand 0 "" "")] | |
9db1d521 | 9584 | "" |
6590e19a UW |
9585 | "s390_emit_jump (operands[0], NULL_RTX); DONE;") |
9586 | ||
9587 | (define_insn "*jump64" | |
9588 | [(set (pc) (label_ref (match_operand 0 "" "")))] | |
8cc6307c | 9589 | "" |
9db1d521 | 9590 | { |
13e58269 | 9591 | if (get_attr_length (insn) == 4) |
d40c829f | 9592 | return "j\t%l0"; |
6590e19a | 9593 | else |
d40c829f | 9594 | return "jg\t%l0"; |
6590e19a UW |
9595 | } |
9596 | [(set_attr "op_type" "RI") | |
9597 | (set_attr "type" "branch") | |
9598 | (set (attr "length") | |
9599 | (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) | |
9600 | (const_int 4) (const_int 6)))]) | |
9601 | ||
9db1d521 HP |
9602 | ; |
9603 | ; indirect-jump instruction pattern(s). | |
9604 | ; | |
9605 | ||
2841f550 AK |
9606 | (define_expand "indirect_jump" |
9607 | [(set (pc) (match_operand 0 "nonimmediate_operand" ""))] | |
9db1d521 | 9608 | "" |
f314b9b1 | 9609 | { |
2841f550 AK |
9610 | if (address_operand (operands[0], GET_MODE (operands[0]))) |
9611 | ; | |
e9e8efc9 | 9612 | else if (TARGET_Z14 |
2841f550 AK |
9613 | && GET_MODE (operands[0]) == Pmode |
9614 | && memory_operand (operands[0], Pmode)) | |
9615 | ; | |
f314b9b1 | 9616 | else |
2841f550 | 9617 | operands[0] = force_reg (Pmode, operands[0]); |
84b4c7b5 AK |
9618 | |
9619 | if (TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK) | |
9620 | { | |
9621 | operands[0] = force_reg (Pmode, operands[0]); | |
9622 | if (TARGET_CPU_Z10) | |
9623 | { | |
9624 | if (TARGET_64BIT) | |
9625 | emit_jump_insn (gen_indirect_jump_via_thunkdi_z10 (operands[0])); | |
9626 | else | |
9627 | emit_jump_insn (gen_indirect_jump_via_thunksi_z10 (operands[0])); | |
9628 | } | |
9629 | else | |
9630 | { | |
9631 | if (TARGET_64BIT) | |
9632 | emit_jump_insn (gen_indirect_jump_via_thunkdi (operands[0])); | |
9633 | else | |
9634 | emit_jump_insn (gen_indirect_jump_via_thunksi (operands[0])); | |
9635 | } | |
9636 | DONE; | |
9637 | } | |
9638 | ||
9639 | if (TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK) | |
9640 | { | |
9641 | operands[0] = force_reg (Pmode, operands[0]); | |
9642 | rtx label_ref = gen_rtx_LABEL_REF (VOIDmode, gen_label_rtx ()); | |
9643 | if (TARGET_CPU_Z10) | |
9644 | { | |
9645 | if (TARGET_64BIT) | |
9646 | emit_jump_insn (gen_indirect_jump_via_inlinethunkdi_z10 (operands[0], | |
9647 | label_ref)); | |
9648 | else | |
9649 | emit_jump_insn (gen_indirect_jump_via_inlinethunksi_z10 (operands[0], | |
9650 | label_ref)); | |
9651 | } | |
9652 | else | |
9653 | { | |
9654 | if (TARGET_64BIT) | |
9655 | emit_jump_insn (gen_indirect_jump_via_inlinethunkdi (operands[0], | |
9656 | label_ref, | |
9657 | force_reg (Pmode, label_ref))); | |
9658 | else | |
9659 | emit_jump_insn (gen_indirect_jump_via_inlinethunksi (operands[0], | |
9660 | label_ref, | |
9661 | force_reg (Pmode, label_ref))); | |
9662 | } | |
9663 | DONE; | |
9664 | } | |
2841f550 AK |
9665 | }) |
9666 | ||
9667 | (define_insn "*indirect_jump" | |
9668 | [(set (pc) | |
84b4c7b5 AK |
9669 | (match_operand 0 "address_operand" "ZR"))] |
9670 | "!TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK" | |
9671 | { | |
9672 | if (get_attr_op_type (insn) == OP_TYPE_RR) | |
9673 | return "br\t%0"; | |
9674 | else | |
9675 | return "b\t%a0"; | |
9676 | } | |
9677 | [(set (attr "op_type") | |
9678 | (if_then_else (match_operand 0 "register_operand" "") | |
9679 | (const_string "RR") (const_string "RX"))) | |
9680 | (set (attr "mnemonic") | |
9681 | (if_then_else (match_operand 0 "register_operand" "") | |
9682 | (const_string "br") (const_string "b"))) | |
2841f550 | 9683 | (set_attr "type" "branch") |
84b4c7b5 AK |
9684 | (set_attr "atype" "agen")]) |
9685 | ||
9686 | (define_insn "indirect_jump_via_thunk<mode>_z10" | |
9687 | [(set (pc) | |
9688 | (match_operand:P 0 "register_operand" "a"))] | |
9689 | "TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK | |
9690 | && TARGET_CPU_Z10" | |
9691 | { | |
9692 | s390_indirect_branch_via_thunk (REGNO (operands[0]), | |
9693 | INVALID_REGNUM, | |
9694 | NULL_RTX, | |
9695 | s390_indirect_branch_type_jump); | |
9696 | return ""; | |
9697 | } | |
9698 | [(set_attr "op_type" "RIL") | |
9699 | (set_attr "mnemonic" "jg") | |
9700 | (set_attr "type" "branch") | |
9701 | (set_attr "atype" "agen")]) | |
9702 | ||
9703 | (define_insn "indirect_jump_via_thunk<mode>" | |
9704 | [(set (pc) | |
9705 | (match_operand:P 0 "register_operand" " a")) | |
9706 | (clobber (reg:P INDIRECT_BRANCH_THUNK_REGNUM))] | |
9707 | "TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK | |
9708 | && !TARGET_CPU_Z10" | |
9709 | { | |
9710 | s390_indirect_branch_via_thunk (REGNO (operands[0]), | |
9711 | INVALID_REGNUM, | |
9712 | NULL_RTX, | |
9713 | s390_indirect_branch_type_jump); | |
9714 | return ""; | |
9715 | } | |
9716 | [(set_attr "op_type" "RIL") | |
9717 | (set_attr "mnemonic" "jg") | |
9718 | (set_attr "type" "branch") | |
9719 | (set_attr "atype" "agen")]) | |
9720 | ||
9721 | ||
9722 | ; The label_ref is wrapped into an if_then_else in order to hide it | |
9723 | ; from mark_jump_label. Without this the label_ref would become the | |
9724 | ; ONLY jump target of that jump breaking the control flow graph. | |
9725 | (define_insn "indirect_jump_via_inlinethunk<mode>_z10" | |
9726 | [(unspec [(if_then_else (match_operand:P 1 "larl_operand" "X") | |
9727 | (const_int 0) | |
9728 | (const_int 0)) | |
9729 | (const_int 0)] UNSPEC_EXECUTE_JUMP) | |
9730 | (set (pc) (match_operand:P 0 "register_operand" "a"))] | |
9731 | "TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK | |
9732 | && TARGET_CPU_Z10" | |
9733 | { | |
9734 | s390_indirect_branch_via_inline_thunk (operands[1]); | |
9735 | return ""; | |
9736 | } | |
9737 | [(set_attr "op_type" "RIL") | |
9738 | (set_attr "type" "branch") | |
9739 | (set_attr "length" "10")]) | |
9740 | ||
9741 | (define_insn "indirect_jump_via_inlinethunk<mode>" | |
9742 | [(unspec [(if_then_else (match_operand:P 1 "larl_operand" "X") | |
9743 | (const_int 0) | |
9744 | (const_int 0)) | |
9745 | (match_operand:P 2 "register_operand" "a")] UNSPEC_EXECUTE_JUMP) | |
9746 | (set (pc) (match_operand:P 0 "register_operand" "a"))] | |
9747 | "TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK | |
9748 | && !TARGET_CPU_Z10" | |
9749 | { | |
9750 | s390_indirect_branch_via_inline_thunk (operands[2]); | |
9751 | return ""; | |
9752 | } | |
9753 | [(set_attr "op_type" "RX") | |
9754 | (set_attr "type" "branch") | |
9755 | (set_attr "length" "8")]) | |
2841f550 AK |
9756 | |
9757 | ; FIXME: LRA does not appear to be able to deal with MEMs being | |
9758 | ; checked against address constraints like ZR above. So make this a | |
9759 | ; separate pattern for now. | |
9760 | (define_insn "*indirect2_jump" | |
9761 | [(set (pc) | |
9762 | (match_operand 0 "nonimmediate_operand" "a,T"))] | |
84b4c7b5 | 9763 | "!TARGET_INDIRECT_BRANCH_NOBP_JUMP" |
2841f550 AK |
9764 | "@ |
9765 | br\t%0 | |
9766 | bi\t%0" | |
9767 | [(set_attr "op_type" "RR,RXY") | |
9768 | (set_attr "type" "branch") | |
9769 | (set_attr "atype" "agen") | |
e9e8efc9 | 9770 | (set_attr "cpu_facility" "*,z14")]) |
9db1d521 HP |
9771 | |
9772 | ; | |
f314b9b1 | 9773 | ; casesi instruction pattern(s). |
9db1d521 HP |
9774 | ; |
9775 | ||
84b4c7b5 AK |
9776 | (define_expand "casesi_jump" |
9777 | [(parallel | |
9778 | [(set (pc) (match_operand 0 "address_operand")) | |
9779 | (use (label_ref (match_operand 1 "")))])] | |
9db1d521 | 9780 | "" |
84b4c7b5 AK |
9781 | { |
9782 | if (TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK) | |
9783 | { | |
9784 | operands[0] = force_reg (GET_MODE (operands[0]), operands[0]); | |
9785 | ||
9786 | if (TARGET_CPU_Z10) | |
9787 | { | |
9788 | if (TARGET_64BIT) | |
9789 | emit_jump_insn (gen_casesi_jump_via_thunkdi_z10 (operands[0], | |
9790 | operands[1])); | |
9791 | else | |
9792 | emit_jump_insn (gen_casesi_jump_via_thunksi_z10 (operands[0], | |
9793 | operands[1])); | |
9794 | } | |
9795 | else | |
9796 | { | |
9797 | if (TARGET_64BIT) | |
9798 | emit_jump_insn (gen_casesi_jump_via_thunkdi (operands[0], | |
9799 | operands[1])); | |
9800 | else | |
9801 | emit_jump_insn (gen_casesi_jump_via_thunksi (operands[0], | |
9802 | operands[1])); | |
9803 | } | |
9804 | DONE; | |
9805 | } | |
9806 | ||
9807 | if (TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK) | |
9808 | { | |
9809 | operands[0] = force_reg (Pmode, operands[0]); | |
9810 | rtx label_ref = gen_rtx_LABEL_REF (VOIDmode, gen_label_rtx ()); | |
9811 | if (TARGET_CPU_Z10) | |
9812 | { | |
9813 | if (TARGET_64BIT) | |
9814 | emit_jump_insn (gen_casesi_jump_via_inlinethunkdi_z10 (operands[0], | |
9815 | operands[1], | |
9816 | label_ref)); | |
9817 | else | |
9818 | emit_jump_insn (gen_casesi_jump_via_inlinethunksi_z10 (operands[0], | |
9819 | operands[1], | |
9820 | label_ref)); | |
9821 | } | |
9822 | else | |
9823 | { | |
9824 | if (TARGET_64BIT) | |
9825 | emit_jump_insn (gen_casesi_jump_via_inlinethunkdi (operands[0], | |
9826 | operands[1], | |
9827 | label_ref, | |
9828 | force_reg (Pmode, label_ref))); | |
9829 | else | |
9830 | emit_jump_insn (gen_casesi_jump_via_inlinethunksi (operands[0], | |
9831 | operands[1], | |
9832 | label_ref, | |
9833 | force_reg (Pmode, label_ref))); | |
9834 | } | |
9835 | DONE; | |
9836 | } | |
9837 | }) | |
9838 | ||
9839 | (define_insn "*casesi_jump" | |
9840 | [(set (pc) (match_operand 0 "address_operand" "ZR")) | |
9841 | (use (label_ref (match_operand 1 "" "")))] | |
9842 | "!TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK" | |
9db1d521 | 9843 | { |
f314b9b1 | 9844 | if (get_attr_op_type (insn) == OP_TYPE_RR) |
d40c829f | 9845 | return "br\t%0"; |
f314b9b1 | 9846 | else |
d40c829f | 9847 | return "b\t%a0"; |
10bbf137 | 9848 | } |
c7453384 | 9849 | [(set (attr "op_type") |
f314b9b1 UW |
9850 | (if_then_else (match_operand 0 "register_operand" "") |
9851 | (const_string "RR") (const_string "RX"))) | |
84b4c7b5 AK |
9852 | (set (attr "mnemonic") |
9853 | (if_then_else (match_operand 0 "register_operand" "") | |
9854 | (const_string "br") (const_string "b"))) | |
9855 | (set_attr "type" "branch") | |
9856 | (set_attr "atype" "agen")]) | |
9857 | ||
9858 | (define_insn "casesi_jump_via_thunk<mode>_z10" | |
9859 | [(set (pc) (match_operand:P 0 "register_operand" "a")) | |
9860 | (use (label_ref (match_operand 1 "" "")))] | |
9861 | "TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK | |
9862 | && TARGET_CPU_Z10" | |
9863 | { | |
9864 | s390_indirect_branch_via_thunk (REGNO (operands[0]), | |
9865 | INVALID_REGNUM, | |
9866 | NULL_RTX, | |
9867 | s390_indirect_branch_type_jump); | |
9868 | return ""; | |
9869 | } | |
9870 | [(set_attr "op_type" "RIL") | |
9871 | (set_attr "mnemonic" "jg") | |
9872 | (set_attr "type" "branch") | |
9873 | (set_attr "atype" "agen")]) | |
9874 | ||
9875 | (define_insn "casesi_jump_via_thunk<mode>" | |
9876 | [(set (pc) (match_operand:P 0 "register_operand" "a")) | |
9877 | (use (label_ref (match_operand 1 "" ""))) | |
9878 | (clobber (reg:P INDIRECT_BRANCH_THUNK_REGNUM))] | |
9879 | "TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK | |
9880 | && !TARGET_CPU_Z10" | |
9881 | { | |
9882 | s390_indirect_branch_via_thunk (REGNO (operands[0]), | |
9883 | INVALID_REGNUM, | |
9884 | NULL_RTX, | |
9885 | s390_indirect_branch_type_jump); | |
9886 | return ""; | |
9887 | } | |
9888 | [(set_attr "op_type" "RIL") | |
9889 | (set_attr "mnemonic" "jg") | |
077dab3b HP |
9890 | (set_attr "type" "branch") |
9891 | (set_attr "atype" "agen")]) | |
9db1d521 | 9892 | |
84b4c7b5 AK |
9893 | |
9894 | ; The label_ref is wrapped into an if_then_else in order to hide it | |
9895 | ; from mark_jump_label. Without this the label_ref would become the | |
9896 | ; ONLY jump target of that jump breaking the control flow graph. | |
9897 | (define_insn "casesi_jump_via_inlinethunk<mode>_z10" | |
9898 | [(unspec [(if_then_else (match_operand:P 2 "larl_operand" "X") | |
9899 | (const_int 0) | |
9900 | (const_int 0)) | |
9901 | (const_int 0)] UNSPEC_EXECUTE_JUMP) | |
9902 | (set (pc) (match_operand:P 0 "register_operand" "a")) | |
9903 | (use (label_ref (match_operand 1 "" "")))] | |
9904 | "TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK | |
9905 | && TARGET_CPU_Z10" | |
9906 | { | |
9907 | s390_indirect_branch_via_inline_thunk (operands[2]); | |
9908 | return ""; | |
9909 | } | |
9910 | [(set_attr "op_type" "RIL") | |
9911 | (set_attr "type" "cs") | |
9912 | (set_attr "length" "10")]) | |
9913 | ||
9914 | (define_insn "casesi_jump_via_inlinethunk<mode>" | |
9915 | [(unspec [(if_then_else (match_operand:P 2 "larl_operand" "X") | |
9916 | (const_int 0) | |
9917 | (const_int 0)) | |
9918 | (match_operand:P 3 "register_operand" "a")] UNSPEC_EXECUTE_JUMP) | |
9919 | (set (pc) (match_operand:P 0 "register_operand" "a")) | |
9920 | (use (label_ref (match_operand 1 "" "")))] | |
9921 | "TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK | |
9922 | && !TARGET_CPU_Z10" | |
9923 | { | |
9924 | s390_indirect_branch_via_inline_thunk (operands[3]); | |
9925 | return ""; | |
9926 | } | |
9927 | [(set_attr "op_type" "RX") | |
9928 | (set_attr "type" "cs") | |
9929 | (set_attr "length" "8")]) | |
9930 | ||
f314b9b1 UW |
9931 | (define_expand "casesi" |
9932 | [(match_operand:SI 0 "general_operand" "") | |
9933 | (match_operand:SI 1 "general_operand" "") | |
9934 | (match_operand:SI 2 "general_operand" "") | |
9935 | (label_ref (match_operand 3 "" "")) | |
9936 | (label_ref (match_operand 4 "" ""))] | |
9db1d521 | 9937 | "" |
f314b9b1 UW |
9938 | { |
9939 | rtx index = gen_reg_rtx (SImode); | |
9940 | rtx base = gen_reg_rtx (Pmode); | |
9941 | rtx target = gen_reg_rtx (Pmode); | |
9942 | ||
9943 | emit_move_insn (index, operands[0]); | |
9944 | emit_insn (gen_subsi3 (index, index, operands[1])); | |
9945 | emit_cmp_and_jump_insns (index, operands[2], GTU, NULL_RTX, SImode, 1, | |
e790b36a | 9946 | operands[4]); |
f314b9b1 UW |
9947 | |
9948 | if (Pmode != SImode) | |
9949 | index = convert_to_mode (Pmode, index, 1); | |
9950 | if (GET_CODE (index) != REG) | |
9951 | index = copy_to_mode_reg (Pmode, index); | |
9952 | ||
9953 | if (TARGET_64BIT) | |
9954 | emit_insn (gen_ashldi3 (index, index, GEN_INT (3))); | |
9955 | else | |
a556fd39 | 9956 | emit_insn (gen_ashlsi3 (index, index, const2_rtx)); |
9db1d521 | 9957 | |
f314b9b1 UW |
9958 | emit_move_insn (base, gen_rtx_LABEL_REF (Pmode, operands[3])); |
9959 | ||
542a8afa | 9960 | index = gen_const_mem (Pmode, gen_rtx_PLUS (Pmode, base, index)); |
f314b9b1 UW |
9961 | emit_move_insn (target, index); |
9962 | ||
9963 | if (flag_pic) | |
9964 | target = gen_rtx_PLUS (Pmode, base, target); | |
9965 | emit_jump_insn (gen_casesi_jump (target, operands[3])); | |
9966 | ||
9967 | DONE; | |
10bbf137 | 9968 | }) |
9db1d521 HP |
9969 | |
9970 | ||
9971 | ;; | |
9972 | ;;- Jump to subroutine. | |
9973 | ;; | |
9974 | ;; | |
9975 | ||
9976 | ; | |
9977 | ; untyped call instruction pattern(s). | |
9978 | ; | |
9979 | ||
9980 | ;; Call subroutine returning any type. | |
9981 | (define_expand "untyped_call" | |
9982 | [(parallel [(call (match_operand 0 "" "") | |
9983 | (const_int 0)) | |
9984 | (match_operand 1 "" "") | |
9985 | (match_operand 2 "" "")])] | |
9986 | "" | |
9db1d521 HP |
9987 | { |
9988 | int i; | |
9989 | ||
9990 | emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx)); | |
9991 | ||
9992 | for (i = 0; i < XVECLEN (operands[2], 0); i++) | |
9993 | { | |
9994 | rtx set = XVECEXP (operands[2], 0, i); | |
9995 | emit_move_insn (SET_DEST (set), SET_SRC (set)); | |
9996 | } | |
9997 | ||
9998 | /* The optimizer does not know that the call sets the function value | |
9999 | registers we stored in the result block. We avoid problems by | |
10000 | claiming that all hard registers are used and clobbered at this | |
10001 | point. */ | |
10002 | emit_insn (gen_blockage ()); | |
10003 | ||
10004 | DONE; | |
10bbf137 | 10005 | }) |
9db1d521 HP |
10006 | |
10007 | ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and | |
10008 | ;; all of memory. This blocks insns from being moved across this point. | |
10009 | ||
10010 | (define_insn "blockage" | |
10bbf137 | 10011 | [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)] |
9db1d521 | 10012 | "" |
4023fb28 | 10013 | "" |
d5869ca0 UW |
10014 | [(set_attr "type" "none") |
10015 | (set_attr "length" "0")]) | |
4023fb28 | 10016 | |
9db1d521 | 10017 | ; |
ed9676cf | 10018 | ; sibcall patterns |
9db1d521 HP |
10019 | ; |
10020 | ||
ed9676cf | 10021 | (define_expand "sibcall" |
44b8152b | 10022 | [(call (match_operand 0 "" "") |
ed9676cf | 10023 | (match_operand 1 "" ""))] |
9db1d521 | 10024 | "" |
9db1d521 | 10025 | { |
ed9676cf AK |
10026 | s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, NULL_RTX); |
10027 | DONE; | |
10028 | }) | |
9db1d521 | 10029 | |
ed9676cf | 10030 | (define_insn "*sibcall_br" |
ae156f85 | 10031 | [(call (mem:QI (reg SIBCALL_REGNUM)) |
ed9676cf | 10032 | (match_operand 0 "const_int_operand" "n"))] |
2f7e5a0d | 10033 | "SIBLING_CALL_P (insn) |
ed9676cf | 10034 | && GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode" |
84b4c7b5 AK |
10035 | { |
10036 | if (TARGET_INDIRECT_BRANCH_NOBP_CALL) | |
10037 | { | |
10038 | gcc_assert (TARGET_CPU_Z10); | |
10039 | s390_indirect_branch_via_thunk (SIBCALL_REGNUM, | |
10040 | INVALID_REGNUM, | |
10041 | NULL_RTX, | |
10042 | s390_indirect_branch_type_call); | |
10043 | return ""; | |
10044 | } | |
10045 | else | |
10046 | return "br\t%%r1"; | |
10047 | } | |
10048 | [(set (attr "op_type") | |
10049 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_CALL") | |
10050 | (const_string "RIL") | |
10051 | (const_string "RR"))) | |
10052 | (set (attr "mnemonic") | |
10053 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_CALL") | |
10054 | (const_string "jg") | |
10055 | (const_string "br"))) | |
ed9676cf AK |
10056 | (set_attr "type" "branch") |
10057 | (set_attr "atype" "agen")]) | |
9db1d521 | 10058 | |
ed9676cf AK |
10059 | (define_insn "*sibcall_brc" |
10060 | [(call (mem:QI (match_operand 0 "bras_sym_operand" "X")) | |
10061 | (match_operand 1 "const_int_operand" "n"))] | |
10062 | "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC" | |
10063 | "j\t%0" | |
10064 | [(set_attr "op_type" "RI") | |
10065 | (set_attr "type" "branch")]) | |
9db1d521 | 10066 | |
ed9676cf AK |
10067 | (define_insn "*sibcall_brcl" |
10068 | [(call (mem:QI (match_operand 0 "bras_sym_operand" "X")) | |
10069 | (match_operand 1 "const_int_operand" "n"))] | |
8cc6307c | 10070 | "SIBLING_CALL_P (insn)" |
ed9676cf AK |
10071 | "jg\t%0" |
10072 | [(set_attr "op_type" "RIL") | |
10073 | (set_attr "type" "branch")]) | |
44b8152b | 10074 | |
ed9676cf AK |
10075 | ; |
10076 | ; sibcall_value patterns | |
10077 | ; | |
9e8327e3 | 10078 | |
ed9676cf AK |
10079 | (define_expand "sibcall_value" |
10080 | [(set (match_operand 0 "" "") | |
10081 | (call (match_operand 1 "" "") | |
10082 | (match_operand 2 "" "")))] | |
10083 | "" | |
10084 | { | |
10085 | s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], NULL_RTX); | |
44b8152b | 10086 | DONE; |
10bbf137 | 10087 | }) |
9db1d521 | 10088 | |
ed9676cf AK |
10089 | (define_insn "*sibcall_value_br" |
10090 | [(set (match_operand 0 "" "") | |
ae156f85 | 10091 | (call (mem:QI (reg SIBCALL_REGNUM)) |
ed9676cf | 10092 | (match_operand 1 "const_int_operand" "n")))] |
2f7e5a0d | 10093 | "SIBLING_CALL_P (insn) |
ed9676cf | 10094 | && GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode" |
84b4c7b5 AK |
10095 | { |
10096 | if (TARGET_INDIRECT_BRANCH_NOBP_CALL) | |
10097 | { | |
10098 | gcc_assert (TARGET_CPU_Z10); | |
10099 | s390_indirect_branch_via_thunk (SIBCALL_REGNUM, | |
10100 | INVALID_REGNUM, | |
10101 | NULL_RTX, | |
10102 | s390_indirect_branch_type_call); | |
10103 | return ""; | |
10104 | } | |
10105 | else | |
10106 | return "br\t%%r1"; | |
10107 | } | |
10108 | [(set (attr "op_type") | |
10109 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_CALL") | |
10110 | (const_string "RIL") | |
10111 | (const_string "RR"))) | |
10112 | (set (attr "mnemonic") | |
10113 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_CALL") | |
10114 | (const_string "jg") | |
10115 | (const_string "br"))) | |
ed9676cf AK |
10116 | (set_attr "type" "branch") |
10117 | (set_attr "atype" "agen")]) | |
10118 | ||
10119 | (define_insn "*sibcall_value_brc" | |
10120 | [(set (match_operand 0 "" "") | |
10121 | (call (mem:QI (match_operand 1 "bras_sym_operand" "X")) | |
10122 | (match_operand 2 "const_int_operand" "n")))] | |
10123 | "SIBLING_CALL_P (insn) && TARGET_SMALL_EXEC" | |
10124 | "j\t%1" | |
10125 | [(set_attr "op_type" "RI") | |
10126 | (set_attr "type" "branch")]) | |
10127 | ||
10128 | (define_insn "*sibcall_value_brcl" | |
10129 | [(set (match_operand 0 "" "") | |
10130 | (call (mem:QI (match_operand 1 "bras_sym_operand" "X")) | |
10131 | (match_operand 2 "const_int_operand" "n")))] | |
8cc6307c | 10132 | "SIBLING_CALL_P (insn)" |
ed9676cf AK |
10133 | "jg\t%1" |
10134 | [(set_attr "op_type" "RIL") | |
10135 | (set_attr "type" "branch")]) | |
10136 | ||
10137 | ||
10138 | ; | |
10139 | ; call instruction pattern(s). | |
10140 | ; | |
10141 | ||
10142 | (define_expand "call" | |
10143 | [(call (match_operand 0 "" "") | |
10144 | (match_operand 1 "" "")) | |
10145 | (use (match_operand 2 "" ""))] | |
44b8152b | 10146 | "" |
ed9676cf | 10147 | { |
2f7e5a0d | 10148 | s390_emit_call (XEXP (operands[0], 0), NULL_RTX, NULL_RTX, |
ed9676cf AK |
10149 | gen_rtx_REG (Pmode, RETURN_REGNUM)); |
10150 | DONE; | |
10151 | }) | |
44b8152b | 10152 | |
9e8327e3 UW |
10153 | (define_insn "*bras" |
10154 | [(call (mem:QI (match_operand 0 "bras_sym_operand" "X")) | |
10155 | (match_operand 1 "const_int_operand" "n")) | |
10156 | (clobber (match_operand 2 "register_operand" "=r"))] | |
2f7e5a0d EC |
10157 | "!SIBLING_CALL_P (insn) |
10158 | && TARGET_SMALL_EXEC | |
ed9676cf | 10159 | && GET_MODE (operands[2]) == Pmode" |
d40c829f | 10160 | "bras\t%2,%0" |
9db1d521 | 10161 | [(set_attr "op_type" "RI") |
65b1d8ea AK |
10162 | (set_attr "type" "jsr") |
10163 | (set_attr "z196prop" "z196_cracked")]) | |
9db1d521 | 10164 | |
9e8327e3 UW |
10165 | (define_insn "*brasl" |
10166 | [(call (mem:QI (match_operand 0 "bras_sym_operand" "X")) | |
10167 | (match_operand 1 "const_int_operand" "n")) | |
10168 | (clobber (match_operand 2 "register_operand" "=r"))] | |
2f7e5a0d | 10169 | "!SIBLING_CALL_P (insn) |
8cc6307c | 10170 | |
ed9676cf | 10171 | && GET_MODE (operands[2]) == Pmode" |
9e8327e3 UW |
10172 | "brasl\t%2,%0" |
10173 | [(set_attr "op_type" "RIL") | |
65b1d8ea | 10174 | (set_attr "type" "jsr") |
14cfceb7 IL |
10175 | (set_attr "z196prop" "z196_cracked") |
10176 | (set_attr "relative_long" "yes")]) | |
9db1d521 | 10177 | |
9e8327e3 | 10178 | (define_insn "*basr" |
3e4be43f | 10179 | [(call (mem:QI (match_operand 0 "address_operand" "ZR")) |
9e8327e3 UW |
10180 | (match_operand 1 "const_int_operand" "n")) |
10181 | (clobber (match_operand 2 "register_operand" "=r"))] | |
84b4c7b5 AK |
10182 | "!TARGET_INDIRECT_BRANCH_NOBP_CALL |
10183 | && !SIBLING_CALL_P (insn) | |
10184 | && GET_MODE (operands[2]) == Pmode" | |
9e8327e3 UW |
10185 | { |
10186 | if (get_attr_op_type (insn) == OP_TYPE_RR) | |
10187 | return "basr\t%2,%0"; | |
10188 | else | |
10189 | return "bas\t%2,%a0"; | |
10190 | } | |
10191 | [(set (attr "op_type") | |
10192 | (if_then_else (match_operand 0 "register_operand" "") | |
10193 | (const_string "RR") (const_string "RX"))) | |
84b4c7b5 AK |
10194 | (set (attr "mnemonic") |
10195 | (if_then_else (match_operand 0 "register_operand" "") | |
10196 | (const_string "basr") (const_string "bas"))) | |
10197 | (set_attr "type" "jsr") | |
10198 | (set_attr "atype" "agen") | |
10199 | (set_attr "z196prop" "z196_cracked")]) | |
10200 | ||
10201 | (define_insn "*basr_via_thunk<mode>_z10" | |
10202 | [(call (mem:QI (match_operand:P 0 "register_operand" "a")) | |
10203 | (match_operand 1 "const_int_operand" "n")) | |
10204 | (clobber (match_operand:P 2 "register_operand" "=&r"))] | |
10205 | "TARGET_INDIRECT_BRANCH_NOBP_CALL | |
10206 | && TARGET_CPU_Z10 | |
10207 | && !SIBLING_CALL_P (insn)" | |
10208 | { | |
10209 | s390_indirect_branch_via_thunk (REGNO (operands[0]), | |
10210 | REGNO (operands[2]), | |
10211 | NULL_RTX, | |
10212 | s390_indirect_branch_type_call); | |
10213 | return ""; | |
10214 | } | |
10215 | [(set_attr "op_type" "RIL") | |
10216 | (set_attr "mnemonic" "brasl") | |
10217 | (set_attr "type" "jsr") | |
10218 | (set_attr "atype" "agen") | |
10219 | (set_attr "z196prop" "z196_cracked")]) | |
10220 | ||
10221 | (define_insn "*basr_via_thunk<mode>" | |
10222 | [(call (mem:QI (match_operand:P 0 "register_operand" "a")) | |
10223 | (match_operand 1 "const_int_operand" "n")) | |
10224 | (clobber (match_operand:P 2 "register_operand" "=&r")) | |
10225 | (clobber (reg:P INDIRECT_BRANCH_THUNK_REGNUM))] | |
10226 | "TARGET_INDIRECT_BRANCH_NOBP_CALL | |
10227 | && !TARGET_CPU_Z10 | |
10228 | && !SIBLING_CALL_P (insn)" | |
10229 | { | |
10230 | s390_indirect_branch_via_thunk (REGNO (operands[0]), | |
10231 | REGNO (operands[2]), | |
10232 | NULL_RTX, | |
10233 | s390_indirect_branch_type_call); | |
10234 | return ""; | |
10235 | } | |
10236 | [(set_attr "op_type" "RIL") | |
10237 | (set_attr "mnemonic" "brasl") | |
9e8327e3 | 10238 | (set_attr "type" "jsr") |
65b1d8ea AK |
10239 | (set_attr "atype" "agen") |
10240 | (set_attr "z196prop" "z196_cracked")]) | |
9db1d521 HP |
10241 | |
10242 | ; | |
10243 | ; call_value instruction pattern(s). | |
10244 | ; | |
10245 | ||
10246 | (define_expand "call_value" | |
44b8152b UW |
10247 | [(set (match_operand 0 "" "") |
10248 | (call (match_operand 1 "" "") | |
10249 | (match_operand 2 "" ""))) | |
10250 | (use (match_operand 3 "" ""))] | |
9db1d521 | 10251 | "" |
9db1d521 | 10252 | { |
2f7e5a0d | 10253 | s390_emit_call (XEXP (operands[1], 0), NULL_RTX, operands[0], |
ed9676cf | 10254 | gen_rtx_REG (Pmode, RETURN_REGNUM)); |
44b8152b | 10255 | DONE; |
10bbf137 | 10256 | }) |
9db1d521 | 10257 | |
9e8327e3 | 10258 | (define_insn "*bras_r" |
c19ec8f9 | 10259 | [(set (match_operand 0 "" "") |
9e8327e3 | 10260 | (call (mem:QI (match_operand 1 "bras_sym_operand" "X")) |
9db1d521 | 10261 | (match_operand:SI 2 "const_int_operand" "n"))) |
9e8327e3 | 10262 | (clobber (match_operand 3 "register_operand" "=r"))] |
2f7e5a0d EC |
10263 | "!SIBLING_CALL_P (insn) |
10264 | && TARGET_SMALL_EXEC | |
ed9676cf | 10265 | && GET_MODE (operands[3]) == Pmode" |
d40c829f | 10266 | "bras\t%3,%1" |
9db1d521 | 10267 | [(set_attr "op_type" "RI") |
65b1d8ea AK |
10268 | (set_attr "type" "jsr") |
10269 | (set_attr "z196prop" "z196_cracked")]) | |
9db1d521 | 10270 | |
9e8327e3 | 10271 | (define_insn "*brasl_r" |
c19ec8f9 | 10272 | [(set (match_operand 0 "" "") |
9e8327e3 UW |
10273 | (call (mem:QI (match_operand 1 "bras_sym_operand" "X")) |
10274 | (match_operand 2 "const_int_operand" "n"))) | |
10275 | (clobber (match_operand 3 "register_operand" "=r"))] | |
2f7e5a0d | 10276 | "!SIBLING_CALL_P (insn) |
8cc6307c | 10277 | |
ed9676cf | 10278 | && GET_MODE (operands[3]) == Pmode" |
9e8327e3 UW |
10279 | "brasl\t%3,%1" |
10280 | [(set_attr "op_type" "RIL") | |
65b1d8ea | 10281 | (set_attr "type" "jsr") |
14cfceb7 IL |
10282 | (set_attr "z196prop" "z196_cracked") |
10283 | (set_attr "relative_long" "yes")]) | |
9db1d521 | 10284 | |
9e8327e3 | 10285 | (define_insn "*basr_r" |
c19ec8f9 | 10286 | [(set (match_operand 0 "" "") |
3e4be43f | 10287 | (call (mem:QI (match_operand 1 "address_operand" "ZR")) |
9e8327e3 UW |
10288 | (match_operand 2 "const_int_operand" "n"))) |
10289 | (clobber (match_operand 3 "register_operand" "=r"))] | |
84b4c7b5 AK |
10290 | "!TARGET_INDIRECT_BRANCH_NOBP_CALL |
10291 | && !SIBLING_CALL_P (insn) | |
10292 | && GET_MODE (operands[3]) == Pmode" | |
9e8327e3 UW |
10293 | { |
10294 | if (get_attr_op_type (insn) == OP_TYPE_RR) | |
10295 | return "basr\t%3,%1"; | |
10296 | else | |
10297 | return "bas\t%3,%a1"; | |
10298 | } | |
10299 | [(set (attr "op_type") | |
10300 | (if_then_else (match_operand 1 "register_operand" "") | |
10301 | (const_string "RR") (const_string "RX"))) | |
84b4c7b5 AK |
10302 | (set (attr "mnemonic") |
10303 | (if_then_else (match_operand 1 "register_operand" "") | |
10304 | (const_string "basr") (const_string "bas"))) | |
10305 | (set_attr "type" "jsr") | |
10306 | (set_attr "atype" "agen") | |
10307 | (set_attr "z196prop" "z196_cracked")]) | |
10308 | ||
10309 | (define_insn "*basr_r_via_thunk_z10" | |
10310 | [(set (match_operand 0 "" "") | |
10311 | (call (mem:QI (match_operand 1 "register_operand" "a")) | |
10312 | (match_operand 2 "const_int_operand" "n"))) | |
10313 | (clobber (match_operand 3 "register_operand" "=&r"))] | |
10314 | "TARGET_INDIRECT_BRANCH_NOBP_CALL | |
10315 | && TARGET_CPU_Z10 | |
10316 | && !SIBLING_CALL_P (insn) | |
10317 | && GET_MODE (operands[3]) == Pmode" | |
10318 | { | |
10319 | s390_indirect_branch_via_thunk (REGNO (operands[1]), | |
10320 | REGNO (operands[3]), | |
10321 | NULL_RTX, | |
10322 | s390_indirect_branch_type_call); | |
10323 | return ""; | |
10324 | } | |
10325 | [(set_attr "op_type" "RIL") | |
10326 | (set_attr "mnemonic" "brasl") | |
10327 | (set_attr "type" "jsr") | |
10328 | (set_attr "atype" "agen") | |
10329 | (set_attr "z196prop" "z196_cracked")]) | |
10330 | ||
10331 | (define_insn "*basr_r_via_thunk" | |
10332 | [(set (match_operand 0 "" "") | |
10333 | (call (mem:QI (match_operand 1 "register_operand" "a")) | |
10334 | (match_operand 2 "const_int_operand" "n"))) | |
10335 | (clobber (match_operand 3 "register_operand" "=&r")) | |
10336 | (clobber (reg:P INDIRECT_BRANCH_THUNK_REGNUM))] | |
10337 | "TARGET_INDIRECT_BRANCH_NOBP_CALL | |
10338 | && !TARGET_CPU_Z10 | |
10339 | && !SIBLING_CALL_P (insn) | |
10340 | && GET_MODE (operands[3]) == Pmode" | |
10341 | { | |
10342 | s390_indirect_branch_via_thunk (REGNO (operands[1]), | |
10343 | REGNO (operands[3]), | |
10344 | NULL_RTX, | |
10345 | s390_indirect_branch_type_call); | |
10346 | return ""; | |
10347 | } | |
10348 | [(set_attr "op_type" "RIL") | |
10349 | (set_attr "mnemonic" "brasl") | |
9e8327e3 | 10350 | (set_attr "type" "jsr") |
65b1d8ea AK |
10351 | (set_attr "atype" "agen") |
10352 | (set_attr "z196prop" "z196_cracked")]) | |
9db1d521 | 10353 | |
fd3cd001 UW |
10354 | ;; |
10355 | ;;- Thread-local storage support. | |
10356 | ;; | |
10357 | ||
f959607b CLT |
10358 | (define_expand "get_thread_pointer<mode>" |
10359 | [(set (match_operand:P 0 "nonimmediate_operand" "") (reg:P TP_REGNUM))] | |
10360 | "" | |
c5aa1d12 | 10361 | "") |
fd3cd001 | 10362 | |
f959607b CLT |
10363 | (define_expand "set_thread_pointer<mode>" |
10364 | [(set (reg:P TP_REGNUM) (match_operand:P 0 "nonimmediate_operand" "")) | |
10365 | (set (reg:P TP_REGNUM) (unspec_volatile:P [(reg:P TP_REGNUM)] UNSPECV_SET_TP))] | |
10366 | "" | |
c5aa1d12 UW |
10367 | "") |
10368 | ||
10369 | (define_insn "*set_tp" | |
ae156f85 | 10370 | [(set (reg TP_REGNUM) (unspec_volatile [(reg TP_REGNUM)] UNSPECV_SET_TP))] |
c5aa1d12 UW |
10371 | "" |
10372 | "" | |
10373 | [(set_attr "type" "none") | |
10374 | (set_attr "length" "0")]) | |
c7453384 | 10375 | |
fd3cd001 UW |
10376 | (define_insn "*tls_load_64" |
10377 | [(set (match_operand:DI 0 "register_operand" "=d") | |
3e4be43f | 10378 | (unspec:DI [(match_operand:DI 1 "memory_operand" "T") |
fd3cd001 UW |
10379 | (match_operand:DI 2 "" "")] |
10380 | UNSPEC_TLS_LOAD))] | |
10381 | "TARGET_64BIT" | |
d40c829f | 10382 | "lg\t%0,%1%J2" |
9381e3f1 WG |
10383 | [(set_attr "op_type" "RXE") |
10384 | (set_attr "z10prop" "z10_fwd_A3")]) | |
fd3cd001 UW |
10385 | |
10386 | (define_insn "*tls_load_31" | |
d3632d41 UW |
10387 | [(set (match_operand:SI 0 "register_operand" "=d,d") |
10388 | (unspec:SI [(match_operand:SI 1 "memory_operand" "R,T") | |
fd3cd001 UW |
10389 | (match_operand:SI 2 "" "")] |
10390 | UNSPEC_TLS_LOAD))] | |
10391 | "!TARGET_64BIT" | |
d3632d41 | 10392 | "@ |
d40c829f UW |
10393 | l\t%0,%1%J2 |
10394 | ly\t%0,%1%J2" | |
9381e3f1 | 10395 | [(set_attr "op_type" "RX,RXY") |
cdc15d23 | 10396 | (set_attr "type" "load") |
3e4be43f | 10397 | (set_attr "cpu_facility" "*,longdisp") |
9381e3f1 | 10398 | (set_attr "z10prop" "z10_fwd_A3,z10_fwd_A3")]) |
fd3cd001 | 10399 | |
9e8327e3 | 10400 | (define_insn "*bras_tls" |
c19ec8f9 | 10401 | [(set (match_operand 0 "" "") |
9e8327e3 UW |
10402 | (call (mem:QI (match_operand 1 "bras_sym_operand" "X")) |
10403 | (match_operand 2 "const_int_operand" "n"))) | |
10404 | (clobber (match_operand 3 "register_operand" "=r")) | |
10405 | (use (match_operand 4 "" ""))] | |
2f7e5a0d EC |
10406 | "!SIBLING_CALL_P (insn) |
10407 | && TARGET_SMALL_EXEC | |
ed9676cf | 10408 | && GET_MODE (operands[3]) == Pmode" |
d40c829f | 10409 | "bras\t%3,%1%J4" |
fd3cd001 | 10410 | [(set_attr "op_type" "RI") |
65b1d8ea AK |
10411 | (set_attr "type" "jsr") |
10412 | (set_attr "z196prop" "z196_cracked")]) | |
fd3cd001 | 10413 | |
9e8327e3 | 10414 | (define_insn "*brasl_tls" |
c19ec8f9 | 10415 | [(set (match_operand 0 "" "") |
9e8327e3 UW |
10416 | (call (mem:QI (match_operand 1 "bras_sym_operand" "X")) |
10417 | (match_operand 2 "const_int_operand" "n"))) | |
10418 | (clobber (match_operand 3 "register_operand" "=r")) | |
10419 | (use (match_operand 4 "" ""))] | |
2f7e5a0d | 10420 | "!SIBLING_CALL_P (insn) |
8cc6307c | 10421 | |
ed9676cf | 10422 | && GET_MODE (operands[3]) == Pmode" |
9e8327e3 UW |
10423 | "brasl\t%3,%1%J4" |
10424 | [(set_attr "op_type" "RIL") | |
65b1d8ea | 10425 | (set_attr "type" "jsr") |
14cfceb7 IL |
10426 | (set_attr "z196prop" "z196_cracked") |
10427 | (set_attr "relative_long" "yes")]) | |
fd3cd001 | 10428 | |
9e8327e3 | 10429 | (define_insn "*basr_tls" |
c19ec8f9 | 10430 | [(set (match_operand 0 "" "") |
3e4be43f | 10431 | (call (mem:QI (match_operand 1 "address_operand" "ZR")) |
9e8327e3 UW |
10432 | (match_operand 2 "const_int_operand" "n"))) |
10433 | (clobber (match_operand 3 "register_operand" "=r")) | |
10434 | (use (match_operand 4 "" ""))] | |
ed9676cf | 10435 | "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode" |
9e8327e3 UW |
10436 | { |
10437 | if (get_attr_op_type (insn) == OP_TYPE_RR) | |
10438 | return "basr\t%3,%1%J4"; | |
10439 | else | |
10440 | return "bas\t%3,%a1%J4"; | |
10441 | } | |
10442 | [(set (attr "op_type") | |
10443 | (if_then_else (match_operand 1 "register_operand" "") | |
10444 | (const_string "RR") (const_string "RX"))) | |
10445 | (set_attr "type" "jsr") | |
65b1d8ea AK |
10446 | (set_attr "atype" "agen") |
10447 | (set_attr "z196prop" "z196_cracked")]) | |
fd3cd001 | 10448 | |
e0374221 AS |
10449 | ;; |
10450 | ;;- Atomic operations | |
10451 | ;; | |
10452 | ||
10453 | ; | |
78ce265b | 10454 | ; memory barrier patterns. |
e0374221 AS |
10455 | ; |
10456 | ||
78ce265b RH |
10457 | (define_expand "mem_thread_fence" |
10458 | [(match_operand:SI 0 "const_int_operand")] ;; model | |
10459 | "" | |
10460 | { | |
10461 | /* Unless this is a SEQ_CST fence, the s390 memory model is strong | |
10462 | enough not to require barriers of any kind. */ | |
46b35980 | 10463 | if (is_mm_seq_cst (memmodel_from_int (INTVAL (operands[0])))) |
78ce265b RH |
10464 | { |
10465 | rtx mem = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); | |
10466 | MEM_VOLATILE_P (mem) = 1; | |
10467 | emit_insn (gen_mem_thread_fence_1 (mem)); | |
10468 | } | |
10469 | DONE; | |
e0374221 AS |
10470 | }) |
10471 | ||
78ce265b RH |
10472 | ; Although bcr is superscalar on Z10, this variant will never |
10473 | ; become part of an execution group. | |
a9cc3f58 AK |
10474 | ; With z196 we can make use of the fast-BCR-serialization facility. |
10475 | ; This allows for a slightly faster sync which is sufficient for our | |
10476 | ; purposes. | |
78ce265b | 10477 | (define_insn "mem_thread_fence_1" |
e0374221 | 10478 | [(set (match_operand:BLK 0 "" "") |
1a8c13b3 | 10479 | (unspec:BLK [(match_dup 0)] UNSPEC_MB))] |
e0374221 | 10480 | "" |
a9cc3f58 AK |
10481 | { |
10482 | if (TARGET_Z196) | |
10483 | return "bcr\t14,0"; | |
10484 | else | |
10485 | return "bcr\t15,0"; | |
10486 | } | |
10487 | [(set_attr "op_type" "RR") | |
10488 | (set_attr "mnemonic" "bcr_flush") | |
10489 | (set_attr "z196prop" "z196_alone")]) | |
1a8c13b3 | 10490 | |
78ce265b RH |
10491 | ; |
10492 | ; atomic load/store operations | |
10493 | ; | |
10494 | ||
10495 | ; Atomic loads need not examine the memory model at all. | |
10496 | (define_expand "atomic_load<mode>" | |
10497 | [(match_operand:DINT 0 "register_operand") ;; output | |
10498 | (match_operand:DINT 1 "memory_operand") ;; memory | |
10499 | (match_operand:SI 2 "const_int_operand")] ;; model | |
10500 | "" | |
10501 | { | |
75cc21e2 AK |
10502 | if (MEM_ALIGN (operands[1]) < GET_MODE_BITSIZE (GET_MODE (operands[1]))) |
10503 | FAIL; | |
10504 | ||
78ce265b RH |
10505 | if (<MODE>mode == TImode) |
10506 | emit_insn (gen_atomic_loadti_1 (operands[0], operands[1])); | |
10507 | else if (<MODE>mode == DImode && !TARGET_ZARCH) | |
10508 | emit_insn (gen_atomic_loaddi_1 (operands[0], operands[1])); | |
10509 | else | |
10510 | emit_move_insn (operands[0], operands[1]); | |
10511 | DONE; | |
10512 | }) | |
10513 | ||
10514 | ; Different from movdi_31 in that we want no splitters. | |
10515 | (define_insn "atomic_loaddi_1" | |
10516 | [(set (match_operand:DI 0 "register_operand" "=d,d,!*f,!*f") | |
10517 | (unspec:DI [(match_operand:DI 1 "memory_operand" "Q,S,R,T")] | |
10518 | UNSPEC_MOVA))] | |
10519 | "!TARGET_ZARCH" | |
10520 | "@ | |
10521 | lm\t%0,%M0,%S1 | |
10522 | lmy\t%0,%M0,%S1 | |
10523 | ld\t%0,%1 | |
10524 | ldy\t%0,%1" | |
10525 | [(set_attr "op_type" "RS,RSY,RS,RSY") | |
3e4be43f | 10526 | (set_attr "cpu_facility" "*,longdisp,*,longdisp") |
78ce265b RH |
10527 | (set_attr "type" "lm,lm,floaddf,floaddf")]) |
10528 | ||
10529 | (define_insn "atomic_loadti_1" | |
10530 | [(set (match_operand:TI 0 "register_operand" "=r") | |
3e4be43f | 10531 | (unspec:TI [(match_operand:TI 1 "memory_operand" "T")] |
78ce265b RH |
10532 | UNSPEC_MOVA))] |
10533 | "TARGET_ZARCH" | |
10534 | "lpq\t%0,%1" | |
10535 | [(set_attr "op_type" "RXY") | |
10536 | (set_attr "type" "other")]) | |
10537 | ||
10538 | ; Atomic stores must(?) enforce sequential consistency. | |
10539 | (define_expand "atomic_store<mode>" | |
10540 | [(match_operand:DINT 0 "memory_operand") ;; memory | |
10541 | (match_operand:DINT 1 "register_operand") ;; input | |
10542 | (match_operand:SI 2 "const_int_operand")] ;; model | |
10543 | "" | |
10544 | { | |
46b35980 | 10545 | enum memmodel model = memmodel_from_int (INTVAL (operands[2])); |
78ce265b | 10546 | |
75cc21e2 AK |
10547 | if (MEM_ALIGN (operands[0]) < GET_MODE_BITSIZE (GET_MODE (operands[0]))) |
10548 | FAIL; | |
10549 | ||
78ce265b RH |
10550 | if (<MODE>mode == TImode) |
10551 | emit_insn (gen_atomic_storeti_1 (operands[0], operands[1])); | |
10552 | else if (<MODE>mode == DImode && !TARGET_ZARCH) | |
10553 | emit_insn (gen_atomic_storedi_1 (operands[0], operands[1])); | |
10554 | else | |
10555 | emit_move_insn (operands[0], operands[1]); | |
46b35980 | 10556 | if (is_mm_seq_cst (model)) |
78ce265b RH |
10557 | emit_insn (gen_mem_thread_fence (operands[2])); |
10558 | DONE; | |
10559 | }) | |
10560 | ||
10561 | ; Different from movdi_31 in that we want no splitters. | |
10562 | (define_insn "atomic_storedi_1" | |
10563 | [(set (match_operand:DI 0 "memory_operand" "=Q,S,R,T") | |
10564 | (unspec:DI [(match_operand:DI 1 "register_operand" "d,d,!*f,!*f")] | |
10565 | UNSPEC_MOVA))] | |
10566 | "!TARGET_ZARCH" | |
10567 | "@ | |
10568 | stm\t%1,%N1,%S0 | |
10569 | stmy\t%1,%N1,%S0 | |
10570 | std %1,%0 | |
10571 | stdy %1,%0" | |
10572 | [(set_attr "op_type" "RS,RSY,RS,RSY") | |
3e4be43f | 10573 | (set_attr "cpu_facility" "*,longdisp,*,longdisp") |
78ce265b RH |
10574 | (set_attr "type" "stm,stm,fstoredf,fstoredf")]) |
10575 | ||
10576 | (define_insn "atomic_storeti_1" | |
3e4be43f | 10577 | [(set (match_operand:TI 0 "memory_operand" "=T") |
78ce265b RH |
10578 | (unspec:TI [(match_operand:TI 1 "register_operand" "r")] |
10579 | UNSPEC_MOVA))] | |
10580 | "TARGET_ZARCH" | |
10581 | "stpq\t%1,%0" | |
10582 | [(set_attr "op_type" "RXY") | |
10583 | (set_attr "type" "other")]) | |
e0374221 AS |
10584 | |
10585 | ; | |
10586 | ; compare and swap patterns. | |
10587 | ; | |
10588 | ||
78ce265b RH |
10589 | (define_expand "atomic_compare_and_swap<mode>" |
10590 | [(match_operand:SI 0 "register_operand") ;; bool success output | |
03db9ab5 DV |
10591 | (match_operand:DINT 1 "nonimmediate_operand");; oldval output |
10592 | (match_operand:DINT 2 "s_operand") ;; memory | |
10593 | (match_operand:DINT 3 "general_operand") ;; expected intput | |
10594 | (match_operand:DINT 4 "general_operand") ;; newval intput | |
78ce265b RH |
10595 | (match_operand:SI 5 "const_int_operand") ;; is_weak |
10596 | (match_operand:SI 6 "const_int_operand") ;; success model | |
10597 | (match_operand:SI 7 "const_int_operand")] ;; failure model | |
10598 | "" | |
10599 | { | |
03db9ab5 DV |
10600 | if (GET_MODE_BITSIZE (<MODE>mode) >= 16 |
10601 | && GET_MODE_BITSIZE (<MODE>mode) > MEM_ALIGN (operands[2])) | |
75cc21e2 AK |
10602 | FAIL; |
10603 | ||
03db9ab5 DV |
10604 | s390_expand_cs (<MODE>mode, operands[0], operands[1], operands[2], |
10605 | operands[3], operands[4], INTVAL (operands[5])); | |
10606 | DONE;}) | |
3093f076 | 10607 | |
78ce265b RH |
10608 | (define_expand "atomic_compare_and_swap<mode>_internal" |
10609 | [(parallel | |
10610 | [(set (match_operand:DGPR 0 "register_operand") | |
03db9ab5 | 10611 | (match_operand:DGPR 1 "s_operand")) |
78ce265b RH |
10612 | (set (match_dup 1) |
10613 | (unspec_volatile:DGPR | |
10614 | [(match_dup 1) | |
10615 | (match_operand:DGPR 2 "register_operand") | |
10616 | (match_operand:DGPR 3 "register_operand")] | |
10617 | UNSPECV_CAS)) | |
03db9ab5 DV |
10618 | (set (match_operand 4 "cc_reg_operand") |
10619 | (match_dup 5))])] | |
10620 | "GET_MODE (operands[4]) == CCZmode | |
10621 | || GET_MODE (operands[4]) == CCZ1mode" | |
10622 | { | |
10623 | operands[5] | |
10624 | = gen_rtx_COMPARE (GET_MODE (operands[4]), operands[1], operands[2]); | |
10625 | }) | |
78ce265b RH |
10626 | |
10627 | ; cdsg, csg | |
10628 | (define_insn "*atomic_compare_and_swap<mode>_1" | |
10629 | [(set (match_operand:TDI 0 "register_operand" "=r") | |
bdb57bcb | 10630 | (match_operand:TDI 1 "nonsym_memory_operand" "+S")) |
8006eaa6 | 10631 | (set (match_dup 1) |
78ce265b | 10632 | (unspec_volatile:TDI |
8006eaa6 | 10633 | [(match_dup 1) |
78ce265b RH |
10634 | (match_operand:TDI 2 "register_operand" "0") |
10635 | (match_operand:TDI 3 "register_operand" "r")] | |
8006eaa6 | 10636 | UNSPECV_CAS)) |
03db9ab5 DV |
10637 | (set (reg CC_REGNUM) |
10638 | (compare (match_dup 1) (match_dup 2)))] | |
10639 | "TARGET_ZARCH | |
10640 | && s390_match_ccmode (insn, CCZ1mode)" | |
78ce265b RH |
10641 | "c<td>sg\t%0,%3,%S1" |
10642 | [(set_attr "op_type" "RSY") | |
8006eaa6 AS |
10643 | (set_attr "type" "sem")]) |
10644 | ||
78ce265b RH |
10645 | ; cds, cdsy |
10646 | (define_insn "*atomic_compare_and_swapdi_2" | |
10647 | [(set (match_operand:DI 0 "register_operand" "=r,r") | |
bdb57bcb | 10648 | (match_operand:DI 1 "nonsym_memory_operand" "+Q,S")) |
e0374221 | 10649 | (set (match_dup 1) |
78ce265b RH |
10650 | (unspec_volatile:DI |
10651 | [(match_dup 1) | |
10652 | (match_operand:DI 2 "register_operand" "0,0") | |
10653 | (match_operand:DI 3 "register_operand" "r,r")] | |
10654 | UNSPECV_CAS)) | |
03db9ab5 DV |
10655 | (set (reg CC_REGNUM) |
10656 | (compare (match_dup 1) (match_dup 2)))] | |
10657 | "!TARGET_ZARCH | |
10658 | && s390_match_ccmode (insn, CCZ1mode)" | |
78ce265b RH |
10659 | "@ |
10660 | cds\t%0,%3,%S1 | |
10661 | cdsy\t%0,%3,%S1" | |
10662 | [(set_attr "op_type" "RS,RSY") | |
3e4be43f | 10663 | (set_attr "cpu_facility" "*,longdisp") |
78ce265b RH |
10664 | (set_attr "type" "sem")]) |
10665 | ||
10666 | ; cs, csy | |
10667 | (define_insn "*atomic_compare_and_swapsi_3" | |
10668 | [(set (match_operand:SI 0 "register_operand" "=r,r") | |
bdb57bcb | 10669 | (match_operand:SI 1 "nonsym_memory_operand" "+Q,S")) |
78ce265b RH |
10670 | (set (match_dup 1) |
10671 | (unspec_volatile:SI | |
e0374221 | 10672 | [(match_dup 1) |
78ce265b RH |
10673 | (match_operand:SI 2 "register_operand" "0,0") |
10674 | (match_operand:SI 3 "register_operand" "r,r")] | |
e0374221 | 10675 | UNSPECV_CAS)) |
03db9ab5 DV |
10676 | (set (reg CC_REGNUM) |
10677 | (compare (match_dup 1) (match_dup 2)))] | |
10678 | "s390_match_ccmode (insn, CCZ1mode)" | |
78ce265b RH |
10679 | "@ |
10680 | cs\t%0,%3,%S1 | |
10681 | csy\t%0,%3,%S1" | |
10682 | [(set_attr "op_type" "RS,RSY") | |
3e4be43f | 10683 | (set_attr "cpu_facility" "*,longdisp") |
e0374221 AS |
10684 | (set_attr "type" "sem")]) |
10685 | ||
45d18331 AS |
10686 | ; |
10687 | ; Other atomic instruction patterns. | |
10688 | ; | |
10689 | ||
65b1d8ea AK |
10690 | ; z196 load and add, xor, or and and instructions |
10691 | ||
78ce265b RH |
10692 | (define_expand "atomic_fetch_<atomic><mode>" |
10693 | [(match_operand:GPR 0 "register_operand") ;; val out | |
10694 | (ATOMIC_Z196:GPR | |
10695 | (match_operand:GPR 1 "memory_operand") ;; memory | |
10696 | (match_operand:GPR 2 "register_operand")) ;; val in | |
10697 | (match_operand:SI 3 "const_int_operand")] ;; model | |
65b1d8ea | 10698 | "TARGET_Z196" |
78ce265b | 10699 | { |
75cc21e2 AK |
10700 | if (MEM_ALIGN (operands[1]) < GET_MODE_BITSIZE (GET_MODE (operands[1]))) |
10701 | FAIL; | |
10702 | ||
78ce265b RH |
10703 | emit_insn (gen_atomic_fetch_<atomic><mode>_iaf |
10704 | (operands[0], operands[1], operands[2])); | |
10705 | DONE; | |
10706 | }) | |
65b1d8ea AK |
10707 | |
10708 | ; lan, lang, lao, laog, lax, laxg, laa, laag | |
78ce265b RH |
10709 | (define_insn "atomic_fetch_<atomic><mode>_iaf" |
10710 | [(set (match_operand:GPR 0 "register_operand" "=d") | |
3e4be43f | 10711 | (match_operand:GPR 1 "memory_operand" "+S")) |
78ce265b RH |
10712 | (set (match_dup 1) |
10713 | (unspec_volatile:GPR | |
10714 | [(ATOMIC_Z196:GPR (match_dup 1) | |
10715 | (match_operand:GPR 2 "general_operand" "d"))] | |
10716 | UNSPECV_ATOMIC_OP)) | |
10717 | (clobber (reg:CC CC_REGNUM))] | |
65b1d8ea | 10718 | "TARGET_Z196" |
78ce265b RH |
10719 | "la<noxa><g>\t%0,%2,%1" |
10720 | [(set_attr "op_type" "RSY") | |
10721 | (set_attr "type" "sem")]) | |
65b1d8ea | 10722 | |
78ce265b RH |
10723 | ;; For SImode and larger, the optabs.c code will do just fine in |
10724 | ;; expanding a compare-and-swap loop. For QI/HImode, we can do | |
10725 | ;; better by expanding our own loop. | |
65b1d8ea | 10726 | |
78ce265b RH |
10727 | (define_expand "atomic_<atomic><mode>" |
10728 | [(ATOMIC:HQI | |
10729 | (match_operand:HQI 0 "memory_operand") ;; memory | |
10730 | (match_operand:HQI 1 "general_operand")) ;; val in | |
10731 | (match_operand:SI 2 "const_int_operand")] ;; model | |
45d18331 | 10732 | "" |
78ce265b RH |
10733 | { |
10734 | s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0], | |
10735 | operands[1], false); | |
10736 | DONE; | |
10737 | }) | |
45d18331 | 10738 | |
78ce265b RH |
10739 | (define_expand "atomic_fetch_<atomic><mode>" |
10740 | [(match_operand:HQI 0 "register_operand") ;; val out | |
10741 | (ATOMIC:HQI | |
10742 | (match_operand:HQI 1 "memory_operand") ;; memory | |
10743 | (match_operand:HQI 2 "general_operand")) ;; val in | |
10744 | (match_operand:SI 3 "const_int_operand")] ;; model | |
45d18331 | 10745 | "" |
78ce265b RH |
10746 | { |
10747 | s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1], | |
10748 | operands[2], false); | |
10749 | DONE; | |
10750 | }) | |
10751 | ||
10752 | (define_expand "atomic_<atomic>_fetch<mode>" | |
10753 | [(match_operand:HQI 0 "register_operand") ;; val out | |
10754 | (ATOMIC:HQI | |
10755 | (match_operand:HQI 1 "memory_operand") ;; memory | |
10756 | (match_operand:HQI 2 "general_operand")) ;; val in | |
10757 | (match_operand:SI 3 "const_int_operand")] ;; model | |
10758 | "" | |
10759 | { | |
10760 | s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1], | |
10761 | operands[2], true); | |
10762 | DONE; | |
10763 | }) | |
10764 | ||
03db9ab5 DV |
10765 | ;; Pattern to implement atomic_exchange with a compare-and-swap loop. The code |
10766 | ;; generated by the middleend is not good. | |
78ce265b | 10767 | (define_expand "atomic_exchange<mode>" |
03db9ab5 DV |
10768 | [(match_operand:DINT 0 "register_operand") ;; val out |
10769 | (match_operand:DINT 1 "s_operand") ;; memory | |
10770 | (match_operand:DINT 2 "general_operand") ;; val in | |
78ce265b | 10771 | (match_operand:SI 3 "const_int_operand")] ;; model |
45d18331 | 10772 | "" |
78ce265b | 10773 | { |
03db9ab5 DV |
10774 | if (<MODE>mode != QImode |
10775 | && MEM_ALIGN (operands[1]) < GET_MODE_BITSIZE (<MODE>mode)) | |
10776 | FAIL; | |
10777 | if (<MODE>mode == HImode || <MODE>mode == QImode) | |
10778 | s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1], operands[2], | |
10779 | false); | |
10780 | else if (<MODE>mode == SImode || TARGET_ZARCH) | |
10781 | s390_expand_atomic_exchange_tdsi (operands[0], operands[1], operands[2]); | |
10782 | else | |
10783 | FAIL; | |
78ce265b RH |
10784 | DONE; |
10785 | }) | |
45d18331 | 10786 | |
9db1d521 HP |
10787 | ;; |
10788 | ;;- Miscellaneous instructions. | |
10789 | ;; | |
10790 | ||
10791 | ; | |
10792 | ; allocate stack instruction pattern(s). | |
10793 | ; | |
10794 | ||
10795 | (define_expand "allocate_stack" | |
ef44a6ff UW |
10796 | [(match_operand 0 "general_operand" "") |
10797 | (match_operand 1 "general_operand" "")] | |
b3d31392 | 10798 | "TARGET_BACKCHAIN" |
9db1d521 | 10799 | { |
ef44a6ff | 10800 | rtx temp = gen_reg_rtx (Pmode); |
9db1d521 | 10801 | |
ef44a6ff UW |
10802 | emit_move_insn (temp, s390_back_chain_rtx ()); |
10803 | anti_adjust_stack (operands[1]); | |
10804 | emit_move_insn (s390_back_chain_rtx (), temp); | |
9db1d521 | 10805 | |
ef44a6ff UW |
10806 | emit_move_insn (operands[0], virtual_stack_dynamic_rtx); |
10807 | DONE; | |
10bbf137 | 10808 | }) |
9db1d521 HP |
10809 | |
10810 | ||
10811 | ; | |
43ab026f | 10812 | ; setjmp instruction pattern. |
9db1d521 HP |
10813 | ; |
10814 | ||
9db1d521 | 10815 | (define_expand "builtin_setjmp_receiver" |
fd7643fb | 10816 | [(match_operand 0 "" "")] |
f314b9b1 | 10817 | "flag_pic" |
9db1d521 | 10818 | { |
585539a1 | 10819 | emit_insn (s390_load_got ()); |
c41c1387 | 10820 | emit_use (pic_offset_table_rtx); |
9db1d521 | 10821 | DONE; |
fd7643fb | 10822 | }) |
9db1d521 | 10823 | |
9db1d521 HP |
10824 | ;; These patterns say how to save and restore the stack pointer. We need not |
10825 | ;; save the stack pointer at function level since we are careful to | |
10826 | ;; preserve the backchain. At block level, we have to restore the backchain | |
10827 | ;; when we restore the stack pointer. | |
10828 | ;; | |
10829 | ;; For nonlocal gotos, we must save both the stack pointer and its | |
10830 | ;; backchain and restore both. Note that in the nonlocal case, the | |
10831 | ;; save area is a memory location. | |
10832 | ||
10833 | (define_expand "save_stack_function" | |
10834 | [(match_operand 0 "general_operand" "") | |
10835 | (match_operand 1 "general_operand" "")] | |
10836 | "" | |
10837 | "DONE;") | |
10838 | ||
10839 | (define_expand "restore_stack_function" | |
10840 | [(match_operand 0 "general_operand" "") | |
10841 | (match_operand 1 "general_operand" "")] | |
10842 | "" | |
10843 | "DONE;") | |
10844 | ||
10845 | (define_expand "restore_stack_block" | |
ef44a6ff UW |
10846 | [(match_operand 0 "register_operand" "") |
10847 | (match_operand 1 "register_operand" "")] | |
b3d31392 | 10848 | "TARGET_BACKCHAIN" |
9db1d521 | 10849 | { |
ef44a6ff UW |
10850 | rtx temp = gen_reg_rtx (Pmode); |
10851 | ||
10852 | emit_move_insn (temp, s390_back_chain_rtx ()); | |
10853 | emit_move_insn (operands[0], operands[1]); | |
10854 | emit_move_insn (s390_back_chain_rtx (), temp); | |
10855 | ||
10856 | DONE; | |
10bbf137 | 10857 | }) |
9db1d521 HP |
10858 | |
10859 | (define_expand "save_stack_nonlocal" | |
10860 | [(match_operand 0 "memory_operand" "") | |
10861 | (match_operand 1 "register_operand" "")] | |
10862 | "" | |
9db1d521 | 10863 | { |
ef44a6ff UW |
10864 | rtx base = gen_rtx_REG (Pmode, BASE_REGNUM); |
10865 | ||
10866 | /* Copy the backchain to the first word, sp to the second and the | |
10867 | literal pool base to the third. */ | |
10868 | ||
9602b6a1 AK |
10869 | rtx save_bc = adjust_address (operands[0], Pmode, 0); |
10870 | rtx save_sp = adjust_address (operands[0], Pmode, GET_MODE_SIZE (Pmode)); | |
10871 | rtx save_bp = adjust_address (operands[0], Pmode, 2 * GET_MODE_SIZE (Pmode)); | |
10872 | ||
b3d31392 | 10873 | if (TARGET_BACKCHAIN) |
9602b6a1 | 10874 | emit_move_insn (save_bc, force_reg (Pmode, s390_back_chain_rtx ())); |
ef44a6ff | 10875 | |
9602b6a1 AK |
10876 | emit_move_insn (save_sp, operands[1]); |
10877 | emit_move_insn (save_bp, base); | |
9db1d521 | 10878 | |
9db1d521 | 10879 | DONE; |
10bbf137 | 10880 | }) |
9db1d521 HP |
10881 | |
10882 | (define_expand "restore_stack_nonlocal" | |
10883 | [(match_operand 0 "register_operand" "") | |
10884 | (match_operand 1 "memory_operand" "")] | |
10885 | "" | |
9db1d521 | 10886 | { |
490ceeb4 | 10887 | rtx base = gen_rtx_REG (Pmode, BASE_REGNUM); |
ef44a6ff | 10888 | rtx temp = NULL_RTX; |
9db1d521 | 10889 | |
43ab026f | 10890 | /* Restore the backchain from the first word, sp from the second and the |
ff482c8d | 10891 | literal pool base from the third. */ |
43ab026f | 10892 | |
9602b6a1 AK |
10893 | rtx save_bc = adjust_address (operands[1], Pmode, 0); |
10894 | rtx save_sp = adjust_address (operands[1], Pmode, GET_MODE_SIZE (Pmode)); | |
10895 | rtx save_bp = adjust_address (operands[1], Pmode, 2 * GET_MODE_SIZE (Pmode)); | |
10896 | ||
b3d31392 | 10897 | if (TARGET_BACKCHAIN) |
9602b6a1 | 10898 | temp = force_reg (Pmode, save_bc); |
9381e3f1 | 10899 | |
9602b6a1 AK |
10900 | emit_move_insn (base, save_bp); |
10901 | emit_move_insn (operands[0], save_sp); | |
ef44a6ff UW |
10902 | |
10903 | if (temp) | |
10904 | emit_move_insn (s390_back_chain_rtx (), temp); | |
10905 | ||
c41c1387 | 10906 | emit_use (base); |
9db1d521 | 10907 | DONE; |
10bbf137 | 10908 | }) |
9db1d521 | 10909 | |
7bcebb25 AK |
10910 | (define_expand "exception_receiver" |
10911 | [(const_int 0)] | |
10912 | "" | |
10913 | { | |
10914 | s390_set_has_landing_pad_p (true); | |
10915 | DONE; | |
10916 | }) | |
9db1d521 HP |
10917 | |
10918 | ; | |
10919 | ; nop instruction pattern(s). | |
10920 | ; | |
10921 | ||
10922 | (define_insn "nop" | |
10923 | [(const_int 0)] | |
10924 | "" | |
aad98a61 AK |
10925 | "nopr\t%%r0" |
10926 | [(set_attr "op_type" "RR")]) | |
10927 | ||
10928 | ; non-branch NOPs required for optimizing compare-and-branch patterns | |
10929 | ; on z10 | |
10930 | ||
10931 | (define_insn "nop_lr0" | |
10932 | [(unspec_volatile [(const_int 0)] UNSPECV_NOP_LR_0)] | |
10933 | "" | |
d40c829f | 10934 | "lr\t0,0" |
729e750f WG |
10935 | [(set_attr "op_type" "RR") |
10936 | (set_attr "z10prop" "z10_fr_E1")]) | |
9db1d521 | 10937 | |
aad98a61 AK |
10938 | (define_insn "nop_lr1" |
10939 | [(unspec_volatile [(const_int 0)] UNSPECV_NOP_LR_1)] | |
d277db6b WG |
10940 | "" |
10941 | "lr\t1,1" | |
10942 | [(set_attr "op_type" "RR")]) | |
10943 | ||
f8af0e30 DV |
10944 | ;;- Undeletable nops (used for hotpatching) |
10945 | ||
10946 | (define_insn "nop_2_byte" | |
10947 | [(unspec_volatile [(const_int 0)] UNSPECV_NOP_2_BYTE)] | |
10948 | "" | |
4bbc8970 | 10949 | "nopr\t%%r0" |
f8af0e30 DV |
10950 | [(set_attr "op_type" "RR")]) |
10951 | ||
10952 | (define_insn "nop_4_byte" | |
10953 | [(unspec_volatile [(const_int 0)] UNSPECV_NOP_4_BYTE)] | |
10954 | "" | |
10955 | "nop\t0" | |
10956 | [(set_attr "op_type" "RX")]) | |
10957 | ||
10958 | (define_insn "nop_6_byte" | |
10959 | [(unspec_volatile [(const_int 0)] UNSPECV_NOP_6_BYTE)] | |
8cc6307c | 10960 | "" |
f8af0e30 | 10961 | "brcl\t0, 0" |
14cfceb7 IL |
10962 | [(set_attr "op_type" "RIL") |
10963 | (set_attr "relative_long" "yes")]) | |
f8af0e30 | 10964 | |
9db1d521 HP |
10965 | |
10966 | ; | |
10967 | ; Special literal pool access instruction pattern(s). | |
10968 | ; | |
10969 | ||
416cf582 UW |
10970 | (define_insn "*pool_entry" |
10971 | [(unspec_volatile [(match_operand 0 "consttable_operand" "X")] | |
10972 | UNSPECV_POOL_ENTRY)] | |
9db1d521 | 10973 | "" |
9db1d521 | 10974 | { |
ef4bddc2 | 10975 | machine_mode mode = GET_MODE (PATTERN (insn)); |
416cf582 | 10976 | unsigned int align = GET_MODE_BITSIZE (mode); |
faeb9bb6 | 10977 | s390_output_pool_entry (operands[0], mode, align); |
fd7643fb UW |
10978 | return ""; |
10979 | } | |
b628bd8e | 10980 | [(set (attr "length") |
416cf582 | 10981 | (symbol_ref "GET_MODE_SIZE (GET_MODE (PATTERN (insn)))"))]) |
b2ccb744 | 10982 | |
9bb86f41 UW |
10983 | (define_insn "pool_align" |
10984 | [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] | |
10985 | UNSPECV_POOL_ALIGN)] | |
10986 | "" | |
10987 | ".align\t%0" | |
b628bd8e | 10988 | [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))]) |
b2ccb744 | 10989 | |
9bb86f41 UW |
10990 | (define_insn "pool_section_start" |
10991 | [(unspec_volatile [(const_int 1)] UNSPECV_POOL_SECTION)] | |
10992 | "" | |
b929b470 MK |
10993 | { |
10994 | switch_to_section (targetm.asm_out.function_rodata_section | |
10995 | (current_function_decl)); | |
10996 | return ""; | |
10997 | } | |
b628bd8e | 10998 | [(set_attr "length" "0")]) |
b2ccb744 | 10999 | |
9bb86f41 UW |
11000 | (define_insn "pool_section_end" |
11001 | [(unspec_volatile [(const_int 0)] UNSPECV_POOL_SECTION)] | |
11002 | "" | |
b929b470 MK |
11003 | { |
11004 | switch_to_section (current_function_section ()); | |
11005 | return ""; | |
11006 | } | |
b628bd8e | 11007 | [(set_attr "length" "0")]) |
b2ccb744 | 11008 | |
5af2f3d3 | 11009 | (define_insn "main_base_64" |
9e8327e3 UW |
11010 | [(set (match_operand 0 "register_operand" "=a") |
11011 | (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_MAIN_BASE))] | |
8cc6307c | 11012 | "GET_MODE (operands[0]) == Pmode" |
5af2f3d3 UW |
11013 | "larl\t%0,%1" |
11014 | [(set_attr "op_type" "RIL") | |
9381e3f1 | 11015 | (set_attr "type" "larl") |
14cfceb7 IL |
11016 | (set_attr "z10prop" "z10_fwd_A1") |
11017 | (set_attr "relative_long" "yes")]) | |
5af2f3d3 UW |
11018 | |
11019 | (define_insn "main_pool" | |
585539a1 UW |
11020 | [(set (match_operand 0 "register_operand" "=a") |
11021 | (unspec_volatile [(const_int 0)] UNSPECV_MAIN_POOL))] | |
11022 | "GET_MODE (operands[0]) == Pmode" | |
8d933e31 AS |
11023 | { |
11024 | gcc_unreachable (); | |
11025 | } | |
9381e3f1 | 11026 | [(set (attr "type") |
8cc6307c | 11027 | (const_string "larl"))]) |
b2ccb744 | 11028 | |
aee4e0db | 11029 | (define_insn "reload_base_64" |
9e8327e3 UW |
11030 | [(set (match_operand 0 "register_operand" "=a") |
11031 | (unspec [(label_ref (match_operand 1 "" ""))] UNSPEC_RELOAD_BASE))] | |
8cc6307c | 11032 | "GET_MODE (operands[0]) == Pmode" |
d40c829f | 11033 | "larl\t%0,%1" |
aee4e0db | 11034 | [(set_attr "op_type" "RIL") |
9381e3f1 | 11035 | (set_attr "type" "larl") |
729e750f | 11036 | (set_attr "z10prop" "z10_fwd_A1")]) |
aee4e0db | 11037 | |
aee4e0db | 11038 | (define_insn "pool" |
fd7643fb | 11039 | [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)] |
aee4e0db | 11040 | "" |
8d933e31 AS |
11041 | { |
11042 | gcc_unreachable (); | |
11043 | } | |
b628bd8e | 11044 | [(set (attr "length") (symbol_ref "INTVAL (operands[0])"))]) |
9db1d521 | 11045 | |
4023fb28 UW |
11046 | ;; |
11047 | ;; Insns related to generating the function prologue and epilogue. | |
11048 | ;; | |
11049 | ||
11050 | ||
11051 | (define_expand "prologue" | |
11052 | [(use (const_int 0))] | |
11053 | "" | |
10bbf137 | 11054 | "s390_emit_prologue (); DONE;") |
4023fb28 UW |
11055 | |
11056 | (define_expand "epilogue" | |
11057 | [(use (const_int 1))] | |
11058 | "" | |
ed9676cf AK |
11059 | "s390_emit_epilogue (false); DONE;") |
11060 | ||
11061 | (define_expand "sibcall_epilogue" | |
11062 | [(use (const_int 0))] | |
11063 | "" | |
11064 | "s390_emit_epilogue (true); DONE;") | |
4023fb28 | 11065 | |
177bc204 RS |
11066 | ;; A direct return instruction, without using an epilogue. |
11067 | (define_insn "<code>" | |
11068 | [(ANY_RETURN)] | |
11069 | "s390_can_use_<code>_insn ()" | |
84b4c7b5 AK |
11070 | { |
11071 | if (TARGET_INDIRECT_BRANCH_NOBP_RET) | |
11072 | { | |
11073 | /* The target is always r14 so there is no clobber | |
11074 | of r1 needed for pre z10 targets. */ | |
11075 | s390_indirect_branch_via_thunk (RETURN_REGNUM, | |
11076 | INVALID_REGNUM, | |
11077 | NULL_RTX, | |
11078 | s390_indirect_branch_type_return); | |
11079 | return ""; | |
11080 | } | |
11081 | else | |
11082 | return "br\t%%r14"; | |
11083 | } | |
11084 | [(set (attr "op_type") | |
11085 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET") | |
11086 | (const_string "RIL") | |
11087 | (const_string "RR"))) | |
11088 | (set (attr "mnemonic") | |
11089 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET") | |
11090 | (const_string "jg") | |
11091 | (const_string "br"))) | |
177bc204 RS |
11092 | (set_attr "type" "jsr") |
11093 | (set_attr "atype" "agen")]) | |
11094 | ||
84b4c7b5 AK |
11095 | |
11096 | (define_expand "return_use" | |
11097 | [(parallel | |
11098 | [(return) | |
11099 | (use (match_operand 0 "register_operand" "a"))])] | |
11100 | "" | |
11101 | { | |
11102 | if (!TARGET_CPU_Z10 | |
11103 | && TARGET_INDIRECT_BRANCH_NOBP_RET_OPTION) | |
11104 | { | |
11105 | if (TARGET_64BIT) | |
11106 | emit_jump_insn (gen_returndi_prez10 (operands[0])); | |
11107 | else | |
11108 | emit_jump_insn (gen_returnsi_prez10 (operands[0])); | |
11109 | DONE; | |
11110 | } | |
11111 | }) | |
11112 | ||
11113 | (define_insn "*return<mode>" | |
4023fb28 | 11114 | [(return) |
84b4c7b5 AK |
11115 | (use (match_operand:P 0 "register_operand" "a"))] |
11116 | "TARGET_CPU_Z10 || !TARGET_INDIRECT_BRANCH_NOBP_RET_OPTION" | |
11117 | { | |
11118 | if (TARGET_INDIRECT_BRANCH_NOBP_RET) | |
11119 | { | |
11120 | s390_indirect_branch_via_thunk (REGNO (operands[0]), | |
11121 | INVALID_REGNUM, | |
11122 | NULL_RTX, | |
11123 | s390_indirect_branch_type_return); | |
11124 | return ""; | |
11125 | } | |
11126 | else | |
11127 | return "br\t%0"; | |
11128 | } | |
11129 | [(set (attr "op_type") | |
11130 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET") | |
11131 | (const_string "RIL") | |
11132 | (const_string "RR"))) | |
11133 | (set (attr "mnemonic") | |
11134 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET") | |
11135 | (const_string "jg") | |
11136 | (const_string "br"))) | |
11137 | (set_attr "type" "jsr") | |
11138 | (set_attr "atype" "agen")]) | |
11139 | ||
11140 | (define_insn "return<mode>_prez10" | |
11141 | [(return) | |
11142 | (use (match_operand:P 0 "register_operand" "a")) | |
11143 | (clobber (reg:P INDIRECT_BRANCH_THUNK_REGNUM))] | |
11144 | "!TARGET_CPU_Z10 && TARGET_INDIRECT_BRANCH_NOBP_RET_OPTION" | |
11145 | { | |
11146 | if (TARGET_INDIRECT_BRANCH_NOBP_RET) | |
11147 | { | |
11148 | s390_indirect_branch_via_thunk (REGNO (operands[0]), | |
11149 | INVALID_REGNUM, | |
11150 | NULL_RTX, | |
11151 | s390_indirect_branch_type_return); | |
11152 | return ""; | |
11153 | } | |
11154 | else | |
11155 | return "br\t%0"; | |
11156 | } | |
11157 | [(set (attr "op_type") | |
11158 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET") | |
11159 | (const_string "RIL") | |
11160 | (const_string "RR"))) | |
11161 | (set (attr "mnemonic") | |
11162 | (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET") | |
11163 | (const_string "jg") | |
11164 | (const_string "br"))) | |
c7453384 | 11165 | (set_attr "type" "jsr") |
077dab3b | 11166 | (set_attr "atype" "agen")]) |
4023fb28 | 11167 | |
4023fb28 | 11168 | |
c7453384 | 11169 | ;; Instruction definition to extend a 31-bit pointer into a 64-bit |
839a4992 | 11170 | ;; pointer. This is used for compatibility. |
c7453384 EC |
11171 | |
11172 | (define_expand "ptr_extend" | |
11173 | [(set (match_operand:DI 0 "register_operand" "=r") | |
11174 | (match_operand:SI 1 "register_operand" "r"))] | |
9e8327e3 | 11175 | "TARGET_64BIT" |
c7453384 | 11176 | { |
c7453384 EC |
11177 | emit_insn (gen_anddi3 (operands[0], |
11178 | gen_lowpart (DImode, operands[1]), | |
11179 | GEN_INT (0x7fffffff))); | |
c7453384 | 11180 | DONE; |
10bbf137 | 11181 | }) |
4798630c D |
11182 | |
11183 | ;; Instruction definition to expand eh_return macro to support | |
11184 | ;; swapping in special linkage return addresses. | |
11185 | ||
11186 | (define_expand "eh_return" | |
11187 | [(use (match_operand 0 "register_operand" ""))] | |
11188 | "TARGET_TPF" | |
11189 | { | |
11190 | s390_emit_tpf_eh_return (operands[0]); | |
11191 | DONE; | |
11192 | }) | |
11193 | ||
7b8acc34 AK |
11194 | ; |
11195 | ; Stack Protector Patterns | |
11196 | ; | |
11197 | ||
11198 | (define_expand "stack_protect_set" | |
11199 | [(set (match_operand 0 "memory_operand" "") | |
11200 | (match_operand 1 "memory_operand" ""))] | |
11201 | "" | |
11202 | { | |
11203 | #ifdef TARGET_THREAD_SSP_OFFSET | |
11204 | operands[1] | |
11205 | = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (), | |
11206 | GEN_INT (TARGET_THREAD_SSP_OFFSET))); | |
11207 | #endif | |
11208 | if (TARGET_64BIT) | |
11209 | emit_insn (gen_stack_protect_setdi (operands[0], operands[1])); | |
11210 | else | |
11211 | emit_insn (gen_stack_protect_setsi (operands[0], operands[1])); | |
11212 | ||
11213 | DONE; | |
11214 | }) | |
11215 | ||
11216 | (define_insn "stack_protect_set<mode>" | |
11217 | [(set (match_operand:DSI 0 "memory_operand" "=Q") | |
11218 | (unspec:DSI [(match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_SET))] | |
11219 | "" | |
11220 | "mvc\t%O0(%G0,%R0),%S1" | |
11221 | [(set_attr "op_type" "SS")]) | |
11222 | ||
11223 | (define_expand "stack_protect_test" | |
11224 | [(set (reg:CC CC_REGNUM) | |
11225 | (compare (match_operand 0 "memory_operand" "") | |
11226 | (match_operand 1 "memory_operand" ""))) | |
11227 | (match_operand 2 "" "")] | |
11228 | "" | |
11229 | { | |
f90b7a5a | 11230 | rtx cc_reg, test; |
7b8acc34 AK |
11231 | #ifdef TARGET_THREAD_SSP_OFFSET |
11232 | operands[1] | |
11233 | = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, s390_get_thread_pointer (), | |
11234 | GEN_INT (TARGET_THREAD_SSP_OFFSET))); | |
11235 | #endif | |
7b8acc34 AK |
11236 | if (TARGET_64BIT) |
11237 | emit_insn (gen_stack_protect_testdi (operands[0], operands[1])); | |
11238 | else | |
11239 | emit_insn (gen_stack_protect_testsi (operands[0], operands[1])); | |
11240 | ||
f90b7a5a PB |
11241 | cc_reg = gen_rtx_REG (CCZmode, CC_REGNUM); |
11242 | test = gen_rtx_EQ (VOIDmode, cc_reg, const0_rtx); | |
11243 | emit_jump_insn (gen_cbranchcc4 (test, cc_reg, const0_rtx, operands[2])); | |
7b8acc34 AK |
11244 | DONE; |
11245 | }) | |
11246 | ||
11247 | (define_insn "stack_protect_test<mode>" | |
11248 | [(set (reg:CCZ CC_REGNUM) | |
11249 | (unspec:CCZ [(match_operand:DSI 0 "memory_operand" "Q") | |
11250 | (match_operand:DSI 1 "memory_operand" "Q")] UNSPEC_SP_TEST))] | |
11251 | "" | |
11252 | "clc\t%O0(%G0,%R0),%S1" | |
11253 | [(set_attr "op_type" "SS")]) | |
12959abe AK |
11254 | |
11255 | ; This is used in s390_emit_prologue in order to prevent insns | |
11256 | ; adjusting the stack pointer to be moved over insns writing stack | |
11257 | ; slots using a copy of the stack pointer in a different register. | |
11258 | (define_insn "stack_tie" | |
11259 | [(set (match_operand:BLK 0 "memory_operand" "+m") | |
11260 | (unspec:BLK [(match_dup 0)] UNSPEC_TIE))] | |
11261 | "" | |
11262 | "" | |
11263 | [(set_attr "length" "0")]) | |
963fc8d0 AK |
11264 | |
11265 | ||
82c6f58a AK |
11266 | (define_insn "stack_restore_from_fpr" |
11267 | [(set (reg:DI STACK_REGNUM) | |
11268 | (match_operand:DI 0 "register_operand" "f")) | |
11269 | (clobber (mem:BLK (scratch)))] | |
11270 | "TARGET_Z10" | |
11271 | "lgdr\t%%r15,%0" | |
11272 | [(set_attr "op_type" "RRE")]) | |
11273 | ||
963fc8d0 AK |
11274 | ; |
11275 | ; Data prefetch patterns | |
11276 | ; | |
11277 | ||
11278 | (define_insn "prefetch" | |
3e4be43f UW |
11279 | [(prefetch (match_operand 0 "address_operand" "ZT,X") |
11280 | (match_operand:SI 1 "const_int_operand" " n,n") | |
11281 | (match_operand:SI 2 "const_int_operand" " n,n"))] | |
22d72dbc | 11282 | "TARGET_Z10" |
963fc8d0 | 11283 | { |
4fe6dea8 AK |
11284 | switch (which_alternative) |
11285 | { | |
11286 | case 0: | |
4fe6dea8 | 11287 | return INTVAL (operands[1]) == 1 ? "pfd\t2,%a0" : "pfd\t1,%a0"; |
22d72dbc | 11288 | case 1: |
4fe6dea8 AK |
11289 | if (larl_operand (operands[0], Pmode)) |
11290 | return INTVAL (operands[1]) == 1 ? "pfdrl\t2,%a0" : "pfdrl\t1,%a0"; | |
a65593a4 | 11291 | /* fallthrough */ |
4fe6dea8 AK |
11292 | default: |
11293 | ||
11294 | /* This might be reached for symbolic operands with an odd | |
11295 | addend. We simply omit the prefetch for such rare cases. */ | |
11296 | ||
11297 | return ""; | |
11298 | } | |
9381e3f1 | 11299 | } |
22d72dbc AK |
11300 | [(set_attr "type" "load,larl") |
11301 | (set_attr "op_type" "RXY,RIL") | |
65b1d8ea | 11302 | (set_attr "z10prop" "z10_super") |
14cfceb7 IL |
11303 | (set_attr "z196prop" "z196_alone") |
11304 | (set_attr "relative_long" "yes")]) | |
07da44ab AK |
11305 | |
11306 | ||
11307 | ; | |
11308 | ; Byte swap instructions | |
11309 | ; | |
11310 | ||
511f5bb1 AK |
11311 | ; FIXME: There is also mvcin but we cannot use it since src and target |
11312 | ; may overlap. | |
50dc4eed | 11313 | ; lrvr, lrv, strv, lrvgr, lrvg, strvg |
07da44ab | 11314 | (define_insn "bswap<mode>2" |
3e4be43f UW |
11315 | [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d,T") |
11316 | (bswap:GPR (match_operand:GPR 1 "nonimmediate_operand" " d,T,d")))] | |
8cc6307c | 11317 | "" |
07da44ab AK |
11318 | "@ |
11319 | lrv<g>r\t%0,%1 | |
6f5a59d1 AK |
11320 | lrv<g>\t%0,%1 |
11321 | strv<g>\t%1,%0" | |
11322 | [(set_attr "type" "*,load,store") | |
11323 | (set_attr "op_type" "RRE,RXY,RXY") | |
07da44ab | 11324 | (set_attr "z10prop" "z10_super")]) |
65b1d8ea | 11325 | |
511f5bb1 | 11326 | (define_insn "bswaphi2" |
3e4be43f UW |
11327 | [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,T") |
11328 | (bswap:HI (match_operand:HI 1 "nonimmediate_operand" " d,T,d")))] | |
8cc6307c | 11329 | "" |
6f5a59d1 AK |
11330 | "@ |
11331 | # | |
11332 | lrvh\t%0,%1 | |
11333 | strvh\t%1,%0" | |
11334 | [(set_attr "type" "*,load,store") | |
11335 | (set_attr "op_type" "RRE,RXY,RXY") | |
511f5bb1 | 11336 | (set_attr "z10prop" "z10_super")]) |
65b1d8ea | 11337 | |
6f5a59d1 AK |
11338 | (define_split |
11339 | [(set (match_operand:HI 0 "register_operand" "") | |
11340 | (bswap:HI (match_operand:HI 1 "register_operand" "")))] | |
8cc6307c | 11341 | "" |
6f5a59d1 | 11342 | [(set (match_dup 2) (bswap:SI (match_dup 3))) |
9060e335 | 11343 | (set (match_dup 2) (lshiftrt:SI (match_dup 2) (const_int 16)))] |
6f5a59d1 | 11344 | { |
9060e335 | 11345 | operands[2] = simplify_gen_subreg (SImode, operands[0], HImode, 0); |
6f5a59d1 AK |
11346 | operands[3] = simplify_gen_subreg (SImode, operands[1], HImode, 0); |
11347 | }) | |
11348 | ||
11349 | ||
65b1d8ea AK |
11350 | ; |
11351 | ; Population count instruction | |
11352 | ; | |
11353 | ||
25cb5165 AK |
11354 | (define_insn "*popcountdi_arch13_cc" |
11355 | [(set (reg CC_REGNUM) | |
11356 | (compare (popcount:DI (match_operand:DI 1 "register_operand" "d")) | |
11357 | (const_int 0))) | |
11358 | (set (match_operand:DI 0 "register_operand" "=d") | |
11359 | (match_dup 1))] | |
11360 | "TARGET_ARCH13 && s390_match_ccmode (insn, CCTmode)" | |
11361 | "popcnt\t%0,%1,8" | |
11362 | [(set_attr "op_type" "RRF")]) | |
11363 | ||
11364 | (define_insn "*popcountdi_arch13_cconly" | |
11365 | [(set (reg CC_REGNUM) | |
11366 | (compare (popcount:DI (match_operand:DI 1 "register_operand" "d")) | |
11367 | (const_int 0))) | |
11368 | (clobber (match_scratch:DI 0 "=d"))] | |
11369 | "TARGET_ARCH13 && s390_match_ccmode(insn, CCTmode)" | |
11370 | "popcnt\t%0,%1,8" | |
11371 | [(set_attr "op_type" "RRF")]) | |
11372 | ||
11373 | (define_insn "*popcountdi_arch13" | |
11374 | [(set (match_operand:DI 0 "register_operand" "=d") | |
11375 | (popcount:DI (match_operand:DI 1 "register_operand" "d"))) | |
11376 | (clobber (reg:CC CC_REGNUM))] | |
11377 | "TARGET_ARCH13" | |
11378 | "popcnt\t%0,%1,8" | |
11379 | [(set_attr "op_type" "RRF")]) | |
11380 | ||
11381 | ; The pre-arch13 popcount instruction counts the bits of op1 in 8 byte | |
65b1d8ea | 11382 | ; portions and stores the result in the corresponding bytes in op0. |
25cb5165 | 11383 | (define_insn "*popcount<mode>_z196" |
65b1d8ea AK |
11384 | [(set (match_operand:INT 0 "register_operand" "=d") |
11385 | (unspec:INT [(match_operand:INT 1 "register_operand" "d")] UNSPEC_POPCNT)) | |
11386 | (clobber (reg:CC CC_REGNUM))] | |
11387 | "TARGET_Z196" | |
11388 | "popcnt\t%0,%1" | |
11389 | [(set_attr "op_type" "RRE")]) | |
11390 | ||
25cb5165 | 11391 | (define_expand "popcountdi2_z196" |
65b1d8ea AK |
11392 | [; popcnt op0, op1 |
11393 | (parallel [(set (match_operand:DI 0 "register_operand" "") | |
11394 | (unspec:DI [(match_operand:DI 1 "register_operand")] | |
11395 | UNSPEC_POPCNT)) | |
11396 | (clobber (reg:CC CC_REGNUM))]) | |
11397 | ; sllg op2, op0, 32 | |
11398 | (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 32))) | |
11399 | ; agr op0, op2 | |
11400 | (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2))) | |
11401 | (clobber (reg:CC CC_REGNUM))]) | |
11402 | ; sllg op2, op0, 16 | |
17465c6e | 11403 | (set (match_dup 2) |
65b1d8ea AK |
11404 | (ashift:DI (match_dup 0) (const_int 16))) |
11405 | ; agr op0, op2 | |
11406 | (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2))) | |
11407 | (clobber (reg:CC CC_REGNUM))]) | |
11408 | ; sllg op2, op0, 8 | |
11409 | (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 8))) | |
11410 | ; agr op0, op2 | |
11411 | (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2))) | |
11412 | (clobber (reg:CC CC_REGNUM))]) | |
11413 | ; srlg op0, op0, 56 | |
11414 | (set (match_dup 0) (lshiftrt:DI (match_dup 0) (const_int 56)))] | |
25cb5165 | 11415 | "TARGET_Z196" |
65b1d8ea AK |
11416 | "operands[2] = gen_reg_rtx (DImode);") |
11417 | ||
25cb5165 AK |
11418 | (define_expand "popcountdi2" |
11419 | [(parallel | |
11420 | [(set (match_operand:DI 0 "register_operand" "") | |
11421 | (popcount:DI (match_operand:DI 1 "register_operand"))) | |
11422 | (clobber (reg:CC CC_REGNUM))])] | |
11423 | "TARGET_Z196" | |
11424 | { | |
11425 | if (!TARGET_ARCH13) | |
11426 | { | |
11427 | emit_insn (gen_popcountdi2_z196 (operands[0], operands[1])); | |
11428 | DONE; | |
11429 | } | |
11430 | }) | |
11431 | ||
11432 | (define_expand "popcountsi2_z196" | |
65b1d8ea AK |
11433 | [; popcnt op0, op1 |
11434 | (parallel [(set (match_operand:SI 0 "register_operand" "") | |
11435 | (unspec:SI [(match_operand:SI 1 "register_operand")] | |
11436 | UNSPEC_POPCNT)) | |
11437 | (clobber (reg:CC CC_REGNUM))]) | |
11438 | ; sllk op2, op0, 16 | |
17465c6e | 11439 | (set (match_dup 2) |
65b1d8ea AK |
11440 | (ashift:SI (match_dup 0) (const_int 16))) |
11441 | ; ar op0, op2 | |
11442 | (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2))) | |
11443 | (clobber (reg:CC CC_REGNUM))]) | |
11444 | ; sllk op2, op0, 8 | |
11445 | (set (match_dup 2) (ashift:SI (match_dup 0) (const_int 8))) | |
11446 | ; ar op0, op2 | |
11447 | (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2))) | |
11448 | (clobber (reg:CC CC_REGNUM))]) | |
11449 | ; srl op0, op0, 24 | |
11450 | (set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 24)))] | |
11451 | "TARGET_Z196" | |
11452 | "operands[2] = gen_reg_rtx (SImode);") | |
11453 | ||
25cb5165 AK |
11454 | ; popcount always counts on the full 64 bit. With the z196 version |
11455 | ; counting bits per byte we just ignore the upper 4 bytes. With the | |
11456 | ; arch13 version we have to zero out the upper 32 bits first. | |
11457 | (define_expand "popcountsi2" | |
11458 | [(set (match_dup 2) | |
11459 | (zero_extend:DI (match_operand:SI 1 "register_operand"))) | |
11460 | (parallel [(set (match_dup 3) (popcount:DI (match_dup 2))) | |
11461 | (clobber (reg:CC CC_REGNUM))]) | |
11462 | (set (match_operand:SI 0 "register_operand") | |
11463 | (subreg:SI (match_dup 3) 4))] | |
11464 | "TARGET_Z196" | |
11465 | { | |
11466 | if (!TARGET_ARCH13) | |
11467 | { | |
11468 | emit_insn (gen_popcountsi2_z196 (operands[0], operands[1])); | |
11469 | DONE; | |
11470 | } | |
11471 | else | |
11472 | { | |
11473 | operands[2] = gen_reg_rtx (DImode); | |
11474 | operands[3] = gen_reg_rtx (DImode); | |
11475 | } | |
11476 | }) | |
11477 | ||
11478 | (define_expand "popcounthi2_z196" | |
65b1d8ea AK |
11479 | [; popcnt op0, op1 |
11480 | (parallel [(set (match_operand:HI 0 "register_operand" "") | |
11481 | (unspec:HI [(match_operand:HI 1 "register_operand")] | |
11482 | UNSPEC_POPCNT)) | |
11483 | (clobber (reg:CC CC_REGNUM))]) | |
11484 | ; sllk op2, op0, 8 | |
17465c6e | 11485 | (set (match_dup 2) |
65b1d8ea AK |
11486 | (ashift:SI (match_dup 0) (const_int 8))) |
11487 | ; ar op0, op2 | |
11488 | (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2))) | |
11489 | (clobber (reg:CC CC_REGNUM))]) | |
11490 | ; srl op0, op0, 8 | |
11491 | (set (match_dup 0) (lshiftrt:HI (match_dup 0) (const_int 8)))] | |
11492 | "TARGET_Z196" | |
11493 | "operands[2] = gen_reg_rtx (SImode);") | |
11494 | ||
25cb5165 AK |
11495 | (define_expand "popcounthi2" |
11496 | [(set (match_dup 2) | |
11497 | (zero_extend:DI (match_operand:HI 1 "register_operand"))) | |
11498 | (parallel [(set (match_dup 3) (popcount:DI (match_dup 2))) | |
11499 | (clobber (reg:CC CC_REGNUM))]) | |
11500 | (set (match_operand:HI 0 "register_operand") | |
11501 | (subreg:HI (match_dup 3) 6))] | |
11502 | "TARGET_Z196" | |
11503 | { | |
11504 | if (!TARGET_ARCH13) | |
11505 | { | |
11506 | emit_insn (gen_popcounthi2_z196 (operands[0], operands[1])); | |
11507 | DONE; | |
11508 | } | |
11509 | else | |
11510 | { | |
11511 | operands[2] = gen_reg_rtx (DImode); | |
11512 | operands[3] = gen_reg_rtx (DImode); | |
11513 | } | |
11514 | }) | |
11515 | ||
11516 | ; For popcount on a single byte the old z196 style popcount | |
11517 | ; instruction is ideal. Since it anyway does a byte-wise popcount we | |
11518 | ; just use it instead of zero extending the QImode input to DImode and | |
11519 | ; using the arch13 popcount variant. | |
65b1d8ea AK |
11520 | (define_expand "popcountqi2" |
11521 | [; popcnt op0, op1 | |
11522 | (parallel [(set (match_operand:QI 0 "register_operand" "") | |
11523 | (unspec:QI [(match_operand:QI 1 "register_operand")] | |
11524 | UNSPEC_POPCNT)) | |
11525 | (clobber (reg:CC CC_REGNUM))])] | |
11526 | "TARGET_Z196" | |
11527 | "") | |
11528 | ||
11529 | ;; | |
11530 | ;;- Copy sign instructions | |
11531 | ;; | |
11532 | ||
11533 | (define_insn "copysign<mode>3" | |
11534 | [(set (match_operand:FP 0 "register_operand" "=f") | |
11535 | (unspec:FP [(match_operand:FP 1 "register_operand" "<fT0>") | |
11536 | (match_operand:FP 2 "register_operand" "f")] | |
11537 | UNSPEC_COPYSIGN))] | |
11538 | "TARGET_Z196" | |
11539 | "cpsdr\t%0,%2,%1" | |
11540 | [(set_attr "op_type" "RRF") | |
11541 | (set_attr "type" "fsimp<mode>")]) | |
5a3fe9b6 AK |
11542 | |
11543 | ||
11544 | ;; | |
11545 | ;;- Transactional execution instructions | |
11546 | ;; | |
11547 | ||
11548 | ; This splitter helps combine to make use of CC directly when | |
11549 | ; comparing the integer result of a tbegin builtin with a constant. | |
11550 | ; The unspec is already removed by canonicalize_comparison. So this | |
11551 | ; splitters only job is to turn the PARALLEL into separate insns | |
11552 | ; again. Unfortunately this only works with the very first cc/int | |
11553 | ; compare since combine is not able to deal with data flow across | |
11554 | ; basic block boundaries. | |
11555 | ||
11556 | ; It needs to be an insn pattern as well since combine does not apply | |
11557 | ; the splitter directly. Combine would only use it if it actually | |
11558 | ; would reduce the number of instructions. | |
11559 | (define_insn_and_split "*ccraw_to_int" | |
11560 | [(set (pc) | |
11561 | (if_then_else | |
11562 | (match_operator 0 "s390_eqne_operator" | |
11563 | [(reg:CCRAW CC_REGNUM) | |
11564 | (match_operand 1 "const_int_operand" "")]) | |
11565 | (label_ref (match_operand 2 "" "")) | |
11566 | (pc))) | |
11567 | (set (match_operand:SI 3 "register_operand" "=d") | |
11568 | (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] | |
11569 | "" | |
11570 | "#" | |
11571 | "" | |
11572 | [(set (match_dup 3) | |
11573 | (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT)) | |
11574 | (set (pc) | |
11575 | (if_then_else (match_op_dup 0 [(reg:CCRAW CC_REGNUM) (match_dup 1)]) | |
11576 | (label_ref (match_dup 2)) | |
11577 | (pc)))] | |
11578 | "") | |
11579 | ||
11580 | ; Non-constrained transaction begin | |
11581 | ||
11582 | (define_expand "tbegin" | |
ee163e72 AK |
11583 | [(match_operand:SI 0 "register_operand" "") |
11584 | (match_operand:BLK 1 "memory_operand" "")] | |
5a3fe9b6 AK |
11585 | "TARGET_HTM" |
11586 | { | |
11587 | s390_expand_tbegin (operands[0], operands[1], NULL_RTX, true); | |
11588 | DONE; | |
11589 | }) | |
11590 | ||
11591 | (define_expand "tbegin_nofloat" | |
ee163e72 AK |
11592 | [(match_operand:SI 0 "register_operand" "") |
11593 | (match_operand:BLK 1 "memory_operand" "")] | |
5a3fe9b6 AK |
11594 | "TARGET_HTM" |
11595 | { | |
11596 | s390_expand_tbegin (operands[0], operands[1], NULL_RTX, false); | |
11597 | DONE; | |
11598 | }) | |
11599 | ||
11600 | (define_expand "tbegin_retry" | |
ee163e72 AK |
11601 | [(match_operand:SI 0 "register_operand" "") |
11602 | (match_operand:BLK 1 "memory_operand" "") | |
11603 | (match_operand:SI 2 "general_operand" "")] | |
5a3fe9b6 AK |
11604 | "TARGET_HTM" |
11605 | { | |
11606 | s390_expand_tbegin (operands[0], operands[1], operands[2], true); | |
11607 | DONE; | |
11608 | }) | |
11609 | ||
11610 | (define_expand "tbegin_retry_nofloat" | |
ee163e72 AK |
11611 | [(match_operand:SI 0 "register_operand" "") |
11612 | (match_operand:BLK 1 "memory_operand" "") | |
11613 | (match_operand:SI 2 "general_operand" "")] | |
5a3fe9b6 AK |
11614 | "TARGET_HTM" |
11615 | { | |
11616 | s390_expand_tbegin (operands[0], operands[1], operands[2], false); | |
11617 | DONE; | |
11618 | }) | |
11619 | ||
c914ac45 AK |
11620 | ; Clobber VRs since they don't get restored |
11621 | (define_insn "tbegin_1_z13" | |
11622 | [(set (reg:CCRAW CC_REGNUM) | |
11623 | (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")] | |
11624 | UNSPECV_TBEGIN)) | |
11625 | (set (match_operand:BLK 1 "memory_operand" "=Q") | |
11626 | (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB)) | |
11627 | (clobber (reg:TI 16)) (clobber (reg:TI 38)) | |
11628 | (clobber (reg:TI 17)) (clobber (reg:TI 39)) | |
11629 | (clobber (reg:TI 18)) (clobber (reg:TI 40)) | |
11630 | (clobber (reg:TI 19)) (clobber (reg:TI 41)) | |
11631 | (clobber (reg:TI 20)) (clobber (reg:TI 42)) | |
11632 | (clobber (reg:TI 21)) (clobber (reg:TI 43)) | |
11633 | (clobber (reg:TI 22)) (clobber (reg:TI 44)) | |
11634 | (clobber (reg:TI 23)) (clobber (reg:TI 45)) | |
11635 | (clobber (reg:TI 24)) (clobber (reg:TI 46)) | |
11636 | (clobber (reg:TI 25)) (clobber (reg:TI 47)) | |
11637 | (clobber (reg:TI 26)) (clobber (reg:TI 48)) | |
11638 | (clobber (reg:TI 27)) (clobber (reg:TI 49)) | |
11639 | (clobber (reg:TI 28)) (clobber (reg:TI 50)) | |
11640 | (clobber (reg:TI 29)) (clobber (reg:TI 51)) | |
11641 | (clobber (reg:TI 30)) (clobber (reg:TI 52)) | |
11642 | (clobber (reg:TI 31)) (clobber (reg:TI 53))] | |
11643 | ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is | |
11644 | ; not supposed to be used for immediates (see genpreds.c). | |
11645 | "TARGET_VX && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff" | |
11646 | "tbegin\t%1,%x0" | |
11647 | [(set_attr "op_type" "SIL")]) | |
11648 | ||
5a3fe9b6 AK |
11649 | (define_insn "tbegin_1" |
11650 | [(set (reg:CCRAW CC_REGNUM) | |
2561451d | 11651 | (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")] |
5a3fe9b6 | 11652 | UNSPECV_TBEGIN)) |
2561451d AK |
11653 | (set (match_operand:BLK 1 "memory_operand" "=Q") |
11654 | (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB)) | |
5a3fe9b6 AK |
11655 | (clobber (reg:DF 16)) |
11656 | (clobber (reg:DF 17)) | |
11657 | (clobber (reg:DF 18)) | |
11658 | (clobber (reg:DF 19)) | |
11659 | (clobber (reg:DF 20)) | |
11660 | (clobber (reg:DF 21)) | |
11661 | (clobber (reg:DF 22)) | |
11662 | (clobber (reg:DF 23)) | |
11663 | (clobber (reg:DF 24)) | |
11664 | (clobber (reg:DF 25)) | |
11665 | (clobber (reg:DF 26)) | |
11666 | (clobber (reg:DF 27)) | |
11667 | (clobber (reg:DF 28)) | |
11668 | (clobber (reg:DF 29)) | |
11669 | (clobber (reg:DF 30)) | |
11670 | (clobber (reg:DF 31))] | |
11671 | ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is | |
11672 | ; not supposed to be used for immediates (see genpreds.c). | |
2561451d AK |
11673 | "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff" |
11674 | "tbegin\t%1,%x0" | |
5a3fe9b6 AK |
11675 | [(set_attr "op_type" "SIL")]) |
11676 | ||
11677 | ; Same as above but without the FPR clobbers | |
11678 | (define_insn "tbegin_nofloat_1" | |
11679 | [(set (reg:CCRAW CC_REGNUM) | |
2561451d AK |
11680 | (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")] |
11681 | UNSPECV_TBEGIN)) | |
11682 | (set (match_operand:BLK 1 "memory_operand" "=Q") | |
11683 | (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))] | |
11684 | "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff" | |
11685 | "tbegin\t%1,%x0" | |
5a3fe9b6 AK |
11686 | [(set_attr "op_type" "SIL")]) |
11687 | ||
11688 | ||
11689 | ; Constrained transaction begin | |
11690 | ||
11691 | (define_expand "tbeginc" | |
11692 | [(set (reg:CCRAW CC_REGNUM) | |
11693 | (unspec_volatile:CCRAW [(const_int TBEGINC_MASK)] | |
11694 | UNSPECV_TBEGINC))] | |
11695 | "TARGET_HTM" | |
11696 | "") | |
11697 | ||
11698 | (define_insn "*tbeginc_1" | |
11699 | [(set (reg:CCRAW CC_REGNUM) | |
11700 | (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" " D")] | |
11701 | UNSPECV_TBEGINC))] | |
11702 | "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff" | |
11703 | "tbeginc\t0,%x0" | |
11704 | [(set_attr "op_type" "SIL")]) | |
11705 | ||
11706 | ; Transaction end | |
11707 | ||
11708 | (define_expand "tend" | |
11709 | [(set (reg:CCRAW CC_REGNUM) | |
11710 | (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND)) | |
ee163e72 | 11711 | (set (match_operand:SI 0 "register_operand" "") |
5a3fe9b6 AK |
11712 | (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
11713 | "TARGET_HTM" | |
11714 | "") | |
11715 | ||
11716 | (define_insn "*tend_1" | |
11717 | [(set (reg:CCRAW CC_REGNUM) | |
11718 | (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))] | |
11719 | "TARGET_HTM" | |
11720 | "tend" | |
11721 | [(set_attr "op_type" "S")]) | |
11722 | ||
11723 | ; Transaction abort | |
11724 | ||
11725 | (define_expand "tabort" | |
eae48192 | 11726 | [(unspec_volatile [(match_operand:SI 0 "nonmemory_operand" "")] |
5a3fe9b6 AK |
11727 | UNSPECV_TABORT)] |
11728 | "TARGET_HTM && operands != NULL" | |
11729 | { | |
11730 | if (CONST_INT_P (operands[0]) | |
11731 | && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 255) | |
11732 | { | |
63c79a75 JJ |
11733 | error ("invalid transaction abort code: %wd; values in range 0 " |
11734 | "through 255 are reserved", INTVAL (operands[0])); | |
5a3fe9b6 AK |
11735 | FAIL; |
11736 | } | |
11737 | }) | |
11738 | ||
11739 | (define_insn "*tabort_1" | |
eae48192 | 11740 | [(unspec_volatile [(match_operand:SI 0 "nonmemory_operand" "aJ")] |
5a3fe9b6 AK |
11741 | UNSPECV_TABORT)] |
11742 | "TARGET_HTM && operands != NULL" | |
11743 | "tabort\t%Y0" | |
11744 | [(set_attr "op_type" "S")]) | |
11745 | ||
eae48192 AK |
11746 | (define_insn "*tabort_1_plus" |
11747 | [(unspec_volatile [(plus:SI (match_operand:SI 0 "register_operand" "a") | |
11748 | (match_operand:SI 1 "const_int_operand" "J"))] | |
11749 | UNSPECV_TABORT)] | |
11750 | "TARGET_HTM && operands != NULL | |
11751 | && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[1]), 'J', \"J\")" | |
11752 | "tabort\t%1(%0)" | |
11753 | [(set_attr "op_type" "S")]) | |
11754 | ||
5a3fe9b6 AK |
11755 | ; Transaction extract nesting depth |
11756 | ||
11757 | (define_insn "etnd" | |
11758 | [(set (match_operand:SI 0 "register_operand" "=d") | |
11759 | (unspec_volatile:SI [(const_int 0)] UNSPECV_ETND))] | |
11760 | "TARGET_HTM" | |
11761 | "etnd\t%0" | |
11762 | [(set_attr "op_type" "RRE")]) | |
11763 | ||
11764 | ; Non-transactional store | |
11765 | ||
11766 | (define_insn "ntstg" | |
3e4be43f | 11767 | [(set (match_operand:DI 0 "memory_operand" "=T") |
5a3fe9b6 AK |
11768 | (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "d")] |
11769 | UNSPECV_NTSTG))] | |
11770 | "TARGET_HTM" | |
11771 | "ntstg\t%1,%0" | |
11772 | [(set_attr "op_type" "RXY")]) | |
11773 | ||
11774 | ; Transaction perform processor assist | |
11775 | ||
11776 | (define_expand "tx_assist" | |
2561451d AK |
11777 | [(unspec_volatile [(match_operand:SI 0 "register_operand" "") |
11778 | (reg:SI GPR0_REGNUM) | |
291a9e98 | 11779 | (const_int PPA_TX_ABORT)] |
5a3fe9b6 AK |
11780 | UNSPECV_PPA)] |
11781 | "TARGET_HTM" | |
2561451d | 11782 | "") |
5a3fe9b6 AK |
11783 | |
11784 | (define_insn "*ppa" | |
11785 | [(unspec_volatile [(match_operand:SI 0 "register_operand" "d") | |
11786 | (match_operand:SI 1 "register_operand" "d") | |
11787 | (match_operand 2 "const_int_operand" "I")] | |
11788 | UNSPECV_PPA)] | |
291a9e98 | 11789 | "(TARGET_ZEC12 || TARGET_HTM) && INTVAL (operands[2]) < 16" |
2561451d | 11790 | "ppa\t%0,%1,%2" |
5a3fe9b6 | 11791 | [(set_attr "op_type" "RRF")]) |
004f64e1 AK |
11792 | |
11793 | ||
11794 | ; Set and get floating point control register | |
11795 | ||
3af82a61 | 11796 | (define_insn "sfpc" |
004f64e1 AK |
11797 | [(unspec_volatile [(match_operand:SI 0 "register_operand" "d")] |
11798 | UNSPECV_SFPC)] | |
11799 | "TARGET_HARD_FLOAT" | |
11800 | "sfpc\t%0") | |
11801 | ||
3af82a61 | 11802 | (define_insn "efpc" |
004f64e1 AK |
11803 | [(set (match_operand:SI 0 "register_operand" "=d") |
11804 | (unspec_volatile:SI [(const_int 0)] UNSPECV_EFPC))] | |
11805 | "TARGET_HARD_FLOAT" | |
11806 | "efpc\t%0") | |
3af82a61 AK |
11807 | |
11808 | ||
11809 | ; Load count to block boundary | |
11810 | ||
11811 | (define_insn "lcbb" | |
11812 | [(set (match_operand:SI 0 "register_operand" "=d") | |
3e4be43f | 11813 | (unspec:SI [(match_operand 1 "address_operand" "ZR") |
3af82a61 AK |
11814 | (match_operand:SI 2 "immediate_operand" "C")] UNSPEC_LCBB)) |
11815 | (clobber (reg:CC CC_REGNUM))] | |
11816 | "TARGET_Z13" | |
9a36359e | 11817 | "lcbb\t%0,%a1,%b2" |
3af82a61 | 11818 | [(set_attr "op_type" "VRX")]) |
4cb4721f MK |
11819 | |
11820 | ; Handle -fsplit-stack. | |
11821 | ||
11822 | (define_expand "split_stack_prologue" | |
11823 | [(const_int 0)] | |
11824 | "" | |
11825 | { | |
11826 | s390_expand_split_stack_prologue (); | |
11827 | DONE; | |
11828 | }) | |
11829 | ||
11830 | ;; If there are operand 0 bytes available on the stack, jump to | |
11831 | ;; operand 1. | |
11832 | ||
11833 | (define_expand "split_stack_space_check" | |
11834 | [(set (pc) (if_then_else | |
11835 | (ltu (minus (reg 15) | |
11836 | (match_operand 0 "register_operand")) | |
11837 | (unspec [(const_int 0)] UNSPEC_STACK_CHECK)) | |
11838 | (label_ref (match_operand 1)) | |
11839 | (pc)))] | |
11840 | "" | |
11841 | { | |
11842 | /* Offset from thread pointer to __private_ss. */ | |
11843 | int psso = TARGET_64BIT ? 0x38 : 0x20; | |
11844 | rtx tp = s390_get_thread_pointer (); | |
11845 | rtx guard = gen_rtx_MEM (Pmode, plus_constant (Pmode, tp, psso)); | |
11846 | rtx reg = gen_reg_rtx (Pmode); | |
11847 | rtx cc; | |
11848 | if (TARGET_64BIT) | |
11849 | emit_insn (gen_subdi3 (reg, stack_pointer_rtx, operands[0])); | |
11850 | else | |
11851 | emit_insn (gen_subsi3 (reg, stack_pointer_rtx, operands[0])); | |
11852 | cc = s390_emit_compare (GT, reg, guard); | |
11853 | s390_emit_jump (operands[1], cc); | |
11854 | ||
11855 | DONE; | |
11856 | }) | |
11857 | ||
11858 | ;; __morestack parameter block for split stack prologue. Parameters are: | |
11859 | ;; parameter block label, label to be called by __morestack, frame size, | |
11860 | ;; stack parameter size. | |
11861 | ||
11862 | (define_insn "split_stack_data" | |
11863 | [(unspec_volatile [(match_operand 0 "" "X") | |
11864 | (match_operand 1 "" "X") | |
11865 | (match_operand 2 "const_int_operand" "X") | |
11866 | (match_operand 3 "const_int_operand" "X")] | |
11867 | UNSPECV_SPLIT_STACK_DATA)] | |
8cc6307c | 11868 | "" |
4cb4721f MK |
11869 | { |
11870 | switch_to_section (targetm.asm_out.function_rodata_section | |
11871 | (current_function_decl)); | |
11872 | ||
11873 | if (TARGET_64BIT) | |
11874 | output_asm_insn (".align\t8", operands); | |
11875 | else | |
11876 | output_asm_insn (".align\t4", operands); | |
11877 | (*targetm.asm_out.internal_label) (asm_out_file, "L", | |
11878 | CODE_LABEL_NUMBER (operands[0])); | |
11879 | if (TARGET_64BIT) | |
11880 | { | |
11881 | output_asm_insn (".quad\t%2", operands); | |
11882 | output_asm_insn (".quad\t%3", operands); | |
11883 | output_asm_insn (".quad\t%1-%0", operands); | |
11884 | } | |
11885 | else | |
11886 | { | |
11887 | output_asm_insn (".long\t%2", operands); | |
11888 | output_asm_insn (".long\t%3", operands); | |
11889 | output_asm_insn (".long\t%1-%0", operands); | |
11890 | } | |
11891 | ||
11892 | switch_to_section (current_function_section ()); | |
11893 | return ""; | |
11894 | } | |
11895 | [(set_attr "length" "0")]) | |
11896 | ||
11897 | ||
11898 | ;; A jg with minimal fuss for use in split stack prologue. | |
11899 | ||
11900 | (define_expand "split_stack_call" | |
11901 | [(match_operand 0 "bras_sym_operand" "X") | |
11902 | (match_operand 1 "" "")] | |
8cc6307c | 11903 | "" |
4cb4721f MK |
11904 | { |
11905 | if (TARGET_64BIT) | |
11906 | emit_jump_insn (gen_split_stack_call_di (operands[0], operands[1])); | |
11907 | else | |
11908 | emit_jump_insn (gen_split_stack_call_si (operands[0], operands[1])); | |
11909 | DONE; | |
11910 | }) | |
11911 | ||
11912 | (define_insn "split_stack_call_<mode>" | |
11913 | [(set (pc) (label_ref (match_operand 1 "" ""))) | |
11914 | (set (reg:P 1) (unspec_volatile [(match_operand 0 "bras_sym_operand" "X") | |
11915 | (reg:P 1)] | |
11916 | UNSPECV_SPLIT_STACK_CALL))] | |
8cc6307c | 11917 | "" |
4cb4721f MK |
11918 | "jg\t%0" |
11919 | [(set_attr "op_type" "RIL") | |
11920 | (set_attr "type" "branch")]) | |
11921 | ||
11922 | ;; Also a conditional one. | |
11923 | ||
11924 | (define_expand "split_stack_cond_call" | |
11925 | [(match_operand 0 "bras_sym_operand" "X") | |
11926 | (match_operand 1 "" "") | |
11927 | (match_operand 2 "" "")] | |
8cc6307c | 11928 | "" |
4cb4721f MK |
11929 | { |
11930 | if (TARGET_64BIT) | |
11931 | emit_jump_insn (gen_split_stack_cond_call_di (operands[0], operands[1], operands[2])); | |
11932 | else | |
11933 | emit_jump_insn (gen_split_stack_cond_call_si (operands[0], operands[1], operands[2])); | |
11934 | DONE; | |
11935 | }) | |
11936 | ||
11937 | (define_insn "split_stack_cond_call_<mode>" | |
11938 | [(set (pc) | |
11939 | (if_then_else | |
11940 | (match_operand 1 "" "") | |
11941 | (label_ref (match_operand 2 "" "")) | |
11942 | (pc))) | |
11943 | (set (reg:P 1) (unspec_volatile [(match_operand 0 "bras_sym_operand" "X") | |
11944 | (reg:P 1)] | |
11945 | UNSPECV_SPLIT_STACK_CALL))] | |
8cc6307c | 11946 | "" |
4cb4721f MK |
11947 | "jg%C1\t%0" |
11948 | [(set_attr "op_type" "RIL") | |
11949 | (set_attr "type" "branch")]) | |
539405d5 AK |
11950 | |
11951 | (define_insn "osc_break" | |
11952 | [(unspec_volatile [(const_int 0)] UNSPECV_OSC_BREAK)] | |
11953 | "" | |
11954 | "bcr\t7,%%r0" | |
11955 | [(set_attr "op_type" "RR")]) | |
291a9e98 AK |
11956 | |
11957 | (define_expand "speculation_barrier" | |
11958 | [(unspec_volatile [(reg:SI GPR0_REGNUM) | |
11959 | (reg:SI GPR0_REGNUM) | |
11960 | (const_int PPA_OOO_BARRIER)] | |
11961 | UNSPECV_PPA)] | |
11962 | "TARGET_ZEC12" | |
11963 | "") |