< prev index next >

test/hotspot/jtreg/compiler/loopopts/superword/TestAlignVector.java

Print this page

 384                   IRNode.AND_VB,        IRNode.VECTOR_SIZE_4, "> 0",
 385                   IRNode.STORE_VECTOR, "> 0"},
 386         applyIf = {"MaxVectorSize", ">=8"},
 387         applyIfPlatform = {"64-bit", "true"},
 388         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
 389     static Object[] test0(byte[] a, byte[] b, byte mask) {
 390         for (int i = 0; i < RANGE; i+=8) {
 391             // Safe to vectorize with AlignVector
 392             b[i+0] = (byte)(a[i+0] & mask); // offset 0, align 0
 393             b[i+1] = (byte)(a[i+1] & mask);
 394             b[i+2] = (byte)(a[i+2] & mask);
 395             b[i+3] = (byte)(a[i+3] & mask);
 396         }
 397         return new Object[]{ a, b };
 398     }
 399 
 400     @Test
 401     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
 402                   IRNode.AND_VB, "> 0",
 403                   IRNode.STORE_VECTOR, "> 0"},

 404         applyIfPlatform = {"64-bit", "true"},
 405         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
 406     static Object[] test1(byte[] a, byte[] b, byte mask) {
 407         for (int i = 0; i < RANGE; i+=8) {
 408             // Safe to vectorize with AlignVector
 409             b[i+0] = (byte)(a[i+0] & mask); // offset 0, align 0
 410             b[i+1] = (byte)(a[i+1] & mask);
 411             b[i+2] = (byte)(a[i+2] & mask);
 412             b[i+3] = (byte)(a[i+3] & mask);
 413             b[i+4] = (byte)(a[i+4] & mask);
 414             b[i+5] = (byte)(a[i+5] & mask);
 415             b[i+6] = (byte)(a[i+6] & mask);
 416             b[i+7] = (byte)(a[i+7] & mask);
 417         }
 418         return new Object[]{ a, b };
 419     }
 420 
 421     @Test
 422     @IR(counts = {IRNode.LOAD_VECTOR_B, IRNode.VECTOR_SIZE_4, "> 0",
 423                   IRNode.AND_VB,        IRNode.VECTOR_SIZE_4, "> 0",

 692                   IRNode.STORE_VECTOR, "= 0"},
 693         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"},
 694         applyIfPlatform = {"64-bit", "true"},
 695         applyIf = {"AlignVector", "true"})
 696     static Object[] test10c(short[] a, short[] b, short mask) {
 697         // This is not alignable with pre-loop, because of odd init.
 698         // Seems not correctly handled with MaxVectorSize >= 32.
 699         for (int i = 13; i < RANGE-8; i+=8) {
 700             b[i+0] = (short)(a[i+0] & mask);
 701             b[i+1] = (short)(a[i+1] & mask);
 702             b[i+2] = (short)(a[i+2] & mask);
 703             b[i+3] = (short)(a[i+3] & mask);
 704         }
 705         return new Object[]{ a, b };
 706     }
 707 
 708     @Test
 709     @IR(counts = {IRNode.LOAD_VECTOR_S, IRNode.VECTOR_SIZE_4, "> 0",
 710                   IRNode.AND_VS,        IRNode.VECTOR_SIZE_4, "> 0",
 711                   IRNode.STORE_VECTOR, "> 0"},
 712         applyIf = {"MaxVectorSize", ">=16"},
 713         applyIfPlatform = {"64-bit", "true"},
 714         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
 715     static Object[] test10d(short[] a, short[] b, short mask) {
 716         for (int i = 13; i < RANGE-16; i+=8) {
 717             // init + offset -> aligned
 718             b[i+0+3] = (short)(a[i+0+3] & mask);
 719             b[i+1+3] = (short)(a[i+1+3] & mask);
 720             b[i+2+3] = (short)(a[i+2+3] & mask);
 721             b[i+3+3] = (short)(a[i+3+3] & mask);
 722         }
 723         return new Object[]{ a, b };
 724     }
 725 
 726     @Test
 727     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
 728                   IRNode.AND_VB, "> 0",
 729                   IRNode.STORE_VECTOR, "> 0"},
 730         applyIfPlatform = {"64-bit", "true"},
 731         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
 732     static Object[] test11aB(byte[] a, byte[] b, byte mask) {

 987                   IRNode.ADD_VI, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
 988                   IRNode.ADD_VL, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
 989                   IRNode.STORE_VECTOR, "> 0"},
 990         applyIfPlatform = {"64-bit", "true"},
 991         applyIfCPUFeatureOr = {"avx2", "true"})
 992     // require avx to ensure vectors are larger than what unrolling produces
 993     static Object[] test13aIL(int[] a, long[] b) {
 994         for (int i = 0; i < RANGE; i++) {
 995             a[i]++;
 996             b[i]++;
 997         }
 998         return new Object[]{ a, b };
 999     }
