|
3073 | 3073 | ;; * Single-bit extraction (SFB) |
3074 | 3074 | ;; * Extraction instruction th.ext(u) (XTheadBb) |
3075 | 3075 | ;; * lshrsi3_extend_2 (see above) |
| 3076 | +;; * Zero extraction fusion (ARC-V) |
3076 | 3077 | (define_insn_and_split "*<any_extract:optab><GPR:mode>3" |
3077 | 3078 | [(set (match_operand:GPR 0 "register_operand" "=r") |
3078 | 3079 | (any_extract:GPR |
|
3085 | 3086 | && (INTVAL (operands[2]) == 1)) |
3086 | 3087 | && !TARGET_XTHEADBB |
3087 | 3088 | && !TARGET_XANDESPERF |
| 3089 | + && !(TARGET_ARCV_RHX100 |
| 3090 | + && <any_extract:is_zero_extract>) |
3088 | 3091 | && !(TARGET_64BIT |
3089 | 3092 | && (INTVAL (operands[3]) > 0) |
3090 | 3093 | && (INTVAL (operands[2]) + INTVAL (operands[3]) == 32))" |
|
4525 | 4528 | (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand")) |
4526 | 4529 | (sign_extend:SI (match_operand:HI 2 "register_operand"))) |
4527 | 4530 | (match_operand:SI 3 "register_operand")))] |
4528 | | - "TARGET_XTHEADMAC" |
4529 | | -) |
| 4531 | + "TARGET_XTHEADMAC || (TARGET_ARCV_RHX100 |
| 4532 | + && !TARGET_64BIT && (TARGET_ZMMUL || TARGET_MUL))" |
| 4533 | +{ |
| 4534 | + if (TARGET_ARCV_RHX100) |
| 4535 | + { |
| 4536 | + rtx tmp0 = gen_reg_rtx (SImode), tmp1 = gen_reg_rtx (SImode); |
| 4537 | + emit_insn (gen_extendhisi2 (tmp0, operands[1])); |
| 4538 | + emit_insn (gen_extendhisi2 (tmp1, operands[2])); |
| 4539 | + |
| 4540 | + if (TARGET_64BIT) |
| 4541 | + { |
| 4542 | + rtx op0 = gen_reg_rtx (DImode); |
| 4543 | + emit_insn (gen_madd_fused_extended (op0, tmp0, tmp1, operands[3])); |
| 4544 | + op0 = gen_lowpart (SImode, op0); |
| 4545 | + SUBREG_PROMOTED_VAR_P (op0) = 1; |
| 4546 | + SUBREG_PROMOTED_SET (op0, SRP_SIGNED); |
| 4547 | + emit_move_insn (operands[0], op0); |
| 4548 | + } |
| 4549 | + else |
| 4550 | + { |
| 4551 | + emit_insn (gen_madd_fused (operands[0], tmp0, tmp1, operands[3])); |
| 4552 | + } |
| 4553 | + |
| 4554 | + DONE; |
| 4555 | + } |
| 4556 | +}) |
| 4557 | + |
| 4558 | +(define_expand "umaddhisi4" |
| 4559 | + [(set (match_operand:SI 0 "register_operand") |
| 4560 | + (plus:SI |
| 4561 | + (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand")) |
| 4562 | + (zero_extend:SI (match_operand:HI 2 "register_operand"))) |
| 4563 | + (match_operand:SI 3 "register_operand")))] |
| 4564 | + "TARGET_ARCV_RHX100 |
| 4565 | + && !TARGET_64BIT && (TARGET_ZMMUL || TARGET_MUL)" |
| 4566 | +{ |
| 4567 | + rtx tmp0 = gen_reg_rtx (SImode), tmp1 = gen_reg_rtx (SImode); |
| 4568 | + emit_insn (gen_zero_extendhisi2 (tmp0, operands[1])); |
| 4569 | + emit_insn (gen_zero_extendhisi2 (tmp1, operands[2])); |
| 4570 | + |
| 4571 | + if (TARGET_64BIT) |
| 4572 | + { |
| 4573 | + rtx op0 = gen_reg_rtx (DImode); |
| 4574 | + emit_insn (gen_madd_fused_extended (op0, tmp0, tmp1, operands[3])); |
| 4575 | + op0 = gen_lowpart (SImode, op0); |
| 4576 | + SUBREG_PROMOTED_VAR_P (op0) = 1; |
| 4577 | + SUBREG_PROMOTED_SET (op0, SRP_SIGNED); |
| 4578 | + emit_move_insn (operands[0], op0); |
| 4579 | + } |
| 4580 | + else |
| 4581 | + { |
| 4582 | + emit_insn (gen_madd_fused (operands[0], tmp0, tmp1, operands[3])); |
| 4583 | + } |
| 4584 | + |
| 4585 | + DONE; |
| 4586 | +}) |
4530 | 4587 |
|
4531 | 4588 | (define_expand "msubhisi4" |
4532 | 4589 | [(set (match_operand:SI 0 "register_operand") |
|
4537 | 4594 | "TARGET_XTHEADMAC" |
4538 | 4595 | ) |
4539 | 4596 |
|
| 4597 | +(define_insn_and_split "madd_fused" |
| 4598 | + [(set (match_operand:SI 0 "register_operand" "=&r,r") |
| 4599 | + (plus:SI |
| 4600 | + (mult:SI (match_operand:SI 1 "register_operand" "r,r") |
| 4601 | + (match_operand:SI 2 "register_operand" "r,r")) |
| 4602 | + (match_operand:SI 3 "register_operand" "r,?0"))) |
| 4603 | + (clobber (match_scratch:SI 4 "=&r,&r"))] |
| 4604 | + "TARGET_ARCV_RHX100 |
| 4605 | + && !TARGET_64BIT && (TARGET_ZMMUL || TARGET_MUL)" |
| 4606 | + "#" |
| 4607 | + "&& reload_completed" |
| 4608 | + [(const_int 0)] |
| 4609 | + "{ |
| 4610 | + if (REGNO (operands[0]) == REGNO (operands[3])) |
| 4611 | + { |
| 4612 | + emit_insn (gen_mulsi3 (operands[4], operands[1], operands[2])); |
| 4613 | + emit_insn (gen_addsi3 (operands[0], operands[3], operands[4])); |
| 4614 | + } |
| 4615 | + else |
| 4616 | + { |
| 4617 | + emit_insn (gen_mulsi3 (operands[0], operands[1], operands[2])); |
| 4618 | + emit_insn (gen_addsi3 (operands[0], operands[0], operands[3])); |
| 4619 | + } |
| 4620 | + DONE; |
| 4621 | + }" |
| 4622 | + [(set_attr "type" "imul_fused")]) |
| 4623 | + |
| 4624 | +(define_insn_and_split "madd_fused_extended" |
| 4625 | + [(set (match_operand:DI 0 "register_operand" "=&r,r") |
| 4626 | + (sign_extend:DI |
| 4627 | + (plus:SI |
| 4628 | + (mult:SI (match_operand:SI 1 "register_operand" "r,r") |
| 4629 | + (match_operand:SI 2 "register_operand" "r,r")) |
| 4630 | + (match_operand:SI 3 "register_operand" "r,?0")))) |
| 4631 | + (clobber (match_scratch:SI 4 "=&r,&r"))] |
| 4632 | + "TARGET_ARCV_RHX100 |
| 4633 | + && (TARGET_ZMMUL || TARGET_MUL)" |
| 4634 | + "#" |
| 4635 | + "&& reload_completed" |
| 4636 | + [(const_int 0)] |
| 4637 | + "{ |
| 4638 | + if (REGNO (operands[0]) == REGNO (operands[3])) |
| 4639 | + { |
| 4640 | + emit_insn (gen_mulsi3_extended (operands[4], operands[1], operands[2])); |
| 4641 | + emit_insn (gen_addsi3_extended (operands[0], operands[3], operands[4])); |
| 4642 | + } |
| 4643 | + else |
| 4644 | + { |
| 4645 | + emit_insn (gen_mulsi3_extended (operands[0], operands[1], operands[2])); |
| 4646 | + emit_insn (gen_addsi3_extended (operands[0], operands[0], operands[3])); |
| 4647 | + } |
| 4648 | + DONE; |
| 4649 | + }" |
| 4650 | + [(set_attr "type" "imul_fused")]) |
| 4651 | + |
| 4652 | +(define_insn_and_split "*zero_extract_fused" |
| 4653 | + [(set (match_operand:SI 0 "register_operand" "=r") |
| 4654 | + (zero_extract:SI (match_operand:SI 1 "register_operand" "r") |
| 4655 | + (match_operand 2 "const_int_operand") |
| 4656 | + (match_operand 3 "const_int_operand")))] |
| 4657 | + "TARGET_ARCV_RHX100 && !TARGET_64BIT |
| 4658 | + && (INTVAL (operands[2]) > 1 || !TARGET_ZBS)" |
| 4659 | + "#" |
| 4660 | + "&& reload_completed" |
| 4661 | + [(set (match_dup 0) (ashift:SI (match_dup 1) (match_dup 2))) |
| 4662 | + (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 3)))] |
| 4663 | + "{ |
| 4664 | + int amount = INTVAL (operands[2]); |
| 4665 | + int end = INTVAL (operands[3]) + amount; |
| 4666 | + operands[2] = GEN_INT (BITS_PER_WORD - end); |
| 4667 | + operands[3] = GEN_INT (BITS_PER_WORD - amount); |
| 4668 | + }" |
| 4669 | + [(set_attr "type" "alu_fused")]) |
| 4670 | + |
4540 | 4671 | ;; String compare with length insn. |
4541 | 4672 | ;; Argument 0 is the target (result) |
4542 | 4673 | ;; Argument 1 is the source1 |
|
0 commit comments