RFR: 8296515: RISC-V: Small refactoring for MaxReductionV/MinReductionV/AddReductionV node implementation [v2]
Yanhong Zhu
yzhu at openjdk.org
Wed Nov 9 06:47:45 UTC 2022
On Wed, 9 Nov 2022 06:32:40 GMT, Yanhong Zhu <yzhu at openjdk.org> wrote:
>> src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp line 1717:
>>
>>> 1715: vredxor_vs(tmp, src2, tmp);
>>> 1716: break;
>>> 1717: case Op_MaxReductionV:
>>
>> We implemented Byte/Short MaxReductionV like this patch before. But there are 2 test cases that failed:
>> jdk/jdk/incubator/vector/ShortMaxVectorTests.java
>> jdk/jdk/incubator/vector/ByteMaxVectorTests.java
>> The reason is that "make_reduction_input" will return INT_MAX for Byte & Short type.
>> Did you meet this problem?
>
>>
>
> I see that this has been fixed in the previous PR 8271515.
> Approved.
> Hi @yhzhu20, thanks for the review! I think this problem was solved in [4e7f606](https://github.com/openjdk/jdk/commit/4e7f606030d67a4f284c375d9c8811f525ae97fd) :
>
> ```diff
> @@ -1105,7 +1145,9 @@ Node* ReductionNode::make_reduction_input(PhaseGVN& gvn, int opc, BasicType bt)
> case Op_MinReductionV:
> switch (bt) {
> case T_BYTE:
> + return gvn.makecon(TypeInt::make(max_jbyte));
> case T_SHORT:
> + return gvn.makecon(TypeInt::make(max_jshort));
> case T_INT:
> return gvn.makecon(TypeInt::MAX);
> case T_LONG:
> @@ -1120,7 +1162,9 @@ Node* ReductionNode::make_reduction_input(PhaseGVN& gvn, int opc, BasicType bt)
> case Op_MaxReductionV:
> switch (bt) {
> case T_BYTE:
> + return gvn.makecon(TypeInt::make(min_jbyte));
> case T_SHORT:
> + return gvn.makecon(TypeInt::make(min_jshort));
> case T_INT:
> return gvn.makecon(TypeInt::MIN);
> case T_LONG:
> ```
>
> The function "make_reduction_input" will return different types for Byte & Short than for int now.
Understood. Thank you.
-------------
PR: https://git.openjdk.org/jdk/pull/11036
More information about the hotspot-dev
mailing list