Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-25 Thread erifan
On Wed, 11 Jun 2025 09:09:57 GMT, erifan wrote: >> src/hotspot/share/opto/vectornode.cpp line 2221: >> >>> 2219: // XorV/XorVMask is commutative, swap VectorMaskCmp/VectorMaskCast >>> to in1. >>> 2220: if (in2->Opcode() == Op_VectorMaskCmp || >>> 2221: (in2->Opcode() == Op_VectorMaskC

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-25 Thread erifan
On Wed, 11 Jun 2025 09:07:12 GMT, erifan wrote: >> Oh. Ok. Well at least add a `RuntimeException` to an `else` branch then, I >> would suggest :) > > Make sense! Done >>> > You are checking IRNode.XOR_VL, "= 0". But you are comparing floats. Does >>> > that make sense? >> >>> The bottom type

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-25 Thread erifan
On Wed, 11 Jun 2025 05:09:34 GMT, Emanuel Peter wrote: >> src/hotspot/share/opto/vectornode.cpp line 2227: >> >>> 2225: const TypeVect* vector_mask_cast_vt = nullptr; >>> 2226: // in1 should be single used, otherwise the optimization may be >>> unprofitable. >>> 2227: if (in1->Opcode() ==

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-25 Thread erifan
On Wed, 11 Jun 2025 08:51:50 GMT, Xiaohong Gong wrote: >> erifan has updated the pull request incrementally with one additional commit >> since the last revision: >> >> Support negating unsigned comparison for BoolTest::mask >> >> Added a static method `negate_mask(mask btm)` into BoolTe

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-25 Thread erifan
On Wed, 11 Jun 2025 04:56:36 GMT, Emanuel Peter wrote: >> erifan has updated the pull request incrementally with one additional commit >> since the last revision: >> >> Support negating unsigned comparison for BoolTest::mask >> >> Added a static method `negate_mask(mask btm)` into BoolTe

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-11 Thread Xiaohong Gong
On Fri, 6 Jun 2025 10:38:11 GMT, erifan wrote: >> This patch optimizes the following patterns: >> For integer types: >> >> (XorV (VectorMaskCmp src1 src2 cond) (Replicate -1)) >> => (VectorMaskCmp src1 src2 ncond) >> (XorVMask (VectorMaskCmp src1 src2 cond) (MaskAll m1)) >> => (VectorMas

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-11 Thread erifan
On Wed, 11 Jun 2025 08:47:56 GMT, Xiaohong Gong wrote: >> erifan has updated the pull request incrementally with one additional commit >> since the last revision: >> >> Support negating unsigned comparison for BoolTest::mask >> >> Added a static method `negate_mask(mask btm)` into BoolTe

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-11 Thread erifan
On Wed, 11 Jun 2025 07:43:55 GMT, Emanuel Peter wrote: >> `VectorOperators.XXX` is not compile time constants, we can't use `switch` >> here. > > Oh. Ok. Well at least add a `RuntimeException` to an `else` branch then, I > would suggest :) Make sense! - PR Review Comment: https:/

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-11 Thread erifan
On Wed, 11 Jun 2025 08:30:51 GMT, Emanuel Peter wrote: >>> You are checking IRNode.XOR_VL, "= 0". But you are comparing floats. Does >>> that make sense? >> >> The bottom types of `float` and `double` vector masks are casted to `int` >> and `long`. Seems this is by design? So this is correct.

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-11 Thread Emanuel Peter
On Wed, 11 Jun 2025 08:20:20 GMT, erifan wrote: > > You are checking IRNode.XOR_VL, "= 0". But you are comparing floats. Does > > that make sense? > The bottom types of float and double vector masks are casted to int and long. > Seems this is by design? So this is correct. This is a `float` t

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-11 Thread erifan
On Wed, 11 Jun 2025 05:31:00 GMT, Emanuel Peter wrote: > You are checking IRNode.XOR_VL, "= 0". But you are comparing floats. Does > that make sense? The bottom types of `float` and `double` vector masks are casted to `int` and `long`. Seems this is by design? So this is correct. As for `cont

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-11 Thread Emanuel Peter
On Wed, 11 Jun 2025 07:31:48 GMT, erifan wrote: >> test/hotspot/jtreg/compiler/vectorapi/VectorMaskCompareNotTest.java line 158: >> >>> 156: } else if (op == VectorOperators.UGT) { >>> 157: Asserts.assertEquals(compareUnsigned(a, b) <= 0, r); >>> 158: } >> >> Please

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-11 Thread erifan
On Wed, 11 Jun 2025 05:23:12 GMT, Emanuel Peter wrote: >> erifan has updated the pull request incrementally with one additional commit >> since the last revision: >> >> Support negating unsigned comparison for BoolTest::mask >> >> Added a static method `negate_mask(mask btm)` into BoolTe

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-10 Thread Emanuel Peter
On Wed, 11 Jun 2025 05:08:35 GMT, Emanuel Peter wrote: >> erifan has updated the pull request incrementally with one additional commit >> since the last revision: >> >> Support negating unsigned comparison for BoolTest::mask >> >> Added a static method `negate_mask(mask btm)` into BoolTe

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-10 Thread Emanuel Peter
On Fri, 6 Jun 2025 10:38:11 GMT, erifan wrote: >> This patch optimizes the following patterns: >> For integer types: >> >> (XorV (VectorMaskCmp src1 src2 cond) (Replicate -1)) >> => (VectorMaskCmp src1 src2 ncond) >> (XorVMask (VectorMaskCmp src1 src2 cond) (MaskAll m1)) >> => (VectorMas

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-10 Thread erifan
On Fri, 6 Jun 2025 10:38:11 GMT, erifan wrote: >> This patch optimizes the following patterns: >> For integer types: >> >> (XorV (VectorMaskCmp src1 src2 cond) (Replicate -1)) >> => (VectorMaskCmp src1 src2 ncond) >> (XorVMask (VectorMaskCmp src1 src2 cond) (MaskAll m1)) >> => (VectorMas

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-09 Thread erifan
On Tue, 10 Jun 2025 02:38:29 GMT, Fei Yang wrote: > FYI: I submitted to testing in QEMU-system / Ubuntu 25.04 (fastdebug jdk > build and 256-bit RVV) and I see `compiler/vectorization`, > `compiler/vectorapi` and `jdk_vector` tests are passing. Thank you very much! - PR Comment:

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-09 Thread Fei Yang
On Fri, 6 Jun 2025 10:38:11 GMT, erifan wrote: >> This patch optimizes the following patterns: >> For integer types: >> >> (XorV (VectorMaskCmp src1 src2 cond) (Replicate -1)) >> => (VectorMaskCmp src1 src2 ncond) >> (XorVMask (VectorMaskCmp src1 src2 cond) (MaskAll m1)) >> => (VectorMas

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-09 Thread erifan
On Fri, 6 Jun 2025 10:38:11 GMT, erifan wrote: >> This patch optimizes the following patterns: >> For integer types: >> >> (XorV (VectorMaskCmp src1 src2 cond) (Replicate -1)) >> => (VectorMaskCmp src1 src2 ncond) >> (XorVMask (VectorMaskCmp src1 src2 cond) (MaskAll m1)) >> => (VectorMas

Re: RFR: 8354242: VectorAPI: combine vector not operation with compare [v8]

2025-06-06 Thread erifan
> This patch optimizes the following patterns: > For integer types: > > (XorV (VectorMaskCmp src1 src2 cond) (Replicate -1)) > => (VectorMaskCmp src1 src2 ncond) > (XorVMask (VectorMaskCmp src1 src2 cond) (MaskAll m1)) > => (VectorMaskCmp src1 src2 ncond) > > cond can be eq, ne, le, ge, l