RFR: 8356760: VectorAPI: Optimize VectorMask.fromLong for all-true/all-false cases [v3]
Jatin Bhateja
jbhateja at openjdk.org
Mon Jul 7 09:07:40 UTC 2025
On Mon, 7 Jul 2025 03:43:44 GMT, erifan <duke at openjdk.org> wrote:
> > > > public static final VectorSpecies FSP = FloatVector.SPECIES_512;
> > > > public static long micro1(long a) {
> > > > long mask = Math.min(-1, Math.max(-1, a));
> > > > return VectorMask.fromLong(FSP, mask).toLong();
> > > > }
> > > > public static long micro2() {
> > > > return FSP.maskAll(true).toLong();
> > > > }
> > >
> > >
> > > With this JMH method we can not see obvious performance improvement, because the hot spots are other instructions. Adding a loop is better.
> >
> >
> > There is no hard and fast rule for the inclusion of a loop in a JMH micro in that case?
>
> You mean adding a loop is not a block, right ?
Yes. If you see gains without loop go for it.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25793#issuecomment-3044086773
More information about the hotspot-compiler-dev
mailing list