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 [v7]

2025-06-06 Thread erifan
On Fri, 6 Jun 2025 07:01:58 GMT, erifan wrote: > > > Oh I think we still cannot use `BoolTest::negate`, because we cannot > > > instantiate a `BoolTest` object with **unsigned** comparison. > > > `BoolTest::negate` is a non-static function. > > > > > > I see. Ok. Hmm. I still think that the l

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

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

2025-06-06 Thread erifan
On Thu, 5 Jun 2025 11:05:48 GMT, Emanuel Peter wrote: > > Oh I think we still cannot use `BoolTest::negate`, because we cannot > > instantiate a `BoolTest` object with **unsigned** comparison. > > `BoolTest::negate` is a non-static function. > > I see. Ok. Hmm. I still think that the logic sho

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

2025-06-05 Thread Emanuel Peter
On Thu, 5 Jun 2025 09:48:46 GMT, erifan wrote: > Oh I think we still cannot use `BoolTest::negate`, because we cannot > instantiate a `BoolTest` object with **unsigned** comparison. > `BoolTest::negate` is a non-static function. I see. Ok. Hmm. I still think that the logic should be in `BoolTe

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

2025-06-05 Thread erifan
On Thu, 5 Jun 2025 09:24:10 GMT, Emanuel Peter wrote: > FYI: `BoolTest::negate` already does what you want: `mask negate( ) const { > return mask(_test^4); }` I think you should use that instead :) Indeed, I hadn't noticed that, thank you. - PR Comment: https://git.openjdk.org/jdk

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

2025-06-05 Thread erifan
On Wed, 28 May 2025 12:18:15 GMT, Emanuel Peter wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains 10 additional commits since >>

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

2025-06-05 Thread erifan
On Thu, 29 May 2025 01:44:49 GMT, Xiaohong Gong wrote: >> test/micro/org/openjdk/bench/jdk/incubator/vector/MaskCompareNotBenchmark.java >> line 49: >> >>> 47: private static final VectorSpecies L_SPECIES = >>> LongVector.SPECIES_MAX; >>> 48: private static final VectorSpecies F_SPECIE

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

2025-06-05 Thread erifan
On Thu, 5 Jun 2025 09:32:15 GMT, erifan wrote: > > FYI: `BoolTest::negate` already does what you want: `mask negate( ) const { > > return mask(_test^4); }` I think you should use that instead :) > > Indeed, I hadn't noticed that, thank you. Oh I think we still cannot use `BoolTest::negate`, be

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

2025-06-05 Thread erifan
On Wed, 28 May 2025 12:28:20 GMT, Emanuel Peter wrote: >> test/hotspot/jtreg/compiler/vectorapi/VectorMaskCompareNotTest.java line 237: >> >>> 235: // Byte tests >>> 236: @Test >>> 237: @IR(counts = { IRNode.XOR_V_MASK, "= 0", IRNode.XOR_VB, "= 0" }, >> >> Could you still assert the

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

2025-06-05 Thread Emanuel Peter
On Thu, 5 Jun 2025 09:12:30 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 [v6]

2025-06-05 Thread erifan
On Thu, 29 May 2025 07:55:06 GMT, erifan wrote: >> Also: You now cast `(VectorMaskCmpNode*) in1` twice. Can we not do >> `as_VectorMaskCmp()`? Or could we at least cast it only once, and then use >> it as `in1_mask_cmp` instead? > >> What is the hard-coded ^ 4 here? > > This is to negate the c

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

2025-06-05 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

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

2025-06-05 Thread erifan
On Thu, 29 May 2025 08:00:05 GMT, erifan wrote: >> src/hotspot/share/opto/vectornode.cpp line 2233: >> >>> 2231: if (in2->Opcode() == Op_VectorMaskCast) { >>> 2232: in2 = in2->in(1); >>> 2233: } >> >> Wow, this seems to be an addition that is not covered in the patterns you >> mention

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

2025-06-05 Thread erifan
On Wed, 28 May 2025 12:03:48 GMT, Emanuel Peter wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains 10 additional commits since >>

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

2025-05-29 Thread erifan
On Wed, 28 May 2025 12:12:50 GMT, Emanuel Peter wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains 10 additional commits since >>

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

2025-05-29 Thread erifan
On Fri, 16 May 2025 07:40:53 GMT, erifan wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains 10 additional commits since >> the las

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

2025-05-29 Thread erifan
On Wed, 28 May 2025 12:16:23 GMT, Emanuel Peter wrote: >> src/hotspot/share/opto/vectornode.cpp line 2244: >> >>> 2242: // BoolTest doesn't support unsigned comparisons. >>> 2243: BoolTest::mask neg_cond = >>> 2244: (BoolTest::mask) (((VectorMaskCmpNode*) in1)->get_predicate() ^ >>> 4

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

2025-05-28 Thread Xiaohong Gong
On Wed, 28 May 2025 12:26:31 GMT, Emanuel Peter wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains 10 additional commits since >>

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

2025-05-28 Thread Emanuel Peter
On Wed, 14 May 2025 02:44:14 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)) >> => (VectorMa

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

2025-05-28 Thread Emanuel Peter
On Wed, 28 May 2025 12:14:56 GMT, Emanuel Peter wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains 10 additional commits since >>

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

2025-05-16 Thread erifan
On Wed, 14 May 2025 02:44:14 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)) >> => (VectorMa

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

2025-05-13 Thread erifan
On Wed, 7 May 2025 11:13:23 GMT, Jatin Bhateja wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains eight additional commits >> sinc

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

2025-05-13 Thread erifan
On Fri, 9 May 2025 09:37:22 GMT, erifan wrote: >> Yes, converting `VectorMask.fromLong(SPECIES, -1L)` to `MaskAll()` would be >> better, and that will benefit AArch64 as well, since `MaskAll()` is much >> more cheaper than `fromLong()` on AArch64. We can add such a transformation >> with anoth

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

2025-05-13 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

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

2025-05-09 Thread erifan
On Thu, 8 May 2025 01:49:45 GMT, Xiaohong Gong wrote: >> Yes, that's the right approach. For this PR, I think you can mix some test >> points covering compare, xor(maskAll(true)). > > Yes, converting `VectorMask.fromLong(SPECIES, -1L)` to `MaskAll()` would be > better, and that will benefit AAr

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

2025-05-09 Thread erifan
On Wed, 7 May 2025 02:10:56 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 [v5]

2025-05-07 Thread Xiaohong Gong
On Wed, 7 May 2025 11:02:43 GMT, Jatin Bhateja wrote: >> Hi @jatin-bhateja It is feasible. But I was thinking about whether another >> solution would be better, which is to turn `VectorMask.fromLong(SPECIES, >> -1L)` into `MaskAll(true)` in the mid-end. In this way, we don't need to >> check

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

2025-05-07 Thread Jatin Bhateja
On Wed, 7 May 2025 02:10:56 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 [v5]

2025-05-07 Thread Jatin Bhateja
On Wed, 7 May 2025 10:24:14 GMT, erifan wrote: >> src/hotspot/share/opto/vectornode.cpp line 2231: >> >>> 2229: } >>> 2230: if (in1->Opcode() != Op_VectorMaskCmp || in1->outcnt() > 1 || >>> 2231: !((VectorMaskCmpNode*) in1)->predicate_can_be_inverted() || >> >> Do you plan to extend

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

2025-05-07 Thread Jatin Bhateja
On Fri, 25 Apr 2025 09:17:02 GMT, Jatin Bhateja wrote: >> Thanks for telling me this information. Another more important reason to >> check outcnt here is to prevent this optimization when the uses of >> VectorMaskCmp is greater than 1, because this optimization may not be >> worthwhile. For e

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

2025-05-07 Thread erifan
On Wed, 7 May 2025 06:59:34 GMT, Jatin Bhateja wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains eight additional commits >> sinc

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

2025-05-07 Thread erifan
On Wed, 7 May 2025 06:59:34 GMT, Jatin Bhateja wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains eight additional commits >> sinc

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

2025-05-07 Thread Jatin Bhateja
On Wed, 7 May 2025 02:10:56 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 [v4]

2025-05-06 Thread erifan
On Fri, 2 May 2025 06:14:33 GMT, Emanuel Peter wrote: >> src/hotspot/share/opto/vectornode.cpp line 2216: >> >>> 2214: in2->is_predicated_vector()) { >>> 2215: with_predicated = true; >>> 2216: } >> >> Suggestion: >> >> bool with_predicated = is_predicated_vector() || >>

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

2025-05-06 Thread erifan
On Fri, 2 May 2025 06:16:03 GMT, Emanuel Peter wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains six additional commits since >>

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

2025-05-06 Thread erifan
On Thu, 1 May 2025 07:32:22 GMT, erifan wrote: >> Yes, this discussion is down to `requires` vs `applyIf`. This is my argument >> for `applyIf`, quoted from above, I have not yet seen an argument against it: >> >>> If you use @require, then the person does not realize there is a test AND >>>

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

2025-05-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

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

2025-05-01 Thread Emanuel Peter
On Fri, 2 May 2025 06:14:19 GMT, Emanuel Peter wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains six additional commits since >>

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

2025-05-01 Thread erifan
On Tue, 29 Apr 2025 10:22:22 GMT, Emanuel Peter wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains four additional commits since >

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

2025-05-01 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

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

2025-04-29 Thread erifan
On Tue, 29 Apr 2025 10:22:22 GMT, Emanuel Peter wrote: > Yes, this discussion is down to `requires` vs `applyIf`. This is my argument > for `applyIf`, quoted from above, I have not yet seen an argument against it: > > > If you use @require, then the person does not realize there is a test AND

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

2025-04-29 Thread Emanuel Peter
On Fri, 25 Apr 2025 07:24:15 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)) >> => (VectorMa

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

2025-04-28 Thread erifan
On Mon, 28 Apr 2025 14:13:43 GMT, Emanuel Peter wrote: > > > > > Just a drive-by comment for now, I may review this later more fully. > > > > > > I would also prefer if you added the IR restrictions rather than > > > > > > the JTREG requires. > > > > > > The benefit is that we can still run the

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

2025-04-28 Thread erifan
On Mon, 28 Apr 2025 14:12:02 GMT, Emanuel Peter wrote: > I suppose in that case you can assert that you NEVER get those nodes, because > if you have vectors not supported, they will not show up because of that, and > if you do support vectors, they should be optimized away. This is expected.

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

2025-04-28 Thread erifan
On Mon, 28 Apr 2025 14:10:40 GMT, Emanuel Peter wrote: >> test/hotspot/jtreg/compiler/vectorapi/VectorMaskCompareNotTest.java line 237: >> >>> 235: public static void testCompareEQMaskNotByte() { >>> 236: testCompareMaskNotByte(VectorOperators.EQ); >>> 237: } >> >> Another comme

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

2025-04-28 Thread Emanuel Peter
On Mon, 28 Apr 2025 14:06:49 GMT, Emanuel Peter wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains four additional commits since >

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

2025-04-28 Thread Emanuel Peter
On Mon, 28 Apr 2025 07:46:14 GMT, erifan wrote: >> I would also prefer if you added the IR restrictions rather than the JTREG >> requires. >> The benefit is that we can still run the tests on all platforms, at least >> for result verification. >> >> Imagine someone adds optimizations to a new

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

2025-04-28 Thread Emanuel Peter
On Mon, 28 Apr 2025 09:51:10 GMT, erifan wrote: > > > > Just a drive-by comment for now, I may review this later more fully. > > > > > I would also prefer if you added the IR restrictions rather than the > > > > > JTREG requires. > > > > > The benefit is that we can still run the tests on all pl

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

2025-04-28 Thread Emanuel Peter
On Fri, 25 Apr 2025 07:24:15 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)) >> => (VectorMa

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

2025-04-28 Thread erifan
On Mon, 28 Apr 2025 09:17:58 GMT, Emanuel Peter wrote: > > > Just a drive-by comment for now, I may review this later more fully. > > > > I would also prefer if you added the IR restrictions rather than the > > > > JTREG requires. > > > > The benefit is that we can still run the tests on all pla

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

2025-04-28 Thread Emanuel Peter
On Mon, 28 Apr 2025 07:48:58 GMT, erifan wrote: > > Just a drive-by comment for now, I may review this later more fully. > > > I would also prefer if you added the IR restrictions rather than the > > > JTREG requires. > > > The benefit is that we can still run the tests on all platforms, at leas

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

2025-04-28 Thread erifan
On Mon, 28 Apr 2025 06:45:58 GMT, Emanuel Peter wrote: >> This is not specifically required on x86, but because this test fails on x86 >> when `-XX:UseAVX=0` is specified. When `-XX:UseAVX=0` is specified, the >> sub-graph is like this: >> `(XorV (VectorMaskCmp (LoadVector ...)) (Replicate -1))

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

