< prev index next >

test/jdk/jdk/incubator/vector/LongMaxVectorTests.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


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




 735     }
 736 
 737     @Test(dataProvider = "longBinaryOpProvider")
 738     static void shiftLLongMaxVectorTests(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.shiftL(bv).intoArray(r, i);
 748             }
 749         }
 750 
 751         assertArraysEquals(a, b, r, LongMaxVectorTests::shiftL);
 752     }
 753 
 754 
 755 
 756     @Test(dataProvider = "longBinaryOpMaskProvider")
 757     static void shiftLLongMaxVectorTests(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.shiftL(bv, vmask).intoArray(r, i);
 770             }
 771         }
 772 
 773         assertArraysEquals(a, b, r, mask, LongMaxVectorTests::shiftL);
 774     }
 775 
 776 
 777     static long aShiftR(long a, long b) {




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




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




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




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


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




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








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


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


< prev index next >