< prev index next >

test/jdk/jdk/incubator/vector/Long128VectorTests.java

Print this page
rev 55894 : 8222897: [vector] Renaming of shift, rotate operations. Few other api changes.
Summary: Renaming of shift, rotate operations. Few other api changes.
Reviewed-by: jrose, briangoetz


 665     static void xorLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb,
 666                                           IntFunction<boolean[]> fm) {
 667         long[] a = fa.apply(SPECIES.length());
 668         long[] b = fb.apply(SPECIES.length());
 669         long[] r = fr.apply(SPECIES.length());
 670         boolean[] mask = fm.apply(SPECIES.length());
 671         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 672 
 673         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 674             for (int i = 0; i < a.length; i += SPECIES.length()) {
 675                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 676                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 677                 av.xor(bv, vmask).intoArray(r, i);
 678             }
 679         }
 680 
 681         assertArraysEquals(a, b, r, mask, Long128VectorTests::xor);
 682     }
 683 
 684 
 685     static long shiftR(long a, long b) {
 686         return (long)((a >>> b));
 687     }
 688 
 689     @Test(dataProvider = "longBinaryOpProvider")
 690     static void shiftRLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 691         long[] a = fa.apply(SPECIES.length());
 692         long[] b = fb.apply(SPECIES.length());
 693         long[] r = fr.apply(SPECIES.length());
 694 
 695         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 696             for (int i = 0; i < a.length; i += SPECIES.length()) {
 697                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 698                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 699                 av.shiftR(bv).intoArray(r, i);
 700             }
 701         }
 702 
 703         assertArraysEquals(a, b, r, Long128VectorTests::shiftR);
 704     }
 705 
 706 
 707 
 708     @Test(dataProvider = "longBinaryOpMaskProvider")
 709     static void shiftRLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb,
 710                                           IntFunction<boolean[]> fm) {
 711         long[] a = fa.apply(SPECIES.length());
 712         long[] b = fb.apply(SPECIES.length());
 713         long[] r = fr.apply(SPECIES.length());
 714         boolean[] mask = fm.apply(SPECIES.length());
 715         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 716 
 717         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 718             for (int i = 0; i < a.length; i += SPECIES.length()) {
 719                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 720                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 721                 av.shiftR(bv, vmask).intoArray(r, i);
 722             }
 723         }
 724 
 725         assertArraysEquals(a, b, r, mask, Long128VectorTests::shiftR);
 726     }
 727 
 728 
 729     static long shiftL(long a, long b) {
 730         return (long)((a << b));




 731     }
 732 
 733     @Test(dataProvider = "longBinaryOpProvider")
 734     static void shiftLLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 735         long[] a = fa.apply(SPECIES.length());
 736         long[] b = fb.apply(SPECIES.length());
 737         long[] r = fr.apply(SPECIES.length());
 738 
 739         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 740             for (int i = 0; i < a.length; i += SPECIES.length()) {
 741                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 742                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 743                 av.shiftL(bv).intoArray(r, i);
 744             }
 745         }
 746 
 747         assertArraysEquals(a, b, r, Long128VectorTests::shiftL);
 748     }
 749 
 750 
 751 
 752     @Test(dataProvider = "longBinaryOpMaskProvider")
 753     static void shiftLLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb,
 754                                           IntFunction<boolean[]> fm) {
 755         long[] a = fa.apply(SPECIES.length());
 756         long[] b = fb.apply(SPECIES.length());
 757         long[] r = fr.apply(SPECIES.length());
 758         boolean[] mask = fm.apply(SPECIES.length());
 759         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 760 
 761         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 762             for (int i = 0; i < a.length; i += SPECIES.length()) {
 763                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 764                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 765                 av.shiftL(bv, vmask).intoArray(r, i);
 766             }
 767         }
 768 
 769         assertArraysEquals(a, b, r, mask, Long128VectorTests::shiftL);
 770     }
 771 
 772 
 773     static long aShiftR(long a, long b) {




 774         return (long)((a >> b));
 775     }
 776 
 777     @Test(dataProvider = "longBinaryOpProvider")
 778     static void aShiftRLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 779         long[] a = fa.apply(SPECIES.length());
 780         long[] b = fb.apply(SPECIES.length());
 781         long[] r = fr.apply(SPECIES.length());
 782 
 783         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 784             for (int i = 0; i < a.length; i += SPECIES.length()) {
 785                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 786                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 787                 av.aShiftR(bv).intoArray(r, i);
 788             }
 789         }
 790 
 791         assertArraysEquals(a, b, r, Long128VectorTests::aShiftR);
 792     }
 793 
 794 
 795 
 796     @Test(dataProvider = "longBinaryOpMaskProvider")
 797     static void aShiftRLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb,
 798                                           IntFunction<boolean[]> fm) {
 799         long[] a = fa.apply(SPECIES.length());
 800         long[] b = fb.apply(SPECIES.length());
 801         long[] r = fr.apply(SPECIES.length());
 802         boolean[] mask = fm.apply(SPECIES.length());
 803         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 804 
 805         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 806             for (int i = 0; i < a.length; i += SPECIES.length()) {
 807                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 808                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 809                 av.aShiftR(bv, vmask).intoArray(r, i);
 810             }
 811         }
 812 
 813         assertArraysEquals(a, b, r, mask, Long128VectorTests::aShiftR);
 814     }
 815 
 816 
 817     static long aShiftR_unary(long a, long b) {
 818         return (long)((a >> b));




 819     }
 820 
 821     @Test(dataProvider = "longBinaryOpProvider")
 822     static void aShiftRLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 823         long[] a = fa.apply(SPECIES.length());
 824         long[] b = fb.apply(SPECIES.length());
 825         long[] r = fr.apply(SPECIES.length());
 826 
 827         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 828             for (int i = 0; i < a.length; i += SPECIES.length()) {
 829                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 830                 av.aShiftR((int)b[i]).intoArray(r, i);
 831             }
 832         }
 833 
 834         assertShiftArraysEquals(a, b, r, Long128VectorTests::aShiftR_unary);
 835     }
 836 
 837 
 838 
 839     @Test(dataProvider = "longBinaryOpMaskProvider")
 840     static void aShiftRLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
 841                                           IntFunction<boolean[]> fm) {
 842         long[] a = fa.apply(SPECIES.length());
 843         long[] b = fb.apply(SPECIES.length());
 844         long[] r = fr.apply(SPECIES.length());
 845         boolean[] mask = fm.apply(SPECIES.length());
 846         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 847 
 848         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 849             for (int i = 0; i < a.length; i += SPECIES.length()) {
 850                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 851                 av.aShiftR((int)b[i], vmask).intoArray(r, i);
 852             }
 853         }
 854 
 855         assertShiftArraysEquals(a, b, r, mask, Long128VectorTests::aShiftR_unary);
 856     }
 857 
 858 
 859     static long shiftR_unary(long a, long b) {




 860         return (long)((a >>> b));
 861     }
 862 
 863     @Test(dataProvider = "longBinaryOpProvider")
 864     static void shiftRLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 865         long[] a = fa.apply(SPECIES.length());
 866         long[] b = fb.apply(SPECIES.length());
 867         long[] r = fr.apply(SPECIES.length());
 868 
 869         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 870             for (int i = 0; i < a.length; i += SPECIES.length()) {
 871                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 872                 av.shiftR((int)b[i]).intoArray(r, i);
 873             }
 874         }
 875 
 876         assertShiftArraysEquals(a, b, r, Long128VectorTests::shiftR_unary);
 877     }
 878 
 879 
 880 
 881     @Test(dataProvider = "longBinaryOpMaskProvider")
 882     static void shiftRLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
 883                                           IntFunction<boolean[]> fm) {
 884         long[] a = fa.apply(SPECIES.length());
 885         long[] b = fb.apply(SPECIES.length());
 886         long[] r = fr.apply(SPECIES.length());
 887         boolean[] mask = fm.apply(SPECIES.length());
 888         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 889 
 890         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 891             for (int i = 0; i < a.length; i += SPECIES.length()) {
 892                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 893                 av.shiftR((int)b[i], vmask).intoArray(r, i);
 894             }
 895         }
 896 
 897         assertShiftArraysEquals(a, b, r, mask, Long128VectorTests::shiftR_unary);
 898     }
 899 
 900 
 901     static long shiftL_unary(long a, long b) {
 902         return (long)((a << b));




 903     }
 904 
 905     @Test(dataProvider = "longBinaryOpProvider")
 906     static void shiftLLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 907         long[] a = fa.apply(SPECIES.length());
 908         long[] b = fb.apply(SPECIES.length());
 909         long[] r = fr.apply(SPECIES.length());
 910 
 911         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 912             for (int i = 0; i < a.length; i += SPECIES.length()) {
 913                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 914                 av.shiftL((int)b[i]).intoArray(r, i);
 915             }
 916         }
 917 
 918         assertShiftArraysEquals(a, b, r, Long128VectorTests::shiftL_unary);
 919     }
 920 
 921 
 922 
 923     @Test(dataProvider = "longBinaryOpMaskProvider")
 924     static void shiftLLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
 925                                           IntFunction<boolean[]> fm) {
 926         long[] a = fa.apply(SPECIES.length());
 927         long[] b = fb.apply(SPECIES.length());
 928         long[] r = fr.apply(SPECIES.length());
 929         boolean[] mask = fm.apply(SPECIES.length());
 930         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 931 
 932         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 933             for (int i = 0; i < a.length; i += SPECIES.length()) {
 934                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 935                 av.shiftL((int)b[i], vmask).intoArray(r, i);
 936             }
 937         }
 938 
 939         assertShiftArraysEquals(a, b, r, mask, Long128VectorTests::shiftL_unary);
 940     }
 941 
 942 
 943 
 944 
 945 
 946 
 947 
 948 
 949 
 950 
 951 
 952 
 953 
 954     static long max(long a, long b) {
 955         return (long)(Math.max(a, b));
 956     }
 957 
 958     @Test(dataProvider = "longBinaryOpProvider")
 959     static void maxLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 960         long[] a = fa.apply(SPECIES.length());
 961         long[] b = fb.apply(SPECIES.length());
 962         long[] r = fr.apply(SPECIES.length());
 963 
 964         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 965             for (int i = 0; i < a.length; i += SPECIES.length()) {
 966                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 967                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 968                 av.max(bv).intoArray(r, i);
 969             }
 970         }
 971 
 972         assertArraysEquals(a, b, r, Long128VectorTests::max);
 973     }


 975         return (long)(Math.min(a, b));
 976     }
 977 
 978     @Test(dataProvider = "longBinaryOpProvider")
 979     static void minLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 980         long[] a = fa.apply(SPECIES.length());
 981         long[] b = fb.apply(SPECIES.length());
 982         long[] r = fr.apply(SPECIES.length());
 983 
 984         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 985             for (int i = 0; i < a.length; i += SPECIES.length()) {
 986                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 987                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 988                 av.min(bv).intoArray(r, i);
 989             }
 990         }
 991 
 992         assertArraysEquals(a, b, r, Long128VectorTests::min);
 993     }
 994 
 995     static long andAll(long[] a, int idx) {
 996         long res = -1;
 997         for (int i = idx; i < (idx + SPECIES.length()); i++) {
 998             res &= a[i];
 999         }
1000 
1001         return res;
1002     }
1003 
1004     static long andAll(long[] a) {
1005         long res = -1;
1006         for (int i = 0; i < a.length; i += SPECIES.length()) {
1007             long tmp = -1;
1008             for (int j = 0; j < SPECIES.length(); j++) {
1009                 tmp &= a[i + j];
1010             }
1011             res &= tmp;
1012         }
1013 
1014         return res;
1015     }
1016 
1017 
1018     @Test(dataProvider = "longUnaryOpProvider")
1019     static void andAllLong128VectorTests(IntFunction<long[]> fa) {
1020         long[] a = fa.apply(SPECIES.length());
1021         long[] r = fr.apply(SPECIES.length());
1022         long ra = -1;
1023 
1024         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1025             for (int i = 0; i < a.length; i += SPECIES.length()) {
1026                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1027                 r[i] = av.andAll();
1028             }
1029         }
1030 
1031         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1032             ra = -1;
1033             for (int i = 0; i < a.length; i += SPECIES.length()) {
1034                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1035                 ra &= av.andAll();
1036             }
1037         }
1038 
1039         assertReductionArraysEquals(a, r, ra, Long128VectorTests::andAll, Long128VectorTests::andAll);
1040     }
1041 
1042 
1043     static long orAll(long[] a, int idx) {
1044         long res = 0;
1045         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1046             res |= a[i];
1047         }
1048 
1049         return res;
1050     }
1051 
1052     static long orAll(long[] a) {
1053         long res = 0;
1054         for (int i = 0; i < a.length; i += SPECIES.length()) {
1055             long tmp = 0;
1056             for (int j = 0; j < SPECIES.length(); j++) {
1057                 tmp |= a[i + j];
1058             }
1059             res |= tmp;
1060         }
1061 
1062         return res;
1063     }
1064 
1065 
1066     @Test(dataProvider = "longUnaryOpProvider")
1067     static void orAllLong128VectorTests(IntFunction<long[]> fa) {
1068         long[] a = fa.apply(SPECIES.length());
1069         long[] r = fr.apply(SPECIES.length());
1070         long ra = 0;
1071 
1072         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1073             for (int i = 0; i < a.length; i += SPECIES.length()) {
1074                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1075                 r[i] = av.orAll();
1076             }
1077         }
1078 
1079         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1080             ra = 0;
1081             for (int i = 0; i < a.length; i += SPECIES.length()) {
1082                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1083                 ra |= av.orAll();
1084             }
1085         }
1086 
1087         assertReductionArraysEquals(a, r, ra, Long128VectorTests::orAll, Long128VectorTests::orAll);
1088     }
1089 
1090 
1091     static long xorAll(long[] a, int idx) {
1092         long res = 0;
1093         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1094             res ^= a[i];
1095         }
1096 
1097         return res;
1098     }
1099 
1100     static long xorAll(long[] a) {
1101         long res = 0;
1102         for (int i = 0; i < a.length; i += SPECIES.length()) {
1103             long tmp = 0;
1104             for (int j = 0; j < SPECIES.length(); j++) {
1105                 tmp ^= a[i + j];
1106             }
1107             res ^= tmp;
1108         }
1109 
1110         return res;
1111     }
1112 
1113 
1114     @Test(dataProvider = "longUnaryOpProvider")
1115     static void xorAllLong128VectorTests(IntFunction<long[]> fa) {
1116         long[] a = fa.apply(SPECIES.length());
1117         long[] r = fr.apply(SPECIES.length());
1118         long ra = 0;
1119 
1120         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1121             for (int i = 0; i < a.length; i += SPECIES.length()) {
1122                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1123                 r[i] = av.xorAll();
1124             }
1125         }
1126 
1127         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1128             ra = 0;
1129             for (int i = 0; i < a.length; i += SPECIES.length()) {
1130                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1131                 ra ^= av.xorAll();
1132             }
1133         }
1134 
1135         assertReductionArraysEquals(a, r, ra, Long128VectorTests::xorAll, Long128VectorTests::xorAll);
1136     }
1137 
1138     static long addAll(long[] a, int idx) {
1139         long res = 0;
1140         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1141             res += a[i];
1142         }
1143 
1144         return res;
1145     }
1146 
1147     static long addAll(long[] a) {
1148         long res = 0;
1149         for (int i = 0; i < a.length; i += SPECIES.length()) {
1150             long tmp = 0;
1151             for (int j = 0; j < SPECIES.length(); j++) {
1152                 tmp += a[i + j];
1153             }
1154             res += tmp;
1155         }
1156 
1157         return res;
1158     }
1159     @Test(dataProvider = "longUnaryOpProvider")
1160     static void addAllLong128VectorTests(IntFunction<long[]> fa) {
1161         long[] a = fa.apply(SPECIES.length());
1162         long[] r = fr.apply(SPECIES.length());
1163         long ra = 0;
1164 
1165         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1166             for (int i = 0; i < a.length; i += SPECIES.length()) {
1167                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1168                 r[i] = av.addAll();
1169             }
1170         }
1171 
1172         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1173             ra = 0;
1174             for (int i = 0; i < a.length; i += SPECIES.length()) {
1175                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1176                 ra += av.addAll();
1177             }
1178         }
1179 
1180         assertReductionArraysEquals(a, r, ra, Long128VectorTests::addAll, Long128VectorTests::addAll);
1181     }
1182     static long mulAll(long[] a, int idx) {
1183         long res = 1;
1184         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1185             res *= a[i];
1186         }
1187 
1188         return res;
1189     }
1190 
1191     static long mulAll(long[] a) {
1192         long res = 1;
1193         for (int i = 0; i < a.length; i += SPECIES.length()) {
1194             long tmp = 1;
1195             for (int j = 0; j < SPECIES.length(); j++) {
1196                 tmp *= a[i + j];
1197             }
1198             res *= tmp;
1199         }
1200 
1201         return res;
1202     }
1203     @Test(dataProvider = "longUnaryOpProvider")
1204     static void mulAllLong128VectorTests(IntFunction<long[]> fa) {
1205         long[] a = fa.apply(SPECIES.length());
1206         long[] r = fr.apply(SPECIES.length());
1207         long ra = 1;
1208 
1209         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1210             for (int i = 0; i < a.length; i += SPECIES.length()) {
1211                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1212                 r[i] = av.mulAll();
1213             }
1214         }
1215 
1216         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1217             ra = 1;
1218             for (int i = 0; i < a.length; i += SPECIES.length()) {
1219                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1220                 ra *= av.mulAll();
1221             }
1222         }
1223 
1224         assertReductionArraysEquals(a, r, ra, Long128VectorTests::mulAll, Long128VectorTests::mulAll);
1225     }
1226     static long minAll(long[] a, int idx) {
1227         long res = Long.MAX_VALUE;
1228         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1229             res = (long)Math.min(res, a[i]);
1230         }
1231 
1232         return res;
1233     }
1234 
1235     static long minAll(long[] a) {
1236         long res = Long.MAX_VALUE;
1237         for (int i = 0; i < a.length; i++) {
1238             res = (long)Math.min(res, a[i]);
1239         }
1240 
1241         return res;
1242     }
1243     @Test(dataProvider = "longUnaryOpProvider")
1244     static void minAllLong128VectorTests(IntFunction<long[]> fa) {
1245         long[] a = fa.apply(SPECIES.length());
1246         long[] r = fr.apply(SPECIES.length());
1247         long ra = Long.MAX_VALUE;
1248 
1249         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1250             for (int i = 0; i < a.length; i += SPECIES.length()) {
1251                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1252                 r[i] = av.minAll();
1253             }
1254         }
1255 
1256         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1257             ra = Long.MAX_VALUE;
1258             for (int i = 0; i < a.length; i += SPECIES.length()) {
1259                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1260                 ra = (long)Math.min(ra, av.minAll());
1261             }
1262         }
1263 
1264         assertReductionArraysEquals(a, r, ra, Long128VectorTests::minAll, Long128VectorTests::minAll);
1265     }
1266     static long maxAll(long[] a, int idx) {
1267         long res = Long.MIN_VALUE;
1268         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1269             res = (long)Math.max(res, a[i]);
1270         }
1271 
1272         return res;
1273     }
1274 
1275     static long maxAll(long[] a) {
1276         long res = Long.MIN_VALUE;
1277         for (int i = 0; i < a.length; i++) {
1278             res = (long)Math.max(res, a[i]);
1279         }
1280 
1281         return res;
1282     }
1283     @Test(dataProvider = "longUnaryOpProvider")
1284     static void maxAllLong128VectorTests(IntFunction<long[]> fa) {
1285         long[] a = fa.apply(SPECIES.length());
1286         long[] r = fr.apply(SPECIES.length());
1287         long ra = Long.MIN_VALUE;
1288 
1289         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1290             for (int i = 0; i < a.length; i += SPECIES.length()) {
1291                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1292                 r[i] = av.maxAll();
1293             }
1294         }
1295 
1296         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1297             ra = Long.MIN_VALUE;
1298             for (int i = 0; i < a.length; i += SPECIES.length()) {
1299                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1300                 ra = (long)Math.max(ra, av.maxAll());
1301             }
1302         }
1303 
1304         assertReductionArraysEquals(a, r, ra, Long128VectorTests::maxAll, Long128VectorTests::maxAll);
1305     }
1306 
1307     static boolean anyTrue(boolean[] a, int idx) {
1308         boolean res = false;
1309         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1310             res |= a[i];
1311         }
1312 
1313         return res;
1314     }
1315 
1316 
1317     @Test(dataProvider = "boolUnaryOpProvider")
1318     static void anyTrueLong128VectorTests(IntFunction<boolean[]> fm) {
1319         boolean[] mask = fm.apply(SPECIES.length());
1320         boolean[] r = fmr.apply(SPECIES.length());
1321 
1322         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1323             for (int i = 0; i < mask.length; i += SPECIES.length()) {
1324                 VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, i);




 665     static void xorLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb,
 666                                           IntFunction<boolean[]> fm) {
 667         long[] a = fa.apply(SPECIES.length());
 668         long[] b = fb.apply(SPECIES.length());
 669         long[] r = fr.apply(SPECIES.length());
 670         boolean[] mask = fm.apply(SPECIES.length());
 671         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 672 
 673         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 674             for (int i = 0; i < a.length; i += SPECIES.length()) {
 675                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 676                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 677                 av.xor(bv, vmask).intoArray(r, i);
 678             }
 679         }
 680 
 681         assertArraysEquals(a, b, r, mask, Long128VectorTests::xor);
 682     }
 683 
 684 
 685     static long shiftLeft(long a, long b) {
 686         return (long)((a << b));
 687     }
 688 
 689     @Test(dataProvider = "longBinaryOpProvider")
 690     static void shiftLeftLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 691         long[] a = fa.apply(SPECIES.length());
 692         long[] b = fb.apply(SPECIES.length());
 693         long[] r = fr.apply(SPECIES.length());
 694 
 695         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 696             for (int i = 0; i < a.length; i += SPECIES.length()) {
 697                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 698                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 699                 av.shiftLeft(bv).intoArray(r, i);
 700             }
 701         }
 702 
 703         assertArraysEquals(a, b, r, Long128VectorTests::shiftLeft);
 704     }
 705 
 706 
 707 
 708     @Test(dataProvider = "longBinaryOpMaskProvider")
 709     static void shiftLeftLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb,
 710                                           IntFunction<boolean[]> fm) {
 711         long[] a = fa.apply(SPECIES.length());
 712         long[] b = fb.apply(SPECIES.length());
 713         long[] r = fr.apply(SPECIES.length());
 714         boolean[] mask = fm.apply(SPECIES.length());
 715         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 716 
 717         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 718             for (int i = 0; i < a.length; i += SPECIES.length()) {
 719                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 720                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 721                 av.shiftLeft(bv, vmask).intoArray(r, i);
 722             }
 723         }
 724 
 725         assertArraysEquals(a, b, r, mask, Long128VectorTests::shiftLeft);
 726     }
 727 
 728 
 729 
 730 
 731 
 732 
 733     static long shiftRight(long a, long b) {
 734         return (long)((a >>> b));
 735     }
 736 
 737     @Test(dataProvider = "longBinaryOpProvider")
 738     static void shiftRightLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 739         long[] a = fa.apply(SPECIES.length());
 740         long[] b = fb.apply(SPECIES.length());
 741         long[] r = fr.apply(SPECIES.length());
 742 
 743         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 744             for (int i = 0; i < a.length; i += SPECIES.length()) {
 745                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 746                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 747                 av.shiftRight(bv).intoArray(r, i);
 748             }
 749         }
 750 
 751         assertArraysEquals(a, b, r, Long128VectorTests::shiftRight);
 752     }
 753 
 754 
 755 
 756     @Test(dataProvider = "longBinaryOpMaskProvider")
 757     static void shiftRightLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb,
 758                                           IntFunction<boolean[]> fm) {
 759         long[] a = fa.apply(SPECIES.length());
 760         long[] b = fb.apply(SPECIES.length());
 761         long[] r = fr.apply(SPECIES.length());
 762         boolean[] mask = fm.apply(SPECIES.length());
 763         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 764 
 765         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 766             for (int i = 0; i < a.length; i += SPECIES.length()) {
 767                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 768                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 769                 av.shiftRight(bv, vmask).intoArray(r, i);
 770             }
 771         }
 772 
 773         assertArraysEquals(a, b, r, mask, Long128VectorTests::shiftRight);
 774     }
 775 
 776 
 777 
 778 
 779 
 780 
 781     static long shiftArithmeticRight(long a, long b) {
 782         return (long)((a >> b));
 783     }
 784 
 785     @Test(dataProvider = "longBinaryOpProvider")
 786     static void shiftArithmeticRightLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 787         long[] a = fa.apply(SPECIES.length());
 788         long[] b = fb.apply(SPECIES.length());
 789         long[] r = fr.apply(SPECIES.length());
 790 
 791         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 792             for (int i = 0; i < a.length; i += SPECIES.length()) {
 793                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 794                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 795                 av.shiftArithmeticRight(bv).intoArray(r, i);
 796             }
 797         }
 798 
 799         assertArraysEquals(a, b, r, Long128VectorTests::shiftArithmeticRight);
 800     }
 801 
 802 
 803 
 804     @Test(dataProvider = "longBinaryOpMaskProvider")
 805     static void shiftArithmeticRightLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb,
 806                                           IntFunction<boolean[]> fm) {
 807         long[] a = fa.apply(SPECIES.length());
 808         long[] b = fb.apply(SPECIES.length());
 809         long[] r = fr.apply(SPECIES.length());
 810         boolean[] mask = fm.apply(SPECIES.length());
 811         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 812 
 813         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 814             for (int i = 0; i < a.length; i += SPECIES.length()) {
 815                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 816                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 817                 av.shiftArithmeticRight(bv, vmask).intoArray(r, i);
 818             }
 819         }
 820 
 821         assertArraysEquals(a, b, r, mask, Long128VectorTests::shiftArithmeticRight);
 822     }
 823 
 824 
 825 
 826 
 827 
 828 
 829     static long shiftLeft_unary(long a, long b) {
 830         return (long)((a << b));
 831     }
 832 
 833     @Test(dataProvider = "longBinaryOpProvider")
 834     static void shiftLeftLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 835         long[] a = fa.apply(SPECIES.length());
 836         long[] b = fb.apply(SPECIES.length());
 837         long[] r = fr.apply(SPECIES.length());
 838 
 839         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 840             for (int i = 0; i < a.length; i += SPECIES.length()) {
 841                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 842                 av.shiftLeft((int)b[i]).intoArray(r, i);
 843             }
 844         }
 845 
 846         assertShiftArraysEquals(a, b, r, Long128VectorTests::shiftLeft_unary);
 847     }
 848 
 849 
 850 
 851     @Test(dataProvider = "longBinaryOpMaskProvider")
 852     static void shiftLeftLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
 853                                           IntFunction<boolean[]> fm) {
 854         long[] a = fa.apply(SPECIES.length());
 855         long[] b = fb.apply(SPECIES.length());
 856         long[] r = fr.apply(SPECIES.length());
 857         boolean[] mask = fm.apply(SPECIES.length());
 858         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 859 
 860         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 861             for (int i = 0; i < a.length; i += SPECIES.length()) {
 862                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 863                 av.shiftLeft((int)b[i], vmask).intoArray(r, i);
 864             }
 865         }
 866 
 867         assertShiftArraysEquals(a, b, r, mask, Long128VectorTests::shiftLeft_unary);
 868     }
 869 
 870 
 871 
 872 
 873 
 874 
 875     static long shiftRight_unary(long a, long b) {
 876         return (long)((a >>> b));
 877     }
 878 
 879     @Test(dataProvider = "longBinaryOpProvider")
 880     static void shiftRightLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 881         long[] a = fa.apply(SPECIES.length());
 882         long[] b = fb.apply(SPECIES.length());
 883         long[] r = fr.apply(SPECIES.length());
 884 
 885         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 886             for (int i = 0; i < a.length; i += SPECIES.length()) {
 887                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 888                 av.shiftRight((int)b[i]).intoArray(r, i);
 889             }
 890         }
 891 
 892         assertShiftArraysEquals(a, b, r, Long128VectorTests::shiftRight_unary);
 893     }
 894 
 895 
 896 
 897     @Test(dataProvider = "longBinaryOpMaskProvider")
 898     static void shiftRightLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
 899                                           IntFunction<boolean[]> fm) {
 900         long[] a = fa.apply(SPECIES.length());
 901         long[] b = fb.apply(SPECIES.length());
 902         long[] r = fr.apply(SPECIES.length());
 903         boolean[] mask = fm.apply(SPECIES.length());
 904         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 905 
 906         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 907             for (int i = 0; i < a.length; i += SPECIES.length()) {
 908                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 909                 av.shiftRight((int)b[i], vmask).intoArray(r, i);
 910             }
 911         }
 912 
 913         assertShiftArraysEquals(a, b, r, mask, Long128VectorTests::shiftRight_unary);
 914     }
 915 
 916 
 917 
 918 
 919 
 920 
 921     static long shiftArithmeticRight_unary(long a, long b) {
 922         return (long)((a >> b));
 923     }
 924 
 925     @Test(dataProvider = "longBinaryOpProvider")
 926     static void shiftArithmeticRightLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 927         long[] a = fa.apply(SPECIES.length());
 928         long[] b = fb.apply(SPECIES.length());
 929         long[] r = fr.apply(SPECIES.length());
 930 
 931         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 932             for (int i = 0; i < a.length; i += SPECIES.length()) {
 933                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 934                 av.shiftArithmeticRight((int)b[i]).intoArray(r, i);
 935             }
 936         }
 937 
 938         assertShiftArraysEquals(a, b, r, Long128VectorTests::shiftArithmeticRight_unary);
 939     }
 940 
 941 
 942 
 943     @Test(dataProvider = "longBinaryOpMaskProvider")
 944     static void shiftArithmeticRightLong128VectorTestsShift(IntFunction<long[]> fa, IntFunction<long[]> fb,
 945                                           IntFunction<boolean[]> fm) {
 946         long[] a = fa.apply(SPECIES.length());
 947         long[] b = fb.apply(SPECIES.length());
 948         long[] r = fr.apply(SPECIES.length());
 949         boolean[] mask = fm.apply(SPECIES.length());
 950         VectorMask<Long> vmask = VectorMask.fromValues(SPECIES, mask);
 951 
 952         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 953             for (int i = 0; i < a.length; i += SPECIES.length()) {
 954                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 955                 av.shiftArithmeticRight((int)b[i], vmask).intoArray(r, i);
 956             }
 957         }
 958 
 959         assertShiftArraysEquals(a, b, r, mask, Long128VectorTests::shiftArithmeticRight_unary);
 960     }
 961 
 962 
 963 
 964 
 965 








 966     static long max(long a, long b) {
 967         return (long)(Math.max(a, b));
 968     }
 969 
 970     @Test(dataProvider = "longBinaryOpProvider")
 971     static void maxLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 972         long[] a = fa.apply(SPECIES.length());
 973         long[] b = fb.apply(SPECIES.length());
 974         long[] r = fr.apply(SPECIES.length());
 975 
 976         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 977             for (int i = 0; i < a.length; i += SPECIES.length()) {
 978                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 979                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
 980                 av.max(bv).intoArray(r, i);
 981             }
 982         }
 983 
 984         assertArraysEquals(a, b, r, Long128VectorTests::max);
 985     }


 987         return (long)(Math.min(a, b));
 988     }
 989 
 990     @Test(dataProvider = "longBinaryOpProvider")
 991     static void minLong128VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
 992         long[] a = fa.apply(SPECIES.length());
 993         long[] b = fb.apply(SPECIES.length());
 994         long[] r = fr.apply(SPECIES.length());
 995 
 996         for (int ic = 0; ic < INVOC_COUNT; ic++) {
 997             for (int i = 0; i < a.length; i += SPECIES.length()) {
 998                 LongVector av = LongVector.fromArray(SPECIES, a, i);
 999                 LongVector bv = LongVector.fromArray(SPECIES, b, i);
1000                 av.min(bv).intoArray(r, i);
1001             }
1002         }
1003 
1004         assertArraysEquals(a, b, r, Long128VectorTests::min);
1005     }
1006 
1007     static long andLanes(long[] a, int idx) {
1008         long res = -1;
1009         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1010             res &= a[i];
1011         }
1012 
1013         return res;
1014     }
1015 
1016     static long andLanes(long[] a) {
1017         long res = -1;
1018         for (int i = 0; i < a.length; i += SPECIES.length()) {
1019             long tmp = -1;
1020             for (int j = 0; j < SPECIES.length(); j++) {
1021                 tmp &= a[i + j];
1022             }
1023             res &= tmp;
1024         }
1025 
1026         return res;
1027     }
1028 
1029 
1030     @Test(dataProvider = "longUnaryOpProvider")
1031     static void andLanesLong128VectorTests(IntFunction<long[]> fa) {
1032         long[] a = fa.apply(SPECIES.length());
1033         long[] r = fr.apply(SPECIES.length());
1034         long ra = -1;
1035 
1036         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1037             for (int i = 0; i < a.length; i += SPECIES.length()) {
1038                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1039                 r[i] = av.andLanes();
1040             }
1041         }
1042 
1043         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1044             ra = -1;
1045             for (int i = 0; i < a.length; i += SPECIES.length()) {
1046                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1047                 ra &= av.andLanes();
1048             }
1049         }
1050 
1051         assertReductionArraysEquals(a, r, ra, Long128VectorTests::andLanes, Long128VectorTests::andLanes);
1052     }
1053 
1054 
1055     static long orLanes(long[] a, int idx) {
1056         long res = 0;
1057         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1058             res |= a[i];
1059         }
1060 
1061         return res;
1062     }
1063 
1064     static long orLanes(long[] a) {
1065         long res = 0;
1066         for (int i = 0; i < a.length; i += SPECIES.length()) {
1067             long tmp = 0;
1068             for (int j = 0; j < SPECIES.length(); j++) {
1069                 tmp |= a[i + j];
1070             }
1071             res |= tmp;
1072         }
1073 
1074         return res;
1075     }
1076 
1077 
1078     @Test(dataProvider = "longUnaryOpProvider")
1079     static void orLanesLong128VectorTests(IntFunction<long[]> fa) {
1080         long[] a = fa.apply(SPECIES.length());
1081         long[] r = fr.apply(SPECIES.length());
1082         long ra = 0;
1083 
1084         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1085             for (int i = 0; i < a.length; i += SPECIES.length()) {
1086                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1087                 r[i] = av.orLanes();
1088             }
1089         }
1090 
1091         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1092             ra = 0;
1093             for (int i = 0; i < a.length; i += SPECIES.length()) {
1094                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1095                 ra |= av.orLanes();
1096             }
1097         }
1098 
1099         assertReductionArraysEquals(a, r, ra, Long128VectorTests::orLanes, Long128VectorTests::orLanes);
1100     }
1101 
1102 
1103     static long xorLanes(long[] a, int idx) {
1104         long res = 0;
1105         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1106             res ^= a[i];
1107         }
1108 
1109         return res;
1110     }
1111 
1112     static long xorLanes(long[] a) {
1113         long res = 0;
1114         for (int i = 0; i < a.length; i += SPECIES.length()) {
1115             long tmp = 0;
1116             for (int j = 0; j < SPECIES.length(); j++) {
1117                 tmp ^= a[i + j];
1118             }
1119             res ^= tmp;
1120         }
1121 
1122         return res;
1123     }
1124 
1125 
1126     @Test(dataProvider = "longUnaryOpProvider")
1127     static void xorLanesLong128VectorTests(IntFunction<long[]> fa) {
1128         long[] a = fa.apply(SPECIES.length());
1129         long[] r = fr.apply(SPECIES.length());
1130         long ra = 0;
1131 
1132         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1133             for (int i = 0; i < a.length; i += SPECIES.length()) {
1134                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1135                 r[i] = av.xorLanes();
1136             }
1137         }
1138 
1139         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1140             ra = 0;
1141             for (int i = 0; i < a.length; i += SPECIES.length()) {
1142                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1143                 ra ^= av.xorLanes();
1144             }
1145         }
1146 
1147         assertReductionArraysEquals(a, r, ra, Long128VectorTests::xorLanes, Long128VectorTests::xorLanes);
1148     }
1149 
1150     static long addLanes(long[] a, int idx) {
1151         long res = 0;
1152         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1153             res += a[i];
1154         }
1155 
1156         return res;
1157     }
1158 
1159     static long addLanes(long[] a) {
1160         long res = 0;
1161         for (int i = 0; i < a.length; i += SPECIES.length()) {
1162             long tmp = 0;
1163             for (int j = 0; j < SPECIES.length(); j++) {
1164                 tmp += a[i + j];
1165             }
1166             res += tmp;
1167         }
1168 
1169         return res;
1170     }
1171     @Test(dataProvider = "longUnaryOpProvider")
1172     static void addLanesLong128VectorTests(IntFunction<long[]> fa) {
1173         long[] a = fa.apply(SPECIES.length());
1174         long[] r = fr.apply(SPECIES.length());
1175         long ra = 0;
1176 
1177         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1178             for (int i = 0; i < a.length; i += SPECIES.length()) {
1179                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1180                 r[i] = av.addLanes();
1181             }
1182         }
1183 
1184         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1185             ra = 0;
1186             for (int i = 0; i < a.length; i += SPECIES.length()) {
1187                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1188                 ra += av.addLanes();
1189             }
1190         }
1191 
1192         assertReductionArraysEquals(a, r, ra, Long128VectorTests::addLanes, Long128VectorTests::addLanes);
1193     }
1194     static long mulLanes(long[] a, int idx) {
1195         long res = 1;
1196         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1197             res *= a[i];
1198         }
1199 
1200         return res;
1201     }
1202 
1203     static long mulLanes(long[] a) {
1204         long res = 1;
1205         for (int i = 0; i < a.length; i += SPECIES.length()) {
1206             long tmp = 1;
1207             for (int j = 0; j < SPECIES.length(); j++) {
1208                 tmp *= a[i + j];
1209             }
1210             res *= tmp;
1211         }
1212 
1213         return res;
1214     }
1215     @Test(dataProvider = "longUnaryOpProvider")
1216     static void mulLanesLong128VectorTests(IntFunction<long[]> fa) {
1217         long[] a = fa.apply(SPECIES.length());
1218         long[] r = fr.apply(SPECIES.length());
1219         long ra = 1;
1220 
1221         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1222             for (int i = 0; i < a.length; i += SPECIES.length()) {
1223                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1224                 r[i] = av.mulLanes();
1225             }
1226         }
1227 
1228         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1229             ra = 1;
1230             for (int i = 0; i < a.length; i += SPECIES.length()) {
1231                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1232                 ra *= av.mulLanes();
1233             }
1234         }
1235 
1236         assertReductionArraysEquals(a, r, ra, Long128VectorTests::mulLanes, Long128VectorTests::mulLanes);
1237     }
1238     static long minLanes(long[] a, int idx) {
1239         long res = Long.MAX_VALUE;
1240         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1241             res = (long)Math.min(res, a[i]);
1242         }
1243 
1244         return res;
1245     }
1246 
1247     static long minLanes(long[] a) {
1248         long res = Long.MAX_VALUE;
1249         for (int i = 0; i < a.length; i++) {
1250             res = (long)Math.min(res, a[i]);
1251         }
1252 
1253         return res;
1254     }
1255     @Test(dataProvider = "longUnaryOpProvider")
1256     static void minLanesLong128VectorTests(IntFunction<long[]> fa) {
1257         long[] a = fa.apply(SPECIES.length());
1258         long[] r = fr.apply(SPECIES.length());
1259         long ra = Long.MAX_VALUE;
1260 
1261         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1262             for (int i = 0; i < a.length; i += SPECIES.length()) {
1263                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1264                 r[i] = av.minLanes();
1265             }
1266         }
1267 
1268         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1269             ra = Long.MAX_VALUE;
1270             for (int i = 0; i < a.length; i += SPECIES.length()) {
1271                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1272                 ra = (long)Math.min(ra, av.minLanes());
1273             }
1274         }
1275 
1276         assertReductionArraysEquals(a, r, ra, Long128VectorTests::minLanes, Long128VectorTests::minLanes);
1277     }
1278     static long maxLanes(long[] a, int idx) {
1279         long res = Long.MIN_VALUE;
1280         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1281             res = (long)Math.max(res, a[i]);
1282         }
1283 
1284         return res;
1285     }
1286 
1287     static long maxLanes(long[] a) {
1288         long res = Long.MIN_VALUE;
1289         for (int i = 0; i < a.length; i++) {
1290             res = (long)Math.max(res, a[i]);
1291         }
1292 
1293         return res;
1294     }
1295     @Test(dataProvider = "longUnaryOpProvider")
1296     static void maxLanesLong128VectorTests(IntFunction<long[]> fa) {
1297         long[] a = fa.apply(SPECIES.length());
1298         long[] r = fr.apply(SPECIES.length());
1299         long ra = Long.MIN_VALUE;
1300 
1301         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1302             for (int i = 0; i < a.length; i += SPECIES.length()) {
1303                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1304                 r[i] = av.maxLanes();
1305             }
1306         }
1307 
1308         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1309             ra = Long.MIN_VALUE;
1310             for (int i = 0; i < a.length; i += SPECIES.length()) {
1311                 LongVector av = LongVector.fromArray(SPECIES, a, i);
1312                 ra = (long)Math.max(ra, av.maxLanes());
1313             }
1314         }
1315 
1316         assertReductionArraysEquals(a, r, ra, Long128VectorTests::maxLanes, Long128VectorTests::maxLanes);
1317     }
1318 
1319     static boolean anyTrue(boolean[] a, int idx) {
1320         boolean res = false;
1321         for (int i = idx; i < (idx + SPECIES.length()); i++) {
1322             res |= a[i];
1323         }
1324 
1325         return res;
1326     }
1327 
1328 
1329     @Test(dataProvider = "boolUnaryOpProvider")
1330     static void anyTrueLong128VectorTests(IntFunction<boolean[]> fm) {
1331         boolean[] mask = fm.apply(SPECIES.length());
1332         boolean[] r = fmr.apply(SPECIES.length());
1333 
1334         for (int ic = 0; ic < INVOC_COUNT; ic++) {
1335             for (int i = 0; i < mask.length; i += SPECIES.length()) {
1336                 VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, i);


< prev index next >