1 ;; -----------------------------------------------------------------
3 ;; -----------------------------------------------------------------
7 (define_insn_and_split "*insv_si_1_n"
8 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
10 (match_operand:SI 1 "const_int_operand" "n"))
11 (match_operand:SI 2 "register_operand" "r"))]
12 "INTVAL (operands[1]) < 16"
15 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 1) (match_dup 1))
17 (clobber (reg:CC CC_REG))])])
19 (define_insn "*insv_si_1_n_clobber_flags"
20 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
22 (match_operand:SI 1 "const_int_operand" "n"))
23 (match_operand:SI 2 "register_operand" "r"))
24 (clobber (reg:CC CC_REG))]
25 "INTVAL (operands[1]) < 16"
26 "bld\\t#0,%w2\;bst\\t%Z1,%Y0"
27 [(set_attr "length" "4")])
29 (define_insn_and_split "*insv_si_1_n_lshiftrt"
30 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
32 (match_operand:SI 1 "const_int_operand" "n"))
33 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
34 (match_operand:SI 3 "const_int_operand" "n")))]
35 "INTVAL (operands[1]) < 16 && INTVAL (operands[3]) < 16"
38 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 1) (match_dup 1))
39 (lshiftrt:SI (match_dup 2) (match_dup 3)))
40 (clobber (reg:CC CC_REG))])])
42 (define_insn "*insv_si_1_n_lshiftrt_clobber_flags"
43 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
45 (match_operand:SI 1 "const_int_operand" "n"))
46 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
47 (match_operand:SI 3 "const_int_operand" "n")))
48 (clobber (reg:CC CC_REG))]
49 "INTVAL (operands[1]) < 16 && INTVAL (operands[3]) < 16"
50 "bld\\t%Z3,%Y2\;bst\\t%Z1,%Y0"
51 [(set_attr "length" "4")])
53 (define_insn_and_split "*insv_si_1_n_lshiftrt_16"
54 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
56 (match_operand:SI 1 "const_int_operand" "n"))
57 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
59 "INTVAL (operands[1]) < 16"
62 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 1) (match_dup 1))
63 (lshiftrt:SI (match_dup 2) (const_int 16)))
64 (clobber (reg:CC CC_REG))])])
66 (define_insn "*insv_si_1_n_lshiftrt_16_clobber_flags"
67 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
69 (match_operand:SI 1 "const_int_operand" "n"))
70 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
72 (clobber (reg:CC CC_REG))]
73 "INTVAL (operands[1]) < 16"
74 "rotr.w\\t%e2\;rotl.w\\t%e2\;bst\\t%Z1,%Y0"
75 [(set_attr "length" "6")])
77 (define_insn_and_split "*insv_si_8_8"
78 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
81 (match_operand:SI 1 "register_operand" "r"))]
85 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
87 (clobber (reg:CC CC_REG))])])
89 (define_insn "*insv_si_8_8_clobber_flags"
90 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
93 (match_operand:SI 1 "register_operand" "r"))
94 (clobber (reg:CC CC_REG))]
97 [(set_attr "length" "2")])
99 (define_insn_and_split "*insv_si_8_8_lshiftrt_8"
100 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
103 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
107 "&& reload_completed"
108 [(parallel [(set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
109 (lshiftrt:SI (match_dup 1) (const_int 8)))
110 (clobber (reg:CC CC_REG))])])
112 (define_insn "*insv_si_8_8_lshiftrt_8_clobber_flags"
113 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
116 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
118 (clobber (reg:CC CC_REG))]
121 [(set_attr "length" "2")])
125 (define_insn_and_split "*extzv_8_8"
126 [(set (match_operand:SI 0 "register_operand" "=r,r")
127 (zero_extract:SI (match_operand:SI 1 "register_operand" "?0,r")
132 "&& reload_completed"
133 [(parallel [(set (match_dup 0)
134 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 8)))
135 (clobber (reg:CC CC_REG))])])
137 (define_insn "*extzv_8_8_clobber_flags"
138 [(set (match_operand:SI 0 "register_operand" "=r,r")
139 (zero_extract:SI (match_operand:SI 1 "register_operand" "?0,r")
142 (clobber (reg:CC CC_REG))]
145 mov.b\\t%x1,%w0\;extu.w\\t%f0\;extu.l\\t%S0
146 sub.l\\t%S0,%S0\;mov.b\\t%x1,%w0"
147 [(set_attr "length" "6,4")])
149 (define_insn_and_split "*extzv_8_16"
150 [(set (match_operand:SI 0 "register_operand" "=r")
151 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
156 "&& reload_completed"
157 [(parallel [(set (match_dup 0)
158 (zero_extract:SI (match_dup 1) (const_int 8) (const_int 16)))
159 (clobber (reg:CC CC_REG))])])
161 (define_insn "*extzv_8_16_clobber_flags"
162 [(set (match_operand:SI 0 "register_operand" "=r")
163 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
166 (clobber (reg:CC CC_REG))]
168 "mov.w\\t%e1,%f0\;extu.w\\t%f0\;extu.l\\t%S0"
169 [(set_attr "length" "6")])
171 (define_insn_and_split "*extzv_16_8"
172 [(set (match_operand:SI 0 "register_operand" "=r")
173 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
176 (clobber (match_scratch:SI 2 "=&r"))]
179 "&& reload_completed"
180 [(parallel [(set (match_dup 0)
181 (zero_extract:SI (match_dup 1) (const_int 16) (const_int 8)))
182 (clobber (reg:CC CC_REG))])])
184 (define_insn "*extzv_16_8_clobber_flags"
185 [(set (match_operand:SI 0 "register_operand" "=r")
186 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
189 (clobber (match_scratch:SI 2 "=&r"))
190 (clobber (reg:CC CC_REG))]
192 "mov.w\\t%e1,%f2\;mov.b\\t%x1,%w0\;mov.b\\t%w2,%x0\;extu.l\\t%S0"
193 [(set_attr "length" "8")])
195 ;; Extract the exponent of a float.
197 (define_insn_and_split "*extzv_8_23"
198 [(set (match_operand:SI 0 "register_operand" "=r")
199 (zero_extract:SI (match_operand:SI 1 "register_operand" "0")
204 "&& reload_completed"
205 [(parallel [(set (match_dup 0)
206 (ashift:SI (match_dup 0)
208 (clobber (scratch:QI))
209 (clobber (reg:CC CC_REG))])
210 (parallel [(set (match_dup 0)
211 (lshiftrt:SI (match_dup 0)
213 (clobber (scratch:QI))
214 (clobber (reg:CC CC_REG))])])
218 ;; ((SImode) HImode) << 15
220 (define_insn_and_split "*twoshifts_l16_r1"
221 [(set (match_operand:SI 0 "register_operand" "=r")
222 (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
224 (const_int 2147450880)))]
227 "&& reload_completed"
228 [(parallel [(set (match_dup 0)
229 (ashift:SI (match_dup 0)
231 (clobber (scratch:QI))
232 (clobber (reg:CC CC_REG))])
233 (parallel [(set (match_dup 0)
234 (lshiftrt:SI (match_dup 0)
236 (clobber (scratch:QI))
237 (clobber (reg:CC CC_REG))])])
239 ;; Transform (SImode << B) & 0xffff into (SImode) (HImode << B).
241 (define_insn_and_split "*andsi3_ashift_n_lower"
242 [(set (match_operand:SI 0 "register_operand" "=r,r")
243 (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
244 (match_operand:QI 2 "const_int_operand" "S,n"))
245 (match_operand:SI 3 "const_int_operand" "n,n")))
246 (clobber (match_scratch:QI 4 "=X,&r"))]
247 "INTVAL (operands[2]) <= 15
248 && UINTVAL (operands[3]) == ((HOST_WIDE_INT_M1U << INTVAL (operands[2]))
251 "&& reload_completed"
252 [(parallel [(set (match_dup 5)
253 (ashift:HI (match_dup 5)
255 (clobber (match_dup 4))
256 (clobber (reg:CC CC_REG))])
257 (parallel [(set (match_dup 0)
258 (zero_extend:SI (match_dup 5)))
259 (clobber (reg:CC CC_REG))])]
261 operands[5] = gen_rtx_REG (HImode, REGNO (operands[0]));
264 ;; Accept (A >> 30) & 2 and the like.
266 (define_insn_and_split "*andsi3_lshiftrt_n_sb"
267 [(set (match_operand:SI 0 "register_operand" "=r")
268 (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
269 (match_operand:SI 2 "const_int_operand" "n"))
270 (match_operand:SI 3 "single_one_operand" "n")))]
271 "exact_log2 (INTVAL (operands[3])) < 16
272 && INTVAL (operands[2]) + exact_log2 (INTVAL (operands[3])) == 31"
274 "&& reload_completed"
275 [(parallel [(set (match_dup 0)
276 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
278 (clobber (reg:CC CC_REG))])])
280 (define_insn "*andsi3_lshiftrt_n_sb"
281 [(set (match_operand:SI 0 "register_operand" "=r")
282 (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
283 (match_operand:SI 2 "const_int_operand" "n"))
284 (match_operand:SI 3 "single_one_operand" "n")))
285 (clobber (reg:CC CC_REG))]
286 "exact_log2 (INTVAL (operands[3])) < 16
287 && INTVAL (operands[2]) + exact_log2 (INTVAL (operands[3])) == 31"
289 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
290 return "shll.l\\t%S0\;xor.l\\t%S0,%S0\;bst\\t%Z3,%Y0";
292 [(set_attr "length" "8")])
294 (define_insn_and_split "*andsi3_lshiftrt_9_sb"
295 [(set (match_operand:SI 0 "register_operand" "=r")
296 (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
298 (const_int 4194304)))]
301 "&& reload_completed"
302 [(parallel [(set (match_dup 0)
303 (and:SI (lshiftrt:SI (match_dup 0) (const_int 25))
305 (clobber (reg:CC CC_REG))])
306 (parallel [(set (match_dup 0)
307 (ashift:SI (match_dup 0)
309 (clobber (scratch:QI))
310 (clobber (reg:CC CC_REG))])])
314 (define_insn_and_split "*addsi3_upper"
315 [(set (match_operand:SI 0 "register_operand" "=r")
316 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r")
318 (match_operand:SI 2 "register_operand" "0")))]
321 "&& reload_completed"
322 [(parallel [(set (match_dup 0)
323 (plus:SI (mult:SI (match_dup 1) (const_int 65536))
325 (clobber (reg:CC CC_REG))])])
327 (define_insn "*addsi3_upper_clobber_regs"
328 [(set (match_operand:SI 0 "register_operand" "=r")
329 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r")
331 (match_operand:SI 2 "register_operand" "0")))
332 (clobber (reg:CC CC_REG))]
335 [(set_attr "length" "2")])
337 (define_insn_and_split "*addsi3_lshiftrt_16_zexthi"
338 [(set (match_operand:SI 0 "register_operand" "=r")
339 (plus:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
341 (zero_extend:SI (match_operand:HI 2 "register_operand" "0"))))]
344 "&& reload_completed"
345 [(parallel [(set (match_dup 0)
346 (plus:SI (lshiftrt:SI (match_dup 1) (const_int 16))
347 (zero_extend:SI (match_dup 2))))
348 (clobber (reg:CC CC_REG))])])
350 (define_insn "*addsi3_lshiftrt_16_zexthi_clobber_flags"
351 [(set (match_operand:SI 0 "register_operand" "=r")
352 (plus:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
354 (zero_extend:SI (match_operand:HI 2 "register_operand" "0"))))
355 (clobber (reg:CC CC_REG))]
357 "add.w\\t%e1,%f0\;xor.w\\t%e0,%e0\;rotxl.w\\t%e0"
358 [(set_attr "length" "6")])
360 ;;(define_insn_and_split "*addsi3_and_r_1"
361 ;; [(set (match_operand:SI 0 "register_operand" "=r")
362 ;; (plus:SI (and:SI (match_operand:SI 1 "register_operand" "r")
364 ;; (match_operand:SI 2 "register_operand" "0")))]
367 ;; "&& reload_completed"
368 ;; [(set (cc0) (compare (zero_extract:SI (match_dup 1)
373 ;; (if_then_else (eq (cc0)
375 ;; (label_ref (match_dup 3))
377 ;; (set (match_dup 2)
378 ;; (plus:SI (match_dup 2)
382 ;; operands[3] = gen_label_rtx ();
385 ;;(define_insn_and_split "*addsi3_and_not_r_1"
386 ;; [(set (match_operand:SI 0 "register_operand" "=r")
387 ;; (plus:SI (and:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
389 ;; (match_operand:SI 2 "register_operand" "0")))]
392 ;; "&& reload_completed"
393 ;; [(set (cc0) (compare (zero_extract:SI (match_dup 1)
398 ;; (if_then_else (ne (cc0)
400 ;; (label_ref (match_dup 3))
402 ;; (set (match_dup 2)
403 ;; (plus:SI (match_dup 2)
407 ;; operands[3] = gen_label_rtx ();
412 (define_insn_and_split "*ixorhi3_zext"
413 [(set (match_operand:HI 0 "register_operand" "=r")
414 (match_operator:HI 1 "iorxor_operator"
415 [(zero_extend:HI (match_operand:QI 2 "register_operand" "r"))
416 (match_operand:HI 3 "register_operand" "0")]))]
419 "&& reload_completed"
420 [(parallel [(set (match_dup 0)
421 (match_op_dup 1 [(zero_extend:HI (match_dup 2))
423 (clobber (reg:CC CC_REG))])])
426 (define_insn "*ixorhi3_zext_clobber_flags"
427 [(set (match_operand:HI 0 "register_operand" "=r")
428 (match_operator:HI 1 "iorxor_operator"
429 [(zero_extend:HI (match_operand:QI 2 "register_operand" "r"))
430 (match_operand:HI 3 "register_operand" "0")]))
431 (clobber (reg:CC CC_REG))]
434 [(set_attr "length" "2")])
438 (define_insn_and_split "*ixorsi3_zext_qi"
439 [(set (match_operand:SI 0 "register_operand" "=r")
440 (match_operator:SI 1 "iorxor_operator"
441 [(zero_extend:SI (match_operand:QI 2 "register_operand" "r"))
442 (match_operand:SI 3 "register_operand" "0")]))]
445 "&& reload_completed"
446 [(parallel [(set (match_dup 0)
447 (match_op_dup 1 [(zero_extend:SI (match_dup 2))
449 (clobber (reg:CC CC_REG))])])
451 (define_insn "*ixorsi3_zext_qi_clobber_flags"
452 [(set (match_operand:SI 0 "register_operand" "=r")
453 (match_operator:SI 1 "iorxor_operator"
454 [(zero_extend:SI (match_operand:QI 2 "register_operand" "r"))
455 (match_operand:SI 3 "register_operand" "0")]))
456 (clobber (reg:CC CC_REG))]
459 [(set_attr "length" "2")])
461 (define_insn_and_split "*ixorsi3_zext_hi"
462 [(set (match_operand:SI 0 "register_operand" "=r")
463 (match_operator:SI 1 "iorxor_operator"
464 [(zero_extend:SI (match_operand:HI 2 "register_operand" "r"))
465 (match_operand:SI 3 "register_operand" "0")]))]
468 "&& reload_completed"
469 [(parallel [(set (match_dup 0)
470 (match_op_dup 1 [(zero_extend:SI (match_dup 2))
472 (clobber (reg:CC CC_REG))])])
474 (define_insn "*ixorsi3_zext_hi_clobber_flags"
475 [(set (match_operand:SI 0 "register_operand" "=r")
476 (match_operator:SI 1 "iorxor_operator"
477 [(zero_extend:SI (match_operand:HI 2 "register_operand" "r"))
478 (match_operand:SI 3 "register_operand" "0")]))
479 (clobber (reg:CC CC_REG))]
482 [(set_attr "length" "2")])
484 (define_insn_and_split "*ixorsi3_ashift_16"
485 [(set (match_operand:SI 0 "register_operand" "=r")
486 (match_operator:SI 1 "iorxor_operator"
487 [(ashift:SI (match_operand:SI 2 "register_operand" "r")
489 (match_operand:SI 3 "register_operand" "0")]))]
492 "&& reload_completed"
493 [(parallel [(set (match_dup 0)
494 (match_op_dup 1 [(ashift:SI (match_dup 2) (const_int 16))
496 (clobber (reg:CC CC_REG))])])
498 (define_insn "*ixorsi3_ashift_16_clobber_flags"
499 [(set (match_operand:SI 0 "register_operand" "=r")
500 (match_operator:SI 1 "iorxor_operator"
501 [(ashift:SI (match_operand:SI 2 "register_operand" "r")
503 (match_operand:SI 3 "register_operand" "0")]))
504 (clobber (reg:CC CC_REG))]
507 [(set_attr "length" "2")])
509 (define_insn_and_split "*ixorsi3_lshiftrt_16"
510 [(set (match_operand:SI 0 "register_operand" "=r")
511 (match_operator:SI 1 "iorxor_operator"
512 [(lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
514 (match_operand:SI 3 "register_operand" "0")]))]
517 "&& reload_completed"
518 [(parallel [(set (match_dup 0)
519 (match_op_dup 1 [(lshiftrt:SI (match_dup 2) (const_int 16))
521 (clobber (reg:CC CC_REG))])])
523 (define_insn "*ixorsi3_lshiftrt_16_clobber_flags"
524 [(set (match_operand:SI 0 "register_operand" "=r")
525 (match_operator:SI 1 "iorxor_operator"
526 [(lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
528 (match_operand:SI 3 "register_operand" "0")]))
529 (clobber (reg:CC CC_REG))]
532 [(set_attr "length" "2")])
536 (define_insn_and_split "*iorhi3_ashift_8"
537 [(set (match_operand:HI 0 "register_operand" "=r")
538 (ior:HI (ashift:HI (match_operand:HI 1 "register_operand" "r")
540 (match_operand:HI 2 "register_operand" "0")))]
543 "&& reload_completed"
544 [(parallel [(set (match_dup 0)
545 (ior:HI (ashift:HI (match_dup 1) (const_int 8))
547 (clobber (reg:CC CC_REG))])])
549 (define_insn "*iorhi3_ashift_8_clobber_flags"
550 [(set (match_operand:HI 0 "register_operand" "=r")
551 (ior:HI (ashift:HI (match_operand:HI 1 "register_operand" "r")
553 (match_operand:HI 2 "register_operand" "0")))
554 (clobber (reg:CC CC_REG))]
557 [(set_attr "length" "2")])
559 (define_insn_and_split "*iorhi3_lshiftrt_8"
560 [(set (match_operand:HI 0 "register_operand" "=r")
561 (ior:HI (lshiftrt:HI (match_operand:HI 1 "register_operand" "r")
563 (match_operand:HI 2 "register_operand" "0")))]
566 "&& reload_completed"
567 [(parallel [(set (match_dup 0)
568 (ior:HI (lshiftrt:HI (match_dup 1) (const_int 8))
570 (clobber (reg:CC CC_REG))])])
572 (define_insn "*iorhi3_lshiftrt_8_clobber_flags"
573 [(set (match_operand:HI 0 "register_operand" "=r")
574 (ior:HI (lshiftrt:HI (match_operand:HI 1 "register_operand" "r")
576 (match_operand:HI 2 "register_operand" "0")))
577 (clobber (reg:CC CC_REG))]
580 [(set_attr "length" "2")])
582 (define_insn_and_split "*iorhi3_two_qi"
583 [(set (match_operand:HI 0 "register_operand" "=r")
584 (ior:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "0"))
585 (ashift:HI (match_operand:HI 2 "register_operand" "r")
589 "&& reload_completed"
590 [(parallel [(set (match_dup 0)
591 (ior:HI (zero_extend:HI (match_dup 1))
592 (ashift:HI (match_dup 2) (const_int 8))))
593 (clobber (reg:CC CC_REG))])])
595 (define_insn "*iorhi3_two_qi_clobber_flags"
596 [(set (match_operand:HI 0 "register_operand" "=r")
597 (ior:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "0"))
598 (ashift:HI (match_operand:HI 2 "register_operand" "r")
600 (clobber (reg:CC CC_REG))]
603 [(set_attr "length" "2")])
605 (define_insn_and_split "*iorhi3_two_qi_mem"
606 [(set (match_operand:HI 0 "register_operand" "=&r")
607 (ior:HI (zero_extend:HI (match_operand:QI 1 "memory_operand" "m"))
608 (ashift:HI (subreg:HI (match_operand:QI 2 "memory_operand" "m") 0)
612 "&& reload_completed"
613 [(parallel [(set (match_dup 0)
614 (ior:HI (zero_extend:HI (match_dup 1))
615 (ashift:HI (subreg:HI (match_dup 2) 0)
617 (clobber (reg:CC CC_REG))])])
619 (define_insn "*iorhi3_two_qi_mem_clobber_flags"
620 [(set (match_operand:HI 0 "register_operand" "=&r")
621 (ior:HI (zero_extend:HI (match_operand:QI 1 "memory_operand" "m"))
622 (ashift:HI (subreg:HI (match_operand:QI 2 "memory_operand" "m") 0)
624 (clobber (reg:CC CC_REG))]
626 "mov.b\\t%X2,%t0\;mov.b\\t%X1,%s0"
627 [(set_attr "length" "16")])
630 [(set (match_operand:HI 0 "register_operand" "")
631 (ior:HI (zero_extend:HI (match_operand:QI 1 "memory_operand" ""))
632 (ashift:HI (subreg:HI (match_operand:QI 2 "memory_operand" "") 0)
635 && byte_accesses_mergeable_p (XEXP (operands[2], 0), XEXP (operands[1], 0))"
636 [(parallel [(set (match_dup 0) (match_dup 3))
637 (clobber (reg:CC CC_REG))])]
639 operands[3] = gen_rtx_MEM (HImode, XEXP (operands[2], 0));
644 (define_insn_and_split "*iorsi3_two_hi"
645 [(set (match_operand:SI 0 "register_operand" "=r")
646 (ior:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "0"))
647 (ashift:SI (match_operand:SI 2 "register_operand" "r")
651 "&& reload_completed"
652 [(parallel [(set (match_dup 0)
653 (ior:SI (zero_extend:SI (match_dup 1))
654 (ashift:SI (match_dup 2) (const_int 16))))
655 (clobber (reg:CC CC_REG))])])
657 (define_insn "*iorsi3_two_hi_clobber_flags"
658 [(set (match_operand:SI 0 "register_operand" "=r")
659 (ior:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "0"))
660 (ashift:SI (match_operand:SI 2 "register_operand" "r")
662 (clobber (reg:CC CC_REG))]
665 [(set_attr "length" "2")])
667 (define_insn_and_split "*iorsi3_two_qi_zext"
668 [(set (match_operand:SI 0 "register_operand" "=&r")
669 (ior:SI (zero_extend:SI (match_operand:QI 1 "memory_operand" "m"))
670 (and:SI (ashift:SI (subreg:SI (match_operand:QI 2 "memory_operand" "m") 0)
672 (const_int 65280))))]
675 "&& reload_completed"
676 [(parallel [(set (match_dup 3)
677 (ior:HI (zero_extend:HI (match_dup 1))
678 (ashift:HI (subreg:HI (match_dup 2) 0)
680 (clobber (reg:CC CC_REG))])
681 (parallel [(set (match_dup 0) (zero_extend:SI (match_dup 3)))
682 (clobber (reg:CC CC_REG))])]
684 operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));
687 (define_insn_and_split "*iorsi3_e2f"
688 [(set (match_operand:SI 0 "register_operand" "=r")
689 (ior:SI (and:SI (match_operand:SI 1 "register_operand" "0")
691 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
695 "&& reload_completed"
696 [(parallel [(set (match_dup 0)
697 (ior:SI (and:SI (match_dup 1) (const_int -65536))
698 (lshiftrt:SI (match_dup 2) (const_int 16))))
699 (clobber (reg:CC CC_REG))])])
701 (define_insn "*iorsi3_e2f_clobber_flags"
702 [(set (match_operand:SI 0 "register_operand" "=r")
703 (ior:SI (and:SI (match_operand:SI 1 "register_operand" "0")
705 (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
707 (clobber (reg:CC CC_REG))]
710 [(set_attr "length" "2")])
712 (define_insn_and_split "*iorsi3_two_qi_sext"
713 [(set (match_operand:SI 0 "register_operand" "=r")
714 (ior:SI (zero_extend:SI (match_operand:QI 1 "register_operand" "0"))
715 (ashift:SI (sign_extend:SI (match_operand:QI 2 "register_operand" "r"))
719 "&& reload_completed"
720 [(parallel [(set (match_dup 3)
721 (ior:HI (zero_extend:HI (match_dup 1))
722 (ashift:HI (match_dup 4) (const_int 8))))
723 (clobber (reg:CC CC_REG))])
724 (parallel [(set (match_dup 0) (sign_extend:SI (match_dup 3)))
725 (clobber (reg:CC CC_REG))])]
727 operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));
728 operands[4] = gen_rtx_REG (HImode, REGNO (operands[2]));
731 (define_insn_and_split "*iorsi3_w"
732 [(set (match_operand:SI 0 "register_operand" "=r,&r")
733 (ior:SI (and:SI (match_operand:SI 1 "register_operand" "0,0")
735 (zero_extend:SI (match_operand:QI 2 "general_operand_src" "r,g>"))))]
738 "&& reload_completed"
739 [(parallel [(set (match_dup 0)
740 (ior:SI (and:SI (match_dup 1) (const_int -256))
741 (zero_extend:SI (match_dup 2))))
742 (clobber (reg:CC CC_REG))])])
744 (define_insn "*iorsi3_w_clobber_flags"
745 [(set (match_operand:SI 0 "register_operand" "=r,&r")
746 (ior:SI (and:SI (match_operand:SI 1 "register_operand" "0,0")
748 (zero_extend:SI (match_operand:QI 2 "general_operand_src" "r,g>"))))
749 (clobber (reg:CC CC_REG))]
752 [(set_attr "length" "2,8")])
754 (define_insn_and_split "*iorsi3_ashift_31"
755 [(set (match_operand:SI 0 "register_operand" "=&r")
756 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
758 (match_operand:SI 2 "register_operand" "0")))]
761 "&& reload_completed"
762 [(parallel [(set (match_dup 0)
763 (ior:SI (ashift:SI (match_dup 1) (const_int 31))
765 (clobber (reg:CC CC_REG))])])
767 (define_insn "*iorsi3_ashift_31_clobber_flags"
768 [(set (match_operand:SI 0 "register_operand" "=&r")
769 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
771 (match_operand:SI 2 "register_operand" "0")))
772 (clobber (reg:CC CC_REG))]
774 "rotxl.l\\t%S0\;bor\\t#0,%w1\;rotxr.l\\t%S0"
775 [(set_attr "length" "6")])
777 (define_insn_and_split "*iorsi3_and_ashift"
778 [(set (match_operand:SI 0 "register_operand" "=r")
779 (ior:SI (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
780 (match_operand:SI 2 "const_int_operand" "n"))
781 (match_operand:SI 3 "single_one_operand" "n"))
782 (match_operand:SI 4 "register_operand" "0")))]
783 "(INTVAL (operands[3]) & ~0xffff) == 0"
785 "&& reload_completed"
786 [(parallel [(set (match_dup 0)
787 (ior:SI (and:SI (ashift:SI (match_dup 1) (match_dup 2))
790 (clobber (reg:CC CC_REG))])])
792 (define_insn "*iorsi3_and_ashift_clobber_flags"
793 [(set (match_operand:SI 0 "register_operand" "=r")
794 (ior:SI (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
795 (match_operand:SI 2 "const_int_operand" "n"))
796 (match_operand:SI 3 "single_one_operand" "n"))
797 (match_operand:SI 4 "register_operand" "0")))
798 (clobber (reg:CC CC_REG))]
799 "(INTVAL (operands[3]) & ~0xffff) == 0"
801 rtx srcpos = GEN_INT (exact_log2 (INTVAL (operands[3]))
802 - INTVAL (operands[2]));
803 rtx dstpos = GEN_INT (exact_log2 (INTVAL (operands[3])));
804 operands[2] = srcpos;
805 operands[3] = dstpos;
806 return "bld\\t%Z2,%Y1\;bor\\t%Z3,%Y0\;bst\\t%Z3,%Y0";
808 [(set_attr "length" "6")])
810 (define_insn_and_split "*iorsi3_and_lshiftrt"
811 [(set (match_operand:SI 0 "register_operand" "=r")
812 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
813 (match_operand:SI 2 "const_int_operand" "n"))
814 (match_operand:SI 3 "single_one_operand" "n"))
815 (match_operand:SI 4 "register_operand" "0")))]
816 "((INTVAL (operands[3]) << INTVAL (operands[2])) & ~0xffff) == 0"
818 "&& reload_completed"
819 [(parallel [(set (match_dup 0)
820 (ior:SI (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
823 (clobber (reg:CC CC_REG))])])
825 (define_insn "*iorsi3_and_lshiftrt_clobber_flags"
826 [(set (match_operand:SI 0 "register_operand" "=r")
827 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
828 (match_operand:SI 2 "const_int_operand" "n"))
829 (match_operand:SI 3 "single_one_operand" "n"))
830 (match_operand:SI 4 "register_operand" "0")))
831 (clobber (reg:CC CC_REG))]
832 "((INTVAL (operands[3]) << INTVAL (operands[2])) & ~0xffff) == 0"
834 rtx srcpos = GEN_INT (exact_log2 (INTVAL (operands[3]))
835 + INTVAL (operands[2]));
836 rtx dstpos = GEN_INT (exact_log2 (INTVAL (operands[3])));
837 operands[2] = srcpos;
838 operands[3] = dstpos;
839 return "bld\\t%Z2,%Y1\;bor\\t%Z3,%Y0\;bst\\t%Z3,%Y0";
841 [(set_attr "length" "6")])
843 (define_insn_and_split "*iorsi3_zero_extract"
844 [(set (match_operand:SI 0 "register_operand" "=r")
845 (ior:SI (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
847 (match_operand:SI 2 "const_int_operand" "n"))
848 (match_operand:SI 3 "register_operand" "0")))]
849 "INTVAL (operands[2]) < 16"
851 "&& reload_completed"
852 [(parallel [(set (match_dup 0)
853 (ior:SI (zero_extract:SI (match_dup 1)
857 (clobber (reg:CC CC_REG))])])
859 (define_insn "*iorsi3_zero_extract_clobber_flags"
860 [(set (match_operand:SI 0 "register_operand" "=r")
861 (ior:SI (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
863 (match_operand:SI 2 "const_int_operand" "n"))
864 (match_operand:SI 3 "register_operand" "0")))
865 (clobber (reg:CC CC_REG))]
866 "INTVAL (operands[2]) < 16"
867 "bld\\t%Z2,%Y1\;bor\\t#0,%w0\;bst\\t#0,%w0"
868 [(set_attr "length" "6")])
870 (define_insn_and_split "*iorsi3_and_lshiftrt_n_sb"
871 [(set (match_operand:SI 0 "register_operand" "=r")
872 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
875 (match_operand:SI 2 "register_operand" "0")))]
878 "&& reload_completed"
879 [(parallel [(set (match_dup 0)
880 (ior:SI (and:SI (lshiftrt:SI (match_dup 1) (const_int 30))
883 (clobber (reg:CC CC_REG))])])
885 (define_insn "*iorsi3_and_lshiftrt_n_sb_clobber_flags"
886 [(set (match_operand:SI 0 "register_operand" "=r")
887 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
890 (match_operand:SI 2 "register_operand" "0")))
891 (clobber (reg:CC CC_REG))]
893 "rotl.l\\t%S1\;rotr.l\\t%S1\;bor\\t#1,%w0\;bst\\t#1,%w0"
894 [(set_attr "length" "8")])
896 (define_insn_and_split "*iorsi3_and_lshiftrt_9_sb"
897 [(set (match_operand:SI 0 "register_operand" "=r")
898 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
901 (match_operand:SI 2 "register_operand" "0")))
902 (clobber (match_scratch:HI 3 "=&r"))]
905 "&& reload_completed"
906 [(parallel [(set (match_dup 0)
907 (ior:SI (and:SI (lshiftrt:SI (match_dup 1) (const_int 9))
910 (clobber (match_dup 3))
911 (clobber (reg:CC CC_REG))])])
914 (define_insn "*iorsi3_and_lshiftrt_9_sb_clobber_flags"
915 [(set (match_operand:SI 0 "register_operand" "=r")
916 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
919 (match_operand:SI 2 "register_operand" "0")))
920 (clobber (match_scratch:HI 3 "=&r"))
921 (clobber (reg:CC CC_REG))]
924 if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
925 return "shll.l\\t%S1\;xor.w\\t%T3,%T3\;bst\\t#6,%s3\;or.w\\t%T3,%e0";
927 return "rotl.l\\t%S1\;rotr.l\\t%S1\;xor.w\\t%T3,%T3\;bst\\t#6,%s3\;or.w\\t%T3,%e0";
929 [(set_attr "length" "10")])
931 ;; Used to OR the exponent of a float.
933 (define_insn "*iorsi3_shift"
934 [(set (match_operand:SI 0 "register_operand" "=r")
935 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
937 (match_operand:SI 2 "register_operand" "0")))
938 (clobber (match_scratch:SI 3 "=&r"))]
943 [(set (match_operand:SI 0 "register_operand" "")
944 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "")
947 (clobber (match_operand:SI 2 "register_operand" ""))]
949 && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))
950 && REGNO (operands[0]) != REGNO (operands[1])"
951 [(parallel [(set (match_dup 3)
952 (ashift:HI (match_dup 3)
954 (clobber (scratch:QI))
955 (clobber (reg:CC CC_REG))])
956 (parallel [(set (match_dup 0)
957 (ior:SI (ashift:SI (match_dup 1) (const_int 16))
959 (clobber (reg:CC CC_REG))])]
961 operands[3] = gen_rtx_REG (HImode, REGNO (operands[1]));
965 [(set (match_operand:SI 0 "register_operand" "")
966 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "")
969 (clobber (match_operand:SI 2 "register_operand" ""))]
971 && !(find_regno_note (insn, REG_DEAD, REGNO (operands[1]))
972 && REGNO (operands[0]) != REGNO (operands[1]))"
973 [(parallel [(set (match_dup 2) (match_dup 1))
974 (clobber (reg:CC CC_REG))])
975 (parallel [(set (match_dup 3)
976 (ashift:HI (match_dup 3)
978 (clobber (scratch:QI))
979 (clobber (reg:CC CC_REG))])
980 (parallel [(set (match_dup 0)
981 (ior:SI (ashift:SI (match_dup 2) (const_int 16))
983 (clobber (reg:CC CC_REG))])]
985 operands[3] = gen_rtx_REG (HImode, REGNO (operands[2]));
988 (define_insn_and_split "*iorsi2_and_1_lshiftrt_1"
989 [(set (match_operand:SI 0 "register_operand" "=r")
990 (ior:SI (and:SI (match_operand:SI 1 "register_operand" "0")
992 (lshiftrt:SI (match_dup 1)
996 "&& reload_completed"
997 [(parallel [(set (match_dup 0)
998 (ior:SI (and:SI (match_dup 1) (const_int 1))
999 (lshiftrt:SI (match_dup 1) (const_int 1))))
1000 (clobber (reg:CC CC_REG))])])
1002 (define_insn "*iorsi2_and_1_lshiftrt_1_clobber_flags"
1003 [(set (match_operand:SI 0 "register_operand" "=r")
1004 (ior:SI (and:SI (match_operand:SI 1 "register_operand" "0")
1006 (lshiftrt:SI (match_dup 1)
1008 (clobber (reg:CC CC_REG))]
1010 "shlr.l\\t%S0\;bor\\t#0,%w0\;bst\\t#0,%w0"
1011 [(set_attr "length" "6")])
1013 (define_insn_and_split "*iorsi3_ashift_16_ashift_24"
1014 [(set (match_operand:SI 0 "register_operand" "=r")
1015 (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
1017 (ashift:SI (match_operand:SI 2 "register_operand" "r")
1021 "&& reload_completed"
1022 [(parallel [(set (match_dup 3)
1023 (ior:HI (ashift:HI (match_dup 4) (const_int 8))
1025 (clobber (reg:CC CC_REG))])
1026 (parallel [(set (match_dup 0)
1027 (ashift:SI (match_dup 0)
1029 (clobber (scratch:QI))
1030 (clobber (reg:CC CC_REG))])]
1032 operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));
1033 operands[4] = gen_rtx_REG (HImode, REGNO (operands[2]));
1036 (define_insn_and_split "*iorsi3_ashift_16_ashift_24_mem"
1037 [(set (match_operand:SI 0 "register_operand" "=&r")
1038 (ior:SI (and:SI (ashift:SI (subreg:SI (match_operand:QI 1 "memory_operand" "m") 0)
1040 (const_int 16711680))
1041 (ashift:SI (subreg:SI (match_operand:QI 2 "memory_operand" "m") 0)
1045 "&& reload_completed"
1046 [(parallel [(set (match_dup 3)
1047 (ior:HI (zero_extend:HI (match_dup 1))
1048 (ashift:HI (subreg:HI (match_dup 2) 0)
1050 (clobber (reg:CC CC_REG))])
1051 (parallel [(set (match_dup 0)
1052 (ashift:SI (match_dup 0)
1054 (clobber (scratch:QI))
1055 (clobber (reg:CC CC_REG))])]
1057 operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));
1060 ;; Used to add the exponent of a float.
1062 (define_insn "*addsi3_shift"
1063 [(set (match_operand:SI 0 "register_operand" "=r")
1064 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r")
1065 (const_int 8388608))
1066 (match_operand:SI 2 "register_operand" "0")))
1067 (clobber (match_scratch:SI 3 "=&r"))]
1072 [(set (match_operand:SI 0 "register_operand" "")
1073 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
1074 (const_int 8388608))
1076 (clobber (match_operand:SI 2 "register_operand" ""))]
1078 && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))
1079 && REGNO (operands[0]) != REGNO (operands[1])"
1080 [(parallel [(set (match_dup 3)
1081 (ashift:HI (match_dup 3)
1083 (clobber (scratch:QI))
1084 (clobber (reg:CC CC_REG))])
1085 (parallel [(set (match_dup 0)
1086 (plus:SI (mult:SI (match_dup 1) (const_int 65536))
1088 (clobber (reg:CC CC_REG))])]
1090 operands[3] = gen_rtx_REG (HImode, REGNO (operands[1]));
1094 [(set (match_operand:SI 0 "register_operand" "")
1095 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
1096 (const_int 8388608))
1098 (clobber (match_operand:SI 2 "register_operand" ""))]
1100 && !(find_regno_note (insn, REG_DEAD, REGNO (operands[1]))
1101 && REGNO (operands[0]) != REGNO (operands[1]))"
1102 [(parallel [(set (match_dup 2) (match_dup 1))
1103 (clobber (reg:CC CC_REG))])
1104 (parallel [(set (match_dup 3)
1105 (ashift:HI (match_dup 3)
1107 (clobber (scratch:QI))
1108 (clobber (reg:CC CC_REG))])
1109 (parallel [(set (match_dup 0)
1110 (plus:SI (mult:SI (match_dup 2) (const_int 65536))
1112 (clobber (reg:CC CC_REG))])]
1114 operands[3] = gen_rtx_REG (HImode, REGNO (operands[2]));
1119 (define_insn_and_split "*ashiftsi_sextqi_7"
1120 [(set (match_operand:SI 0 "register_operand" "=r")
1121 (ashift:SI (sign_extend:SI (match_operand:QI 1 "register_operand" "0"))
1125 "&& reload_completed"
1126 [(parallel [(set (match_dup 2)
1127 (ashift:HI (match_dup 2)
1129 (clobber (scratch:QI))
1130 (clobber (reg:CC CC_REG))])
1131 (parallel [(set (match_dup 0) (sign_extend:SI (match_dup 2)))
1132 (clobber (reg:CC CC_REG))])
1133 (parallel [(set (match_dup 0)
1134 (ashiftrt:SI (match_dup 0)
1136 (clobber (scratch:QI))
1137 (clobber (reg:CC CC_REG))])]
1139 operands[2] = gen_rtx_REG (HImode, REGNO (operands[0]));
1142 ;; Storing a part of HImode to QImode.
1144 (define_insn_and_split ""
1145 [(set (match_operand:QI 0 "general_operand_dst" "=rm,Za,Zb,Zc,Zd,Ze,Zf,Zg,Zh")
1146 (subreg:QI (lshiftrt:HI (match_operand:HI 1 "register_operand" "r,Z0,Z1,Z2,Z3,Z4,Z5,Z6,Z7")
1150 "&& reload_completed"
1151 [(parallel [(set (match_dup 0) (subreg:QI (lshiftrt:HI (match_dup 1)
1153 (clobber (reg:CC CC_REG))])])
1156 [(set (match_operand:QI 0 "general_operand_dst" "=rm,Za,Zb,Zc,Zd,Ze,Zf,Zh,Zg")
1157 (subreg:QI (lshiftrt:HI (match_operand:HI 1 "register_operand" "r,Z0,Z1,Z2,Z3,Z4,Z5,Z6,Z7")
1159 (clobber (reg:CC CC_REG))]
1162 [(set_attr "length" "8")])
1164 ;; Storing a part of SImode to QImode.
1166 (define_insn_and_split ""
1167 [(set (match_operand:QI 0 "general_operand_dst" "=rm,Za,Zb,Zc,Zd,Ze,Zf,Zh,Zg")
1168 (subreg:QI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,Z0,Z1,Z2,Z3,Z4,Z5,Z6,Z7")
1172 "&& reload_completed"
1173 [(parallel [(set (match_dup 0)
1174 (subreg:QI (lshiftrt:SI (match_dup 1) (const_int 8)) 3))
1175 (clobber (reg:CC CC_REG))])])
1178 [(set (match_operand:QI 0 "general_operand_dst" "=rm,Za,Zb,Zc,Zd,Ze,Zf,Zh,Zg")
1179 (subreg:QI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,Z0,Z1,Z2,Z3,Z4,Z5,Z6,Z7")
1181 (clobber (reg:CC CC_REG))]
1184 [(set_attr "length" "8")])
1186 (define_insn_and_split ""
1187 [(set (match_operand:QI 0 "general_operand_dst" "=rm,Za,Zb,Zc,Zd,Ze,Zf,Zh,Zg")
1188 (subreg:QI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,Z0,Z1,Z2,Z3,Z4,Z5,Z6,Z7")
1190 (clobber (match_scratch:SI 2 "=&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
1193 "&& reload_completed"
1194 [(parallel [(set (match_dup 0)
1195 (subreg:QI (lshiftrt:SI (match_dup 1) (const_int 16)) 3))
1196 (clobber (match_dup 2))
1197 (clobber (reg:CC CC_REG))])])
1200 [(set (match_operand:QI 0 "general_operand_dst" "=rm,Za,Zb,Zc,Zd,Ze,Zf,Zh,Zg")
1201 (subreg:QI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,Z0,Z1,Z2,Z3,Z4,Z5,Z6,Z7")
1203 (clobber (match_scratch:SI 2 "=&r,&r,&r,&r,&r,&r,&r,&r,&r"))
1204 (clobber (reg:CC CC_REG))]
1206 "mov.w\\t%e1,%f2\;mov.b\\t%w2,%R0"
1207 [(set_attr "length" "10")])
1209 (define_insn_and_split ""
1210 [(set (match_operand:QI 0 "general_operand_dst" "=rm,Za,Zb,Zc,Zd,Ze,Zf,Zh,Zg")
1211 (subreg:QI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,Z0,Z1,Z2,Z3,Z4,Z5,Z6,Z7")
1213 (clobber (match_scratch:SI 2 "=&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
1216 "&& reload_completed"
1217 [(parallel [(set (match_dup 0)
1218 (subreg:QI (lshiftrt:SI (match_dup 1) (const_int 24)) 3))
1219 (clobber (match_dup 2))
1220 (clobber (reg:CC CC_REG))])])
1223 [(set (match_operand:QI 0 "general_operand_dst" "=rm,Za,Zb,Zc,Zd,Ze,Zf,Zh,Zg")
1224 (subreg:QI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,Z0,Z1,Z2,Z3,Z4,Z5,Z6,Z7")
1226 (clobber (match_scratch:SI 2 "=&r,&r,&r,&r,&r,&r,&r,&r,&r"))
1227 (clobber (reg:CC CC_REG))]
1229 "mov.w\\t%e1,%f2\;mov.b\\t%x2,%R0"
1230 [(set_attr "length" "10")])
1232 ;;(define_insn_and_split ""
1234 ;; (if_then_else (eq (zero_extract:SI (subreg:SI (match_operand:QI 0 "register_operand" "") 0)
1238 ;; (label_ref (match_operand 1 "" ""))
1243 ;; [(set (cc0) (compare (match_dup 0)
1246 ;; (if_then_else (ge (cc0)
1248 ;; (label_ref (match_dup 1))
1252 ;; (define_insn_and_split ""
1254 ;; (if_then_else (ne (zero_extract:SI (subreg:SI (match_operand:QI 0 "register_operand" "") 0)
1258 ;; (label_ref (match_operand 1 "" ""))
1263 ;; [(set (cc0) (compare (match_dup 0)
1266 ;; (if_then_else (lt (cc0)
1268 ;; (label_ref (match_dup 1))
1272 ;; This is a signed bitfield extraction starting at bit 0
1273 ;; It's usually faster than using shifts, but not always,
1274 ;; particularly on the H8/S and H8/SX variants.
1275 (define_insn_and_split "*extvsi_n_0"
1276 [(set (match_operand:SI 0 "register_operand" "=r")
1277 (sign_extract:SI (match_operand:SI 1 "register_operand" "0")
1278 (match_operand 2 "const_int_operand")
1280 "INTVAL (operands[2]) > 1
1281 && INTVAL (operands[2]) < (TARGET_H8300S ? 26 - TARGET_H8300SX : 29)
1282 && (!TARGET_H8300SX || (INTVAL (operands[2]) != 24 && INTVAL (operands[2]) != 17))"
1284 "&& reload_completed"
1285 [(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 3)))
1286 (clobber (reg:CC CC_REG))])
1287 (parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 4)))
1288 (clobber (reg:CC CC_REG))])
1289 (parallel [(set (match_dup 0) (minus:SI (match_dup 0) (match_dup 4)))
1290 (clobber (reg:CC CC_REG))])]
1292 int tmp = INTVAL (operands[2]);
1293 operands[3] = GEN_INT (~(HOST_WIDE_INT_M1U << tmp));
1294 operands[4] = GEN_INT (HOST_WIDE_INT_1U << (tmp - 1));
1297 (define_insn_and_split "*extvsi_n_n"
1298 [(set (match_operand:SI 0 "register_operand" "=r")
1299 (sign_extract:SI (match_operand:SI 1 "register_operand" "0")
1300 (match_operand 2 "const_int_operand")
1301 (match_operand 3 "const_int_operand")))]
1302 "(!h8300_shift_needs_scratch_p (INTVAL (operands[3]), SImode, LSHIFTRT)
1303 && use_extvsi (INTVAL (operands[2]), INTVAL (operands[3])))"
1305 "&& reload_completed"
1306 [(parallel [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 3)))
1307 (clobber (reg:CC CC_REG))])
1308 (parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 4)))
1309 (clobber (reg:CC CC_REG))])
1310 (parallel [(set (match_dup 0) (xor:SI (match_dup 0) (match_dup 5)))
1311 (clobber (reg:CC CC_REG))])
1312 (parallel [(set (match_dup 0) (minus:SI (match_dup 0) (match_dup 5)))
1313 (clobber (reg:CC CC_REG))])]
1315 int tmp = INTVAL (operands[2]);
1316 operands[4] = gen_int_mode (~(HOST_WIDE_INT_M1U << tmp), SImode);
1317 operands[5] = gen_int_mode (HOST_WIDE_INT_1U << (tmp - 1), SImode);
1321 ;; Testing showed this only triggering with SImode, probably because
1322 ;; of how insv/extv are defined.
1323 (define_insn_and_split ""
1324 [(set (match_operand:SI 0 "register_operand" "=r")
1325 (sign_extract:SI (match_operand:QHSI 1 "register_operand" "0")
1327 (match_operand 2 "immediate_operand")))]
1330 "&& reload_completed"
1331 [(parallel [(set (match_dup 0)
1332 (sign_extract:SI (match_dup 1) (const_int 1) (match_dup 2)))
1333 (clobber (reg:CC CC_REG))])])
1336 [(set (match_operand:SI 0 "register_operand" "=r")
1337 (sign_extract:SI (match_operand:QHSI 1 "register_operand" "0")
1339 (match_operand 2 "immediate_operand")))
1340 (clobber (reg:CC CC_REG))]
1343 int position = INTVAL (operands[2]);
1345 /* For bit position 31, 30, left shift the bit we want into C. */
1346 bool bit_in_c = false;
1349 output_asm_insn ("shll.l\t%0", operands);
1352 else if (position == 30 && TARGET_H8300S)
1354 output_asm_insn ("shll.l\t#2,%0", operands);
1358 /* Similar for positions 16, 17, but with a right shift into C. */
1359 else if (position == 16)
1361 output_asm_insn ("shlr.w\t%e0", operands);
1364 else if (position == 17 && TARGET_H8300S)
1366 output_asm_insn ("shlr.w\t#2,%e0", operands);
1371 /* For all the other cases in the upper 16 bits, move the upper 16
1372 bits into the lower 16 bits, then use the standard sequence for
1373 extracting one of the low 16 bits. */
1374 else if (position >= 16)
1376 output_asm_insn ("mov.w\t%e1,%f0", operands);
1378 /* We'll use the standard sequences for the low word now. */
1382 /* Same size/speed as the general sequence, but slightly faster
1385 return "and.l\t#1,%0\;neg.l\t%0";
1388 xoperands[0] = operands[0];
1389 xoperands[1] = operands[1];
1390 xoperands[2] = GEN_INT (position);
1392 /* If the bit we want is not already in C, get it there */
1397 xoperands[2] = GEN_INT (position % 8);
1398 output_asm_insn ("bld\t%2,%t1", xoperands);
1401 output_asm_insn ("bld\t%2,%s1", xoperands);
1404 /* Now the bit we want is in C, emit the generalized sequence
1405 to get that bit into the destination, properly extended. */
1406 return "subx\t%s0,%s0\;exts.w %T0\;exts.l %0";
1408 [(set (attr "length") (symbol_ref "INTVAL (operands[2]) >= 16 ? 10 : 8"))])
1410 ;; For shift counts >= 16 we can always do better than the
1411 ;; generic sequences. Other patterns handle smaller counts.
1412 (define_insn_and_split ""
1413 [(set (match_operand:SI 0 "register_operand" "=r")
1414 (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
1415 (match_operand 2 "immediate_operand" "n"))
1417 "!TARGET_H8300SX && INTVAL (operands[2]) >= 16"
1419 "&& reload_completed"
1420 [(parallel [(set (match_dup 0) (and:SI (lshiftrt:SI (match_dup 0) (match_dup 2))
1422 (clobber (reg:CC CC_REG))])])
1425 [(set (match_operand:SI 0 "register_operand" "=r")
1426 (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
1427 (match_operand 2 "immediate_operand" "n"))
1429 (clobber (reg:CC CC_REG))]
1430 "!TARGET_H8300SX && INTVAL (operands[2]) >= 16"
1432 int position = INTVAL (operands[2]);
1434 /* If the bit we want is the highest bit we can just rotate it into position
1435 and mask off everything else. */
1438 output_asm_insn ("rotl.l\t%0", operands);
1439 return "and.l\t#1,%0";
1442 /* Special case for H8/S. Similar to bit 31. */
1443 if (position == 30 && TARGET_H8300S)
1444 return "rotl.l\t#2,%0\;and.l\t#1,%0";
1446 if (position <= 30 && position >= 17)
1448 /* Shift 16 bits, without worrying about extensions. */
1449 output_asm_insn ("mov.w\t%e1,%f0", operands);
1451 /* Get the bit we want into C. */
1452 operands[2] = GEN_INT (position % 8);
1454 output_asm_insn ("bld\t%2,%t0", operands);
1456 output_asm_insn ("bld\t%2,%s0", operands);
1458 /* xor + rotate to clear the destination, then rotate
1459 the C into position. */
1460 return "xor.l\t%0,%0\;rotxl.l\t%0";
1465 /* Shift 16 bits, without worrying about extensions. */
1466 output_asm_insn ("mov.w\t%e1,%f0", operands);
1468 /* And finally, mask out everything we don't want. */
1469 return "and.l\t#1,%0";
1474 [(set_attr "length" "10")])