1000 
1001     @Test
1002     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
1003                   IRNode.LOAD_VECTOR_I, "> 0",
1004                   IRNode.ADD_VB, "> 0",
1005                   IRNode.ADD_VI, "> 0",
1006                   IRNode.STORE_VECTOR, "> 0"},

1007         applyIfPlatform = {"64-bit", "true"},
1008         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1009     static Object[] test13aIB(int[] a, byte[] b) {
1010         for (int i = 0; i < RANGE; i++) {
1011             a[i]++;
1012             b[i]++;
1013         }
1014         return new Object[]{ a, b };
1015     }
1016 
1017     @Test
1018     @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
1019                   IRNode.LOAD_VECTOR_S, "> 0",
1020                   IRNode.ADD_VI, "> 0",
1021                   IRNode.ADD_VS, "> 0",
1022                   IRNode.STORE_VECTOR, "> 0"},

1023         applyIfPlatform = {"64-bit", "true"},
1024         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1025     static Object[] test13aIS(int[] a, short[] b) {
1026         for (int i = 0; i < RANGE; i++) {
1027             a[i]++;
1028             b[i]++;
1029         }
1030         return new Object[]{ a, b };
1031     }
1032 
1033     @Test
1034     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
1035                   IRNode.LOAD_VECTOR_S, "> 0",
1036                   IRNode.LOAD_VECTOR_I, "> 0",
1037                   IRNode.LOAD_VECTOR_L, "> 0",
1038                   IRNode.ADD_VB, "> 0",
1039                   IRNode.ADD_VS, "> 0",
1040                   IRNode.ADD_VI, "> 0",
1041                   IRNode.ADD_VL, "> 0",
1042                   IRNode.STORE_VECTOR, "> 0"},

1043         applyIfPlatform = {"64-bit", "true"},
1044         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1045     static Object[] test13aBSIL(byte[] a, short[] b, int[] c, long[] d) {
1046         for (int i = 0; i < RANGE; i++) {
1047             a[i]++;
1048             b[i]++;
1049             c[i]++;
1050             d[i]++;
1051         }
1052         return new Object[]{ a, b, c, d };
1053     }
1054 
1055     @Test
1056     @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
1057                   IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
1058                   IRNode.ADD_VI, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
1059                   IRNode.ADD_VL, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
1060                   IRNode.STORE_VECTOR, "> 0"},
1061         applyIfPlatform = {"64-bit", "true"},
1062         applyIfCPUFeatureOr = {"avx2", "true"})
1063     // require avx to ensure vectors are larger than what unrolling produces
1064     static Object[] test13bIL(int[] a, long[] b) {
1065         for (int i = 1; i < RANGE; i++) {
1066             a[i]++;
1067             b[i]++;
1068         }
1069         return new Object[]{ a, b };
1070     }
1071 
1072     @Test
1073     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
1074                   IRNode.LOAD_VECTOR_I, "> 0",
1075                   IRNode.ADD_VB, "> 0",
1076                   IRNode.ADD_VI, "> 0",
1077                   IRNode.STORE_VECTOR, "> 0"},

1078         applyIfPlatform = {"64-bit", "true"},
1079         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1080     static Object[] test13bIB(int[] a, byte[] b) {
1081         for (int i = 1; i < RANGE; i++) {
1082             a[i]++;
1083             b[i]++;
1084         }
1085         return new Object[]{ a, b };
1086     }
1087 
1088     @Test
1089     @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
1090                   IRNode.LOAD_VECTOR_S, "> 0",
1091                   IRNode.ADD_VI, "> 0",
1092                   IRNode.ADD_VS, "> 0",
1093                   IRNode.STORE_VECTOR, "> 0"},

