1006 0,
1007 (z -> Byte512Mask.FALSE_MASK));
1008 }
1009
1010 @Override
1011 @ForceInline
1012 public Byte512Vector fromArray(byte[] a, int ix) {
1013 Objects.requireNonNull(a);
1014 ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
1015 return (Byte512Vector) VectorIntrinsics.load(Byte512Vector.class, byte.class, LENGTH,
1016 a, ix,
1017 (arr, idx) -> super.fromArray((byte[]) arr, idx));
1018 }
1019
1020 @Override
1021 @ForceInline
1022 public Byte512Vector fromArray(byte[] a, int ax, Mask<Byte, Shapes.S512Bit> m) {
1023 return zero().blend(fromArray(a, ax), m); // TODO: use better default impl: op(m, i -> a[ax + i]);
1024 }
1025
1026 @Override
1027 @ForceInline
1028 @SuppressWarnings("unchecked")
1029 public <F> Byte512Vector rebracket(Vector<F, Shapes.S512Bit> o) {
1030 Objects.requireNonNull(o);
1031 if (o.elementType() == byte.class) {
1032 Byte512Vector so = (Byte512Vector)o;
1033 return VectorIntrinsics.reinterpret(
1034 Byte512Vector.class, byte.class, so.length(),
1035 byte.class, LENGTH, so,
1036 (v, t) -> (Byte512Vector)reshape(v)
1037 );
1038 } else if (o.elementType() == short.class) {
1039 Short512Vector so = (Short512Vector)o;
1040 return VectorIntrinsics.reinterpret(
1041 Short512Vector.class, short.class, so.length(),
1042 byte.class, LENGTH, so,
1043 (v, t) -> (Byte512Vector)reshape(v)
1044 );
1045 } else if (o.elementType() == int.class) {
1054 return VectorIntrinsics.reinterpret(
1055 Long512Vector.class, long.class, so.length(),
1056 byte.class, LENGTH, so,
1057 (v, t) -> (Byte512Vector)reshape(v)
1058 );
1059 } else if (o.elementType() == float.class) {
1060 Float512Vector so = (Float512Vector)o;
1061 return VectorIntrinsics.reinterpret(
1062 Float512Vector.class, float.class, so.length(),
1063 byte.class, LENGTH, so,
1064 (v, t) -> (Byte512Vector)reshape(v)
1065 );
1066 } else if (o.elementType() == double.class) {
1067 Double512Vector so = (Double512Vector)o;
1068 return VectorIntrinsics.reinterpret(
1069 Double512Vector.class, double.class, so.length(),
1070 byte.class, LENGTH, so,
1071 (v, t) -> (Byte512Vector)reshape(v)
1072 );
1073 } else {
1074 throw new InternalError("Unimplemented size");
1075 }
1076 }
1077
1078 @Override
1079 @ForceInline
1080 @SuppressWarnings("unchecked")
1081 public <T extends Shape> Byte512Vector resize(Vector<Byte, T> o) {
1082 Objects.requireNonNull(o);
1083 if (o.bitSize() == 64) {
1084 Byte64Vector so = (Byte64Vector)o;
1085 return VectorIntrinsics.reinterpret(
1086 Byte64Vector.class, byte.class, so.length(),
1087 byte.class, LENGTH, so,
1088 (v, t) -> (Byte512Vector)reshape(v)
1089 );
1090 } else if (o.bitSize() == 128) {
1091 Byte128Vector so = (Byte128Vector)o;
1092 return VectorIntrinsics.reinterpret(
1093 Byte128Vector.class, byte.class, so.length(),
1094 byte.class, LENGTH, so,
|
1006 0,
1007 (z -> Byte512Mask.FALSE_MASK));
1008 }
1009
1010 @Override
1011 @ForceInline
1012 public Byte512Vector fromArray(byte[] a, int ix) {
1013 Objects.requireNonNull(a);
1014 ix = VectorIntrinsics.checkIndex(ix, a.length, LENGTH);
1015 return (Byte512Vector) VectorIntrinsics.load(Byte512Vector.class, byte.class, LENGTH,
1016 a, ix,
1017 (arr, idx) -> super.fromArray((byte[]) arr, idx));
1018 }
1019
1020 @Override
1021 @ForceInline
1022 public Byte512Vector fromArray(byte[] a, int ax, Mask<Byte, Shapes.S512Bit> m) {
1023 return zero().blend(fromArray(a, ax), m); // TODO: use better default impl: op(m, i -> a[ax + i]);
1024 }
1025
1026 @ForceInline
1027 @SuppressWarnings("unchecked")
1028 private <S extends Shape> Byte512Vector castFromByte(ByteVector<S> o) {
1029 if (o.bitSize() == 64) {
1030 Byte64Vector so = (Byte64Vector)o;
1031 return VectorIntrinsics.cast(
1032 Byte64Vector.class, byte.class, so.length(),
1033 byte.class, LENGTH, so,
1034 (v, t) -> (Byte512Vector)super.cast(v)
1035 );
1036 } else if (o.bitSize() == 128) {
1037 Byte128Vector so = (Byte128Vector)o;
1038 return VectorIntrinsics.cast(
1039 Byte128Vector.class, byte.class, so.length(),
1040 byte.class, LENGTH, so,
1041 (v, t) -> (Byte512Vector)super.cast(v)
1042 );
1043 } else if (o.bitSize() == 256) {
1044 Byte256Vector so = (Byte256Vector)o;
1045 return VectorIntrinsics.cast(
1046 Byte256Vector.class, byte.class, so.length(),
1047 byte.class, LENGTH, so,
1048 (v, t) -> (Byte512Vector)super.cast(v)
1049 );
1050 } else if (o.bitSize() == 512) {
1051 Byte512Vector so = (Byte512Vector)o;
1052 return VectorIntrinsics.cast(
1053 Byte512Vector.class, byte.class, so.length(),
1054 byte.class, LENGTH, so,
1055 (v, t) -> (Byte512Vector)super.cast(v)
1056 );
1057 } else {
1058 throw new InternalError("Unimplemented size");
1059 }
1060 }
1061
1062 @ForceInline
1063 @SuppressWarnings("unchecked")
1064 private <S extends Shape> Byte512Vector castFromShort(ShortVector<S> o) {
1065 if (o.bitSize() == 64) {
1066 Short64Vector so = (Short64Vector)o;
1067 return VectorIntrinsics.cast(
1068 Short64Vector.class, short.class, so.length(),
1069 byte.class, LENGTH, so,
1070 (v, t) -> (Byte512Vector)super.cast(v)
1071 );
1072 } else if (o.bitSize() == 128) {
1073 Short128Vector so = (Short128Vector)o;
1074 return VectorIntrinsics.cast(
1075 Short128Vector.class, short.class, so.length(),
1076 byte.class, LENGTH, so,
1077 (v, t) -> (Byte512Vector)super.cast(v)
1078 );
1079 } else if (o.bitSize() == 256) {
1080 Short256Vector so = (Short256Vector)o;
1081 return VectorIntrinsics.cast(
1082 Short256Vector.class, short.class, so.length(),
1083 byte.class, LENGTH, so,
1084 (v, t) -> (Byte512Vector)super.cast(v)
1085 );
1086 } else if (o.bitSize() == 512) {
1087 Short512Vector so = (Short512Vector)o;
1088 return VectorIntrinsics.cast(
1089 Short512Vector.class, short.class, so.length(),
1090 byte.class, LENGTH, so,
1091 (v, t) -> (Byte512Vector)super.cast(v)
1092 );
1093 } else {
1094 throw new InternalError("Unimplemented size");
1095 }
1096 }
1097
1098 @ForceInline
1099 @SuppressWarnings("unchecked")
1100 private <S extends Shape> Byte512Vector castFromInt(IntVector<S> o) {
1101 if (o.bitSize() == 64) {
1102 Int64Vector so = (Int64Vector)o;
1103 return VectorIntrinsics.cast(
1104 Int64Vector.class, int.class, so.length(),
1105 byte.class, LENGTH, so,
1106 (v, t) -> (Byte512Vector)super.cast(v)
1107 );
1108 } else if (o.bitSize() == 128) {
1109 Int128Vector so = (Int128Vector)o;
1110 return VectorIntrinsics.cast(
1111 Int128Vector.class, int.class, so.length(),
1112 byte.class, LENGTH, so,
1113 (v, t) -> (Byte512Vector)super.cast(v)
1114 );
1115 } else if (o.bitSize() == 256) {
1116 Int256Vector so = (Int256Vector)o;
1117 return VectorIntrinsics.cast(
1118 Int256Vector.class, int.class, so.length(),
1119 byte.class, LENGTH, so,
1120 (v, t) -> (Byte512Vector)super.cast(v)
1121 );
1122 } else if (o.bitSize() == 512) {
1123 Int512Vector so = (Int512Vector)o;
1124 return VectorIntrinsics.cast(
1125 Int512Vector.class, int.class, so.length(),
1126 byte.class, LENGTH, so,
1127 (v, t) -> (Byte512Vector)super.cast(v)
1128 );
1129 } else {
1130 throw new InternalError("Unimplemented size");
1131 }
1132 }
1133
1134 @ForceInline
1135 @SuppressWarnings("unchecked")
1136 private <S extends Shape> Byte512Vector castFromLong(LongVector<S> o) {
1137 if (o.bitSize() == 64) {
1138 Long64Vector so = (Long64Vector)o;
1139 return VectorIntrinsics.cast(
1140 Long64Vector.class, long.class, so.length(),
1141 byte.class, LENGTH, so,
1142 (v, t) -> (Byte512Vector)super.cast(v)
1143 );
1144 } else if (o.bitSize() == 128) {
1145 Long128Vector so = (Long128Vector)o;
1146 return VectorIntrinsics.cast(
1147 Long128Vector.class, long.class, so.length(),
1148 byte.class, LENGTH, so,
1149 (v, t) -> (Byte512Vector)super.cast(v)
1150 );
1151 } else if (o.bitSize() == 256) {
1152 Long256Vector so = (Long256Vector)o;
1153 return VectorIntrinsics.cast(
1154 Long256Vector.class, long.class, so.length(),
1155 byte.class, LENGTH, so,
1156 (v, t) -> (Byte512Vector)super.cast(v)
1157 );
1158 } else if (o.bitSize() == 512) {
1159 Long512Vector so = (Long512Vector)o;
1160 return VectorIntrinsics.cast(
1161 Long512Vector.class, long.class, so.length(),
1162 byte.class, LENGTH, so,
1163 (v, t) -> (Byte512Vector)super.cast(v)
1164 );
1165 } else {
1166 throw new InternalError("Unimplemented size");
1167 }
1168 }
1169
1170 @ForceInline
1171 @SuppressWarnings("unchecked")
1172 private <S extends Shape> Byte512Vector castFromFloat(FloatVector<S> o) {
1173 if (o.bitSize() == 64) {
1174 Float64Vector so = (Float64Vector)o;
1175 return VectorIntrinsics.cast(
1176 Float64Vector.class, float.class, so.length(),
1177 byte.class, LENGTH, so,
1178 (v, t) -> (Byte512Vector)super.cast(v)
1179 );
1180 } else if (o.bitSize() == 128) {
1181 Float128Vector so = (Float128Vector)o;
1182 return VectorIntrinsics.cast(
1183 Float128Vector.class, float.class, so.length(),
1184 byte.class, LENGTH, so,
1185 (v, t) -> (Byte512Vector)super.cast(v)
1186 );
1187 } else if (o.bitSize() == 256) {
1188 Float256Vector so = (Float256Vector)o;
1189 return VectorIntrinsics.cast(
1190 Float256Vector.class, float.class, so.length(),
1191 byte.class, LENGTH, so,
1192 (v, t) -> (Byte512Vector)super.cast(v)
1193 );
1194 } else if (o.bitSize() == 512) {
1195 Float512Vector so = (Float512Vector)o;
1196 return VectorIntrinsics.cast(
1197 Float512Vector.class, float.class, so.length(),
1198 byte.class, LENGTH, so,
1199 (v, t) -> (Byte512Vector)super.cast(v)
1200 );
1201 } else {
1202 throw new InternalError("Unimplemented size");
1203 }
1204 }
1205
1206 @ForceInline
1207 @SuppressWarnings("unchecked")
1208 private <S extends Shape> Byte512Vector castFromDouble(DoubleVector<S> o) {
1209 if (o.bitSize() == 64) {
1210 Double64Vector so = (Double64Vector)o;
1211 return VectorIntrinsics.cast(
1212 Double64Vector.class, double.class, so.length(),
1213 byte.class, LENGTH, so,
1214 (v, t) -> (Byte512Vector)super.cast(v)
1215 );
1216 } else if (o.bitSize() == 128) {
1217 Double128Vector so = (Double128Vector)o;
1218 return VectorIntrinsics.cast(
1219 Double128Vector.class, double.class, so.length(),
1220 byte.class, LENGTH, so,
1221 (v, t) -> (Byte512Vector)super.cast(v)
1222 );
1223 } else if (o.bitSize() == 256) {
1224 Double256Vector so = (Double256Vector)o;
1225 return VectorIntrinsics.cast(
1226 Double256Vector.class, double.class, so.length(),
1227 byte.class, LENGTH, so,
1228 (v, t) -> (Byte512Vector)super.cast(v)
1229 );
1230 } else if (o.bitSize() == 512) {
1231 Double512Vector so = (Double512Vector)o;
1232 return VectorIntrinsics.cast(
1233 Double512Vector.class, double.class, so.length(),
1234 byte.class, LENGTH, so,
1235 (v, t) -> (Byte512Vector)super.cast(v)
1236 );
1237 } else {
1238 throw new InternalError("Unimplemented size");
1239 }
1240 }
1241
1242 @Override
1243 @ForceInline
1244 @SuppressWarnings("unchecked")
1245 public <E, S extends Shape> Byte512Vector cast(Vector<E, S> o) {
1246 Objects.requireNonNull(o);
1247 if (o.elementType() == byte.class) {
1248 ByteVector<S> so = (ByteVector<S>)o;
1249 return castFromByte(so);
1250 } else if (o.elementType() == short.class) {
1251 ShortVector<S> so = (ShortVector<S>)o;
1252 return castFromShort(so);
1253 } else if (o.elementType() == int.class) {
1254 IntVector<S> so = (IntVector<S>)o;
1255 return castFromInt(so);
1256 } else if (o.elementType() == long.class) {
1257 LongVector<S> so = (LongVector<S>)o;
1258 return castFromLong(so);
1259 } else if (o.elementType() == float.class) {
1260 FloatVector<S> so = (FloatVector<S>)o;
1261 return castFromFloat(so);
1262 } else if (o.elementType() == double.class) {
1263 DoubleVector<S> so = (DoubleVector<S>)o;
1264 return castFromDouble(so);
1265 } else {
1266 throw new InternalError("Unimplemented type");
1267 }
1268 }
1269
1270 @Override
1271 @ForceInline
1272 @SuppressWarnings("unchecked")
1273 public <F> Byte512Vector rebracket(Vector<F, Shapes.S512Bit> o) {
1274 Objects.requireNonNull(o);
1275 if (o.elementType() == byte.class) {
1276 Byte512Vector so = (Byte512Vector)o;
1277 return VectorIntrinsics.reinterpret(
1278 Byte512Vector.class, byte.class, so.length(),
1279 byte.class, LENGTH, so,
1280 (v, t) -> (Byte512Vector)reshape(v)
1281 );
1282 } else if (o.elementType() == short.class) {
1283 Short512Vector so = (Short512Vector)o;
1284 return VectorIntrinsics.reinterpret(
1285 Short512Vector.class, short.class, so.length(),
1286 byte.class, LENGTH, so,
1287 (v, t) -> (Byte512Vector)reshape(v)
1288 );
1289 } else if (o.elementType() == int.class) {
1298 return VectorIntrinsics.reinterpret(
1299 Long512Vector.class, long.class, so.length(),
1300 byte.class, LENGTH, so,
1301 (v, t) -> (Byte512Vector)reshape(v)
1302 );
1303 } else if (o.elementType() == float.class) {
1304 Float512Vector so = (Float512Vector)o;
1305 return VectorIntrinsics.reinterpret(
1306 Float512Vector.class, float.class, so.length(),
1307 byte.class, LENGTH, so,
1308 (v, t) -> (Byte512Vector)reshape(v)
1309 );
1310 } else if (o.elementType() == double.class) {
1311 Double512Vector so = (Double512Vector)o;
1312 return VectorIntrinsics.reinterpret(
1313 Double512Vector.class, double.class, so.length(),
1314 byte.class, LENGTH, so,
1315 (v, t) -> (Byte512Vector)reshape(v)
1316 );
1317 } else {
1318 throw new InternalError("Unimplemented type");
1319 }
1320 }
1321
1322 @Override
1323 @ForceInline
1324 @SuppressWarnings("unchecked")
1325 public <T extends Shape> Byte512Vector resize(Vector<Byte, T> o) {
1326 Objects.requireNonNull(o);
1327 if (o.bitSize() == 64) {
1328 Byte64Vector so = (Byte64Vector)o;
1329 return VectorIntrinsics.reinterpret(
1330 Byte64Vector.class, byte.class, so.length(),
1331 byte.class, LENGTH, so,
1332 (v, t) -> (Byte512Vector)reshape(v)
1333 );
1334 } else if (o.bitSize() == 128) {
1335 Byte128Vector so = (Byte128Vector)o;
1336 return VectorIntrinsics.reinterpret(
1337 Byte128Vector.class, byte.class, so.length(),
1338 byte.class, LENGTH, so,
|