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