1094         applyIfPlatform = {"64-bit", "true"},
1095         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1096     static Object[] test13bIS(int[] a, short[] b) {
1097         for (int i = 1; i < RANGE; i++) {
1098             a[i]++;
1099             b[i]++;
1100         }
1101         return new Object[]{ a, b };
1102     }
1103 
1104     @Test
1105     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
1106                   IRNode.LOAD_VECTOR_S, "> 0",
1107                   IRNode.LOAD_VECTOR_I, "> 0",
1108                   IRNode.LOAD_VECTOR_L, "> 0",
1109                   IRNode.ADD_VB, "> 0",
1110                   IRNode.ADD_VS, "> 0",
1111                   IRNode.ADD_VI, "> 0",
1112                   IRNode.ADD_VL, "> 0",
1113                   IRNode.STORE_VECTOR, "> 0"},

1114         applyIfPlatform = {"64-bit", "true"},
1115         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1116     static Object[] test13bBSIL(byte[] a, short[] b, int[] c, long[] d) {
1117         for (int i = 1; i < RANGE; i++) {
1118             a[i]++;
1119             b[i]++;
1120             c[i]++;
1121             d[i]++;
1122         }
1123         return new Object[]{ a, b, c, d };
1124     }
1125 
1126     @Test
1127     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
1128                   IRNode.ADD_VB, "> 0",
1129                   IRNode.STORE_VECTOR, "> 0"},
1130         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"},
1131         applyIfPlatform = {"64-bit", "true"},
1132         applyIf = {"AlignVector", "false"})
1133     @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0",

 384                   IRNode.AND_VB,        IRNode.VECTOR_SIZE_4, "> 0",
 385                   IRNode.STORE_VECTOR, "> 0"},
 386         applyIf = {"MaxVectorSize", ">=8"},
 387         applyIfPlatform = {"64-bit", "true"},
 388         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
 389     static Object[] test0(byte[] a, byte[] b, byte mask) {
 390         for (int i = 0; i < RANGE; i+=8) {
 391             // Safe to vectorize with AlignVector
 392             b[i+0] = (byte)(a[i+0] & mask); // offset 0, align 0
 393             b[i+1] = (byte)(a[i+1] & mask);
 394             b[i+2] = (byte)(a[i+2] & mask);
 395             b[i+3] = (byte)(a[i+3] & mask);
 396         }
 397         return new Object[]{ a, b };
 398     }
 399 
 400     @Test
 401     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
 402                   IRNode.AND_VB, "> 0",
 403                   IRNode.STORE_VECTOR, "> 0"},
 404         applyIf = {"UseCompactObjectHeaders", "false"},
 405         applyIfPlatform = {"64-bit", "true"},
 406         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
 407     static Object[] test1(byte[] a, byte[] b, byte mask) {
 408         for (int i = 0; i < RANGE; i+=8) {
 409             // Safe to vectorize with AlignVector
 410             b[i+0] = (byte)(a[i+0] & mask); // offset 0, align 0
 411             b[i+1] = (byte)(a[i+1] & mask);
 412             b[i+2] = (byte)(a[i+2] & mask);
 413             b[i+3] = (byte)(a[i+3] & mask);
 414             b[i+4] = (byte)(a[i+4] & mask);
 415             b[i+5] = (byte)(a[i+5] & mask);
 416             b[i+6] = (byte)(a[i+6] & mask);
 417             b[i+7] = (byte)(a[i+7] & mask);
 418         }
 419         return new Object[]{ a, b };
 420     }
 421 
 422     @Test
 423     @IR(counts = {IRNode.LOAD_VECTOR_B, IRNode.VECTOR_SIZE_4, "> 0",
 424                   IRNode.AND_VB,        IRNode.VECTOR_SIZE_4, "> 0",

 693                   IRNode.STORE_VECTOR, "= 0"},
 694         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"},
 695         applyIfPlatform = {"64-bit", "true"},
 696         applyIf = {"AlignVector", "true"})
 697     static Object[] test10c(short[] a, short[] b, short mask) {
 698         // This is not alignable with pre-loop, because of odd init.
 699         // Seems not correctly handled with MaxVectorSize >= 32.
 700         for (int i = 13; i < RANGE-8; i+=8) {
 701             b[i+0] = (short)(a[i+0] & mask);
 702             b[i+1] = (short)(a[i+1] & mask);
 703             b[i+2] = (short)(a[i+2] & mask);
 704             b[i+3] = (short)(a[i+3] & mask);
 705         }
 706         return new Object[]{ a, b };
 707     }
 708 
 709     @Test
 710     @IR(counts = {IRNode.LOAD_VECTOR_S, IRNode.VECTOR_SIZE_4, "> 0",
 711                   IRNode.AND_VS,        IRNode.VECTOR_SIZE_4, "> 0",
 712                   IRNode.STORE_VECTOR, "> 0"},
 713         applyIfAnd = {"MaxVectorSize", ">=16", "UseCompactObjectHeaders", "false"},
 714         applyIfPlatform = {"64-bit", "true"},
 715         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
 716     static Object[] test10d(short[] a, short[] b, short mask) {
 717         for (int i = 13; i < RANGE-16; i+=8) {
 718             // init + offset -> aligned
 719             b[i+0+3] = (short)(a[i+0+3] & mask);
 720             b[i+1+3] = (short)(a[i+1+3] & mask);
 721             b[i+2+3] = (short)(a[i+2+3] & mask);
 722             b[i+3+3] = (short)(a[i+3+3] & mask);
 723         }
 724         return new Object[]{ a, b };
 725     }
 726 
 727     @Test
 728     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
 729                   IRNode.AND_VB, "> 0",
 730                   IRNode.STORE_VECTOR, "> 0"},
 731         applyIfPlatform = {"64-bit", "true"},
 732         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
 733     static Object[] test11aB(byte[] a, byte[] b, byte mask) {

 988                   IRNode.ADD_VI, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
 989                   IRNode.ADD_VL, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
 990                   IRNode.STORE_VECTOR, "> 0"},
 991         applyIfPlatform = {"64-bit", "true"},
 992         applyIfCPUFeatureOr = {"avx2", "true"})
 993     // require avx to ensure vectors are larger than what unrolling produces
 994     static Object[] test13aIL(int[] a, long[] b) {
 995         for (int i = 0; i < RANGE; i++) {
 996             a[i]++;
 997             b[i]++;
 998         }
 999         return new Object[]{ a, b };
1000     }
1001 
1002     @Test
1003     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
1004                   IRNode.LOAD_VECTOR_I, "> 0",
1005                   IRNode.ADD_VB, "> 0",
1006                   IRNode.ADD_VI, "> 0",
1007                   IRNode.STORE_VECTOR, "> 0"},
1008         applyIf = {"UseCompactObjectHeaders", "false"},
1009         applyIfPlatform = {"64-bit", "true"},
1010         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1011     static Object[] test13aIB(int[] a, byte[] b) {
1012         for (int i = 0; i < RANGE; i++) {
1013             a[i]++;
1014             b[i]++;
1015         }
1016         return new Object[]{ a, b };
1017     }
1018 
1019     @Test
1020     @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
1021                   IRNode.LOAD_VECTOR_S, "> 0",
1022                   IRNode.ADD_VI, "> 0",
1023                   IRNode.ADD_VS, "> 0",
1024                   IRNode.STORE_VECTOR, "> 0"},
1025         applyIf = {"UseCompactObjectHeaders", "false"},
1026         applyIfPlatform = {"64-bit", "true"},
1027         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1028     static Object[] test13aIS(int[] a, short[] b) {
1029         for (int i = 0; i < RANGE; i++) {
1030             a[i]++;
1031             b[i]++;
1032         }
1033         return new Object[]{ a, b };
1034     }
1035 
1036     @Test
1037     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
1038                   IRNode.LOAD_VECTOR_S, "> 0",
1039                   IRNode.LOAD_VECTOR_I, "> 0",
1040                   IRNode.LOAD_VECTOR_L, "> 0",
1041                   IRNode.ADD_VB, "> 0",
1042                   IRNode.ADD_VS, "> 0",
1043                   IRNode.ADD_VI, "> 0",
1044                   IRNode.ADD_VL, "> 0",
1045                   IRNode.STORE_VECTOR, "> 0"},
1046         applyIf = {"UseCompactObjectHeaders", "false"},
1047         applyIfPlatform = {"64-bit", "true"},
1048         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1049     static Object[] test13aBSIL(byte[] a, short[] b, int[] c, long[] d) {
1050         for (int i = 0; i < RANGE; i++) {
1051             a[i]++;
1052             b[i]++;
1053             c[i]++;
1054             d[i]++;
1055         }
1056         return new Object[]{ a, b, c, d };
1057     }
1058 
1059     @Test
1060     @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
1061                   IRNode.LOAD_VECTOR_L, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
1062                   IRNode.ADD_VI, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
1063                   IRNode.ADD_VL, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
1064                   IRNode.STORE_VECTOR, "> 0"},
1065         applyIfPlatform = {"64-bit", "true"},
1066         applyIfCPUFeatureOr = {"avx2", "true"})
1067     // require avx to ensure vectors are larger than what unrolling produces
1068     static Object[] test13bIL(int[] a, long[] b) {
1069         for (int i = 1; i < RANGE; i++) {
1070             a[i]++;
1071             b[i]++;
1072         }
1073         return new Object[]{ a, b };
1074     }
1075 
1076     @Test
1077     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
1078                   IRNode.LOAD_VECTOR_I, "> 0",
1079                   IRNode.ADD_VB, "> 0",
1080                   IRNode.ADD_VI, "> 0",
1081                   IRNode.STORE_VECTOR, "> 0"},
1082         applyIf = {"UseCompactObjectHeaders", "false"},
1083         applyIfPlatform = {"64-bit", "true"},
1084         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1085     static Object[] test13bIB(int[] a, byte[] b) {
1086         for (int i = 1; i < RANGE; i++) {
1087             a[i]++;
1088             b[i]++;
1089         }
1090         return new Object[]{ a, b };
1091     }
1092 
1093     @Test
1094     @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
1095                   IRNode.LOAD_VECTOR_S, "> 0",
1096                   IRNode.ADD_VI, "> 0",
1097                   IRNode.ADD_VS, "> 0",
1098                   IRNode.STORE_VECTOR, "> 0"},
1099         applyIf = {"UseCompactObjectHeaders", "false"},
1100         applyIfPlatform = {"64-bit", "true"},
1101         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1102     static Object[] test13bIS(int[] a, short[] b) {
1103         for (int i = 1; i < RANGE; i++) {
1104             a[i]++;
1105             b[i]++;
1106         }
1107         return new Object[]{ a, b };
1108     }
1109 
1110     @Test
1111     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
1112                   IRNode.LOAD_VECTOR_S, "> 0",
1113                   IRNode.LOAD_VECTOR_I, "> 0",
1114                   IRNode.LOAD_VECTOR_L, "> 0",
1115                   IRNode.ADD_VB, "> 0",
1116                   IRNode.ADD_VS, "> 0",
1117                   IRNode.ADD_VI, "> 0",
1118                   IRNode.ADD_VL, "> 0",
1119                   IRNode.STORE_VECTOR, "> 0"},
1120         applyIf = {"UseCompactObjectHeaders", "false"},
1121         applyIfPlatform = {"64-bit", "true"},
1122         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
1123     static Object[] test13bBSIL(byte[] a, short[] b, int[] c, long[] d) {
1124         for (int i = 1; i < RANGE; i++) {
1125             a[i]++;
1126             b[i]++;
1127             c[i]++;
1128             d[i]++;
1129         }
1130         return new Object[]{ a, b, c, d };
1131     }
1132 
1133     @Test
1134     @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
1135                   IRNode.ADD_VB, "> 0",
1136                   IRNode.STORE_VECTOR, "> 0"},
1137         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"},
1138         applyIfPlatform = {"64-bit", "true"},
1139         applyIf = {"AlignVector", "false"})
1140     @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0",
< prev index next >