Skip to content

Commit

Permalink
enable
Browse files Browse the repository at this point in the history
  • Loading branch information
offamitkumar committed Oct 28, 2024
1 parent 44d6876 commit 237221d
Showing 1 changed file with 111 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,98 +249,122 @@ public static void testByteLong2_runner() {
runAndVerify(() -> testByteLong2b(byteArray, longArray), -8);
}

// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
// applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
// applyIfPlatform = {"64-bit", "true"})
// // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
// // might get fixed with JDK-8325155.
// public static void testByteLong3a(byte[] dest, long[] src) {
// for (int i = 0; i < src.length - 1; i++) {
// UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + 1), src[i]);
// }
// }
@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
applyIfPlatform = {"64-bit", "true"})
// 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
// might get fixed with JDK-8325155.
public static void testByteLong3a(byte[] dest, long[] src) {
for (int i = 0; i < src.length - 1; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + 1), value);
}
}

// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
// applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
// applyIfPlatform = {"64-bit", "true"})
// // 32-bit: address has ConvL2I for cast of long to address, not supported.
// public static void testByteLong3b(byte[] dest, long[] src) {
// for (int i = 0; i < src.length - 1; i++) {
// UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * (i + 1), src[i]);
// }
// }
@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
applyIfPlatform = {"64-bit", "true"})
// 32-bit: address has ConvL2I for cast of long to address, not supported.
public static void testByteLong3b(byte[] dest, long[] src) {
for (int i = 0; i < src.length - 1; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * (i + 1), value);
}
}

// @Run(test = {"testByteLong3a", "testByteLong3b"})
// public static void testByteLong3_runner() {
// //runAndVerify(() -> testByteLong3a(byteArray, longArray), 8);
// //runAndVerify(() -> testByteLong3b(byteArray, longArray), 8);
// }
@Run(test = {"testByteLong3a", "testByteLong3b"})
public static void testByteLong3_runner() {
runAndVerify(() -> testByteLong3a(byteArray, longArray), 8);
runAndVerify(() -> testByteLong3b(byteArray, longArray), 8);
}

// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
// applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
// applyIfPlatform = {"64-bit", "true"},
// applyIf = {"AlignVector", "false"})
// // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
// // might get fixed with JDK-8325155.
// // AlignVector cannot guarantee that invar is aligned.
// public static void testByteLong4a(byte[] dest, long[] src, int start, int stop) {
// for (int i = start; i < stop; i++) {
// UNSAFE.putLongUnaligned(dest, 8 * i + baseOffset, src[i]);
// }
// }
@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
applyIfPlatform = {"64-bit", "true"},
applyIf = {"AlignVector", "false"})
// 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
// might get fixed with JDK-8325155.
// AlignVector cannot guarantee that invar is aligned.
public static void testByteLong4a(byte[] dest, long[] src, int start, int stop) {
for (int i = start; i < stop; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(dest, 8 * i + baseOffset, value);
}
}

// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
// applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
// applyIfPlatform = {"64-bit", "true"},
// applyIf = {"AlignVector", "false"})
// // 32-bit: address has ConvL2I for cast of long to address, not supported.
// // AlignVector cannot guarantee that invar is aligned.
// public static void testByteLong4b(byte[] dest, long[] src, int start, int stop) {
// for (int i = start; i < stop; i++) {
// UNSAFE.putLongUnaligned(dest, 8L * i + baseOffset, src[i]);
// }
// }
//
// @Run(test = {"testByteLong4a", "testByteLong4b"})
// public static void testByteLong4_runner() {
// baseOffset = UNSAFE.ARRAY_BYTE_BASE_OFFSET;
// //runAndVerify(() -> testByteLong4a(byteArray, longArray, 0, size), 0);
// //runAndVerify(() -> testByteLong4b(byteArray, longArray, 0, size), 0);
// }
@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
applyIfPlatform = {"64-bit", "true"},
applyIf = {"AlignVector", "false"})
// 32-bit: address has ConvL2I for cast of long to address, not supported.
// AlignVector cannot guarantee that invar is aligned.
public static void testByteLong4b(byte[] dest, long[] src, int start, int stop) {
for (int i = start; i < stop; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(dest, 8L * i + baseOffset, value);
}
}

// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
// applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
// applyIfPlatform = {"64-bit", "true"})
// // 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
// // might get fixed with JDK-8325155.
// public static void testByteLong5a(byte[] dest, long[] src, int start, int stop) {
// for (int i = start; i < stop; i++) {
// UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + baseOffset), src[i]);
// }
// }
//
// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
// applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
// applyIfPlatform = {"64-bit", "true"})
// // 32-bit: address has ConvL2I for cast of long to address, not supported.
// public static void testByteLong5b(byte[] dest, long[] src, int start, int stop) {
// for (int i = start; i < stop; i++) {
// UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * (i + baseOffset), src[i]);
// }
// }
//
// @Run(test = {"testByteLong5a", "testByteLong5b"})
// public static void testByteLong5_runner() {
// baseOffset = 1;
// //runAndVerify(() -> testByteLong5a(byteArray, longArray, 0, size-1), 8);
// //runAndVerify(() -> testByteLong5b(byteArray, longArray, 0, size-1), 8);
// }
@Run(test = {"testByteLong4a", "testByteLong4b"})
public static void testByteLong4_runner() {
baseOffset = UNSAFE.ARRAY_BYTE_BASE_OFFSET;
runAndVerify(() -> testByteLong4a(byteArray, longArray, 0, size), 0);
runAndVerify(() -> testByteLong4b(byteArray, longArray, 0, size), 0);
}

@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
applyIfPlatform = {"64-bit", "true"})
// 32-bit: offsets are badly aligned (UNSAFE.ARRAY_BYTE_BASE_OFFSET is 4 byte aligned, but not 8 byte aligned).
// might get fixed with JDK-8325155.
public static void testByteLong5a(byte[] dest, long[] src, int start, int stop) {
for (int i = start; i < stop; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8 * (i + baseOffset), value);
}
}

@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"},
applyIfPlatform = {"64-bit", "true"})
// 32-bit: address has ConvL2I for cast of long to address, not supported.
public static void testByteLong5b(byte[] dest, long[] src, int start, int stop) {
for (int i = start; i < stop; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(dest, UNSAFE.ARRAY_BYTE_BASE_OFFSET + 8L * (i + baseOffset), value);
}
}

@Run(test = {"testByteLong5a", "testByteLong5b"})
public static void testByteLong5_runner() {
baseOffset = 1;
runAndVerify(() -> testByteLong5a(byteArray, longArray, 0, size-1), 8);
runAndVerify(() -> testByteLong5b(byteArray, longArray, 0, size-1), 8);
}
//
// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
Expand Down

0 comments on commit 237221d

Please sign in to comment.