|
4526 | 4526 | (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand")) |
4527 | 4527 | (sign_extend:SI (match_operand:HI 2 "register_operand"))) |
4528 | 4528 | (match_operand:SI 3 "register_operand")))] |
4529 | | - "TARGET_XTHEADMAC" |
| 4529 | + "TARGET_XTHEADMAC || (riscv_is_micro_arch (arcv_rhx100) |
| 4530 | + && !TARGET_64BIT && (TARGET_ZMMUL || TARGET_MUL))" |
| 4531 | + { |
| 4532 | + if (riscv_is_micro_arch (arcv_rhx100)) |
| 4533 | + { |
| 4534 | + rtx tmp0 = gen_reg_rtx (SImode), tmp1 = gen_reg_rtx (SImode); |
| 4535 | + emit_insn (gen_extendhisi2 (tmp0, operands[1])); |
| 4536 | + emit_insn (gen_extendhisi2 (tmp1, operands[2])); |
| 4537 | + emit_insn (gen_madd_split_fused (operands[0], tmp0, tmp1, operands[3])); |
| 4538 | + DONE; |
| 4539 | + } |
| 4540 | + } |
| 4541 | +) |
| 4542 | + |
| 4543 | +(define_expand "umaddhisi4" |
| 4544 | + [(set (match_operand:SI 0 "register_operand") |
| 4545 | + (plus:SI |
| 4546 | + (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand")) |
| 4547 | + (zero_extend:SI (match_operand:HI 2 "register_operand"))) |
| 4548 | + (match_operand:SI 3 "register_operand")))] |
| 4549 | + "riscv_is_micro_arch (arcv_rhx100) |
| 4550 | + && !TARGET_64BIT && (TARGET_ZMMUL || TARGET_MUL)" |
| 4551 | + { |
| 4552 | + rtx tmp0 = gen_reg_rtx (SImode), tmp1 = gen_reg_rtx (SImode); |
| 4553 | + emit_insn (gen_zero_extendhisi2 (tmp0, operands[1])); |
| 4554 | + emit_insn (gen_zero_extendhisi2 (tmp1, operands[2])); |
| 4555 | + emit_insn (gen_madd_split (operands[0], tmp0, tmp1, operands[3])); |
| 4556 | + DONE; |
| 4557 | + } |
4530 | 4558 | ) |
4531 | 4559 |
|
4532 | 4560 | (define_expand "msubhisi4" |
|
4538 | 4566 | "TARGET_XTHEADMAC" |
4539 | 4567 | ) |
4540 | 4568 |
|
| 4569 | +(define_insn_and_split "madd_split" |
| 4570 | + [(set (match_operand:SI 0 "register_operand" "=&r,r") |
| 4571 | + (plus:SI |
| 4572 | + (mult:SI (match_operand:SI 1 "register_operand" "r,r") |
| 4573 | + (match_operand:SI 2 "register_operand" "r,r")) |
| 4574 | + (match_operand:SI 3 "register_operand" "r,?0"))) |
| 4575 | + (clobber (match_scratch:SI 4 "=&r,&r"))] |
| 4576 | + "riscv_is_micro_arch (rhx) && !TARGET_64BIT && (TARGET_ZMMUL || TARGET_MUL)" |
| 4577 | + "#" |
| 4578 | + "&& reload_completed" |
| 4579 | + [(const_int 0)] |
| 4580 | + "{ |
| 4581 | + if (REGNO (operands[0]) == REGNO (operands[3])) |
| 4582 | + { |
| 4583 | + emit_insn (gen_mulsi3 (operands[4], operands[1], operands[2])); |
| 4584 | + emit_insn (gen_addsi3 (operands[0], operands[3], operands[4])); |
| 4585 | + } |
| 4586 | + else |
| 4587 | + { |
| 4588 | + emit_insn (gen_mulsi3 (operands[0], operands[1], operands[2])); |
| 4589 | + emit_insn (gen_addsi3 (operands[0], operands[0], operands[3])); |
| 4590 | + } |
| 4591 | + DONE; |
| 4592 | + }" |
| 4593 | + [(set_attr "type" "imul")] |
| 4594 | +) |
| 4595 | + |
4541 | 4596 | ;; String compare with length insn. |
4542 | 4597 | ;; Argument 0 is the target (result) |
4543 | 4598 | ;; Argument 1 is the source1 |
|
0 commit comments