135 for (i = 0; i < Math.max(offset, 0); i++) {
136 if (UNSAFE.getByte(null, baseOffHeap + i) != 0) {
137 throw new RuntimeException("Incorrect result at " + i + " " + byteArray[i] + " != 0");
138 }
139 }
140 for (; i < Math.min(size * 8 + offset, size * 8); i++) {
141 if (UNSAFE.getByte(null, baseOffHeap + i) != verifyByteArray[i - offset]) {
142 throw new RuntimeException("Incorrect result at " + i + " " + byteArray[i] + " != " + verifyByteArray[i-offset]);
143 }
144 }
145 for (; i < byteArray.length; i++) {
146 if (UNSAFE.getByte(null, baseOffHeap + i) != 0) {
147 throw new RuntimeException("Incorrect result at " + i + " " + byteArray[i] + " != 0");
148 }
149 }
150 }
151
152 @Test
153 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
154 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
155 applyIfPlatform = {"64-bit", "true"})
156 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
157 // might get fixed with JDK-8325155.
158 public static void testByteLong1a(byte[] dest, long[] src) {
159 for (int i = 0; i < src.length; i++) {
160 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i, src[i]);
161 }
162 }
163
164 @Test
165 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
166 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
167 applyIfPlatform = {"64-bit", "true"})
168 // 32-bit: address has ConvL2I for cast of long to address, not supported.
169 public static void testByteLong1b(byte[] dest, long[] src) {
170 for (int i = 0; i < src.length; i++) {
171 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * i, src[i]);
172 }
173 }
174
175 @Test
176 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
177 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"})
178 public static void testByteLong1c(byte[] dest, long[] src) {
179 long base = 64; // make sure it is big enough and 8 byte aligned (required for 32-bit)
180 for (int i = 0; i < src.length - 8; i++) {
181 UNSAFE.putLongUnaligned(dest, base + 8 * i, src[i]);
182 }
183 }
184
185 @Test
186 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
187 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
188 applyIfPlatform = {"64-bit", "true"})
189 // 32-bit: address has ConvL2I for cast of long to address, not supported.
190 public static void testByteLong1d(byte[] dest, long[] src) {
191 long base = 64; // make sure it is big enough and 8 byte aligned (required for 32-bit)
192 for (int i = 0; i < src.length - 8; i++) {
193 UNSAFE.putLongUnaligned(dest, base + 8L * i, src[i]);
194 }
195 }
196
197 @Run(test = {"testByteLong1a", "testByteLong1b", "testByteLong1c", "testByteLong1d"})
198 public static void testByteLong1_runner() {
199 runAndVerify(() -> testByteLong1a(byteArray, longArray), 0);
200 runAndVerify(() -> testByteLong1b(byteArray, longArray), 0);
201 testByteLong1c(byteArray, longArray);
202 testByteLong1d(byteArray, longArray);
203 }
204
205 @Test
206 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
207 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
208 applyIfPlatform = {"64-bit", "true"})
209 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
210 // might get fixed with JDK-8325155.
211 public static void testByteLong2a(byte[] dest, long[] src) {
212 for (int i = 1; i < src.length; i++) {
213 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i - 1), src[i]);
214 }
215 }
216
217 @Test
218 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
219 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
220 applyIfPlatform = {"64-bit", "true"})
221 // 32-bit: address has ConvL2I for cast of long to address, not supported.
222 public static void testByteLong2b(byte[] dest, long[] src) {
223 for (int i = 1; i < src.length; i++) {
224 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * (i - 1), src[i]);
225 }
226 }
227
228 @Run(test = {"testByteLong2a", "testByteLong2b"})
229 public static void testByteLong2_runner() {
230 runAndVerify(() -> testByteLong2a(byteArray, longArray), -8);
231 runAndVerify(() -> testByteLong2b(byteArray, longArray), -8);
232 }
233
234 @Test
235 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
236 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
237 applyIfPlatform = {"64-bit", "true"})
238 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
239 // might get fixed with JDK-8325155.
240 public static void testByteLong3a(byte[] dest, long[] src) {
241 for (int i = 0; i < src.length - 1; i++) {
242 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + 1), src[i]);
243 }
244 }
245
246 @Test
247 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
248 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
249 applyIfPlatform = {"64-bit", "true"})
250 // 32-bit: address has ConvL2I for cast of long to address, not supported.
251 public static void testByteLong3b(byte[] dest, long[] src) {
252 for (int i = 0; i < src.length - 1; i++) {
253 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * (i + 1), src[i]);
254 }
255 }
256
257 @Run(test = {"testByteLong3a", "testByteLong3b"})
258 public static void testByteLong3_runner() {
259 runAndVerify(() -> testByteLong3a(byteArray, longArray), 8);
260 runAndVerify(() -> testByteLong3b(byteArray, longArray), 8);
261 }
262
263 @Test
264 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
265 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
266 applyIfPlatform = {"64-bit", "true"})
267 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
268 // might get fixed with JDK-8325155.
269 public static void testByteLong4a(byte[] dest, long[] src, int start, int stop) {
276 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
277 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
278 applyIfPlatform = {"64-bit", "true"})
279 // 32-bit: address has ConvL2I for cast of long to address, not supported.
280 public static void testByteLong4b(byte[] dest, long[] src, int start, int stop) {
281 for (int i = start; i < stop; i++) {
282 UNSAFE.putLongUnaligned(dest, 8L * i + baseOffset, src[i]);
283 }
284 }
285
286 @Run(test = {"testByteLong4a", "testByteLong4b"})
287 public static void testByteLong4_runner() {
288 baseOffset = UNSAFE.ARRAY_BYTE_BASE_OFFSET;
289 runAndVerify(() -> testByteLong4a(byteArray, longArray, 0, size), 0);
290 runAndVerify(() -> testByteLong4b(byteArray, longArray, 0, size), 0);
291 }
292
293 @Test
294 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
295 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
296 applyIfPlatform = {"64-bit", "true"})
297 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
298 // might get fixed with JDK-8325155.
299 public static void testByteLong5a(byte[] dest, long[] src, int start, int stop) {
300 for (int i = start; i < stop; i++) {
301 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + baseOffset), src[i]);
302 }
303 }
304
305 @Test
306 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
307 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
308 applyIfPlatform = {"64-bit", "true"})
309 // 32-bit: address has ConvL2I for cast of long to address, not supported.
310 public static void testByteLong5b(byte[] dest, long[] src, int start, int stop) {
311 for (int i = start; i < stop; i++) {
312 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * (i + baseOffset), src[i]);
313 }
314 }
315
316 @Run(test = {"testByteLong5a", "testByteLong5b"})
317 public static void testByteLong5_runner() {
318 baseOffset = 1;
319 runAndVerify(() -> testByteLong5a(byteArray, longArray, 0, size-1), 8);
320 runAndVerify(() -> testByteLong5b(byteArray, longArray, 0, size-1), 8);
321 }
322
323 @Test
324 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
325 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
326 applyIfPlatform = {"64-bit", "true"})
327 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
328 // might get fixed with JDK-8325155.
329 public static void testByteByte1a(byte[] dest, byte[] src) {
330 for (int i = 0; i < src.length / 8; i++) {
331 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i, UNSAFE.getLongUnaligned(src, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i));
332 }
333 }
334
335 @Test
336 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
337 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
338 applyIfPlatform = {"64-bit", "true"})
339 // 32-bit: address has ConvL2I for cast of long to address, not supported.
340 public static void testByteByte1b(byte[] dest, byte[] src) {
341 for (int i = 0; i < src.length / 8; i++) {
342 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * i, UNSAFE.getLongUnaligned(src, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * i));
343 }
344 }
345
346 @Run(test = {"testByteByte1a", "testByteByte1b"})
347 public static void testByteByte1_runner() {
348 runAndVerify2(() -> testByteByte1a(byteArray, byteArray), 0);
349 runAndVerify2(() -> testByteByte1b(byteArray, byteArray), 0);
350 }
351
352 @Test
353 // It would be legal to vectorize this one but it's not currently
354 //@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
355 // applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
356 // applyIfPlatform = {"64-bit", "true"})
357 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
358 // might get fixed with JDK-8325155.
|
135 for (i = 0; i < Math.max(offset, 0); i++) {
136 if (UNSAFE.getByte(null, baseOffHeap + i) != 0) {
137 throw new RuntimeException("Incorrect result at " + i + " " + byteArray[i] + " != 0");
138 }
139 }
140 for (; i < Math.min(size * 8 + offset, size * 8); i++) {
141 if (UNSAFE.getByte(null, baseOffHeap + i) != verifyByteArray[i - offset]) {
142 throw new RuntimeException("Incorrect result at " + i + " " + byteArray[i] + " != " + verifyByteArray[i-offset]);
143 }
144 }
145 for (; i < byteArray.length; i++) {
146 if (UNSAFE.getByte(null, baseOffHeap + i) != 0) {
147 throw new RuntimeException("Incorrect result at " + i + " " + byteArray[i] + " != 0");
148 }
149 }
150 }
151
152 @Test
153 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
154 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
155 applyIfPlatform = {"64-bit", "true"},
156 applyIf = {"UseCompactObjectHeaders", "false"})
157 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
158 // might get fixed with JDK-8325155.
159 public static void testByteLong1a(byte[] dest, long[] src) {
160 for (int i = 0; i < src.length; i++) {
161 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i, src[i]);
162 }
163 }
164
165 @Test
166 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
167 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
168 applyIfPlatform = {"64-bit", "true"},
169 applyIf = {"UseCompactObjectHeaders", "false"})
170 // 32-bit: address has ConvL2I for cast of long to address, not supported.
171 public static void testByteLong1b(byte[] dest, long[] src) {
172 for (int i = 0; i < src.length; i++) {
173 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * i, src[i]);
174 }
175 }
176
177 @Test
178 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
179 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
180 applyIf = {"UseCompactObjectHeaders", "false"})
181 public static void testByteLong1c(byte[] dest, long[] src) {
182 long base = 64; // make sure it is big enough and 8 byte aligned (required for 32-bit)
183 for (int i = 0; i < src.length - 8; i++) {
184 UNSAFE.putLongUnaligned(dest, base + 8 * i, src[i]);
185 }
186 }
187
188 @Test
189 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
190 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
191 applyIfPlatform = {"64-bit", "true"},
192 applyIf = {"UseCompactObjectHeaders", "false"})
193 // 32-bit: address has ConvL2I for cast of long to address, not supported.
194 public static void testByteLong1d(byte[] dest, long[] src) {
195 long base = 64; // make sure it is big enough and 8 byte aligned (required for 32-bit)
196 for (int i = 0; i < src.length - 8; i++) {
197 UNSAFE.putLongUnaligned(dest, base + 8L * i, src[i]);
198 }
199 }
200
201 @Run(test = {"testByteLong1a", "testByteLong1b", "testByteLong1c", "testByteLong1d"})
202 public static void testByteLong1_runner() {
203 runAndVerify(() -> testByteLong1a(byteArray, longArray), 0);
204 runAndVerify(() -> testByteLong1b(byteArray, longArray), 0);
205 testByteLong1c(byteArray, longArray);
206 testByteLong1d(byteArray, longArray);
207 }
208
209 @Test
210 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
211 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
212 applyIfPlatform = {"64-bit", "true"},
213 applyIf = {"UseCompactObjectHeaders", "false"})
214 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
215 // might get fixed with JDK-8325155.
216 public static void testByteLong2a(byte[] dest, long[] src) {
217 for (int i = 1; i < src.length; i++) {
218 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i - 1), src[i]);
219 }
220 }
221
222 @Test
223 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
224 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
225 applyIfPlatform = {"64-bit", "true"},
226 applyIf = {"UseCompactObjectHeaders", "false"})
227 // 32-bit: address has ConvL2I for cast of long to address, not supported.
228 public static void testByteLong2b(byte[] dest, long[] src) {
229 for (int i = 1; i < src.length; i++) {
230 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * (i - 1), src[i]);
231 }
232 }
233
234 @Run(test = {"testByteLong2a", "testByteLong2b"})
235 public static void testByteLong2_runner() {
236 runAndVerify(() -> testByteLong2a(byteArray, longArray), -8);
237 runAndVerify(() -> testByteLong2b(byteArray, longArray), -8);
238 }
239
240 @Test
241 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
242 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
243 applyIfPlatform = {"64-bit", "true"},
244 applyIf = {"UseCompactObjectHeaders", "false"})
245 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
246 // might get fixed with JDK-8325155.
247 public static void testByteLong3a(byte[] dest, long[] src) {
248 for (int i = 0; i < src.length - 1; i++) {
249 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + 1), src[i]);
250 }
251 }
252
253 @Test
254 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
255 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
256 applyIfPlatform = {"64-bit", "true"},
257 applyIf = {"UseCompactObjectHeaders", "false"})
258 // 32-bit: address has ConvL2I for cast of long to address, not supported.
259 public static void testByteLong3b(byte[] dest, long[] src) {
260 for (int i = 0; i < src.length - 1; i++) {
261 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * (i + 1), src[i]);
262 }
263 }
264
265 @Run(test = {"testByteLong3a", "testByteLong3b"})
266 public static void testByteLong3_runner() {
267 runAndVerify(() -> testByteLong3a(byteArray, longArray), 8);
268 runAndVerify(() -> testByteLong3b(byteArray, longArray), 8);
269 }
270
271 @Test
272 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
273 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
274 applyIfPlatform = {"64-bit", "true"})
275 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
276 // might get fixed with JDK-8325155.
277 public static void testByteLong4a(byte[] dest, long[] src, int start, int stop) {
284 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
285 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
286 applyIfPlatform = {"64-bit", "true"})
287 // 32-bit: address has ConvL2I for cast of long to address, not supported.
288 public static void testByteLong4b(byte[] dest, long[] src, int start, int stop) {
289 for (int i = start; i < stop; i++) {
290 UNSAFE.putLongUnaligned(dest, 8L * i + baseOffset, src[i]);
291 }
292 }
293
294 @Run(test = {"testByteLong4a", "testByteLong4b"})
295 public static void testByteLong4_runner() {
296 baseOffset = UNSAFE.ARRAY_BYTE_BASE_OFFSET;
297 runAndVerify(() -> testByteLong4a(byteArray, longArray, 0, size), 0);
298 runAndVerify(() -> testByteLong4b(byteArray, longArray, 0, size), 0);
299 }
300
301 @Test
302 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
303 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
304 applyIfPlatform = {"64-bit", "true"},
305 applyIf = {"UseCompactObjectHeaders", "false"})
306 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
307 // might get fixed with JDK-8325155.
308 public static void testByteLong5a(byte[] dest, long[] src, int start, int stop) {
309 for (int i = start; i < stop; i++) {
310 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + baseOffset), src[i]);
311 }
312 }
313
314 @Test
315 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
316 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
317 applyIfPlatform = {"64-bit", "true"},
318 applyIf = {"UseCompactObjectHeaders", "false"})
319 // 32-bit: address has ConvL2I for cast of long to address, not supported.
320 public static void testByteLong5b(byte[] dest, long[] src, int start, int stop) {
321 for (int i = start; i < stop; i++) {
322 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * (i + baseOffset), src[i]);
323 }
324 }
325
326 @Run(test = {"testByteLong5a", "testByteLong5b"})
327 public static void testByteLong5_runner() {
328 baseOffset = 1;
329 runAndVerify(() -> testByteLong5a(byteArray, longArray, 0, size-1), 8);
330 runAndVerify(() -> testByteLong5b(byteArray, longArray, 0, size-1), 8);
331 }
332
333 @Test
334 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
335 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
336 applyIfPlatform = {"64-bit", "true"},
337 applyIf = {"UseCompactObjectHeaders", "false"})
338 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
339 // might get fixed with JDK-8325155.
340 public static void testByteByte1a(byte[] dest, byte[] src) {
341 for (int i = 0; i < src.length / 8; i++) {
342 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i, UNSAFE.getLongUnaligned(src, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * i));
343 }
344 }
345
346 @Test
347 @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
348 applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
349 applyIfPlatform = {"64-bit", "true"},
350 applyIf = {"UseCompactObjectHeaders", "false"})
351 // 32-bit: address has ConvL2I for cast of long to address, not supported.
352 public static void testByteByte1b(byte[] dest, byte[] src) {
353 for (int i = 0; i < src.length / 8; i++) {
354 UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * i, UNSAFE.getLongUnaligned(src, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * i));
355 }
356 }
357
358 @Run(test = {"testByteByte1a", "testByteByte1b"})
359 public static void testByteByte1_runner() {
360 runAndVerify2(() -> testByteByte1a(byteArray, byteArray), 0);
361 runAndVerify2(() -> testByteByte1b(byteArray, byteArray), 0);
362 }
363
364 @Test
365 // It would be legal to vectorize this one but it's not currently
366 //@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
367 // applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
368 // applyIfPlatform = {"64-bit", "true"})
369 // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
370 // might get fixed with JDK-8325155.
|