2025-04-28 Thread erifan
On Mon, 28 Apr 2025 06:47:38 GMT, Emanuel Peter wrote: > Just a drive-by comment for now, I may review this later more fully. > > > I would also prefer if you added the IR restrictions rather than the JTREG > > requires. > > The benefit is that we can still run the tests on all platforms, at le

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

2025-04-27 Thread Emanuel Peter
On Sun, 27 Apr 2025 10:09:48 GMT, erifan wrote: >> I don't see XorVMask implemented on all non-x86 target, like PPC etc.. > > This is not specifically required on x86, but because this test fails on x86 > when `-XX:UseAVX=0` is specified. When `-XX:UseAVX=0` is specified, the > sub-graph is lik

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

2025-04-27 Thread Emanuel Peter
On Fri, 25 Apr 2025 07:24:15 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)) >> => (VectorMa

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

2025-04-27 Thread erifan
On Fri, 25 Apr 2025 09:48:59 GMT, Jatin Bhateja wrote: >> Since this is a platform independent optimization, I tend to use this >> `@requires` because it's simpler. If we use `applyIfCPUFeatureOr`, we need >> to add the same restriction before each test. In addition, if a new >> architecture

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

2025-04-25 Thread Jatin Bhateja
On Thu, 24 Apr 2025 08:57:14 GMT, erifan wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains two additional commits since >> the la

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

2025-04-25 Thread Jatin Bhateja
On Thu, 24 Apr 2025 09:46:24 GMT, erifan wrote: >> test/hotspot/jtreg/compiler/vectorapi/VectorMaskCompareNotTest.java line 38: >> >>> 36: * @summary test combining vector not operation with compare >>> 37: * @modules jdk.incubator.vector >>> 38: * @requires ((os.arch!="x86" & os.arch!="i386"

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

2025-04-25 Thread Jatin Bhateja
On Thu, 24 Apr 2025 09:37:07 GMT, erifan wrote: >> src/hotspot/share/opto/vectornode.cpp line 2243: >> >>> 2241: in1 = in1->in(1); >>> 2242: } >>> 2243: if (in1->Opcode() != Op_VectorMaskCmp || in1->outcnt() > 1 || >> >> Checks on outcnt on line 2243 and 2238 can be removed. Idealizatio

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

2025-04-25 Thread erifan
On Thu, 24 Apr 2025 10:28:15 GMT, Andrew Haley wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains two additional commits since >>

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

2025-04-25 Thread erifan
On Thu, 24 Apr 2025 09:39:58 GMT, erifan wrote: >> src/hotspot/share/opto/vectornode.cpp line 2265: >> >>> 2263: vmcmp = new VectorMaskCastNode(phase->transform(vmcmp), >>> vmcast_vt); >>> 2264: } >>> 2265: return vmcmp; >> >> It would be preferable if you could kindly re-factor the co

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

2025-04-25 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

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

2025-04-24 Thread Andrew Haley
On Fri, 18 Apr 2025 01:36:10 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)) >> => (VectorMa

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

2025-04-24 Thread erifan
On Wed, 23 Apr 2025 12:09:51 GMT, Jatin Bhateja wrote: >> erifan has updated the pull request with a new target base due to a merge or >> a rebase. The incremental webrev excludes the unrelated changes brought in >> by the merge/rebase. The pull request contains two additional commits since >>

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

2025-04-24 Thread erifan
On Fri, 18 Apr 2025 01:36:10 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)) >> => (VectorMa

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

2025-04-23 Thread Jatin Bhateja
On Fri, 18 Apr 2025 01:36:10 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)) >> => (VectorMa

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

2025-04-23 Thread Jatin Bhateja
On Fri, 18 Apr 2025 01:36:10 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)) >> => (VectorMa

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

2025-04-17 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

RFR: 8354242: VectorAPI: combine vector not operation with compare

2025-04-15 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, lt, gt, ule, uge, u