|
4502 | 4502 | (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand")) |
4503 | 4503 | (sign_extend:SI (match_operand:HI 2 "register_operand"))) |
4504 | 4504 | (match_operand:SI 3 "register_operand")))] |
4505 | | - "TARGET_XTHEADMAC" |
| 4505 | + "TARGET_XTHEADMAC || (riscv_is_micro_arch (arcv_rhx100) |
| 4506 | + && !TARGET_64BIT && (TARGET_ZMMUL || TARGET_MUL))" |
| 4507 | + { |
| 4508 | + if (riscv_is_micro_arch (arcv_rhx100)) |
| 4509 | + { |
| 4510 | + rtx tmp0 = gen_reg_rtx (SImode), tmp1 = gen_reg_rtx (SImode); |
| 4511 | + emit_insn (gen_extendhisi2 (tmp0, operands[1])); |
| 4512 | + emit_insn (gen_extendhisi2 (tmp1, operands[2])); |
| 4513 | + emit_insn (gen_madd_split_fused (operands[0], tmp0, tmp1, operands[3])); |
| 4514 | + DONE; |
| 4515 | + } |
| 4516 | + } |
| 4517 | +) |
| 4518 | + |
| 4519 | +(define_expand "umaddhisi4" |
| 4520 | + [(set (match_operand:SI 0 "register_operand") |
| 4521 | + (plus:SI |
| 4522 | + (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand")) |
| 4523 | + (zero_extend:SI (match_operand:HI 2 "register_operand"))) |
| 4524 | + (match_operand:SI 3 "register_operand")))] |
| 4525 | + "riscv_is_micro_arch (arcv_rhx100) |
| 4526 | + && !TARGET_64BIT && (TARGET_ZMMUL || TARGET_MUL)" |
| 4527 | + { |
| 4528 | + rtx tmp0 = gen_reg_rtx (SImode), tmp1 = gen_reg_rtx (SImode); |
| 4529 | + emit_insn (gen_zero_extendhisi2 (tmp0, operands[1])); |
| 4530 | + emit_insn (gen_zero_extendhisi2 (tmp1, operands[2])); |
| 4531 | + emit_insn (gen_madd_split (operands[0], tmp0, tmp1, operands[3])); |
| 4532 | + DONE; |
| 4533 | + } |
4506 | 4534 | ) |
4507 | 4535 |
|
4508 | 4536 | (define_expand "msubhisi4" |
|
4514 | 4542 | "TARGET_XTHEADMAC" |
4515 | 4543 | ) |
4516 | 4544 |
|
| 4545 | +(define_insn_and_split "madd_split" |
| 4546 | + [(set (match_operand:SI 0 "register_operand" "=&r,r") |
| 4547 | + (plus:SI |
| 4548 | + (mult:SI (match_operand:SI 1 "register_operand" "r,r") |
| 4549 | + (match_operand:SI 2 "register_operand" "r,r")) |
| 4550 | + (match_operand:SI 3 "register_operand" "r,?0"))) |
| 4551 | + (clobber (match_scratch:SI 4 "=&r,&r"))] |
| 4552 | + "riscv_is_micro_arch (rhx) && !TARGET_64BIT && (TARGET_ZMMUL || TARGET_MUL)" |
| 4553 | + "#" |
| 4554 | + "&& reload_completed" |
| 4555 | + [(const_int 0)] |
| 4556 | + "{ |
| 4557 | + if (REGNO (operands[0]) == REGNO (operands[3])) |
| 4558 | + { |
| 4559 | + emit_insn (gen_mulsi3 (operands[4], operands[1], operands[2])); |
| 4560 | + emit_insn (gen_addsi3 (operands[0], operands[3], operands[4])); |
| 4561 | + } |
| 4562 | + else |
| 4563 | + { |
| 4564 | + emit_insn (gen_mulsi3 (operands[0], operands[1], operands[2])); |
| 4565 | + emit_insn (gen_addsi3 (operands[0], operands[0], operands[3])); |
| 4566 | + } |
| 4567 | + DONE; |
| 4568 | + }" |
| 4569 | + [(set_attr "type" "imul")] |
| 4570 | +) |
| 4571 | + |
4517 | 4572 | ;; String compare with length insn. |
4518 | 4573 | ;; Argument 0 is the target (result) |
4519 | 4574 | ;; Argument 1 is the source1 |
|
0 commit comments