< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorIntrinsics.java

Print this page
rev 49509 : [vector] Intrinsic support for resize


 190         return defaultImpl.apply(v1, v2, m);
 191     }
 192 
 193     /* ============================================================================ */
 194 
 195     interface VectorBroadcastIntOp<V extends Vector<?,?>> {
 196         V apply(V v, int i);
 197     }
 198 
 199     @HotSpotIntrinsicCandidate
 200     static
 201     <V extends Vector<?,?>>
 202     V broadcastInt(int opr, Class<V> vectorClass, Class<?> elementType, int vlen,
 203                    V v, int i,
 204                    VectorBroadcastIntOp<V> defaultImpl) {
 205         return defaultImpl.apply(v, i);
 206     }
 207 
 208     /* ============================================================================ */
 209 
 210     interface VectorRebracketOp<VT, VF> {
 211         VT apply(VF v, Class<?> elementType);
 212     }
 213 
 214     @HotSpotIntrinsicCandidate
 215     static
 216     <VT, VF>
 217     VT rebracket(Class<VF> fromVectorClass, Class<?> fromElementType, int fromVLen,
 218                  Class<?> toElementType, VF v,
 219                  VectorRebracketOp<VT,VF> defaultImpl) {
 220         return defaultImpl.apply(v, toElementType);
 221     }
 222 
 223     /* ============================================================================ */
 224 
 225     @HotSpotIntrinsicCandidate
 226     static <V> V maybeRebox(V v) {
 227         // The fence is added here to avoid memory aliasing problems in C2 between scalar & vector accesses.
 228         // TODO: move the fence generation into C2. Generate only when reboxing is taking place.
 229         U.loadFence();
 230         return v;
 231     }
 232 
 233     /* ============================================================================ */
 234 
 235     static final int VECTOR_ACCESS_OOB_CHECK = Integer.getInteger("jdk.incubator.vector.VECTOR_ACCESS_OOB_CHECK", 2);
 236 
 237     @ForceInline
 238     static int checkIndex(int ix, int length, int vlen) {
 239         switch (VectorIntrinsics.VECTOR_ACCESS_OOB_CHECK) {


 190         return defaultImpl.apply(v1, v2, m);
 191     }
 192 
 193     /* ============================================================================ */
 194 
 195     interface VectorBroadcastIntOp<V extends Vector<?,?>> {
 196         V apply(V v, int i);
 197     }
 198 
 199     @HotSpotIntrinsicCandidate
 200     static
 201     <V extends Vector<?,?>>
 202     V broadcastInt(int opr, Class<V> vectorClass, Class<?> elementType, int vlen,
 203                    V v, int i,
 204                    VectorBroadcastIntOp<V> defaultImpl) {
 205         return defaultImpl.apply(v, i);
 206     }
 207 
 208     /* ============================================================================ */
 209 
 210     interface VectorReinterpretOp<VT, VF> {
 211         VT apply(VF v, Class<?> elementType);
 212     }
 213 
 214     @HotSpotIntrinsicCandidate
 215     static
 216     <VT, VF>
 217     VT reinterpret(Class<VF> fromVectorClass, Class<?> fromElementType, int fromVLen,
 218                    Class<?> toElementType, int toVLen, VF v,
 219                    VectorReinterpretOp<VT,VF> defaultImpl) {
 220         return defaultImpl.apply(v, toElementType);
 221     }
 222 
 223     /* ============================================================================ */
 224 
 225     @HotSpotIntrinsicCandidate
 226     static <V> V maybeRebox(V v) {
 227         // The fence is added here to avoid memory aliasing problems in C2 between scalar & vector accesses.
 228         // TODO: move the fence generation into C2. Generate only when reboxing is taking place.
 229         U.loadFence();
 230         return v;
 231     }
 232 
 233     /* ============================================================================ */
 234 
 235     static final int VECTOR_ACCESS_OOB_CHECK = Integer.getInteger("jdk.incubator.vector.VECTOR_ACCESS_OOB_CHECK", 2);
 236 
 237     @ForceInline
 238     static int checkIndex(int ix, int length, int vlen) {
 239         switch (VectorIntrinsics.VECTOR_ACCESS_OOB_CHECK) {
< prev index next >