|
2 | 2 | // Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
|
3 | 3 | // Copyright (c) 2020, 2023, Arm Limited. All rights reserved.
|
4 | 4 | // Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
|
| 5 | +// Copyright (c) 2023, 2025, Rivos Inc. All rights reserved. |
5 | 6 | // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
6 | 7 | //
|
7 | 8 | // This code is free software; you can redistribute it and/or modify it
|
@@ -99,6 +100,12 @@ source %{
|
99 | 100 | return false;
|
100 | 101 | }
|
101 | 102 | break;
|
| 103 | + case Op_MulReductionVI: |
| 104 | + case Op_MulReductionVL: |
| 105 | + // When vlen < 4, our log2(vlen) implementation does not help to gain performance improvement. |
| 106 | + if (vlen < 4) { |
| 107 | + return false; |
| 108 | + } |
102 | 109 | default:
|
103 | 110 | break;
|
104 | 111 | }
|
@@ -2427,6 +2434,67 @@ instruct vreduce_minD_masked(fRegD dst, fRegD src1, vReg src2, vRegMask_V0 v0, v
|
2427 | 2434 | ins_pipe(pipe_slow);
|
2428 | 2435 | %}
|
2429 | 2436 |
|
| 2437 | + |
| 2438 | +// ------------------------------ Vector reduction mul ------------------------- |
| 2439 | + |
| 2440 | +instruct reduce_mulI(iRegINoSp dst, iRegIorL2I isrc, vReg vsrc, |
| 2441 | + vReg tmp1, vReg tmp2) %{ |
| 2442 | + match(Set dst (MulReductionVI isrc vsrc)); |
| 2443 | + effect(TEMP_DEF dst, TEMP tmp1, TEMP tmp2); |
| 2444 | + format %{ "reduce_mulI $dst, $isrc, $vsrc\t" %} |
| 2445 | + |
| 2446 | + ins_encode %{ |
| 2447 | + __ reduce_mul_integral_v($dst$$Register, $isrc$$Register, as_VectorRegister($vsrc$$reg), |
| 2448 | + as_VectorRegister($tmp1$$reg), as_VectorRegister($tmp2$$reg), |
| 2449 | + Matcher::vector_element_basic_type(this, $vsrc), Matcher::vector_length(this, $vsrc)); |
| 2450 | + %} |
| 2451 | + ins_pipe(pipe_slow); |
| 2452 | +%} |
| 2453 | + |
| 2454 | +instruct reduce_mulI_masked(iRegINoSp dst, iRegIorL2I isrc, vReg vsrc, |
| 2455 | + vRegMask_V0 v0, vReg tmp1, vReg tmp2) %{ |
| 2456 | + match(Set dst (MulReductionVI (Binary isrc vsrc) v0)); |
| 2457 | + effect(TEMP_DEF dst, TEMP tmp1, TEMP tmp2); |
| 2458 | + format %{ "reduce_mulI_masked $dst, $isrc, $vsrc, $v0\t" %} |
| 2459 | + |
| 2460 | + ins_encode %{ |
| 2461 | + __ reduce_mul_integral_v($dst$$Register, $isrc$$Register, as_VectorRegister($vsrc$$reg), |
| 2462 | + as_VectorRegister($tmp1$$reg), as_VectorRegister($tmp2$$reg), |
| 2463 | + Matcher::vector_element_basic_type(this, $vsrc), Matcher::vector_length(this, $vsrc), |
| 2464 | + Assembler::v0_t); |
| 2465 | + %} |
| 2466 | + ins_pipe(pipe_slow); |
| 2467 | +%} |
| 2468 | + |
| 2469 | +instruct reduce_mulL(iRegLNoSp dst, iRegL isrc, vReg vsrc, |
| 2470 | + vReg tmp1, vReg tmp2) %{ |
| 2471 | + match(Set dst (MulReductionVL isrc vsrc)); |
| 2472 | + effect(TEMP_DEF dst, TEMP tmp1, TEMP tmp2); |
| 2473 | + format %{ "reduce_mulL $dst, $isrc, $vsrc\t" %} |
| 2474 | + |
| 2475 | + ins_encode %{ |
| 2476 | + __ reduce_mul_integral_v($dst$$Register, $isrc$$Register, as_VectorRegister($vsrc$$reg), |
| 2477 | + as_VectorRegister($tmp1$$reg), as_VectorRegister($tmp2$$reg), |
| 2478 | + Matcher::vector_element_basic_type(this, $vsrc), Matcher::vector_length(this, $vsrc)); |
| 2479 | + %} |
| 2480 | + ins_pipe(pipe_slow); |
| 2481 | +%} |
| 2482 | + |
| 2483 | +instruct reduce_mulL_masked(iRegLNoSp dst, iRegL isrc, vReg vsrc, |
| 2484 | + vRegMask_V0 v0, vReg tmp1, vReg tmp2) %{ |
| 2485 | + match(Set dst (MulReductionVL (Binary isrc vsrc) v0)); |
| 2486 | + effect(TEMP_DEF dst, TEMP tmp1, TEMP tmp2); |
| 2487 | + format %{ "reduce_mulL_masked $dst, $isrc, $vsrc, $v0\t" %} |
| 2488 | + |
| 2489 | + ins_encode %{ |
| 2490 | + __ reduce_mul_integral_v($dst$$Register, $isrc$$Register, as_VectorRegister($vsrc$$reg), |
| 2491 | + as_VectorRegister($tmp1$$reg), as_VectorRegister($tmp2$$reg), |
| 2492 | + Matcher::vector_element_basic_type(this, $vsrc), Matcher::vector_length(this, $vsrc), |
| 2493 | + Assembler::v0_t); |
| 2494 | + %} |
| 2495 | + ins_pipe(pipe_slow); |
| 2496 | +%} |
| 2497 | + |
2430 | 2498 | // vector replicate
|
2431 | 2499 |
|
2432 | 2500 | instruct replicate(vReg dst, iRegIorL2I src) %{
|
|
0 commit comments