< prev index next >

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

Print this page

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

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

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

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

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

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

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

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

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

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

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

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

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