[vector] cast/rehsape intrinsics <was> Re: [vector] reshape/cast using species

Paul Sandoz paul.sandoz at oracle.com
Wed Feb 28 18:26:08 UTC 2018


Hi Razvan, Vladimir,

Are you ok if i push this patch leaving behind some intrinsics to be cleaned up to operate on species:

do_intrinsic(_VectorMaskRebracket, jdk_incubator_vector_VectorMask, rebracket_method_name, vector_mask_rebracket_sig, F_R)                  \
do_intrinsic(_VectorRebracket, jdk_incubator_vector_Vector, rebracket_method_name, vector_cast_sig, F_R)                                    \

?

Perhaps we need to push casts/reshape down into VectorIntrinsics? For example:
 
static <V, W> W cast(Class<? extends V> vectorClassOut, Class<?> elementTypeOut, int vlenOut,
                     Class<? extends V> vectorClassIn, Class<?> elementTypeIn, int vlenIn,
                     V vIn,
                     Function<V, W> defaultImpl) {
    throw new UnsupportedOperationException();
}

static <V, W> W reshape(Class<? extends V> vectorClassOut, Class<?> elementTypeOut, int vlenOut,
                     Class<? extends V> vectorClassIn, Class<?> elementTypeIn, int vlenIn,
                     V vIn,
                     Function<V, W> defaultImpl) {
    throw new UnsupportedOperationException();
}
 
Same applies to Mask (and possibly Shuffle), which this method might cove with a rename of the vector parameters?

Paul.


> On Feb 27, 2018, at 5:03 PM, Paul Sandoz <Paul.Sandoz at oracle.com> wrote:
> 
> Hi,
> 
> I think it makes more sense to move the reshape and cast functionality from Vector to species, and then to preserve the fluent nature of the API add methods to Vector that accept a species and defer to the species method. Same applies to Mask and Shuffle.
> 
>  http://cr.openjdk.java.net/~psandoz/panama/species-reshape-cast/webrev/index.html
> 
> 
> I left some commented out methods that are intrinsic as a reminder this needs to be looked at:
> 
> 139 //    //Costless vector cast.  Bit-wise contents preserved
> 140 //    @HotSpotIntrinsicCandidate
> 141 //    default <F> Vector<F, S> rebracket(Class<F> type) { return reshape(type, shape());}
> 142 
> 
> 468 //#if[float]
> 469 //    @HotSpotIntrinsicCandidate
> 470 //#end[float]
> 471 //    @Override
> 472 //    public <F> Vector<F,S> cast(Class<F> type) {
> 473 //        return cast(type, shape());
> 474 //    }
> 
> I’ll need some guidance with respect preserving hotspot intrinsic behavior for the newly added methods on species.
> 
> I’ll add some combo test later.
> 
> Thanks,
> Paul.



More information about the panama-dev mailing list